Ships Pithos (the s3d control panel) as a built-in extension: the dock menu opens it in a tab served from a loopback port, and "Stop s3d" shuts the gateway down. Generated by Pithos/scripts/build-theseus-addon.mjs. yaml is vendored under vendor/yaml/lib rather than node_modules/ or dist/, because Theseus git-ignores both and a clean-worktree release build would otherwise ship the add-on without its only dependency.
28 lines
850 B
JavaScript
28 lines
850 B
JavaScript
'use strict';
|
|
|
|
function emptyScalarPosition(offset, before, pos) {
|
|
if (before) {
|
|
pos ?? (pos = before.length);
|
|
for (let i = pos - 1; i >= 0; --i) {
|
|
let st = before[i];
|
|
switch (st.type) {
|
|
case 'space':
|
|
case 'comment':
|
|
case 'newline':
|
|
offset -= st.source.length;
|
|
continue;
|
|
}
|
|
// Technically, an empty scalar is immediately after the last non-empty
|
|
// node, but it's more useful to place it after any whitespace.
|
|
st = before[++i];
|
|
while (st?.type === 'space') {
|
|
offset += st.source.length;
|
|
st = before[++i];
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
return offset;
|
|
}
|
|
|
|
exports.emptyScalarPosition = emptyScalarPosition;
|