@skgo/sveltekit-adapter 0.28.2 → 0.31.0
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 +1 -1
- package/skgo-adapter/env.js +8 -4
package/package.json
CHANGED
package/skgo-adapter/env.js
CHANGED
|
@@ -1014,8 +1014,8 @@ export function gojaDevEnvironment({ outDir = '.svelte-kit' } = {}) {
|
|
|
1014
1014
|
* way. Kit's own dev server has no answer to it: vite turns each report into a
|
|
1015
1015
|
* hot update or a full page reload, and a reload throws away what a visitor
|
|
1016
1016
|
* had typed and aborts the documents Go was rendering for them. So the dev
|
|
1017
|
-
* server
|
|
1018
|
-
*
|
|
1017
|
+
* server initializes its baseline from the first load, then advances it when
|
|
1018
|
+
* the watcher reports a change, and lets through reports whose content differs.
|
|
1019
1019
|
*
|
|
1020
1020
|
* Content means the file's bytes, not the text vite decoded from them: two
|
|
1021
1021
|
* different invalid byte sequences decode to the same replacement characters,
|
|
@@ -1040,7 +1040,7 @@ export function gojaDevEnvironment({ outDir = '.svelte-kit' } = {}) {
|
|
|
1040
1040
|
* @returns {import('vite').Plugin}
|
|
1041
1041
|
*/
|
|
1042
1042
|
export function gojaDevUnchangedFiles({ out = 'build' } = {}) {
|
|
1043
|
-
/**
|
|
1043
|
+
/** The initial load or last delivered watcher content: its byte digest. */
|
|
1044
1044
|
const known = new Map();
|
|
1045
1045
|
const digest = (/** @type {Uint8Array} */ bytes) => createHash('sha256').update(bytes).digest('base64');
|
|
1046
1046
|
const read = (/** @type {string} */ file) => {
|
|
@@ -1050,8 +1050,12 @@ export function gojaDevUnchangedFiles({ out = 'build' } = {}) {
|
|
|
1050
1050
|
return null;
|
|
1051
1051
|
}
|
|
1052
1052
|
};
|
|
1053
|
-
/**
|
|
1053
|
+
/** Initialize a file from the bytes vite decoded, without consuming pending watcher changes. */
|
|
1054
1054
|
const remember = (/** @type {string} */ file, /** @type {string} */ code) => {
|
|
1055
|
+
// A module request can transform new bytes while awaitWriteFinish is
|
|
1056
|
+
// still settling their event. Only watcher delivery advances this baseline
|
|
1057
|
+
// after initialization, or that real change would be suppressed.
|
|
1058
|
+
if (known.has(posix(file))) return;
|
|
1055
1059
|
try {
|
|
1056
1060
|
const bytes = readFileSync(file);
|
|
1057
1061
|
if (bytes.toString('utf8') === code) known.set(posix(file), digest(bytes));
|