@sanity/cli-core 3.11.1 → 3.12.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.
@@ -14,7 +14,7 @@ import { i as isNotFoundError, n as isProjectRootNotFoundError, r as NotFoundErr
14
14
  import { exitCodes } from "../exitCodes.js";
15
15
  import { n as createStudioWorker, r as studioWorkerTask, t as tsxWorkerTask } from "../tsxWorkerTask-DQQSOYCZ.js";
16
16
  import { a as getCliTelemetry, i as clearCliTelemetry, n as getTelemetryBaseInfo, o as reportCliTraceError, r as CLI_TELEMETRY_SYMBOL, s as setCliTelemetry, t as noopLogger } from "../noopTelemetry-BJRIvASI.js";
17
- import { a as isCi, i as isInteractive, n as normalizePath, o as importModule, r as isStaging, s as doImport, t as safeStructuredClone } from "../safeStructuredClone-DAFcnqtc.js";
17
+ import { a as isCi, i as isInteractive, n as normalizePath, o as importModule, r as isStaging, s as doImport, t as safeStructuredClone } from "../safeStructuredClone-BixYyg4K.js";
18
18
  import { a as getLocalPackageVersion, i as getLocalPackageDir, n as resolveLocalPackageFrom, r as resolveLocalPackagePath, t as resolveLocalPackage } from "../resolveLocalPackage-Dr-TNTyk.js";
19
19
  import { n as ReadPackageJsonOptions, r as readPackageJson, t as PackageJson } from "../readPackageJson-Cr_lbjVR.js";
20
20
  import { n as colorizeJson, t as getTimer } from "../timer-Dwu2TIgB.js";
@@ -1,5 +1,5 @@
1
1
  import { a as getSanityDataDir, i as getSanityConfigDir, n as getSanityUrl, r as getSanityEnvVar, t as getWorkspace } from "../getWorkspace-CU32E6Uo.js";
2
- import { a as isCi, i as isInteractive$1, n as normalizePath, o as importModule, r as isStaging, s as doImport, t as safeStructuredClone } from "../safeStructuredClone-DAFcnqtc.js";
2
+ import { a as isCi, i as isInteractive$1, n as normalizePath, o as importModule, r as isStaging, s as doImport, t as safeStructuredClone } from "../safeStructuredClone-BixYyg4K.js";
3
3
  declare function getCoreAppUrl(organizationId: string, appId: string): string;
4
4
  /**
5
5
  * Checks if the given value is a record (javascript objectish)
@@ -11,6 +11,12 @@ interface ImportModuleOptions {
11
11
  * Default: true
12
12
  */
13
13
  default?: boolean;
14
+ /**
15
+ * Whether to transform JSX in the imported module (and anything it imports).
16
+ * Required for `.tsx`/`.jsx` modules — without it they fail to parse.
17
+ * Default: false
18
+ */
19
+ jsx?: boolean;
14
20
  /**
15
21
  * Path to the tsconfig file to use for the import. If not provided, the tsconfig
16
22
  * will be inferred from the nearest `tsconfig.json` file.
@@ -54,4 +60,4 @@ declare function normalizePath(path: string): string;
54
60
  */
55
61
  declare function safeStructuredClone<T>(obj: T): T;
56
62
  export { isCi as a, isInteractive as i, normalizePath as n, importModule as o, isStaging as r, doImport as s, safeStructuredClone as t };
57
- //# sourceMappingURL=safeStructuredClone-DAFcnqtc.d.ts.map
63
+ //# sourceMappingURL=safeStructuredClone-BixYyg4K.d.ts.map
@@ -11,9 +11,10 @@ const debug = subdebug('importModule');
11
11
  *
12
12
  * @internal
13
13
  */ export async function importModule(filePath, options = {}) {
14
- const { default: returnDefault = true, tsconfigPath } = options;
14
+ const { default: returnDefault = true, jsx = false, tsconfigPath } = options;
15
15
  const jiti = createJiti(import.meta.url, {
16
16
  debug: debug.enabled,
17
+ jsx,
17
18
  tsconfigPaths: typeof tsconfigPath === 'string' ? tsconfigPath : true
18
19
  });
19
20
  const fileURL = typeof filePath === 'string' ? pathToFileURL(filePath) : filePath;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/util/importModule.ts"],"sourcesContent":["import {fileURLToPath, pathToFileURL} from 'node:url'\n\nimport {createJiti, type JitiResolveOptions} from 'jiti'\n\nimport {subdebug} from '../_exports/debug.js'\n\ninterface ImportModuleOptions {\n /**\n * Whether to return the default export of the module.\n * Default: true\n */\n default?: boolean\n\n /**\n * Path to the tsconfig file to use for the import. If not provided, the tsconfig\n * will be inferred from the nearest `tsconfig.json` file.\n */\n tsconfigPath?: string\n}\n\nconst debug = subdebug('importModule')\n\n/**\n * Imports a module using Jiti and returns its exports.\n *\n * @param filePath - Path to the module to import.\n * @param options - Options for the importModule function.\n * @returns The exported module.\n *\n * @internal\n */\nexport async function importModule<T = unknown>(\n filePath: string | URL,\n options: ImportModuleOptions = {},\n): Promise<T> {\n const {default: returnDefault = true, tsconfigPath} = options\n\n const jiti = createJiti(import.meta.url, {\n debug: debug.enabled,\n tsconfigPaths: typeof tsconfigPath === 'string' ? tsconfigPath : true,\n })\n\n const fileURL = typeof filePath === 'string' ? pathToFileURL(filePath) : filePath\n\n debug(`Loading module: ${fileURLToPath(fileURL)}`, {tsconfigPath})\n\n const jitiOptions: JitiResolveOptions & {default?: true} = {}\n\n // If the default option is true, add it to the jiti options\n if (returnDefault) {\n jitiOptions.default = true\n }\n\n return jiti.import<T>(fileURLToPath(fileURL), jitiOptions)\n}\n"],"names":["fileURLToPath","pathToFileURL","createJiti","subdebug","debug","importModule","filePath","options","default","returnDefault","tsconfigPath","jiti","url","enabled","tsconfigPaths","fileURL","jitiOptions","import"],"mappings":"AAAA,SAAQA,aAAa,EAAEC,aAAa,QAAO,WAAU;AAErD,SAAQC,UAAU,QAAgC,OAAM;AAExD,SAAQC,QAAQ,QAAO,uBAAsB;AAgB7C,MAAMC,QAAQD,SAAS;AAEvB;;;;;;;;CAQC,GACD,OAAO,eAAeE,aACpBC,QAAsB,EACtBC,UAA+B,CAAC,CAAC;IAEjC,MAAM,EAACC,SAASC,gBAAgB,IAAI,EAAEC,YAAY,EAAC,GAAGH;IAEtD,MAAMI,OAAOT,WAAW,YAAYU,GAAG,EAAE;QACvCR,OAAOA,MAAMS,OAAO;QACpBC,eAAe,OAAOJ,iBAAiB,WAAWA,eAAe;IACnE;IAEA,MAAMK,UAAU,OAAOT,aAAa,WAAWL,cAAcK,YAAYA;IAEzEF,MAAM,CAAC,gBAAgB,EAAEJ,cAAce,UAAU,EAAE;QAACL;IAAY;IAEhE,MAAMM,cAAqD,CAAC;IAE5D,4DAA4D;IAC5D,IAAIP,eAAe;QACjBO,YAAYR,OAAO,GAAG;IACxB;IAEA,OAAOG,KAAKM,MAAM,CAAIjB,cAAce,UAAUC;AAChD"}
1
+ {"version":3,"sources":["../../src/util/importModule.ts"],"sourcesContent":["import {fileURLToPath, pathToFileURL} from 'node:url'\n\nimport {createJiti, type JitiResolveOptions} from 'jiti'\n\nimport {subdebug} from '../_exports/debug.js'\n\ninterface ImportModuleOptions {\n /**\n * Whether to return the default export of the module.\n * Default: true\n */\n default?: boolean\n\n /**\n * Whether to transform JSX in the imported module (and anything it imports).\n * Required for `.tsx`/`.jsx` modules — without it they fail to parse.\n * Default: false\n */\n jsx?: boolean\n\n /**\n * Path to the tsconfig file to use for the import. If not provided, the tsconfig\n * will be inferred from the nearest `tsconfig.json` file.\n */\n tsconfigPath?: string\n}\n\nconst debug = subdebug('importModule')\n\n/**\n * Imports a module using Jiti and returns its exports.\n *\n * @param filePath - Path to the module to import.\n * @param options - Options for the importModule function.\n * @returns The exported module.\n *\n * @internal\n */\nexport async function importModule<T = unknown>(\n filePath: string | URL,\n options: ImportModuleOptions = {},\n): Promise<T> {\n const {default: returnDefault = true, jsx = false, tsconfigPath} = options\n\n const jiti = createJiti(import.meta.url, {\n debug: debug.enabled,\n jsx,\n tsconfigPaths: typeof tsconfigPath === 'string' ? tsconfigPath : true,\n })\n\n const fileURL = typeof filePath === 'string' ? pathToFileURL(filePath) : filePath\n\n debug(`Loading module: ${fileURLToPath(fileURL)}`, {tsconfigPath})\n\n const jitiOptions: JitiResolveOptions & {default?: true} = {}\n\n // If the default option is true, add it to the jiti options\n if (returnDefault) {\n jitiOptions.default = true\n }\n\n return jiti.import<T>(fileURLToPath(fileURL), jitiOptions)\n}\n"],"names":["fileURLToPath","pathToFileURL","createJiti","subdebug","debug","importModule","filePath","options","default","returnDefault","jsx","tsconfigPath","jiti","url","enabled","tsconfigPaths","fileURL","jitiOptions","import"],"mappings":"AAAA,SAAQA,aAAa,EAAEC,aAAa,QAAO,WAAU;AAErD,SAAQC,UAAU,QAAgC,OAAM;AAExD,SAAQC,QAAQ,QAAO,uBAAsB;AAuB7C,MAAMC,QAAQD,SAAS;AAEvB;;;;;;;;CAQC,GACD,OAAO,eAAeE,aACpBC,QAAsB,EACtBC,UAA+B,CAAC,CAAC;IAEjC,MAAM,EAACC,SAASC,gBAAgB,IAAI,EAAEC,MAAM,KAAK,EAAEC,YAAY,EAAC,GAAGJ;IAEnE,MAAMK,OAAOV,WAAW,YAAYW,GAAG,EAAE;QACvCT,OAAOA,MAAMU,OAAO;QACpBJ;QACAK,eAAe,OAAOJ,iBAAiB,WAAWA,eAAe;IACnE;IAEA,MAAMK,UAAU,OAAOV,aAAa,WAAWL,cAAcK,YAAYA;IAEzEF,MAAM,CAAC,gBAAgB,EAAEJ,cAAcgB,UAAU,EAAE;QAACL;IAAY;IAEhE,MAAMM,cAAqD,CAAC;IAE5D,4DAA4D;IAC5D,IAAIR,eAAe;QACjBQ,YAAYT,OAAO,GAAG;IACxB;IAEA,OAAOI,KAAKM,MAAM,CAAIlB,cAAcgB,UAAUC;AAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-core",
3
- "version": "3.11.1",
3
+ "version": "3.12.0",
4
4
  "description": "Sanity CLI core package",
5
5
  "keywords": [
6
6
  "cli",