@microlee666/dom-to-pptx 1.1.4 → 1.1.5
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/.claude/settings.local.json +11 -0
- package/Readme.md +28 -0
- package/SUPPORTED.md +5 -0
- package/USAGE_CN.md +26 -0
- package/cli/dom-to-pptx.bundle.js +957 -36
- package/cli/html2pptx.js +19 -6
- package/cli/presentation.pptx +0 -0
- package/dist/dom-to-pptx.bundle.js +749 -14
- package/dist/dom-to-pptx.cjs +747 -13
- package/dist/dom-to-pptx.cjs.map +1 -1
- package/dist/dom-to-pptx.mjs +747 -13
- package/dist/dom-to-pptx.mjs.map +1 -1
- package/package.json +2 -2
- package/scripts/patch-bundle.js +66 -0
- package/src/index.js +510 -10
- package/src/utils.js +240 -4
package/cli/html2pptx.js
CHANGED
|
@@ -103,8 +103,22 @@ async function convert() {
|
|
|
103
103
|
viewport: { width: viewportWidth, height: viewportHeight },
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
+
// Disable browser cache to ensure fresh bundle is loaded
|
|
107
|
+
await context.setOffline(false);
|
|
108
|
+
|
|
106
109
|
const page = await context.newPage();
|
|
107
110
|
|
|
111
|
+
// Disable cache to ensure fresh bundle is loaded
|
|
112
|
+
await page.route('**/*', (route) => {
|
|
113
|
+
route.continue({
|
|
114
|
+
headers: {
|
|
115
|
+
...route.request().headers(),
|
|
116
|
+
'Cache-Control': 'no-cache',
|
|
117
|
+
'Pragma': 'no-cache',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
108
122
|
// 加载页面
|
|
109
123
|
console.log('📖 加载页面...');
|
|
110
124
|
if (isUrl) {
|
|
@@ -122,11 +136,10 @@ async function convert() {
|
|
|
122
136
|
// 等待页面完全加载
|
|
123
137
|
await page.waitForTimeout(1000);
|
|
124
138
|
|
|
125
|
-
// 注入 dom-to-pptx
|
|
126
|
-
console.log('💉 注入 dom-to-pptx
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
139
|
+
// 注入 dom-to-pptx 库(使用本地构建版本)
|
|
140
|
+
console.log('💉 注入 dom-to-pptx(本地)...');
|
|
141
|
+
const bundlePath = path.join(__dirname, 'dom-to-pptx.bundle.js');
|
|
142
|
+
await page.addScriptTag({ path: bundlePath });
|
|
130
143
|
|
|
131
144
|
// 等待库加载
|
|
132
145
|
await page.waitForFunction(() => typeof window.domToPptx !== 'undefined', {
|
|
@@ -211,4 +224,4 @@ async function convert() {
|
|
|
211
224
|
}
|
|
212
225
|
}
|
|
213
226
|
|
|
214
|
-
convert();
|
|
227
|
+
convert();
|
|
Binary file
|