@nhtio/vite-plugins 0.1.0-master-f525ebee → 0.1.0-master-aedb1582

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 CHANGED
@@ -29,7 +29,7 @@ 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
33
 
34
34
  /**
35
35
  * Represents the structure of a package.json file with dependency mappings.
package/dts.mjs CHANGED
@@ -1,247 +1,5 @@
1
+ import { d as deepmerge } from "./index-B2cQuM3q.mjs";
1
2
  import dtsPlugin from "vite-plugin-dts";
2
- const actions = {
3
- defaultMerge: Symbol("deepmerge-ts: default merge"),
4
- skip: Symbol("deepmerge-ts: skip")
5
- };
6
- ({
7
- defaultMerge: actions.defaultMerge
8
- });
9
- function defaultMetaDataUpdater(previousMeta, metaMeta) {
10
- return metaMeta;
11
- }
12
- function defaultFilterValues(values, meta) {
13
- return values.filter((value) => value !== void 0);
14
- }
15
- var ObjectType;
16
- (function(ObjectType2) {
17
- ObjectType2[ObjectType2["NOT"] = 0] = "NOT";
18
- ObjectType2[ObjectType2["RECORD"] = 1] = "RECORD";
19
- ObjectType2[ObjectType2["ARRAY"] = 2] = "ARRAY";
20
- ObjectType2[ObjectType2["SET"] = 3] = "SET";
21
- ObjectType2[ObjectType2["MAP"] = 4] = "MAP";
22
- ObjectType2[ObjectType2["OTHER"] = 5] = "OTHER";
23
- })(ObjectType || (ObjectType = {}));
24
- function getObjectType(object) {
25
- if (typeof object !== "object" || object === null) {
26
- return 0;
27
- }
28
- if (Array.isArray(object)) {
29
- return 2;
30
- }
31
- if (isRecord(object)) {
32
- return 1;
33
- }
34
- if (object instanceof Set) {
35
- return 3;
36
- }
37
- if (object instanceof Map) {
38
- return 4;
39
- }
40
- return 5;
41
- }
42
- function getKeys(objects) {
43
- const keys = /* @__PURE__ */ new Set();
44
- for (const object of objects) {
45
- for (const key of [...Object.keys(object), ...Object.getOwnPropertySymbols(object)]) {
46
- keys.add(key);
47
- }
48
- }
49
- return keys;
50
- }
51
- function objectHasProperty(object, property) {
52
- return typeof object === "object" && Object.prototype.propertyIsEnumerable.call(object, property);
53
- }
54
- function getIterableOfIterables(iterables) {
55
- let mut_iterablesIndex = 0;
56
- let mut_iterator = iterables[0]?.[Symbol.iterator]();
57
- return {
58
- [Symbol.iterator]() {
59
- return {
60
- next() {
61
- do {
62
- if (mut_iterator === void 0) {
63
- return { done: true, value: void 0 };
64
- }
65
- const result = mut_iterator.next();
66
- if (result.done === true) {
67
- mut_iterablesIndex += 1;
68
- mut_iterator = iterables[mut_iterablesIndex]?.[Symbol.iterator]();
69
- continue;
70
- }
71
- return {
72
- done: false,
73
- value: result.value
74
- };
75
- } while (true);
76
- }
77
- };
78
- }
79
- };
80
- }
81
- const validRecordToStringValues = ["[object Object]", "[object Module]"];
82
- function isRecord(value) {
83
- if (!validRecordToStringValues.includes(Object.prototype.toString.call(value))) {
84
- return false;
85
- }
86
- const { constructor } = value;
87
- if (constructor === void 0) {
88
- return true;
89
- }
90
- const prototype = constructor.prototype;
91
- if (prototype === null || typeof prototype !== "object" || !validRecordToStringValues.includes(Object.prototype.toString.call(prototype))) {
92
- return false;
93
- }
94
- if (!prototype.hasOwnProperty("isPrototypeOf")) {
95
- return false;
96
- }
97
- return true;
98
- }
99
- function mergeRecords$1(values, utils, meta) {
100
- const result = {};
101
- for (const key of getKeys(values)) {
102
- const propValues = [];
103
- for (const value of values) {
104
- if (objectHasProperty(value, key)) {
105
- propValues.push(value[key]);
106
- }
107
- }
108
- if (propValues.length === 0) {
109
- continue;
110
- }
111
- const updatedMeta = utils.metaDataUpdater(meta, {
112
- key,
113
- parents: values
114
- });
115
- const propertyResult = mergeUnknowns(propValues, utils, updatedMeta);
116
- if (propertyResult === actions.skip) {
117
- continue;
118
- }
119
- if (key === "__proto__") {
120
- Object.defineProperty(result, key, {
121
- value: propertyResult,
122
- configurable: true,
123
- enumerable: true,
124
- writable: true
125
- });
126
- } else {
127
- result[key] = propertyResult;
128
- }
129
- }
130
- return result;
131
- }
132
- function mergeArrays$1(values) {
133
- return values.flat();
134
- }
135
- function mergeSets$1(values) {
136
- return new Set(getIterableOfIterables(values));
137
- }
138
- function mergeMaps$1(values) {
139
- return new Map(getIterableOfIterables(values));
140
- }
141
- function mergeOthers$1(values) {
142
- return values.at(-1);
143
- }
144
- const mergeFunctions = {
145
- mergeRecords: mergeRecords$1,
146
- mergeArrays: mergeArrays$1,
147
- mergeSets: mergeSets$1,
148
- mergeMaps: mergeMaps$1,
149
- mergeOthers: mergeOthers$1
150
- };
151
- function deepmerge(...objects) {
152
- return deepmergeCustom({})(...objects);
153
- }
154
- function deepmergeCustom(options, rootMetaData) {
155
- const utils = getUtils(options, customizedDeepmerge);
156
- function customizedDeepmerge(...objects) {
157
- return mergeUnknowns(objects, utils, rootMetaData);
158
- }
159
- return customizedDeepmerge;
160
- }
161
- function getUtils(options, customizedDeepmerge) {
162
- return {
163
- defaultMergeFunctions: mergeFunctions,
164
- mergeFunctions: {
165
- ...mergeFunctions,
166
- ...Object.fromEntries(Object.entries(options).filter(([key, option]) => Object.hasOwn(mergeFunctions, key)).map(([key, option]) => option === false ? [key, mergeFunctions.mergeOthers] : [key, option]))
167
- },
168
- metaDataUpdater: options.metaDataUpdater ?? defaultMetaDataUpdater,
169
- deepmerge: customizedDeepmerge,
170
- useImplicitDefaultMerging: options.enableImplicitDefaultMerging ?? false,
171
- filterValues: options.filterValues === false ? void 0 : options.filterValues ?? defaultFilterValues,
172
- actions
173
- };
174
- }
175
- function mergeUnknowns(values, utils, meta) {
176
- const filteredValues = utils.filterValues?.(values, meta) ?? values;
177
- if (filteredValues.length === 0) {
178
- return void 0;
179
- }
180
- if (filteredValues.length === 1) {
181
- return mergeOthers(filteredValues, utils, meta);
182
- }
183
- const type = getObjectType(filteredValues[0]);
184
- if (type !== 0 && type !== 5) {
185
- for (let mut_index = 1; mut_index < filteredValues.length; mut_index++) {
186
- if (getObjectType(filteredValues[mut_index]) === type) {
187
- continue;
188
- }
189
- return mergeOthers(filteredValues, utils, meta);
190
- }
191
- }
192
- switch (type) {
193
- case 1: {
194
- return mergeRecords(filteredValues, utils, meta);
195
- }
196
- case 2: {
197
- return mergeArrays(filteredValues, utils, meta);
198
- }
199
- case 3: {
200
- return mergeSets(filteredValues, utils, meta);
201
- }
202
- case 4: {
203
- return mergeMaps(filteredValues, utils, meta);
204
- }
205
- default: {
206
- return mergeOthers(filteredValues, utils, meta);
207
- }
208
- }
209
- }
210
- function mergeRecords(values, utils, meta) {
211
- const result = utils.mergeFunctions.mergeRecords(values, utils, meta);
212
- if (result === actions.defaultMerge || utils.useImplicitDefaultMerging && result === void 0 && utils.mergeFunctions.mergeRecords !== utils.defaultMergeFunctions.mergeRecords) {
213
- return utils.defaultMergeFunctions.mergeRecords(values, utils, meta);
214
- }
215
- return result;
216
- }
217
- function mergeArrays(values, utils, meta) {
218
- const result = utils.mergeFunctions.mergeArrays(values, utils, meta);
219
- if (result === actions.defaultMerge || utils.useImplicitDefaultMerging && result === void 0 && utils.mergeFunctions.mergeArrays !== utils.defaultMergeFunctions.mergeArrays) {
220
- return utils.defaultMergeFunctions.mergeArrays(values);
221
- }
222
- return result;
223
- }
224
- function mergeSets(values, utils, meta) {
225
- const result = utils.mergeFunctions.mergeSets(values, utils, meta);
226
- if (result === actions.defaultMerge || utils.useImplicitDefaultMerging && result === void 0 && utils.mergeFunctions.mergeSets !== utils.defaultMergeFunctions.mergeSets) {
227
- return utils.defaultMergeFunctions.mergeSets(values);
228
- }
229
- return result;
230
- }
231
- function mergeMaps(values, utils, meta) {
232
- const result = utils.mergeFunctions.mergeMaps(values, utils, meta);
233
- if (result === actions.defaultMerge || utils.useImplicitDefaultMerging && result === void 0 && utils.mergeFunctions.mergeMaps !== utils.defaultMergeFunctions.mergeMaps) {
234
- return utils.defaultMergeFunctions.mergeMaps(values);
235
- }
236
- return result;
237
- }
238
- function mergeOthers(values, utils, meta) {
239
- const result = utils.mergeFunctions.mergeOthers(values, utils, meta);
240
- if (result === actions.defaultMerge || utils.useImplicitDefaultMerging && result === void 0 && utils.mergeFunctions.mergeOthers !== utils.defaultMergeFunctions.mergeOthers) {
241
- return utils.defaultMergeFunctions.mergeOthers(values);
242
- }
243
- return result;
244
- }
245
3
  const dts = (packageJson, external, options) => {
246
4
  const bundled = /* @__PURE__ */ new Set([]);
247
5
  if (packageJson.devDependencies) {
@@ -250,7 +8,15 @@ const dts = (packageJson, external, options) => {
250
8
  });
251
9
  }
252
10
  external.forEach((mod) => {
253
- bundled.delete(mod);
11
+ if ("string" === typeof mod) {
12
+ bundled.delete(mod);
13
+ } else if (mod instanceof RegExp) {
14
+ Array.from(bundled).forEach((dep) => {
15
+ if (mod.test(dep)) {
16
+ bundled.delete(dep);
17
+ }
18
+ });
19
+ }
254
20
  });
255
21
  const providedOpts = {
256
22
  tsconfigPath: "./tsconfig.build.json",
package/dts.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dts.mjs","sources":["../node_modules/.pnpm/deepmerge-ts@7.1.5/node_modules/deepmerge-ts/dist/index.mjs","../src/dts.ts"],"sourcesContent":["/**\n * Special values that tell deepmerge to perform a certain action.\n */\nconst actions = {\n defaultMerge: Symbol(\"deepmerge-ts: default merge\"),\n skip: Symbol(\"deepmerge-ts: skip\"),\n};\n/**\n * Special values that tell deepmergeInto to perform a certain action.\n */\nconst actionsInto = {\n defaultMerge: actions.defaultMerge,\n};\n\n/**\n * The default function to update meta data.\n *\n * It doesn't update the meta data.\n */\nfunction defaultMetaDataUpdater(previousMeta, metaMeta) {\n return metaMeta;\n}\n/**\n * The default function to filter values.\n *\n * It filters out undefined values.\n */\nfunction defaultFilterValues(values, meta) {\n return values.filter((value) => value !== undefined);\n}\n\n/**\n * The different types of objects deepmerge-ts support.\n */\nvar ObjectType;\n(function (ObjectType) {\n ObjectType[ObjectType[\"NOT\"] = 0] = \"NOT\";\n ObjectType[ObjectType[\"RECORD\"] = 1] = \"RECORD\";\n ObjectType[ObjectType[\"ARRAY\"] = 2] = \"ARRAY\";\n ObjectType[ObjectType[\"SET\"] = 3] = \"SET\";\n ObjectType[ObjectType[\"MAP\"] = 4] = \"MAP\";\n ObjectType[ObjectType[\"OTHER\"] = 5] = \"OTHER\";\n})(ObjectType || (ObjectType = {}));\n/**\n * Get the type of the given object.\n *\n * @param object - The object to get the type of.\n * @returns The type of the given object.\n */\nfunction getObjectType(object) {\n if (typeof object !== \"object\" || object === null) {\n return 0 /* ObjectType.NOT */;\n }\n if (Array.isArray(object)) {\n return 2 /* ObjectType.ARRAY */;\n }\n if (isRecord(object)) {\n return 1 /* ObjectType.RECORD */;\n }\n if (object instanceof Set) {\n return 3 /* ObjectType.SET */;\n }\n if (object instanceof Map) {\n return 4 /* ObjectType.MAP */;\n }\n return 5 /* ObjectType.OTHER */;\n}\n/**\n * Get the keys of the given objects including symbol keys.\n *\n * Note: Only keys to enumerable properties are returned.\n *\n * @param objects - An array of objects to get the keys of.\n * @returns A set containing all the keys of all the given objects.\n */\nfunction getKeys(objects) {\n const keys = new Set();\n for (const object of objects) {\n for (const key of [...Object.keys(object), ...Object.getOwnPropertySymbols(object)]) {\n keys.add(key);\n }\n }\n return keys;\n}\n/**\n * Does the given object have the given property.\n *\n * @param object - The object to test.\n * @param property - The property to test.\n * @returns Whether the object has the property.\n */\nfunction objectHasProperty(object, property) {\n return typeof object === \"object\" && Object.prototype.propertyIsEnumerable.call(object, property);\n}\n/**\n * Get an iterable object that iterates over the given iterables.\n */\nfunction getIterableOfIterables(iterables) {\n let mut_iterablesIndex = 0;\n let mut_iterator = iterables[0]?.[Symbol.iterator]();\n return {\n [Symbol.iterator]() {\n return {\n next() {\n do {\n if (mut_iterator === undefined) {\n return { done: true, value: undefined };\n }\n const result = mut_iterator.next();\n if (result.done === true) {\n mut_iterablesIndex += 1;\n mut_iterator = iterables[mut_iterablesIndex]?.[Symbol.iterator]();\n continue;\n }\n return {\n done: false,\n value: result.value,\n };\n } while (true);\n },\n };\n },\n };\n}\n// eslint-disable-next-line unicorn/prefer-set-has -- Array is more performant for a low number of elements.\nconst validRecordToStringValues = [\"[object Object]\", \"[object Module]\"];\n/**\n * Does the given object appear to be a record.\n */\nfunction isRecord(value) {\n // All records are objects.\n if (!validRecordToStringValues.includes(Object.prototype.toString.call(value))) {\n return false;\n }\n const { constructor } = value;\n // If has modified constructor.\n // eslint-disable-next-line ts/no-unnecessary-condition\n if (constructor === undefined) {\n return true;\n }\n const prototype = constructor.prototype;\n // If has modified prototype.\n if (prototype === null ||\n typeof prototype !== \"object\" ||\n !validRecordToStringValues.includes(Object.prototype.toString.call(prototype))) {\n return false;\n }\n // If constructor does not have an Object-specific method.\n // eslint-disable-next-line sonar/prefer-single-boolean-return, no-prototype-builtins\n if (!prototype.hasOwnProperty(\"isPrototypeOf\")) {\n return false;\n }\n // Most likely a record.\n return true;\n}\n\n/**\n * The default strategy to merge records.\n *\n * @param values - The records.\n */\nfunction mergeRecords$1(values, utils, meta) {\n const result = {};\n for (const key of getKeys(values)) {\n const propValues = [];\n for (const value of values) {\n if (objectHasProperty(value, key)) {\n propValues.push(value[key]);\n }\n }\n if (propValues.length === 0) {\n continue;\n }\n const updatedMeta = utils.metaDataUpdater(meta, {\n key,\n parents: values,\n });\n const propertyResult = mergeUnknowns(propValues, utils, updatedMeta);\n if (propertyResult === actions.skip) {\n continue;\n }\n if (key === \"__proto__\") {\n Object.defineProperty(result, key, {\n value: propertyResult,\n configurable: true,\n enumerable: true,\n writable: true,\n });\n }\n else {\n result[key] = propertyResult;\n }\n }\n return result;\n}\n/**\n * The default strategy to merge arrays.\n *\n * @param values - The arrays.\n */\nfunction mergeArrays$1(values) {\n return values.flat();\n}\n/**\n * The default strategy to merge sets.\n *\n * @param values - The sets.\n */\nfunction mergeSets$1(values) {\n return new Set(getIterableOfIterables(values));\n}\n/**\n * The default strategy to merge maps.\n *\n * @param values - The maps.\n */\nfunction mergeMaps$1(values) {\n return new Map(getIterableOfIterables(values));\n}\n/**\n * Get the last value in the given array.\n */\nfunction mergeOthers$1(values) {\n return values.at(-1);\n}\n/**\n * The merge functions.\n */\nconst mergeFunctions = {\n mergeRecords: mergeRecords$1,\n mergeArrays: mergeArrays$1,\n mergeSets: mergeSets$1,\n mergeMaps: mergeMaps$1,\n mergeOthers: mergeOthers$1,\n};\n\n/**\n * Deeply merge objects.\n *\n * @param objects - The objects to merge.\n */\nfunction deepmerge(...objects) {\n return deepmergeCustom({})(...objects);\n}\nfunction deepmergeCustom(options, rootMetaData) {\n const utils = getUtils(options, customizedDeepmerge);\n /**\n * The customized deepmerge function.\n */\n function customizedDeepmerge(...objects) {\n return mergeUnknowns(objects, utils, rootMetaData);\n }\n return customizedDeepmerge;\n}\n/**\n * The the utils that are available to the merge functions.\n *\n * @param options - The options the user specified\n */\nfunction getUtils(options, customizedDeepmerge) {\n return {\n defaultMergeFunctions: mergeFunctions,\n mergeFunctions: {\n ...mergeFunctions,\n ...Object.fromEntries(Object.entries(options)\n .filter(([key, option]) => Object.hasOwn(mergeFunctions, key))\n .map(([key, option]) => (option === false ? [key, mergeFunctions.mergeOthers] : [key, option]))),\n },\n metaDataUpdater: (options.metaDataUpdater ?? defaultMetaDataUpdater),\n deepmerge: customizedDeepmerge,\n useImplicitDefaultMerging: options.enableImplicitDefaultMerging ?? false,\n filterValues: options.filterValues === false ? undefined : (options.filterValues ?? defaultFilterValues),\n actions,\n };\n}\n/**\n * Merge unknown things.\n *\n * @param values - The values.\n */\nfunction mergeUnknowns(values, utils, meta) {\n const filteredValues = utils.filterValues?.(values, meta) ?? values;\n if (filteredValues.length === 0) {\n return undefined;\n }\n if (filteredValues.length === 1) {\n return mergeOthers(filteredValues, utils, meta);\n }\n const type = getObjectType(filteredValues[0]);\n if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {\n for (let mut_index = 1; mut_index < filteredValues.length; mut_index++) {\n if (getObjectType(filteredValues[mut_index]) === type) {\n continue;\n }\n return mergeOthers(filteredValues, utils, meta);\n }\n }\n switch (type) {\n case 1 /* ObjectType.RECORD */: {\n return mergeRecords(filteredValues, utils, meta);\n }\n case 2 /* ObjectType.ARRAY */: {\n return mergeArrays(filteredValues, utils, meta);\n }\n case 3 /* ObjectType.SET */: {\n return mergeSets(filteredValues, utils, meta);\n }\n case 4 /* ObjectType.MAP */: {\n return mergeMaps(filteredValues, utils, meta);\n }\n default: {\n return mergeOthers(filteredValues, utils, meta);\n }\n }\n}\n/**\n * Merge records.\n *\n * @param values - The records.\n */\nfunction mergeRecords(values, utils, meta) {\n const result = utils.mergeFunctions.mergeRecords(values, utils, meta);\n if (result === actions.defaultMerge ||\n (utils.useImplicitDefaultMerging &&\n result === undefined &&\n utils.mergeFunctions.mergeRecords !== utils.defaultMergeFunctions.mergeRecords)) {\n return utils.defaultMergeFunctions.mergeRecords(values, utils, meta);\n }\n return result;\n}\n/**\n * Merge arrays.\n *\n * @param values - The arrays.\n */\nfunction mergeArrays(values, utils, meta) {\n const result = utils.mergeFunctions.mergeArrays(values, utils, meta);\n if (result === actions.defaultMerge ||\n (utils.useImplicitDefaultMerging &&\n result === undefined &&\n utils.mergeFunctions.mergeArrays !== utils.defaultMergeFunctions.mergeArrays)) {\n return utils.defaultMergeFunctions.mergeArrays(values);\n }\n return result;\n}\n/**\n * Merge sets.\n *\n * @param values - The sets.\n */\nfunction mergeSets(values, utils, meta) {\n const result = utils.mergeFunctions.mergeSets(values, utils, meta);\n if (result === actions.defaultMerge ||\n (utils.useImplicitDefaultMerging &&\n result === undefined &&\n utils.mergeFunctions.mergeSets !== utils.defaultMergeFunctions.mergeSets)) {\n return utils.defaultMergeFunctions.mergeSets(values);\n }\n return result;\n}\n/**\n * Merge maps.\n *\n * @param values - The maps.\n */\nfunction mergeMaps(values, utils, meta) {\n const result = utils.mergeFunctions.mergeMaps(values, utils, meta);\n if (result === actions.defaultMerge ||\n (utils.useImplicitDefaultMerging &&\n result === undefined &&\n utils.mergeFunctions.mergeMaps !== utils.defaultMergeFunctions.mergeMaps)) {\n return utils.defaultMergeFunctions.mergeMaps(values);\n }\n return result;\n}\n/**\n * Merge other things.\n *\n * @param values - The other things.\n */\nfunction mergeOthers(values, utils, meta) {\n const result = utils.mergeFunctions.mergeOthers(values, utils, meta);\n if (result === actions.defaultMerge ||\n (utils.useImplicitDefaultMerging &&\n result === undefined &&\n utils.mergeFunctions.mergeOthers !== utils.defaultMergeFunctions.mergeOthers)) {\n return utils.defaultMergeFunctions.mergeOthers(values);\n }\n return result;\n}\n\n/**\n * The default strategy to merge records into a target record.\n *\n * @param mut_target - The result will be mutated into this record\n * @param values - The records (including the target's value if there is one).\n */\nfunction mergeRecordsInto$1(mut_target, values, utils, meta) {\n for (const key of getKeys(values)) {\n const propValues = [];\n for (const value of values) {\n if (objectHasProperty(value, key)) {\n propValues.push(value[key]);\n }\n }\n if (propValues.length === 0) {\n continue;\n }\n const updatedMeta = utils.metaDataUpdater(meta, {\n key,\n parents: values,\n });\n const propertyTarget = { value: propValues[0] };\n mergeUnknownsInto(propertyTarget, propValues, utils, updatedMeta);\n if (key === \"__proto__\") {\n Object.defineProperty(mut_target.value, key, {\n value: propertyTarget.value,\n configurable: true,\n enumerable: true,\n writable: true,\n });\n }\n else {\n mut_target.value[key] = propertyTarget.value;\n }\n }\n}\n/**\n * The default strategy to merge arrays into a target array.\n *\n * @param mut_target - The result will be mutated into this array\n * @param values - The arrays (including the target's value if there is one).\n */\nfunction mergeArraysInto$1(mut_target, values) {\n mut_target.value.push(...values.slice(1).flat());\n}\n/**\n * The default strategy to merge sets into a target set.\n *\n * @param mut_target - The result will be mutated into this set\n * @param values - The sets (including the target's value if there is one).\n */\nfunction mergeSetsInto$1(mut_target, values) {\n for (const value of getIterableOfIterables(values.slice(1))) {\n mut_target.value.add(value);\n }\n}\n/**\n * The default strategy to merge maps into a target map.\n *\n * @param mut_target - The result will be mutated into this map\n * @param values - The maps (including the target's value if there is one).\n */\nfunction mergeMapsInto$1(mut_target, values) {\n for (const [key, value] of getIterableOfIterables(values.slice(1))) {\n mut_target.value.set(key, value);\n }\n}\n/**\n * Set the target to the last value.\n */\nfunction mergeOthersInto$1(mut_target, values) {\n mut_target.value = values.at(-1);\n}\n/**\n * The merge functions.\n */\nconst mergeIntoFunctions = {\n mergeRecords: mergeRecordsInto$1,\n mergeArrays: mergeArraysInto$1,\n mergeSets: mergeSetsInto$1,\n mergeMaps: mergeMapsInto$1,\n mergeOthers: mergeOthersInto$1,\n};\n\nfunction deepmergeInto(target, ...objects) {\n return void deepmergeIntoCustom({})(target, ...objects);\n}\nfunction deepmergeIntoCustom(options, rootMetaData) {\n const utils = getIntoUtils(options, customizedDeepmergeInto);\n /**\n * The customized deepmerge function.\n */\n function customizedDeepmergeInto(target, ...objects) {\n mergeUnknownsInto({ value: target }, [target, ...objects], utils, rootMetaData);\n }\n return customizedDeepmergeInto;\n}\n/**\n * The the utils that are available to the merge functions.\n *\n * @param options - The options the user specified\n */\nfunction getIntoUtils(options, customizedDeepmergeInto) {\n return {\n defaultMergeFunctions: mergeIntoFunctions,\n mergeFunctions: {\n ...mergeIntoFunctions,\n ...Object.fromEntries(Object.entries(options)\n .filter(([key, option]) => Object.hasOwn(mergeIntoFunctions, key))\n .map(([key, option]) => (option === false ? [key, mergeIntoFunctions.mergeOthers] : [key, option]))),\n },\n metaDataUpdater: (options.metaDataUpdater ?? defaultMetaDataUpdater),\n deepmergeInto: customizedDeepmergeInto,\n filterValues: options.filterValues === false ? undefined : (options.filterValues ?? defaultFilterValues),\n actions: actionsInto,\n };\n}\n/**\n * Merge unknown things into a target.\n *\n * @param mut_target - The target to merge into.\n * @param values - The values.\n */\nfunction mergeUnknownsInto(mut_target, values, utils, meta) {\n const filteredValues = utils.filterValues?.(values, meta) ?? values;\n if (filteredValues.length === 0) {\n return;\n }\n if (filteredValues.length === 1) {\n return void mergeOthersInto(mut_target, filteredValues, utils, meta);\n }\n const type = getObjectType(mut_target.value);\n if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {\n for (let mut_index = 1; mut_index < filteredValues.length; mut_index++) {\n if (getObjectType(filteredValues[mut_index]) === type) {\n continue;\n }\n return void mergeOthersInto(mut_target, filteredValues, utils, meta);\n }\n }\n switch (type) {\n case 1 /* ObjectType.RECORD */: {\n return void mergeRecordsInto(mut_target, filteredValues, utils, meta);\n }\n case 2 /* ObjectType.ARRAY */: {\n return void mergeArraysInto(mut_target, filteredValues, utils, meta);\n }\n case 3 /* ObjectType.SET */: {\n return void mergeSetsInto(mut_target, filteredValues, utils, meta);\n }\n case 4 /* ObjectType.MAP */: {\n return void mergeMapsInto(mut_target, filteredValues, utils, meta);\n }\n default: {\n return void mergeOthersInto(mut_target, filteredValues, utils, meta);\n }\n }\n}\n/**\n * Merge records into a target record.\n *\n * @param mut_target - The target to merge into.\n * @param values - The records.\n */\nfunction mergeRecordsInto(mut_target, values, utils, meta) {\n const action = utils.mergeFunctions.mergeRecords(mut_target, values, utils, meta);\n if (action === actionsInto.defaultMerge) {\n utils.defaultMergeFunctions.mergeRecords(mut_target, values, utils, meta);\n }\n}\n/**\n * Merge arrays into a target array.\n *\n * @param mut_target - The target to merge into.\n * @param values - The arrays.\n */\nfunction mergeArraysInto(mut_target, values, utils, meta) {\n const action = utils.mergeFunctions.mergeArrays(mut_target, values, utils, meta);\n if (action === actionsInto.defaultMerge) {\n utils.defaultMergeFunctions.mergeArrays(mut_target, values);\n }\n}\n/**\n * Merge sets into a target set.\n *\n * @param mut_target - The target to merge into.\n * @param values - The sets.\n */\nfunction mergeSetsInto(mut_target, values, utils, meta) {\n const action = utils.mergeFunctions.mergeSets(mut_target, values, utils, meta);\n if (action === actionsInto.defaultMerge) {\n utils.defaultMergeFunctions.mergeSets(mut_target, values);\n }\n}\n/**\n * Merge maps into a target map.\n *\n * @param mut_target - The target to merge into.\n * @param values - The maps.\n */\nfunction mergeMapsInto(mut_target, values, utils, meta) {\n const action = utils.mergeFunctions.mergeMaps(mut_target, values, utils, meta);\n if (action === actionsInto.defaultMerge) {\n utils.defaultMergeFunctions.mergeMaps(mut_target, values);\n }\n}\n/**\n * Merge other things into a target.\n *\n * @param mut_target - The target to merge into.\n * @param values - The other things.\n */\nfunction mergeOthersInto(mut_target, values, utils, meta) {\n const action = utils.mergeFunctions.mergeOthers(mut_target, values, utils, meta);\n if (action === actionsInto.defaultMerge || mut_target.value === actionsInto.defaultMerge) {\n utils.defaultMergeFunctions.mergeOthers(mut_target, values);\n }\n}\n\nexport { deepmerge, deepmergeCustom, deepmergeInto, deepmergeIntoCustom, getKeys, getObjectType, objectHasProperty };\n","/**\n * A Vite plugin that generates declaration files (*.d.ts) from .ts(x) or .vue source files when using Vite in library mode.\n * @module @nhtio/vite-plugins/dts\n *\n * @primaryExport\n */\n\nimport { deepmerge } from 'deepmerge-ts'\nimport { default as dtsPlugin } from 'vite-plugin-dts'\nimport type { Plugin } from 'vite'\nimport type { PluginOptions } from 'vite-plugin-dts'\n\n/**\n * Represents the structure of a package.json file with dependency mappings.\n * @interface\n */\nexport interface PackageJson {\n /**\n * Runtime dependencies of the package.\n */\n dependencies?: Record<string, string>\n /**\n * Development-only dependencies of the package.\n */\n devDependencies?: Record<string, string>\n}\n\n/**\n * Creates a Vite plugin for generating TypeScript declaration files with intelligent bundling.\n *\n * This function configures `vite-plugin-dts` with sensible defaults and automatically determines\n * which packages should be bundled into the generated declaration files. Packages listed in\n * `devDependencies` are considered for bundling unless they appear in the `external` array.\n *\n * @param packageJson - The package.json object containing dependency information\n * @param external - Array of module names that should remain external (not bundled)\n * @param options - Optional overrides for the plugin configuration\n * @returns A configured Vite plugin instance from `vite-plugin-dts`\n *\n * @example\n * ```typescript\n * import { dts } from '@nhtio/vite-plugins/dts'\n * import packageJson from './package.json'\n *\n * export default {\n * plugins: [\n * dts(packageJson, ['vue', 'vue-router'], {\n * strictOutput: false\n * })\n * ]\n * }\n * ```\n *\n * @see {@link https://www.npmjs.com/package/vite-plugin-dts | vite-plugin-dts} for more details on available options.\n */\nexport const dts = (\n packageJson: PackageJson,\n external: Array<string>,\n options?: Partial<PluginOptions>\n): Plugin => {\n const bundled = new Set<string>([])\n if (packageJson.devDependencies) {\n Object.keys(packageJson.devDependencies).forEach((dep) => {\n bundled.add(dep)\n })\n }\n external.forEach((mod) => {\n bundled.delete(mod)\n })\n const providedOpts: PluginOptions = {\n tsconfigPath: './tsconfig.build.json',\n staticImport: true,\n clearPureImport: true,\n copyDtsFiles: true,\n strictOutput: true,\n insertTypesEntry: true,\n rollupTypes: true,\n bundledPackages: Array.from(bundled),\n compilerOptions: {\n baseUrl: '.',\n },\n }\n const resolvedOptions: PluginOptions = deepmerge(providedOpts, options || {})\n return dtsPlugin(resolvedOptions)\n}\n"],"names":["ObjectType"],"mappings":";AAGA,MAAM,UAAU;AAAA,EACZ,cAAc,OAAO,6BAA6B;AAAA,EAClD,MAAM,OAAO,oBAAoB;AACrC;AAAA,CAIoB;AAAA,EAChB,cAAc,QAAQ;AAC1B;AAOA,SAAS,uBAAuB,cAAc,UAAU;AACpD,SAAO;AACX;AAMA,SAAS,oBAAoB,QAAQ,MAAM;AACvC,SAAO,OAAO,OAAO,CAAC,UAAU,UAAU,MAAS;AACvD;AAKA,IAAI;AAAA,CACH,SAAUA,aAAY;AACnB,EAAAA,YAAWA,YAAW,KAAK,IAAI,CAAC,IAAI;AACpC,EAAAA,YAAWA,YAAW,QAAQ,IAAI,CAAC,IAAI;AACvC,EAAAA,YAAWA,YAAW,OAAO,IAAI,CAAC,IAAI;AACtC,EAAAA,YAAWA,YAAW,KAAK,IAAI,CAAC,IAAI;AACpC,EAAAA,YAAWA,YAAW,KAAK,IAAI,CAAC,IAAI;AACpC,EAAAA,YAAWA,YAAW,OAAO,IAA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AAc;AAAA,IACd,cAAc;AAAA,IACd,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,iBAAiB,MAAM,KAAK,OAAO;AAAA,IACnC,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEF,QAAM,kBAAiC,UAAU,cAAc,WAAW,CAAA,CAAE;AAC5E,SAAO,UAAU,eAAe;AAClC;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"dts.mjs","sources":["../src/dts.ts"],"sourcesContent":["/**\n * A Vite plugin that generates declaration files (*.d.ts) from .ts(x) or .vue source files when using Vite in library mode.\n * @module @nhtio/vite-plugins/dts\n *\n * @primaryExport\n */\n\nimport { deepmerge } from 'deepmerge-ts'\nimport { default as dtsPlugin } from 'vite-plugin-dts'\nimport type { Plugin } from 'vite'\nimport type { PluginOptions } from 'vite-plugin-dts'\n\n/**\n * Represents the structure of a package.json file with dependency mappings.\n * @interface\n */\nexport interface PackageJson {\n /**\n * Runtime dependencies of the package.\n */\n dependencies?: Record<string, string>\n /**\n * Development-only dependencies of the package.\n */\n devDependencies?: Record<string, string>\n}\n\n/**\n * Creates a Vite plugin for generating TypeScript declaration files with intelligent bundling.\n *\n * This function configures `vite-plugin-dts` with sensible defaults and automatically determines\n * which packages should be bundled into the generated declaration files. Packages listed in\n * `devDependencies` are considered for bundling unless they appear in the `external` array.\n *\n * @param packageJson - The package.json object containing dependency information\n * @param external - Array of module names that should remain external (not bundled)\n * @param options - Optional overrides for the plugin configuration\n * @returns A configured Vite plugin instance from `vite-plugin-dts`\n *\n * @example\n * ```typescript\n * import { dts } from '@nhtio/vite-plugins/dts'\n * import packageJson from './package.json'\n *\n * export default {\n * plugins: [\n * dts(packageJson, ['vue', 'vue-router'], {\n * strictOutput: false\n * })\n * ]\n * }\n * ```\n *\n * @see {@link https://www.npmjs.com/package/vite-plugin-dts | vite-plugin-dts} for more details on available options.\n */\nexport const dts = (\n packageJson: PackageJson,\n external: Array<string | RegExp>,\n options?: Partial<PluginOptions>\n): Plugin => {\n const bundled = new Set<string>([])\n if (packageJson.devDependencies) {\n Object.keys(packageJson.devDependencies).forEach((dep) => {\n bundled.add(dep)\n })\n }\n external.forEach((mod) => {\n if ('string' === typeof mod) {\n bundled.delete(mod)\n } else if (mod instanceof RegExp) {\n Array.from(bundled).forEach((dep) => {\n if (mod.test(dep)) {\n bundled.delete(dep)\n }\n })\n }\n })\n const providedOpts: PluginOptions = {\n tsconfigPath: './tsconfig.build.json',\n staticImport: true,\n clearPureImport: true,\n copyDtsFiles: true,\n strictOutput: true,\n insertTypesEntry: true,\n rollupTypes: true,\n bundledPackages: Array.from(bundled),\n compilerOptions: {\n baseUrl: '.',\n },\n }\n const resolvedOptions: PluginOptions = deepmerge(providedOpts, options || {})\n return dtsPlugin(resolvedOptions)\n}\n"],"names":[],"mappings":";;AAuDO,MAAM,MAAM,CACjB,aACA,UACA,YACW;AACX,QAAM,UAAU,oBAAI,IAAY,EAAE;AAClC,MAAI,YAAY,iBAAiB;AAC/B,WAAO,KAAK,YAAY,eAAe,EAAE,QAAQ,CAAC,QAAQ;AACxD,cAAQ,IAAI,GAAG;AAAA,IACjB,CAAC;AAAA,EACH;AACA,WAAS,QAAQ,CAAC,QAAQ;AACxB,QAAI,aAAa,OAAO,KAAK;AAC3B,cAAQ,OAAO,GAAG;AAAA,IACpB,WAAW,eAAe,QAAQ;AAChC,YAAM,KAAK,OAAO,EAAE,QAAQ,CAAC,QAAQ;AACnC,YAAI,IAAI,KAAK,GAAG,GAAG;AACjB,kBAAQ,OAAO,GAAG;AAAA,QACpB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACD,QAAM,eAA8B;AAAA,IAClC,cAAc;AAAA,IACd,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,cAAc;AAAA,IACd,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,iBAAiB,MAAM,KAAK,OAAO;AAAA,IACnC,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEF,QAAM,kBAAiC,UAAU,cAAc,WAAW,CAAA,CAAE;AAC5E,SAAO,UAAU,eAAe;AAClC;"}
@@ -0,0 +1,138 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * Advanced Vite plugin that generates TypeScript declaration files for library builds with intelligent
5
+ * vendor dependency bundling and path alias resolution.
6
+ *
7
+ * ## Key Differences from `@nhtio/vite-plugins/dts`
8
+ *
9
+ * While the standard `dts` plugin runs the entire pipeline through Microsoft API Extractor,
10
+ * `dtsComplex` uses a hybrid approach:
11
+ *
12
+ * 1. **Native TypeScript Compilation**: Your source files are compiled to `.d.ts` using TypeScript's
13
+ * native compiler, preserving original structure and comments.
14
+ *
15
+ * 2. **Selective API Extractor Usage**: API Extractor is only used to bundle external vendor libraries
16
+ * into single declaration files, not for your entire codebase.
17
+ *
18
+ * 3. **Separate Vendor Bundles**: External dependencies are bundled into separate files
19
+ * (e.g., `bundled_vendor_name.d.ts`) and referenced from your main declarations, rather than
20
+ * being inlined.
21
+ *
22
+ * 4. **Path Alias Resolution**: All import/export paths are resolved to relative paths, eliminating
23
+ * the need for consumers to configure `paths` in their `tsconfig.json`.
24
+ *
25
+ * ## Pre-Rolled vs Bundled Dependencies
26
+ *
27
+ * - **Bundled Dependencies**: Libraries that need to be rolled up using API Extractor because their
28
+ * declaration files are spread across multiple files.
29
+ *
30
+ * - **Pre-Rolled Dependencies**: Libraries that already provide a single rolled-up declaration file
31
+ * (or single declaration per subpath). These are extracted as-is without further processing.
32
+ *
33
+ * @example
34
+ * Basic usage with bundled dependencies:
35
+ * ```typescript
36
+ * import { defineConfig } from 'vite'
37
+ * import { dtsComplex } from '@nhtio/vite-plugins/dts_complex'
38
+ *
39
+ * export default defineConfig({
40
+ * build: {
41
+ * lib: {
42
+ * entry: './src/index.ts',
43
+ * name: 'MyLibrary'
44
+ * }
45
+ * },
46
+ * plugins: [
47
+ * dtsComplex({
48
+ * bundledDependencies: ['lodash-es', 'date-fns']
49
+ * })
50
+ * ]
51
+ * })
52
+ * ```
53
+ *
54
+ * @example
55
+ * Advanced usage with pre-rolled dependencies:
56
+ * ```typescript
57
+ * import { defineConfig } from 'vite'
58
+ * import { dtsComplex } from '@nhtio/vite-plugins/dts_complex'
59
+ *
60
+ * export default defineConfig({
61
+ * build: {
62
+ * lib: {
63
+ * entry: {
64
+ * index: './src/index.ts',
65
+ * utils: './src/utils/index.ts'
66
+ * },
67
+ * name: 'MyLibrary'
68
+ * }
69
+ * },
70
+ * plugins: [
71
+ * dtsComplex({
72
+ * // Dependencies that need rollup
73
+ * bundledDependencies: ['lodash-es'],
74
+ * // Dependencies with pre-existing single declaration files
75
+ * preRolledDependencies: ['@nhtio/encoder'],
76
+ * // Custom paths
77
+ * tsConfigJsonPath: './tsconfig.build.json',
78
+ * packageJsonPath: './package.json'
79
+ * })
80
+ * ]
81
+ * })
82
+ * ```
83
+ *
84
+ * @example
85
+ * With regex patterns for scoped packages:
86
+ * ```typescript
87
+ * dtsComplex({
88
+ * bundledDependencies: [
89
+ * /^@mycompany\//, // All @mycompany/* packages
90
+ * 'specific-lib'
91
+ * ],
92
+ * preRolledDependencies: [
93
+ * /^@types\// // All @types/* packages (usually pre-rolled)
94
+ * ]
95
+ * })
96
+ * ```
97
+ */
98
+ export declare const dtsComplex: (options?: Options | undefined) => Plugin<any> | Plugin<any>[];
99
+
100
+ /**
101
+ * Options for the dts_complex Vite plugin.
102
+ */
103
+ export declare interface Options {
104
+ /**
105
+ * The path to the package.json file.
106
+ * Can be an absolute path or a path relative to the project root.
107
+ */
108
+ packageJsonPath?: string;
109
+ /**
110
+ * The path to the tsconfig.json file to use for generating declaration files. Defaults to the project's root tsconfig.json.
111
+ * Can be an absolute path or a path relative to the project root.
112
+ */
113
+ tsConfigJsonPath?: string;
114
+ /**
115
+ * The path to the node_modules directory. Defaults to the project's root node_modules directory.
116
+ * Can be an absolute path or a path relative to the project root.
117
+ */
118
+ nodeModulesPath?: string;
119
+ /**
120
+ * An array of package names or regular expressions representing dependencies that should be bundled into the generated declaration files.
121
+ */
122
+ bundledDependencies?: Array<string | RegExp>;
123
+ /**
124
+ * 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.
125
+ * If the dependency is not already included in `bundledDependencies`, it will be treated as if it were.
126
+ */
127
+ preRolledDependencies?: Array<string | RegExp>;
128
+ /**
129
+ * Activate additional debug output information
130
+ */
131
+ debug?: boolean;
132
+ /**
133
+ * Trace Typescript Resolution
134
+ */
135
+ traceResolution?: boolean;
136
+ }
137
+
138
+ export { }
@@ -0,0 +1,5 @@
1
+ import { d } from "./index-DFu5x9xC.mjs";
2
+ export {
3
+ d as dtsComplex
4
+ };
5
+ //# sourceMappingURL=dts_complex.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dts_complex.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}