kss-modern 0.0.39 → 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.
package/dist/node/lib/index.mjs
CHANGED
|
@@ -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
|
|
755
|
-
|
|
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)
|
|
@@ -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,
|
|
114
|
+
result = await compilePug(contentDir, mode, result);
|
|
104
115
|
if (needsFormatting) {
|
|
105
116
|
result = await biomeFormat(result);
|
|
106
117
|
}
|