@shopify/create-app 4.8.5 → 4.9.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.
Files changed (68) hide show
  1. package/dist/analytics-IECFN4JQ.js +40 -0
  2. package/dist/analytics-LBB7P36D.js +48 -0
  3. package/dist/{chunk-ODCXYGJ2.js → chunk-23UTCSPZ.js} +14 -4
  4. package/dist/{chunk-67ZHQJFJ.js → chunk-27YRBZHB.js} +5 -5
  5. package/dist/{chunk-F2LFNR26.js → chunk-37A2FHUG.js} +2 -2
  6. package/dist/chunk-3YGXE2AP.js +50 -0
  7. package/dist/{chunk-SGIGETET.js → chunk-63WOEPSQ.js} +203 -56
  8. package/dist/{chunk-YGBCHL4K.js → chunk-6OYK2NCF.js} +2 -2
  9. package/dist/chunk-7NOX742S.js +86 -0
  10. package/dist/{chunk-ZTNEDTAC.js → chunk-7RUPPYI4.js} +3093 -23
  11. package/dist/{chunk-BEUNBVME.js → chunk-A33KVF5C.js} +1 -1
  12. package/dist/{chunk-B4MEUQZW.js → chunk-AIZTGQJR.js} +10 -10
  13. package/dist/chunk-CK3T27VW.js +119 -0
  14. package/dist/{chunk-GU2TODXD.js → chunk-DC6ZFOVX.js} +3 -3
  15. package/dist/{chunk-E43EDJOG.js → chunk-EJEHENXO.js} +3 -2
  16. package/dist/{chunk-CPI6XVRV.js → chunk-EJPPP2UR.js} +32 -10
  17. package/dist/chunk-FKZ3NFHZ.js +7 -0
  18. package/dist/{chunk-JEMOMVLA.js → chunk-GXCPTCSE.js} +2 -2
  19. package/dist/{chunk-TS6YLIAL.js → chunk-IGYLFVSH.js} +51 -26
  20. package/dist/chunk-QWRYHKCI.js +218 -0
  21. package/dist/chunk-SHCNJ47P.js +89 -0
  22. package/dist/{chunk-4SGOGIHQ.js → chunk-U5GH53OY.js} +16 -16
  23. package/dist/{chunk-C3J4HVUN.js → chunk-VDUAROBQ.js} +3 -2
  24. package/dist/chunk-WXRXVG7I.js +1092 -0
  25. package/dist/{chunk-ZKLW7LMH.js → chunk-XE2VSA7J.js} +16 -14
  26. package/dist/{chunk-PERCCMZB.js → chunk-XIVTHG4G.js} +320 -3213
  27. package/dist/{chunk-5JYB62AT.js → chunk-XTW7GZNX.js} +7 -7
  28. package/dist/command-json-schema-NKZVCRA4.js +65 -0
  29. package/dist/{conf-store-I2EVFNHO.js → conf-store-OXRRZ7GJ.js} +11 -11
  30. package/dist/custom-oclif-loader-GXZPW6CV.js +85 -0
  31. package/dist/{deprecations-ASHE6RU7.js → deprecations-DRF2EUF3.js} +18 -15
  32. package/dist/environment-OJNKZ7ML.js +25 -0
  33. package/dist/environments-4D4TK7F7.js +32 -0
  34. package/dist/error-handler-LQ3ZDIBZ.js +44 -0
  35. package/dist/{fs-AOTVAHUT.js → fs-PMEOY2EH.js} +10 -5
  36. package/dist/hooks/postrun.js +11 -6
  37. package/dist/hooks/prerun.js +6 -6
  38. package/dist/{http-proxy-node16-5LMQ6YXS.js → http-proxy-node16-FD2WN6JB.js} +2 -3
  39. package/dist/index.js +6687 -3622
  40. package/dist/{is-global-2XE72BX5.js → is-global-LYFZG4LV.js} +10 -5
  41. package/dist/json-error-4FQODRLE.js +104 -0
  42. package/dist/{lib-XCYUJYSO.js → lib-NYDMHWZM.js} +3 -4
  43. package/dist/{local-VTOHZRT2.js → local-EVID5OFN.js} +11 -3
  44. package/dist/{metadata-PNCC4F25.js → metadata-WETP27SP.js} +10 -4
  45. package/dist/{node-package-manager-WUKOPNFK.js → node-package-manager-BLIC3IFC.js} +20 -17
  46. package/dist/notifications-system-45UW7RPJ.js +47 -0
  47. package/dist/os-VO35CUIL.js +24 -0
  48. package/dist/{output-Y2INREX2.js → output-7GWEONQ7.js} +12 -5
  49. package/dist/{path-2WA5R6GG.js → path-2KZ7FSGN.js} +2 -2
  50. package/dist/{prettier-SS3RRDXK.js → prettier-BNZDRHR4.js} +2 -2
  51. package/dist/{system-KPC4GYYQ.js → system-F25CZRFX.js} +18 -15
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/dist/{ui-WQOJ2UKT.js → ui-KEWWVBIJ.js} +18 -15
  54. package/dist/{upgrade-KCKPO4QT.js → upgrade-RSDWMQIO.js} +47 -29
  55. package/dist/{version-ODXTDVIB.js → version-MTILA6OW.js} +2 -2
  56. package/dist/version-XXESWBZG.js +36 -0
  57. package/oclif.manifest.json +15 -1
  58. package/package.json +3 -3
  59. package/dist/analytics-I6PGSH5K.js +0 -44
  60. package/dist/analytics-QHQHZXCP.js +0 -36
  61. package/dist/chunk-2Z5L5TZI.js +0 -301
  62. package/dist/chunk-7OHJH7BF.js +0 -21
  63. package/dist/custom-oclif-loader-HTLL62HO.js +0 -54
  64. package/dist/environments-JM7VKVKQ.js +0 -29
  65. package/dist/error-handler-TUY64CIU.js +0 -40
  66. package/dist/notifications-system-GBBRT4B6.js +0 -43
  67. package/dist/os-J6JGAAOY.js +0 -19
  68. package/dist/version-5242JBZK.js +0 -33
@@ -13859,4 +13859,4 @@ export {
13859
13859
  debugApis,
13860
13860
  init_prettier
13861
13861
  };
13862
- //# sourceMappingURL=chunk-BEUNBVME.js.map
13862
+ //# sourceMappingURL=chunk-A33KVF5C.js.map
@@ -1,21 +1,18 @@
1
1
  import {
2
2
  cacheRetrieve,
3
3
  cacheRetrieveOrRepopulate
4
- } from "./chunk-TS6YLIAL.js";
4
+ } from "./chunk-IGYLFVSH.js";
5
5
  import {
6
6
  AbortController,
7
7
  exec
8
- } from "./chunk-SGIGETET.js";
8
+ } from "./chunk-63WOEPSQ.js";
9
9
  import {
10
10
  runWithTimer
11
- } from "./chunk-GU2TODXD.js";
11
+ } from "./chunk-DC6ZFOVX.js";
12
12
  import {
13
13
  AbortError,
14
14
  BugError
15
- } from "./chunk-CPI6XVRV.js";
16
- import {
17
- require_semver
18
- } from "./chunk-OQ3KXXGH.js";
15
+ } from "./chunk-EJPPP2UR.js";
19
16
  import {
20
17
  fileExists,
21
18
  fileExistsSync,
@@ -27,11 +24,14 @@ import {
27
24
  outputToken,
28
25
  readFile,
29
26
  writeFile
30
- } from "./chunk-ZTNEDTAC.js";
27
+ } from "./chunk-7RUPPYI4.js";
28
+ import {
29
+ require_semver
30
+ } from "./chunk-OQ3KXXGH.js";
31
31
  import {
32
32
  dirname,
33
33
  joinPath
34
- } from "./chunk-C3J4HVUN.js";
34
+ } from "./chunk-VDUAROBQ.js";
35
35
  import {
36
36
  __toESM,
37
37
  init_cjs_shims
@@ -344,4 +344,4 @@ export {
344
344
  writePackageJSON,
345
345
  inferPackageManager
346
346
  };
347
- //# sourceMappingURL=chunk-B4MEUQZW.js.map
347
+ //# sourceMappingURL=chunk-AIZTGQJR.js.map
@@ -0,0 +1,119 @@
1
+ import {
2
+ joinPath
3
+ } from "./chunk-VDUAROBQ.js";
4
+ import {
5
+ init_cjs_shims
6
+ } from "./chunk-3XNI6LP4.js";
7
+
8
+ // ../cli-kit/dist/private/node/constants.js
9
+ init_cjs_shims();
10
+
11
+ // ../../node_modules/.pnpm/env-paths@3.0.0/node_modules/env-paths/index.js
12
+ init_cjs_shims();
13
+ import path from "node:path";
14
+ import os from "node:os";
15
+ import process2 from "node:process";
16
+ var homedir = os.homedir(), tmpdir = os.tmpdir(), { env } = process2, macos = (name) => {
17
+ let library = path.join(homedir, "Library");
18
+ return {
19
+ data: path.join(library, "Application Support", name),
20
+ config: path.join(library, "Preferences", name),
21
+ cache: path.join(library, "Caches", name),
22
+ log: path.join(library, "Logs", name),
23
+ temp: path.join(tmpdir, name)
24
+ };
25
+ }, windows = (name) => {
26
+ let appData = env.APPDATA || path.join(homedir, "AppData", "Roaming"), localAppData = env.LOCALAPPDATA || path.join(homedir, "AppData", "Local");
27
+ return {
28
+ // Data/config/cache/log are invented by me as Windows isn't opinionated about this
29
+ data: path.join(localAppData, name, "Data"),
30
+ config: path.join(appData, name, "Config"),
31
+ cache: path.join(localAppData, name, "Cache"),
32
+ log: path.join(localAppData, name, "Log"),
33
+ temp: path.join(tmpdir, name)
34
+ };
35
+ }, linux = (name) => {
36
+ let username = path.basename(homedir);
37
+ return {
38
+ data: path.join(env.XDG_DATA_HOME || path.join(homedir, ".local", "share"), name),
39
+ config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, ".config"), name),
40
+ cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, ".cache"), name),
41
+ // https://wiki.debian.org/XDGBaseDirectorySpecification#state
42
+ log: path.join(env.XDG_STATE_HOME || path.join(homedir, ".local", "state"), name),
43
+ temp: path.join(tmpdir, username, name)
44
+ };
45
+ };
46
+ function envPaths(name, { suffix = "nodejs" } = {}) {
47
+ if (typeof name != "string")
48
+ throw new TypeError(`Expected a string, got ${typeof name}`);
49
+ return suffix && (name += `-${suffix}`), process2.platform === "darwin" ? macos(name) : process2.platform === "win32" ? windows(name) : linux(name);
50
+ }
51
+
52
+ // ../cli-kit/dist/private/node/constants.js
53
+ var identifier = "shopify-cli", cacheFolder = () => process.env.XDG_CACHE_HOME ? process.env.XDG_CACHE_HOME : envPaths(identifier).cache;
54
+ var environmentVariables = {
55
+ alwaysLogAnalytics: "SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS",
56
+ alwaysLogMetrics: "SHOPIFY_CLI_ALWAYS_LOG_METRICS",
57
+ deviceAuth: "SHOPIFY_CLI_DEVICE_AUTH",
58
+ doctor: "SHOPIFY_CLI_DOCTOR",
59
+ enableCliRedirect: "SHOPIFY_CLI_ENABLE_CLI_REDIRECT",
60
+ env: "SHOPIFY_CLI_ENV",
61
+ noAnalytics: "SHOPIFY_CLI_NO_ANALYTICS",
62
+ optOutInstrumentation: "OPT_OUT_INSTRUMENTATION",
63
+ appAutomationToken: "SHOPIFY_APP_AUTOMATION_TOKEN",
64
+ partnersToken: "SHOPIFY_CLI_PARTNERS_TOKEN",
65
+ runAsUser: "SHOPIFY_RUN_AS_USER",
66
+ serviceEnv: "SHOPIFY_SERVICE_ENV",
67
+ skipCliRedirect: "SHOPIFY_CLI_SKIP_CLI_REDIRECT",
68
+ spinInstance: "SPIN_INSTANCE",
69
+ themeToken: "SHOPIFY_CLI_THEME_TOKEN",
70
+ unitTest: "SHOPIFY_UNIT_TEST",
71
+ verbose: "SHOPIFY_FLAG_VERBOSE",
72
+ // Variables to detect if the CLI is running in a cloud environment
73
+ codespaces: "CODESPACES",
74
+ codespaceName: "CODESPACE_NAME",
75
+ codespacePortForwardingDomain: "GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN",
76
+ gitpod: "GITPOD_WORKSPACE_URL",
77
+ cloudShell: "CLOUD_SHELL",
78
+ spinAppPort: "SERVER_PORT",
79
+ spinAppHost: "SPIN_APP_HOST",
80
+ organization: "SHOPIFY_CLI_ORGANIZATION",
81
+ identityToken: "SHOPIFY_CLI_IDENTITY_TOKEN",
82
+ refreshToken: "SHOPIFY_CLI_REFRESH_TOKEN",
83
+ otelURL: "SHOPIFY_CLI_OTEL_EXPORTER_OTLP_ENDPOINT",
84
+ themeKitAccessDomain: "SHOPIFY_CLI_THEME_KIT_ACCESS_DOMAIN",
85
+ json: "SHOPIFY_FLAG_JSON",
86
+ skipNetworkLevelRetry: "SHOPIFY_CLI_SKIP_NETWORK_LEVEL_RETRY",
87
+ maxRequestTimeForNetworkCalls: "SHOPIFY_CLI_MAX_REQUEST_TIME_FOR_NETWORK_CALLS",
88
+ disableImportScanning: "SHOPIFY_CLI_DISABLE_IMPORT_SCANNING"
89
+ }, defaultThemeKitAccessDomain = "theme-kit-access.shopifyapps.com", systemEnvironmentVariables = {
90
+ backendPort: "BACKEND_PORT"
91
+ }, pathConstants = {
92
+ executables: {
93
+ dev: "/opt/dev/bin/dev"
94
+ },
95
+ directories: {
96
+ cache: {
97
+ path: () => cacheFolder(),
98
+ vendor: {
99
+ path: () => joinPath(cacheFolder(), "vendor"),
100
+ binaries: () => joinPath(cacheFolder(), "vendor", "binaries")
101
+ }
102
+ }
103
+ }
104
+ }, sessionConstants = {
105
+ expirationTimeMarginInMinutes: 4
106
+ }, bugsnagApiKey = "9e1e6889176fd0c795d5c659225e0fae", reportingRateLimit = { limit: 300, timeout: { days: 1 } }, themeKitAccessDomain = process.env[environmentVariables.themeKitAccessDomain] ?? defaultThemeKitAccessDomain;
107
+
108
+ export {
109
+ envPaths,
110
+ environmentVariables,
111
+ defaultThemeKitAccessDomain,
112
+ systemEnvironmentVariables,
113
+ pathConstants,
114
+ sessionConstants,
115
+ bugsnagApiKey,
116
+ reportingRateLimit,
117
+ themeKitAccessDomain
118
+ };
119
+ //# sourceMappingURL=chunk-CK3T27VW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isUnitTest
3
- } from "./chunk-2Z5L5TZI.js";
3
+ } from "./chunk-QWRYHKCI.js";
4
4
  import {
5
5
  init_cjs_shims
6
6
  } from "./chunk-3XNI6LP4.js";
@@ -32,7 +32,7 @@ function createRuntimeMetadataContainer(defaultPublicMetadata = {}) {
32
32
  try {
33
33
  await getAndSet();
34
34
  } catch (error) {
35
- let { sendErrorToBugsnag } = await import("./error-handler-TUY64CIU.js");
35
+ let { sendErrorToBugsnag } = await import("./error-handler-LQ3ZDIBZ.js");
36
36
  await sendErrorToBugsnag(error, "unexpected_error");
37
37
  }
38
38
  }, durationStack = [];
@@ -75,4 +75,4 @@ export {
75
75
  addSensitiveMetadata,
76
76
  runWithTimer
77
77
  };
78
- //# sourceMappingURL=chunk-GU2TODXD.js.map
78
+ //# sourceMappingURL=chunk-DC6ZFOVX.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  require_src,
3
3
  require_supports_color
4
- } from "./chunk-ODCXYGJ2.js";
4
+ } from "./chunk-23UTCSPZ.js";
5
5
  import {
6
6
  require_is_wsl
7
7
  } from "./chunk-LBXDGVFS.js";
@@ -11788,6 +11788,7 @@ var require_lib = __commonJS({
11788
11788
 
11789
11789
  export {
11790
11790
  require_ansi_styles,
11791
+ require_help,
11791
11792
  require_commonjs3 as require_commonjs,
11792
11793
  require_lib
11793
11794
  };
@@ -11802,4 +11803,4 @@ ejs/lib/ejs.js:
11802
11803
  * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
11803
11804
  *)
11804
11805
  */
11805
- //# sourceMappingURL=chunk-E43EDJOG.js.map
11806
+ //# sourceMappingURL=chunk-EJEHENXO.js.map
@@ -1,20 +1,21 @@
1
- import {
2
- require_lib
3
- } from "./chunk-E43EDJOG.js";
4
1
  import {
5
2
  TokenizedString,
3
+ flushStdout,
6
4
  stringifyMessage,
7
5
  tokenItemToString
8
- } from "./chunk-ZTNEDTAC.js";
6
+ } from "./chunk-7RUPPYI4.js";
7
+ import {
8
+ require_lib
9
+ } from "./chunk-EJEHENXO.js";
9
10
  import {
10
11
  normalizePath
11
- } from "./chunk-C3J4HVUN.js";
12
+ } from "./chunk-VDUAROBQ.js";
12
13
  import {
13
14
  __toESM,
14
15
  init_cjs_shims
15
16
  } from "./chunk-3XNI6LP4.js";
16
17
 
17
- // ../cli-kit/dist/public/node/error.js
18
+ // ../cli-kit/dist/public/node/error/index.js
18
19
  init_cjs_shims();
19
20
 
20
21
  // ../cli-kit/dist/private/node/analytics/graphql-error-codes.js
@@ -43,7 +44,14 @@ function hasRateLimitCode(errors) {
43
44
  return graphQLErrorCodes(errors).some(isRateLimitCode);
44
45
  }
45
46
 
46
- // ../cli-kit/dist/public/node/error.js
47
+ // ../cli-kit/dist/private/node/api/status-checks.js
48
+ init_cjs_shims();
49
+ var GATEWAY_ERROR_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
50
+ function isGatewayErrorStatus(status) {
51
+ return status !== void 0 && GATEWAY_ERROR_STATUSES.has(status);
52
+ }
53
+
54
+ // ../cli-kit/dist/public/node/error/index.js
47
55
  var import_core = __toESM(require_lib(), 1), FatalErrorType;
48
56
  (function(FatalErrorType2) {
49
57
  FatalErrorType2[FatalErrorType2.Abort = 0] = "Abort", FatalErrorType2[FatalErrorType2.AbortSilent = 1] = "AbortSilent", FatalErrorType2[FatalErrorType2.Bug = 2] = "Bug";
@@ -55,6 +63,10 @@ var CancelExecution = class extends Error {
55
63
  nextSteps;
56
64
  formattedMessage;
57
65
  customSections;
66
+ /** A stable code for JSON consumers to identify this error, included only when known. */
67
+ code;
68
+ /** Selected JSON-serializable data to include in JSON errors. Never attach the raw error or request. */
69
+ details;
58
70
  skipOclifErrorHandling;
59
71
  /**
60
72
  * Creates a new FatalError error.
@@ -102,7 +114,12 @@ async function handler(error) {
102
114
  let maybeError = error;
103
115
  fatal = new BugError(maybeError?.message ?? "Unknown error"), maybeError?.stack && (fatal.stack = maybeError?.stack);
104
116
  }
105
- let { renderFatalError } = await import("./ui-WQOJ2UKT.js");
117
+ let { jsonOutputEnabled } = await import("./environment-OJNKZ7ML.js");
118
+ if (jsonOutputEnabled()) {
119
+ let { renderFatalErrorAsJson } = await import("./json-error-4FQODRLE.js");
120
+ return renderFatalErrorAsJson(fatal), await flushStdout(), error;
121
+ }
122
+ let { renderFatalError } = await import("./ui-KEWWVBIJ.js");
106
123
  return renderFatalError(fatal), Promise.resolve(error);
107
124
  }
108
125
  function errorMapper(error) {
@@ -136,7 +153,7 @@ function isExpectedApiError(error) {
136
153
  if (typeof candidate.response != "object" || candidate.response === null || candidate.request === void 0)
137
154
  return !1;
138
155
  let status = candidate.response.status;
139
- return status === 401 || status === 429 || status === 502 || status === 503 || status === 504 ? !0 : hasRateLimitCode(candidate.response.errors);
156
+ return status === 401 || status === 429 || isGatewayErrorStatus(status) ? !0 : hasRateLimitCode(candidate.response.errors);
140
157
  }
141
158
  function cleanSingleStackTracePath(filePath) {
142
159
  return normalizePath(filePath).replace("file:/", "/").replace(/^\/?[A-Z]:/, "");
@@ -160,11 +177,16 @@ function errorMessageImpliesEnvironmentIssue(message) {
160
177
  ].some((issueMessage) => message.includes(issueMessage));
161
178
  }
162
179
 
180
+ // ../cli-kit/dist/public/node/error.js
181
+ init_cjs_shims();
182
+
163
183
  export {
164
184
  graphQLErrorCodes,
165
185
  isRateLimitCode,
166
186
  isPermissionCode,
167
187
  hasRateLimitCode,
188
+ isGatewayErrorStatus,
189
+ FatalErrorType,
168
190
  CancelExecution,
169
191
  FatalError,
170
192
  AbortError,
@@ -176,4 +198,4 @@ export {
176
198
  shouldReportErrorAsUnexpected,
177
199
  cleanSingleStackTracePath
178
200
  };
179
- //# sourceMappingURL=chunk-CPI6XVRV.js.map
201
+ //# sourceMappingURL=chunk-EJPPP2UR.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ init_cjs_shims
3
+ } from "./chunk-3XNI6LP4.js";
4
+
5
+ // ../cli-kit/dist/public/node/schema.js
6
+ init_cjs_shims();
7
+ //# sourceMappingURL=chunk-FKZ3NFHZ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  captureOutput,
3
3
  require_lib
4
- } from "./chunk-SGIGETET.js";
4
+ } from "./chunk-63WOEPSQ.js";
5
5
  import {
6
6
  require_semver
7
7
  } from "./chunk-OQ3KXXGH.js";
@@ -52,4 +52,4 @@ export {
52
52
  isPreReleaseVersion,
53
53
  isMajorVersionChange
54
54
  };
55
- //# sourceMappingURL=chunk-JEMOMVLA.js.map
55
+ //# sourceMappingURL=chunk-GXCPTCSE.js.map
@@ -1,27 +1,32 @@
1
- import {
2
- AbortError,
3
- BugError
4
- } from "./chunk-CPI6XVRV.js";
5
1
  import {
6
2
  mimicFunction
7
3
  } from "./chunk-CM6ALOD7.js";
8
4
  import {
9
- require_semver
10
- } from "./chunk-OQ3KXXGH.js";
5
+ AbortError,
6
+ BugError
7
+ } from "./chunk-EJPPP2UR.js";
11
8
  import {
9
+ fileExistsSync,
12
10
  fileHasWritePermissions,
11
+ findPathUpSync,
13
12
  outputContent,
14
13
  outputDebug,
15
14
  unixFileIsOwnedByCurrentUser
16
- } from "./chunk-ZTNEDTAC.js";
15
+ } from "./chunk-7RUPPYI4.js";
17
16
  import {
18
- envPaths,
19
- environmentVariables,
20
17
  isUnitTest
21
- } from "./chunk-2Z5L5TZI.js";
18
+ } from "./chunk-QWRYHKCI.js";
19
+ import {
20
+ envPaths,
21
+ environmentVariables
22
+ } from "./chunk-CK3T27VW.js";
23
+ import {
24
+ require_semver
25
+ } from "./chunk-OQ3KXXGH.js";
22
26
  import {
23
- dirname
24
- } from "./chunk-C3J4HVUN.js";
27
+ dirname,
28
+ resolvePath
29
+ } from "./chunk-VDUAROBQ.js";
25
30
  import {
26
31
  __commonJS,
27
32
  __toESM,
@@ -5912,6 +5917,18 @@ var import_semver = __toESM(require_semver(), 1), __classPrivateFieldSet = funct
5912
5917
  };
5913
5918
 
5914
5919
  // ../cli-kit/dist/public/node/local-storage.js
5920
+ function isFileSystemPermissionError(error) {
5921
+ if (!(error instanceof Error))
5922
+ return !1;
5923
+ let errorCode = error.code;
5924
+ return errorCode === "EACCES" || errorCode === "EPERM";
5925
+ }
5926
+ function configPathFromInitializationError(options, error) {
5927
+ if (typeof error.path == "string")
5928
+ return error.syscall === "mkdir" ? resolvePath(error.path, "config.json") : resolvePath(error.path);
5929
+ let configDirectory = options.cwd ?? (options.projectName ? envPaths(options.projectName, { suffix: "nodejs" }).config : void 0);
5930
+ return configDirectory ? resolvePath(configDirectory, "config.json") : void 0;
5931
+ }
5915
5932
  function deserializeJson(value) {
5916
5933
  let valueWithoutByteOrderMark = value.replace(/^\uFEFF/, "");
5917
5934
  return JSON.parse(valueWithoutByteOrderMark);
@@ -5919,11 +5936,18 @@ function deserializeJson(value) {
5919
5936
  var LocalStorage = class {
5920
5937
  config;
5921
5938
  constructor(options) {
5922
- this.config = new Conf({
5923
- ...options,
5924
- clearInvalidConfig: !0,
5925
- deserialize: deserializeJson
5926
- });
5939
+ try {
5940
+ this.config = new Conf({
5941
+ ...options,
5942
+ clearInvalidConfig: !0,
5943
+ deserialize: deserializeJson
5944
+ });
5945
+ } catch (error) {
5946
+ if (!isFileSystemPermissionError(error))
5947
+ throw error;
5948
+ let configPath = configPathFromInitializationError(options, error);
5949
+ throw configPath && this.handleError(error, "initialize", configPath), new AbortError(`Failed to access local storage (initialize): ${error}`);
5950
+ }
5927
5951
  }
5928
5952
  /**
5929
5953
  * Get a value from the local storage.
@@ -5989,21 +6013,22 @@ var LocalStorage = class {
5989
6013
  *
5990
6014
  * @param error - The error that occurred.
5991
6015
  * @param operation - The operation that failed.
6016
+ * @param configPath - The local storage configuration file path.
5992
6017
  * @throws AbortError if the error is permission-related.
5993
6018
  * @throws BugError if the error is not permission-related.
5994
6019
  */
5995
- handleError(error, operation) {
5996
- throw this.isPermissionError() ? new AbortError(`Failed to access local storage (${operation}): ${error}`, this.tryMessage()) : new BugError(`Unexpected error while accessing local storage at ${this.config.path} (${operation}): ${error}`);
6020
+ handleError(error, operation, configPath = this.config.path) {
6021
+ throw isFileSystemPermissionError(error) || this.isPermissionError(configPath) ? new AbortError(`Failed to access local storage (${operation}): ${error}`, this.tryMessage(configPath)) : new BugError(`Unexpected error while accessing local storage at ${configPath} (${operation}): ${error}`);
5997
6022
  }
5998
- isPermissionError() {
5999
- let canAccessFile = fileHasWritePermissions(this.config.path), canAccessFolder = fileHasWritePermissions(dirname(this.config.path)), ownsFile = unixFileIsOwnedByCurrentUser(this.config.path);
6023
+ isPermissionError(configPath) {
6024
+ let canAccessFile = fileHasWritePermissions(configPath), canAccessFolder = fileHasWritePermissions(dirname(configPath)), ownsFile = unixFileIsOwnedByCurrentUser(configPath);
6000
6025
  return !canAccessFile || !canAccessFolder || ownsFile === !1;
6001
6026
  }
6002
- tryMessage() {
6003
- let ownsFile = unixFileIsOwnedByCurrentUser(this.config.path), ownsFolder = unixFileIsOwnedByCurrentUser(dirname(this.config.path)), message = ["Check that you have write permissions for", { filePath: this.config.path }];
6004
- return (ownsFile === !1 || ownsFolder === !1) && message.push("- The file is owned by a different user. This typically happens when Shopify CLI was previously run with elevated permissions (e.g., sudo)."), message.push(`
6027
+ tryMessage(configPath) {
6028
+ let configDirectory = dirname(configPath), configDirectoryExists = fileExistsSync(configDirectory), permissionsPath = configDirectoryExists ? configPath : findPathUpSync(".", { cwd: configDirectory, type: "directory" }) ?? configDirectory, ownsFile = fileExistsSync(configPath) ? unixFileIsOwnedByCurrentUser(configPath) : void 0, ownsFolder = unixFileIsOwnedByCurrentUser(configDirectoryExists ? configDirectory : permissionsPath), message = ["Check that you have write permissions for", { filePath: permissionsPath }];
6029
+ return (ownsFile === !1 || ownsFolder === !1) && message.push("- The file is owned by a different user. This typically happens when Shopify CLI was previously run with elevated permissions (e.g., sudo)."), configDirectoryExists && (message.push(`
6005
6030
 
6006
- To resolve this, remove the Shopify CLI preferences folder:`), message.push({ command: `rm -rf ${dirname(this.config.path)}` }), message;
6031
+ To resolve this, remove the Shopify CLI preferences folder:`), message.push({ filePath: configDirectory })), message;
6007
6032
  }
6008
6033
  };
6009
6034
 
@@ -6114,4 +6139,4 @@ export {
6114
6139
  getCachedPartnerAccountStatus,
6115
6140
  setCachedPartnerAccountStatus
6116
6141
  };
6117
- //# sourceMappingURL=chunk-TS6YLIAL.js.map
6142
+ //# sourceMappingURL=chunk-IGYLFVSH.js.map