@sanity/pkg-utils 5.0.7 → 5.0.8-canary.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/cli.cjs CHANGED
@@ -3,7 +3,7 @@ var cac = require("cac");
3
3
  function _interopDefaultCompat(e) {
4
4
  return e && typeof e == "object" && "default" in e ? e : { default: e };
5
5
  }
6
- var cac__default = /* @__PURE__ */ _interopDefaultCompat(cac), version = "5.0.7";
6
+ var cac__default = /* @__PURE__ */ _interopDefaultCompat(cac), version = "5.0.8-canary.0";
7
7
  const cli = cac__default.default();
8
8
  cli.command("", "Check").alias("check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async (options) => {
9
9
  const { checkAction } = await Promise.resolve().then(function() {
package/dist/index.js CHANGED
@@ -648,7 +648,16 @@ async function buildTypes(options2) {
648
648
  declarationDir: outDir,
649
649
  emitDeclarationOnly: !0,
650
650
  noEmit: !1,
651
- outDir
651
+ outDir,
652
+ // Support the new `module: 'preserve'` option in TypeScript 5.4
653
+ ...tsconfig.options.module === ts.ModuleKind.Preserve ? {
654
+ // Set the equivalent options to `module: 'Preserve'`
655
+ // https://github.com/microsoft/TypeScript/pull/56785/files?file-filters%5B%5D=.js&file-filters%5B%5D=.json&file-filters%5B%5D=.symbols&file-filters%5B%5D=.ts&file-filters%5B%5D=.types&show-viewed-files=true#diff-31d3c12bafea26bc9e8c8a77920c41af0c593206442add70c45a06c063767445
656
+ module: ts.ModuleKind.ESNext,
657
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
658
+ esModuleInterop: !0,
659
+ resolveJsonModule: !0
660
+ } : {}
652
661
  }, program = ts.createProgram(tsconfig.fileNames, compilerOptions), emitResult = program.emit(), allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
653
662
  for (const diagnostic of allDiagnostics)
654
663
  printDiagnostic({ cwd, logger, diagnostic });
@@ -669,6 +678,7 @@ function createApiExtractorConfig(options2) {
669
678
  messages,
670
679
  projectFolder,
671
680
  mainEntryPointFilePath,
681
+ tsconfig,
672
682
  tsconfigPath
673
683
  } = options2;
674
684
  return {
@@ -677,7 +687,21 @@ function createApiExtractorConfig(options2) {
677
687
  reportFileName: "<unscopedPackageName>.api.md"
678
688
  },
679
689
  bundledPackages,
680
- compiler: {
690
+ compiler: tsconfig.options.module === ts.ModuleKind.Preserve ? {
691
+ // When the module is 'preserve' it's necessary to override the tsconfig file as api-extractor doesn't handle it out of the box
692
+ overrideTsconfig: {
693
+ extends: tsconfigPath,
694
+ compilerOptions: {
695
+ // Set the equivalent options to `module: 'Preserve'`
696
+ // https://github.com/microsoft/TypeScript/pull/56785/files?file-filters%5B%5D=.js&file-filters%5B%5D=.json&file-filters%5B%5D=.symbols&file-filters%5B%5D=.ts&file-filters%5B%5D=.types&show-viewed-files=true#diff-31d3c12bafea26bc9e8c8a77920c41af0c593206442add70c45a06c063767445
697
+ module: "ESNext",
698
+ moduleResolution: "Bundler",
699
+ esModuleInterop: !0,
700
+ resolveJsonModule: !0
701
+ }
702
+ }
703
+ } : {
704
+ // If the module is not 'preserve', use the tsconfig file directly
681
705
  tsconfigFilePath: tsconfigPath
682
706
  },
683
707
  docModel: {
@@ -20161,6 +20185,7 @@ async function extractTypes(options2) {
20161
20185
  rules,
20162
20186
  sourceTypesPath,
20163
20187
  tmpPath,
20188
+ tsconfig,
20164
20189
  tsconfigPath
20165
20190
  } = options2, tsdocConfigFile = await createTSDocConfig({
20166
20191
  customTags: customTags || []
@@ -20173,6 +20198,7 @@ async function extractTypes(options2) {
20173
20198
  messages: getExtractMessagesConfig({ rules }),
20174
20199
  projectFolder: projectPath,
20175
20200
  mainEntryPointFilePath: sourceTypesPath,
20201
+ tsconfig,
20176
20202
  tsconfigPath
20177
20203
  }),
20178
20204
  configObjectFullPath: void 0,
@@ -20231,6 +20257,7 @@ async function doExtract(ctx, task) {
20231
20257
  projectPath: cwd,
20232
20258
  rules: config2?.extract?.rules,
20233
20259
  sourceTypesPath,
20260
+ tsconfig: ts2.config,
20234
20261
  tmpPath,
20235
20262
  tsconfigPath: path$1.resolve(cwd, ts2.configPath || "tsconfig.json")
20236
20263
  });