kss-modern 0.0.38 → 0.0.40

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.
@@ -751,8 +751,13 @@ async function parse(input, config) {
751
751
  function computeSource(section) {
752
752
  const cssSource = section.source;
753
753
  let sourceMarkup = void 0;
754
- const hasExtractableMarkupFile = section.markup.includes('<insert-vite-pug src="');
755
- if (hasExtractableMarkupFile) {
754
+ const trimmedMarkup = section.markup.trim();
755
+ const isHtmlFilePath = trimmedMarkup.endsWith(".html") && !trimmedMarkup.includes("<") && !trimmedMarkup.includes("\n");
756
+ if (isHtmlFilePath) {
757
+ sourceMarkup = {
758
+ file: path.join(config.contentDir, trimmedMarkup)
759
+ };
760
+ } else if (section.markup.includes('<insert-vite-pug src="')) {
756
761
  const regexModifierLine = /<insert-vite-pug src="(.+?)".*(?:[\n\r\u2028\u2029]\s*)?(modifierClass="(.+?)")? *><\/insert-vite-pug>/g;
757
762
  const vitePugTags = section.markup.match(regexModifierLine);
758
763
  if (!vitePugTags)
@@ -919,7 +924,7 @@ async function generateFullPageFile(data) {
919
924
  <link rel="icon" type="image/svg+xml" href="/styleguide-assets/favicon/fullpage-light.svg">
920
925
  `}
921
926
  ${data.ogImageUrl ? `<meta property="og:image" content="${data.ogImageUrl}">` : ""}
922
- <script type="module" src="/styleguide-assets/fullpage-MsRLbo3b.js"><\/script>
927
+ <script type="module" src="/styleguide-assets/fullpage-CBMHq8rr.js"><\/script>
923
928
  ${computedStyleTags}
924
929
  </head>
925
930
  <body${data.page.bodyclass ? ` class="${data.page.bodyclass}"` : ""}>
@@ -983,7 +988,7 @@ function getHeaderHtml(config) {
983
988
  </button>
984
989
 
985
990
  <div class="flex gap-4">
986
- ${config.launchInEditor ? `
991
+ ${config.mode === "development" && config.launchInEditor ? `
987
992
  <form class="hidden editor-select md:block">
988
993
  <fieldset class="flex items-center rounded-3xl border border-styleguide-border">
989
994
  <legend class="sr-only">Select a preferred editor</legend>
@@ -1267,7 +1272,7 @@ function getMainContentRegular(section, config) {
1267
1272
  };
1268
1273
  const renderOpenInEditorLink = (editorType, contentType, link) => `
1269
1274
  <a
1270
- class="hidden editor-${editorType}-only @md:inline-flex items-center group/${editorType} gap-1.5 p-4 desktop-device-only cursor-pointer active:scale-90 transition hover:text-styleguide-highlight duration-200"
1275
+ class="hidden editor-${editorType}-only @md:inline-flex items-center group/${editorType} gap-1.5 p-4 desktop-device-only cursor-pointer active:scale-90 transition hover:text-styleguide-highlight duration-200"
1271
1276
  href="${link}"
1272
1277
  >
1273
1278
  <span class="hidden @2xl:inline-block">Open ${contentType}</span>
@@ -1939,10 +1944,10 @@ async function terminateAllWorkers() {
1939
1944
  workerPool = [];
1940
1945
  }
1941
1946
  const processCache = /* @__PURE__ */ new Map();
1942
- const __filename = fileURLToPath(import.meta.url);
1943
- const __dirname = path.dirname(__filename);
1944
- const workerFilePath = __dirname.includes("dist/") ? "./vite-pug/worker.mjs" : "./worker.ts";
1945
- const workerFilePathResolved = path.resolve(__dirname, workerFilePath);
1947
+ const __filename$1 = fileURLToPath(import.meta.url);
1948
+ const __dirname$1 = path.dirname(__filename$1);
1949
+ const workerFilePath = __dirname$1.includes("dist/") ? "./vite-pug/worker.mjs" : "./worker.ts";
1950
+ const workerFilePathResolved = path.resolve(__dirname$1, workerFilePath);
1946
1951
  const signals = ["SIGINT", "SIGTERM", "SIGQUIT"];
1947
1952
  signals.forEach((signal) => process.on(signal, async () => await terminateAllWorkers()));
1948
1953
  async function compilePugMarkup(mode, contentDir, repository) {
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs/promises';
1
2
  import path from 'node:path';
2
3
  import { parentPort } from 'node:worker_threads';
3
4
  import { Biome, Distribution } from '@biomejs/js-api';
@@ -99,8 +100,18 @@ if (!parentPort) {
99
100
  parentPort.on("message", async (data) => {
100
101
  const { id, mode, html, contentDir } = data;
101
102
  let result = html;
103
+ const trimmed = html.trim();
104
+ if (trimmed.endsWith(".html") && !trimmed.includes("<") && !trimmed.includes("\n")) {
105
+ const htmlFilePath = path.join(contentDir, trimmed);
106
+ try {
107
+ result = await fs.readFile(htmlFilePath, "utf-8");
108
+ } catch {
109
+ parentPort.postMessage({ error: `HTML markup file not found: "${htmlFilePath}"` });
110
+ return;
111
+ }
112
+ }
102
113
  const needsFormatting = mode === "development" && !result.includes("<insert-vite-pug") || mode === "production";
103
- result = await compilePug(contentDir, mode, html);
114
+ result = await compilePug(contentDir, mode, result);
104
115
  if (needsFormatting) {
105
116
  result = await biomeFormat(result);
106
117
  }
@@ -20,7 +20,7 @@
20
20
  "name": "utils"
21
21
  },
22
22
  "client/fullpage.ts": {
23
- "file": "fullpage-MsRLbo3b.js",
23
+ "file": "fullpage-CBMHq8rr.js",
24
24
  "name": "fullpage",
25
25
  "src": "client/fullpage.ts",
26
26
  "isEntry": true,
@@ -104,7 +104,7 @@
104
104
  ]
105
105
  },
106
106
  "node_modules/html-validate/dist/esm/browser.js": {
107
- "file": "browser-BjsUm14H.js",
107
+ "file": "browser-BkdgI_IA.js",
108
108
  "name": "browser",
109
109
  "src": "node_modules/html-validate/dist/esm/browser.js",
110
110
  "isDynamicEntry": true,