chocola 1.1.5 → 1.1.6
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/compiler/index.js +2 -1
- package/compiler/pipeline.js +9 -0
- package/dev/index.js +1 -1
- package/package.json +1 -1
package/compiler/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { throwError, genRandomId, incrementAlfabet } from "./utils.js";
|
|
|
2
2
|
import { JSDOM } from "jsdom";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { promises as fs } from "fs";
|
|
5
|
-
import { getComponents, getSrcIndex, processStylesheet } from "./pipeline.js";
|
|
5
|
+
import { getComponents, getSrcIndex, processIcons, processStylesheet } from "./pipeline.js";
|
|
6
6
|
import chalk from 'chalk';
|
|
7
7
|
import beautify from "js-beautify";
|
|
8
8
|
import { getChocolaConfig } from "../utils.js";
|
|
@@ -171,6 +171,7 @@ ${letter}RUNTIME(${letter}, ${JSON.stringify(ctx)});`);
|
|
|
171
171
|
for (const link of docLinks) {
|
|
172
172
|
const rel = link.rel;
|
|
173
173
|
if (rel === "stylesheet") await processStylesheet(link, __rootdir, __srcdir, outDirPath, fileIds);
|
|
174
|
+
if (rel === "icon") await processIcons(link, __rootdir, __srcdir, outDirPath, fileIds)
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
|
package/compiler/pipeline.js
CHANGED
|
@@ -113,3 +113,12 @@ export async function processStylesheet(link, __rootdir, __srcdir, outDirPath, f
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
export async function processIcons(link, __rootdir, __srcdir, outDirPath) {
|
|
117
|
+
try {
|
|
118
|
+
const href = link.href;
|
|
119
|
+
const iconPath = path.join(__rootdir, __srcdir, href);
|
|
120
|
+
await fs.copyFile(iconPath, path.join(outDirPath, href));
|
|
121
|
+
} catch (err) {
|
|
122
|
+
throwError(err)
|
|
123
|
+
}
|
|
124
|
+
}
|
package/dev/index.js
CHANGED