Consolidate Lit repositories: figma-to-lit, figma_lit_example, lit-3d-piano, lit-calculator, lit-code-editor, lit-draggable-dom, lit-file-based-routing, lit-force-graph, lit-html-editor, lit-html-table, lit-modules, lit-native, lit-node-editor, lit-sheet-music, lit-starter-ts, lit-vscode-extension, lit-wmr, vite-lit-capacitor, vite-lit-element-starter, vite-rxdb-lit

This commit is contained in:
2026-05-16 22:17:12 -07:00
parent 4dc3c8a3ff
commit 95667e3038
527 changed files with 63872 additions and 54 deletions
@@ -0,0 +1,56 @@
export function analyzePage(path: string, content: string): WebComponent[] {
const components: WebComponent[] = [];
// Check for export function loader( or export async function loader(
let hasLoader = false;
const lines = content.split("\n");
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (
line.includes("export function loader(") ||
line.includes("export async function loader(")
) {
hasLoader = true;
break;
}
}
// Look for @customElement decorator and get the value
const regex = /@customElement\("([^"]+)"\)/g;
const matches = content.match(regex);
if (matches) {
for (const match of matches) {
const result = match.match(/@customElement\("([^"]+)"\)/);
if (result) {
const name = result[1];
components.push({
name,
path,
hasLoader,
});
}
}
}
// Look for customElements.define() and get the value
const regex2 = /customElements\.define\("([^"]+)"/g;
const matches2 = content.match(regex2);
if (matches2) {
for (const match of matches2) {
const result = match.match(/customElements\.define\("([^"]+)"/);
if (result) {
const name = result[1];
components.push({
name,
path,
hasLoader,
});
}
}
}
return components;
}
export interface WebComponent {
name: string;
path: string;
alias?: string;
hasLoader: boolean;
}