@codefluss/vite-config-lib 0.0.1-alpha.3 → 0.0.2-alpha.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/dist/vite.config.base.cjs +7 -11
- package/dist/vite.config.base.js +8 -12
- package/package.json +7 -6
|
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(vite_config_base_exports);
|
|
|
36
36
|
var import_plugin_react = __toESM(require("@vitejs/plugin-react"), 1);
|
|
37
37
|
var import_vite_plugin_dts = __toESM(require("vite-plugin-dts"), 1);
|
|
38
38
|
var import_path = require("path");
|
|
39
|
+
var dts = typeof import_vite_plugin_dts.default === "function" ? import_vite_plugin_dts.default : import_vite_plugin_dts.default.default;
|
|
39
40
|
function createLibraryConfig(options) {
|
|
40
41
|
const {
|
|
41
42
|
libraryName,
|
|
@@ -49,11 +50,7 @@ function createLibraryConfig(options) {
|
|
|
49
50
|
plugins = [],
|
|
50
51
|
viteConfigOverrides = {}
|
|
51
52
|
} = options;
|
|
52
|
-
const standardExternals = [
|
|
53
|
-
"react",
|
|
54
|
-
"react-dom",
|
|
55
|
-
"react/jsx-runtime"
|
|
56
|
-
];
|
|
53
|
+
const standardExternals = ["react", "react-dom", "react/jsx-runtime"];
|
|
57
54
|
const allExternals = [.../* @__PURE__ */ new Set([...standardExternals, ...external])];
|
|
58
55
|
const standardGlobals = {
|
|
59
56
|
react: "React",
|
|
@@ -67,11 +64,7 @@ function createLibraryConfig(options) {
|
|
|
67
64
|
skipDiagnostics: dtsConfig.skipDiagnostics ?? false
|
|
68
65
|
};
|
|
69
66
|
const config = {
|
|
70
|
-
plugins: [
|
|
71
|
-
(0, import_plugin_react.default)(),
|
|
72
|
-
(0, import_vite_plugin_dts.default)(dtsPluginConfig),
|
|
73
|
-
...plugins
|
|
74
|
-
],
|
|
67
|
+
plugins: [(0, import_plugin_react.default)(), dts(dtsPluginConfig), ...plugins],
|
|
75
68
|
build: {
|
|
76
69
|
lib: {
|
|
77
70
|
entry: (0, import_path.resolve)(process.cwd(), entry),
|
|
@@ -100,7 +93,10 @@ function createLibraryConfig(options) {
|
|
|
100
93
|
return {
|
|
101
94
|
...config,
|
|
102
95
|
...viteConfigOverrides,
|
|
103
|
-
plugins: [
|
|
96
|
+
plugins: [
|
|
97
|
+
...config.plugins ?? [],
|
|
98
|
+
...viteConfigOverrides.plugins ?? []
|
|
99
|
+
],
|
|
104
100
|
build: {
|
|
105
101
|
...config.build,
|
|
106
102
|
...viteConfigOverrides.build,
|
package/dist/vite.config.base.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// vite.config.base.ts
|
|
2
2
|
import react from "@vitejs/plugin-react";
|
|
3
|
-
import
|
|
3
|
+
import dtsPlugin from "vite-plugin-dts";
|
|
4
4
|
import { resolve } from "path";
|
|
5
|
+
var dts = typeof dtsPlugin === "function" ? dtsPlugin : dtsPlugin.default;
|
|
5
6
|
function createLibraryConfig(options) {
|
|
6
7
|
const {
|
|
7
8
|
libraryName,
|
|
@@ -15,11 +16,7 @@ function createLibraryConfig(options) {
|
|
|
15
16
|
plugins = [],
|
|
16
17
|
viteConfigOverrides = {}
|
|
17
18
|
} = options;
|
|
18
|
-
const standardExternals = [
|
|
19
|
-
"react",
|
|
20
|
-
"react-dom",
|
|
21
|
-
"react/jsx-runtime"
|
|
22
|
-
];
|
|
19
|
+
const standardExternals = ["react", "react-dom", "react/jsx-runtime"];
|
|
23
20
|
const allExternals = [.../* @__PURE__ */ new Set([...standardExternals, ...external])];
|
|
24
21
|
const standardGlobals = {
|
|
25
22
|
react: "React",
|
|
@@ -33,11 +30,7 @@ function createLibraryConfig(options) {
|
|
|
33
30
|
skipDiagnostics: dtsConfig.skipDiagnostics ?? false
|
|
34
31
|
};
|
|
35
32
|
const config = {
|
|
36
|
-
plugins: [
|
|
37
|
-
react(),
|
|
38
|
-
dts(dtsPluginConfig),
|
|
39
|
-
...plugins
|
|
40
|
-
],
|
|
33
|
+
plugins: [react(), dts(dtsPluginConfig), ...plugins],
|
|
41
34
|
build: {
|
|
42
35
|
lib: {
|
|
43
36
|
entry: resolve(process.cwd(), entry),
|
|
@@ -66,7 +59,10 @@ function createLibraryConfig(options) {
|
|
|
66
59
|
return {
|
|
67
60
|
...config,
|
|
68
61
|
...viteConfigOverrides,
|
|
69
|
-
plugins: [
|
|
62
|
+
plugins: [
|
|
63
|
+
...config.plugins ?? [],
|
|
64
|
+
...viteConfigOverrides.plugins ?? []
|
|
65
|
+
],
|
|
70
66
|
build: {
|
|
71
67
|
...config.build,
|
|
72
68
|
...viteConfigOverrides.build,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefluss/vite-config-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared Vite configuration for library builds",
|
|
6
6
|
"main": "./dist/vite.config.base.cjs",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup vite.config.base.ts --format esm,cjs --dts --clean",
|
|
21
|
+
"clean": "rm -rf dist",
|
|
22
|
+
"prepublishOnly": "pnpm build"
|
|
23
|
+
},
|
|
19
24
|
"dependencies": {
|
|
20
25
|
"@vitejs/plugin-react": "^5.1.2",
|
|
21
26
|
"vite": "^7.2.7",
|
|
@@ -36,9 +41,5 @@
|
|
|
36
41
|
"license": "MIT",
|
|
37
42
|
"publishConfig": {
|
|
38
43
|
"access": "public"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "tsup vite.config.base.ts --format esm,cjs --dts --clean",
|
|
42
|
-
"clean": "rm -rf dist"
|
|
43
44
|
}
|
|
44
|
-
}
|
|
45
|
+
}
|