@shopify/create-app 3.81.2 → 3.82.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
@@ -8,7 +8,7 @@ import {
8
8
  errorHandler,
9
9
  registerCleanBugsnagErrorsFromWithinPlugins,
10
10
  require_end_of_stream
11
- } from "./chunk-YFBX3GUL.js";
11
+ } from "./chunk-6OWK7KKO.js";
12
12
  import {
13
13
  setNextDeprecationDate
14
14
  } from "./chunk-CP3BRHWK.js";
@@ -17,11 +17,11 @@ import {
17
17
  getListOfTunnelPlugins,
18
18
  reportAnalyticsEvent,
19
19
  requestIdsCollection
20
- } from "./chunk-CVOLR6M5.js";
20
+ } from "./chunk-ZIXYVUD6.js";
21
21
  import {
22
22
  setCurrentCommandId,
23
23
  showNotificationsIfNeeded
24
- } from "./chunk-CSOJOXW2.js";
24
+ } from "./chunk-TNRWP2XN.js";
25
25
  import {
26
26
  CLI_KIT_VERSION,
27
27
  ClientError,
@@ -69,7 +69,7 @@ import {
69
69
  setLastSeenUserIdAfterAuth,
70
70
  shopifyFetch,
71
71
  z
72
- } from "./chunk-GGWHB6LL.js";
72
+ } from "./chunk-H2RMSP56.js";
73
73
  import "./chunk-25IMI7TH.js";
74
74
  import {
75
75
  LocalStorage,
@@ -94,7 +94,7 @@ import {
94
94
  usesWorkspaces,
95
95
  versionSatisfies,
96
96
  writePackageJSON
97
- } from "./chunk-YJPO3M7O.js";
97
+ } from "./chunk-4ZPIFK7H.js";
98
98
  import {
99
99
  AbortController as AbortController2,
100
100
  AbortError,
@@ -286,7 +286,7 @@ import {
286
286
  username,
287
287
  writeFile,
288
288
  writeFileSync
289
- } from "./chunk-NEIKNULL.js";
289
+ } from "./chunk-75QMAARJ.js";
290
290
  import {
291
291
  require_brace_expansion,
292
292
  require_commonjs,
@@ -4117,7 +4117,7 @@ var init_strings = __esm({
4117
4117
  });
4118
4118
 
4119
4119
  // ../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js
4120
- var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command2, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, StringValue, InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, SelectedCompletionInfo, InlineCompletionContext, WorkspaceFolder, TextDocument, FullTextDocument, Is, init_main2 = __esm({
4120
+ var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, StringValue, InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, SelectedCompletionInfo, InlineCompletionContext, WorkspaceFolder, TextDocument, FullTextDocument, Is, init_main2 = __esm({
4121
4121
  "../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"() {
4122
4122
  "use strict";
4123
4123
  init_cjs_shims();
@@ -4309,7 +4309,7 @@ var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink
4309
4309
  return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
4310
4310
  }
4311
4311
  Command4.is = is;
4312
- })(Command2 || (Command2 = {}));
4312
+ })(Command || (Command = {}));
4313
4313
  (function(TextEdit3) {
4314
4314
  function replace(range, newText) {
4315
4315
  return { range, newText };
@@ -4635,12 +4635,12 @@ var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink
4635
4635
  (function(CodeAction3) {
4636
4636
  function create(title, kindOrCommandOrEdit, kind) {
4637
4637
  let result = { title }, checkKind = !0;
4638
- return typeof kindOrCommandOrEdit == "string" ? (checkKind = !1, result.kind = kindOrCommandOrEdit) : Command2.is(kindOrCommandOrEdit) ? result.command = kindOrCommandOrEdit : result.edit = kindOrCommandOrEdit, checkKind && kind !== void 0 && (result.kind = kind), result;
4638
+ return typeof kindOrCommandOrEdit == "string" ? (checkKind = !1, result.kind = kindOrCommandOrEdit) : Command.is(kindOrCommandOrEdit) ? result.command = kindOrCommandOrEdit : result.edit = kindOrCommandOrEdit, checkKind && kind !== void 0 && (result.kind = kind), result;
4639
4639
  }
4640
4640
  CodeAction3.create = create;
4641
4641
  function is(value) {
4642
4642
  let candidate = value;
4643
- return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command2.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
4643
+ return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
4644
4644
  }
4645
4645
  CodeAction3.is = is;
4646
4646
  })(CodeAction || (CodeAction = {}));
@@ -4652,7 +4652,7 @@ var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink
4652
4652
  CodeLens3.create = create;
4653
4653
  function is(value) {
4654
4654
  let candidate = value;
4655
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command2.is(candidate.command));
4655
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
4656
4656
  }
4657
4657
  CodeLens3.is = is;
4658
4658
  })(CodeLens || (CodeLens = {}));
@@ -4760,7 +4760,7 @@ var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink
4760
4760
  InlayHintLabelPart3.create = create;
4761
4761
  function is(value) {
4762
4762
  let candidate = value;
4763
- return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command2.is(candidate.command));
4763
+ return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command));
4764
4764
  }
4765
4765
  InlayHintLabelPart3.is = is;
4766
4766
  })(InlayHintLabelPart || (InlayHintLabelPart = {}));
@@ -8757,7 +8757,7 @@ __export(jsonLanguageService_exports, {
8757
8757
  Color: () => Color,
8758
8758
  ColorInformation: () => ColorInformation,
8759
8759
  ColorPresentation: () => ColorPresentation,
8760
- Command: () => Command2,
8760
+ Command: () => Command,
8761
8761
  CompletionItem: () => CompletionItem,
8762
8762
  CompletionItemKind: () => CompletionItemKind,
8763
8763
  CompletionItemTag: () => CompletionItemTag,
@@ -75032,7 +75032,7 @@ var l10n13, CSSCodeActions, init_cssCodeActions = __esm({
75032
75032
  doCodeActions(document2, range, context, stylesheet) {
75033
75033
  return this.doCodeActions2(document2, range, context, stylesheet).map((ca) => {
75034
75034
  let textDocumentEdit = ca.edit && ca.edit.documentChanges && ca.edit.documentChanges[0];
75035
- return Command2.create(ca.title, "_css.applyCodeAction", document2.uri, document2.version, textDocumentEdit && textDocumentEdit.edits);
75035
+ return Command.create(ca.title, "_css.applyCodeAction", document2.uri, document2.version, textDocumentEdit && textDocumentEdit.edits);
75036
75036
  });
75037
75037
  }
75038
75038
  doCodeActions2(document2, range, context, stylesheet) {
@@ -104871,7 +104871,7 @@ __export(cssLanguageService_exports, {
104871
104871
  Color: () => Color,
104872
104872
  ColorInformation: () => ColorInformation,
104873
104873
  ColorPresentation: () => ColorPresentation,
104874
- Command: () => Command2,
104874
+ Command: () => Command,
104875
104875
  CompletionItem: () => CompletionItem,
104876
104876
  CompletionItemKind: () => CompletionItemKind,
104877
104877
  CompletionItemTag: () => CompletionItemTag,
@@ -188546,7 +188546,6 @@ var environmentVariableNames = {
188546
188546
  enableAppLogPolling: "SHOPIFY_CLI_ENABLE_APP_LOG_POLLING",
188547
188547
  templatesJsonPath: "SHOPIFY_CLI_APP_TEMPLATES_JSON_PATH",
188548
188548
  mkcertBinaryPath: "SHOPIFY_CLI_MKCERT_BINARY",
188549
- enableUnsupportedConfigPropertyChecks: "SHOPIFY_CLI_ENABLE_UNSUPPORTED_CONFIG_PROPERTY_CHECKS",
188550
188549
  disableUnsupportedConfigPropertyChecks: "SHOPIFY_CLI_DISABLE_UNSUPPORTED_CONFIG_PROPERTY_CHECKS",
188551
188550
  disableMinificationOnDev: "SHOPIFY_CLI_DISABLE_MINIFICATION_ON_DEV",
188552
188551
  disableWasmTomlPatch: "SHOPIFY_CLI_DISABLE_WASM_TOML_PATCH"
@@ -188895,201 +188894,6 @@ async function showApiKeyDeprecationWarning() {
188895
188894
  });
188896
188895
  }
188897
188896
 
188898
- // ../app/dist/cli/utilities/app-command.js
188899
- init_cjs_shims();
188900
-
188901
- // ../cli-kit/dist/public/node/base-command.js
188902
- init_cjs_shims();
188903
-
188904
- // ../cli-kit/dist/public/node/environments.js
188905
- init_cjs_shims();
188906
-
188907
- // ../cli-kit/dist/public/node/toml.js
188908
- init_cjs_shims();
188909
- var toml = __toESM(require_toml());
188910
- function decodeToml(input) {
188911
- let normalizedInput = input.replace(/\r\n$/g, `
188912
- `);
188913
- return toml.parse(normalizedInput);
188914
- }
188915
- function encodeToml(content) {
188916
- return toml.stringify(content);
188917
- }
188918
-
188919
- // ../cli-kit/dist/public/node/environments.js
188920
- function renderWarningIfNeeded(message, silent) {
188921
- silent || renderWarning(message);
188922
- }
188923
- async function loadEnvironment(environmentName, fileName, options2) {
188924
- let filePath = await environmentFilePath(fileName, options2);
188925
- if (!filePath) {
188926
- renderWarningIfNeeded({ body: "Environment file not found." }, options2?.silent);
188927
- return;
188928
- }
188929
- let environments = decodeToml(await readFile(filePath)).environments;
188930
- if (!environments) {
188931
- renderWarningIfNeeded({
188932
- body: ["No environments found in", { command: filePath }, { char: "." }]
188933
- }, options2?.silent);
188934
- return;
188935
- }
188936
- let environment = environments[environmentName];
188937
- if (!environment) {
188938
- renderWarningIfNeeded({
188939
- body: ["Environment", { command: environmentName }, "not found."]
188940
- }, options2?.silent);
188941
- return;
188942
- }
188943
- return await addSensitiveMetadata(() => ({
188944
- environmentFlags: JSON.stringify(environment)
188945
- })), environment;
188946
- }
188947
- async function environmentFilePath(fileName, options2) {
188948
- let basePath = options2?.from && options2.from !== "." ? options2.from : cwd();
188949
- return findPathUp(fileName, {
188950
- cwd: basePath,
188951
- type: "file"
188952
- });
188953
- }
188954
-
188955
- // ../cli-kit/dist/public/node/base-command.js
188956
- var import_core2 = __toESM(require_lib2()), BaseCommand = class extends import_core2.Command {
188957
- // Replace markdown links to plain text like: "link label" (url)
188958
- static descriptionWithoutMarkdown() {
188959
- return (this.descriptionWithMarkdown ?? "").replace(/(\[)(.*?)(])(\()(.*?)(\))/gm, '"$2" ($5)');
188960
- }
188961
- static analyticsNameOverride() {
188962
- }
188963
- static analyticsStopCommand() {
188964
- }
188965
- async catch(error) {
188966
- return error.skipOclifErrorHandling = !0, await errorHandler(error, this.config), import_core2.Errors.handle(error);
188967
- }
188968
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
188969
- async init() {
188970
- return this.exitWithTimestampWhenEnvVariablePresent(), setCurrentCommandId(this.id ?? ""), isDevelopment() || await registerCleanBugsnagErrorsFromWithinPlugins(this.config), this.showNpmFlagWarning(), await showNotificationsIfNeeded(), super.init();
188971
- }
188972
- // NPM creates an environment variable for every flag passed to a script.
188973
- // This function checks for the presence of any of the available CLI flags
188974
- // and warns the user to use the `--` separator.
188975
- showNpmFlagWarning() {
188976
- let commandVariables = this.constructor;
188977
- Object.keys(commandVariables.flags || {}).map((key) => `npm_config_${underscore(key).replace(/^no_/, "")}`).some((flag) => process.env[flag] !== void 0) && renderWarning({
188978
- body: [
188979
- "NPM scripts require an extra",
188980
- { command: "--" },
188981
- "separator to pass the flags. Example:",
188982
- { command: "npm run dev -- --reset" }
188983
- ]
188984
- });
188985
- }
188986
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
188987
- exitWithTimestampWhenEnvVariablePresent() {
188988
- isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN) && (outputResult(`
188989
- SHOPIFY_CLI_TIMESTAMP_START
188990
- { "timestamp": ${Date.now()} }
188991
- SHOPIFY_CLI_TIMESTAMP_END
188992
- `), process.exit(0));
188993
- }
188994
- async parse(options2, argv) {
188995
- let result = await super.parse(options2, argv);
188996
- return result = await this.resultWithEnvironment(result, options2, argv), await addFromParsedFlags(result.flags), { ...result, argv: result.argv };
188997
- }
188998
- environmentsFilename() {
188999
- }
189000
- failMissingNonTTYFlags(flags, requiredFlags) {
189001
- terminalSupportsPrompting() || requiredFlags.forEach((name) => {
189002
- if (!(name in flags))
189003
- throw new AbortError(outputContent`Flag not specified:
189004
-
189005
- ${outputToken.cyan(name)}
189006
-
189007
- This flag is required in non-interactive terminal environments, such as a CI environment, or when piping input from another process.`, "To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.");
189008
- });
189009
- }
189010
- async resultWithEnvironment(originalResult, options2, argv) {
189011
- let flags = originalResult.flags, environmentsFileName = this.environmentsFilename();
189012
- if (!environmentsFileName)
189013
- return originalResult;
189014
- let environmentFileExists = await environmentFilePath(environmentsFileName, { from: flags.path }), environments = flags.environment ?? [], environmentSpecified = environments.length > 0;
189015
- if (!environmentFileExists && !environmentSpecified || environmentSpecified && environments.length > 1)
189016
- return originalResult;
189017
- let { environment, isDefaultEnvironment } = await this.loadEnvironmentForCommand(flags.path, environmentsFileName, environments[0]);
189018
- if (!environment)
189019
- return originalResult;
189020
- let noDefaultsResult = await super.parse(noDefaultsOptions(options2), argv), result = await super.parse(options2, [
189021
- // Need to specify argv default because we're merging with argsFromEnvironment.
189022
- ...argv ?? this.argv,
189023
- ...argsFromEnvironment(environment, options2, noDefaultsResult),
189024
- ...isDefaultEnvironment ? ["--environment", "default"] : []
189025
- ]);
189026
- return reportEnvironmentApplication(noDefaultsResult.flags, result.flags, isDefaultEnvironment ? "default" : flags.environment?.[0], environment), result;
189027
- }
189028
- /**
189029
- * Tries to load an environment to forward to the command. If no environment
189030
- * is specified it will try to load a default environment.
189031
- */
189032
- async loadEnvironmentForCommand(path, environmentsFileName, specifiedEnvironment) {
189033
- return specifiedEnvironment ? { environment: await loadEnvironment(specifiedEnvironment, environmentsFileName, { from: path }), isDefaultEnvironment: !1 } : { environment: await loadEnvironment("default", environmentsFileName, { from: path, silent: !0 }), isDefaultEnvironment: !0 };
189034
- }
189035
- };
189036
- BaseCommand.baseFlags = {};
189037
- async function addFromParsedFlags(flags) {
189038
- await addPublicMetadata(() => ({
189039
- cmd_all_verbose: flags.verbose,
189040
- cmd_all_path_override: flags.path !== void 0,
189041
- cmd_all_path_override_hash: flags.path === void 0 ? void 0 : hashString(flags.path)
189042
- }));
189043
- }
189044
- function reportEnvironmentApplication(noDefaultsFlags, flagsWithEnvironments, environmentName, environment) {
189045
- let changes = {};
189046
- for (let [name, value] of Object.entries(flagsWithEnvironments)) {
189047
- let userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name), environmentContainsFlag = Object.prototype.hasOwnProperty.call(environment, name);
189048
- if (!userSpecifiedThisFlag && environmentContainsFlag) {
189049
- let valueToReport = name === "password" ? `********${value.substr(-4)}` : value;
189050
- changes[name] = valueToReport;
189051
- }
189052
- }
189053
- if (Object.keys(changes).length === 0)
189054
- return;
189055
- let items = Object.entries(changes).map(([name, value]) => `${name}: ${value}`);
189056
- renderInfo({
189057
- headline: ["Using applicable flags from", { userInput: environmentName }, "environment:"],
189058
- body: [{ list: { items } }]
189059
- });
189060
- }
189061
- function noDefaultsOptions(options2) {
189062
- return options2?.flags ? {
189063
- ...options2,
189064
- flags: Object.fromEntries(Object.entries(options2.flags).map(([label, settings]) => {
189065
- let copiedSettings = { ...settings };
189066
- return delete copiedSettings.default, [label, copiedSettings];
189067
- }))
189068
- } : options2;
189069
- }
189070
- function argsFromEnvironment(environment, options2, noDefaultsResult) {
189071
- let args = [];
189072
- for (let [label, value] of Object.entries(environment)) {
189073
- let flagIsRelevantToCommand = options2?.flags && Object.prototype.hasOwnProperty.call(options2.flags, label), userSpecifiedThisFlag = noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label);
189074
- if (flagIsRelevantToCommand && !userSpecifiedThisFlag)
189075
- if (typeof value == "boolean")
189076
- if (value)
189077
- args.push(`--${label}`);
189078
- else
189079
- throw new AbortError(outputContent`Environments can only specify true for boolean flags. Attempted to set ${outputToken.yellow(label)} to false.`);
189080
- else Array.isArray(value) ? value.forEach((element) => args.push(`--${label}`, `${element}`)) : args.push(`--${label}`, `${value}`);
189081
- }
189082
- return args;
189083
- }
189084
- var base_command_default = BaseCommand;
189085
-
189086
- // ../app/dist/cli/utilities/app-command.js
189087
- var AppCommand = class extends base_command_default {
189088
- environmentsFilename() {
189089
- return configurationFileNames.appEnvironments;
189090
- }
189091
- };
189092
-
189093
188897
  // ../app/dist/cli/services/app-context.js
189094
188898
  init_cjs_shims();
189095
188899
 
@@ -189473,6 +189277,18 @@ function reduceWebhooks(subscriptions, property) {
189473
189277
  }, []);
189474
189278
  }
189475
189279
 
189280
+ // ../cli-kit/dist/public/node/toml.js
189281
+ init_cjs_shims();
189282
+ var toml = __toESM(require_toml(), 1);
189283
+ function decodeToml(input) {
189284
+ let normalizedInput = input.replace(/\r\n$/g, `
189285
+ `);
189286
+ return toml.parse(normalizedInput);
189287
+ }
189288
+ function encodeToml(content) {
189289
+ return toml.stringify(content);
189290
+ }
189291
+
189476
189292
  // ../app/dist/cli/services/app/write-app-configuration-file.js
189477
189293
  async function writeAppConfigurationFile(configuration, schema) {
189478
189294
  outputDebug(`Writing app configuration to ${configuration.path}`);
@@ -189711,6 +189527,7 @@ var WebConfigurationAuthCallbackPathSchema = z.preprocess(ensurePathStartsWithSl
189711
189527
  await patchAppHiddenConfigFile(path, String(this.configuration.client_id), this.hiddenConfig);
189712
189528
  }
189713
189529
  async preDeployValidation() {
189530
+ this.validateWebhookLegacyFlowCompatibility();
189714
189531
  let functionExtensionsWithUiHandle = this.allExtensions.filter((ext) => ext.isFunctionExtension && ext.configuration.ui?.handle);
189715
189532
  if (functionExtensionsWithUiHandle.length > 0) {
189716
189533
  let errors = validateFunctionExtensionsWithUiHandle(functionExtensionsWithUiHandle, this.allExtensions);
@@ -189779,6 +189596,25 @@ var WebConfigurationAuthCallbackPathSchema = z.preprocess(ensurePathStartsWithSl
189779
189596
  prefix: devApplicationURLs.appProxy.proxySubPathPrefix
189780
189597
  }), this.configuration.auth?.redirect_urls && (this.configuration.auth.redirect_urls = devApplicationURLs.redirectUrlWhitelist));
189781
189598
  }
189599
+ /**
189600
+ * Validates that app-specific webhooks are not used with legacy install flow.
189601
+ * This incompatibility exists because app-specific webhooks require declarative
189602
+ * scopes in the Partner Dashboard, which aren't synced when using legacy flow.
189603
+ * @throws When app-specific webhooks are used with legacy install flow
189604
+ */
189605
+ validateWebhookLegacyFlowCompatibility() {
189606
+ if (!isCurrentAppSchema(this.configuration))
189607
+ return;
189608
+ let hasAppSpecificWebhooks = (this.configuration.webhooks?.subscriptions?.length ?? 0) > 0, usesLegacyInstallFlow = this.configuration.access_scopes?.use_legacy_install_flow === !0;
189609
+ if (hasAppSpecificWebhooks && usesLegacyInstallFlow)
189610
+ throw new AbortError("App-specific webhook subscriptions are not supported when use_legacy_install_flow is enabled.", `To use app-specific webhooks, you need to:
189611
+ 1. Remove 'use_legacy_install_flow = true' from your configuration
189612
+ 2. Run 'shopify app deploy' to sync your scopes with the Partner Dashboard
189613
+
189614
+ Alternatively, continue using shop-specific webhooks with the legacy install flow.
189615
+
189616
+ Learn more: https://shopify.dev/docs/apps/build/authentication-authorization/app-installation`);
189617
+ }
189782
189618
  };
189783
189619
  function validateFunctionExtensionsWithUiHandle(functionExtensionsWithUiHandle, allExtensions) {
189784
189620
  let errors = [];
@@ -191464,7 +191300,7 @@ var CUSTOM_CREDIT_CARD_TARGET = "payments.custom-credit-card.render", MAX_CHECKO
191464
191300
  multiple_capture: z.boolean(),
191465
191301
  checkout_hosted_fields: z.array(z.string()).optional(),
191466
191302
  ui_extension_handle: z.string().optional(),
191467
- encryption_certificate_fingerprint: z.string().min(1, { message: "Encryption certificate fingerprint can't be blank" }),
191303
+ encryption_certificate_fingerprint: z.string(),
191468
191304
  checkout_payment_method_fields: z.array(z.object({
191469
191305
  type: z.union([z.literal("string"), z.literal("number"), z.literal("boolean")]),
191470
191306
  required: z.boolean(),
@@ -191533,7 +191369,7 @@ var CREDIT_CARD_TARGET = "payments.credit-card.render", MAX_CHECKOUT_PAYMENT_MET
191533
191369
  required_error: "supports_moto is required",
191534
191370
  invalid_type_error: "Value must be Boolean"
191535
191371
  }),
191536
- encryption_certificate_fingerprint: z.string().min(1, { message: "Encryption certificate fingerprint can't be blank" }),
191372
+ encryption_certificate_fingerprint: z.string(),
191537
191373
  checkout_payment_method_fields: z.array(z.object({
191538
191374
  type: z.union([z.literal("string"), z.literal("number"), z.literal("boolean")]),
191539
191375
  required: z.boolean(),
@@ -192705,12 +192541,7 @@ function parseConfigurationObjectAgainstSpecification(spec2, filepath, configura
192705
192541
  }
192706
192542
  }
192707
192543
  async function shouldFailIfUnsupportedConfigProperty() {
192708
- let env = getEnvironmentVariables(), enableUnsupportedConfigPropertyChecks = env[environmentVariableNames.enableUnsupportedConfigPropertyChecks];
192709
- if (isTruthy(enableUnsupportedConfigPropertyChecks))
192710
- return !0;
192711
- if (!await isShopify())
192712
- return !1;
192713
- let disableUnsupportedConfigPropertyChecks = env[environmentVariableNames.disableUnsupportedConfigPropertyChecks];
192544
+ let disableUnsupportedConfigPropertyChecks = getEnvironmentVariables()[environmentVariableNames.disableUnsupportedConfigPropertyChecks];
192714
192545
  return !isTruthy(disableUnsupportedConfigPropertyChecks);
192715
192546
  }
192716
192547
  var AppErrors = class {
@@ -194533,14 +194364,22 @@ var PartnersClient = class {
194533
194364
  }));
194534
194365
  }
194535
194366
  async templateSpecifications({ apiKey }) {
194536
- let variables = { apiKey };
194537
- return (await this.request(RemoteTemplateSpecificationsQuery, variables)).templateSpecifications.map((template) => {
194367
+ let variables = { apiKey }, templates2 = (await this.request(RemoteTemplateSpecificationsQuery, variables)).templateSpecifications.map((template) => {
194538
194368
  let { types, ...rest } = template;
194539
194369
  return {
194540
194370
  ...rest,
194541
194371
  ...types[0]
194542
194372
  };
194543
- });
194373
+ }), counter = 0, templatesWithPriority = templates2.map((template) => ({
194374
+ ...template,
194375
+ sortPriority: template.sortPriority ?? counter++
194376
+ })), groupOrder = [];
194377
+ for (let template of templatesWithPriority)
194378
+ template.group && !groupOrder.includes(template.group) && groupOrder.push(template.group);
194379
+ return {
194380
+ templates: templatesWithPriority,
194381
+ groupOrder
194382
+ };
194544
194383
  }
194545
194384
  async createApp(org, options2) {
194546
194385
  let variables = getAppVars(org, options2.name, options2.isLaunchable, options2.scopesArray), result = await this.request(CreateAppQuery, variables);
@@ -197165,8 +197004,13 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
197165
197004
  "This likely means a problem with your internet connection."
197166
197005
  ]);
197167
197006
  }
197168
- let counter = 0;
197169
- return (await allowedTemplates(templates2, async (betaFlags) => this.organizationBetaFlags(organizationId, betaFlags))).map((template) => ({ ...template, sortPriority: counter++ }));
197007
+ let counter = 0, filteredTemplates = (await allowedTemplates(templates2, async (betaFlags) => this.organizationBetaFlags(organizationId, betaFlags))).map((template) => ({ ...template, sortPriority: counter++ })), groupOrder = [];
197008
+ for (let template of templates2)
197009
+ template.group && !groupOrder.includes(template.group) && groupOrder.push(template.group);
197010
+ return {
197011
+ templates: filteredTemplates,
197012
+ groupOrder
197013
+ };
197170
197014
  }
197171
197015
  async createApp(org, options2) {
197172
197016
  let apiVersion = (await this.apiVersions(org.id)).publicApiVersions.filter((version) => version !== "unstable").sort().at(-1) ?? "unstable", variables = createAppVars(options2, apiVersion), mutation = CreateApp, result = await this.appManagementRequest({
@@ -199303,6 +199147,205 @@ async function logMetadata(app, organization, resetUsed) {
199303
199147
  cmd_app_reset_used: resetUsed
199304
199148
  }));
199305
199149
  }
199150
+ async function localAppContext({ directory, userProvidedConfigName, unsafeReportMode = !1 }) {
199151
+ let specifications = await loadLocalExtensionsSpecifications();
199152
+ return loadApp({
199153
+ directory,
199154
+ userProvidedConfigName,
199155
+ specifications,
199156
+ mode: unsafeReportMode ? "report" : "strict"
199157
+ });
199158
+ }
199159
+
199160
+ // ../app/dist/cli/utilities/app-unlinked-command.js
199161
+ init_cjs_shims();
199162
+
199163
+ // ../app/dist/cli/utilities/app-command.js
199164
+ init_cjs_shims();
199165
+
199166
+ // ../cli-kit/dist/public/node/base-command.js
199167
+ init_cjs_shims();
199168
+
199169
+ // ../cli-kit/dist/public/node/environments.js
199170
+ init_cjs_shims();
199171
+ function renderWarningIfNeeded(message, silent) {
199172
+ silent || renderWarning(message);
199173
+ }
199174
+ async function loadEnvironment(environmentName, fileName, options2) {
199175
+ let filePath = await environmentFilePath(fileName, options2);
199176
+ if (!filePath) {
199177
+ renderWarningIfNeeded({ body: "Environment file not found." }, options2?.silent);
199178
+ return;
199179
+ }
199180
+ let environments = decodeToml(await readFile(filePath)).environments;
199181
+ if (!environments) {
199182
+ renderWarningIfNeeded({
199183
+ body: ["No environments found in", { command: filePath }, { char: "." }]
199184
+ }, options2?.silent);
199185
+ return;
199186
+ }
199187
+ let environment = environments[environmentName];
199188
+ if (!environment) {
199189
+ renderWarningIfNeeded({
199190
+ body: ["Environment", { command: environmentName }, "not found."]
199191
+ }, options2?.silent);
199192
+ return;
199193
+ }
199194
+ return await addSensitiveMetadata(() => ({
199195
+ environmentFlags: JSON.stringify(environment)
199196
+ })), environment;
199197
+ }
199198
+ async function environmentFilePath(fileName, options2) {
199199
+ let basePath = options2?.from && options2.from !== "." ? options2.from : cwd();
199200
+ return findPathUp(fileName, {
199201
+ cwd: basePath,
199202
+ type: "file"
199203
+ });
199204
+ }
199205
+
199206
+ // ../cli-kit/dist/public/node/base-command.js
199207
+ var import_core2 = __toESM(require_lib2()), BaseCommand = class extends import_core2.Command {
199208
+ // Replace markdown links to plain text like: "link label" (url)
199209
+ static descriptionWithoutMarkdown() {
199210
+ return (this.descriptionWithMarkdown ?? "").replace(/(\[)(.*?)(])(\()(.*?)(\))/gm, '"$2" ($5)');
199211
+ }
199212
+ static analyticsNameOverride() {
199213
+ }
199214
+ static analyticsStopCommand() {
199215
+ }
199216
+ async catch(error) {
199217
+ return error.skipOclifErrorHandling = !0, await errorHandler(error, this.config), import_core2.Errors.handle(error);
199218
+ }
199219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
199220
+ async init() {
199221
+ return this.exitWithTimestampWhenEnvVariablePresent(), setCurrentCommandId(this.id ?? ""), isDevelopment() || await registerCleanBugsnagErrorsFromWithinPlugins(this.config), this.showNpmFlagWarning(), await showNotificationsIfNeeded(), super.init();
199222
+ }
199223
+ // NPM creates an environment variable for every flag passed to a script.
199224
+ // This function checks for the presence of any of the available CLI flags
199225
+ // and warns the user to use the `--` separator.
199226
+ showNpmFlagWarning() {
199227
+ let commandVariables = this.constructor;
199228
+ Object.keys(commandVariables.flags || {}).map((key) => `npm_config_${underscore(key).replace(/^no_/, "")}`).some((flag) => process.env[flag] !== void 0) && renderWarning({
199229
+ body: [
199230
+ "NPM scripts require an extra",
199231
+ { command: "--" },
199232
+ "separator to pass the flags. Example:",
199233
+ { command: "npm run dev -- --reset" }
199234
+ ]
199235
+ });
199236
+ }
199237
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
199238
+ exitWithTimestampWhenEnvVariablePresent() {
199239
+ isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN) && (outputResult(`
199240
+ SHOPIFY_CLI_TIMESTAMP_START
199241
+ { "timestamp": ${Date.now()} }
199242
+ SHOPIFY_CLI_TIMESTAMP_END
199243
+ `), process.exit(0));
199244
+ }
199245
+ async parse(options2, argv) {
199246
+ let result = await super.parse(options2, argv);
199247
+ return result = await this.resultWithEnvironment(result, options2, argv), await addFromParsedFlags(result.flags), { ...result, argv: result.argv };
199248
+ }
199249
+ environmentsFilename() {
199250
+ }
199251
+ failMissingNonTTYFlags(flags, requiredFlags) {
199252
+ terminalSupportsPrompting() || requiredFlags.forEach((name) => {
199253
+ if (!(name in flags))
199254
+ throw new AbortError(outputContent`Flag not specified:
199255
+
199256
+ ${outputToken.cyan(name)}
199257
+
199258
+ This flag is required in non-interactive terminal environments, such as a CI environment, or when piping input from another process.`, "To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.");
199259
+ });
199260
+ }
199261
+ async resultWithEnvironment(originalResult, options2, argv) {
199262
+ let flags = originalResult.flags, environmentsFileName = this.environmentsFilename();
199263
+ if (!environmentsFileName)
199264
+ return originalResult;
199265
+ let environmentFileExists = await environmentFilePath(environmentsFileName, { from: flags.path }), environments = [];
199266
+ flags.environment && (environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment]);
199267
+ let environmentSpecified = environments.length > 0;
199268
+ if (!environmentFileExists && !environmentSpecified || environmentSpecified && environments.length > 1)
199269
+ return originalResult;
199270
+ let { environment, isDefaultEnvironment } = await this.loadEnvironmentForCommand(flags.path, environmentsFileName, environments[0]);
199271
+ if (!environment)
199272
+ return originalResult;
199273
+ let noDefaultsResult = await super.parse(noDefaultsOptions(options2), argv), result = await super.parse(options2, [
199274
+ // Need to specify argv default because we're merging with argsFromEnvironment.
199275
+ ...argv ?? this.argv,
199276
+ ...argsFromEnvironment(environment, options2, noDefaultsResult),
199277
+ ...isDefaultEnvironment ? ["--environment", "default"] : []
199278
+ ]);
199279
+ return reportEnvironmentApplication(noDefaultsResult.flags, result.flags, isDefaultEnvironment ? "default" : environments[0], environment), result;
199280
+ }
199281
+ /**
199282
+ * Tries to load an environment to forward to the command. If no environment
199283
+ * is specified it will try to load a default environment.
199284
+ */
199285
+ async loadEnvironmentForCommand(path, environmentsFileName, specifiedEnvironment) {
199286
+ return specifiedEnvironment ? { environment: await loadEnvironment(specifiedEnvironment, environmentsFileName, { from: path }), isDefaultEnvironment: !1 } : { environment: await loadEnvironment("default", environmentsFileName, { from: path, silent: !0 }), isDefaultEnvironment: !0 };
199287
+ }
199288
+ };
199289
+ BaseCommand.baseFlags = {};
199290
+ async function addFromParsedFlags(flags) {
199291
+ await addPublicMetadata(() => ({
199292
+ cmd_all_verbose: flags.verbose,
199293
+ cmd_all_path_override: flags.path !== void 0,
199294
+ cmd_all_path_override_hash: flags.path === void 0 ? void 0 : hashString(flags.path)
199295
+ }));
199296
+ }
199297
+ function reportEnvironmentApplication(noDefaultsFlags, flagsWithEnvironments, environmentName, environment) {
199298
+ let changes = {};
199299
+ for (let [name, value] of Object.entries(flagsWithEnvironments)) {
199300
+ let userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name), environmentContainsFlag = Object.prototype.hasOwnProperty.call(environment, name);
199301
+ if (!userSpecifiedThisFlag && environmentContainsFlag) {
199302
+ let valueToReport = name === "password" ? `********${value.substr(-4)}` : value;
199303
+ changes[name] = valueToReport;
199304
+ }
199305
+ }
199306
+ if (Object.keys(changes).length === 0)
199307
+ return;
199308
+ let items = Object.entries(changes).map(([name, value]) => `${name}: ${value}`);
199309
+ renderInfo({
199310
+ headline: ["Using applicable flags from", { userInput: environmentName }, "environment:"],
199311
+ body: [{ list: { items } }]
199312
+ });
199313
+ }
199314
+ function noDefaultsOptions(options2) {
199315
+ return options2?.flags ? {
199316
+ ...options2,
199317
+ flags: Object.fromEntries(Object.entries(options2.flags).map(([label, settings]) => {
199318
+ let copiedSettings = { ...settings };
199319
+ return delete copiedSettings.default, [label, copiedSettings];
199320
+ }))
199321
+ } : options2;
199322
+ }
199323
+ function argsFromEnvironment(environment, options2, noDefaultsResult) {
199324
+ let args = [];
199325
+ for (let [label, value] of Object.entries(environment)) {
199326
+ let flagIsRelevantToCommand = options2?.flags && Object.prototype.hasOwnProperty.call(options2.flags, label), userSpecifiedThisFlag = noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label);
199327
+ if (flagIsRelevantToCommand && !userSpecifiedThisFlag)
199328
+ if (typeof value == "boolean")
199329
+ if (value)
199330
+ args.push(`--${label}`);
199331
+ else
199332
+ throw new AbortError(outputContent`Environments can only specify true for boolean flags. Attempted to set ${outputToken.yellow(label)} to false.`);
199333
+ else Array.isArray(value) ? value.forEach((element) => args.push(`--${label}`, `${element}`)) : args.push(`--${label}`, `${value}`);
199334
+ }
199335
+ return args;
199336
+ }
199337
+ var base_command_default = BaseCommand;
199338
+
199339
+ // ../app/dist/cli/utilities/app-command.js
199340
+ var AppCommand = class extends base_command_default {
199341
+ environmentsFilename() {
199342
+ return configurationFileNames.appEnvironments;
199343
+ }
199344
+ };
199345
+
199346
+ // ../app/dist/cli/utilities/app-unlinked-command.js
199347
+ var AppUnlinkedCommand = class extends AppCommand {
199348
+ };
199306
199349
 
199307
199350
  // ../app/dist/cli/commands/app/build.js
199308
199351
  var import_core4 = __toESM(require_lib2(), 1);
@@ -199314,7 +199357,7 @@ init_cjs_shims();
199314
199357
  init_cjs_shims();
199315
199358
  import { fileURLToPath as fileURLToPath2 } from "node:url";
199316
199359
  async function launchCLI(options2) {
199317
- let { errorHandler: errorHandler3 } = await import("./error-handler-5ZPHVQR4.js"), { isDevelopment: isDevelopment2 } = await import("./local-O36XSLPO.js"), oclif = await import("./lib-UJ7YNLH4.js"), { ShopifyConfig } = await import("./custom-oclif-loader-5ZQOICQH.js");
199360
+ let { errorHandler: errorHandler3 } = await import("./error-handler-SWZ4Y54O.js"), { isDevelopment: isDevelopment2 } = await import("./local-KOMGI74N.js"), oclif = await import("./lib-UJ7YNLH4.js"), { ShopifyConfig } = await import("./custom-oclif-loader-2KUDQ6HQ.js");
199318
199361
  isDevelopment2() && (oclif.default.settings.debug = !0);
199319
199362
  try {
199320
199363
  let config2 = new ShopifyConfig({ root: fileURLToPath2(options2.moduleURL) });
@@ -199329,7 +199372,7 @@ var import_core3 = __toESM(require_lib2());
199329
199372
  async function exitIfOldNodeVersion(versions2 = process.versions) {
199330
199373
  let nodeVersion = versions2.node, nodeMajorVersion = Number(nodeVersion.split(".")[0]);
199331
199374
  if (nodeMajorVersion < 18) {
199332
- let { renderError: renderError2 } = await import("./ui-TUFRYZMP.js");
199375
+ let { renderError: renderError2 } = await import("./ui-2DQEYOWO.js");
199333
199376
  renderError2({
199334
199377
  headline: "Upgrade to a supported Node version now.",
199335
199378
  body: [
@@ -199356,7 +199399,7 @@ async function runCLI(options2, launchCLI2 = launchCLI, argv = process.argv, env
199356
199399
  return setupEnvironmentVariables(options2, argv, env), options2.runInCreateMode && await addInitToArgvWhenRunningCreateCLI(options2, argv), forceNoColor(argv, env), await exitIfOldNodeVersion(versions2), launchCLI2({ moduleURL: options2.moduleURL });
199357
199400
  }
199358
199401
  async function addInitToArgvWhenRunningCreateCLI(options2, argv = process.argv) {
199359
- let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-DXIM2DYO.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-COZT77T2.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options2.moduleURL))).content.name.replace("@shopify/create-", "");
199402
+ let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-HDKMIXR2.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-COZT77T2.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options2.moduleURL))).content.name.replace("@shopify/create-", "");
199360
199403
  if (argv.findIndex((arg) => arg.includes("init")) === -1) {
199361
199404
  let initIndex2 = argv.findIndex((arg) => arg.match(new RegExp(`bin(\\/|\\\\)+(create-${name}|dev|run)`))) + 1;
199362
199405
  argv.splice(initIndex2, 0, "init");
@@ -199387,7 +199430,7 @@ var globalFlags = {
199387
199430
  };
199388
199431
 
199389
199432
  // ../app/dist/cli/commands/app/build.js
199390
- var _a, Build = class extends AppCommand {
199433
+ var _a, Build = class extends AppUnlinkedCommand {
199391
199434
  async run() {
199392
199435
  let { flags } = await this.parse(_a);
199393
199436
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -199395,10 +199438,8 @@ var _a, Build = class extends AppCommand {
199395
199438
  await addPublicMetadata(() => ({
199396
199439
  cmd_app_dependency_installation_skipped: flags["skip-dependencies-installation"]
199397
199440
  }));
199398
- let { app } = await linkedAppContext({
199441
+ let app = await localAppContext({
199399
199442
  directory: flags.path,
199400
- clientId: apiKey,
199401
- forceRelink: flags.reset,
199402
199443
  userProvidedConfigName: flags.config
199403
199444
  });
199404
199445
  return await build_default({ app, skipDependenciesInstallation: flags["skip-dependencies-installation"], apiKey }), { app };
@@ -199428,7 +199469,14 @@ var build_default2 = Build;
199428
199469
 
199429
199470
  // ../app/dist/cli/commands/app/config/link.js
199430
199471
  init_cjs_shims();
199431
- var _a2, ConfigLink = class extends AppCommand {
199472
+
199473
+ // ../app/dist/cli/utilities/app-linked-command.js
199474
+ init_cjs_shims();
199475
+ var AppLinkedCommand = class extends AppCommand {
199476
+ };
199477
+
199478
+ // ../app/dist/cli/commands/app/config/link.js
199479
+ var _a2, ConfigLink = class extends AppLinkedCommand {
199432
199480
  async run() {
199433
199481
  let { flags } = await this.parse(_a2), options2 = {
199434
199482
  directory: flags.path,
@@ -199459,7 +199507,7 @@ var link_default = ConfigLink;
199459
199507
  // ../app/dist/cli/commands/app/config/use.js
199460
199508
  init_cjs_shims();
199461
199509
  var import_core5 = __toESM(require_lib2(), 1);
199462
- var _a3, { config, ...appFlagsWithoutConfig } = appFlags, ConfigUse = class extends AppCommand {
199510
+ var _a3, { config, ...appFlagsWithoutConfig } = appFlags, ConfigUse = class extends AppLinkedCommand {
199463
199511
  async run() {
199464
199512
  let { flags, args } = await this.parse(_a3);
199465
199513
  await checkFolderIsValidApp(flags.path), await use({ directory: flags.path, configName: args.config, reset: flags.reset });
@@ -199881,7 +199929,7 @@ var AppEventWatcher = class extends EventEmitter {
199881
199929
  };
199882
199930
 
199883
199931
  // ../app/dist/cli/commands/app/demo/watcher.js
199884
- var DemoWatcher = class _DemoWatcher extends AppCommand {
199932
+ var DemoWatcher = class _DemoWatcher extends AppLinkedCommand {
199885
199933
  async run() {
199886
199934
  let { flags } = await this.parse(_DemoWatcher), { app } = await linkedAppContext({
199887
199935
  directory: flags.path,
@@ -200248,7 +200296,7 @@ function validateMessage(message) {
200248
200296
 
200249
200297
  // ../app/dist/cli/commands/app/deploy.js
200250
200298
  var import_core6 = __toESM(require_lib2(), 1);
200251
- var _a4, Deploy = class extends AppCommand {
200299
+ var _a4, Deploy = class extends AppLinkedCommand {
200252
200300
  async run() {
200253
200301
  let { flags } = await this.parse(_a4);
200254
200302
  await metadata_default.addPublicMetadata(() => ({
@@ -202197,7 +202245,7 @@ init_cjs_shims();
202197
202245
  var import_core7 = __toESM(require_lib2(), 1);
202198
202246
  var themeFlags = {
202199
202247
  path: import_core7.Flags.string({
202200
- description: "The path to your theme directory.",
202248
+ description: "The path where you want to run the command. Defaults to the current working directory.",
202201
202249
  env: "SHOPIFY_FLAG_PATH",
202202
202250
  parse: async (input) => resolvePath(input),
202203
202251
  default: async () => cwd(),
@@ -202475,7 +202523,7 @@ function assertThemeStoreExists(storage = themeLocalStorage()) {
202475
202523
  function ensureThemeStore(flags) {
202476
202524
  let store = flags.store || getThemeStore();
202477
202525
  if (!store)
202478
- throw new AbortError("A store is required", `Specify the store passing ${outputContent`${outputToken.genericShellCommand(`--${themeFlags.store.name}={your_store_url}`)}`.value} or set the ${outputContent`${outputToken.genericShellCommand(themeFlags.store.env)}`.value} environment variable.`);
202526
+ throw new AbortError("A store is required", `Specify the store passing ${outputContent`${outputToken.genericShellCommand(`--${themeFlags.store.name}=example.myshopify.com`)}`.value} or set the ${outputContent`${outputToken.genericShellCommand(themeFlags.store.env)}`.value} environment variable.`);
202479
202527
  return setThemeStore(store), store;
202480
202528
  }
202481
202529
 
@@ -202517,33 +202565,53 @@ var ThemeCommand = class extends base_command_default {
202517
202565
  environmentsFilename() {
202518
202566
  return configurationFileName;
202519
202567
  }
202520
- async command(_flags, _session) {
202568
+ async command(_flags, _session, _context) {
202521
202569
  }
202522
202570
  async run(_opts) {
202523
202571
  let klass = this.constructor, requiredFlags = klass.multiEnvironmentsFlags, { flags } = await this.parse(klass);
202524
- if (!flags.environment) {
202572
+ if (!flags.environment?.length) {
202573
+ let session = await this.ensureAuthenticated(flags);
202574
+ await this.command(flags, session);
202575
+ return;
202576
+ }
202577
+ let environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment];
202578
+ if (environments.length === 1) {
202525
202579
  let session = await this.ensureAuthenticated(flags);
202526
202580
  await this.command(flags, session);
202527
202581
  return;
202528
202582
  }
202529
- let sessions = {}, environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment];
202583
+ let sessions = {};
202530
202584
  for (let environmentName of environments) {
202531
- let environmentConfig = await loadEnvironment(environmentName, "shopify.theme.toml", { from: flags.path });
202585
+ let environmentConfig = await loadEnvironment(environmentName, "shopify.theme.toml", {
202586
+ from: flags.path,
202587
+ silent: !0
202588
+ });
202532
202589
  sessions[environmentName] = await this.ensureAuthenticated(environmentConfig);
202533
202590
  }
202534
- await Promise.all(environments.map(async (environment) => {
202535
- let environmentConfig = await loadEnvironment(environment, "shopify.theme.toml", { from: flags.path }), environmentFlags = {
202536
- ...flags,
202537
- ...environmentConfig,
202538
- environment: [environment]
202539
- };
202540
- if (!this.validConfig(environmentConfig, requiredFlags, environment))
202541
- return;
202542
- let session = sessions[environment];
202543
- if (!session)
202544
- throw new AbortError(`No session found for environment ${environment}`);
202545
- return this.command(environmentFlags, session);
202546
- }));
202591
+ let abortController = new AbortController2();
202592
+ await renderConcurrent({
202593
+ processes: environments.map((environment) => ({
202594
+ prefix: environment,
202595
+ action: async (stdout, stderr, _signal) => {
202596
+ let environmentConfig = await loadEnvironment(environment, "shopify.theme.toml", {
202597
+ from: flags.path,
202598
+ silent: !0
202599
+ }), environmentFlags = {
202600
+ ...flags,
202601
+ ...environmentConfig,
202602
+ environment: [environment]
202603
+ };
202604
+ if (!this.validConfig(environmentConfig, requiredFlags, environment))
202605
+ return;
202606
+ let session = sessions[environment];
202607
+ if (!session)
202608
+ throw new AbortError(`No session found for environment ${environment}`);
202609
+ await this.command(environmentFlags, session, { stdout, stderr });
202610
+ }
202611
+ })),
202612
+ abortSignal: abortController.signal,
202613
+ showTimestamps: !0
202614
+ });
202547
202615
  }
202548
202616
  async ensureAuthenticated(flags) {
202549
202617
  let store = flags.store, password = flags.password;
@@ -202744,7 +202812,7 @@ async function getStorefrontSessionCookies(storeUrl, themeId, password, headers
202744
202812
  let storefrontDigest = await enrichSessionWithStorefrontPassword(shopifyEssential, storeUrl, password, headers);
202745
202813
  return cookieRecord.storefront_digest = storefrontDigest, cookieRecord;
202746
202814
  }
202747
- async function sessionEssentialCookie(storeUrl, themeId, headers) {
202815
+ async function sessionEssentialCookie(storeUrl, themeId, headers, retries = 1) {
202748
202816
  let params = new URLSearchParams({
202749
202817
  preview_theme_id: themeId,
202750
202818
  _fd: "0",
@@ -202757,12 +202825,18 @@ async function sessionEssentialCookie(storeUrl, themeId, headers) {
202757
202825
  ...defaultHeaders()
202758
202826
  }
202759
202827
  }), setCookies = response.headers.raw()["set-cookie"] ?? [], shopifyEssential = getCookie(setCookies, "_shopify_essential");
202760
- if (!shopifyEssential)
202761
- throw outputDebug(`Failed to obtain _shopify_essential cookie.
202828
+ if (!shopifyEssential) {
202829
+ if (outputDebug(`Failed to obtain _shopify_essential cookie.
202762
202830
 
202763
202831
  -Request ID: ${response.headers.get("x-request-id") ?? "unknown"}
202764
202832
 
202765
- -Body: ${await response.text()}`), new ShopifyEssentialError('Your development session could not be created because the "_shopify_essential" could not be defined. Please, check your internet connection.');
202833
+ -Body: ${await response.text()}
202834
+
202835
+ -Status: ${response.status}
202836
+ `), retries > 3)
202837
+ throw new ShopifyEssentialError('Your development session could not be created because the "_shopify_essential" could not be defined. Please, check your internet connection.');
202838
+ return outputDebug("Retrying to obtain the _shopify_essential cookie..."), await sleep(retries), sessionEssentialCookie(storeUrl, themeId, headers, retries + 1);
202839
+ }
202766
202840
  return shopifyEssential;
202767
202841
  }
202768
202842
  async function enrichSessionWithStorefrontPassword(shopifyEssential, storeUrl, password, headers) {
@@ -204267,9 +204341,7 @@ Console.descriptionWithMarkdown = `Starts the Shopify Liquid REPL (read-eval-pri
204267
204341
  Console.description = _a6.descriptionWithoutMarkdown();
204268
204342
  Console.flags = {
204269
204343
  ...globalFlags,
204270
- store: themeFlags.store,
204271
- password: themeFlags.password,
204272
- environment: themeFlags.environment,
204344
+ ...themeFlags,
204273
204345
  url: import_core9.Flags.string({
204274
204346
  description: "The url to be used as context",
204275
204347
  env: "SHOPIFY_FLAG_URL",
@@ -204495,7 +204567,7 @@ Delete.description = _a7.descriptionWithoutMarkdown();
204495
204567
  Delete.strict = !1;
204496
204568
  Delete.flags = {
204497
204569
  ...globalFlags,
204498
- password: themeFlags.password,
204570
+ ...themeFlags,
204499
204571
  development: import_core10.Flags.boolean({
204500
204572
  char: "d",
204501
204573
  description: "Delete your development theme.",
@@ -204516,9 +204588,7 @@ Delete.flags = {
204516
204588
  description: "Theme ID or name of the remote theme.",
204517
204589
  env: "SHOPIFY_FLAG_THEME_ID",
204518
204590
  multiple: !0
204519
- }),
204520
- store: themeFlags.store,
204521
- environment: themeFlags.environment
204591
+ })
204522
204592
  };
204523
204593
 
204524
204594
  // ../theme/dist/cli/commands/theme/dev.js
@@ -206930,7 +207000,7 @@ You can run this command only in a directory that matches the [default Shopify t
206930
207000
  Dev.description = _a8.descriptionWithoutMarkdown();
206931
207001
  Dev.flags = {
206932
207002
  ...globalFlags,
206933
- path: themeFlags.path,
207003
+ ...themeFlags,
206934
207004
  host: import_core11.Flags.string({
206935
207005
  description: "Set which network interface the web server listens on. The default value is 127.0.0.1.",
206936
207006
  env: "SHOPIFY_FLAG_HOST"
@@ -206966,7 +207036,6 @@ Dev.flags = {
206966
207036
  description: "Local port to serve theme preview from.",
206967
207037
  env: "SHOPIFY_FLAG_PORT"
206968
207038
  }),
206969
- store: themeFlags.store,
206970
207039
  theme: import_core11.Flags.string({
206971
207040
  char: "t",
206972
207041
  description: "Theme ID or name of the remote theme.",
@@ -206995,8 +207064,6 @@ Dev.flags = {
206995
207064
  description: "Proceed without confirmation, if current directory does not seem to be theme directory.",
206996
207065
  env: "SHOPIFY_FLAG_FORCE"
206997
207066
  }),
206998
- password: themeFlags.password,
206999
- environment: themeFlags.environment,
207000
207067
  notify: import_core11.Flags.string({
207001
207068
  description: "The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",
207002
207069
  env: "SHOPIFY_FLAG_NOTIFY"
@@ -207113,9 +207180,7 @@ Info.description = "Displays information about your theme environment, including
207113
207180
  Info.flags = {
207114
207181
  ...globalFlags,
207115
207182
  ...jsonFlag,
207116
- store: themeFlags.store,
207117
- password: themeFlags.password,
207118
- environment: themeFlags.environment,
207183
+ ...themeFlags,
207119
207184
  development: import_core12.Flags.boolean({
207120
207185
  char: "d",
207121
207186
  description: "Retrieve info from your development theme.",
@@ -210541,6 +210606,15 @@ async function insideGitDirectory(directory) {
210541
210606
  async function isClean(directory) {
210542
210607
  return (await esm_default({ baseDir: directory }).status()).isClean();
210543
210608
  }
210609
+ async function removeGitRemote(directory, remoteName = "origin") {
210610
+ outputDebug(outputContent`Removing git remote ${remoteName} from ${outputToken.path(directory)}...`), await ensureGitIsPresentOrAbort();
210611
+ let repo = esm_default(directory);
210612
+ if (!(await repo.getRemotes()).some((remote) => remote.name === remoteName)) {
210613
+ outputDebug(outputContent`Remote ${remoteName} does not exist, no action needed`);
210614
+ return;
210615
+ }
210616
+ await repo.removeRemote(remoteName);
210617
+ }
210544
210618
 
210545
210619
  // ../theme/dist/cli/services/init.js
210546
210620
  async function cloneRepo(repoUrl, destination) {
@@ -210557,8 +210631,9 @@ async function downloadRepository(repoUrl, destination, latestTag) {
210557
210631
  await downloadGitRepository({
210558
210632
  repoUrl,
210559
210633
  destination,
210560
- latestTag
210561
- });
210634
+ latestTag,
210635
+ shallow: !0
210636
+ }), await removeGitRemote(destination);
210562
210637
  }
210563
210638
  }
210564
210639
  ]);
@@ -210706,8 +210781,7 @@ List2.description = "Lists the themes in your store, along with their IDs and st
210706
210781
  List2.flags = {
210707
210782
  ...globalFlags,
210708
210783
  ...jsonFlag,
210709
- password: themeFlags.password,
210710
- store: themeFlags.store,
210784
+ ...themeFlags,
210711
210785
  role: import_core14.Flags.custom({
210712
210786
  description: "Only list themes with the given role.",
210713
210787
  options: ALLOWED_ROLES,
@@ -210720,8 +210794,7 @@ List2.flags = {
210720
210794
  id: import_core14.Flags.integer({
210721
210795
  description: "Only list theme with the given ID.",
210722
210796
  env: "SHOPIFY_FLAG_ID"
210723
- }),
210724
- environment: themeFlags.environment
210797
+ })
210725
210798
  };
210726
210799
  List2.multiEnvironmentsFlags = ["store", "password"];
210727
210800
 
@@ -210776,7 +210849,7 @@ Open.descriptionWithMarkdown = `Returns links that let you preview the specified
210776
210849
  Open.description = _a13.descriptionWithoutMarkdown();
210777
210850
  Open.flags = {
210778
210851
  ...globalFlags,
210779
- password: themeFlags.password,
210852
+ ...themeFlags,
210780
210853
  development: import_core15.Flags.boolean({
210781
210854
  char: "d",
210782
210855
  description: "Open your development theme.",
@@ -210796,9 +210869,7 @@ Open.flags = {
210796
210869
  char: "t",
210797
210870
  description: "Theme ID or name of the remote theme.",
210798
210871
  env: "SHOPIFY_FLAG_THEME_ID"
210799
- }),
210800
- store: themeFlags.store,
210801
- environment: themeFlags.environment
210872
+ })
210802
210873
  };
210803
210874
 
210804
210875
  // ../theme/dist/cli/commands/theme/package.js
@@ -210811,6 +210882,7 @@ var import_theme_check_node5 = __toESM(require_dist5(), 1), themeFilesPattern =
210811
210882
  "blocks/**",
210812
210883
  "config/**",
210813
210884
  "layout/**",
210885
+ "listings/**/*",
210814
210886
  "locales/**",
210815
210887
  "sections/**",
210816
210888
  "snippets/**",
@@ -210858,6 +210930,8 @@ Package.descriptionWithMarkdown = `Packages your local theme files into a ZIP fi
210858
210930
 
210859
210931
  Only folders that match the [default Shopify theme folder structure](https://shopify.dev/docs/storefronts/themes/tools/cli#directory-structure) are included in the package.
210860
210932
 
210933
+ The package includes the \`listings\` directory if present (required for multi-preset themes per [Theme Store requirements](https://shopify.dev/docs/storefronts/themes/store/requirements#adding-presets-to-your-theme-zip-submission)).
210934
+
210861
210935
  The ZIP file uses the name \`theme_name-theme_version.zip\`, based on parameters in your [settings_schema.json](https://shopify.dev/docs/storefronts/themes/architecture/config/settings-schema-json) file.`;
210862
210936
  Package.description = _a14.descriptionWithoutMarkdown();
210863
210937
  Package.flags = {
@@ -210939,8 +211013,7 @@ Profile.descriptionWithMarkdown = `Profile the Shopify Liquid on a given page.
210939
211013
  Profile.description = _a15.descriptionWithoutMarkdown();
210940
211014
  Profile.flags = {
210941
211015
  ...globalFlags,
210942
- store: themeFlags.store,
210943
- password: themeFlags.password,
211016
+ ...themeFlags,
210944
211017
  theme: import_core16.Flags.string({
210945
211018
  char: "t",
210946
211019
  description: "Theme ID or name of the remote theme.",
@@ -210955,7 +211028,6 @@ Profile.flags = {
210955
211028
  description: "The password for storefronts with password protection.",
210956
211029
  env: "SHOPIFY_FLAG_STORE_PASSWORD"
210957
211030
  }),
210958
- environment: themeFlags.environment,
210959
211031
  ...jsonFlag
210960
211032
  };
210961
211033
 
@@ -211027,7 +211099,7 @@ Publish.description = _a16.descriptionWithoutMarkdown();
211027
211099
  Publish.strict = !1;
211028
211100
  Publish.flags = {
211029
211101
  ...globalFlags,
211030
- password: themeFlags.password,
211102
+ ...themeFlags,
211031
211103
  force: import_core17.Flags.boolean({
211032
211104
  char: "f",
211033
211105
  description: "Skip confirmation.",
@@ -211037,9 +211109,7 @@ Publish.flags = {
211037
211109
  char: "t",
211038
211110
  description: "Theme ID or name of the remote theme.",
211039
211111
  env: "SHOPIFY_FLAG_THEME_ID"
211040
- }),
211041
- store: themeFlags.store,
211042
- environment: themeFlags.environment
211112
+ })
211043
211113
  };
211044
211114
 
211045
211115
  // ../theme/dist/cli/commands/theme/metafields/pull.js
@@ -211536,9 +211606,7 @@ Rename.descriptionWithMarkdown = `Renames a theme in your store.
211536
211606
  Rename.description = _a20.descriptionWithoutMarkdown();
211537
211607
  Rename.flags = {
211538
211608
  ...globalFlags,
211539
- store: themeFlags.store,
211540
- password: themeFlags.password,
211541
- environment: themeFlags.environment,
211609
+ ...themeFlags,
211542
211610
  name: import_core21.Flags.string({
211543
211611
  char: "n",
211544
211612
  description: "The new name for the theme.",
@@ -211966,7 +212034,7 @@ init_cjs_shims();
211966
212034
  init_cjs_shims();
211967
212035
  var EventType2;
211968
212036
  (function(EventType3) {
211969
- EventType3.Update = "update", EventType3.Dispatch = "dispatch";
212037
+ EventType3.Update = "update", EventType3.Dispatch = "dispatch", EventType3.Log = "log";
211970
212038
  })(EventType2 || (EventType2 = {}));
211971
212039
 
211972
212040
  // ../app/dist/cli/services/dev/extension/websocket/handlers.js
@@ -211986,12 +212054,49 @@ function getConnectionDoneHandler(wss, options2) {
211986
212054
  outputDebug(outputContent`Sending connected payload: ${outputToken.json(connectedPayload)}`, options2.stdout), ws.send(JSON.stringify(connectedPayload)), ws.on("message", getOnMessageHandler(wss, options2));
211987
212055
  };
211988
212056
  }
212057
+ function parseLogMessage(message) {
212058
+ try {
212059
+ let parsed = JSON.parse(message);
212060
+ if (!Array.isArray(parsed))
212061
+ return message;
212062
+ let formatted = parsed.map((arg) => typeof arg == "object" && arg !== null ? outputToken.json(arg).output() : String(arg)).join(" ");
212063
+ return outputContent`${formatted}`.value;
212064
+ } catch (error) {
212065
+ if (error instanceof SyntaxError)
212066
+ return message;
212067
+ throw error;
212068
+ }
212069
+ }
212070
+ var consoleTypeColors = {
212071
+ debug: (text) => outputToken.gray(text),
212072
+ warn: (text) => outputToken.yellow(text),
212073
+ error: (text) => outputToken.errorText(text)
212074
+ };
212075
+ function getOutput({ type, message }) {
212076
+ let formattedMessage = parseLogMessage(message);
212077
+ switch (type) {
212078
+ case "debug":
212079
+ case "warn":
212080
+ case "error":
212081
+ return outputContent`${consoleTypeColors[type](type.toUpperCase())}: ${formattedMessage}`.value;
212082
+ case "log":
212083
+ case "info":
212084
+ return formattedMessage;
212085
+ default:
212086
+ return `${type.toUpperCase()}: ${formattedMessage}`;
212087
+ }
212088
+ }
212089
+ function handleLogEvent(eventData, options2) {
212090
+ useConcurrentOutputContext({ outputPrefix: eventData.extensionName, stripAnsi: !1 }, () => {
212091
+ options2.stdout.write(getOutput(eventData));
212092
+ });
212093
+ }
211989
212094
  function getOnMessageHandler(wss, options2) {
211990
212095
  return (data) => {
211991
212096
  let jsonData = JSON.parse(data.toString()), { event: eventType, data: eventData } = jsonData;
211992
212097
  if (outputDebug(outputContent`Received websocket message with event type ${eventType} and data:
211993
212098
  ${outputToken.json(eventData)}
211994
- `, options2.stdout), eventType === "update") {
212099
+ `, options2.stdout), eventType === EventType2.Update) {
211995
212100
  let payloadStoreApiKey = options2.payloadStore.getRawPayload().app.apiKey, eventAppApiKey = eventData.app?.apiKey;
211996
212101
  if (eventData.app) {
211997
212102
  if (payloadStoreApiKey !== eventAppApiKey)
@@ -211999,10 +212104,10 @@ ${outputToken.json(eventData)}
211999
212104
  options2.payloadStore.updateApp(eventData.app);
212000
212105
  }
212001
212106
  eventData.extensions && options2.payloadStore.updateExtensions(eventData.extensions);
212002
- } else if (eventType === "dispatch") {
212107
+ } else if (eventType === EventType2.Dispatch) {
212003
212108
  let outGoingMessage = getOutgoingDispatchMessage(jsonData, options2);
212004
212109
  notifyClients(wss, outGoingMessage, options2);
212005
- }
212110
+ } else eventType === EventType2.Log && handleLogEvent(eventData, options2);
212006
212111
  };
212007
212112
  }
212008
212113
  function getPayloadUpdateHandler(wss, options2) {
@@ -215812,7 +215917,7 @@ async function getTunnelMode({ useLocalhost, localhostPort, tunnelUrl }) {
215812
215917
 
215813
215918
  // ../app/dist/cli/commands/app/dev.js
215814
215919
  var import_core23 = __toESM(require_lib2(), 1);
215815
- var _a22, Dev3 = class extends AppCommand {
215920
+ var _a22, Dev3 = class extends AppLinkedCommand {
215816
215921
  static analyticsStopCommand() {
215817
215922
  return "app dev stop";
215818
215923
  }
@@ -216422,7 +216527,7 @@ function renderAppLogsConfigInfo(appName, storeFqdn, storeFqdns, configFile, org
216422
216527
 
216423
216528
  // ../app/dist/cli/commands/app/logs.js
216424
216529
  var import_core24 = __toESM(require_lib2(), 1);
216425
- var _a23, Logs2 = class extends AppCommand {
216530
+ var _a23, Logs2 = class extends AppLinkedCommand {
216426
216531
  async run() {
216427
216532
  let { flags } = await this.parse(_a23), apiKey = flags["client-id"] ?? flags["api-key"];
216428
216533
  await checkFolderIsValidApp(flags.path);
@@ -216495,7 +216600,7 @@ function sources(app) {
216495
216600
  }
216496
216601
 
216497
216602
  // ../app/dist/cli/commands/app/app-logs/sources.js
216498
- var _a24, Sources = class extends AppCommand {
216603
+ var _a24, Sources = class extends AppLinkedCommand {
216499
216604
  async run() {
216500
216605
  let { flags } = await this.parse(_a24), { app } = await linkedAppContext({
216501
216606
  directory: flags.path,
@@ -216776,7 +216881,7 @@ ${newEnvFileContent}
216776
216881
 
216777
216882
  // ../app/dist/cli/commands/app/env/pull.js
216778
216883
  var import_core25 = __toESM(require_lib2(), 1);
216779
- var _a25, EnvPull = class extends AppCommand {
216884
+ var _a25, EnvPull = class extends AppLinkedCommand {
216780
216885
  async run() {
216781
216886
  let { flags } = await this.parse(_a25), { app, remoteApp, organization } = await linkedAppContext({
216782
216887
  directory: flags.path,
@@ -216823,7 +216928,7 @@ async function outputEnv(app, remoteApp, organization, format5) {
216823
216928
  }
216824
216929
 
216825
216930
  // ../app/dist/cli/commands/app/env/show.js
216826
- var _a26, EnvShow = class extends AppCommand {
216931
+ var _a26, EnvShow = class extends AppLinkedCommand {
216827
216932
  async run() {
216828
216933
  let { flags } = await this.parse(_a26), { app, remoteApp, organization } = await linkedAppContext({
216829
216934
  directory: flags.path,
@@ -216913,17 +217018,21 @@ async function inFunctionContext({ path, userProvidedConfigName, apiKey, callbac
216913
217018
  clientId: apiKey,
216914
217019
  forceRelink: reset ?? !1,
216915
217020
  userProvidedConfigName
216916
- }), allFunctions = app.allExtensions.filter((ext) => ext.isFunctionExtension), ourFunction = allFunctions.find((fun) => fun.directory === path);
217021
+ }), ourFunction = await chooseFunction(app, path);
217022
+ return callback(app, developerPlatformClient, ourFunction, organization.id);
217023
+ }
217024
+ async function chooseFunction(app, path) {
217025
+ let allFunctions = app.allExtensions.filter((ext) => ext.isFunctionExtension), ourFunction = allFunctions.find((fun) => fun.directory === path);
216917
217026
  if (ourFunction)
216918
- return callback(app, developerPlatformClient, ourFunction, organization.id);
216919
- if (isTerminalInteractive()) {
216920
- let selectedFunction = await renderAutocompletePrompt({
217027
+ return ourFunction;
217028
+ if (allFunctions.length === 1 && allFunctions[0])
217029
+ return allFunctions[0];
217030
+ if (isTerminalInteractive())
217031
+ return await renderAutocompletePrompt({
216921
217032
  message: "Which function?",
216922
217033
  choices: allFunctions.map((shopifyFunction) => ({ label: shopifyFunction.handle, value: shopifyFunction }))
216923
217034
  });
216924
- return callback(app, developerPlatformClient, selectedFunction, organization.id);
216925
- } else
216926
- throw new AbortError("Run this command from a function directory or use `--path` to specify a function directory.");
217035
+ throw new AbortError("Run this command from a function directory or use `--path` to specify a function directory.");
216927
217036
  }
216928
217037
  async function getOrGenerateSchemaPath(extension, app, developerPlatformClient, orgId) {
216929
217038
  let path = joinPath(extension.directory, "schema.graphql");
@@ -216938,22 +217047,19 @@ async function getOrGenerateSchemaPath(extension, app, developerPlatformClient,
216938
217047
  }
216939
217048
 
216940
217049
  // ../app/dist/cli/commands/app/function/build.js
216941
- var _a27, FunctionBuild = class extends AppCommand {
217050
+ var _a27, FunctionBuild = class extends AppUnlinkedCommand {
216942
217051
  async run() {
216943
- let { flags } = await this.parse(_a27);
216944
- return { app: await inFunctionContext({
216945
- path: flags.path,
216946
- userProvidedConfigName: flags.config,
216947
- apiKey: flags["client-id"],
216948
- reset: flags.reset,
216949
- callback: async (app2, _2, ourFunction) => (await buildFunctionExtension(ourFunction, {
216950
- app: app2,
216951
- stdout: process.stdout,
216952
- stderr: process.stderr,
216953
- useTasks: !0,
216954
- environment: "production"
216955
- }), renderSuccess({ headline: "Function built successfully." }), app2)
216956
- }) };
217052
+ let { flags } = await this.parse(_a27), app = await localAppContext({
217053
+ directory: flags.path,
217054
+ userProvidedConfigName: flags.config
217055
+ }), ourFunction = await chooseFunction(app, flags.path);
217056
+ return await buildFunctionExtension(ourFunction, {
217057
+ app,
217058
+ stdout: process.stdout,
217059
+ stderr: process.stderr,
217060
+ useTasks: !0,
217061
+ environment: "production"
217062
+ }), renderSuccess({ headline: "Function built successfully." }), { app };
216957
217063
  }
216958
217064
  };
216959
217065
  _a27 = FunctionBuild;
@@ -217331,7 +217437,7 @@ function getAllFunctionRunFileNames(functionRunsDir) {
217331
217437
  }
217332
217438
 
217333
217439
  // ../app/dist/cli/commands/app/function/replay.js
217334
- var import_core27 = __toESM(require_lib2(), 1), _a28, FunctionReplay = class extends AppCommand {
217440
+ var import_core27 = __toESM(require_lib2(), 1), _a28, FunctionReplay = class extends AppLinkedCommand {
217335
217441
  async run() {
217336
217442
  let { flags } = await this.parse(_a28);
217337
217443
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -217386,7 +217492,7 @@ var replay_default = FunctionReplay;
217386
217492
  // ../app/dist/cli/commands/app/function/run.js
217387
217493
  init_cjs_shims();
217388
217494
  var import_core28 = __toESM(require_lib2(), 1);
217389
- var _a29, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppCommand {
217495
+ var _a29, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppLinkedCommand {
217390
217496
  async run() {
217391
217497
  let { flags } = await this.parse(_a29);
217392
217498
  return { app: await inFunctionContext({
@@ -217453,7 +217559,7 @@ var run_default = FunctionRun;
217453
217559
  // ../app/dist/cli/commands/app/function/schema.js
217454
217560
  init_cjs_shims();
217455
217561
  var import_core29 = __toESM(require_lib2(), 1);
217456
- var _a30, FetchSchema = class extends AppCommand {
217562
+ var _a30, FetchSchema = class extends AppLinkedCommand {
217457
217563
  async run() {
217458
217564
  let { flags } = await this.parse(_a30);
217459
217565
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -217500,7 +217606,7 @@ var schema_default = FetchSchema;
217500
217606
 
217501
217607
  // ../app/dist/cli/commands/app/function/typegen.js
217502
217608
  init_cjs_shims();
217503
- var _a31, FunctionTypegen = class extends AppCommand {
217609
+ var _a31, FunctionTypegen = class extends AppLinkedCommand {
217504
217610
  async run() {
217505
217611
  let { flags } = await this.parse(_a31);
217506
217612
  return { app: await inFunctionContext({
@@ -217540,11 +217646,14 @@ function isPolarisUnifiedEnabled() {
217540
217646
 
217541
217647
  // ../app/dist/cli/services/generate/fetch-template-specifications.js
217542
217648
  async function fetchExtensionTemplates(developerPlatformClient, app, availableSpecifications) {
217543
- let remoteTemplates = await developerPlatformClient.templateSpecifications(app), polarisUnifiedEnabled = isPolarisUnifiedEnabled();
217544
- return remoteTemplates.filter((template) => availableSpecifications.includes(template.identifier) || availableSpecifications.includes(template.type)).map((template) => template.type === "ui_extension" ? {
217545
- ...template,
217546
- supportedFlavors: template.supportedFlavors.filter((flavor) => polarisUnifiedEnabled ? flavor.value === "preact" : flavor.value !== "preact")
217547
- } : template).filter((template) => template.supportedFlavors.length > 0);
217649
+ let { templates: remoteTemplates, groupOrder } = await developerPlatformClient.templateSpecifications(app), polarisUnifiedEnabled = isPolarisUnifiedEnabled();
217650
+ return {
217651
+ templates: remoteTemplates.filter((template) => availableSpecifications.includes(template.identifier) || availableSpecifications.includes(template.type)).map((template) => template.type === "ui_extension" ? {
217652
+ ...template,
217653
+ supportedFlavors: template.supportedFlavors.filter((flavor) => polarisUnifiedEnabled ? flavor.value === "preact" : flavor.value !== "preact")
217654
+ } : template).filter((template) => template.supportedFlavors.length > 0),
217655
+ groupOrder
217656
+ };
217548
217657
  }
217549
217658
 
217550
217659
  // ../app/dist/cli/prompts/generate/extension.js
@@ -217574,7 +217683,8 @@ var generateExtensionPrompts = async (options2) => {
217574
217683
  throw new AbortError("You have reached the limit for the number of extensions you can create.");
217575
217684
  templateType = await renderAutocompletePrompt({
217576
217685
  message: "Type of extension?",
217577
- choices: buildChoices(extensionTemplates, options2.unavailableExtensions)
217686
+ choices: buildChoices(extensionTemplates, options2.unavailableExtensions),
217687
+ groupOrder: options2.groupOrder
217578
217688
  });
217579
217689
  }
217580
217690
  let extensionTemplate = extensionTemplates.find((template) => template.identifier === templateType), name = options2.name || await promptName(options2.directory, extensionTemplate.defaultName), flavor = options2.extensionFlavor ?? await promptFlavor(extensionTemplate);
@@ -217784,12 +217894,12 @@ async function downloadOrFindTemplateDirectory(url, extensionFlavor, tmpDir, onG
217784
217894
 
217785
217895
  // ../app/dist/cli/services/generate.js
217786
217896
  async function generate(options2) {
217787
- let { app, developerPlatformClient, remoteApp, specifications, template } = options2, availableSpecifications = specifications.map((spec2) => spec2.identifier), extensionTemplates = await fetchExtensionTemplates(developerPlatformClient, remoteApp, availableSpecifications), promptOptions = await buildPromptOptions(extensionTemplates, specifications, app, options2), promptAnswers = await extension_default(promptOptions);
217897
+ let { app, developerPlatformClient, remoteApp, specifications, template } = options2, availableSpecifications = specifications.map((spec2) => spec2.identifier), { templates: extensionTemplates, groupOrder } = await fetchExtensionTemplates(developerPlatformClient, remoteApp, availableSpecifications), promptOptions = await buildPromptOptions(extensionTemplates, groupOrder, specifications, app, options2), promptAnswers = await extension_default(promptOptions);
217788
217898
  await saveAnalyticsMetadata(promptAnswers, template);
217789
217899
  let generateExtensionOptions = buildGenerateOptions(promptAnswers, app, options2, developerPlatformClient), generatedExtension = await generateExtensionTemplate(generateExtensionOptions);
217790
217900
  renderSuccessMessage2(generatedExtension, app.packageManager);
217791
217901
  }
217792
- async function buildPromptOptions(extensionTemplates, specifications, app, options2) {
217902
+ async function buildPromptOptions(extensionTemplates, groupOrder, specifications, app, options2) {
217793
217903
  let extensionTemplate = await handleTypeParameter(options2.template, app, extensionTemplates, specifications);
217794
217904
  validateExtensionFlavor(extensionTemplate, options2.flavor);
217795
217905
  let { validTemplates, templatesOverlimit } = checkLimits(extensionTemplates, specifications, app);
@@ -217801,7 +217911,8 @@ async function buildPromptOptions(extensionTemplates, specifications, app, optio
217801
217911
  app,
217802
217912
  extensionTemplates: validTemplates ?? [],
217803
217913
  unavailableExtensions: templatesOverlimit ?? [],
217804
- reset: options2.reset
217914
+ reset: options2.reset,
217915
+ groupOrder
217805
217916
  };
217806
217917
  }
217807
217918
  function checkLimits(extensionTemplates, specifications, app) {
@@ -217870,7 +217981,7 @@ var generate_default = generate;
217870
217981
 
217871
217982
  // ../app/dist/cli/commands/app/generate/extension.js
217872
217983
  var import_core30 = __toESM(require_lib2(), 1);
217873
- var _a32, AppGenerateExtension = class extends AppCommand {
217984
+ var _a32, AppGenerateExtension = class extends AppLinkedCommand {
217874
217985
  static analyticsNameOverride() {
217875
217986
  return "app scaffold extension";
217876
217987
  }
@@ -218339,7 +218450,7 @@ var getMigrationChoices = () => [
218339
218450
  extensionTypes: ["app_link", "bulk_action"],
218340
218451
  buildTomlObject: buildTomlObject3
218341
218452
  }
218342
- ], ImportExtensions = class _ImportExtensions extends AppCommand {
218453
+ ], ImportExtensions = class _ImportExtensions extends AppLinkedCommand {
218343
218454
  async run() {
218344
218455
  let { flags } = await this.parse(_ImportExtensions), appContext = await linkedAppContext({
218345
218456
  directory: flags.path,
@@ -218537,7 +218648,7 @@ Directory components`.toUpperCase(),
218537
218648
 
218538
218649
  // ../app/dist/cli/commands/app/info.js
218539
218650
  var import_core32 = __toESM(require_lib2(), 1);
218540
- var _a34, AppInfo2 = class extends AppCommand {
218651
+ var _a34, AppInfo2 = class extends AppLinkedCommand {
218541
218652
  async run() {
218542
218653
  let { flags } = await this.parse(_a34), { app, remoteApp, organization, developerPlatformClient } = await linkedAppContext({
218543
218654
  directory: flags.path,
@@ -218887,7 +218998,7 @@ function validateFlavorValue(template, flavor) {
218887
218998
 
218888
218999
  // ../app/dist/cli/commands/app/init.js
218889
219000
  var import_core33 = __toESM(require_lib2(), 1);
218890
- var _a35, Init2 = class extends AppCommand {
219001
+ var _a35, Init2 = class extends AppLinkedCommand {
218891
219002
  async run() {
218892
219003
  let { flags } = await this.parse(_a35);
218893
219004
  validateTemplateValue(flags.template), validateFlavorValue(flags.template, flags.flavor);
@@ -219051,7 +219162,7 @@ ${versionDetails.message}` : ""
219051
219162
 
219052
219163
  // ../app/dist/cli/commands/app/release.js
219053
219164
  var import_core34 = __toESM(require_lib2(), 1);
219054
- var _a36, Release = class extends AppCommand {
219165
+ var _a36, Release = class extends AppLinkedCommand {
219055
219166
  async run() {
219056
219167
  let { flags } = await this.parse(_a36);
219057
219168
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -219170,7 +219281,7 @@ async function versionList(options2) {
219170
219281
  }
219171
219282
 
219172
219283
  // ../app/dist/cli/commands/app/versions/list.js
219173
- var import_core35 = __toESM(require_lib2(), 1), _a37, VersionsList = class extends AppCommand {
219284
+ var import_core35 = __toESM(require_lib2(), 1), _a37, VersionsList = class extends AppLinkedCommand {
219174
219285
  async run() {
219175
219286
  let { flags } = await this.parse(_a37);
219176
219287
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -219342,7 +219453,7 @@ function formatErrors(errors) {
219342
219453
 
219343
219454
  // ../app/dist/cli/commands/app/webhook/trigger.js
219344
219455
  var import_core36 = __toESM(require_lib2(), 1);
219345
- var _a38, WebhookTrigger = class extends AppCommand {
219456
+ var _a38, WebhookTrigger = class extends AppLinkedCommand {
219346
219457
  async run() {
219347
219458
  let { flags } = await this.parse(_a38);
219348
219459
  flags["shared-secret"] && renderWarning({
@@ -219496,7 +219607,7 @@ async function devClean(options2) {
219496
219607
 
219497
219608
  // ../app/dist/cli/commands/app/dev/clean.js
219498
219609
  var import_core37 = __toESM(require_lib2(), 1);
219499
- var _a39, DevClean = class extends AppCommand {
219610
+ var _a39, DevClean = class extends AppLinkedCommand {
219500
219611
  async run() {
219501
219612
  let { flags } = await this.parse(_a39), appContextResult = await linkedAppContext({
219502
219613
  directory: flags.path,