@shopify/create-app 3.85.1 → 3.85.3

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.
@@ -2,12 +2,12 @@ import {
2
2
  CLI_KIT_VERSION,
3
3
  jsonOutputEnabled,
4
4
  z
5
- } from "./chunk-K6GH3OTA.js";
5
+ } from "./chunk-6NLDEVLI.js";
6
6
  import {
7
7
  cacheRetrieve,
8
8
  cacheStore,
9
9
  versionSatisfies
10
- } from "./chunk-LSGUB77H.js";
10
+ } from "./chunk-5HCVMQPA.js";
11
11
  import {
12
12
  AbortSilentError,
13
13
  exec,
@@ -16,7 +16,7 @@ import {
16
16
  renderError,
17
17
  renderInfo,
18
18
  renderWarning
19
- } from "./chunk-BPVVHBDS.js";
19
+ } from "./chunk-GDQKSWAB.js";
20
20
  import {
21
21
  init_cjs_shims
22
22
  } from "./chunk-PKR7KJ6P.js";
@@ -84,7 +84,7 @@ async function showNotificationsIfNeeded(currentSurfaces, environment = process.
84
84
  throw new AbortSilentError();
85
85
  let errorMessage = `Error showing notifications: ${error.message}`;
86
86
  outputDebug(errorMessage);
87
- let { sendErrorToBugsnag } = await import("./error-handler-PZL5TOG2.js");
87
+ let { sendErrorToBugsnag } = await import("./error-handler-MJJYI3CD.js");
88
88
  await sendErrorToBugsnag(errorMessage, "unexpected_error");
89
89
  }
90
90
  }
@@ -174,4 +174,4 @@ export {
174
174
  showNotificationsIfNeeded,
175
175
  fetchNotificationsInBackground
176
176
  };
177
- //# sourceMappingURL=chunk-OF4U7FDV.js.map
177
+ //# sourceMappingURL=chunk-NXCZ6OFG.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  execaSync,
3
3
  fileExistsSync
4
- } from "./chunk-BPVVHBDS.js";
4
+ } from "./chunk-GDQKSWAB.js";
5
5
  import {
6
6
  require_lib
7
- } from "./chunk-G5HUFNZJ.js";
7
+ } from "./chunk-2VQSCETZ.js";
8
8
  import "./chunk-UMUTXITN.js";
9
9
  import {
10
10
  cwd,
@@ -40,4 +40,4 @@ var import_core = __toESM(require_lib(), 1), ShopifyConfig = class extends impor
40
40
  export {
41
41
  ShopifyConfig
42
42
  };
43
- //# sourceMappingURL=custom-oclif-loader-CPWFMSSL.js.map
43
+ //# sourceMappingURL=custom-oclif-loader-R36KMIMZ.js.map
@@ -4,13 +4,13 @@ import {
4
4
  errorHandler,
5
5
  registerCleanBugsnagErrorsFromWithinPlugins,
6
6
  sendErrorToBugsnag
7
- } from "./chunk-345OYFTI.js";
8
- import "./chunk-UW5PDMY2.js";
9
- import "./chunk-K6GH3OTA.js";
7
+ } from "./chunk-K2VIRVTL.js";
8
+ import "./chunk-A6BP5R5D.js";
9
+ import "./chunk-6NLDEVLI.js";
10
10
  import "./chunk-25IMI7TH.js";
11
- import "./chunk-LSGUB77H.js";
12
- import "./chunk-BPVVHBDS.js";
13
- import "./chunk-G5HUFNZJ.js";
11
+ import "./chunk-5HCVMQPA.js";
12
+ import "./chunk-GDQKSWAB.js";
13
+ import "./chunk-2VQSCETZ.js";
14
14
  import "./chunk-UMUTXITN.js";
15
15
  import "./chunk-Y2JP6WFP.js";
16
16
  import "./chunk-SHWOPMLQ.js";
@@ -25,4 +25,4 @@ export {
25
25
  registerCleanBugsnagErrorsFromWithinPlugins,
26
26
  sendErrorToBugsnag
27
27
  };
28
- //# sourceMappingURL=error-handler-PZL5TOG2.js.map
28
+ //# sourceMappingURL=error-handler-MJJYI3CD.js.map
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  reportAnalyticsEvent
3
- } from "../chunk-UW5PDMY2.js";
3
+ } from "../chunk-A6BP5R5D.js";
4
4
  import {
5
5
  getNextDeprecationDate
6
- } from "../chunk-K6GH3OTA.js";
6
+ } from "../chunk-6NLDEVLI.js";
7
7
  import "../chunk-25IMI7TH.js";
8
- import "../chunk-LSGUB77H.js";
8
+ import "../chunk-5HCVMQPA.js";
9
9
  import {
10
10
  addSensitiveMetadata,
11
11
  getAllSensitiveMetadata,
12
12
  outputDebug,
13
13
  renderWarning
14
- } from "../chunk-BPVVHBDS.js";
15
- import "../chunk-G5HUFNZJ.js";
14
+ } from "../chunk-GDQKSWAB.js";
15
+ import "../chunk-2VQSCETZ.js";
16
16
  import "../chunk-UMUTXITN.js";
17
17
  import "../chunk-Y2JP6WFP.js";
18
18
  import "../chunk-75LV6AQS.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  fetchNotificationsInBackground
3
- } from "../chunk-OF4U7FDV.js";
3
+ } from "../chunk-NXCZ6OFG.js";
4
4
  import {
5
5
  CLI_KIT_VERSION,
6
6
  startAnalytics
7
- } from "../chunk-K6GH3OTA.js";
7
+ } from "../chunk-6NLDEVLI.js";
8
8
  import "../chunk-25IMI7TH.js";
9
9
  import {
10
10
  checkForCachedNewVersion,
11
11
  checkForNewVersion,
12
12
  packageManagerFromUserAgent,
13
13
  runAtMinimumInterval
14
- } from "../chunk-LSGUB77H.js";
14
+ } from "../chunk-5HCVMQPA.js";
15
15
  import {
16
16
  currentProcessIsGlobal,
17
17
  inferPackageManagerForGlobalCLI,
@@ -20,8 +20,8 @@ import {
20
20
  outputDebug,
21
21
  outputToken,
22
22
  outputWarn
23
- } from "../chunk-BPVVHBDS.js";
24
- import "../chunk-G5HUFNZJ.js";
23
+ } from "../chunk-GDQKSWAB.js";
24
+ import "../chunk-2VQSCETZ.js";
25
25
  import "../chunk-UMUTXITN.js";
26
26
  import "../chunk-Y2JP6WFP.js";
27
27
  import "../chunk-75LV6AQS.js";
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-345OYFTI.js";
11
+ } from "./chunk-K2VIRVTL.js";
12
12
  import {
13
13
  compileData,
14
14
  fanoutHooks,
@@ -17,11 +17,11 @@ import {
17
17
  recordEvent,
18
18
  recordTiming,
19
19
  reportAnalyticsEvent
20
- } from "./chunk-UW5PDMY2.js";
20
+ } from "./chunk-A6BP5R5D.js";
21
21
  import {
22
22
  setCurrentCommandId,
23
23
  showNotificationsIfNeeded
24
- } from "./chunk-OF4U7FDV.js";
24
+ } from "./chunk-NXCZ6OFG.js";
25
25
  import {
26
26
  CLI_KIT_VERSION,
27
27
  ClientError,
@@ -89,7 +89,7 @@ import {
89
89
  setPathValue,
90
90
  shopifyFetch,
91
91
  z
92
- } from "./chunk-K6GH3OTA.js";
92
+ } from "./chunk-6NLDEVLI.js";
93
93
  import "./chunk-25IMI7TH.js";
94
94
  import {
95
95
  LocalStorage,
@@ -112,7 +112,7 @@ import {
112
112
  usesWorkspaces,
113
113
  versionSatisfies,
114
114
  writePackageJSON
115
- } from "./chunk-LSGUB77H.js";
115
+ } from "./chunk-5HCVMQPA.js";
116
116
  import {
117
117
  AbortController as AbortController2,
118
118
  AbortError,
@@ -275,11 +275,12 @@ import {
275
275
  username,
276
276
  writeFile,
277
277
  writeFileSync
278
- } from "./chunk-BPVVHBDS.js";
278
+ } from "./chunk-GDQKSWAB.js";
279
279
  import {
280
280
  require_commonjs,
281
- require_lib as require_lib2
282
- } from "./chunk-G5HUFNZJ.js";
281
+ require_lib as require_lib2,
282
+ require_typescript
283
+ } from "./chunk-2VQSCETZ.js";
283
284
  import {
284
285
  require_ms,
285
286
  require_src
@@ -3270,7 +3271,7 @@ var require_main = __commonJS({
3270
3271
  t: () => t18
3271
3272
  });
3272
3273
  module2.exports = __toCommonJS3(main_exports4);
3273
- var import_fs82 = __require("fs"), import_promises5 = __require("fs/promises");
3274
+ var import_fs83 = __require("fs"), import_promises5 = __require("fs/promises");
3274
3275
  async function readFileFromUri(uri) {
3275
3276
  if (uri.protocol === "file:")
3276
3277
  return await (0, import_promises5.readFile)(uri, "utf8");
@@ -3295,7 +3296,7 @@ var require_main = __commonJS({
3295
3296
  throw new Error("Unsupported protocol");
3296
3297
  }
3297
3298
  function readFileFromFsPath(fsPath) {
3298
- return (0, import_fs82.readFileSync)(fsPath, "utf8");
3299
+ return (0, import_fs83.readFileSync)(fsPath, "utf8");
3299
3300
  }
3300
3301
  var bundle;
3301
3302
  function config2(config22) {
@@ -33433,8 +33434,8 @@ var require_resolve_block_scalar = __commonJS({
33433
33434
  default: {
33434
33435
  let message = `Unexpected token in block scalar header: ${token.type}`;
33435
33436
  onError2(token, "UNEXPECTED_TOKEN", message);
33436
- let ts = token.source;
33437
- ts && typeof ts == "string" && (length += ts.length);
33437
+ let ts2 = token.source;
33438
+ ts2 && typeof ts2 == "string" && (length += ts2.length);
33438
33439
  }
33439
33440
  }
33440
33441
  }
@@ -33671,7 +33672,7 @@ var require_compose_scalar = __commonJS({
33671
33672
  if (schema.compat) {
33672
33673
  let compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity.SCALAR];
33673
33674
  if (tag.tag !== compat.tag) {
33674
- let ts = directives.tagString(tag.tag), cs = directives.tagString(compat.tag), msg = `Value may be parsed as either ${ts} or ${cs}`;
33675
+ let ts2 = directives.tagString(tag.tag), cs = directives.tagString(compat.tag), msg = `Value may be parsed as either ${ts2} or ${cs}`;
33675
33676
  onError2(token, "TAG_RESOLVE_FAILED", msg, !0);
33676
33677
  }
33677
33678
  }
@@ -45254,12 +45255,12 @@ var require_stream_transform = __commonJS({
45254
45255
  util.inherits = require_inherits();
45255
45256
  util.inherits(Transform, Duplex);
45256
45257
  function afterTransform(er, data) {
45257
- var ts = this._transformState;
45258
- ts.transforming = !1;
45259
- var cb = ts.writecb;
45258
+ var ts2 = this._transformState;
45259
+ ts2.transforming = !1;
45260
+ var cb = ts2.writecb;
45260
45261
  if (!cb)
45261
45262
  return this.emit("error", new Error("write callback called multiple times"));
45262
- ts.writechunk = null, ts.writecb = null, data != null && this.push(data), cb(er);
45263
+ ts2.writechunk = null, ts2.writecb = null, data != null && this.push(data), cb(er);
45263
45264
  var rs = this._readableState;
45264
45265
  rs.reading = !1, (rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark);
45265
45266
  }
@@ -45287,15 +45288,15 @@ var require_stream_transform = __commonJS({
45287
45288
  throw new Error("_transform() is not implemented");
45288
45289
  };
45289
45290
  Transform.prototype._write = function(chunk, encoding, cb) {
45290
- var ts = this._transformState;
45291
- if (ts.writecb = cb, ts.writechunk = chunk, ts.writeencoding = encoding, !ts.transforming) {
45291
+ var ts2 = this._transformState;
45292
+ if (ts2.writecb = cb, ts2.writechunk = chunk, ts2.writeencoding = encoding, !ts2.transforming) {
45292
45293
  var rs = this._readableState;
45293
- (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark);
45294
+ (ts2.needTransform || rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark);
45294
45295
  }
45295
45296
  };
45296
45297
  Transform.prototype._read = function(n) {
45297
- var ts = this._transformState;
45298
- ts.writechunk !== null && ts.writecb && !ts.transforming ? (ts.transforming = !0, this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform)) : ts.needTransform = !0;
45298
+ var ts2 = this._transformState;
45299
+ ts2.writechunk !== null && ts2.writecb && !ts2.transforming ? (ts2.transforming = !0, this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform)) : ts2.needTransform = !0;
45299
45300
  };
45300
45301
  Transform.prototype._destroy = function(err2, cb) {
45301
45302
  var _this2 = this;
@@ -47871,12 +47872,12 @@ var require_stream_transform2 = __commonJS({
47871
47872
  var _require$codes = require_errors4().codes, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0, Duplex = require_stream_duplex2();
47872
47873
  require_inherits()(Transform, Duplex);
47873
47874
  function afterTransform(er, data) {
47874
- var ts = this._transformState;
47875
- ts.transforming = !1;
47876
- var cb = ts.writecb;
47875
+ var ts2 = this._transformState;
47876
+ ts2.transforming = !1;
47877
+ var cb = ts2.writecb;
47877
47878
  if (cb === null)
47878
47879
  return this.emit("error", new ERR_MULTIPLE_CALLBACK());
47879
- ts.writechunk = null, ts.writecb = null, data != null && this.push(data), cb(er);
47880
+ ts2.writechunk = null, ts2.writecb = null, data != null && this.push(data), cb(er);
47880
47881
  var rs = this._readableState;
47881
47882
  rs.reading = !1, (rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark);
47882
47883
  }
@@ -47904,15 +47905,15 @@ var require_stream_transform2 = __commonJS({
47904
47905
  cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
47905
47906
  };
47906
47907
  Transform.prototype._write = function(chunk, encoding, cb) {
47907
- var ts = this._transformState;
47908
- if (ts.writecb = cb, ts.writechunk = chunk, ts.writeencoding = encoding, !ts.transforming) {
47908
+ var ts2 = this._transformState;
47909
+ if (ts2.writecb = cb, ts2.writechunk = chunk, ts2.writeencoding = encoding, !ts2.transforming) {
47909
47910
  var rs = this._readableState;
47910
- (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark);
47911
+ (ts2.needTransform || rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark);
47911
47912
  }
47912
47913
  };
47913
47914
  Transform.prototype._read = function(n) {
47914
- var ts = this._transformState;
47915
- ts.writechunk !== null && !ts.transforming ? (ts.transforming = !0, this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform)) : ts.needTransform = !0;
47915
+ var ts2 = this._transformState;
47916
+ ts2.writechunk !== null && !ts2.transforming ? (ts2.transforming = !0, this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform)) : ts2.needTransform = !0;
47916
47917
  };
47917
47918
  Transform.prototype._destroy = function(err2, cb) {
47918
47919
  Duplex.prototype._destroy.call(this, err2, function(err22) {
@@ -194009,6 +194010,129 @@ function arraySum(array) {
194009
194010
  // ../app/dist/cli/models/extensions/specifications/ui_extension.js
194010
194011
  init_cjs_shims();
194011
194012
 
194013
+ // ../app/dist/cli/models/extensions/specifications/type-generation.js
194014
+ init_cjs_shims();
194015
+ var import_typescript = __toESM(require_typescript(), 1);
194016
+ import { createRequire } from "module";
194017
+ var require2 = createRequire(import.meta.url);
194018
+ function parseApiVersion(apiVersion) {
194019
+ let [year, month] = apiVersion.split("-");
194020
+ return !year || !month ? null : { year: parseInt(year, 10), month: parseInt(month, 10) };
194021
+ }
194022
+ function loadTsConfig(startPath) {
194023
+ let configPath = import_typescript.default.findConfigFile(startPath, import_typescript.default.sys.fileExists.bind(import_typescript.default.sys), "tsconfig.json");
194024
+ if (!configPath)
194025
+ return { compilerOptions: {}, configPath: void 0 };
194026
+ let configFile = import_typescript.default.readConfigFile(configPath, import_typescript.default.sys.readFile.bind(import_typescript.default.sys));
194027
+ return configFile.error ? { compilerOptions: {}, configPath } : { compilerOptions: import_typescript.default.parseJsonConfigFileContent(configFile.config, import_typescript.default.sys, dirname(configPath)).options, configPath };
194028
+ }
194029
+ async function fallbackResolve(importPath, baseDir) {
194030
+ if (!importPath.startsWith("./") && !importPath.startsWith("../"))
194031
+ return null;
194032
+ let resolvedPath = resolvePath(baseDir, importPath), extensions = ["", ".js", ".jsx", ".ts", ".tsx"];
194033
+ for (let ext of extensions) {
194034
+ let pathWithExt = resolvedPath + ext;
194035
+ if (await fileExists(pathWithExt) && !pathWithExt.includes("node_modules"))
194036
+ return pathWithExt;
194037
+ }
194038
+ for (let ext of [".js", ".jsx", ".ts", ".tsx"]) {
194039
+ let indexPath = joinPath(resolvedPath, `index${ext}`);
194040
+ if (await fileExists(indexPath) && !indexPath.includes("node_modules"))
194041
+ return indexPath;
194042
+ }
194043
+ return null;
194044
+ }
194045
+ async function parseAndResolveImports(filePath) {
194046
+ try {
194047
+ let content = readFileSync(filePath).toString(), resolvedPaths = [], { compilerOptions } = loadTsConfig(filePath), scriptKind = import_typescript.default.ScriptKind.JSX;
194048
+ filePath.endsWith(".ts") ? scriptKind = import_typescript.default.ScriptKind.TS : filePath.endsWith(".tsx") && (scriptKind = import_typescript.default.ScriptKind.TSX);
194049
+ let sourceFile = import_typescript.default.createSourceFile(filePath, content, import_typescript.default.ScriptTarget.Latest, !0, scriptKind), processedImports = /* @__PURE__ */ new Set(), importPaths = [], visit3 = (node) => {
194050
+ if (import_typescript.default.isImportDeclaration(node) && node.moduleSpecifier && import_typescript.default.isStringLiteral(node.moduleSpecifier))
194051
+ importPaths.push(node.moduleSpecifier.text);
194052
+ else if (import_typescript.default.isCallExpression(node) && node.expression.kind === import_typescript.default.SyntaxKind.ImportKeyword) {
194053
+ let firstArg = node.arguments[0];
194054
+ firstArg && import_typescript.default.isStringLiteral(firstArg) && importPaths.push(firstArg.text);
194055
+ } else import_typescript.default.isExportDeclaration(node) && node.moduleSpecifier && import_typescript.default.isStringLiteral(node.moduleSpecifier) && importPaths.push(node.moduleSpecifier.text);
194056
+ import_typescript.default.forEachChild(node, visit3);
194057
+ };
194058
+ visit3(sourceFile);
194059
+ for (let importPath of importPaths) {
194060
+ if (!importPath || processedImports.has(importPath))
194061
+ continue;
194062
+ processedImports.add(importPath);
194063
+ let resolvedModule = import_typescript.default.resolveModuleName(importPath, filePath, compilerOptions, import_typescript.default.sys);
194064
+ if (resolvedModule.resolvedModule?.resolvedFileName) {
194065
+ let resolvedPath = resolvedModule.resolvedModule.resolvedFileName;
194066
+ resolvedPath.includes("node_modules") || resolvedPaths.push(resolvedPath);
194067
+ } else {
194068
+ let fallbackPath = await fallbackResolve(importPath, dirname(filePath));
194069
+ fallbackPath && resolvedPaths.push(fallbackPath);
194070
+ }
194071
+ }
194072
+ return resolvedPaths;
194073
+ } catch (error) {
194074
+ if (error instanceof AbortError)
194075
+ throw error;
194076
+ return [];
194077
+ }
194078
+ }
194079
+ async function findAllImportedFiles(filePath, visited = /* @__PURE__ */ new Set()) {
194080
+ if (visited.has(filePath))
194081
+ return [];
194082
+ visited.add(filePath);
194083
+ let resolvedPaths = await parseAndResolveImports(filePath), allFiles = [...resolvedPaths];
194084
+ for (let resolvedPath of resolvedPaths) {
194085
+ let nestedImports = await findAllImportedFiles(resolvedPath, visited);
194086
+ allFiles.push(...nestedImports);
194087
+ }
194088
+ return [...new Set(allFiles)];
194089
+ }
194090
+ function createTypeDefinition(fullPath, typeFilePath, targets, apiVersion) {
194091
+ try {
194092
+ for (let target of targets)
194093
+ try {
194094
+ require2.resolve(`@shopify/ui-extensions/${target}`, { paths: [fullPath, typeFilePath] });
194095
+ } catch {
194096
+ let { year, month } = parseApiVersion(apiVersion) ?? { year: 2025, month: 10 };
194097
+ throw new AbortError(`Type reference for ${target} could not be found. You might be using the wrong @shopify/ui-extensions version.`, `Fix the error by ensuring you have the correct version of @shopify/ui-extensions, for example ~${year}.${month}.0, in your dependencies.`);
194098
+ }
194099
+ let relativePath2 = relativizePath(fullPath, dirname(typeFilePath));
194100
+ if (targets.length === 1) {
194101
+ let target = targets[0] ?? "";
194102
+ return `//@ts-ignore
194103
+ declare module './${relativePath2}' {
194104
+ const shopify: import('@shopify/ui-extensions/${target}').Api;
194105
+ const globalThis: { shopify: typeof shopify };
194106
+ }
194107
+ `;
194108
+ } else if (targets.length > 1) {
194109
+ let unionType = targets.map((target) => ` import('@shopify/ui-extensions/${target}').Api`).join(` |
194110
+ `);
194111
+ return `//@ts-ignore
194112
+ declare module './${relativePath2}' {
194113
+ const shopify:
194114
+ ${unionType};
194115
+ const globalThis: { shopify: typeof shopify };
194116
+ }
194117
+ `;
194118
+ }
194119
+ return null;
194120
+ } catch (error) {
194121
+ if (error instanceof AbortError)
194122
+ throw error;
194123
+ let { year, month } = parseApiVersion(apiVersion) ?? { year: 2025, month: 10 };
194124
+ throw new AbortError("Type reference could not be found. You might be using the wrong @shopify/ui-extensions version.", `Fix the error by ensuring you have the correct version of @shopify/ui-extensions, for example ~${year}.${month}.0, in your dependencies.`);
194125
+ }
194126
+ }
194127
+ async function findNearestTsConfigDir(fromFile, extensionDirectory) {
194128
+ let fromDirectory = dirname(fromFile), tsconfigPath = await findPathUp("tsconfig.json", { cwd: fromDirectory, type: "file" });
194129
+ if (tsconfigPath) {
194130
+ let normalizedTsconfigPath = resolvePath(tsconfigPath), normalizedExtensionDirectory = resolvePath(extensionDirectory);
194131
+ if (normalizedTsconfigPath.startsWith(normalizedExtensionDirectory))
194132
+ return dirname(tsconfigPath);
194133
+ }
194134
+ }
194135
+
194012
194136
  // ../app/dist/cli/services/dev/extension/utilities.js
194013
194137
  init_cjs_shims();
194014
194138
 
@@ -194164,8 +194288,7 @@ function getExtensionPointTargetSurface(extensionPointTarget) {
194164
194288
  }
194165
194289
 
194166
194290
  // ../app/dist/cli/models/extensions/specifications/ui_extension.js
194167
- import { createRequire } from "module";
194168
- var require2 = createRequire(import.meta.url), dependency5 = "@shopify/checkout-ui-extensions", validatePoints = (config2) => config2.extension_points !== void 0 || config2.targeting !== void 0, missingExtensionPointsMessage = "No extension targets defined, add a `targeting` field to your configuration", UIExtensionSchema = BaseSchema.extend({
194291
+ var dependency5 = "@shopify/checkout-ui-extensions", validatePoints = (config2) => config2.extension_points !== void 0 || config2.targeting !== void 0, missingExtensionPointsMessage = "No extension targets defined, add a `targeting` field to your configuration", UIExtensionSchema = BaseSchema.extend({
194169
194292
  name: z.string(),
194170
194293
  type: z.literal("ui_extension"),
194171
194294
  extension_points: NewExtensionPointsSchema.optional(),
@@ -194243,30 +194366,56 @@ var require2 = createRequire(import.meta.url), dependency5 = "@shopify/checkout-
194243
194366
  contributeToSharedTypeFile: async (extension, typeDefinitionsByFile) => {
194244
194367
  if (!isRemoteDomExtension(extension.configuration))
194245
194368
  return;
194246
- let { configuration } = extension;
194369
+ let { configuration } = extension, fileToTargetsMap = /* @__PURE__ */ new Map();
194247
194370
  for await (let extensionPoint of configuration.extension_points) {
194248
194371
  let fullPath = joinPath(extension.directory, extensionPoint.module);
194249
194372
  if (!await fileExists(fullPath))
194250
194373
  continue;
194251
- let mainTsConfigDir = await findNearestTsConfigDir(fullPath, extension.directory);
194252
- if (!mainTsConfigDir)
194374
+ let currentTargets = fileToTargetsMap.get(fullPath) ?? [];
194375
+ if (currentTargets.push(extensionPoint.target), fileToTargetsMap.set(fullPath, currentTargets), extensionPoint.build_manifest.assets[AssetIdentifier.ShouldRender]?.module) {
194376
+ let shouldRenderPath = joinPath(extension.directory, extensionPoint.build_manifest.assets[AssetIdentifier.ShouldRender].module);
194377
+ if (await fileExists(shouldRenderPath)) {
194378
+ let shouldRenderTargets = fileToTargetsMap.get(shouldRenderPath) ?? [];
194379
+ shouldRenderTargets.push(getShouldRenderTarget(extensionPoint.target)), fileToTargetsMap.set(shouldRenderPath, shouldRenderTargets);
194380
+ }
194381
+ }
194382
+ }
194383
+ for await (let extensionPoint of configuration.extension_points) {
194384
+ let fullPath = joinPath(extension.directory, extensionPoint.module);
194385
+ if (!await fileExists(fullPath))
194253
194386
  continue;
194254
- let mainTypeFilePath = joinPath(mainTsConfigDir, "shopify.d.ts"), mainTypes = getSharedTypeDefinition(fullPath, mainTypeFilePath, extensionPoint.target, configuration.api_version);
194255
- if (mainTypes) {
194256
- let currentTypes = typeDefinitionsByFile.get(mainTypeFilePath) ?? /* @__PURE__ */ new Set();
194257
- currentTypes.add(mainTypes), typeDefinitionsByFile.set(mainTypeFilePath, currentTypes);
194387
+ let importedFiles = await findAllImportedFiles(fullPath);
194388
+ for (let importedFile of importedFiles) {
194389
+ let currentTargets = fileToTargetsMap.get(importedFile) ?? [];
194390
+ currentTargets.push(extensionPoint.target), fileToTargetsMap.set(importedFile, currentTargets);
194258
194391
  }
194259
194392
  if (extensionPoint.build_manifest.assets[AssetIdentifier.ShouldRender]?.module) {
194260
- let shouldRenderTsConfigDir = await findNearestTsConfigDir(joinPath(extension.directory, extensionPoint.build_manifest.assets[AssetIdentifier.ShouldRender].module), extension.directory);
194261
- if (!shouldRenderTsConfigDir)
194262
- continue;
194263
- let shouldRenderTypeFilePath = joinPath(shouldRenderTsConfigDir, "shopify.d.ts"), shouldRenderTypes = getSharedTypeDefinition(joinPath(extension.directory, extensionPoint.build_manifest.assets[AssetIdentifier.ShouldRender].module), shouldRenderTypeFilePath, getShouldRenderTarget(extensionPoint.target), configuration.api_version);
194264
- if (shouldRenderTypes) {
194265
- let currentTypes = typeDefinitionsByFile.get(shouldRenderTypeFilePath) ?? /* @__PURE__ */ new Set();
194266
- currentTypes.add(shouldRenderTypes), typeDefinitionsByFile.set(shouldRenderTypeFilePath, currentTypes);
194393
+ let shouldRenderPath = joinPath(extension.directory, extensionPoint.build_manifest.assets[AssetIdentifier.ShouldRender].module);
194394
+ if (await fileExists(shouldRenderPath)) {
194395
+ let shouldRenderImports = await findAllImportedFiles(shouldRenderPath);
194396
+ for (let importedFile of shouldRenderImports) {
194397
+ let currentTargets = fileToTargetsMap.get(importedFile) ?? [];
194398
+ currentTargets.push(getShouldRenderTarget(extensionPoint.target)), fileToTargetsMap.set(importedFile, currentTargets);
194399
+ }
194267
194400
  }
194268
194401
  }
194269
194402
  }
194403
+ for await (let [filePath, targets] of fileToTargetsMap.entries()) {
194404
+ let tsConfigDir = await findNearestTsConfigDir(filePath, extension.directory);
194405
+ if (!tsConfigDir)
194406
+ continue;
194407
+ let typeFilePath = joinPath(tsConfigDir, "shopify.d.ts"), uniqueTargets = [...new Set(targets)];
194408
+ try {
194409
+ let typeDefinition = createTypeDefinition(filePath, typeFilePath, uniqueTargets, configuration.api_version);
194410
+ if (typeDefinition) {
194411
+ let currentTypes = typeDefinitionsByFile.get(typeFilePath) ?? /* @__PURE__ */ new Set();
194412
+ currentTypes.add(typeDefinition), typeDefinitionsByFile.set(typeFilePath, currentTypes);
194413
+ }
194414
+ } catch (error) {
194415
+ if (configuration.extension_points.some((ep) => joinPath(extension.directory, ep.module) === filePath || ep.build_manifest.assets[AssetIdentifier.ShouldRender]?.module && joinPath(extension.directory, ep.build_manifest.assets[AssetIdentifier.ShouldRender].module) === filePath))
194416
+ throw error;
194417
+ }
194418
+ }
194270
194419
  }
194271
194420
  });
194272
194421
  function addDistPathToAssets(extP) {
@@ -194303,35 +194452,15 @@ Extension point targets must be unique`), errors.length ? (errors.push(`Please c
194303
194452
  `))) : ok({});
194304
194453
  }
194305
194454
  function isRemoteDomExtension(config2) {
194306
- let apiVersion = config2.api_version, [year, month] = apiVersion?.split("-").map((part) => parseInt(part, 10)) ?? [];
194307
- return !year || !month ? !1 : year > 2025 || year === 2025 && month >= 10;
194455
+ let apiVersion = config2.api_version;
194456
+ if (!apiVersion)
194457
+ return !1;
194458
+ let { year, month } = parseApiVersion(apiVersion) ?? { year: 0, month: 0 };
194459
+ return year > 2025 || year === 2025 && month >= 10;
194308
194460
  }
194309
194461
  function getShouldRenderTarget(target) {
194310
194462
  return target.replace(/\.render$/, ".should-render");
194311
194463
  }
194312
- function convertApiVersionToSemver(apiVersion) {
194313
- let [year, month] = apiVersion.split("-");
194314
- if (!year || !month)
194315
- throw new AbortError("Invalid API version format. Expected format: YYYY-MM");
194316
- return `${year}.${month}.0`;
194317
- }
194318
- function getSharedTypeDefinition(fullPath, typeFilePath, target, apiVersion) {
194319
- try {
194320
- return require2.resolve(`@shopify/ui-extensions/${target}`, { paths: [fullPath, typeFilePath] }), `//@ts-ignore
194321
- declare module './${relativizePath(fullPath, dirname(typeFilePath))}' {
194322
- const shopify: import('@shopify/ui-extensions/${target}').Api;
194323
- const globalThis: { shopify: typeof shopify };
194324
- }
194325
- `;
194326
- } catch {
194327
- throw new AbortError(`Type reference for ${target} could not be found. You might be using the wrong @shopify/ui-extensions version.`, `Fix the error by ensuring you have the correct version of @shopify/ui-extensions, for example ${convertApiVersionToSemver(apiVersion)}, in your dependencies.`);
194328
- }
194329
- }
194330
- async function findNearestTsConfigDir(fromFile, extensionDirectory) {
194331
- let fromDirectory = dirname(fromFile), tsconfigPath = await findPathUp("tsconfig.json", { cwd: fromDirectory, type: "file", stopAt: extensionDirectory });
194332
- if (tsconfigPath)
194333
- return dirname(tsconfigPath);
194334
- }
194335
194464
  var ui_extension_default = uiExtensionSpec;
194336
194465
 
194337
194466
  // ../app/dist/cli/models/extensions/specifications/web_pixel_extension.js
@@ -201723,7 +201852,7 @@ init_cjs_shims();
201723
201852
  init_cjs_shims();
201724
201853
  import { fileURLToPath as fileURLToPath2 } from "node:url";
201725
201854
  async function launchCLI(options) {
201726
- let { errorHandler: errorHandler2 } = await import("./error-handler-PZL5TOG2.js"), { isDevelopment: isDevelopment2 } = await import("./local-CSLZHQAW.js"), oclif = await import("./lib-G23FRF64.js"), { ShopifyConfig } = await import("./custom-oclif-loader-CPWFMSSL.js");
201855
+ let { errorHandler: errorHandler2 } = await import("./error-handler-MJJYI3CD.js"), { isDevelopment: isDevelopment2 } = await import("./local-MWSAESLX.js"), oclif = await import("./lib-XDPPS4KW.js"), { ShopifyConfig } = await import("./custom-oclif-loader-R36KMIMZ.js");
201727
201856
  isDevelopment2() && (oclif.default.settings.debug = !0);
201728
201857
  try {
201729
201858
  let config2 = new ShopifyConfig({ root: fileURLToPath2(options.moduleURL) });
@@ -201738,7 +201867,7 @@ var import_core3 = __toESM(require_lib2());
201738
201867
  async function exitIfOldNodeVersion(versions2 = process.versions) {
201739
201868
  let nodeVersion = versions2.node, nodeMajorVersion = Number(nodeVersion.split(".")[0]);
201740
201869
  if (nodeMajorVersion < 18) {
201741
- let { renderError: renderError2 } = await import("./ui-XUWZDBQN.js");
201870
+ let { renderError: renderError2 } = await import("./ui-O654GOTM.js");
201742
201871
  renderError2({
201743
201872
  headline: "Upgrade to a supported Node version now.",
201744
201873
  body: [
@@ -201765,7 +201894,7 @@ async function runCLI(options, launchCLI2 = launchCLI, argv = process.argv, env
201765
201894
  return setupEnvironmentVariables(options, argv, env), options.runInCreateMode && await addInitToArgvWhenRunningCreateCLI(options, argv), forceNoColor(argv, env), await exitIfOldNodeVersion(versions2), launchCLI2({ moduleURL: options.moduleURL });
201766
201895
  }
201767
201896
  async function addInitToArgvWhenRunningCreateCLI(options, argv = process.argv) {
201768
- let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-3OVW7PSU.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-COZT77T2.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options.moduleURL))).content.name.replace("@shopify/create-", "");
201897
+ let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-6AJOWMMJ.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-COZT77T2.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options.moduleURL))).content.name.replace("@shopify/create-", "");
201769
201898
  if (argv.findIndex((arg) => arg.includes("init")) === -1) {
201770
201899
  let initIndex2 = argv.findIndex((arg) => arg.match(new RegExp(`bin(\\/|\\\\)+(create-${name}|dev|run)`))) + 1;
201771
201900
  argv.splice(initIndex2, 0, "init");
@@ -221002,21 +221131,10 @@ init_cjs_shims();
221002
221131
 
221003
221132
  // ../app/dist/cli/services/generate/fetch-template-specifications.js
221004
221133
  init_cjs_shims();
221005
-
221006
- // ../cli-kit/dist/public/node/is-polaris-unified-enabled.js
221007
- init_cjs_shims();
221008
- function isPolarisUnifiedEnabled() {
221009
- return isTruthy(process.env.POLARIS_UNIFIED);
221010
- }
221011
-
221012
- // ../app/dist/cli/services/generate/fetch-template-specifications.js
221013
221134
  async function fetchExtensionTemplates(developerPlatformClient, app, availableSpecifications) {
221014
- let { templates: remoteTemplates, groupOrder } = await developerPlatformClient.templateSpecifications(app), polarisUnifiedEnabled = isPolarisUnifiedEnabled();
221135
+ let { templates: remoteTemplates, groupOrder } = await developerPlatformClient.templateSpecifications(app);
221015
221136
  return {
221016
- templates: remoteTemplates.filter((template) => availableSpecifications.includes(template.identifier) || availableSpecifications.includes(template.type)).map((template) => template.type === "ui_extension" ? {
221017
- ...template,
221018
- supportedFlavors: template.supportedFlavors.filter((flavor) => polarisUnifiedEnabled ? flavor.value === "preact" : flavor.value !== "preact")
221019
- } : template).filter((template) => template.supportedFlavors.length > 0),
221137
+ templates: remoteTemplates.filter((template) => availableSpecifications.includes(template.identifier) || availableSpecifications.includes(template.type)),
221020
221138
  groupOrder
221021
221139
  };
221022
221140
  }
@@ -221182,7 +221300,7 @@ async function uiExtensionInit({ directory, url, app, name, extensionFlavor, onG
221182
221300
  flavor: extensionFlavor?.value ?? "",
221183
221301
  uid: nonRandomUUID(slugify(name))
221184
221302
  });
221185
- }), templateLanguage === "javascript" && (await changeIndexFileExtension(directory, srcFileExtension), await removeUnwantedTemplateFilesPerFlavor(directory, extensionFlavor.value));
221303
+ }), templateLanguage === "javascript" && await changeIndexFileExtension(directory, srcFileExtension);
221186
221304
  }
221187
221305
  },
221188
221306
  {
@@ -221239,9 +221357,6 @@ async function changeIndexFileExtension(extensionDirectory, fileExtension, renam
221239
221357
  srcFileExensionsToChange.push(moveFile(srcFilePath, `${srcFilePath}.${fileExtension}`));
221240
221358
  await Promise.all(srcFileExensionsToChange);
221241
221359
  }
221242
- async function removeUnwantedTemplateFilesPerFlavor(extensionDirectory, extensionFlavor) {
221243
- extensionFlavor !== "preact" && extensionFlavor !== "typescript-react" && await removeFile(joinPath(extensionDirectory, "tsconfig.json"));
221244
- }
221245
221360
  async function addResolutionOrOverrideIfNeeded(directory, extensionFlavor) {
221246
221361
  extensionFlavor === "typescript-react" && await addResolutionOrOverride(directory, { "@types/react": versions.reactTypes });
221247
221362
  }
@@ -221716,17 +221831,7 @@ var templates = {
221716
221831
  prompt: "For your Remix template, which language do you want?",
221717
221832
  options: {
221718
221833
  javascript: { branch: "javascript", label: "JavaScript" },
221719
- typescript: { branch: "main", label: "TypeScript" },
221720
- ...process.env.POLARIS_UNIFIED && {
221721
- javascriptPolarisEarlyAccess: {
221722
- branch: "polaris-docs-2025-js",
221723
- label: "JavaScript (Polaris Release Candidate)"
221724
- },
221725
- typescriptPolarisEarlyAccess: {
221726
- branch: "polaris-docs-2025",
221727
- label: "TypeScript (Polaris Release Candidate)"
221728
- }
221729
- }
221834
+ typescript: { branch: "main", label: "TypeScript" }
221730
221835
  }
221731
221836
  }
221732
221837
  },