vite-plugin-lib 2.1.6 → 2.2.1
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/README.md +2 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8 -6
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -46,7 +46,8 @@ export default defineConfig({
|
|
|
46
46
|
formats: ['es'], // optional, default is ['es']
|
|
47
47
|
name: 'YourGlobalUMDName', // optional if format does not include 'umd' or 'iife'
|
|
48
48
|
external: ['some-package'], // optional, default is all node_modules and builtin modules
|
|
49
|
-
manifest: 'package.json', // relative path to package.json, default is package.json
|
|
49
|
+
manifest: 'package.json', // relative path to package.json, default is package.json,
|
|
50
|
+
tsconfig: 'tsconfig.json', // relative path to tsconfig.json, default is tsconfig.json
|
|
50
51
|
}),
|
|
51
52
|
],
|
|
52
53
|
})
|
package/dist/index.d.mts
CHANGED
|
@@ -20,6 +20,8 @@ interface Options {
|
|
|
20
20
|
verbose?: boolean;
|
|
21
21
|
/** Remove any temporary build files. Defaults to `true`. */
|
|
22
22
|
cleanup?: boolean;
|
|
23
|
+
/** Path to the tsconfig file (relative to the project root). Defaults to `./tsconfig.json` */
|
|
24
|
+
tsconfig: string;
|
|
23
25
|
}
|
|
24
26
|
declare function tsconfigPaths(options?: Partial<Options>): Plugin;
|
|
25
27
|
declare function library(options?: Partial<Options>): Plugin[];
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ interface Options {
|
|
|
20
20
|
verbose?: boolean;
|
|
21
21
|
/** Remove any temporary build files. Defaults to `true`. */
|
|
22
22
|
cleanup?: boolean;
|
|
23
|
+
/** Path to the tsconfig file (relative to the project root). Defaults to `./tsconfig.json` */
|
|
24
|
+
tsconfig: string;
|
|
23
25
|
}
|
|
24
26
|
declare function tsconfigPaths(options?: Partial<Options>): Plugin;
|
|
25
27
|
declare function library(options?: Partial<Options>): Plugin[];
|
package/dist/index.mjs
CHANGED
|
@@ -108,7 +108,8 @@ const defaults = {
|
|
|
108
108
|
entry: "src/index.ts",
|
|
109
109
|
formats: ["es"],
|
|
110
110
|
manifest: "package.json",
|
|
111
|
-
cleanup: true
|
|
111
|
+
cleanup: true,
|
|
112
|
+
tsconfig: "./tsconfig.json"
|
|
112
113
|
};
|
|
113
114
|
function mergeWithDefaults(options) {
|
|
114
115
|
return {
|
|
@@ -117,15 +118,15 @@ function mergeWithDefaults(options) {
|
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
function tsconfigPaths(options = {}) {
|
|
120
|
-
const { verbose } = mergeWithDefaults(options);
|
|
121
|
+
const { verbose, tsconfig } = mergeWithDefaults(options);
|
|
121
122
|
return {
|
|
122
123
|
name: "vite-plugin-lib:alias",
|
|
123
124
|
enforce: "pre",
|
|
124
125
|
config: async (config) => {
|
|
125
|
-
const tsconfigPath = path.resolve(config.root ?? ".",
|
|
126
|
+
const tsconfigPath = path.resolve(config.root ?? ".", tsconfig);
|
|
126
127
|
const { baseUrl, paths } = await readConfig(tsconfigPath);
|
|
127
128
|
if (!baseUrl || !paths) {
|
|
128
|
-
log(
|
|
129
|
+
log(`No paths found in ${tsconfig}.`);
|
|
129
130
|
return config;
|
|
130
131
|
}
|
|
131
132
|
const pathToAlias = pathToAliasFactory(tsconfigPath, baseUrl, verbose);
|
|
@@ -265,7 +266,7 @@ function formatToFileName(entry, format) {
|
|
|
265
266
|
function library(options = {}) {
|
|
266
267
|
const mergedOptions = mergeWithDefaults(options);
|
|
267
268
|
const plugins = [
|
|
268
|
-
tsconfigPaths(),
|
|
269
|
+
tsconfigPaths(mergedOptions),
|
|
269
270
|
buildConfig(mergedOptions),
|
|
270
271
|
dts__default({
|
|
271
272
|
cleanVueFileName: true,
|
|
@@ -273,6 +274,7 @@ function library(options = {}) {
|
|
|
273
274
|
include: `${path.resolve(mergedOptions.entry, "..")}/**`,
|
|
274
275
|
outDir: typesDir,
|
|
275
276
|
staticImport: true,
|
|
277
|
+
tsconfigPath: mergedOptions.tsconfig,
|
|
276
278
|
afterBuild: async () => {
|
|
277
279
|
if (includesESFormat(mergedOptions.formats)) {
|
|
278
280
|
await generateMTSDeclarations(
|
|
@@ -313,7 +315,7 @@ async function readConfig(configPath) {
|
|
|
313
315
|
return options;
|
|
314
316
|
} catch (error) {
|
|
315
317
|
const message = getErrorMessage(error);
|
|
316
|
-
logError(`Could not read
|
|
318
|
+
logError(`Could not read ${configPath}: ${message}`);
|
|
317
319
|
throw error;
|
|
318
320
|
}
|
|
319
321
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"description": "Vite plugin for build configuration, automatic aliases, and type declarations.",
|
|
6
6
|
"author": "Jan Müller <janmueller3698@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"picocolors": "1.1.1",
|
|
43
|
-
"vite-plugin-dts": "4.5.
|
|
43
|
+
"vite-plugin-dts": "4.5.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "22.
|
|
47
|
-
"typescript": "5.
|
|
48
|
-
"unbuild": "3.
|
|
49
|
-
"vite": "6.
|
|
50
|
-
"@yeger/tsconfig": "2.0
|
|
46
|
+
"@types/node": "22.14.1",
|
|
47
|
+
"typescript": "5.8.3",
|
|
48
|
+
"unbuild": "3.5.0",
|
|
49
|
+
"vite": "6.2.6",
|
|
50
|
+
"@yeger/tsconfig": "2.1.0"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|