vite-plugin-dts 3.5.3 → 3.6.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.cjs CHANGED
@@ -195,7 +195,8 @@ function rollupDeclarationFiles({
195
195
  entryPath,
196
196
  fileName,
197
197
  libFolder,
198
- rollupConfig = {}
198
+ rollupConfig = {},
199
+ rollupOptions = {}
199
200
  }) {
200
201
  const configObjectFullPath = node_path.resolve(root, "api-extractor.json");
201
202
  if (!dtsRE$1.test(fileName)) {
@@ -251,7 +252,8 @@ function rollupDeclarationFiles({
251
252
  localBuild: false,
252
253
  showVerboseMessages: false,
253
254
  showDiagnostics: false,
254
- typescriptCompilerFolder: libFolder ? node_path.resolve(libFolder) : void 0
255
+ typescriptCompilerFolder: libFolder ? node_path.resolve(libFolder) : void 0,
256
+ ...rollupOptions
255
257
  });
256
258
  return result.succeeded;
257
259
  }
@@ -480,6 +482,7 @@ function dtsPlugin(options = {}) {
480
482
  rollupTypes = false,
481
483
  pathsToAliases = true,
482
484
  aliasesExclude = [],
485
+ rollupOptions = {},
483
486
  copyDtsFiles = false,
484
487
  declarationOnly = false,
485
488
  strictOutput = true,
@@ -626,11 +629,17 @@ ${logPrefix} ${kolorist.yellow(
626
629
  });
627
630
  }
628
631
  }
629
- include = ensureArray(options.include ?? content?.raw.include ?? "**/*").map(normalizeGlob);
630
- exclude = ensureArray(options.exclude ?? content?.raw.exclude ?? "node_modules/**").map(
631
- normalizeGlob
632
- );
633
- filter = pluginutils.createFilter(include, exclude, { resolve: root });
632
+ const computeGlobs = (rootGlobs, tsGlobs, defaultGlob) => {
633
+ if (rootGlobs?.length) {
634
+ return ensureArray(rootGlobs).map((glob) => normalizeGlob(ensureAbsolute(glob, root)));
635
+ }
636
+ return ensureArray(tsGlobs?.length ? tsGlobs : defaultGlob).map(
637
+ (glob) => normalizeGlob(ensureAbsolute(glob, configPath ? node_path.dirname(configPath) : root))
638
+ );
639
+ };
640
+ include = computeGlobs(options.include, content?.raw.include, "**/*");
641
+ exclude = computeGlobs(options.exclude, content?.raw.exclude, "node_modules/**");
642
+ filter = pluginutils.createFilter(include, exclude);
634
643
  const rootNames = Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath);
635
644
  host = ts__default.createCompilerHost(compilerOptions, true);
636
645
  program = vueTsc.createProgram({ host, rootNames, options: compilerOptions });
@@ -872,7 +881,8 @@ export default ${libName}
872
881
  entryPath: path,
873
882
  fileName: node_path.basename(path),
874
883
  libFolder,
875
- rollupConfig
884
+ rollupConfig,
885
+ rollupOptions
876
886
  });
877
887
  emittedFiles.delete(path);
878
888
  rollupFiles.add(path);
@@ -886,7 +896,8 @@ export default ${libName}
886
896
  entryPath: typesPath,
887
897
  fileName: node_path.basename(typesPath),
888
898
  libFolder,
889
- rollupConfig
899
+ rollupConfig,
900
+ rollupOptions
890
901
  });
891
902
  emittedFiles.delete(typesPath);
892
903
  rollupFiles.add(typesPath);
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as vite from 'vite';
2
2
  import { LogLevel } from 'vite';
3
3
  import ts from 'typescript';
4
- import { IExtractorConfigPrepareOptions } from '@microsoft/api-extractor';
4
+ import { IExtractorInvokeOptions, IExtractorConfigPrepareOptions } from '@microsoft/api-extractor';
5
5
 
6
6
  type MaybePromise<T> = T | Promise<T>;
7
7
  type RollupConfig = Omit<IExtractorConfigPrepareOptions['configObject'], 'projectFolder' | 'mainEntryPointFilePath' | 'compiler' | 'dtsRollup'>;
@@ -115,9 +115,9 @@ interface PluginOptions {
115
115
  */
116
116
  staticImport?: boolean;
117
117
  /**
118
- * Override `include` glob
118
+ * Override `include` glob (relative to root)
119
119
  *
120
- * Defaults to `include` property of tsconfig.json
120
+ * Defaults to `include` property of tsconfig.json (relative to tsconfig.json located)
121
121
  */
122
122
  include?: string | string[];
123
123
  /**
@@ -164,6 +164,13 @@ interface PluginOptions {
164
164
  * @see https://api-extractor.com/pages/setup/configure_api_report/
165
165
  */
166
166
  rollupConfig?: RollupConfig;
167
+ /**
168
+ * Override the invoke options of `@microsoft/api-extractor`
169
+ *
170
+ * @default null
171
+ * @see https://api-extractor.com/pages/setup/invoking/#invoking-from-a-build-script
172
+ */
173
+ rollupOptions?: IExtractorInvokeOptions;
167
174
  /**
168
175
  * Whether to copy .d.ts source files to `outDir`
169
176
  *
package/dist/index.mjs CHANGED
@@ -195,7 +195,8 @@ function rollupDeclarationFiles({
195
195
  entryPath,
196
196
  fileName,
197
197
  libFolder,
198
- rollupConfig = {}
198
+ rollupConfig = {},
199
+ rollupOptions = {}
199
200
  }) {
200
201
  const configObjectFullPath = resolve$1(root, "api-extractor.json");
201
202
  if (!dtsRE$1.test(fileName)) {
@@ -251,7 +252,8 @@ function rollupDeclarationFiles({
251
252
  localBuild: false,
252
253
  showVerboseMessages: false,
253
254
  showDiagnostics: false,
254
- typescriptCompilerFolder: libFolder ? resolve$1(libFolder) : void 0
255
+ typescriptCompilerFolder: libFolder ? resolve$1(libFolder) : void 0,
256
+ ...rollupOptions
255
257
  });
256
258
  return result.succeeded;
257
259
  }
@@ -480,6 +482,7 @@ function dtsPlugin(options = {}) {
480
482
  rollupTypes = false,
481
483
  pathsToAliases = true,
482
484
  aliasesExclude = [],
485
+ rollupOptions = {},
483
486
  copyDtsFiles = false,
484
487
  declarationOnly = false,
485
488
  strictOutput = true,
@@ -626,11 +629,17 @@ ${logPrefix} ${yellow(
626
629
  });
627
630
  }
628
631
  }
629
- include = ensureArray(options.include ?? content?.raw.include ?? "**/*").map(normalizeGlob);
630
- exclude = ensureArray(options.exclude ?? content?.raw.exclude ?? "node_modules/**").map(
631
- normalizeGlob
632
- );
633
- filter = createFilter(include, exclude, { resolve: root });
632
+ const computeGlobs = (rootGlobs, tsGlobs, defaultGlob) => {
633
+ if (rootGlobs?.length) {
634
+ return ensureArray(rootGlobs).map((glob) => normalizeGlob(ensureAbsolute(glob, root)));
635
+ }
636
+ return ensureArray(tsGlobs?.length ? tsGlobs : defaultGlob).map(
637
+ (glob) => normalizeGlob(ensureAbsolute(glob, configPath ? dirname(configPath) : root))
638
+ );
639
+ };
640
+ include = computeGlobs(options.include, content?.raw.include, "**/*");
641
+ exclude = computeGlobs(options.exclude, content?.raw.exclude, "node_modules/**");
642
+ filter = createFilter(include, exclude);
634
643
  const rootNames = Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath);
635
644
  host = ts.createCompilerHost(compilerOptions, true);
636
645
  program = createProgram({ host, rootNames, options: compilerOptions });
@@ -872,7 +881,8 @@ export default ${libName}
872
881
  entryPath: path,
873
882
  fileName: basename(path),
874
883
  libFolder,
875
- rollupConfig
884
+ rollupConfig,
885
+ rollupOptions
876
886
  });
877
887
  emittedFiles.delete(path);
878
888
  rollupFiles.add(path);
@@ -886,7 +896,8 @@ export default ${libName}
886
896
  entryPath: typesPath,
887
897
  fileName: basename(typesPath),
888
898
  libFolder,
889
- rollupConfig
899
+ rollupConfig,
900
+ rollupOptions
890
901
  });
891
902
  emittedFiles.delete(typesPath);
892
903
  rollupFiles.add(typesPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-dts",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "qmhc",