@gaulatti/giorgia 0.1.61 → 0.1.62
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/renderer.d.ts +2 -2
- package/dist/renderer.js +1 -1
- package/dist/renderer.node.d.ts +6 -0
- package/dist/renderer.node.js +22 -0
- package/package.json +1 -1
package/dist/renderer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { render, liveProgramPageHtml, liveProgramPageAsset, liveProgramPageFiles, fontFiles } from './renderer.node.js';
|
|
2
|
-
export type { LiveProgramFileEntry, FontFileEntry } from './renderer.node.js';
|
|
1
|
+
export { assetFiles, render, liveProgramPageHtml, liveProgramPageAsset, liveProgramPageFiles, fontFiles } from './renderer.node.js';
|
|
2
|
+
export type { AssetFileEntry, LiveProgramFileEntry, FontFileEntry } from './renderer.node.js';
|
|
3
3
|
export { buildInstagramImageHtml, registerInstagramImageHelpers, type InstagramImageTemplateParams } from './instagram-image-template.js';
|
|
4
4
|
export { outletConfig } from './outlet-config.js';
|
|
5
5
|
export { version } from './version.js';
|
package/dist/renderer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { render, liveProgramPageHtml, liveProgramPageAsset, liveProgramPageFiles, fontFiles } from './renderer.node.js';
|
|
1
|
+
export { assetFiles, render, liveProgramPageHtml, liveProgramPageAsset, liveProgramPageFiles, fontFiles } from './renderer.node.js';
|
|
2
2
|
export { buildInstagramImageHtml, registerInstagramImageHelpers } from './instagram-image-template.js';
|
|
3
3
|
export { outletConfig } from './outlet-config.js';
|
|
4
4
|
export { version } from './version.js';
|
package/dist/renderer.node.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export type FontFileEntry = {
|
|
|
7
7
|
contentType: string;
|
|
8
8
|
};
|
|
9
9
|
export declare function fontFiles(): FontFileEntry[];
|
|
10
|
+
export type AssetFileEntry = {
|
|
11
|
+
key: string;
|
|
12
|
+
body: Buffer;
|
|
13
|
+
contentType: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function assetFiles(): AssetFileEntry[];
|
|
10
16
|
export declare function liveProgramPageAsset(filename: string): string;
|
|
11
17
|
export type LiveProgramFileEntry = {
|
|
12
18
|
key: string;
|
package/dist/renderer.node.js
CHANGED
|
@@ -88,6 +88,11 @@ function fontsDir() {
|
|
|
88
88
|
const currentDir = path.dirname(currentFile);
|
|
89
89
|
return path.join(currentDir, 'fonts');
|
|
90
90
|
}
|
|
91
|
+
function assetsDir() {
|
|
92
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
93
|
+
const currentDir = path.dirname(currentFile);
|
|
94
|
+
return path.join(currentDir, 'assets');
|
|
95
|
+
}
|
|
91
96
|
export function fontFiles() {
|
|
92
97
|
const dir = fontsDir();
|
|
93
98
|
if (!fs.existsSync(dir)) {
|
|
@@ -115,6 +120,22 @@ export function fontFiles() {
|
|
|
115
120
|
}
|
|
116
121
|
return entries;
|
|
117
122
|
}
|
|
123
|
+
export function assetFiles() {
|
|
124
|
+
const dir = assetsDir();
|
|
125
|
+
if (!fs.existsSync(dir)) {
|
|
126
|
+
throw new Error(`assets directory not found at ${dir} — run npm run build first`);
|
|
127
|
+
}
|
|
128
|
+
return fs.readdirSync(dir, { withFileTypes: true })
|
|
129
|
+
.filter((item) => item.isFile())
|
|
130
|
+
.map((item) => {
|
|
131
|
+
const fullPath = path.join(dir, item.name);
|
|
132
|
+
return {
|
|
133
|
+
key: `assets/${item.name}`,
|
|
134
|
+
body: fs.readFileSync(fullPath),
|
|
135
|
+
contentType: contentTypeForFile(item.name),
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
|
118
139
|
export function liveProgramPageAsset(filename) {
|
|
119
140
|
const pageDir = liveProgramPageDir();
|
|
120
141
|
const assetPath = path.join(pageDir, filename);
|
|
@@ -130,6 +151,7 @@ const CONTENT_TYPE_MAP = {
|
|
|
130
151
|
'.jpg': 'image/jpeg',
|
|
131
152
|
'.jpeg': 'image/jpeg',
|
|
132
153
|
'.png': 'image/png',
|
|
154
|
+
'.svg': 'image/svg+xml',
|
|
133
155
|
'.woff2': 'font/woff2',
|
|
134
156
|
'.woff': 'font/woff',
|
|
135
157
|
'.ogg': 'audio/ogg',
|