@microlee666/dom-to-pptx 1.1.4 → 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/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
- await page.addScriptTag({
128
- url: 'https://cdn.jsdelivr.net/npm/dom-to-pptx@latest/dist/dom-to-pptx.bundle.js',
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