@shopify/create-app 3.81.2 → 3.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-GDQEM2UF.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-SL6HOGUO.js";
21
21
  import {
22
22
  setCurrentCommandId,
23
23
  showNotificationsIfNeeded
24
- } from "./chunk-CSOJOXW2.js";
24
+ } from "./chunk-I6Y6PISS.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-PAVXCWH3.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-F3VN5LFU.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-NV22QPFP.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());
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 {
@@ -194534,13 +194365,16 @@ var PartnersClient = class {
194534
194365
  }
194535
194366
  async templateSpecifications({ apiKey }) {
194536
194367
  let variables = { apiKey };
194537
- return (await this.request(RemoteTemplateSpecificationsQuery, variables)).templateSpecifications.map((template) => {
194538
- let { types, ...rest } = template;
194539
- return {
194540
- ...rest,
194541
- ...types[0]
194542
- };
194543
- });
194368
+ return {
194369
+ templates: (await this.request(RemoteTemplateSpecificationsQuery, variables)).templateSpecifications.map((template) => {
194370
+ let { types, ...rest } = template;
194371
+ return {
194372
+ ...rest,
194373
+ ...types[0]
194374
+ };
194375
+ }),
194376
+ groupOrder: []
194377
+ };
194544
194378
  }
194545
194379
  async createApp(org, options2) {
194546
194380
  let variables = getAppVars(org, options2.name, options2.isLaunchable, options2.scopesArray), result = await this.request(CreateAppQuery, variables);
@@ -197165,8 +196999,13 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
197165
196999
  "This likely means a problem with your internet connection."
197166
197000
  ]);
197167
197001
  }
197168
- let counter = 0;
197169
- return (await allowedTemplates(templates2, async (betaFlags) => this.organizationBetaFlags(organizationId, betaFlags))).map((template) => ({ ...template, sortPriority: counter++ }));
197002
+ let counter = 0, filteredTemplates = (await allowedTemplates(templates2, async (betaFlags) => this.organizationBetaFlags(organizationId, betaFlags))).map((template) => ({ ...template, sortPriority: counter++ })), groupOrder = [];
197003
+ for (let template of templates2)
197004
+ template.group && !groupOrder.includes(template.group) && groupOrder.push(template.group);
197005
+ return {
197006
+ templates: filteredTemplates,
197007
+ groupOrder
197008
+ };
197170
197009
  }
197171
197010
  async createApp(org, options2) {
197172
197011
  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 +199142,205 @@ async function logMetadata(app, organization, resetUsed) {
199303
199142
  cmd_app_reset_used: resetUsed
199304
199143
  }));
199305
199144
  }
199145
+ async function localAppContext({ directory, userProvidedConfigName, unsafeReportMode = !1 }) {
199146
+ let specifications = await loadLocalExtensionsSpecifications();
199147
+ return loadApp({
199148
+ directory,
199149
+ userProvidedConfigName,
199150
+ specifications,
199151
+ mode: unsafeReportMode ? "report" : "strict"
199152
+ });
199153
+ }
199154
+
199155
+ // ../app/dist/cli/utilities/app-unlinked-command.js
199156
+ init_cjs_shims();
199157
+
199158
+ // ../app/dist/cli/utilities/app-command.js
199159
+ init_cjs_shims();
199160
+
199161
+ // ../cli-kit/dist/public/node/base-command.js
199162
+ init_cjs_shims();
199163
+
199164
+ // ../cli-kit/dist/public/node/environments.js
199165
+ init_cjs_shims();
199166
+ function renderWarningIfNeeded(message, silent) {
199167
+ silent || renderWarning(message);
199168
+ }
199169
+ async function loadEnvironment(environmentName, fileName, options2) {
199170
+ let filePath = await environmentFilePath(fileName, options2);
199171
+ if (!filePath) {
199172
+ renderWarningIfNeeded({ body: "Environment file not found." }, options2?.silent);
199173
+ return;
199174
+ }
199175
+ let environments = decodeToml(await readFile(filePath)).environments;
199176
+ if (!environments) {
199177
+ renderWarningIfNeeded({
199178
+ body: ["No environments found in", { command: filePath }, { char: "." }]
199179
+ }, options2?.silent);
199180
+ return;
199181
+ }
199182
+ let environment = environments[environmentName];
199183
+ if (!environment) {
199184
+ renderWarningIfNeeded({
199185
+ body: ["Environment", { command: environmentName }, "not found."]
199186
+ }, options2?.silent);
199187
+ return;
199188
+ }
199189
+ return await addSensitiveMetadata(() => ({
199190
+ environmentFlags: JSON.stringify(environment)
199191
+ })), environment;
199192
+ }
199193
+ async function environmentFilePath(fileName, options2) {
199194
+ let basePath = options2?.from && options2.from !== "." ? options2.from : cwd();
199195
+ return findPathUp(fileName, {
199196
+ cwd: basePath,
199197
+ type: "file"
199198
+ });
199199
+ }
199200
+
199201
+ // ../cli-kit/dist/public/node/base-command.js
199202
+ var import_core2 = __toESM(require_lib2()), BaseCommand = class extends import_core2.Command {
199203
+ // Replace markdown links to plain text like: "link label" (url)
199204
+ static descriptionWithoutMarkdown() {
199205
+ return (this.descriptionWithMarkdown ?? "").replace(/(\[)(.*?)(])(\()(.*?)(\))/gm, '"$2" ($5)');
199206
+ }
199207
+ static analyticsNameOverride() {
199208
+ }
199209
+ static analyticsStopCommand() {
199210
+ }
199211
+ async catch(error) {
199212
+ return error.skipOclifErrorHandling = !0, await errorHandler(error, this.config), import_core2.Errors.handle(error);
199213
+ }
199214
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
199215
+ async init() {
199216
+ return this.exitWithTimestampWhenEnvVariablePresent(), setCurrentCommandId(this.id ?? ""), isDevelopment() || await registerCleanBugsnagErrorsFromWithinPlugins(this.config), this.showNpmFlagWarning(), await showNotificationsIfNeeded(), super.init();
199217
+ }
199218
+ // NPM creates an environment variable for every flag passed to a script.
199219
+ // This function checks for the presence of any of the available CLI flags
199220
+ // and warns the user to use the `--` separator.
199221
+ showNpmFlagWarning() {
199222
+ let commandVariables = this.constructor;
199223
+ Object.keys(commandVariables.flags || {}).map((key) => `npm_config_${underscore(key).replace(/^no_/, "")}`).some((flag) => process.env[flag] !== void 0) && renderWarning({
199224
+ body: [
199225
+ "NPM scripts require an extra",
199226
+ { command: "--" },
199227
+ "separator to pass the flags. Example:",
199228
+ { command: "npm run dev -- --reset" }
199229
+ ]
199230
+ });
199231
+ }
199232
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
199233
+ exitWithTimestampWhenEnvVariablePresent() {
199234
+ isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN) && (outputResult(`
199235
+ SHOPIFY_CLI_TIMESTAMP_START
199236
+ { "timestamp": ${Date.now()} }
199237
+ SHOPIFY_CLI_TIMESTAMP_END
199238
+ `), process.exit(0));
199239
+ }
199240
+ async parse(options2, argv) {
199241
+ let result = await super.parse(options2, argv);
199242
+ return result = await this.resultWithEnvironment(result, options2, argv), await addFromParsedFlags(result.flags), { ...result, argv: result.argv };
199243
+ }
199244
+ environmentsFilename() {
199245
+ }
199246
+ failMissingNonTTYFlags(flags, requiredFlags) {
199247
+ terminalSupportsPrompting() || requiredFlags.forEach((name) => {
199248
+ if (!(name in flags))
199249
+ throw new AbortError(outputContent`Flag not specified:
199250
+
199251
+ ${outputToken.cyan(name)}
199252
+
199253
+ 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.");
199254
+ });
199255
+ }
199256
+ async resultWithEnvironment(originalResult, options2, argv) {
199257
+ let flags = originalResult.flags, environmentsFileName = this.environmentsFilename();
199258
+ if (!environmentsFileName)
199259
+ return originalResult;
199260
+ let environmentFileExists = await environmentFilePath(environmentsFileName, { from: flags.path }), environments = [];
199261
+ flags.environment && (environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment]);
199262
+ let environmentSpecified = environments.length > 0;
199263
+ if (!environmentFileExists && !environmentSpecified || environmentSpecified && environments.length > 1)
199264
+ return originalResult;
199265
+ let { environment, isDefaultEnvironment } = await this.loadEnvironmentForCommand(flags.path, environmentsFileName, environments[0]);
199266
+ if (!environment)
199267
+ return originalResult;
199268
+ let noDefaultsResult = await super.parse(noDefaultsOptions(options2), argv), result = await super.parse(options2, [
199269
+ // Need to specify argv default because we're merging with argsFromEnvironment.
199270
+ ...argv ?? this.argv,
199271
+ ...argsFromEnvironment(environment, options2, noDefaultsResult),
199272
+ ...isDefaultEnvironment ? ["--environment", "default"] : []
199273
+ ]);
199274
+ return reportEnvironmentApplication(noDefaultsResult.flags, result.flags, isDefaultEnvironment ? "default" : environments[0], environment), result;
199275
+ }
199276
+ /**
199277
+ * Tries to load an environment to forward to the command. If no environment
199278
+ * is specified it will try to load a default environment.
199279
+ */
199280
+ async loadEnvironmentForCommand(path, environmentsFileName, specifiedEnvironment) {
199281
+ return specifiedEnvironment ? { environment: await loadEnvironment(specifiedEnvironment, environmentsFileName, { from: path }), isDefaultEnvironment: !1 } : { environment: await loadEnvironment("default", environmentsFileName, { from: path, silent: !0 }), isDefaultEnvironment: !0 };
199282
+ }
199283
+ };
199284
+ BaseCommand.baseFlags = {};
199285
+ async function addFromParsedFlags(flags) {
199286
+ await addPublicMetadata(() => ({
199287
+ cmd_all_verbose: flags.verbose,
199288
+ cmd_all_path_override: flags.path !== void 0,
199289
+ cmd_all_path_override_hash: flags.path === void 0 ? void 0 : hashString(flags.path)
199290
+ }));
199291
+ }
199292
+ function reportEnvironmentApplication(noDefaultsFlags, flagsWithEnvironments, environmentName, environment) {
199293
+ let changes = {};
199294
+ for (let [name, value] of Object.entries(flagsWithEnvironments)) {
199295
+ let userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name), environmentContainsFlag = Object.prototype.hasOwnProperty.call(environment, name);
199296
+ if (!userSpecifiedThisFlag && environmentContainsFlag) {
199297
+ let valueToReport = name === "password" ? `********${value.substr(-4)}` : value;
199298
+ changes[name] = valueToReport;
199299
+ }
199300
+ }
199301
+ if (Object.keys(changes).length === 0)
199302
+ return;
199303
+ let items = Object.entries(changes).map(([name, value]) => `${name}: ${value}`);
199304
+ renderInfo({
199305
+ headline: ["Using applicable flags from", { userInput: environmentName }, "environment:"],
199306
+ body: [{ list: { items } }]
199307
+ });
199308
+ }
199309
+ function noDefaultsOptions(options2) {
199310
+ return options2?.flags ? {
199311
+ ...options2,
199312
+ flags: Object.fromEntries(Object.entries(options2.flags).map(([label, settings]) => {
199313
+ let copiedSettings = { ...settings };
199314
+ return delete copiedSettings.default, [label, copiedSettings];
199315
+ }))
199316
+ } : options2;
199317
+ }
199318
+ function argsFromEnvironment(environment, options2, noDefaultsResult) {
199319
+ let args = [];
199320
+ for (let [label, value] of Object.entries(environment)) {
199321
+ let flagIsRelevantToCommand = options2?.flags && Object.prototype.hasOwnProperty.call(options2.flags, label), userSpecifiedThisFlag = noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label);
199322
+ if (flagIsRelevantToCommand && !userSpecifiedThisFlag)
199323
+ if (typeof value == "boolean")
199324
+ if (value)
199325
+ args.push(`--${label}`);
199326
+ else
199327
+ throw new AbortError(outputContent`Environments can only specify true for boolean flags. Attempted to set ${outputToken.yellow(label)} to false.`);
199328
+ else Array.isArray(value) ? value.forEach((element) => args.push(`--${label}`, `${element}`)) : args.push(`--${label}`, `${value}`);
199329
+ }
199330
+ return args;
199331
+ }
199332
+ var base_command_default = BaseCommand;
199333
+
199334
+ // ../app/dist/cli/utilities/app-command.js
199335
+ var AppCommand = class extends base_command_default {
199336
+ environmentsFilename() {
199337
+ return configurationFileNames.appEnvironments;
199338
+ }
199339
+ };
199340
+
199341
+ // ../app/dist/cli/utilities/app-unlinked-command.js
199342
+ var AppUnlinkedCommand = class extends AppCommand {
199343
+ };
199306
199344
 
199307
199345
  // ../app/dist/cli/commands/app/build.js
199308
199346
  var import_core4 = __toESM(require_lib2(), 1);
@@ -199314,7 +199352,7 @@ init_cjs_shims();
199314
199352
  init_cjs_shims();
199315
199353
  import { fileURLToPath as fileURLToPath2 } from "node:url";
199316
199354
  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");
199355
+ let { errorHandler: errorHandler3 } = await import("./error-handler-CEA2CASG.js"), { isDevelopment: isDevelopment2 } = await import("./local-QAYZ4QC3.js"), oclif = await import("./lib-UJ7YNLH4.js"), { ShopifyConfig } = await import("./custom-oclif-loader-KNMTQ32B.js");
199318
199356
  isDevelopment2() && (oclif.default.settings.debug = !0);
199319
199357
  try {
199320
199358
  let config2 = new ShopifyConfig({ root: fileURLToPath2(options2.moduleURL) });
@@ -199329,7 +199367,7 @@ var import_core3 = __toESM(require_lib2());
199329
199367
  async function exitIfOldNodeVersion(versions2 = process.versions) {
199330
199368
  let nodeVersion = versions2.node, nodeMajorVersion = Number(nodeVersion.split(".")[0]);
199331
199369
  if (nodeMajorVersion < 18) {
199332
- let { renderError: renderError2 } = await import("./ui-TUFRYZMP.js");
199370
+ let { renderError: renderError2 } = await import("./ui-YMMRDCYD.js");
199333
199371
  renderError2({
199334
199372
  headline: "Upgrade to a supported Node version now.",
199335
199373
  body: [
@@ -199356,7 +199394,7 @@ async function runCLI(options2, launchCLI2 = launchCLI, argv = process.argv, env
199356
199394
  return setupEnvironmentVariables(options2, argv, env), options2.runInCreateMode && await addInitToArgvWhenRunningCreateCLI(options2, argv), forceNoColor(argv, env), await exitIfOldNodeVersion(versions2), launchCLI2({ moduleURL: options2.moduleURL });
199357
199395
  }
199358
199396
  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-", "");
199397
+ let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-3VNYJANO.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-COZT77T2.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options2.moduleURL))).content.name.replace("@shopify/create-", "");
199360
199398
  if (argv.findIndex((arg) => arg.includes("init")) === -1) {
199361
199399
  let initIndex2 = argv.findIndex((arg) => arg.match(new RegExp(`bin(\\/|\\\\)+(create-${name}|dev|run)`))) + 1;
199362
199400
  argv.splice(initIndex2, 0, "init");
@@ -199387,7 +199425,7 @@ var globalFlags = {
199387
199425
  };
199388
199426
 
199389
199427
  // ../app/dist/cli/commands/app/build.js
199390
- var _a, Build = class extends AppCommand {
199428
+ var _a, Build = class extends AppUnlinkedCommand {
199391
199429
  async run() {
199392
199430
  let { flags } = await this.parse(_a);
199393
199431
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -199395,10 +199433,8 @@ var _a, Build = class extends AppCommand {
199395
199433
  await addPublicMetadata(() => ({
199396
199434
  cmd_app_dependency_installation_skipped: flags["skip-dependencies-installation"]
199397
199435
  }));
199398
- let { app } = await linkedAppContext({
199436
+ let app = await localAppContext({
199399
199437
  directory: flags.path,
199400
- clientId: apiKey,
199401
- forceRelink: flags.reset,
199402
199438
  userProvidedConfigName: flags.config
199403
199439
  });
199404
199440
  return await build_default({ app, skipDependenciesInstallation: flags["skip-dependencies-installation"], apiKey }), { app };
@@ -199428,7 +199464,14 @@ var build_default2 = Build;
199428
199464
 
199429
199465
  // ../app/dist/cli/commands/app/config/link.js
199430
199466
  init_cjs_shims();
199431
- var _a2, ConfigLink = class extends AppCommand {
199467
+
199468
+ // ../app/dist/cli/utilities/app-linked-command.js
199469
+ init_cjs_shims();
199470
+ var AppLinkedCommand = class extends AppCommand {
199471
+ };
199472
+
199473
+ // ../app/dist/cli/commands/app/config/link.js
199474
+ var _a2, ConfigLink = class extends AppLinkedCommand {
199432
199475
  async run() {
199433
199476
  let { flags } = await this.parse(_a2), options2 = {
199434
199477
  directory: flags.path,
@@ -199459,7 +199502,7 @@ var link_default = ConfigLink;
199459
199502
  // ../app/dist/cli/commands/app/config/use.js
199460
199503
  init_cjs_shims();
199461
199504
  var import_core5 = __toESM(require_lib2(), 1);
199462
- var _a3, { config, ...appFlagsWithoutConfig } = appFlags, ConfigUse = class extends AppCommand {
199505
+ var _a3, { config, ...appFlagsWithoutConfig } = appFlags, ConfigUse = class extends AppLinkedCommand {
199463
199506
  async run() {
199464
199507
  let { flags, args } = await this.parse(_a3);
199465
199508
  await checkFolderIsValidApp(flags.path), await use({ directory: flags.path, configName: args.config, reset: flags.reset });
@@ -199881,7 +199924,7 @@ var AppEventWatcher = class extends EventEmitter {
199881
199924
  };
199882
199925
 
199883
199926
  // ../app/dist/cli/commands/app/demo/watcher.js
199884
- var DemoWatcher = class _DemoWatcher extends AppCommand {
199927
+ var DemoWatcher = class _DemoWatcher extends AppLinkedCommand {
199885
199928
  async run() {
199886
199929
  let { flags } = await this.parse(_DemoWatcher), { app } = await linkedAppContext({
199887
199930
  directory: flags.path,
@@ -200248,7 +200291,7 @@ function validateMessage(message) {
200248
200291
 
200249
200292
  // ../app/dist/cli/commands/app/deploy.js
200250
200293
  var import_core6 = __toESM(require_lib2(), 1);
200251
- var _a4, Deploy = class extends AppCommand {
200294
+ var _a4, Deploy = class extends AppLinkedCommand {
200252
200295
  async run() {
200253
200296
  let { flags } = await this.parse(_a4);
200254
200297
  await metadata_default.addPublicMetadata(() => ({
@@ -202197,7 +202240,7 @@ init_cjs_shims();
202197
202240
  var import_core7 = __toESM(require_lib2(), 1);
202198
202241
  var themeFlags = {
202199
202242
  path: import_core7.Flags.string({
202200
- description: "The path to your theme directory.",
202243
+ description: "The path where you want to run the command. Defaults to the current working directory.",
202201
202244
  env: "SHOPIFY_FLAG_PATH",
202202
202245
  parse: async (input) => resolvePath(input),
202203
202246
  default: async () => cwd(),
@@ -202475,7 +202518,7 @@ function assertThemeStoreExists(storage = themeLocalStorage()) {
202475
202518
  function ensureThemeStore(flags) {
202476
202519
  let store = flags.store || getThemeStore();
202477
202520
  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.`);
202521
+ 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
202522
  return setThemeStore(store), store;
202480
202523
  }
202481
202524
 
@@ -202517,33 +202560,53 @@ var ThemeCommand = class extends base_command_default {
202517
202560
  environmentsFilename() {
202518
202561
  return configurationFileName;
202519
202562
  }
202520
- async command(_flags, _session) {
202563
+ async command(_flags, _session, _context) {
202521
202564
  }
202522
202565
  async run(_opts) {
202523
202566
  let klass = this.constructor, requiredFlags = klass.multiEnvironmentsFlags, { flags } = await this.parse(klass);
202524
- if (!flags.environment) {
202567
+ if (!flags.environment?.length) {
202568
+ let session = await this.ensureAuthenticated(flags);
202569
+ await this.command(flags, session);
202570
+ return;
202571
+ }
202572
+ let environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment];
202573
+ if (environments.length === 1) {
202525
202574
  let session = await this.ensureAuthenticated(flags);
202526
202575
  await this.command(flags, session);
202527
202576
  return;
202528
202577
  }
202529
- let sessions = {}, environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment];
202578
+ let sessions = {};
202530
202579
  for (let environmentName of environments) {
202531
- let environmentConfig = await loadEnvironment(environmentName, "shopify.theme.toml", { from: flags.path });
202580
+ let environmentConfig = await loadEnvironment(environmentName, "shopify.theme.toml", {
202581
+ from: flags.path,
202582
+ silent: !0
202583
+ });
202532
202584
  sessions[environmentName] = await this.ensureAuthenticated(environmentConfig);
202533
202585
  }
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
- }));
202586
+ let abortController = new AbortController2();
202587
+ await renderConcurrent({
202588
+ processes: environments.map((environment) => ({
202589
+ prefix: environment,
202590
+ action: async (stdout, stderr, _signal) => {
202591
+ let environmentConfig = await loadEnvironment(environment, "shopify.theme.toml", {
202592
+ from: flags.path,
202593
+ silent: !0
202594
+ }), environmentFlags = {
202595
+ ...flags,
202596
+ ...environmentConfig,
202597
+ environment: [environment]
202598
+ };
202599
+ if (!this.validConfig(environmentConfig, requiredFlags, environment))
202600
+ return;
202601
+ let session = sessions[environment];
202602
+ if (!session)
202603
+ throw new AbortError(`No session found for environment ${environment}`);
202604
+ await this.command(environmentFlags, session, { stdout, stderr });
202605
+ }
202606
+ })),
202607
+ abortSignal: abortController.signal,
202608
+ showTimestamps: !0
202609
+ });
202547
202610
  }
202548
202611
  async ensureAuthenticated(flags) {
202549
202612
  let store = flags.store, password = flags.password;
@@ -202744,7 +202807,7 @@ async function getStorefrontSessionCookies(storeUrl, themeId, password, headers
202744
202807
  let storefrontDigest = await enrichSessionWithStorefrontPassword(shopifyEssential, storeUrl, password, headers);
202745
202808
  return cookieRecord.storefront_digest = storefrontDigest, cookieRecord;
202746
202809
  }
202747
- async function sessionEssentialCookie(storeUrl, themeId, headers) {
202810
+ async function sessionEssentialCookie(storeUrl, themeId, headers, retries = 1) {
202748
202811
  let params = new URLSearchParams({
202749
202812
  preview_theme_id: themeId,
202750
202813
  _fd: "0",
@@ -202757,12 +202820,18 @@ async function sessionEssentialCookie(storeUrl, themeId, headers) {
202757
202820
  ...defaultHeaders()
202758
202821
  }
202759
202822
  }), setCookies = response.headers.raw()["set-cookie"] ?? [], shopifyEssential = getCookie(setCookies, "_shopify_essential");
202760
- if (!shopifyEssential)
202761
- throw outputDebug(`Failed to obtain _shopify_essential cookie.
202823
+ if (!shopifyEssential) {
202824
+ if (outputDebug(`Failed to obtain _shopify_essential cookie.
202762
202825
 
202763
202826
  -Request ID: ${response.headers.get("x-request-id") ?? "unknown"}
202764
202827
 
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.');
202828
+ -Body: ${await response.text()}
202829
+
202830
+ -Status: ${response.status}
202831
+ `), retries > 3)
202832
+ throw new ShopifyEssentialError('Your development session could not be created because the "_shopify_essential" could not be defined. Please, check your internet connection.');
202833
+ return outputDebug("Retrying to obtain the _shopify_essential cookie..."), await sleep(retries), sessionEssentialCookie(storeUrl, themeId, headers, retries + 1);
202834
+ }
202766
202835
  return shopifyEssential;
202767
202836
  }
202768
202837
  async function enrichSessionWithStorefrontPassword(shopifyEssential, storeUrl, password, headers) {
@@ -204267,9 +204336,7 @@ Console.descriptionWithMarkdown = `Starts the Shopify Liquid REPL (read-eval-pri
204267
204336
  Console.description = _a6.descriptionWithoutMarkdown();
204268
204337
  Console.flags = {
204269
204338
  ...globalFlags,
204270
- store: themeFlags.store,
204271
- password: themeFlags.password,
204272
- environment: themeFlags.environment,
204339
+ ...themeFlags,
204273
204340
  url: import_core9.Flags.string({
204274
204341
  description: "The url to be used as context",
204275
204342
  env: "SHOPIFY_FLAG_URL",
@@ -204495,7 +204562,7 @@ Delete.description = _a7.descriptionWithoutMarkdown();
204495
204562
  Delete.strict = !1;
204496
204563
  Delete.flags = {
204497
204564
  ...globalFlags,
204498
- password: themeFlags.password,
204565
+ ...themeFlags,
204499
204566
  development: import_core10.Flags.boolean({
204500
204567
  char: "d",
204501
204568
  description: "Delete your development theme.",
@@ -204516,9 +204583,7 @@ Delete.flags = {
204516
204583
  description: "Theme ID or name of the remote theme.",
204517
204584
  env: "SHOPIFY_FLAG_THEME_ID",
204518
204585
  multiple: !0
204519
- }),
204520
- store: themeFlags.store,
204521
- environment: themeFlags.environment
204586
+ })
204522
204587
  };
204523
204588
 
204524
204589
  // ../theme/dist/cli/commands/theme/dev.js
@@ -206930,7 +206995,7 @@ You can run this command only in a directory that matches the [default Shopify t
206930
206995
  Dev.description = _a8.descriptionWithoutMarkdown();
206931
206996
  Dev.flags = {
206932
206997
  ...globalFlags,
206933
- path: themeFlags.path,
206998
+ ...themeFlags,
206934
206999
  host: import_core11.Flags.string({
206935
207000
  description: "Set which network interface the web server listens on. The default value is 127.0.0.1.",
206936
207001
  env: "SHOPIFY_FLAG_HOST"
@@ -206966,7 +207031,6 @@ Dev.flags = {
206966
207031
  description: "Local port to serve theme preview from.",
206967
207032
  env: "SHOPIFY_FLAG_PORT"
206968
207033
  }),
206969
- store: themeFlags.store,
206970
207034
  theme: import_core11.Flags.string({
206971
207035
  char: "t",
206972
207036
  description: "Theme ID or name of the remote theme.",
@@ -206995,8 +207059,6 @@ Dev.flags = {
206995
207059
  description: "Proceed without confirmation, if current directory does not seem to be theme directory.",
206996
207060
  env: "SHOPIFY_FLAG_FORCE"
206997
207061
  }),
206998
- password: themeFlags.password,
206999
- environment: themeFlags.environment,
207000
207062
  notify: import_core11.Flags.string({
207001
207063
  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
207064
  env: "SHOPIFY_FLAG_NOTIFY"
@@ -207113,9 +207175,7 @@ Info.description = "Displays information about your theme environment, including
207113
207175
  Info.flags = {
207114
207176
  ...globalFlags,
207115
207177
  ...jsonFlag,
207116
- store: themeFlags.store,
207117
- password: themeFlags.password,
207118
- environment: themeFlags.environment,
207178
+ ...themeFlags,
207119
207179
  development: import_core12.Flags.boolean({
207120
207180
  char: "d",
207121
207181
  description: "Retrieve info from your development theme.",
@@ -210541,6 +210601,15 @@ async function insideGitDirectory(directory) {
210541
210601
  async function isClean(directory) {
210542
210602
  return (await esm_default({ baseDir: directory }).status()).isClean();
210543
210603
  }
210604
+ async function removeGitRemote(directory, remoteName = "origin") {
210605
+ outputDebug(outputContent`Removing git remote ${remoteName} from ${outputToken.path(directory)}...`), await ensureGitIsPresentOrAbort();
210606
+ let repo = esm_default(directory);
210607
+ if (!(await repo.getRemotes()).some((remote) => remote.name === remoteName)) {
210608
+ outputDebug(outputContent`Remote ${remoteName} does not exist, no action needed`);
210609
+ return;
210610
+ }
210611
+ await repo.removeRemote(remoteName);
210612
+ }
210544
210613
 
210545
210614
  // ../theme/dist/cli/services/init.js
210546
210615
  async function cloneRepo(repoUrl, destination) {
@@ -210557,8 +210626,9 @@ async function downloadRepository(repoUrl, destination, latestTag) {
210557
210626
  await downloadGitRepository({
210558
210627
  repoUrl,
210559
210628
  destination,
210560
- latestTag
210561
- });
210629
+ latestTag,
210630
+ shallow: !0
210631
+ }), await removeGitRemote(destination);
210562
210632
  }
210563
210633
  }
210564
210634
  ]);
@@ -210706,8 +210776,7 @@ List2.description = "Lists the themes in your store, along with their IDs and st
210706
210776
  List2.flags = {
210707
210777
  ...globalFlags,
210708
210778
  ...jsonFlag,
210709
- password: themeFlags.password,
210710
- store: themeFlags.store,
210779
+ ...themeFlags,
210711
210780
  role: import_core14.Flags.custom({
210712
210781
  description: "Only list themes with the given role.",
210713
210782
  options: ALLOWED_ROLES,
@@ -210720,8 +210789,7 @@ List2.flags = {
210720
210789
  id: import_core14.Flags.integer({
210721
210790
  description: "Only list theme with the given ID.",
210722
210791
  env: "SHOPIFY_FLAG_ID"
210723
- }),
210724
- environment: themeFlags.environment
210792
+ })
210725
210793
  };
210726
210794
  List2.multiEnvironmentsFlags = ["store", "password"];
210727
210795
 
@@ -210776,7 +210844,7 @@ Open.descriptionWithMarkdown = `Returns links that let you preview the specified
210776
210844
  Open.description = _a13.descriptionWithoutMarkdown();
210777
210845
  Open.flags = {
210778
210846
  ...globalFlags,
210779
- password: themeFlags.password,
210847
+ ...themeFlags,
210780
210848
  development: import_core15.Flags.boolean({
210781
210849
  char: "d",
210782
210850
  description: "Open your development theme.",
@@ -210796,9 +210864,7 @@ Open.flags = {
210796
210864
  char: "t",
210797
210865
  description: "Theme ID or name of the remote theme.",
210798
210866
  env: "SHOPIFY_FLAG_THEME_ID"
210799
- }),
210800
- store: themeFlags.store,
210801
- environment: themeFlags.environment
210867
+ })
210802
210868
  };
210803
210869
 
210804
210870
  // ../theme/dist/cli/commands/theme/package.js
@@ -210811,6 +210877,7 @@ var import_theme_check_node5 = __toESM(require_dist5(), 1), themeFilesPattern =
210811
210877
  "blocks/**",
210812
210878
  "config/**",
210813
210879
  "layout/**",
210880
+ "listings/**/*",
210814
210881
  "locales/**",
210815
210882
  "sections/**",
210816
210883
  "snippets/**",
@@ -210858,6 +210925,8 @@ Package.descriptionWithMarkdown = `Packages your local theme files into a ZIP fi
210858
210925
 
210859
210926
  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
210927
 
210928
+ 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)).
210929
+
210861
210930
  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
210931
  Package.description = _a14.descriptionWithoutMarkdown();
210863
210932
  Package.flags = {
@@ -210939,8 +211008,7 @@ Profile.descriptionWithMarkdown = `Profile the Shopify Liquid on a given page.
210939
211008
  Profile.description = _a15.descriptionWithoutMarkdown();
210940
211009
  Profile.flags = {
210941
211010
  ...globalFlags,
210942
- store: themeFlags.store,
210943
- password: themeFlags.password,
211011
+ ...themeFlags,
210944
211012
  theme: import_core16.Flags.string({
210945
211013
  char: "t",
210946
211014
  description: "Theme ID or name of the remote theme.",
@@ -210955,7 +211023,6 @@ Profile.flags = {
210955
211023
  description: "The password for storefronts with password protection.",
210956
211024
  env: "SHOPIFY_FLAG_STORE_PASSWORD"
210957
211025
  }),
210958
- environment: themeFlags.environment,
210959
211026
  ...jsonFlag
210960
211027
  };
210961
211028
 
@@ -211027,7 +211094,7 @@ Publish.description = _a16.descriptionWithoutMarkdown();
211027
211094
  Publish.strict = !1;
211028
211095
  Publish.flags = {
211029
211096
  ...globalFlags,
211030
- password: themeFlags.password,
211097
+ ...themeFlags,
211031
211098
  force: import_core17.Flags.boolean({
211032
211099
  char: "f",
211033
211100
  description: "Skip confirmation.",
@@ -211037,9 +211104,7 @@ Publish.flags = {
211037
211104
  char: "t",
211038
211105
  description: "Theme ID or name of the remote theme.",
211039
211106
  env: "SHOPIFY_FLAG_THEME_ID"
211040
- }),
211041
- store: themeFlags.store,
211042
- environment: themeFlags.environment
211107
+ })
211043
211108
  };
211044
211109
 
211045
211110
  // ../theme/dist/cli/commands/theme/metafields/pull.js
@@ -211536,9 +211601,7 @@ Rename.descriptionWithMarkdown = `Renames a theme in your store.
211536
211601
  Rename.description = _a20.descriptionWithoutMarkdown();
211537
211602
  Rename.flags = {
211538
211603
  ...globalFlags,
211539
- store: themeFlags.store,
211540
- password: themeFlags.password,
211541
- environment: themeFlags.environment,
211604
+ ...themeFlags,
211542
211605
  name: import_core21.Flags.string({
211543
211606
  char: "n",
211544
211607
  description: "The new name for the theme.",
@@ -211966,7 +212029,7 @@ init_cjs_shims();
211966
212029
  init_cjs_shims();
211967
212030
  var EventType2;
211968
212031
  (function(EventType3) {
211969
- EventType3.Update = "update", EventType3.Dispatch = "dispatch";
212032
+ EventType3.Update = "update", EventType3.Dispatch = "dispatch", EventType3.Log = "log";
211970
212033
  })(EventType2 || (EventType2 = {}));
211971
212034
 
211972
212035
  // ../app/dist/cli/services/dev/extension/websocket/handlers.js
@@ -211986,12 +212049,49 @@ function getConnectionDoneHandler(wss, options2) {
211986
212049
  outputDebug(outputContent`Sending connected payload: ${outputToken.json(connectedPayload)}`, options2.stdout), ws.send(JSON.stringify(connectedPayload)), ws.on("message", getOnMessageHandler(wss, options2));
211987
212050
  };
211988
212051
  }
212052
+ function parseLogMessage(message) {
212053
+ try {
212054
+ let parsed = JSON.parse(message);
212055
+ if (!Array.isArray(parsed))
212056
+ return message;
212057
+ let formatted = parsed.map((arg) => typeof arg == "object" && arg !== null ? outputToken.json(arg).output() : String(arg)).join(" ");
212058
+ return outputContent`${formatted}`.value;
212059
+ } catch (error) {
212060
+ if (error instanceof SyntaxError)
212061
+ return message;
212062
+ throw error;
212063
+ }
212064
+ }
212065
+ var consoleTypeColors = {
212066
+ debug: (text) => outputToken.gray(text),
212067
+ warn: (text) => outputToken.yellow(text),
212068
+ error: (text) => outputToken.errorText(text)
212069
+ };
212070
+ function getOutput({ type, message }) {
212071
+ let formattedMessage = parseLogMessage(message);
212072
+ switch (type) {
212073
+ case "debug":
212074
+ case "warn":
212075
+ case "error":
212076
+ return outputContent`${consoleTypeColors[type](type.toUpperCase())}: ${formattedMessage}`.value;
212077
+ case "log":
212078
+ case "info":
212079
+ return formattedMessage;
212080
+ default:
212081
+ return `${type.toUpperCase()}: ${formattedMessage}`;
212082
+ }
212083
+ }
212084
+ function handleLogEvent(eventData, options2) {
212085
+ useConcurrentOutputContext({ outputPrefix: eventData.extensionName, stripAnsi: !1 }, () => {
212086
+ options2.stdout.write(getOutput(eventData));
212087
+ });
212088
+ }
211989
212089
  function getOnMessageHandler(wss, options2) {
211990
212090
  return (data) => {
211991
212091
  let jsonData = JSON.parse(data.toString()), { event: eventType, data: eventData } = jsonData;
211992
212092
  if (outputDebug(outputContent`Received websocket message with event type ${eventType} and data:
211993
212093
  ${outputToken.json(eventData)}
211994
- `, options2.stdout), eventType === "update") {
212094
+ `, options2.stdout), eventType === EventType2.Update) {
211995
212095
  let payloadStoreApiKey = options2.payloadStore.getRawPayload().app.apiKey, eventAppApiKey = eventData.app?.apiKey;
211996
212096
  if (eventData.app) {
211997
212097
  if (payloadStoreApiKey !== eventAppApiKey)
@@ -211999,10 +212099,10 @@ ${outputToken.json(eventData)}
211999
212099
  options2.payloadStore.updateApp(eventData.app);
212000
212100
  }
212001
212101
  eventData.extensions && options2.payloadStore.updateExtensions(eventData.extensions);
212002
- } else if (eventType === "dispatch") {
212102
+ } else if (eventType === EventType2.Dispatch) {
212003
212103
  let outGoingMessage = getOutgoingDispatchMessage(jsonData, options2);
212004
212104
  notifyClients(wss, outGoingMessage, options2);
212005
- }
212105
+ } else eventType === EventType2.Log && handleLogEvent(eventData, options2);
212006
212106
  };
212007
212107
  }
212008
212108
  function getPayloadUpdateHandler(wss, options2) {
@@ -215812,7 +215912,7 @@ async function getTunnelMode({ useLocalhost, localhostPort, tunnelUrl }) {
215812
215912
 
215813
215913
  // ../app/dist/cli/commands/app/dev.js
215814
215914
  var import_core23 = __toESM(require_lib2(), 1);
215815
- var _a22, Dev3 = class extends AppCommand {
215915
+ var _a22, Dev3 = class extends AppLinkedCommand {
215816
215916
  static analyticsStopCommand() {
215817
215917
  return "app dev stop";
215818
215918
  }
@@ -216422,7 +216522,7 @@ function renderAppLogsConfigInfo(appName, storeFqdn, storeFqdns, configFile, org
216422
216522
 
216423
216523
  // ../app/dist/cli/commands/app/logs.js
216424
216524
  var import_core24 = __toESM(require_lib2(), 1);
216425
- var _a23, Logs2 = class extends AppCommand {
216525
+ var _a23, Logs2 = class extends AppLinkedCommand {
216426
216526
  async run() {
216427
216527
  let { flags } = await this.parse(_a23), apiKey = flags["client-id"] ?? flags["api-key"];
216428
216528
  await checkFolderIsValidApp(flags.path);
@@ -216495,7 +216595,7 @@ function sources(app) {
216495
216595
  }
216496
216596
 
216497
216597
  // ../app/dist/cli/commands/app/app-logs/sources.js
216498
- var _a24, Sources = class extends AppCommand {
216598
+ var _a24, Sources = class extends AppLinkedCommand {
216499
216599
  async run() {
216500
216600
  let { flags } = await this.parse(_a24), { app } = await linkedAppContext({
216501
216601
  directory: flags.path,
@@ -216776,7 +216876,7 @@ ${newEnvFileContent}
216776
216876
 
216777
216877
  // ../app/dist/cli/commands/app/env/pull.js
216778
216878
  var import_core25 = __toESM(require_lib2(), 1);
216779
- var _a25, EnvPull = class extends AppCommand {
216879
+ var _a25, EnvPull = class extends AppLinkedCommand {
216780
216880
  async run() {
216781
216881
  let { flags } = await this.parse(_a25), { app, remoteApp, organization } = await linkedAppContext({
216782
216882
  directory: flags.path,
@@ -216823,7 +216923,7 @@ async function outputEnv(app, remoteApp, organization, format5) {
216823
216923
  }
216824
216924
 
216825
216925
  // ../app/dist/cli/commands/app/env/show.js
216826
- var _a26, EnvShow = class extends AppCommand {
216926
+ var _a26, EnvShow = class extends AppLinkedCommand {
216827
216927
  async run() {
216828
216928
  let { flags } = await this.parse(_a26), { app, remoteApp, organization } = await linkedAppContext({
216829
216929
  directory: flags.path,
@@ -216913,17 +217013,21 @@ async function inFunctionContext({ path, userProvidedConfigName, apiKey, callbac
216913
217013
  clientId: apiKey,
216914
217014
  forceRelink: reset ?? !1,
216915
217015
  userProvidedConfigName
216916
- }), allFunctions = app.allExtensions.filter((ext) => ext.isFunctionExtension), ourFunction = allFunctions.find((fun) => fun.directory === path);
217016
+ }), ourFunction = await chooseFunction(app, path);
217017
+ return callback(app, developerPlatformClient, ourFunction, organization.id);
217018
+ }
217019
+ async function chooseFunction(app, path) {
217020
+ let allFunctions = app.allExtensions.filter((ext) => ext.isFunctionExtension), ourFunction = allFunctions.find((fun) => fun.directory === path);
216917
217021
  if (ourFunction)
216918
- return callback(app, developerPlatformClient, ourFunction, organization.id);
216919
- if (isTerminalInteractive()) {
216920
- let selectedFunction = await renderAutocompletePrompt({
217022
+ return ourFunction;
217023
+ if (allFunctions.length === 1 && allFunctions[0])
217024
+ return allFunctions[0];
217025
+ if (isTerminalInteractive())
217026
+ return await renderAutocompletePrompt({
216921
217027
  message: "Which function?",
216922
217028
  choices: allFunctions.map((shopifyFunction) => ({ label: shopifyFunction.handle, value: shopifyFunction }))
216923
217029
  });
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.");
217030
+ throw new AbortError("Run this command from a function directory or use `--path` to specify a function directory.");
216927
217031
  }
216928
217032
  async function getOrGenerateSchemaPath(extension, app, developerPlatformClient, orgId) {
216929
217033
  let path = joinPath(extension.directory, "schema.graphql");
@@ -216938,22 +217042,19 @@ async function getOrGenerateSchemaPath(extension, app, developerPlatformClient,
216938
217042
  }
216939
217043
 
216940
217044
  // ../app/dist/cli/commands/app/function/build.js
216941
- var _a27, FunctionBuild = class extends AppCommand {
217045
+ var _a27, FunctionBuild = class extends AppUnlinkedCommand {
216942
217046
  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
- }) };
217047
+ let { flags } = await this.parse(_a27), app = await localAppContext({
217048
+ directory: flags.path,
217049
+ userProvidedConfigName: flags.config
217050
+ }), ourFunction = await chooseFunction(app, flags.path);
217051
+ return await buildFunctionExtension(ourFunction, {
217052
+ app,
217053
+ stdout: process.stdout,
217054
+ stderr: process.stderr,
217055
+ useTasks: !0,
217056
+ environment: "production"
217057
+ }), renderSuccess({ headline: "Function built successfully." }), { app };
216957
217058
  }
216958
217059
  };
216959
217060
  _a27 = FunctionBuild;
@@ -217331,7 +217432,7 @@ function getAllFunctionRunFileNames(functionRunsDir) {
217331
217432
  }
217332
217433
 
217333
217434
  // ../app/dist/cli/commands/app/function/replay.js
217334
- var import_core27 = __toESM(require_lib2(), 1), _a28, FunctionReplay = class extends AppCommand {
217435
+ var import_core27 = __toESM(require_lib2(), 1), _a28, FunctionReplay = class extends AppLinkedCommand {
217335
217436
  async run() {
217336
217437
  let { flags } = await this.parse(_a28);
217337
217438
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -217386,7 +217487,7 @@ var replay_default = FunctionReplay;
217386
217487
  // ../app/dist/cli/commands/app/function/run.js
217387
217488
  init_cjs_shims();
217388
217489
  var import_core28 = __toESM(require_lib2(), 1);
217389
- var _a29, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppCommand {
217490
+ var _a29, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppLinkedCommand {
217390
217491
  async run() {
217391
217492
  let { flags } = await this.parse(_a29);
217392
217493
  return { app: await inFunctionContext({
@@ -217453,7 +217554,7 @@ var run_default = FunctionRun;
217453
217554
  // ../app/dist/cli/commands/app/function/schema.js
217454
217555
  init_cjs_shims();
217455
217556
  var import_core29 = __toESM(require_lib2(), 1);
217456
- var _a30, FetchSchema = class extends AppCommand {
217557
+ var _a30, FetchSchema = class extends AppLinkedCommand {
217457
217558
  async run() {
217458
217559
  let { flags } = await this.parse(_a30);
217459
217560
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -217500,7 +217601,7 @@ var schema_default = FetchSchema;
217500
217601
 
217501
217602
  // ../app/dist/cli/commands/app/function/typegen.js
217502
217603
  init_cjs_shims();
217503
- var _a31, FunctionTypegen = class extends AppCommand {
217604
+ var _a31, FunctionTypegen = class extends AppLinkedCommand {
217504
217605
  async run() {
217505
217606
  let { flags } = await this.parse(_a31);
217506
217607
  return { app: await inFunctionContext({
@@ -217540,11 +217641,14 @@ function isPolarisUnifiedEnabled() {
217540
217641
 
217541
217642
  // ../app/dist/cli/services/generate/fetch-template-specifications.js
217542
217643
  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);
217644
+ let { templates: remoteTemplates, groupOrder } = await developerPlatformClient.templateSpecifications(app), polarisUnifiedEnabled = isPolarisUnifiedEnabled();
217645
+ return {
217646
+ templates: remoteTemplates.filter((template) => availableSpecifications.includes(template.identifier) || availableSpecifications.includes(template.type)).map((template) => template.type === "ui_extension" ? {
217647
+ ...template,
217648
+ supportedFlavors: template.supportedFlavors.filter((flavor) => polarisUnifiedEnabled ? flavor.value === "preact" : flavor.value !== "preact")
217649
+ } : template).filter((template) => template.supportedFlavors.length > 0),
217650
+ groupOrder
217651
+ };
217548
217652
  }
217549
217653
 
217550
217654
  // ../app/dist/cli/prompts/generate/extension.js
@@ -217574,7 +217678,8 @@ var generateExtensionPrompts = async (options2) => {
217574
217678
  throw new AbortError("You have reached the limit for the number of extensions you can create.");
217575
217679
  templateType = await renderAutocompletePrompt({
217576
217680
  message: "Type of extension?",
217577
- choices: buildChoices(extensionTemplates, options2.unavailableExtensions)
217681
+ choices: buildChoices(extensionTemplates, options2.unavailableExtensions),
217682
+ groupOrder: options2.groupOrder
217578
217683
  });
217579
217684
  }
217580
217685
  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 +217889,12 @@ async function downloadOrFindTemplateDirectory(url, extensionFlavor, tmpDir, onG
217784
217889
 
217785
217890
  // ../app/dist/cli/services/generate.js
217786
217891
  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);
217892
+ 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
217893
  await saveAnalyticsMetadata(promptAnswers, template);
217789
217894
  let generateExtensionOptions = buildGenerateOptions(promptAnswers, app, options2, developerPlatformClient), generatedExtension = await generateExtensionTemplate(generateExtensionOptions);
217790
217895
  renderSuccessMessage2(generatedExtension, app.packageManager);
217791
217896
  }
217792
- async function buildPromptOptions(extensionTemplates, specifications, app, options2) {
217897
+ async function buildPromptOptions(extensionTemplates, groupOrder, specifications, app, options2) {
217793
217898
  let extensionTemplate = await handleTypeParameter(options2.template, app, extensionTemplates, specifications);
217794
217899
  validateExtensionFlavor(extensionTemplate, options2.flavor);
217795
217900
  let { validTemplates, templatesOverlimit } = checkLimits(extensionTemplates, specifications, app);
@@ -217801,7 +217906,8 @@ async function buildPromptOptions(extensionTemplates, specifications, app, optio
217801
217906
  app,
217802
217907
  extensionTemplates: validTemplates ?? [],
217803
217908
  unavailableExtensions: templatesOverlimit ?? [],
217804
- reset: options2.reset
217909
+ reset: options2.reset,
217910
+ groupOrder
217805
217911
  };
217806
217912
  }
217807
217913
  function checkLimits(extensionTemplates, specifications, app) {
@@ -217870,7 +217976,7 @@ var generate_default = generate;
217870
217976
 
217871
217977
  // ../app/dist/cli/commands/app/generate/extension.js
217872
217978
  var import_core30 = __toESM(require_lib2(), 1);
217873
- var _a32, AppGenerateExtension = class extends AppCommand {
217979
+ var _a32, AppGenerateExtension = class extends AppLinkedCommand {
217874
217980
  static analyticsNameOverride() {
217875
217981
  return "app scaffold extension";
217876
217982
  }
@@ -218339,7 +218445,7 @@ var getMigrationChoices = () => [
218339
218445
  extensionTypes: ["app_link", "bulk_action"],
218340
218446
  buildTomlObject: buildTomlObject3
218341
218447
  }
218342
- ], ImportExtensions = class _ImportExtensions extends AppCommand {
218448
+ ], ImportExtensions = class _ImportExtensions extends AppLinkedCommand {
218343
218449
  async run() {
218344
218450
  let { flags } = await this.parse(_ImportExtensions), appContext = await linkedAppContext({
218345
218451
  directory: flags.path,
@@ -218537,7 +218643,7 @@ Directory components`.toUpperCase(),
218537
218643
 
218538
218644
  // ../app/dist/cli/commands/app/info.js
218539
218645
  var import_core32 = __toESM(require_lib2(), 1);
218540
- var _a34, AppInfo2 = class extends AppCommand {
218646
+ var _a34, AppInfo2 = class extends AppLinkedCommand {
218541
218647
  async run() {
218542
218648
  let { flags } = await this.parse(_a34), { app, remoteApp, organization, developerPlatformClient } = await linkedAppContext({
218543
218649
  directory: flags.path,
@@ -218887,7 +218993,7 @@ function validateFlavorValue(template, flavor) {
218887
218993
 
218888
218994
  // ../app/dist/cli/commands/app/init.js
218889
218995
  var import_core33 = __toESM(require_lib2(), 1);
218890
- var _a35, Init2 = class extends AppCommand {
218996
+ var _a35, Init2 = class extends AppLinkedCommand {
218891
218997
  async run() {
218892
218998
  let { flags } = await this.parse(_a35);
218893
218999
  validateTemplateValue(flags.template), validateFlavorValue(flags.template, flags.flavor);
@@ -219051,7 +219157,7 @@ ${versionDetails.message}` : ""
219051
219157
 
219052
219158
  // ../app/dist/cli/commands/app/release.js
219053
219159
  var import_core34 = __toESM(require_lib2(), 1);
219054
- var _a36, Release = class extends AppCommand {
219160
+ var _a36, Release = class extends AppLinkedCommand {
219055
219161
  async run() {
219056
219162
  let { flags } = await this.parse(_a36);
219057
219163
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -219170,7 +219276,7 @@ async function versionList(options2) {
219170
219276
  }
219171
219277
 
219172
219278
  // ../app/dist/cli/commands/app/versions/list.js
219173
- var import_core35 = __toESM(require_lib2(), 1), _a37, VersionsList = class extends AppCommand {
219279
+ var import_core35 = __toESM(require_lib2(), 1), _a37, VersionsList = class extends AppLinkedCommand {
219174
219280
  async run() {
219175
219281
  let { flags } = await this.parse(_a37);
219176
219282
  flags["api-key"] && await showApiKeyDeprecationWarning();
@@ -219342,7 +219448,7 @@ function formatErrors(errors) {
219342
219448
 
219343
219449
  // ../app/dist/cli/commands/app/webhook/trigger.js
219344
219450
  var import_core36 = __toESM(require_lib2(), 1);
219345
- var _a38, WebhookTrigger = class extends AppCommand {
219451
+ var _a38, WebhookTrigger = class extends AppLinkedCommand {
219346
219452
  async run() {
219347
219453
  let { flags } = await this.parse(_a38);
219348
219454
  flags["shared-secret"] && renderWarning({
@@ -219496,7 +219602,7 @@ async function devClean(options2) {
219496
219602
 
219497
219603
  // ../app/dist/cli/commands/app/dev/clean.js
219498
219604
  var import_core37 = __toESM(require_lib2(), 1);
219499
- var _a39, DevClean = class extends AppCommand {
219605
+ var _a39, DevClean = class extends AppLinkedCommand {
219500
219606
  async run() {
219501
219607
  let { flags } = await this.parse(_a39), appContextResult = await linkedAppContext({
219502
219608
  directory: flags.path,