skullmaster 0.1.4 → 0.2.0-next.2

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/dist/cli.mjs CHANGED
@@ -117,8 +117,11 @@ function buildExecutor(rules) {
117
117
  return current;
118
118
  };
119
119
  }
120
+ function sanitizeAttrValue(value) {
121
+ return value.replace(/"/g, "'").replace(/\\/g, "/");
122
+ }
120
123
  function createJsxStringAttribute(name, value) {
121
- return t.jsxAttribute(t.jsxIdentifier(name), t.stringLiteral(value));
124
+ return t.jsxAttribute(t.jsxIdentifier(name), t.stringLiteral(sanitizeAttrValue(value)));
122
125
  }
123
126
  function createJsxExpressionAttribute(name, expression) {
124
127
  return t.jsxAttribute(t.jsxIdentifier(name), t.jsxExpressionContainer(expression));
@@ -197,7 +200,7 @@ function normalizeAttributeName(name) {
197
200
  if (lower.startsWith("data-") || lower.startsWith("aria-")) return lower;
198
201
  return name.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
199
202
  }
200
- const STYLE_ATTRIBUTES = new Set([
203
+ const STYLE_ATTRIBUTES = /* @__PURE__ */ new Set([
201
204
  "class",
202
205
  "style",
203
206
  "type",
@@ -361,6 +364,15 @@ const addRootSkeletonsAttrs = {
361
364
  };
362
365
  }
363
366
  };
367
+ const skipNode = {
368
+ id: "skip-node",
369
+ skipAllRest: true,
370
+ match: (ctx) => ctx.element.nodeType === 1 && ctx.element.hasAttribute("data-skip-skull"),
371
+ transform: (ctx) => ({
372
+ ...ctx,
373
+ target: null
374
+ })
375
+ };
364
376
  const DATA_NAT_H = "data-natural-h";
365
377
  const DATA_NAT_W = "data-natural-w";
366
378
  const DATA_IMAGE_SKELETON = "data-image-skeleton";
@@ -369,9 +381,6 @@ function createSkeletonSrc(width, height, color = "#e5e7eb") {
369
381
  const h = Number(height) || 300;
370
382
  return `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}" preserveAspectRatio="none"><rect width="100%" height="100%" fill="${color}"/></svg>`)}`;
371
383
  }
372
- function hasAttribute(attrs, name) {
373
- return attrs.some((attr) => t.isJSXIdentifier(attr.name) && attr.name.name === name);
374
- }
375
384
  const transformImg = {
376
385
  id: "transform-img",
377
386
  match: (ctx) => ctx.element.nodeType === 1 && ctx.element.tagName.toLowerCase() === "img",
@@ -383,30 +392,25 @@ const transformImg = {
383
392
  const naturalWidth = naturalWidthAttr?.value?.value;
384
393
  const naturalHeight = naturalHeightAttr?.value?.value;
385
394
  const placeholderSrc = createSkeletonSrc(naturalWidth, naturalHeight);
386
- const filteredAttrs = attrs.filter((attr) => {
387
- if (!t.isJSXAttribute(attr)) return false;
388
- const name = t.isJSXIdentifier(attr.name) ? attr.name.name : void 0;
389
- return ![
390
- "src",
391
- "srcSet",
392
- "sizes",
393
- "loading",
394
- "decoding",
395
- "fetchPriority",
396
- DATA_NAT_W,
397
- DATA_NAT_H,
398
- DATA_IMAGE_SKELETON
399
- ].includes(name ?? "");
400
- });
401
395
  const attributes = [
402
- ...filteredAttrs,
396
+ ...attrs.filter((attr) => {
397
+ if (!t.isJSXAttribute(attr)) return false;
398
+ const name = t.isJSXIdentifier(attr.name) ? attr.name.name : void 0;
399
+ return ![
400
+ "src",
401
+ "srcSet",
402
+ "sizes",
403
+ "loading",
404
+ "decoding",
405
+ "fetchPriority",
406
+ DATA_NAT_W,
407
+ DATA_NAT_H,
408
+ DATA_IMAGE_SKELETON
409
+ ].includes(name ?? "");
410
+ }),
403
411
  createJsxStringAttribute("src", placeholderSrc),
404
412
  createJsxStringAttribute(DATA_IMAGE_SKELETON, "true")
405
413
  ];
406
- if (naturalWidth && naturalHeight) {
407
- if (!hasAttribute(filteredAttrs, "width")) attributes.push(createJsxStringAttribute("width", naturalWidth));
408
- if (!hasAttribute(filteredAttrs, "height")) attributes.push(createJsxStringAttribute("height", naturalHeight));
409
- }
410
414
  return {
411
415
  ...ctx,
412
416
  target: {
@@ -416,7 +420,7 @@ const transformImg = {
416
420
  };
417
421
  }
418
422
  };
419
- const INTERACTIVE_TAGS = new Set([
423
+ const INTERACTIVE_TAGS = /* @__PURE__ */ new Set([
420
424
  "input",
421
425
  "textarea",
422
426
  "select",
@@ -438,7 +442,7 @@ const INTERACTIVE_TAGS = new Set([
438
442
  "object",
439
443
  "dialog"
440
444
  ]);
441
- const INTERACTIVE_ROLES = new Set([
445
+ const INTERACTIVE_ROLES = /* @__PURE__ */ new Set([
442
446
  "button",
443
447
  "link",
444
448
  "tab",
@@ -458,7 +462,7 @@ const INTERACTIVE_ROLES = new Set([
458
462
  "rowheader",
459
463
  "columnheader"
460
464
  ]);
461
- const ARIA_ATTRIBUTES_TO_REMOVE = new Set([
465
+ const ARIA_ATTRIBUTES_TO_REMOVE = /* @__PURE__ */ new Set([
462
466
  "role",
463
467
  "aria-label",
464
468
  "aria-labelledby",
@@ -504,24 +508,12 @@ const transformInteractiveElements = {
504
508
  };
505
509
  }
506
510
  };
507
- const SAFE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
508
511
  function spacePreservedObfuscator(input) {
509
512
  if (!input) return null;
510
- let seed = 2166136261;
511
- for (const char of input) {
512
- seed ^= char.charCodeAt(0);
513
- seed = Math.imul(seed, 16777619);
514
- }
515
- const len = 66;
516
- return [...input].map((char, i) => {
517
- if (char === " ") return " ";
518
- seed ^= seed << 13;
519
- seed ^= seed >>> 17;
520
- seed ^= seed << 5;
521
- return SAFE_CHARS[Math.abs(seed + i) % len];
522
- }).join("");
513
+ return [...input].map((char) => char === " " ? " " : "█").join("");
523
514
  }
524
515
  const executor = buildExecutor([
516
+ skipNode,
525
517
  {
526
518
  id: "transform-text",
527
519
  skipAllRest: true,
@@ -721,6 +713,8 @@ async function generateInitialRegistry(outDir, projectType) {
721
713
  const isTs = projectType.endsWith("ts");
722
714
  const ext = isTs ? "tsx" : "jsx";
723
715
  const skeletonPropsType = isTs ? `
716
+ import "@skullmaster/react/style.css"
717
+
724
718
  type SkeletonProps = {
725
719
  name: string;
726
720
  };
@@ -770,7 +764,8 @@ async function generateRegistry(operation, isTs, registryPath) {
770
764
  const registry = sourceFile.getVariableDeclaration("registry")?.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);
771
765
  if (!registry) throw new Error("Unable to locate registry object, have you ran skullmaster init??");
772
766
  const existingComponents = new Set(registry.getProperties().filter((property) => property.getKind() === SyntaxKind.PropertyAssignment).map((property) => property.asKindOrThrow(SyntaxKind.PropertyAssignment)).map((property) => property.getName().replace(/['"]/g, "")));
773
- for (const component of operation.components) {
767
+ for (let component of operation.components) {
768
+ component = toPascalCase(component);
774
769
  if (existingComponents.has(component)) continue;
775
770
  registry.addPropertyAssignment({
776
771
  name: `"${component}"`,
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["htmlNodeToJsx","readFile","writeFile"],"sources":["../src/shared/constants.ts","../src/shared/schema.ts","../src/shared/log.ts","../src/cache/index.ts","../src/generate-target/index.ts","../../excarnate/dist/index.mjs","../src/transform/index.ts","../src/utils/to-pascal-case.ts","../src/utils/fnv1a.ts","../src/commands/serve.ts","../src/init/is-file-exists.ts","../src/constants.ts","../src/init/collect-preferences.ts","../src/init/ensure-lazy-imports.ts","../src/init/registry.ts","../src/init/cache-registry.ts","../src/init/default-bone.ts","../src/init/preferences.ts","../src/cli.ts"],"sourcesContent":["export const DEFAULT_PORT = 8008;\nexport const EMPTY_SET_DEFAULT_DIR = \"skullmaster\";\nexport const DATA_NAT_H = \"data-natural-h\";\nexport const DATA_NAT_W = \"data-natural-w\";\n","import z from \"zod\";\n\nexport const SkeletonPayloadInputSchema = z.record(\n z.string(),\n z.object({\n component: z.string(),\n html: z.string(),\n }),\n);\n\nexport const SkeletonCacheEntrySchema = z.record(\n z.string(),\n z.object({\n component: z.string(),\n html: z.string(),\n hash: z.string(),\n }),\n);\n\nexport type SkeletonPayloadInput = z.infer<typeof SkeletonPayloadInputSchema>;\n\nexport type SkeletonCacheEntry = z.infer<typeof SkeletonCacheEntrySchema>;\n","export const log = {\n success: (message: string) => console.log(`\\x1b[32m[💀] ${message}\\x1b[0m`),\n info: (message: string) => console.log(`\\x1b[36m[💀] ${message}\\x1b[0m`),\n warn: (message: string) => console.log(`\\x1b[33m[💀] ${message}\\x1b[0m`),\n error: (message: string) => console.log(`\\x1b[31m[💀] ${message}\\x1b[0m`),\n gray: (message: string) => console.log(`\\x1b[90m[💀] ${message}\\x1b[0m`),\n};\n","import { readFile } from \"node:fs/promises\";\nimport type { Config } from \"../init/preferences\";\nimport { type SkeletonCacheEntry, SkeletonCacheEntrySchema } from \"../shared\";\n\nexport class SkeletonCacheDB {\n private data: SkeletonCacheEntry = {};\n config: Config;\n private constructor(config: Config) {\n this.config = config;\n }\n\n static async create(config: Config) {\n const db = new SkeletonCacheDB(config);\n\n await db.load();\n\n return db;\n }\n\n private async load() {\n try {\n const file = await readFile(this.config.getCachePath(), \"utf8\");\n\n const parsed = JSON.parse(file);\n\n this.data = SkeletonCacheEntrySchema.parse(parsed);\n } catch {\n this.data = {};\n\n await this.config.cache({ type: \"replace\", cacheEntry: {} });\n }\n }\n\n get(key: string) {\n return this.data[key];\n }\n getComponentNames(): string[] {\n return Object.values(this.data).map((entry) => entry.component);\n }\n\n async set(key: string, value: SkeletonCacheEntry[string]) {\n this.data[key] = value;\n this.config.cache({ type: \"update\", componentName: key, payload: value });\n }\n}\n","import { Project, QuoteKind, ScriptKind } from \"ts-morph\";\n\ntype GenerateTargetOptions = {\n project: Project;\n filePath: string;\n componentName: string;\n body: string;\n};\n\nexport default function generateTarget({\n project,\n filePath,\n componentName,\n body,\n}: GenerateTargetOptions) {\n project.manipulationSettings.set({\n quoteKind: QuoteKind.Double,\n });\n\n const file = project.createSourceFile(filePath, \"\", {\n overwrite: true,\n scriptKind: ScriptKind.TSX,\n });\n\n file.insertText(\n 0,\n `/* eslint-disable */\n/* prettier-ignore-start */\n\n/**\n * Auto-generated by Skullmaster.\n *\n * DO NOT EDIT THIS FILE MANUALLY.\n * Changes may be overwritten on the next generation.\n */\n\n`,\n );\n\n file.addFunction({\n name: componentName,\n isDefaultExport: true,\n statements: [`return (${body});`],\n });\n\n file.addStatements(`\n/* prettier-ignore-end */\n`);\n}\n","import * as t from \"@babel/types\";\nimport { jsxText } from \"@babel/types\";\n//#region src/executor.ts\nfunction buildExecutor(rules) {\n\treturn (ctx) => {\n\t\tlet current = ctx;\n\t\tfor (const rule of rules) {\n\t\t\tif (!rule.match(current)) continue;\n\t\t\tcurrent = rule.transform(current);\n\t\t\tif (rule.skipAllRest) break;\n\t\t}\n\t\treturn current;\n\t};\n}\n//#endregion\n//#region src/helpers/jsx.ts\nfunction createJsxStringAttribute(name, value) {\n\treturn t.jsxAttribute(t.jsxIdentifier(name), t.stringLiteral(value));\n}\nfunction createJsxExpressionAttribute(name, expression) {\n\treturn t.jsxAttribute(t.jsxIdentifier(name), t.jsxExpressionContainer(expression));\n}\nfunction findJsxAttribute(attributes, name) {\n\treturn attributes.find((attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name);\n}\nfunction findStringJsxAttribute(attributes, name) {\n\tconst attr = findJsxAttribute(attributes, name);\n\tif (!attr?.value || !t.isStringLiteral(attr.value)) return;\n\treturn attr;\n}\nfunction createJsxElement(tagName, children, attributes = []) {\n\treturn t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier(tagName), attributes, false), t.jsxClosingElement(t.jsxIdentifier(tagName)), children, false);\n}\n//#endregion\n//#region src/constants.ts\nconst DEPTH_ATTRIBUTE = \"data-depth\";\nconst TEXT_CLASSNAME = \"empty-set__text\";\nconst SKELETON_CLASSNAME = \"empty-set__skeleton\";\n//#endregion\n//#region src/exceptions/target-mismatch.ts\nvar TargetElementMismatchError = class extends Error {\n\tconstructor(expected, actual) {\n\t\tsuper(`Expected target element to be ${expected}, but got ${actual}`);\n\t\tthis.name = \"TargetElementMismatchError\";\n\t}\n};\n//#endregion\n//#region src/helpers/attribute-replace-map.ts\nconst ATTRIBUTE_MAP = {\n\tclass: \"className\",\n\tfor: \"htmlFor\",\n\ttabindex: \"tabIndex\",\n\treadonly: \"readOnly\",\n\tmaxlength: \"maxLength\",\n\tminlength: \"minLength\",\n\tcolspan: \"colSpan\",\n\trowspan: \"rowSpan\",\n\tcontenteditable: \"contentEditable\",\n\tautocapitalize: \"autoCapitalize\",\n\tautocomplete: \"autoComplete\",\n\tautofocus: \"autoFocus\",\n\tspellcheck: \"spellCheck\",\n\tcrossorigin: \"crossOrigin\",\n\treferrerpolicy: \"referrerPolicy\",\n\tstrokewidth: \"strokeWidth\",\n\t\"stroke-width\": \"strokeWidth\",\n\tstrokelinecap: \"strokeLinecap\",\n\t\"stroke-linecap\": \"strokeLinecap\",\n\tstrokelinejoin: \"strokeLinejoin\",\n\t\"stroke-linejoin\": \"strokeLinejoin\",\n\tstrokemiterlimit: \"strokeMiterlimit\",\n\t\"stroke-miterlimit\": \"strokeMiterlimit\",\n\tstrokedasharray: \"strokeDasharray\",\n\t\"stroke-dasharray\": \"strokeDasharray\",\n\tstrokedashoffset: \"strokeDashoffset\",\n\t\"stroke-dashoffset\": \"strokeDashoffset\",\n\tstrokeopacity: \"strokeOpacity\",\n\t\"stroke-opacity\": \"strokeOpacity\",\n\tfillopacity: \"fillOpacity\",\n\t\"fill-opacity\": \"fillOpacity\",\n\tfillrule: \"fillRule\",\n\t\"fill-rule\": \"fillRule\",\n\tcliprule: \"clipRule\",\n\t\"clip-rule\": \"clipRule\",\n\tclippath: \"clipPath\",\n\t\"clip-path\": \"clipPath\",\n\tstopcolor: \"stopColor\",\n\t\"stop-color\": \"stopColor\",\n\tstopopacity: \"stopOpacity\",\n\t\"stop-opacity\": \"stopOpacity\",\n\tviewbox: \"viewBox\",\n\txlinkhref: \"xlinkHref\",\n\t\"xlink:href\": \"xlinkHref\",\n\txmlspace: \"xmlSpace\",\n\t\"xml:space\": \"xmlSpace\"\n};\n//#endregion\n//#region src/helpers/attr-normalize.ts\nfunction normalizeAttributeName(name) {\n\tconst lower = name.toLowerCase();\n\tif (ATTRIBUTE_MAP[lower]) return ATTRIBUTE_MAP[lower];\n\tif (lower.startsWith(\"data-\") || lower.startsWith(\"aria-\")) return lower;\n\treturn name.replace(/-([a-z])/g, (_, char) => char.toUpperCase());\n}\n//#endregion\n//#region src/helpers/is-style.ts\nconst STYLE_ATTRIBUTES = new Set([\n\t\"class\",\n\t\"style\",\n\t\"type\",\n\t\"fill\",\n\t\"fill-opacity\",\n\t\"fill-rule\",\n\t\"src\",\n\t\"stroke\",\n\t\"stroke-width\",\n\t\"stroke-opacity\",\n\t\"stroke-linecap\",\n\t\"stroke-linejoin\",\n\t\"stroke-dasharray\",\n\t\"stroke-dashoffset\",\n\t\"opacity\",\n\t\"role\",\n\t\"width\",\n\t\"height\",\n\t\"x\",\n\t\"y\",\n\t\"cx\",\n\t\"cy\",\n\t\"r\",\n\t\"rx\",\n\t\"ry\",\n\t\"viewbox\",\n\t\"transform\",\n\t\"d\",\n\t\"points\"\n]);\nfunction shouldKeepAttribute(name) {\n\tconst lowerName = name.toLowerCase();\n\treturn lowerName.startsWith(\"data-\") || lowerName.startsWith(\"aria-\") || STYLE_ATTRIBUTES.has(lowerName);\n}\n//#endregion\n//#region src/helpers/parse-style.ts\nfunction parseStyle(style) {\n\tconst properties = [];\n\tfor (const rule of style.split(\";\")) {\n\t\tconst trimmedRule = rule.trim();\n\t\tif (!trimmedRule) continue;\n\t\tconst colonIndex = trimmedRule.indexOf(\":\");\n\t\tif (colonIndex === -1) continue;\n\t\tconst rawKey = trimmedRule.slice(0, colonIndex).trim();\n\t\tconst rawValue = trimmedRule.slice(colonIndex + 1).trim();\n\t\tconst key = rawKey.replace(/-([a-z])/g, (_, char) => char.toUpperCase());\n\t\tconst keyNode = key.startsWith(\"--\") || key.includes(\"-\") ? t.stringLiteral(key) : t.identifier(key);\n\t\tproperties.push(t.objectProperty(keyNode, t.stringLiteral(rawValue)));\n\t}\n\treturn t.objectExpression(properties);\n}\n//#endregion\n//#region src/rules/populate-attrs.ts\nconst populateAttrs = {\n\tid: \"populate-attrs\",\n\tmatch: (ctx) => ctx.element.nodeType === 1,\n\ttransform: (ctx) => {\n\t\tconst element = ctx.element;\n\t\tconst attributes = [];\n\t\tconst tagName = element.tagName.toLowerCase();\n\t\tif (ctx.target?.element && ctx.target?.element !== tagName) throw new TargetElementMismatchError(tagName, ctx.target.element);\n\t\tif (!element.hasAttribute(\"data-depth\")) attributes.push(createJsxStringAttribute(DEPTH_ATTRIBUTE, String(ctx.depth)));\n\t\tfor (const attr of element.attributes) {\n\t\t\tif (!shouldKeepAttribute(attr.name)) continue;\n\t\t\tconst name = normalizeAttributeName(attr.name);\n\t\t\tconst value = attr.value;\n\t\t\tif (name === \"style\") {\n\t\t\t\tattributes.push(createJsxExpressionAttribute(\"style\", parseStyle(value)));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tattributes.push(createJsxStringAttribute(name, value));\n\t\t}\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\telement: tagName,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/matchers.ts\nconst atDepth = (depth) => (ctx) => ctx.depth === depth;\nconst isTagNamesIn = (elements) => (ctx) => ctx.element.nodeType === 1 && elements.includes(ctx.element.tagName.toLowerCase());\n//#endregion\n//#region src/rules/process-svg.ts\nconst processSvg = {\n\tid: \"process-svg\",\n\tskipAllRest: true,\n\tmatch: isTagNamesIn([\"svg\"]),\n\ttransform: (ctx) => {\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...ctx.target,\n\t\t\t\telement: \"svg\",\n\t\t\t\tchildren: []\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/remove-node.ts\nconst removeReduntantNode = {\n\tid: \"remove-node\",\n\tskipAllRest: true,\n\tmatch: isTagNamesIn([\n\t\t\"html\",\n\t\t\"script\",\n\t\t\"style\",\n\t\t\"head\",\n\t\t\"meta\",\n\t\t\"link\",\n\t\t\"noscript\",\n\t\t\"template\",\n\t\t\"audio\",\n\t\t\"video\",\n\t\t\"source\",\n\t\t\"track\",\n\t\t\"iframe\",\n\t\t\"embed\",\n\t\t\"object\",\n\t\t\"title\",\n\t\t\"base\",\n\t\t\"defs\",\n\t\t\"symbol\",\n\t\t\"html\",\n\t\t\"canvas\",\n\t\t\"map\",\n\t\t\"area\",\n\t\t\"picture\",\n\t\t\"portal\"\n\t]),\n\ttransform: (ctx) => {\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: null\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/root-skeleton-attrs.ts\nconst addRootSkeletonsAttrs = {\n\tid: \"add-root-skeleton-attrs\",\n\tmatch: (ctx) => ctx.element.nodeType === 1 && atDepth(0)(ctx),\n\ttransform: (ctx) => {\n\t\tconst tagName = ctx.element.tagName.toLowerCase();\n\t\tif (ctx.target?.element && ctx.target.element !== tagName) throw new TargetElementMismatchError(tagName, ctx.target.element);\n\t\tconst existingTarget = ctx.target ?? {\n\t\t\telement: tagName,\n\t\t\tattributes: []\n\t\t};\n\t\tconst existingAttrs = existingTarget.attributes ?? [];\n\t\tconst classNameAttr = findStringJsxAttribute(existingAttrs, \"className\");\n\t\tconst attributes = [...classNameAttr ? existingAttrs.map((attr) => attr === classNameAttr ? {\n\t\t\t...attr,\n\t\t\tvalue: {\n\t\t\t\t...classNameAttr.value,\n\t\t\t\tvalue: `${classNameAttr.value.value} ${SKELETON_CLASSNAME}`\n\t\t\t}\n\t\t} : attr) : [...existingAttrs, createJsxStringAttribute(\"className\", SKELETON_CLASSNAME)]];\n\t\tif (!findJsxAttribute(attributes, \"role\")) attributes.push(createJsxStringAttribute(\"role\", \"status\"));\n\t\tif (!findJsxAttribute(attributes, \"aria-live\")) attributes.push(createJsxStringAttribute(\"aria-live\", \"polite\"));\n\t\tif (!findJsxAttribute(attributes, \"aria-busy\")) attributes.push(createJsxStringAttribute(\"aria-busy\", \"true\"));\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...existingTarget,\n\t\t\t\telement: tagName,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/transform-img.ts\nconst DATA_NAT_H = \"data-natural-h\";\nconst DATA_NAT_W = \"data-natural-w\";\nconst DATA_IMAGE_SKELETON = \"data-image-skeleton\";\nfunction createSkeletonSrc(width, height, color = \"#e5e7eb\") {\n\tconst w = Number(width) || 400;\n\tconst h = Number(height) || 300;\n\treturn `data:image/svg+xml,${encodeURIComponent(`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${w}\" height=\"${h}\" viewBox=\"0 0 ${w} ${h}\" preserveAspectRatio=\"none\"><rect width=\"100%\" height=\"100%\" fill=\"${color}\"/></svg>`)}`;\n}\nfunction hasAttribute(attrs, name) {\n\treturn attrs.some((attr) => t.isJSXIdentifier(attr.name) && attr.name.name === name);\n}\nconst transformImg = {\n\tid: \"transform-img\",\n\tmatch: (ctx) => ctx.element.nodeType === 1 && ctx.element.tagName.toLowerCase() === \"img\",\n\ttransform: (ctx) => {\n\t\tif (!ctx.target) throw new Error(\"Target must be defined before transforming an image element.\");\n\t\tconst attrs = ctx.target.attributes ?? [];\n\t\tconst naturalWidthAttr = findStringJsxAttribute(attrs, DATA_NAT_W);\n\t\tconst naturalHeightAttr = findStringJsxAttribute(attrs, DATA_NAT_H);\n\t\tconst naturalWidth = naturalWidthAttr?.value?.value;\n\t\tconst naturalHeight = naturalHeightAttr?.value?.value;\n\t\tconst placeholderSrc = createSkeletonSrc(naturalWidth, naturalHeight);\n\t\tconst filteredAttrs = attrs.filter((attr) => {\n\t\t\tif (!t.isJSXAttribute(attr)) return false;\n\t\t\tconst name = t.isJSXIdentifier(attr.name) ? attr.name.name : void 0;\n\t\t\treturn ![\n\t\t\t\t\"src\",\n\t\t\t\t\"srcSet\",\n\t\t\t\t\"sizes\",\n\t\t\t\t\"loading\",\n\t\t\t\t\"decoding\",\n\t\t\t\t\"fetchPriority\",\n\t\t\t\tDATA_NAT_W,\n\t\t\t\tDATA_NAT_H,\n\t\t\t\tDATA_IMAGE_SKELETON\n\t\t\t].includes(name ?? \"\");\n\t\t});\n\t\tconst attributes = [\n\t\t\t...filteredAttrs,\n\t\t\tcreateJsxStringAttribute(\"src\", placeholderSrc),\n\t\t\tcreateJsxStringAttribute(DATA_IMAGE_SKELETON, \"true\")\n\t\t];\n\t\tif (naturalWidth && naturalHeight) {\n\t\t\tif (!hasAttribute(filteredAttrs, \"width\")) attributes.push(createJsxStringAttribute(\"width\", naturalWidth));\n\t\t\tif (!hasAttribute(filteredAttrs, \"height\")) attributes.push(createJsxStringAttribute(\"height\", naturalHeight));\n\t\t}\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...ctx.target,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/transform-interactive.ts\nconst INTERACTIVE_TAGS = new Set([\n\t\"input\",\n\t\"textarea\",\n\t\"select\",\n\t\"option\",\n\t\"optgroup\",\n\t\"button\",\n\t\"label\",\n\t\"fieldset\",\n\t\"legend\",\n\t\"output\",\n\t\"datalist\",\n\t\"a\",\n\t\"details\",\n\t\"summary\",\n\t\"audio\",\n\t\"video\",\n\t\"iframe\",\n\t\"embed\",\n\t\"object\",\n\t\"dialog\"\n]);\nconst INTERACTIVE_ROLES = new Set([\n\t\"button\",\n\t\"link\",\n\t\"tab\",\n\t\"menuitem\",\n\t\"checkbox\",\n\t\"radio\",\n\t\"switch\",\n\t\"option\",\n\t\"combobox\",\n\t\"textbox\",\n\t\"searchbox\",\n\t\"slider\",\n\t\"spinbutton\",\n\t\"listbox\",\n\t\"treeitem\",\n\t\"gridcell\",\n\t\"rowheader\",\n\t\"columnheader\"\n]);\nconst ARIA_ATTRIBUTES_TO_REMOVE = new Set([\n\t\"role\",\n\t\"aria-label\",\n\t\"aria-labelledby\",\n\t\"aria-describedby\",\n\t\"aria-controls\",\n\t\"aria-expanded\",\n\t\"aria-haspopup\",\n\t\"aria-pressed\",\n\t\"aria-selected\",\n\t\"aria-checked\",\n\t\"aria-current\",\n\t\"contenteditable\",\n\t\"tabindex\",\n\t\"aria-hidden\",\n\t\"data-skeleton-interactive\"\n]);\nconst transformInteractiveElements = {\n\tid: \"transform-interactive-elements\",\n\tmatch: (ctx) => {\n\t\tif (ctx.element.nodeType !== 1) return false;\n\t\tconst element = ctx.element;\n\t\tconst tag = element.tagName.toLowerCase();\n\t\tif (INTERACTIVE_TAGS.has(tag)) return true;\n\t\tconst role = element.getAttribute(\"role\")?.toLowerCase();\n\t\tif (role && INTERACTIVE_ROLES.has(role)) return true;\n\t\tif (element.hasAttribute(\"contenteditable\")) return true;\n\t\tif (element.hasAttribute(\"tabindex\")) return true;\n\t\treturn false;\n\t},\n\ttransform: (ctx) => {\n\t\tif (!ctx.target) return ctx;\n\t\tconst attributes = (ctx.target.attributes ?? []).filter((attribute) => {\n\t\t\tconst name = attribute.type === \"JSXAttribute\" && attribute.name?.name ? String(attribute.name.name).toLowerCase() : \"\";\n\t\t\treturn !ARIA_ATTRIBUTES_TO_REMOVE.has(name);\n\t\t});\n\t\tattributes.push(createJsxStringAttribute(\"data-skeleton-interactive\", \"true\"), createJsxStringAttribute(\"aria-hidden\", \"true\"), createJsxExpressionAttribute(\"tabIndex\", t.numericLiteral(-1)));\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...ctx.target,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/helpers/hash.ts\nconst SAFE_CHARS = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~\";\nfunction spacePreservedObfuscator(input) {\n\tif (!input) return null;\n\tlet seed = 2166136261;\n\tfor (const char of input) {\n\t\tseed ^= char.charCodeAt(0);\n\t\tseed = Math.imul(seed, 16777619);\n\t}\n\tconst len = 66;\n\treturn [...input].map((char, i) => {\n\t\tif (char === \" \") return \" \";\n\t\tseed ^= seed << 13;\n\t\tseed ^= seed >>> 17;\n\t\tseed ^= seed << 5;\n\t\treturn SAFE_CHARS[Math.abs(seed + i) % len];\n\t}).join(\"\");\n}\n//#endregion\n//#region src/index.ts\nconst executor = buildExecutor([\n\t{\n\t\tid: \"transform-text\",\n\t\tskipAllRest: true,\n\t\tmatch: (ctx) => ctx.element.nodeType === 3,\n\t\ttransform: (ctx) => {\n\t\t\tconst text = spacePreservedObfuscator(ctx.element.textContent?.trim());\n\t\t\tif (!text) return ctx;\n\t\t\tconst isHeading = ctx.parentNode?.nodeName.toLowerCase().startsWith(\"h\");\n\t\t\tif (![\"p\", \"label\"].includes(ctx.parentNode?.nodeName.toLowerCase() ?? \"\") && !isHeading) return {\n\t\t\t\t...ctx,\n\t\t\t\ttarget: {\n\t\t\t\t\telement: \"TEXT\",\n\t\t\t\t\tchildren: [jsxText(text)]\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn {\n\t\t\t\t...ctx,\n\t\t\t\ttarget: {\n\t\t\t\t\telement: \"span\",\n\t\t\t\t\tattributes: [\n\t\t\t\t\t\tcreateJsxStringAttribute(\"className\", TEXT_CLASSNAME),\n\t\t\t\t\t\tcreateJsxStringAttribute(\"data-text-node\", \"true\"),\n\t\t\t\t\t\tcreateJsxStringAttribute(DEPTH_ATTRIBUTE, ctx.parentDepth ?? String(ctx.depth))\n\t\t\t\t\t],\n\t\t\t\t\tchildren: [jsxText(text)]\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t},\n\tremoveReduntantNode,\n\tpopulateAttrs,\n\tprocessSvg,\n\ttransformImg,\n\ttransformInteractiveElements,\n\taddRootSkeletonsAttrs\n]);\nfunction excarnate(element, depth, parentNode = null, parentDepth) {\n\tconst target = executor({\n\t\telement,\n\t\tdepth,\n\t\tparentNode,\n\t\tparentDepth\n\t}).target;\n\tif (!target) return null;\n\tconst { children, element: tagName, attributes } = target;\n\tif (tagName === \"TEXT\") return children?.[0] ?? null;\n\tif (children) return createJsxElement(tagName, children, attributes);\n\tconst { childNodes } = element ?? { childNodes: [] };\n\treturn createJsxElement(tagName, Array.from(childNodes).map((child) => excarnate(child, depth + 1, element, depth.toString())).filter(Boolean), attributes);\n}\n//#endregion\nexport { excarnate as default };\n\n//# sourceMappingURL=index.mjs.map","import { JSDOM } from \"jsdom\";\nimport pkg from \"@babel/generator\";\n\n// @ts-ignore\nconst generate = pkg.default;\n\nimport htmlNodeToJsx from \"@skullmaster/excarnate\";\n\nexport function transformInput(html: string) {\n const dom = new JSDOM(html);\n\n const root = dom.window.document.body.firstElementChild;\n\n if (!root) {\n throw new Error(\"No root element found\");\n }\n\n const jsxAst = htmlNodeToJsx(root, 0);\n\n if (!jsxAst) {\n throw new Error(\"Failed to generate JSX AST\");\n }\n\n const result = generate(jsxAst, {\n jsescOption: {\n minimal: true,\n },\n });\n\n return result.code;\n}\n","export function toPascalCase(input: string): string {\n return input\n .trim()\n .replace(/['\"]/g, \"\")\n .split(/[^a-zA-Z0-9]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\"\");\n}\n","export function fnv1a(str: string): number {\n let hash = 0x811c9dc5;\n\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193);\n }\n\n return hash >>> 0;\n}\n","import { serve } from \"@hono/node-server\";\nimport { Hono } from \"hono\";\nimport { cors } from \"hono/cors\";\nimport { Project } from \"ts-morph\";\nimport { SkeletonCacheDB } from \"../cache\";\nimport generateTarget from \"../generate-target\";\nimport { transformInput } from \"../transform\";\nimport { toPascalCase } from \"../utils/to-pascal-case\";\nimport { fnv1a } from \"../utils/fnv1a\";\nimport type { Config } from \"../init/preferences\";\nimport { log, SkeletonPayloadInputSchema } from \"../shared\";\n\nexport async function serveCommand(config: Config, port: number) {\n const app = new Hono();\n\n app.use(\n \"*\",\n cors({\n origin: \"*\",\n allowMethods: [\"GET\", \"POST\", \"OPTIONS\"],\n allowHeaders: [\"Content-Type\", \"Authorization\"],\n }),\n );\n\n const db = await SkeletonCacheDB.create(config);\n\n app.get(\"/health\", (c) => {\n return c.json({\n ok: true,\n });\n });\n\n app.post(\"/skeletons\", async (c) => {\n const body = await c.req.json();\n\n const result = SkeletonPayloadInputSchema.parse(body);\n\n const project = new Project();\n const entries = Object.entries(result).map(async ([key, value]) => {\n const componentName = toPascalCase(value.component);\n const transformedHtml = transformInput(value.html);\n const hash = fnv1a(transformedHtml).toString();\n const cached = db.get(key);\n const shouldSkip = cached && cached.hash === hash;\n\n if (shouldSkip) {\n return;\n }\n\n generateTarget({\n project,\n filePath: `${config.getSkeletonPath()}/${componentName}.${config.getExt()}`,\n componentName,\n body: transformedHtml,\n });\n\n await db.set(key, {\n component: value.component,\n html: transformedHtml,\n hash,\n });\n });\n await Promise.all(entries);\n config.registry({ type: \"add\", components: db.getComponentNames() });\n await project.save();\n\n return c.json({\n sucess: true,\n });\n });\n\n serve(\n {\n fetch: app.fetch,\n port,\n },\n (info) => {\n log.info(`Server running at http://localhost:${info.port}`);\n },\n );\n}\n","import { access } from \"node:fs/promises\";\n\nexport default async function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n","export const CONFIG_PATH = \"skullmaster.config.json\";\n","import { cancel, isCancel, select, text } from \"@clack/prompts\";\nimport fileExists from \"./is-file-exists\";\nimport { readFile, writeFile } from \"fs/promises\";\nimport { CONFIG_PATH } from \"../constants\";\n\nexport type Preferences = {\n outDir: string;\n project: string;\n};\n\nexport default async function collectPreferences(): Promise<Preferences> {\n const isAlreadyInitialized = await fileExists(CONFIG_PATH);\n if (isAlreadyInitialized) {\n return JSON.parse(await readFile(`./${CONFIG_PATH}`, \"utf-8\"));\n }\n\n const outDir = await text({\n message: \"Where do you want to output the generated files?\",\n placeholder: \"src/skeletons\",\n initialValue: \"src/skeletons\",\n validate(value) {\n if (value?.length === 0) return `Value is required!`;\n },\n });\n if (isCancel(outDir)) {\n cancel(\"Operation cancelled.\");\n process.exit(0);\n }\n\n const projectType = await select({\n message: \"Pick a project type.\",\n initialValue: \"react-ts\",\n options: [\n { value: \"react-ts\", label: \"React with TypeScript\" },\n { value: \"react-js\", label: \"React\" },\n ],\n });\n\n if (isCancel(projectType)) {\n cancel(\"Operation cancelled.\");\n process.exit(0);\n }\n\n const preferences = {\n outDir,\n project: projectType.toString(),\n };\n await writeFile(`./${CONFIG_PATH}`, JSON.stringify(preferences, null, 2), \"utf-8\");\n\n return preferences;\n}\n","import { SourceFile } from \"ts-morph\";\n\nexport function ensureLazyImport(sourceFile: SourceFile) {\n const reactImport = sourceFile.getImportDeclaration(\n (d) => d.getModuleSpecifierValue() === \"react\",\n );\n\n if (!reactImport) {\n sourceFile.addImportDeclaration({\n moduleSpecifier: \"react\",\n namedImports: [\"lazy\"],\n });\n\n return;\n }\n\n const hasLazy = reactImport.getNamedImports().some((i) => i.getName() === \"lazy\");\n\n if (!hasLazy) {\n reactImport.addNamedImport(\"lazy\");\n }\n}\n","import { Project, SyntaxKind } from \"ts-morph\";\nimport { writeFile } from \"node:fs/promises\";\nimport { ensureLazyImport } from \"./ensure-lazy-imports\";\n\nexport async function generateInitialRegistry(outDir: string, projectType: string) {\n const isTs = projectType.endsWith(\"ts\");\n\n const ext = isTs ? \"tsx\" : \"jsx\";\n\n const skeletonPropsType = isTs\n ? `\ntype SkeletonProps = {\n name: string;\n};\n`\n : \"\";\n\n await writeFile(\n `${outDir}/registry.${ext}`,\n `\n/* eslint-disable */\n/* oxlint-disable */\n/* biome-ignore-all lint */\n/* @ts-nocheck */\n\n /**\n * Auto-generated by Skullmaster.\n *\n * Do not edit this file manually.\n * Use Skullmaster commands to add, update, or remove skeletons.\n *\n * To remove unused skeletons:\n * pnpm skeleton prune\n */\n\n\nimport DefaultBone from \"./skeletons/DefaultBone\";\n\nconst registry${isTs ? \": Record<string, any>\" : \"\"} = {};\n\n${skeletonPropsType}\n\nexport default function Skeleton({\n name,\n}${isTs ? \": SkeletonProps\" : \"\"}) {\n const Component = registry[name];\n\n if (!Component) {\n return <DefaultBone />;\n }\n\n return <Component />;\n}\n`,\n \"utf8\",\n );\n}\n\nexport type RegistryOperation =\n | { type: \"init\"; components: string[] }\n | { type: \"add\"; components: string[] };\n\nexport async function generateRegistry(\n operation: RegistryOperation,\n isTs: boolean,\n registryPath: string,\n) {\n let project: Project;\n if (isTs) {\n project = new Project({\n tsConfigFilePath: \"tsconfig.json\",\n });\n } else {\n project = new Project();\n }\n\n const sourceFile = project.addSourceFileAtPath(registryPath);\n\n ensureLazyImport(sourceFile);\n\n const registry = sourceFile\n .getVariableDeclaration(\"registry\")\n ?.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);\n\n if (!registry) {\n throw new Error(\"Unable to locate registry object, have you ran skullmaster init??\");\n }\n\n const existingComponents = new Set(\n registry\n .getProperties()\n .filter((property) => property.getKind() === SyntaxKind.PropertyAssignment)\n .map((property) => property.asKindOrThrow(SyntaxKind.PropertyAssignment))\n .map((property) => property.getName().replace(/['\"]/g, \"\")),\n );\n\n for (const component of operation.components) {\n if (existingComponents.has(component)) {\n continue;\n }\n\n registry.addPropertyAssignment({\n name: `\"${component}\"`,\n initializer: `lazy(() => import(\"./skeletons/${component}\"))`,\n });\n }\n\n sourceFile.formatText();\n\n await sourceFile.save();\n\n project.saveSync();\n}\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport z from \"zod\";\nimport fileExists from \"./is-file-exists\";\nimport { fnv1a } from \"../utils/fnv1a\";\nimport { SkeletonCacheEntrySchema } from \"../shared\";\n\nexport type CacheOperation =\n | { type: \"replace\"; cacheEntry: z.infer<typeof SkeletonCacheEntrySchema> }\n | { type: \"delete\"; componentName: string }\n | {\n type: \"update\";\n componentName: string;\n payload: z.infer<typeof SkeletonCacheEntrySchema>[string];\n };\n\nexport async function updateCacheRegistry(operation: CacheOperation, outDir: string) {\n const cacheFilePath = outDir;\n let cacheEntries: z.infer<typeof SkeletonCacheEntrySchema> = {};\n if (!(await fileExists(cacheFilePath))) {\n await writeFile(cacheFilePath, JSON.stringify({}), \"utf8\");\n } else {\n cacheEntries = SkeletonCacheEntrySchema.parse(\n JSON.parse(await readFile(cacheFilePath, \"utf8\")),\n );\n }\n switch (operation.type) {\n case \"replace\":\n await writeFile(cacheFilePath, JSON.stringify(operation.cacheEntry), \"utf8\");\n break;\n case \"delete\":\n delete cacheEntries[operation.componentName];\n await writeFile(cacheFilePath, JSON.stringify(cacheEntries), \"utf8\");\n break;\n case \"update\":\n cacheEntries[operation.componentName] = {\n ...operation.payload,\n hash: fnv1a(operation.payload.html).toString(),\n };\n await writeFile(cacheFilePath, JSON.stringify(cacheEntries), \"utf8\");\n }\n}\n","import { writeFile } from \"node:fs/promises\";\n\nexport default async function defaultBone(target: string) {\n await writeFile(\n target,\n `/* eslint-disable */\n/* oxlint-disable */\n/* biome-ignore-all lint */\n/* @ts-nocheck */\n\n/**\n * Auto-generated by Skullmaster.\n *\n * This is the default fallback skeleton component displayed when a\n * matching skeleton implementation cannot be found in the registry.\n *\n * You may freely customize or replace this component to match the\n * loading experience of your application.\n */\nexport default function DefaultBone() {\n return <div>loading...</div>;\n}\n`,\n \"utf8\",\n );\n}\n","import { mkdirSync, writeFileSync } from \"node:fs\";\nimport fileExists from \"./is-file-exists\";\nimport { generateInitialRegistry, generateRegistry, type RegistryOperation } from \"./registry\";\nimport { updateCacheRegistry, type CacheOperation } from \"./cache-registry\";\nimport defaultBone from \"./default-bone\";\nimport { log } from \"../shared\";\n\nexport class Config {\n outDir: string;\n projectType: string;\n\n constructor(outDir: string, projectType: string) {\n this.outDir = outDir;\n this.projectType = projectType;\n }\n async initialize() {\n log.info(\"Initializing project structure...\");\n if (!(await fileExists(this.outDir))) {\n mkdirSync(this.outDir, { recursive: true });\n log.success(`Created output directory: ${this.outDir}`);\n } else {\n log.gray(`Output directory exists: ${this.outDir}`);\n }\n const skeletonsDirectoryPath = this.getSkeletonPath();\n if (!(await fileExists(skeletonsDirectoryPath))) {\n mkdirSync(skeletonsDirectoryPath, { recursive: true });\n log.success(`Created skeletons directory: ${skeletonsDirectoryPath}`);\n } else {\n log.gray(`Skeletons directory exists: ${skeletonsDirectoryPath}`);\n }\n const registryFilePath = this.getRegistryPath();\n if (!(await fileExists(registryFilePath))) {\n await generateInitialRegistry(this.outDir, this.projectType);\n log.success(`Created registry: ${registryFilePath}`);\n } else {\n log.gray(`Registry exists: ${registryFilePath}`);\n }\n const cachePath = this.getCachePath();\n if (!(await fileExists(cachePath))) {\n writeFileSync(cachePath, JSON.stringify({}), \"utf8\");\n log.success(`Created cache: ${cachePath}`);\n } else {\n log.gray(`Cache exists: ${cachePath}`);\n }\n const defaultBonePath = this.getDefSkeletonPath();\n if (!(await fileExists(defaultBonePath))) {\n await defaultBone(defaultBonePath);\n log.success(`Created default bone: ${defaultBonePath}`);\n } else {\n log.gray(`Default bone exists: ${defaultBonePath}`);\n }\n log.success(\"Initialization complete\");\n }\n async cache(op: CacheOperation) {\n return await updateCacheRegistry(op, this.getCachePath());\n }\n async registry(op: RegistryOperation) {\n return generateRegistry(op, this.projectType.endsWith(\"ts\"), this.getRegistryPath());\n }\n getCachePath() {\n return `${this.outDir}/cache.json`;\n }\n getSkeletonPath() {\n return `${this.outDir}/skeletons`;\n }\n getDefSkeletonPath() {\n return `${this.getSkeletonPath()}/DefaultBone.${this.getExt()}`;\n }\n getExt() {\n return this.projectType.endsWith(\"ts\") ? \"tsx\" : \"jsx\";\n }\n getRegistryPath() {\n return `${this.outDir}/registry.${this.getExt()}`;\n }\n}\n","#!/usr/bin/env node\n\nimport { cac } from \"cac\";\nimport { serveCommand } from \"./commands/serve\";\nimport collectPreferences from \"./init/collect-preferences\";\nimport { Config } from \"./init/preferences\";\nimport { DEFAULT_PORT } from \"./shared\";\n\nconst cli = cac(\"💀\");\n\ncli\n .command(\"serve\", \"Start 💀 dev server\")\n .option(\"--port <port>\", \"Port\", {\n default: DEFAULT_PORT,\n })\n .action(async (options) => {\n const preferences = await collectPreferences();\n const config = new Config(preferences.outDir, preferences.project);\n await config.initialize();\n await serveCommand(config, Number(options.port));\n });\n\ncli.help();\ncli.parse();\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,MAAa,eAAe;;;ACE5B,MAAa,6BAA6B,EAAE,OAC1C,EAAE,OAAO,GACT,EAAE,OAAO;CACP,WAAW,EAAE,OAAO;CACpB,MAAM,EAAE,OAAO;AACjB,CAAC,CACH;AAEA,MAAa,2BAA2B,EAAE,OACxC,EAAE,OAAO,GACT,EAAE,OAAO;CACP,WAAW,EAAE,OAAO;CACpB,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;AACjB,CAAC,CACH;;;ACjBA,MAAa,MAAM;CACjB,UAAU,YAAoB,QAAQ,IAAI,gBAAgB,QAAQ,QAAQ;CAC1E,OAAO,YAAoB,QAAQ,IAAI,gBAAgB,QAAQ,QAAQ;CACvE,OAAO,YAAoB,QAAQ,IAAI,gBAAgB,QAAQ,QAAQ;CACvE,QAAQ,YAAoB,QAAQ,IAAI,gBAAgB,QAAQ,QAAQ;CACxE,OAAO,YAAoB,QAAQ,IAAI,gBAAgB,QAAQ,QAAQ;AACzE;;;ACFA,IAAa,kBAAb,MAAa,gBAAgB;CAC3B,OAAmC,CAAC;CACpC;CACA,YAAoB,QAAgB;EAClC,KAAK,SAAS;CAChB;CAEA,aAAa,OAAO,QAAgB;EAClC,MAAM,KAAK,IAAI,gBAAgB,MAAM;EAErC,MAAM,GAAG,KAAK;EAEd,OAAO;CACT;CAEA,MAAc,OAAO;EACnB,IAAI;GACF,MAAM,OAAO,MAAM,SAAS,KAAK,OAAO,aAAa,GAAG,MAAM;GAE9D,MAAM,SAAS,KAAK,MAAM,IAAI;GAE9B,KAAK,OAAO,yBAAyB,MAAM,MAAM;EACnD,QAAQ;GACN,KAAK,OA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"file":"cli.mjs","names":["htmlNodeToJsx","readFile","writeFile"],"sources":["../src/shared/constants.ts","../src/shared/schema.ts","../src/shared/log.ts","../src/cache/index.ts","../src/generate-target/index.ts","../../excarnate/dist/index.mjs","../src/transform/index.ts","../src/utils/to-pascal-case.ts","../src/utils/fnv1a.ts","../src/commands/serve.ts","../src/init/is-file-exists.ts","../src/constants.ts","../src/init/collect-preferences.ts","../src/init/ensure-lazy-imports.ts","../src/init/registry.ts","../src/init/cache-registry.ts","../src/init/default-bone.ts","../src/init/preferences.ts","../src/cli.ts"],"sourcesContent":["export const DEFAULT_PORT = 8008;\nexport const EMPTY_SET_DEFAULT_DIR = \"skullmaster\";\nexport const DATA_NAT_H = \"data-natural-h\";\nexport const DATA_NAT_W = \"data-natural-w\";\n","import z from \"zod\";\n\nexport const SkeletonPayloadInputSchema = z.record(\n z.string(),\n z.object({\n component: z.string(),\n html: z.string(),\n }),\n);\n\nexport const SkeletonCacheEntrySchema = z.record(\n z.string(),\n z.object({\n component: z.string(),\n html: z.string(),\n hash: z.string(),\n }),\n);\n\nexport type SkeletonPayloadInput = z.infer<typeof SkeletonPayloadInputSchema>;\n\nexport type SkeletonCacheEntry = z.infer<typeof SkeletonCacheEntrySchema>;\n","export const log = {\n success: (message: string) => console.log(`\\x1b[32m[💀] ${message}\\x1b[0m`),\n info: (message: string) => console.log(`\\x1b[36m[💀] ${message}\\x1b[0m`),\n warn: (message: string) => console.log(`\\x1b[33m[💀] ${message}\\x1b[0m`),\n error: (message: string) => console.log(`\\x1b[31m[💀] ${message}\\x1b[0m`),\n gray: (message: string) => console.log(`\\x1b[90m[💀] ${message}\\x1b[0m`),\n};\n","import { readFile } from \"node:fs/promises\";\nimport type { Config } from \"../init/preferences\";\nimport { type SkeletonCacheEntry, SkeletonCacheEntrySchema } from \"../shared\";\n\nexport class SkeletonCacheDB {\n private data: SkeletonCacheEntry = {};\n config: Config;\n private constructor(config: Config) {\n this.config = config;\n }\n\n static async create(config: Config) {\n const db = new SkeletonCacheDB(config);\n\n await db.load();\n\n return db;\n }\n\n private async load() {\n try {\n const file = await readFile(this.config.getCachePath(), \"utf8\");\n\n const parsed = JSON.parse(file);\n\n this.data = SkeletonCacheEntrySchema.parse(parsed);\n } catch {\n this.data = {};\n\n await this.config.cache({ type: \"replace\", cacheEntry: {} });\n }\n }\n\n get(key: string) {\n return this.data[key];\n }\n getComponentNames(): string[] {\n return Object.values(this.data).map((entry) => entry.component);\n }\n\n async set(key: string, value: SkeletonCacheEntry[string]) {\n this.data[key] = value;\n this.config.cache({ type: \"update\", componentName: key, payload: value });\n }\n}\n","import { Project, QuoteKind, ScriptKind } from \"ts-morph\";\n\ntype GenerateTargetOptions = {\n project: Project;\n filePath: string;\n componentName: string;\n body: string;\n};\n\nexport default function generateTarget({\n project,\n filePath,\n componentName,\n body,\n}: GenerateTargetOptions) {\n project.manipulationSettings.set({\n quoteKind: QuoteKind.Double,\n });\n\n const file = project.createSourceFile(filePath, \"\", {\n overwrite: true,\n scriptKind: ScriptKind.TSX,\n });\n\n file.insertText(\n 0,\n `/* eslint-disable */\n/* prettier-ignore-start */\n\n/**\n * Auto-generated by Skullmaster.\n *\n * DO NOT EDIT THIS FILE MANUALLY.\n * Changes may be overwritten on the next generation.\n */\n\n`,\n );\n\n file.addFunction({\n name: componentName,\n isDefaultExport: true,\n statements: [`return (${body});`],\n });\n\n file.addStatements(`\n/* prettier-ignore-end */\n`);\n}\n","import * as t from \"@babel/types\";\nimport { jsxText } from \"@babel/types\";\n//#region src/executor.ts\nfunction buildExecutor(rules) {\n\treturn (ctx) => {\n\t\tlet current = ctx;\n\t\tfor (const rule of rules) {\n\t\t\tif (!rule.match(current)) continue;\n\t\t\tcurrent = rule.transform(current);\n\t\t\tif (rule.skipAllRest) break;\n\t\t}\n\t\treturn current;\n\t};\n}\n//#endregion\n//#region src/helpers/sanitize-attr-value.ts\nfunction sanitizeAttrValue(value) {\n\treturn value.replace(/\"/g, \"'\").replace(/\\\\/g, \"/\");\n}\n//#endregion\n//#region src/helpers/jsx.ts\nfunction createJsxStringAttribute(name, value) {\n\treturn t.jsxAttribute(t.jsxIdentifier(name), t.stringLiteral(sanitizeAttrValue(value)));\n}\nfunction createJsxExpressionAttribute(name, expression) {\n\treturn t.jsxAttribute(t.jsxIdentifier(name), t.jsxExpressionContainer(expression));\n}\nfunction findJsxAttribute(attributes, name) {\n\treturn attributes.find((attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name);\n}\nfunction findStringJsxAttribute(attributes, name) {\n\tconst attr = findJsxAttribute(attributes, name);\n\tif (!attr?.value || !t.isStringLiteral(attr.value)) return;\n\treturn attr;\n}\nfunction createJsxElement(tagName, children, attributes = []) {\n\treturn t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier(tagName), attributes, false), t.jsxClosingElement(t.jsxIdentifier(tagName)), children, false);\n}\n//#endregion\n//#region src/constants.ts\nconst DEPTH_ATTRIBUTE = \"data-depth\";\nconst TEXT_CLASSNAME = \"empty-set__text\";\nconst SKELETON_CLASSNAME = \"empty-set__skeleton\";\n//#endregion\n//#region src/exceptions/target-mismatch.ts\nvar TargetElementMismatchError = class extends Error {\n\tconstructor(expected, actual) {\n\t\tsuper(`Expected target element to be ${expected}, but got ${actual}`);\n\t\tthis.name = \"TargetElementMismatchError\";\n\t}\n};\n//#endregion\n//#region src/helpers/attribute-replace-map.ts\nconst ATTRIBUTE_MAP = {\n\tclass: \"className\",\n\tfor: \"htmlFor\",\n\ttabindex: \"tabIndex\",\n\treadonly: \"readOnly\",\n\tmaxlength: \"maxLength\",\n\tminlength: \"minLength\",\n\tcolspan: \"colSpan\",\n\trowspan: \"rowSpan\",\n\tcontenteditable: \"contentEditable\",\n\tautocapitalize: \"autoCapitalize\",\n\tautocomplete: \"autoComplete\",\n\tautofocus: \"autoFocus\",\n\tspellcheck: \"spellCheck\",\n\tcrossorigin: \"crossOrigin\",\n\treferrerpolicy: \"referrerPolicy\",\n\tstrokewidth: \"strokeWidth\",\n\t\"stroke-width\": \"strokeWidth\",\n\tstrokelinecap: \"strokeLinecap\",\n\t\"stroke-linecap\": \"strokeLinecap\",\n\tstrokelinejoin: \"strokeLinejoin\",\n\t\"stroke-linejoin\": \"strokeLinejoin\",\n\tstrokemiterlimit: \"strokeMiterlimit\",\n\t\"stroke-miterlimit\": \"strokeMiterlimit\",\n\tstrokedasharray: \"strokeDasharray\",\n\t\"stroke-dasharray\": \"strokeDasharray\",\n\tstrokedashoffset: \"strokeDashoffset\",\n\t\"stroke-dashoffset\": \"strokeDashoffset\",\n\tstrokeopacity: \"strokeOpacity\",\n\t\"stroke-opacity\": \"strokeOpacity\",\n\tfillopacity: \"fillOpacity\",\n\t\"fill-opacity\": \"fillOpacity\",\n\tfillrule: \"fillRule\",\n\t\"fill-rule\": \"fillRule\",\n\tcliprule: \"clipRule\",\n\t\"clip-rule\": \"clipRule\",\n\tclippath: \"clipPath\",\n\t\"clip-path\": \"clipPath\",\n\tstopcolor: \"stopColor\",\n\t\"stop-color\": \"stopColor\",\n\tstopopacity: \"stopOpacity\",\n\t\"stop-opacity\": \"stopOpacity\",\n\tviewbox: \"viewBox\",\n\txlinkhref: \"xlinkHref\",\n\t\"xlink:href\": \"xlinkHref\",\n\txmlspace: \"xmlSpace\",\n\t\"xml:space\": \"xmlSpace\"\n};\n//#endregion\n//#region src/helpers/attr-normalize.ts\nfunction normalizeAttributeName(name) {\n\tconst lower = name.toLowerCase();\n\tif (ATTRIBUTE_MAP[lower]) return ATTRIBUTE_MAP[lower];\n\tif (lower.startsWith(\"data-\") || lower.startsWith(\"aria-\")) return lower;\n\treturn name.replace(/-([a-z])/g, (_, char) => char.toUpperCase());\n}\n//#endregion\n//#region src/helpers/is-style.ts\nconst STYLE_ATTRIBUTES = /* @__PURE__ */ new Set([\n\t\"class\",\n\t\"style\",\n\t\"type\",\n\t\"fill\",\n\t\"fill-opacity\",\n\t\"fill-rule\",\n\t\"src\",\n\t\"stroke\",\n\t\"stroke-width\",\n\t\"stroke-opacity\",\n\t\"stroke-linecap\",\n\t\"stroke-linejoin\",\n\t\"stroke-dasharray\",\n\t\"stroke-dashoffset\",\n\t\"opacity\",\n\t\"role\",\n\t\"width\",\n\t\"height\",\n\t\"x\",\n\t\"y\",\n\t\"cx\",\n\t\"cy\",\n\t\"r\",\n\t\"rx\",\n\t\"ry\",\n\t\"viewbox\",\n\t\"transform\",\n\t\"d\",\n\t\"points\"\n]);\nfunction shouldKeepAttribute(name) {\n\tconst lowerName = name.toLowerCase();\n\treturn lowerName.startsWith(\"data-\") || lowerName.startsWith(\"aria-\") || STYLE_ATTRIBUTES.has(lowerName);\n}\n//#endregion\n//#region src/helpers/parse-style.ts\nfunction parseStyle(style) {\n\tconst properties = [];\n\tfor (const rule of style.split(\";\")) {\n\t\tconst trimmedRule = rule.trim();\n\t\tif (!trimmedRule) continue;\n\t\tconst colonIndex = trimmedRule.indexOf(\":\");\n\t\tif (colonIndex === -1) continue;\n\t\tconst rawKey = trimmedRule.slice(0, colonIndex).trim();\n\t\tconst rawValue = trimmedRule.slice(colonIndex + 1).trim();\n\t\tconst key = rawKey.replace(/-([a-z])/g, (_, char) => char.toUpperCase());\n\t\tconst keyNode = key.startsWith(\"--\") || key.includes(\"-\") ? t.stringLiteral(key) : t.identifier(key);\n\t\tproperties.push(t.objectProperty(keyNode, t.stringLiteral(rawValue)));\n\t}\n\treturn t.objectExpression(properties);\n}\n//#endregion\n//#region src/rules/populate-attrs.ts\nconst populateAttrs = {\n\tid: \"populate-attrs\",\n\tmatch: (ctx) => ctx.element.nodeType === 1,\n\ttransform: (ctx) => {\n\t\tconst element = ctx.element;\n\t\tconst attributes = [];\n\t\tconst tagName = element.tagName.toLowerCase();\n\t\tif (ctx.target?.element && ctx.target?.element !== tagName) throw new TargetElementMismatchError(tagName, ctx.target.element);\n\t\tif (!element.hasAttribute(\"data-depth\")) attributes.push(createJsxStringAttribute(DEPTH_ATTRIBUTE, String(ctx.depth)));\n\t\tfor (const attr of element.attributes) {\n\t\t\tif (!shouldKeepAttribute(attr.name)) continue;\n\t\t\tconst name = normalizeAttributeName(attr.name);\n\t\t\tconst value = attr.value;\n\t\t\tif (name === \"style\") {\n\t\t\t\tattributes.push(createJsxExpressionAttribute(\"style\", parseStyle(value)));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tattributes.push(createJsxStringAttribute(name, value));\n\t\t}\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\telement: tagName,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/matchers.ts\nconst atDepth = (depth) => (ctx) => ctx.depth === depth;\nconst isTagNamesIn = (elements) => (ctx) => ctx.element.nodeType === 1 && elements.includes(ctx.element.tagName.toLowerCase());\n//#endregion\n//#region src/rules/process-svg.ts\nconst processSvg = {\n\tid: \"process-svg\",\n\tskipAllRest: true,\n\tmatch: isTagNamesIn([\"svg\"]),\n\ttransform: (ctx) => {\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...ctx.target,\n\t\t\t\telement: \"svg\",\n\t\t\t\tchildren: []\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/remove-node.ts\nconst removeReduntantNode = {\n\tid: \"remove-node\",\n\tskipAllRest: true,\n\tmatch: isTagNamesIn([\n\t\t\"html\",\n\t\t\"script\",\n\t\t\"style\",\n\t\t\"head\",\n\t\t\"meta\",\n\t\t\"link\",\n\t\t\"noscript\",\n\t\t\"template\",\n\t\t\"audio\",\n\t\t\"video\",\n\t\t\"source\",\n\t\t\"track\",\n\t\t\"iframe\",\n\t\t\"embed\",\n\t\t\"object\",\n\t\t\"title\",\n\t\t\"base\",\n\t\t\"defs\",\n\t\t\"symbol\",\n\t\t\"html\",\n\t\t\"canvas\",\n\t\t\"map\",\n\t\t\"area\",\n\t\t\"picture\",\n\t\t\"portal\"\n\t]),\n\ttransform: (ctx) => {\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: null\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/root-skeleton-attrs.ts\nconst addRootSkeletonsAttrs = {\n\tid: \"add-root-skeleton-attrs\",\n\tmatch: (ctx) => ctx.element.nodeType === 1 && atDepth(0)(ctx),\n\ttransform: (ctx) => {\n\t\tconst tagName = ctx.element.tagName.toLowerCase();\n\t\tif (ctx.target?.element && ctx.target.element !== tagName) throw new TargetElementMismatchError(tagName, ctx.target.element);\n\t\tconst existingTarget = ctx.target ?? {\n\t\t\telement: tagName,\n\t\t\tattributes: []\n\t\t};\n\t\tconst existingAttrs = existingTarget.attributes ?? [];\n\t\tconst classNameAttr = findStringJsxAttribute(existingAttrs, \"className\");\n\t\tconst attributes = [...classNameAttr ? existingAttrs.map((attr) => attr === classNameAttr ? {\n\t\t\t...attr,\n\t\t\tvalue: {\n\t\t\t\t...classNameAttr.value,\n\t\t\t\tvalue: `${classNameAttr.value.value} ${SKELETON_CLASSNAME}`\n\t\t\t}\n\t\t} : attr) : [...existingAttrs, createJsxStringAttribute(\"className\", SKELETON_CLASSNAME)]];\n\t\tif (!findJsxAttribute(attributes, \"role\")) attributes.push(createJsxStringAttribute(\"role\", \"status\"));\n\t\tif (!findJsxAttribute(attributes, \"aria-live\")) attributes.push(createJsxStringAttribute(\"aria-live\", \"polite\"));\n\t\tif (!findJsxAttribute(attributes, \"aria-busy\")) attributes.push(createJsxStringAttribute(\"aria-busy\", \"true\"));\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...existingTarget,\n\t\t\t\telement: tagName,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/skip-node.ts\nconst skipNode = {\n\tid: \"skip-node\",\n\tskipAllRest: true,\n\tmatch: (ctx) => ctx.element.nodeType === 1 && ctx.element.hasAttribute(\"data-skip-skull\"),\n\ttransform: (ctx) => ({\n\t\t...ctx,\n\t\ttarget: null\n\t})\n};\n//#endregion\n//#region src/rules/transform-img.ts\nconst DATA_NAT_H = \"data-natural-h\";\nconst DATA_NAT_W = \"data-natural-w\";\nconst DATA_IMAGE_SKELETON = \"data-image-skeleton\";\nfunction createSkeletonSrc(width, height, color = \"#e5e7eb\") {\n\tconst w = Number(width) || 400;\n\tconst h = Number(height) || 300;\n\treturn `data:image/svg+xml,${encodeURIComponent(`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${w}\" height=\"${h}\" viewBox=\"0 0 ${w} ${h}\" preserveAspectRatio=\"none\"><rect width=\"100%\" height=\"100%\" fill=\"${color}\"/></svg>`)}`;\n}\nconst transformImg = {\n\tid: \"transform-img\",\n\tmatch: (ctx) => ctx.element.nodeType === 1 && ctx.element.tagName.toLowerCase() === \"img\",\n\ttransform: (ctx) => {\n\t\tif (!ctx.target) throw new Error(\"Target must be defined before transforming an image element.\");\n\t\tconst attrs = ctx.target.attributes ?? [];\n\t\tconst naturalWidthAttr = findStringJsxAttribute(attrs, DATA_NAT_W);\n\t\tconst naturalHeightAttr = findStringJsxAttribute(attrs, DATA_NAT_H);\n\t\tconst naturalWidth = naturalWidthAttr?.value?.value;\n\t\tconst naturalHeight = naturalHeightAttr?.value?.value;\n\t\tconst placeholderSrc = createSkeletonSrc(naturalWidth, naturalHeight);\n\t\tconst attributes = [\n\t\t\t...attrs.filter((attr) => {\n\t\t\t\tif (!t.isJSXAttribute(attr)) return false;\n\t\t\t\tconst name = t.isJSXIdentifier(attr.name) ? attr.name.name : void 0;\n\t\t\t\treturn ![\n\t\t\t\t\t\"src\",\n\t\t\t\t\t\"srcSet\",\n\t\t\t\t\t\"sizes\",\n\t\t\t\t\t\"loading\",\n\t\t\t\t\t\"decoding\",\n\t\t\t\t\t\"fetchPriority\",\n\t\t\t\t\tDATA_NAT_W,\n\t\t\t\t\tDATA_NAT_H,\n\t\t\t\t\tDATA_IMAGE_SKELETON\n\t\t\t\t].includes(name ?? \"\");\n\t\t\t}),\n\t\t\tcreateJsxStringAttribute(\"src\", placeholderSrc),\n\t\t\tcreateJsxStringAttribute(DATA_IMAGE_SKELETON, \"true\")\n\t\t];\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...ctx.target,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/rules/transform-interactive.ts\nconst INTERACTIVE_TAGS = /* @__PURE__ */ new Set([\n\t\"input\",\n\t\"textarea\",\n\t\"select\",\n\t\"option\",\n\t\"optgroup\",\n\t\"button\",\n\t\"label\",\n\t\"fieldset\",\n\t\"legend\",\n\t\"output\",\n\t\"datalist\",\n\t\"a\",\n\t\"details\",\n\t\"summary\",\n\t\"audio\",\n\t\"video\",\n\t\"iframe\",\n\t\"embed\",\n\t\"object\",\n\t\"dialog\"\n]);\nconst INTERACTIVE_ROLES = /* @__PURE__ */ new Set([\n\t\"button\",\n\t\"link\",\n\t\"tab\",\n\t\"menuitem\",\n\t\"checkbox\",\n\t\"radio\",\n\t\"switch\",\n\t\"option\",\n\t\"combobox\",\n\t\"textbox\",\n\t\"searchbox\",\n\t\"slider\",\n\t\"spinbutton\",\n\t\"listbox\",\n\t\"treeitem\",\n\t\"gridcell\",\n\t\"rowheader\",\n\t\"columnheader\"\n]);\nconst ARIA_ATTRIBUTES_TO_REMOVE = /* @__PURE__ */ new Set([\n\t\"role\",\n\t\"aria-label\",\n\t\"aria-labelledby\",\n\t\"aria-describedby\",\n\t\"aria-controls\",\n\t\"aria-expanded\",\n\t\"aria-haspopup\",\n\t\"aria-pressed\",\n\t\"aria-selected\",\n\t\"aria-checked\",\n\t\"aria-current\",\n\t\"contenteditable\",\n\t\"tabindex\",\n\t\"aria-hidden\",\n\t\"data-skeleton-interactive\"\n]);\nconst transformInteractiveElements = {\n\tid: \"transform-interactive-elements\",\n\tmatch: (ctx) => {\n\t\tif (ctx.element.nodeType !== 1) return false;\n\t\tconst element = ctx.element;\n\t\tconst tag = element.tagName.toLowerCase();\n\t\tif (INTERACTIVE_TAGS.has(tag)) return true;\n\t\tconst role = element.getAttribute(\"role\")?.toLowerCase();\n\t\tif (role && INTERACTIVE_ROLES.has(role)) return true;\n\t\tif (element.hasAttribute(\"contenteditable\")) return true;\n\t\tif (element.hasAttribute(\"tabindex\")) return true;\n\t\treturn false;\n\t},\n\ttransform: (ctx) => {\n\t\tif (!ctx.target) return ctx;\n\t\tconst attributes = (ctx.target.attributes ?? []).filter((attribute) => {\n\t\t\tconst name = attribute.type === \"JSXAttribute\" && attribute.name?.name ? String(attribute.name.name).toLowerCase() : \"\";\n\t\t\treturn !ARIA_ATTRIBUTES_TO_REMOVE.has(name);\n\t\t});\n\t\tattributes.push(createJsxStringAttribute(\"data-skeleton-interactive\", \"true\"), createJsxStringAttribute(\"aria-hidden\", \"true\"), createJsxExpressionAttribute(\"tabIndex\", t.numericLiteral(-1)));\n\t\treturn {\n\t\t\t...ctx,\n\t\t\ttarget: {\n\t\t\t\t...ctx.target,\n\t\t\t\tattributes\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region src/helpers/hash.ts\nfunction spacePreservedObfuscator(input) {\n\tif (!input) return null;\n\treturn [...input].map((char) => char === \" \" ? \" \" : \"█\").join(\"\");\n}\n//#endregion\n//#region src/index.ts\nconst executor = buildExecutor([\n\tskipNode,\n\t{\n\t\tid: \"transform-text\",\n\t\tskipAllRest: true,\n\t\tmatch: (ctx) => ctx.element.nodeType === 3,\n\t\ttransform: (ctx) => {\n\t\t\tconst text = spacePreservedObfuscator(ctx.element.textContent?.trim());\n\t\t\tif (!text) return ctx;\n\t\t\tconst isHeading = ctx.parentNode?.nodeName.toLowerCase().startsWith(\"h\");\n\t\t\tif (![\"p\", \"label\"].includes(ctx.parentNode?.nodeName.toLowerCase() ?? \"\") && !isHeading) return {\n\t\t\t\t...ctx,\n\t\t\t\ttarget: {\n\t\t\t\t\telement: \"TEXT\",\n\t\t\t\t\tchildren: [jsxText(text)]\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn {\n\t\t\t\t...ctx,\n\t\t\t\ttarget: {\n\t\t\t\t\telement: \"span\",\n\t\t\t\t\tattributes: [\n\t\t\t\t\t\tcreateJsxStringAttribute(\"className\", TEXT_CLASSNAME),\n\t\t\t\t\t\tcreateJsxStringAttribute(\"data-text-node\", \"true\"),\n\t\t\t\t\t\tcreateJsxStringAttribute(DEPTH_ATTRIBUTE, ctx.parentDepth ?? String(ctx.depth))\n\t\t\t\t\t],\n\t\t\t\t\tchildren: [jsxText(text)]\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t},\n\tremoveReduntantNode,\n\tpopulateAttrs,\n\tprocessSvg,\n\ttransformImg,\n\ttransformInteractiveElements,\n\taddRootSkeletonsAttrs\n]);\nfunction excarnate(element, depth, parentNode = null, parentDepth) {\n\tconst target = executor({\n\t\telement,\n\t\tdepth,\n\t\tparentNode,\n\t\tparentDepth\n\t}).target;\n\tif (!target) return null;\n\tconst { children, element: tagName, attributes } = target;\n\tif (tagName === \"TEXT\") return children?.[0] ?? null;\n\tif (children) return createJsxElement(tagName, children, attributes);\n\tconst { childNodes } = element ?? { childNodes: [] };\n\treturn createJsxElement(tagName, Array.from(childNodes).map((child) => excarnate(child, depth + 1, element, depth.toString())).filter(Boolean), attributes);\n}\n//#endregion\nexport { excarnate as default };\n\n//# sourceMappingURL=index.mjs.map","import { JSDOM } from \"jsdom\";\nimport pkg from \"@babel/generator\";\n\n// @ts-ignore\nconst generate = pkg.default;\n\nimport htmlNodeToJsx from \"@skullmaster/excarnate\";\n\nexport function transformInput(html: string) {\n const dom = new JSDOM(html);\n\n const root = dom.window.document.body.firstElementChild;\n\n if (!root) {\n throw new Error(\"No root element found\");\n }\n\n const jsxAst = htmlNodeToJsx(root, 0);\n\n if (!jsxAst) {\n throw new Error(\"Failed to generate JSX AST\");\n }\n\n const result = generate(jsxAst, {\n jsescOption: {\n minimal: true,\n },\n });\n\n return result.code;\n}\n","export function toPascalCase(input: string): string {\n return input\n .trim()\n .replace(/['\"]/g, \"\")\n .split(/[^a-zA-Z0-9]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\"\");\n}\n","export function fnv1a(str: string): number {\n let hash = 0x811c9dc5;\n\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193);\n }\n\n return hash >>> 0;\n}\n","import { serve } from \"@hono/node-server\";\nimport { Hono } from \"hono\";\nimport { cors } from \"hono/cors\";\nimport { Project } from \"ts-morph\";\nimport { SkeletonCacheDB } from \"../cache\";\nimport generateTarget from \"../generate-target\";\nimport { transformInput } from \"../transform\";\nimport { toPascalCase } from \"../utils/to-pascal-case\";\nimport { fnv1a } from \"../utils/fnv1a\";\nimport type { Config } from \"../init/preferences\";\nimport { log, SkeletonPayloadInputSchema } from \"../shared\";\n\nexport async function serveCommand(config: Config, port: number) {\n const app = new Hono();\n\n app.use(\n \"*\",\n cors({\n origin: \"*\",\n allowMethods: [\"GET\", \"POST\", \"OPTIONS\"],\n allowHeaders: [\"Content-Type\", \"Authorization\"],\n }),\n );\n\n const db = await SkeletonCacheDB.create(config);\n\n app.get(\"/health\", (c) => {\n return c.json({\n ok: true,\n });\n });\n\n app.post(\"/skeletons\", async (c) => {\n const body = await c.req.json();\n\n const result = SkeletonPayloadInputSchema.parse(body);\n\n const project = new Project();\n const entries = Object.entries(result).map(async ([key, value]) => {\n const componentName = toPascalCase(value.component);\n const transformedHtml = transformInput(value.html);\n const hash = fnv1a(transformedHtml).toString();\n const cached = db.get(key);\n const shouldSkip = cached && cached.hash === hash;\n\n if (shouldSkip) {\n return;\n }\n\n generateTarget({\n project,\n filePath: `${config.getSkeletonPath()}/${componentName}.${config.getExt()}`,\n componentName,\n body: transformedHtml,\n });\n\n await db.set(key, {\n component: value.component,\n html: transformedHtml,\n hash,\n });\n });\n await Promise.all(entries);\n config.registry({ type: \"add\", components: db.getComponentNames() });\n await project.save();\n\n return c.json({\n sucess: true,\n });\n });\n\n serve(\n {\n fetch: app.fetch,\n port,\n },\n (info) => {\n log.info(`Server running at http://localhost:${info.port}`);\n },\n );\n}\n","import { access } from \"node:fs/promises\";\n\nexport default async function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n","export const CONFIG_PATH = \"skullmaster.config.json\";\n","import { cancel, isCancel, select, text } from \"@clack/prompts\";\nimport fileExists from \"./is-file-exists\";\nimport { readFile, writeFile } from \"fs/promises\";\nimport { CONFIG_PATH } from \"../constants\";\n\nexport type Preferences = {\n outDir: string;\n project: string;\n};\n\nexport default async function collectPreferences(): Promise<Preferences> {\n const isAlreadyInitialized = await fileExists(CONFIG_PATH);\n if (isAlreadyInitialized) {\n return JSON.parse(await readFile(`./${CONFIG_PATH}`, \"utf-8\"));\n }\n\n const outDir = await text({\n message: \"Where do you want to output the generated files?\",\n placeholder: \"src/skeletons\",\n initialValue: \"src/skeletons\",\n validate(value) {\n if (value?.length === 0) return `Value is required!`;\n },\n });\n if (isCancel(outDir)) {\n cancel(\"Operation cancelled.\");\n process.exit(0);\n }\n\n const projectType = await select({\n message: \"Pick a project type.\",\n initialValue: \"react-ts\",\n options: [\n { value: \"react-ts\", label: \"React with TypeScript\" },\n { value: \"react-js\", label: \"React\" },\n ],\n });\n\n if (isCancel(projectType)) {\n cancel(\"Operation cancelled.\");\n process.exit(0);\n }\n\n const preferences = {\n outDir,\n project: projectType.toString(),\n };\n await writeFile(`./${CONFIG_PATH}`, JSON.stringify(preferences, null, 2), \"utf-8\");\n\n return preferences;\n}\n","import { SourceFile } from \"ts-morph\";\n\nexport function ensureLazyImport(sourceFile: SourceFile) {\n const reactImport = sourceFile.getImportDeclaration(\n (d) => d.getModuleSpecifierValue() === \"react\",\n );\n\n if (!reactImport) {\n sourceFile.addImportDeclaration({\n moduleSpecifier: \"react\",\n namedImports: [\"lazy\"],\n });\n\n return;\n }\n\n const hasLazy = reactImport.getNamedImports().some((i) => i.getName() === \"lazy\");\n\n if (!hasLazy) {\n reactImport.addNamedImport(\"lazy\");\n }\n}\n","import { Project, SyntaxKind } from \"ts-morph\";\nimport { writeFile } from \"node:fs/promises\";\nimport { ensureLazyImport } from \"./ensure-lazy-imports\";\nimport { toPascalCase } from \"../utils/to-pascal-case\";\n\nexport async function generateInitialRegistry(outDir: string, projectType: string) {\n const isTs = projectType.endsWith(\"ts\");\n\n const ext = isTs ? \"tsx\" : \"jsx\";\n\n const skeletonPropsType = isTs\n ? `\nimport \"@skullmaster/react/style.css\"\n\ntype SkeletonProps = {\n name: string;\n};\n`\n : \"\";\n\n await writeFile(\n `${outDir}/registry.${ext}`,\n `\n/* eslint-disable */\n/* oxlint-disable */\n/* biome-ignore-all lint */\n/* @ts-nocheck */\n\n /**\n * Auto-generated by Skullmaster.\n *\n * Do not edit this file manually.\n * Use Skullmaster commands to add, update, or remove skeletons.\n *\n * To remove unused skeletons:\n * pnpm skeleton prune\n */\n\n\nimport DefaultBone from \"./skeletons/DefaultBone\";\n\nconst registry${isTs ? \": Record<string, any>\" : \"\"} = {};\n\n${skeletonPropsType}\n\nexport default function Skeleton({\n name,\n}${isTs ? \": SkeletonProps\" : \"\"}) {\n const Component = registry[name];\n\n if (!Component) {\n return <DefaultBone />;\n }\n\n return <Component />;\n}\n`,\n \"utf8\",\n );\n}\n\nexport type RegistryOperation =\n | { type: \"init\"; components: string[] }\n | { type: \"add\"; components: string[] };\n\nexport async function generateRegistry(\n operation: RegistryOperation,\n isTs: boolean,\n registryPath: string,\n) {\n let project: Project;\n if (isTs) {\n project = new Project({\n tsConfigFilePath: \"tsconfig.json\",\n });\n } else {\n project = new Project();\n }\n\n const sourceFile = project.addSourceFileAtPath(registryPath);\n\n ensureLazyImport(sourceFile);\n\n const registry = sourceFile\n .getVariableDeclaration(\"registry\")\n ?.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);\n\n if (!registry) {\n throw new Error(\"Unable to locate registry object, have you ran skullmaster init??\");\n }\n\n const existingComponents = new Set(\n registry\n .getProperties()\n .filter((property) => property.getKind() === SyntaxKind.PropertyAssignment)\n .map((property) => property.asKindOrThrow(SyntaxKind.PropertyAssignment))\n .map((property) => property.getName().replace(/['\"]/g, \"\")),\n );\n\n for (let component of operation.components) {\n component = toPascalCase(component);\n if (existingComponents.has(component)) {\n continue;\n }\n\n registry.addPropertyAssignment({\n name: `\"${component}\"`,\n initializer: `lazy(() => import(\"./skeletons/${component}\"))`,\n });\n }\n\n sourceFile.formatText();\n\n await sourceFile.save();\n\n project.saveSync();\n}\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport z from \"zod\";\nimport fileExists from \"./is-file-exists\";\nimport { fnv1a } from \"../utils/fnv1a\";\nimport { SkeletonCacheEntrySchema } from \"../shared\";\n\nexport type CacheOperation =\n | { type: \"replace\"; cacheEntry: z.infer<typeof SkeletonCacheEntrySchema> }\n | { type: \"delete\"; componentName: string }\n | {\n type: \"update\";\n componentName: string;\n payload: z.infer<typeof SkeletonCacheEntrySchema>[string];\n };\n\nexport async function updateCacheRegistry(operation: CacheOperation, outDir: string) {\n const cacheFilePath = outDir;\n let cacheEntries: z.infer<typeof SkeletonCacheEntrySchema> = {};\n if (!(await fileExists(cacheFilePath))) {\n await writeFile(cacheFilePath, JSON.stringify({}), \"utf8\");\n } else {\n cacheEntries = SkeletonCacheEntrySchema.parse(\n JSON.parse(await readFile(cacheFilePath, \"utf8\")),\n );\n }\n switch (operation.type) {\n case \"replace\":\n await writeFile(cacheFilePath, JSON.stringify(operation.cacheEntry), \"utf8\");\n break;\n case \"delete\":\n delete cacheEntries[operation.componentName];\n await writeFile(cacheFilePath, JSON.stringify(cacheEntries), \"utf8\");\n break;\n case \"update\":\n cacheEntries[operation.componentName] = {\n ...operation.payload,\n hash: fnv1a(operation.payload.html).toString(),\n };\n await writeFile(cacheFilePath, JSON.stringify(cacheEntries), \"utf8\");\n }\n}\n","import { writeFile } from \"node:fs/promises\";\n\nexport default async function defaultBone(target: string) {\n await writeFile(\n target,\n `/* eslint-disable */\n/* oxlint-disable */\n/* biome-ignore-all lint */\n/* @ts-nocheck */\n\n/**\n * Auto-generated by Skullmaster.\n *\n * This is the default fallback skeleton component displayed when a\n * matching skeleton implementation cannot be found in the registry.\n *\n * You may freely customize or replace this component to match the\n * loading experience of your application.\n */\nexport default function DefaultBone() {\n return <div>loading...</div>;\n}\n`,\n \"utf8\",\n );\n}\n","import { mkdirSync, writeFileSync } from \"node:fs\";\nimport fileExists from \"./is-file-exists\";\nimport { generateInitialRegistry, generateRegistry, type RegistryOperation } from \"./registry\";\nimport { updateCacheRegistry, type CacheOperation } from \"./cache-registry\";\nimport defaultBone from \"./default-bone\";\nimport { log } from \"../shared\";\n\nexport class Config {\n outDir: string;\n projectType: string;\n\n constructor(outDir: string, projectType: string) {\n this.outDir = outDir;\n this.projectType = projectType;\n }\n async initialize() {\n log.info(\"Initializing project structure...\");\n if (!(await fileExists(this.outDir))) {\n mkdirSync(this.outDir, { recursive: true });\n log.success(`Created output directory: ${this.outDir}`);\n } else {\n log.gray(`Output directory exists: ${this.outDir}`);\n }\n const skeletonsDirectoryPath = this.getSkeletonPath();\n if (!(await fileExists(skeletonsDirectoryPath))) {\n mkdirSync(skeletonsDirectoryPath, { recursive: true });\n log.success(`Created skeletons directory: ${skeletonsDirectoryPath}`);\n } else {\n log.gray(`Skeletons directory exists: ${skeletonsDirectoryPath}`);\n }\n const registryFilePath = this.getRegistryPath();\n if (!(await fileExists(registryFilePath))) {\n await generateInitialRegistry(this.outDir, this.projectType);\n log.success(`Created registry: ${registryFilePath}`);\n } else {\n log.gray(`Registry exists: ${registryFilePath}`);\n }\n const cachePath = this.getCachePath();\n if (!(await fileExists(cachePath))) {\n writeFileSync(cachePath, JSON.stringify({}), \"utf8\");\n log.success(`Created cache: ${cachePath}`);\n } else {\n log.gray(`Cache exists: ${cachePath}`);\n }\n const defaultBonePath = this.getDefSkeletonPath();\n if (!(await fileExists(defaultBonePath))) {\n await defaultBone(defaultBonePath);\n log.success(`Created default bone: ${defaultBonePath}`);\n } else {\n log.gray(`Default bone exists: ${defaultBonePath}`);\n }\n log.success(\"Initialization complete\");\n }\n async cache(op: CacheOperation) {\n return await updateCacheRegistry(op, this.getCachePath());\n }\n async registry(op: RegistryOperation) {\n return generateRegistry(op, this.projectType.endsWith(\"ts\"), this.getRegistryPath());\n }\n getCachePath() {\n return `${this.outDir}/cache.json`;\n }\n getSkeletonPath() {\n return `${this.outDir}/skeletons`;\n }\n getDefSkeletonPath() {\n return `${this.getSkeletonPath()}/DefaultBone.${this.getExt()}`;\n }\n getExt() {\n return this.projectType.endsWith(\"ts\") ? \"tsx\" : \"jsx\";\n }\n getRegistryPath() {\n return `${this.outDir}/registry.${this.getExt()}`;\n }\n}\n","#!/usr/bin/env node\n\nimport { cac } from \"cac\";\nimport { serveCommand } from \"./commands/serve\";\nimport collectPreferences from \"./init/collect-preferences\";\nimport { Config } from \"./init/preferences\";\nimport { DEFAULT_PORT } from \"./shared\";\n\nconst cli = cac(\"💀\");\n\ncli\n .command(\"serve\", \"Start 💀 dev server\")\n .option(\"--port <port>\", \"Port\", {\n default: DEFAULT_PORT,\n })\n .action(async (options) => {\n const preferences = await collectPreferences();\n const config = new Config(preferences.outDir, preferences.project);\n await config.initialize();\n await serveCommand(config, Number(options.port));\n });\n\ncli.help();\ncli.parse();\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,MAAa,eAAe;;;ACE5B,MAAa,6BAA6B,EAAE,OAC1C,EAAE,OAAO,GACT,EAAE,OAAO;CACP,WAAW,EAAE,OAAO;CACpB,MAAM,EAAE,OAAO;AACjB,CAAC,CACH;AAEA,MAAa,2BAA2B,EAAE,OACxC,EAAE,OAAO,GACT,EAAE,OAAO;CACP,WAAW,EAAE,OAAO;CACpB,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;AACjB,CAAC,CACH;;;ACjBA,MAAa,MAAM;CACjB,UAAU,YAAoB,QAAQ,IAAI,gBAAgB,QAAQ,QAAQ;CAC1E,OAAO,YAAoB,QAAQ,IAAI,gBAAgB,QAAQ,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IAAI,IAAI,QAAQ;CACnD;CACA,kBAAkB;EAChB,OAAO,GAAG,KAAK,OAAO,YAAY,KAAK,OAAO;CAChD;AACF;;;AClEA,MAAM,MAAM,IAAI,IAAI;AAEpB,IACG,QAAQ,SAAS,qBAAqB,CAAC,CACvC,OAAO,iBAAiB,QAAQ,EAC/B,SAAS,aACX,CAAC,CAAC,CACD,OAAO,OAAO,YAAY;CACzB,MAAM,cAAc,MAAM,mBAAmB;CAC7C,MAAM,SAAS,IAAI,OAAO,YAAY,QAAQ,YAAY,OAAO;CACjE,MAAM,OAAO,WAAW;CACxB,MAAM,aAAa,QAAQ,OAAO,QAAQ,IAAI,CAAC;AACjD,CAAC;AAEH,IAAI,KAAK;AACT,IAAI,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";iBAAgB,EAAA,CAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";iBAAgB"}
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "skullmaster",
3
- "version": "0.1.4",
3
+ "version": "0.2.0-next.2",
4
4
  "private": false,
5
5
  "description": "A simple example library built by tsdown",
6
+ "homepage": "https://www.ajth.in/skullmaster/",
7
+ "bugs": {
8
+ "url": "https://github.com/ajth-in/skullmaster/issues"
9
+ },
6
10
  "repository": {
7
11
  "type": "git",
8
12
  "url": "git+https://github.com/ajth-in/skullmaster.git"
@@ -46,7 +50,7 @@
46
50
  "oxlint": "^1.0.0",
47
51
  "tsdown": "^0.22.0",
48
52
  "typescript": "^6.0.3",
49
- "@skullmaster/excarnate": "0.1.3",
53
+ "@skullmaster/excarnate": "0.2.0-next.1",
50
54
  "@skullmaster/oxlint-config": "0.0.0",
51
55
  "@skullmaster/typescript-config": "0.0.0"
52
56
  },