docgen-utils 1.0.31 → 1.0.33
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/bundle.js +46 -30
- package/dist/bundle.min.js +83 -83
- package/dist/cli.js +6257 -93
- package/dist/packages/cli/commands/export-slides.d.ts +4 -9
- package/dist/packages/cli/commands/export-slides.d.ts.map +1 -1
- package/dist/packages/cli/commands/export-slides.js +242 -100
- package/dist/packages/cli/commands/export-slides.js.map +1 -1
- package/dist/packages/shared/fetch-with-proxy.d.ts +6 -1
- package/dist/packages/shared/fetch-with-proxy.d.ts.map +1 -1
- package/dist/packages/shared/fetch-with-proxy.js +103 -30
- package/dist/packages/shared/fetch-with-proxy.js.map +1 -1
- package/dist/packages/slides/convert.d.ts +2 -0
- package/dist/packages/slides/convert.d.ts.map +1 -1
- package/dist/packages/slides/convert.js +39 -31
- package/dist/packages/slides/convert.js.map +1 -1
- package/dist/packages/slides/createPresentation.d.ts.map +1 -1
- package/dist/packages/slides/createPresentation.js +18 -18
- package/dist/packages/slides/createPresentation.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Export slides command - converts HTML slides to PPTX using Playwright
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - Google Fonts <link> tags load correctly → accurate font names/sizes
|
|
9
|
-
* - --disable-web-security allows cross-origin images on canvas without
|
|
10
|
-
* tainting → CSS filters, mask-image, and icon font rendering all work
|
|
11
|
-
* - No need to pre-embed images as data URIs (avoids regex fragility and
|
|
12
|
-
* potential base64 corruption by transformHtmlForPptx)
|
|
4
|
+
* Architecture: Pipelined processing for maximum speed:
|
|
5
|
+
* - Parse slides in browser (batched for stability)
|
|
6
|
+
* - Start fetching images immediately as slides are parsed
|
|
7
|
+
* - Generate PPTX slides as soon as their images are ready
|
|
13
8
|
*/
|
|
14
9
|
export declare function exportSlides(filePaths: string[], outDir: string, outputName?: string, pdf?: boolean): Promise<void>;
|
|
15
10
|
//# sourceMappingURL=export-slides.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-slides.d.ts","sourceRoot":"","sources":["../../../../packages/cli/commands/export-slides.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"export-slides.d.ts","sourceRoot":"","sources":["../../../../packages/cli/commands/export-slides.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA6EH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmRhI"}
|
|
@@ -1,70 +1,81 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Export slides command - converts HTML slides to PPTX using Playwright
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - Google Fonts <link> tags load correctly → accurate font names/sizes
|
|
9
|
-
* - --disable-web-security allows cross-origin images on canvas without
|
|
10
|
-
* tainting → CSS filters, mask-image, and icon font rendering all work
|
|
11
|
-
* - No need to pre-embed images as data URIs (avoids regex fragility and
|
|
12
|
-
* potential base64 corruption by transformHtmlForPptx)
|
|
4
|
+
* Architecture: Pipelined processing for maximum speed:
|
|
5
|
+
* - Parse slides in browser (batched for stability)
|
|
6
|
+
* - Start fetching images immediately as slides are parsed
|
|
7
|
+
* - Generate PPTX slides as soon as their images are ready
|
|
13
8
|
*/
|
|
14
9
|
import * as fs from "node:fs";
|
|
15
10
|
import * as path from "node:path";
|
|
16
11
|
import { fileURLToPath } from "node:url";
|
|
17
12
|
import { chromium } from "playwright";
|
|
18
|
-
import { fetchWithProxy } from "../../shared/fetch-with-proxy";
|
|
19
13
|
import { convertOfficeToPdf } from "../../shared/convert-to-pdf";
|
|
14
|
+
import { fetchWithProxy } from "../../shared/fetch-with-proxy";
|
|
15
|
+
import PptxGenJS from "../../slides/vendor/pptxgen";
|
|
16
|
+
import { addElementsToSlide, applyBackground } from "../../slides/convert";
|
|
20
17
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
18
|
const __dirname = path.dirname(__filename);
|
|
22
19
|
/**
|
|
23
|
-
*
|
|
24
|
-
* This bypasses CORS restrictions by fetching images in Node.js
|
|
25
|
-
* before passing HTML to the browser context.
|
|
20
|
+
* Fetch an image URL and convert to base64 data URL using Node.js.
|
|
26
21
|
*/
|
|
27
|
-
async function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//
|
|
22
|
+
async function fetchImageAsDataUrlNode(url) {
|
|
23
|
+
const response = await fetchWithProxy(url);
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
throw new Error(`Failed to fetch image: ${response.status}`);
|
|
26
|
+
}
|
|
27
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
28
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
29
|
+
// Determine MIME type from URL or content-type header
|
|
30
|
+
const contentType = response.headers.get("content-type") || "image/png";
|
|
31
|
+
const base64 = buffer.toString("base64");
|
|
32
|
+
return `data:${contentType};base64,${base64}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Collect all image URLs from parsed slide data.
|
|
36
|
+
*/
|
|
37
|
+
function collectImageUrls(slideData) {
|
|
35
38
|
const urls = new Set();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const base64 = Buffer.from(buffer).toString('base64');
|
|
48
|
-
const dataUri = `data:${contentType};base64,${base64}`;
|
|
49
|
-
urlToDataUri.set(url, dataUri);
|
|
39
|
+
// Background image
|
|
40
|
+
if (slideData.background.type === "image" && slideData.background.path) {
|
|
41
|
+
const src = slideData.background.path;
|
|
42
|
+
if (!src.startsWith("data:"))
|
|
43
|
+
urls.add(src);
|
|
44
|
+
}
|
|
45
|
+
// Element images
|
|
46
|
+
for (const el of slideData.elements) {
|
|
47
|
+
if (el.type === "image" || el.type === "backgroundImage" || el.type === "slideBackgroundImage") {
|
|
48
|
+
if (el.src && !el.src.startsWith("data:")) {
|
|
49
|
+
urls.add(el.src);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
}
|
|
53
|
+
return urls;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Replace external image URLs with data URLs in parsed slide data.
|
|
57
|
+
*/
|
|
58
|
+
function injectImageDataUrls(slideData, imageCache) {
|
|
59
|
+
// Background image
|
|
60
|
+
if (slideData.background.type === "image" && slideData.background.path) {
|
|
61
|
+
const dataUrl = imageCache.get(slideData.background.path);
|
|
62
|
+
if (dataUrl)
|
|
63
|
+
slideData.background.path = dataUrl;
|
|
64
|
+
}
|
|
65
|
+
// Element images
|
|
66
|
+
for (const el of slideData.elements) {
|
|
67
|
+
if (el.type === "image" || el.type === "backgroundImage" || el.type === "slideBackgroundImage") {
|
|
68
|
+
if (el.src && !el.src.startsWith("data:")) {
|
|
69
|
+
const dataUrl = imageCache.get(el.src);
|
|
70
|
+
if (dataUrl)
|
|
71
|
+
el.src = dataUrl;
|
|
72
|
+
}
|
|
62
73
|
}
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
return html;
|
|
74
|
+
}
|
|
66
75
|
}
|
|
67
76
|
export async function exportSlides(filePaths, outDir, outputName, pdf = false) {
|
|
77
|
+
// Filter out empty strings (e.g., from trailing commas in --files argument)
|
|
78
|
+
filePaths = filePaths.filter(p => p.trim() !== "");
|
|
68
79
|
if (filePaths.length === 0) {
|
|
69
80
|
throw new Error("No input files provided");
|
|
70
81
|
}
|
|
@@ -78,7 +89,7 @@ export async function exportSlides(filePaths, outDir, outputName, pdf = false) {
|
|
|
78
89
|
absolutePaths.push(absolutePath);
|
|
79
90
|
}
|
|
80
91
|
console.log(`Exporting ${absolutePaths.length} slide(s) to ${pdf ? "PDF" : "PPTX"}`);
|
|
81
|
-
// Read the bundle which contains
|
|
92
|
+
// Read the bundle which contains parsing code
|
|
82
93
|
let bundlePath = path.resolve(__dirname, "bundle.min.js");
|
|
83
94
|
if (!fs.existsSync(bundlePath)) {
|
|
84
95
|
bundlePath = path.resolve(__dirname, "..", "..", "..", "dist/bundle.min.js");
|
|
@@ -86,23 +97,75 @@ export async function exportSlides(filePaths, outDir, outputName, pdf = false) {
|
|
|
86
97
|
if (!fs.existsSync(bundlePath)) {
|
|
87
98
|
throw new Error(`Bundle not found: ${bundlePath}. Run 'npm run build' first.`);
|
|
88
99
|
}
|
|
89
|
-
const
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
const bundleJs = fs.readFileSync(bundlePath, "utf-8");
|
|
101
|
+
// Shared image cache - populated as images are fetched
|
|
102
|
+
const imageCache = new Map();
|
|
103
|
+
const imageFetchPromises = new Map();
|
|
104
|
+
// Track failed image fetches
|
|
105
|
+
const failedImages = new Set();
|
|
106
|
+
// Start fetching an image if not already fetching
|
|
107
|
+
function startImageFetch(url) {
|
|
108
|
+
if (imageFetchPromises.has(url))
|
|
109
|
+
return;
|
|
110
|
+
const promise = fetchImageAsDataUrlNode(url)
|
|
111
|
+
.then(dataUrl => { imageCache.set(url, dataUrl); })
|
|
112
|
+
.catch((err) => {
|
|
113
|
+
console.error(` Failed to fetch image: ${url} - ${err.message}`);
|
|
114
|
+
failedImages.add(url);
|
|
115
|
+
});
|
|
116
|
+
imageFetchPromises.set(url, promise);
|
|
117
|
+
}
|
|
118
|
+
// Wait for all images needed by a slide
|
|
119
|
+
async function waitForSlideImages(slideData) {
|
|
120
|
+
const urls = collectImageUrls(slideData);
|
|
121
|
+
const promises = Array.from(urls).map(url => imageFetchPromises.get(url)).filter(Boolean);
|
|
122
|
+
await Promise.all(promises);
|
|
123
|
+
}
|
|
124
|
+
// Initialize PPTX early
|
|
125
|
+
const pptx = new PptxGenJS();
|
|
126
|
+
pptx.layout = "LAYOUT_16x9";
|
|
127
|
+
pptx.author = "docgen";
|
|
128
|
+
pptx.title = "Presentation";
|
|
129
|
+
// Pre-create slides to maintain order (PptxGenJS adds slides sequentially)
|
|
130
|
+
const slideSlots = [];
|
|
131
|
+
for (let i = 0; i < absolutePaths.length; i++) {
|
|
132
|
+
slideSlots.push({ slide: pptx.addSlide(), generated: false });
|
|
133
|
+
}
|
|
134
|
+
// Track progress
|
|
135
|
+
let parsedCount = 0;
|
|
136
|
+
let generatedCount = 0;
|
|
137
|
+
// Queue of parsed slides ready for generation
|
|
138
|
+
const parsedSlides = [];
|
|
139
|
+
// Serialized slide generation - only one generation loop runs at a time
|
|
140
|
+
let generationChain = Promise.resolve();
|
|
141
|
+
function queueGeneration() {
|
|
142
|
+
generationChain = generationChain.then(async () => {
|
|
143
|
+
while (true) {
|
|
144
|
+
// Find next slide in order
|
|
145
|
+
const nextIndex = generatedCount;
|
|
146
|
+
const entry = parsedSlides.find(p => p.index === nextIndex);
|
|
147
|
+
if (!entry)
|
|
148
|
+
break;
|
|
149
|
+
// Wait for this slide's images
|
|
150
|
+
await entry.imagesReady;
|
|
151
|
+
// Generate slide
|
|
152
|
+
const { slideData } = entry;
|
|
153
|
+
const slot = slideSlots[nextIndex];
|
|
154
|
+
injectImageDataUrls(slideData, imageCache);
|
|
155
|
+
await applyBackground(slideData.background, slot.slide);
|
|
156
|
+
await addElementsToSlide(slideData.elements, slot.slide, pptx);
|
|
157
|
+
slot.generated = true;
|
|
158
|
+
generatedCount++;
|
|
159
|
+
console.log(` Slide ${generatedCount}/${absolutePaths.length} done`);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
// Launch browser
|
|
101
164
|
const launchOptions = {
|
|
102
165
|
headless: true,
|
|
103
166
|
args: ["--disable-web-security"],
|
|
104
167
|
};
|
|
105
|
-
const proxyServer = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
168
|
+
const proxyServer = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy;
|
|
106
169
|
if (proxyServer) {
|
|
107
170
|
launchOptions.proxy = { server: proxyServer };
|
|
108
171
|
}
|
|
@@ -113,51 +176,130 @@ export async function exportSlides(filePaths, outDir, outputName, pdf = false) {
|
|
|
113
176
|
viewport: { width: 960, height: 540 },
|
|
114
177
|
ignoreHTTPSErrors: true,
|
|
115
178
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const script = document.createElement("script");
|
|
126
|
-
script.textContent = code;
|
|
127
|
-
document.head.appendChild(script);
|
|
128
|
-
}, bundleCode);
|
|
129
|
-
// Wait for the bundle to initialise on the page
|
|
130
|
-
await page.waitForFunction(() => !!window.docgen);
|
|
131
|
-
// Generate PPTX in browser
|
|
132
|
-
const pptxBuffer = await page.evaluate(async ({ htmlContents }) => {
|
|
133
|
-
const docgen = window.docgen;
|
|
134
|
-
// Create PptxGenJS instance
|
|
135
|
-
const pptx = new docgen.PptxGenJS();
|
|
136
|
-
pptx.layout = "LAYOUT_16x9";
|
|
137
|
-
pptx.author = "docgen";
|
|
138
|
-
pptx.title = "Presentation";
|
|
139
|
-
// Add each slide
|
|
140
|
-
for (const htmlContent of htmlContents) {
|
|
141
|
-
const transformedHtml = docgen.transformHtmlForPptx(htmlContent);
|
|
142
|
-
await docgen.addSlideFromHtml(transformedHtml, pptx);
|
|
179
|
+
// Block external image loading - we fetch images in Node.js instead
|
|
180
|
+
await context.route('**/*', route => {
|
|
181
|
+
const request = route.request();
|
|
182
|
+
const url = request.url();
|
|
183
|
+
if (url.startsWith('blob:') || url.startsWith('data:')) {
|
|
184
|
+
return route.continue();
|
|
185
|
+
}
|
|
186
|
+
if (request.resourceType() === 'image') {
|
|
187
|
+
return route.abort();
|
|
143
188
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
189
|
+
return route.continue();
|
|
190
|
+
});
|
|
191
|
+
// Parse slides in batches, but start processing immediately
|
|
192
|
+
const MAX_CONCURRENT = 4;
|
|
193
|
+
for (let batchStart = 0; batchStart < absolutePaths.length; batchStart += MAX_CONCURRENT) {
|
|
194
|
+
const batchEnd = Math.min(batchStart + MAX_CONCURRENT, absolutePaths.length);
|
|
195
|
+
const batchPaths = absolutePaths.slice(batchStart, batchEnd);
|
|
196
|
+
const batchPromises = batchPaths.map(async (slidePath, batchIndex) => {
|
|
197
|
+
const index = batchStart + batchIndex;
|
|
198
|
+
const page = await context.newPage();
|
|
199
|
+
page.setDefaultTimeout(60000);
|
|
200
|
+
await page.goto(`file://${slidePath}`, { waitUntil: "domcontentloaded" });
|
|
201
|
+
await page.addScriptTag({ content: bundleJs });
|
|
202
|
+
await page.waitForFunction("typeof window.docgen !== 'undefined'");
|
|
203
|
+
await page.evaluate(`(async function() {
|
|
204
|
+
if (document.fonts && document.fonts.ready) {
|
|
205
|
+
await Promise.race([
|
|
206
|
+
document.fonts.ready,
|
|
207
|
+
new Promise(r => setTimeout(r, 500))
|
|
208
|
+
]);
|
|
209
|
+
}
|
|
210
|
+
})()`);
|
|
211
|
+
const slideDataJson = await page.evaluate(`(async function() {
|
|
212
|
+
const docgen = window.docgen;
|
|
213
|
+
const html = document.documentElement.outerHTML;
|
|
214
|
+
const transformedHtml = docgen.transformHtmlForPptx(html);
|
|
215
|
+
|
|
216
|
+
const iframe = document.createElement('iframe');
|
|
217
|
+
iframe.style.cssText = 'position:absolute;left:-9999px;width:960px;height:540px;border:none;';
|
|
218
|
+
|
|
219
|
+
const blob = new Blob([transformedHtml], { type: 'text/html' });
|
|
220
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
221
|
+
|
|
222
|
+
return new Promise((resolve) => {
|
|
223
|
+
iframe.onload = async () => {
|
|
224
|
+
URL.revokeObjectURL(blobUrl);
|
|
225
|
+
|
|
226
|
+
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
227
|
+
const win = iframe.contentWindow;
|
|
228
|
+
|
|
229
|
+
if (win.document.fonts && win.document.fonts.ready) {
|
|
230
|
+
await Promise.race([
|
|
231
|
+
win.document.fonts.ready,
|
|
232
|
+
new Promise(r => setTimeout(r, 500))
|
|
233
|
+
]);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
try {
|
|
237
|
+
const slideData = docgen.parseSlideHtml(iframeDoc);
|
|
238
|
+
iframe.parentNode.removeChild(iframe);
|
|
239
|
+
resolve(JSON.stringify(slideData));
|
|
240
|
+
} catch(e) {
|
|
241
|
+
iframe.parentNode.removeChild(iframe);
|
|
242
|
+
resolve(JSON.stringify({ error: e.message }));
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
iframe.onerror = () => {
|
|
247
|
+
URL.revokeObjectURL(blobUrl);
|
|
248
|
+
iframe.parentNode?.removeChild(iframe);
|
|
249
|
+
resolve(JSON.stringify({ error: 'iframe load error' }));
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
iframe.src = blobUrl;
|
|
253
|
+
document.body.appendChild(iframe);
|
|
254
|
+
|
|
255
|
+
setTimeout(() => {
|
|
256
|
+
if (iframe.parentNode) {
|
|
257
|
+
iframe.parentNode.removeChild(iframe);
|
|
258
|
+
resolve(JSON.stringify({ error: 'timeout' }));
|
|
259
|
+
}
|
|
260
|
+
}, 10000);
|
|
261
|
+
});
|
|
262
|
+
})()`);
|
|
263
|
+
await page.close();
|
|
264
|
+
if (!slideDataJson) {
|
|
265
|
+
throw new Error(`Failed to parse slide ${index + 1}: ${slidePath} - null result`);
|
|
266
|
+
}
|
|
267
|
+
const parsed = JSON.parse(slideDataJson);
|
|
268
|
+
if (typeof parsed === 'object' && 'error' in parsed) {
|
|
269
|
+
throw new Error(`Failed to parse slide ${index + 1}: ${slidePath} - ${parsed.error}`);
|
|
270
|
+
}
|
|
271
|
+
const slideData = parsed;
|
|
272
|
+
parsedCount++;
|
|
273
|
+
console.log(` Parsed ${parsedCount}/${absolutePaths.length}`);
|
|
274
|
+
// Start fetching images for this slide immediately
|
|
275
|
+
const urls = collectImageUrls(slideData);
|
|
276
|
+
urls.forEach(url => startImageFetch(url));
|
|
277
|
+
// Create promise that resolves when all images for this slide are ready
|
|
278
|
+
const imagesReady = waitForSlideImages(slideData);
|
|
279
|
+
// Add to queue and trigger generation
|
|
280
|
+
parsedSlides.push({ index, slideData, imagesReady });
|
|
281
|
+
queueGeneration();
|
|
282
|
+
});
|
|
283
|
+
await Promise.all(batchPromises);
|
|
284
|
+
}
|
|
149
285
|
await context.close();
|
|
150
|
-
|
|
286
|
+
await browser.close();
|
|
287
|
+
// Wait for all slide generation to complete
|
|
288
|
+
await generationChain;
|
|
289
|
+
// Report any images that failed to fetch
|
|
290
|
+
if (failedImages.size > 0) {
|
|
291
|
+
console.error(`Warning: Failed to fetch ${failedImages.size} image(s)`);
|
|
292
|
+
}
|
|
293
|
+
// Write final PPTX
|
|
294
|
+
const base64 = await pptx.write({ outputType: "base64" });
|
|
295
|
+
const pptxBuffer = Buffer.from(base64, "base64");
|
|
151
296
|
const firstBaseName = path.basename(absolutePaths[0], ".html");
|
|
152
297
|
const finalName = outputName || (absolutePaths.length === 1 ? firstBaseName : "presentation");
|
|
153
298
|
const pptxOutputPath = path.join(outDir, `${finalName}.pptx`);
|
|
154
|
-
|
|
155
|
-
const buffer = Buffer.from(pptxBuffer, "base64");
|
|
156
|
-
fs.writeFileSync(pptxOutputPath, buffer);
|
|
299
|
+
fs.writeFileSync(pptxOutputPath, pptxBuffer);
|
|
157
300
|
if (pdf) {
|
|
158
301
|
console.log("Converting to PDF via LibreOffice...");
|
|
159
302
|
const pdfPath = convertOfficeToPdf(pptxOutputPath, outDir);
|
|
160
|
-
// Remove intermediate PPTX file
|
|
161
303
|
fs.unlinkSync(pptxOutputPath);
|
|
162
304
|
console.log(`Output: ${pdfPath}`);
|
|
163
305
|
}
|
|
@@ -166,7 +308,7 @@ export async function exportSlides(filePaths, outDir, outputName, pdf = false) {
|
|
|
166
308
|
}
|
|
167
309
|
}
|
|
168
310
|
finally {
|
|
169
|
-
await browser.close();
|
|
311
|
+
await browser.close().catch(() => { });
|
|
170
312
|
}
|
|
171
313
|
}
|
|
172
314
|
//# sourceMappingURL=export-slides.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-slides.js","sourceRoot":"","sources":["../../../../packages/cli/commands/export-slides.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"export-slides.js","sourceRoot":"","sources":["../../../../packages/cli/commands/export-slides.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG3E,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;A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,12 @@ interface ProxyResponse {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Fetch a URL with optional proxy support.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* Supports two proxy modes:
|
|
13
|
+
* 1. Forward proxy (default): Sends full URL to proxy, proxy handles TLS.
|
|
14
|
+
* Works with most proxies (Squid, corporate proxies, etc.)
|
|
15
|
+
* 2. CONNECT tunnel (fallback): Establishes tunnel, client handles TLS.
|
|
16
|
+
* Used when forward proxy fails or for CONNECT-only proxies.
|
|
12
17
|
*
|
|
13
18
|
* @param url - The URL to fetch
|
|
14
19
|
* @returns A Promise resolving to a ProxyResponse or native Response
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-with-proxy.d.ts","sourceRoot":"","sources":["../../../packages/shared/fetch-with-proxy.ts"],"names":[],"mappings":"AASA,UAAU,aAAa;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"fetch-with-proxy.d.ts","sourceRoot":"","sources":["../../../packages/shared/fetch-with-proxy.ts"],"names":[],"mappings":"AASA,UAAU,aAAa;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAoTD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,aAAa,GAAG,QAAQ,CAAC,CA8BnC"}
|