@xuda.io/drive_module 1.1.1491 → 1.1.1493
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/index.mjs +17 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2660,21 +2660,35 @@ export default {
|
|
|
2660
2660
|
dependencies: devDependencies,
|
|
2661
2661
|
},
|
|
2662
2662
|
};
|
|
2663
|
-
|
|
2663
|
+
// return_result: caller owns persistence (e.g. save_prog's strict insert) —
|
|
2664
|
+
// return the build result instead of self-saving. job_id keeps the original
|
|
2665
|
+
// studio-save contract.
|
|
2666
|
+
if (job_id || req.return_result) {
|
|
2664
2667
|
return vite_build_res;
|
|
2665
2668
|
}
|
|
2666
2669
|
|
|
2667
2670
|
doc.vite_build_res = vite_build_res;
|
|
2668
2671
|
doc.scriptData.dependencies = devDependencies;
|
|
2672
|
+
// build_error parity with the (former) blocking client flow: a clean build
|
|
2673
|
+
// clears any stale error so the editor stops flagging the doc.
|
|
2674
|
+
delete doc.build_error;
|
|
2669
2675
|
|
|
2670
2676
|
db_module.save_app_couch_doc(app_id, doc);
|
|
2671
2677
|
} catch (err) {
|
|
2678
|
+
// src_hash on the FAILURE result too — the changes-watcher compares it to
|
|
2679
|
+
// decide "source changed since last build"; without it a failing script
|
|
2680
|
+
// recompiled on every self-save, forever.
|
|
2672
2681
|
doc.vite_build_res = {
|
|
2673
2682
|
code: -1,
|
|
2683
|
+
src_hash: js_src_hash(doc.scriptData?.value || ''),
|
|
2674
2684
|
data: err.message,
|
|
2675
2685
|
};
|
|
2676
|
-
|
|
2677
|
-
|
|
2686
|
+
// Stamp build_error on the doc itself (same contract as save_prog): the
|
|
2687
|
+
// studio save flow no longer blocks on the build, so editors learn of
|
|
2688
|
+
// failures from this self-saved rev replicating back.
|
|
2689
|
+
doc.build_error = { message: err?.message || 'Compilation error', ts: Date.now() };
|
|
2690
|
+
console.error(doc._id, 'js compile failed:', String(err.message).slice(0, 300));
|
|
2691
|
+
if (job_id || req.return_result) {
|
|
2678
2692
|
return doc.vite_build_res;
|
|
2679
2693
|
}
|
|
2680
2694
|
db_module.save_app_couch_doc(app_id, doc);
|