@dominikcz/greg 0.9.33 → 0.9.34
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/package.json
CHANGED
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
import path from 'node:path';
|
|
29
29
|
import { fileURLToPath } from 'node:url';
|
|
30
30
|
import { loadGregConfig, resolveGregConfigPaths } from './loadGregConfig.js';
|
|
31
|
+
import {
|
|
32
|
+
DEFAULT_OUTPUT_BASE_DIR,
|
|
33
|
+
DEFAULT_SITE_BASE,
|
|
34
|
+
normalizeBasePath,
|
|
35
|
+
} from './versioningDefaults.js';
|
|
31
36
|
|
|
32
37
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
33
38
|
/** Absolute path to greg's own components directory (inside the package). */
|
|
@@ -47,8 +52,8 @@ export function vitePluginGregConfig() {
|
|
|
47
52
|
return {
|
|
48
53
|
name: 'greg:config',
|
|
49
54
|
|
|
50
|
-
config() {
|
|
51
|
-
|
|
55
|
+
async config() {
|
|
56
|
+
const viteConfig = {
|
|
52
57
|
resolve: {
|
|
53
58
|
alias: {
|
|
54
59
|
'$components': GREG_COMPONENTS_DIR,
|
|
@@ -71,6 +76,23 @@ export function vitePluginGregConfig() {
|
|
|
71
76
|
],
|
|
72
77
|
},
|
|
73
78
|
};
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
const resolved = await loadGregConfig(root);
|
|
82
|
+
const hasBase = Object.prototype.hasOwnProperty.call(resolved, 'base');
|
|
83
|
+
const hasOutDir = Object.prototype.hasOwnProperty.call(resolved, 'outDir');
|
|
84
|
+
if (hasBase) {
|
|
85
|
+
viteConfig.base = normalizeBasePath(resolved.base, DEFAULT_SITE_BASE);
|
|
86
|
+
}
|
|
87
|
+
if (hasOutDir) {
|
|
88
|
+
const outDir = String(resolved.outDir || DEFAULT_OUTPUT_BASE_DIR).trim() || DEFAULT_OUTPUT_BASE_DIR;
|
|
89
|
+
viteConfig.build = { outDir };
|
|
90
|
+
}
|
|
91
|
+
} catch {
|
|
92
|
+
// Ignore config parse issues here; runtime virtual module load will report details.
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return viteConfig;
|
|
74
96
|
},
|
|
75
97
|
|
|
76
98
|
configResolved(config) {
|