@nhtio/vite-plugins 1.20251202.0 → 1.20251212.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/dts.d.ts +1 -1
- package/dts.mjs +10 -244
- package/dts.mjs.map +1 -1
- package/dts_complex.d.ts +138 -0
- package/dts_complex.mjs +5 -0
- package/dts_complex.mjs.map +1 -0
- package/index-B2cQuM3q.mjs +247 -0
- package/index-B2cQuM3q.mjs.map +1 -0
- package/index-DFu5x9xC.mjs +395370 -0
- package/index-DFu5x9xC.mjs.map +1 -0
- package/index.d.ts +136 -1
- package/index.mjs +3 -1
- package/index.mjs.map +1 -1
- package/package.json +6 -1
package/index.d.ts
CHANGED
|
@@ -29,7 +29,142 @@ import { PluginOptions } from 'vite-plugin-dts';
|
|
|
29
29
|
*
|
|
30
30
|
* @see {@link https://www.npmjs.com/package/vite-plugin-dts | vite-plugin-dts} for more details on available options.
|
|
31
31
|
*/
|
|
32
|
-
export declare const dts: (packageJson: PackageJson, external: Array<string>, options?: Partial<PluginOptions>) => Plugin;
|
|
32
|
+
export declare const dts: (packageJson: PackageJson, external: Array<string | RegExp>, options?: Partial<PluginOptions>) => Plugin;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Advanced Vite plugin that generates TypeScript declaration files for library builds with intelligent
|
|
36
|
+
* vendor dependency bundling and path alias resolution.
|
|
37
|
+
*
|
|
38
|
+
* ## Key Differences from `@nhtio/vite-plugins/dts`
|
|
39
|
+
*
|
|
40
|
+
* While the standard `dts` plugin runs the entire pipeline through Microsoft API Extractor,
|
|
41
|
+
* `dtsComplex` uses a hybrid approach:
|
|
42
|
+
*
|
|
43
|
+
* 1. **Native TypeScript Compilation**: Your source files are compiled to `.d.ts` using TypeScript's
|
|
44
|
+
* native compiler, preserving original structure and comments.
|
|
45
|
+
*
|
|
46
|
+
* 2. **Selective API Extractor Usage**: API Extractor is only used to bundle external vendor libraries
|
|
47
|
+
* into single declaration files, not for your entire codebase.
|
|
48
|
+
*
|
|
49
|
+
* 3. **Separate Vendor Bundles**: External dependencies are bundled into separate files
|
|
50
|
+
* (e.g., `bundled_vendor_name.d.ts`) and referenced from your main declarations, rather than
|
|
51
|
+
* being inlined.
|
|
52
|
+
*
|
|
53
|
+
* 4. **Path Alias Resolution**: All import/export paths are resolved to relative paths, eliminating
|
|
54
|
+
* the need for consumers to configure `paths` in their `tsconfig.json`.
|
|
55
|
+
*
|
|
56
|
+
* ## Pre-Rolled vs Bundled Dependencies
|
|
57
|
+
*
|
|
58
|
+
* - **Bundled Dependencies**: Libraries that need to be rolled up using API Extractor because their
|
|
59
|
+
* declaration files are spread across multiple files.
|
|
60
|
+
*
|
|
61
|
+
* - **Pre-Rolled Dependencies**: Libraries that already provide a single rolled-up declaration file
|
|
62
|
+
* (or single declaration per subpath). These are extracted as-is without further processing.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* Basic usage with bundled dependencies:
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { defineConfig } from 'vite'
|
|
68
|
+
* import { dtsComplex } from '@nhtio/vite-plugins/dts_complex'
|
|
69
|
+
*
|
|
70
|
+
* export default defineConfig({
|
|
71
|
+
* build: {
|
|
72
|
+
* lib: {
|
|
73
|
+
* entry: './src/index.ts',
|
|
74
|
+
* name: 'MyLibrary'
|
|
75
|
+
* }
|
|
76
|
+
* },
|
|
77
|
+
* plugins: [
|
|
78
|
+
* dtsComplex({
|
|
79
|
+
* bundledDependencies: ['lodash-es', 'date-fns']
|
|
80
|
+
* })
|
|
81
|
+
* ]
|
|
82
|
+
* })
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* Advanced usage with pre-rolled dependencies:
|
|
87
|
+
* ```typescript
|
|
88
|
+
* import { defineConfig } from 'vite'
|
|
89
|
+
* import { dtsComplex } from '@nhtio/vite-plugins/dts_complex'
|
|
90
|
+
*
|
|
91
|
+
* export default defineConfig({
|
|
92
|
+
* build: {
|
|
93
|
+
* lib: {
|
|
94
|
+
* entry: {
|
|
95
|
+
* index: './src/index.ts',
|
|
96
|
+
* utils: './src/utils/index.ts'
|
|
97
|
+
* },
|
|
98
|
+
* name: 'MyLibrary'
|
|
99
|
+
* }
|
|
100
|
+
* },
|
|
101
|
+
* plugins: [
|
|
102
|
+
* dtsComplex({
|
|
103
|
+
* // Dependencies that need rollup
|
|
104
|
+
* bundledDependencies: ['lodash-es'],
|
|
105
|
+
* // Dependencies with pre-existing single declaration files
|
|
106
|
+
* preRolledDependencies: ['@nhtio/encoder'],
|
|
107
|
+
* // Custom paths
|
|
108
|
+
* tsConfigJsonPath: './tsconfig.build.json',
|
|
109
|
+
* packageJsonPath: './package.json'
|
|
110
|
+
* })
|
|
111
|
+
* ]
|
|
112
|
+
* })
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* With regex patterns for scoped packages:
|
|
117
|
+
* ```typescript
|
|
118
|
+
* dtsComplex({
|
|
119
|
+
* bundledDependencies: [
|
|
120
|
+
* /^@mycompany\//, // All @mycompany/* packages
|
|
121
|
+
* 'specific-lib'
|
|
122
|
+
* ],
|
|
123
|
+
* preRolledDependencies: [
|
|
124
|
+
* /^@types\// // All @types/* packages (usually pre-rolled)
|
|
125
|
+
* ]
|
|
126
|
+
* })
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const dtsComplex: (options?: Options | undefined) => Plugin<any> | Plugin<any>[];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Options for the dts_complex Vite plugin.
|
|
133
|
+
*/
|
|
134
|
+
declare interface Options {
|
|
135
|
+
/**
|
|
136
|
+
* The path to the package.json file.
|
|
137
|
+
* Can be an absolute path or a path relative to the project root.
|
|
138
|
+
*/
|
|
139
|
+
packageJsonPath?: string;
|
|
140
|
+
/**
|
|
141
|
+
* The path to the tsconfig.json file to use for generating declaration files. Defaults to the project's root tsconfig.json.
|
|
142
|
+
* Can be an absolute path or a path relative to the project root.
|
|
143
|
+
*/
|
|
144
|
+
tsConfigJsonPath?: string;
|
|
145
|
+
/**
|
|
146
|
+
* The path to the node_modules directory. Defaults to the project's root node_modules directory.
|
|
147
|
+
* Can be an absolute path or a path relative to the project root.
|
|
148
|
+
*/
|
|
149
|
+
nodeModulesPath?: string;
|
|
150
|
+
/**
|
|
151
|
+
* An array of package names or regular expressions representing dependencies that should be bundled into the generated declaration files.
|
|
152
|
+
*/
|
|
153
|
+
bundledDependencies?: Array<string | RegExp>;
|
|
154
|
+
/**
|
|
155
|
+
* An array of package names or regular expressions representing dependencies that should be bundled into the generated declaration files, but which do not need to be rolled up into a single declaration file.
|
|
156
|
+
* If the dependency is not already included in `bundledDependencies`, it will be treated as if it were.
|
|
157
|
+
*/
|
|
158
|
+
preRolledDependencies?: Array<string | RegExp>;
|
|
159
|
+
/**
|
|
160
|
+
* Activate additional debug output information
|
|
161
|
+
*/
|
|
162
|
+
debug?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Trace Typescript Resolution
|
|
165
|
+
*/
|
|
166
|
+
traceResolution?: boolean;
|
|
167
|
+
}
|
|
33
168
|
|
|
34
169
|
/**
|
|
35
170
|
* Represents the structure of a package.json file with dependency mappings.
|
package/index.mjs
CHANGED
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * Preconfigured Commonly Used Vite Plugins\n * @module @nhtio/vite-plugins\n */\n\n/**\n * The current version of the package.\n *\n * @tip This is a constant that is replaced during the build process with the actual version of the package.\n */\nexport const version = __VERSION__\n\nexport { dts } from './dts'\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * Preconfigured Commonly Used Vite Plugins\n * @module @nhtio/vite-plugins\n */\n\n/**\n * The current version of the package.\n *\n * @tip This is a constant that is replaced during the build process with the actual version of the package.\n */\nexport const version = __VERSION__\n\nexport { dts } from './dts'\nexport { dtsComplex } from './dts_complex'\n"],"names":[],"mappings":";;AAUO,MAAM,UAAU;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nhtio/vite-plugins",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20251212.0",
|
|
4
4
|
"description": "Preconfigured Commonly Used Vite Plugins",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Jak Giveon <jak@nht.io>",
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"import": "./dts.mjs",
|
|
22
22
|
"require": "./dts.cjs",
|
|
23
23
|
"types": "./dts.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./dts_complex": {
|
|
26
|
+
"import": "./dts_complex.mjs",
|
|
27
|
+
"require": "./dts_complex.cjs",
|
|
28
|
+
"types": "./dts_complex.d.ts"
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"packageManager": "pnpm@10.8.0+sha512.0e82714d1b5b43c74610193cb20734897c1d00de89d0e18420aebc5977fa13d780a9cb05734624e81ebd81cc876cd464794850641c48b9544326b5622ca29971",
|