@stati/core 1.3.0 â 1.3.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/core/dev.d.ts.map +1 -1
- package/dist/core/dev.js +27 -18
- package/package.json +1 -1
package/dist/core/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/core/dev.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,aAAa,CAAC;AAMvD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/core/dev.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,aAAa,CAAC;AAMvD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,CAoaxF"}
|
package/dist/core/dev.js
CHANGED
|
@@ -71,17 +71,30 @@ export async function createDevServer(options = {}) {
|
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
isBuilding = true;
|
|
74
|
+
const startTime = Date.now();
|
|
75
|
+
// Create a quiet logger for dev builds that suppresses verbose output
|
|
76
|
+
const devLogger = {
|
|
77
|
+
info: () => { }, // Suppress info messages
|
|
78
|
+
success: () => { }, // Suppress success messages
|
|
79
|
+
error: logger.error || (() => { }),
|
|
80
|
+
warning: logger.warning || (() => { }),
|
|
81
|
+
building: () => { }, // Suppress building messages
|
|
82
|
+
processing: () => { }, // Suppress processing messages
|
|
83
|
+
stats: () => { }, // Suppress stats messages
|
|
84
|
+
};
|
|
74
85
|
try {
|
|
86
|
+
const relativePath = changedPath
|
|
87
|
+
.replace(process.cwd(), '')
|
|
88
|
+
.replace(/\\/g, '/')
|
|
89
|
+
.replace(/^\//, '');
|
|
75
90
|
// Check if the changed file is a template/partial
|
|
76
91
|
if (changedPath.endsWith('.eta') || changedPath.includes('_partials')) {
|
|
77
|
-
|
|
78
|
-
await handleTemplateChange(changedPath);
|
|
92
|
+
await handleTemplateChange(changedPath, devLogger);
|
|
79
93
|
}
|
|
80
94
|
else {
|
|
81
95
|
// Content or static file changed - use normal rebuild
|
|
82
|
-
logger.info?.(`đ Content changed: ${changedPath}`);
|
|
83
96
|
await build({
|
|
84
|
-
logger,
|
|
97
|
+
logger: devLogger,
|
|
85
98
|
force: false,
|
|
86
99
|
clean: false,
|
|
87
100
|
...(configPath && { configPath }),
|
|
@@ -97,10 +110,12 @@ export async function createDevServer(options = {}) {
|
|
|
97
110
|
}
|
|
98
111
|
});
|
|
99
112
|
}
|
|
100
|
-
|
|
113
|
+
const duration = Date.now() - startTime;
|
|
114
|
+
logger.info?.(`⥠${relativePath} rebuilt in ${duration}ms`);
|
|
101
115
|
}
|
|
102
116
|
catch (error) {
|
|
103
|
-
|
|
117
|
+
const duration = Date.now() - startTime;
|
|
118
|
+
logger.error?.(`â Rebuild failed after ${duration}ms: ${error instanceof Error ? error.message : String(error)}`);
|
|
104
119
|
}
|
|
105
120
|
finally {
|
|
106
121
|
isBuilding = false;
|
|
@@ -109,16 +124,16 @@ export async function createDevServer(options = {}) {
|
|
|
109
124
|
/**
|
|
110
125
|
* Handles template/partial file changes by invalidating affected pages
|
|
111
126
|
*/
|
|
112
|
-
async function handleTemplateChange(templatePath) {
|
|
127
|
+
async function handleTemplateChange(templatePath, buildLogger) {
|
|
113
128
|
const cacheDir = join(process.cwd(), '.stati');
|
|
129
|
+
const effectiveLogger = buildLogger || logger;
|
|
114
130
|
try {
|
|
115
131
|
// Load existing cache manifest
|
|
116
132
|
let cacheManifest = await loadCacheManifest(cacheDir);
|
|
117
133
|
if (!cacheManifest) {
|
|
118
134
|
// No cache exists, perform full rebuild
|
|
119
|
-
logger.info?.('No cache found, performing full rebuild...');
|
|
120
135
|
await build({
|
|
121
|
-
logger,
|
|
136
|
+
logger: effectiveLogger,
|
|
122
137
|
force: false,
|
|
123
138
|
clean: false,
|
|
124
139
|
...(configPath && { configPath }),
|
|
@@ -135,27 +150,21 @@ export async function createDevServer(options = {}) {
|
|
|
135
150
|
}
|
|
136
151
|
}
|
|
137
152
|
if (affectedPages.length > 0) {
|
|
138
|
-
logger.info?.(`đ¯ Invalidating ${affectedPages.length} affected pages:`);
|
|
139
|
-
affectedPages.forEach((page) => logger.info?.(` đ ${page}`));
|
|
140
153
|
// Save updated cache manifest
|
|
141
154
|
await saveCacheManifest(cacheDir, cacheManifest);
|
|
142
155
|
// Perform incremental rebuild (only affected pages will be rebuilt)
|
|
143
156
|
await build({
|
|
144
|
-
logger,
|
|
157
|
+
logger: effectiveLogger,
|
|
145
158
|
force: false,
|
|
146
159
|
clean: false,
|
|
147
160
|
...(configPath && { configPath }),
|
|
148
161
|
});
|
|
149
162
|
}
|
|
150
|
-
else {
|
|
151
|
-
logger.info?.('âšī¸ No pages affected by template change');
|
|
152
|
-
}
|
|
153
163
|
}
|
|
154
|
-
catch
|
|
155
|
-
logger.warning?.(`Template dependency analysis failed, performing full rebuild: ${error instanceof Error ? error.message : String(error)}`);
|
|
164
|
+
catch {
|
|
156
165
|
// Fallback to full rebuild
|
|
157
166
|
await build({
|
|
158
|
-
logger,
|
|
167
|
+
logger: effectiveLogger,
|
|
159
168
|
force: false,
|
|
160
169
|
clean: false,
|
|
161
170
|
...(configPath && { configPath }),
|