Problem: the hexagonal refactor churns the backend tree for nine more phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper, compose/web image) must move to its own repo first so doc/layout rewrites land once on a backend-only tree. Change: - New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/ (updateURL repointed to oikos-web releases), compose/, own CI (web + desktop jobs), own deploy script (CI-green gate, TOCTOU guard, version-tagged images, prune-to-3), own webhook receiver on :9798 + launchd unit, own compose project publishing the same 8091:80. - Cutover executed on mac-mini in order: oikos stack's web service stopped+removed, oikos-web project brought up on 8091; outer Caddy untouched (targets the published port) — serving + Authentik flow + /wails 404 quirk verified post-cutover. - Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install targets, the compose web service, oikos-web from deploy.sh's fallback prune list; wails + go-keyring dropped from go.mod, vendor synced. - README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now point at the new repo; mbse + mascot design docs carry a path note. Risk: production SPA serving depends on the new pipeline now; rollback is versioned-image re-up of the old web service from a pre-split checkout (port 8091). Desktop builds installed before the split still check dtoro/oikos releases — one manual reinstall, noted in the oikos-web release notes. Verification: go vet, make test (race), make generate-check, golangci (no new findings; baseline down 400→365); post-cutover curls — localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
119 lines
5.3 KiB
JavaScript
119 lines
5.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const utils_1 = require("../utils");
|
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
const eslint_utils_1 = require("@eslint-community/eslint-utils");
|
|
const DOM_MANIPULATING_METHODS = new Set([
|
|
'appendChild', // https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
|
|
'insertBefore', // https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
|
|
'normalize', // https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize
|
|
'removeChild', // https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
|
|
'replaceChild', // https://developer.mozilla.org/en-US/docs/Web/API/Node/replaceChild
|
|
'after', // https://developer.mozilla.org/en-US/docs/Web/API/Element/after
|
|
'append', // https://developer.mozilla.org/en-US/docs/Web/API/Element/append
|
|
'before', // https://developer.mozilla.org/en-US/docs/Web/API/Element/before
|
|
'insertAdjacentElement', // https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement
|
|
'insertAdjacentHTML', // https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
|
|
'insertAdjacentText', // https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentText
|
|
'prepend', // https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend
|
|
'remove', // https://developer.mozilla.org/en-US/docs/Web/API/Element/remove
|
|
'replaceChildren', // https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren
|
|
'replaceWith' // https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith
|
|
]);
|
|
const DOM_MANIPULATING_PROPERTIES = new Set([
|
|
'textContent', // https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent
|
|
'innerHTML', // https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML
|
|
'outerHTML', // https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML
|
|
'innerText', // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText
|
|
'outerText' // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
|
|
]);
|
|
exports.default = (0, utils_1.createRule)('no-dom-manipulating', {
|
|
meta: {
|
|
docs: {
|
|
description: 'disallow DOM manipulating',
|
|
category: 'Possible Errors',
|
|
recommended: false
|
|
},
|
|
schema: [],
|
|
messages: {
|
|
disallowManipulateDOM: "Don't manipulate the DOM directly. The Svelte runtime can get confused if there is a difference between the actual DOM and the DOM expected by the Svelte runtime."
|
|
},
|
|
type: 'problem'
|
|
},
|
|
create(context) {
|
|
const domVariables = new Set();
|
|
/**
|
|
* Verify DOM variable identifier node
|
|
*/
|
|
function verifyIdentifier(node) {
|
|
const member = node.parent;
|
|
if (member?.type !== 'MemberExpression' || member.object !== node) {
|
|
return;
|
|
}
|
|
const name = (0, eslint_utils_1.getPropertyName)(member);
|
|
if (!name) {
|
|
return;
|
|
}
|
|
let target = member;
|
|
let parent = target.parent;
|
|
while (parent?.type === 'ChainExpression') {
|
|
target = parent;
|
|
parent = parent.parent;
|
|
}
|
|
if (!parent) {
|
|
return;
|
|
}
|
|
if (parent.type === 'CallExpression') {
|
|
if (parent.callee !== target || !DOM_MANIPULATING_METHODS.has(name)) {
|
|
return;
|
|
}
|
|
}
|
|
else if (parent.type === 'AssignmentExpression') {
|
|
if (parent.left !== target || !DOM_MANIPULATING_PROPERTIES.has(name)) {
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
return;
|
|
}
|
|
context.report({
|
|
node: member,
|
|
messageId: 'disallowManipulateDOM'
|
|
});
|
|
}
|
|
return {
|
|
"SvelteDirective[kind='Binding']"(node) {
|
|
if (node.key.name.name !== 'this' ||
|
|
!node.expression ||
|
|
node.expression.type !== 'Identifier') {
|
|
// not bind:this={id}
|
|
return;
|
|
}
|
|
const element = node.parent.parent;
|
|
if (element.type !== 'SvelteElement' || !isHTMLElement(element)) {
|
|
// not HTML element
|
|
return;
|
|
}
|
|
const variable = (0, ast_utils_1.findVariable)(context, node.expression);
|
|
if (!variable || (variable.scope.type !== 'module' && variable.scope.type !== 'global')) {
|
|
return;
|
|
}
|
|
domVariables.add(variable);
|
|
},
|
|
'Program:exit'() {
|
|
for (const variable of domVariables) {
|
|
for (const reference of variable.references) {
|
|
verifyIdentifier(reference.identifier);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
/**
|
|
* Checks whether the given node is a HTML element or not.
|
|
*/
|
|
function isHTMLElement(node) {
|
|
return (node.kind === 'html' || (node.kind === 'special' && (0, ast_utils_1.getNodeName)(node) === 'svelte:element'));
|
|
}
|
|
}
|
|
});
|