@vezham/config 26.0.0-alpha.6 → 26.0.0-alpha.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/integrations/vite-lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/integrations/vite-lib/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAc,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAgC9D,eAAO,MAAM,YAAY,GAAI,YAAW,mBAAwB,uCAqD5D,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineConfig as defineConfig$2 } from "./base.js";
|
|
2
|
-
import { cpSync, existsSync, globSync, readFileSync } from "node:fs";
|
|
2
|
+
import { cpSync, existsSync, globSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { mergeConfig } from "vite";
|
|
5
5
|
//#region src/lib/integrations/vite-lib/index.ts
|
|
@@ -14,17 +14,25 @@ var getPackageEntries = (projectRoot) => {
|
|
|
14
14
|
var defineConfig = (overrides = {}) => defineConfig$2(async (env) => {
|
|
15
15
|
const config = typeof overrides === "function" ? await overrides(env) : overrides;
|
|
16
16
|
const root = path.resolve(config.root ?? process.cwd());
|
|
17
|
+
const entries = getPackageEntries(root);
|
|
18
|
+
const outDir = path.resolve(root, config.build?.outDir ?? "dist");
|
|
17
19
|
return mergeConfig({
|
|
18
20
|
plugins: [{
|
|
19
21
|
name: "vezham:package-assets",
|
|
20
22
|
closeBundle() {
|
|
21
|
-
for (const file of globSync("src/**/*.{html,css}", { cwd: root }))
|
|
23
|
+
for (const file of globSync("src/**/*.{html,css}", { cwd: root })) {
|
|
24
|
+
const source = path.join(root, file);
|
|
25
|
+
const target = path.join(outDir, file.replace(/^src\//, ""));
|
|
26
|
+
if (file.endsWith(".css") && existsSync(target)) writeFileSync(target, `${readFileSync(source, "utf8")}\n${readFileSync(target, "utf8")}`);
|
|
27
|
+
else cpSync(source, target, { recursive: true });
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
}],
|
|
24
31
|
build: {
|
|
25
32
|
minify: false,
|
|
26
33
|
lib: {
|
|
27
|
-
entry:
|
|
34
|
+
entry: entries,
|
|
35
|
+
cssFileName: "index",
|
|
28
36
|
fileName: (_format, name) => `${name}.js`
|
|
29
37
|
},
|
|
30
38
|
rolldownOptions: {
|