@azuro-org/images-generator 2.0.6 → 2.0.7
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/generator.d.ts +1 -0
- package/dist/{index-6ec143bc.js → index-dd1b4780.js} +2 -2
- package/dist/index.es.js +175 -132
- package/dist/templates/bet-nft/index.js +1 -1
- package/dist/templates/bet-og/index.js +1 -1
- package/dist/templates/combo-bet-og/index.js +1 -1
- package/dist/templates/freebet/index.js +1 -1
- package/dist/templates/trendle-leaderboard/index.js +1 -1
- package/dist/templates/trendle-social/index.js +1 -1
- package/dist/templates/trendle-trading/index.js +1 -1
- package/lib/generator.d.ts +1 -0
- package/lib/{index-efa024cc.js → index-0f16798b.js} +2 -2
- package/lib/index.js +175 -132
- package/lib/templates/bet-nft/index.js +1 -1
- package/lib/templates/bet-og/index.js +1 -1
- package/lib/templates/combo-bet-og/index.js +1 -1
- package/lib/templates/freebet/index.js +1 -1
- package/lib/templates/trendle-leaderboard/index.js +1 -1
- package/lib/templates/trendle-social/index.js +1 -1
- package/lib/templates/trendle-trading/index.js +1 -1
- package/package.json +2 -2
package/dist/generator.d.ts
CHANGED
|
@@ -15650,7 +15650,7 @@ function requireCommon () {
|
|
|
15650
15650
|
|
|
15651
15651
|
const split = (typeof namespaces === 'string' ? namespaces : '')
|
|
15652
15652
|
.trim()
|
|
15653
|
-
.replace(
|
|
15653
|
+
.replace(/\s+/g, ',')
|
|
15654
15654
|
.split(',')
|
|
15655
15655
|
.filter(Boolean);
|
|
15656
15656
|
|
|
@@ -16000,7 +16000,7 @@ function requireBrowser () {
|
|
|
16000
16000
|
function load() {
|
|
16001
16001
|
let r;
|
|
16002
16002
|
try {
|
|
16003
|
-
r = exports.storage.getItem('debug');
|
|
16003
|
+
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
|
|
16004
16004
|
} catch (error) {
|
|
16005
16005
|
// Swallow
|
|
16006
16006
|
// XXX (@Qix-) should we be logging these?
|
package/dist/index.es.js
CHANGED
|
@@ -60,11 +60,17 @@ function __generator(thisArg, body) {
|
|
|
60
60
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
61
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}function isProtocolTimeoutError(error) {
|
|
64
|
+
if (!(error instanceof Error))
|
|
65
|
+
return false;
|
|
66
|
+
return (error.name === 'ProtocolError' ||
|
|
67
|
+
/protocol.*timeout|timed out/i.test(error.message));
|
|
68
|
+
}
|
|
69
|
+
var Generator = /** @class */ (function () {
|
|
64
70
|
function Generator(options) {
|
|
65
71
|
if (options === void 0) { options = {}; }
|
|
66
72
|
this.browser = null;
|
|
67
|
-
this.options = __assign({ headless: true, timeout: 30000, args: [
|
|
73
|
+
this.options = __assign({ headless: true, timeout: 30000, protocolTimeout: 60000, args: [
|
|
68
74
|
'--no-sandbox',
|
|
69
75
|
'--disable-setuid-sandbox',
|
|
70
76
|
'--disable-gpu',
|
|
@@ -73,7 +79,6 @@ function __generator(thisArg, body) {
|
|
|
73
79
|
'--disable-web-security',
|
|
74
80
|
'--disable-plugins',
|
|
75
81
|
'--disable-extensions',
|
|
76
|
-
'--disable-background-networking',
|
|
77
82
|
'--disable-background-timer-throttling',
|
|
78
83
|
'--disable-renderer-backgrounding',
|
|
79
84
|
'--disable-backgrounding-occluded-windows',
|
|
@@ -93,38 +98,39 @@ function __generator(thisArg, body) {
|
|
|
93
98
|
] }, options);
|
|
94
99
|
}
|
|
95
100
|
Generator.prototype.run = function () {
|
|
96
|
-
var _a;
|
|
101
|
+
var _a, _b;
|
|
97
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var launchOptions,
|
|
103
|
+
var launchOptions, _c, error_1;
|
|
99
104
|
var _this = this;
|
|
100
|
-
return __generator(this, function (
|
|
101
|
-
switch (
|
|
105
|
+
return __generator(this, function (_d) {
|
|
106
|
+
switch (_d.label) {
|
|
102
107
|
case 0:
|
|
103
108
|
if (this.browser) {
|
|
104
109
|
return [2 /*return*/];
|
|
105
110
|
}
|
|
106
|
-
|
|
111
|
+
_d.label = 1;
|
|
107
112
|
case 1:
|
|
108
|
-
|
|
113
|
+
_d.trys.push([1, 3, , 5]);
|
|
109
114
|
launchOptions = {
|
|
110
115
|
headless: (_a = this.options.headless) !== null && _a !== void 0 ? _a : true,
|
|
111
116
|
devtools: false,
|
|
112
117
|
args: this.options.args,
|
|
113
118
|
timeout: this.options.timeout,
|
|
119
|
+
protocolTimeout: (_b = this.options.protocolTimeout) !== null && _b !== void 0 ? _b : 60000,
|
|
114
120
|
};
|
|
115
|
-
|
|
121
|
+
_c = this;
|
|
116
122
|
return [4 /*yield*/, puppeteer.launch(launchOptions)];
|
|
117
123
|
case 2:
|
|
118
|
-
|
|
124
|
+
_c.browser = _d.sent();
|
|
119
125
|
this.browser.on('disconnected', function () {
|
|
120
126
|
_this.browser = null;
|
|
121
127
|
});
|
|
122
128
|
return [3 /*break*/, 5];
|
|
123
129
|
case 3:
|
|
124
|
-
error_1 =
|
|
130
|
+
error_1 = _d.sent();
|
|
125
131
|
return [4 /*yield*/, this.cleanup()];
|
|
126
132
|
case 4:
|
|
127
|
-
|
|
133
|
+
_d.sent();
|
|
128
134
|
throw new Error("Failed to initialize generator: ".concat(error_1 instanceof Error ? error_1.message : 'Unknown error'));
|
|
129
135
|
case 5: return [2 /*return*/];
|
|
130
136
|
}
|
|
@@ -134,131 +140,168 @@ function __generator(thisArg, body) {
|
|
|
134
140
|
Generator.prototype.generate = function (props) {
|
|
135
141
|
var _a, _b;
|
|
136
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var
|
|
138
|
-
return __generator(this, function (
|
|
139
|
-
switch (
|
|
143
|
+
var maxAttempts, lastError, _loop_1, this_1, attempt, state_1, errorMessage;
|
|
144
|
+
return __generator(this, function (_c) {
|
|
145
|
+
switch (_c.label) {
|
|
140
146
|
case 0:
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
maxAttempts = 2;
|
|
148
|
+
_loop_1 = function (attempt) {
|
|
149
|
+
var template, templateProps, output, filename, _d, options, width, height, type, getHtml, _e, quality, _f, fullPage, _g, waitForFonts, _h, waitTimeout_1, _j, waitUntil, _k, skipAnimations, page, htmlContent, content, _l, screenshotOptions, imageBuffer, innerError_1, error_2;
|
|
150
|
+
return __generator(this, function (_m) {
|
|
151
|
+
switch (_m.label) {
|
|
152
|
+
case 0:
|
|
153
|
+
_m.trys.push([0, 23, , 26]);
|
|
154
|
+
if (!!this_1.browser) return [3 /*break*/, 2];
|
|
155
|
+
return [4 /*yield*/, this_1.run()];
|
|
156
|
+
case 1:
|
|
157
|
+
_m.sent();
|
|
158
|
+
_m.label = 2;
|
|
159
|
+
case 2:
|
|
160
|
+
template = props.template, templateProps = props.props, output = props.output, filename = props.filename, _d = props.options, options = _d === void 0 ? {} : _d;
|
|
161
|
+
// Validate template
|
|
162
|
+
if (!template.width || !template.height || !template.html) {
|
|
163
|
+
throw new Error('Invalid template: missing required properties');
|
|
164
|
+
}
|
|
165
|
+
width = template.width, height = template.height, type = template.type, getHtml = template.html;
|
|
166
|
+
_e = options.quality, quality = _e === void 0 ? type === 'jpeg' ? 85 : undefined : _e, _f = options.fullPage, fullPage = _f === void 0 ? false : _f, _g = options.waitForFonts, waitForFonts = _g === void 0 ? true : _g, _h = options.waitTimeout, waitTimeout_1 = _h === void 0 ? 2000 : _h, _j = options.waitUntil, waitUntil = _j === void 0 ? 'load' : _j, _k = options.skipAnimations, skipAnimations = _k === void 0 ? true : _k;
|
|
167
|
+
return [4 /*yield*/, this_1.browser.newPage()];
|
|
168
|
+
case 3:
|
|
169
|
+
page = _m.sent();
|
|
170
|
+
// Set reasonable timeout instead of infinite
|
|
171
|
+
page.setDefaultNavigationTimeout((_a = this_1.options.timeout) !== null && _a !== void 0 ? _a : 30000);
|
|
172
|
+
page.setDefaultTimeout((_b = this_1.options.timeout) !== null && _b !== void 0 ? _b : 30000);
|
|
173
|
+
// Optimize page performance
|
|
174
|
+
return [4 /*yield*/, page.setCacheEnabled(false)];
|
|
175
|
+
case 4:
|
|
176
|
+
// Optimize page performance
|
|
177
|
+
_m.sent();
|
|
178
|
+
return [4 /*yield*/, page.setJavaScriptEnabled(true)];
|
|
179
|
+
case 5:
|
|
180
|
+
_m.sent();
|
|
181
|
+
// Block unnecessary network requests for faster rendering
|
|
182
|
+
return [4 /*yield*/, page.setRequestInterception(true)];
|
|
183
|
+
case 6:
|
|
184
|
+
// Block unnecessary network requests for faster rendering
|
|
185
|
+
_m.sent();
|
|
186
|
+
page.on('request', function (req) {
|
|
187
|
+
var resourceType = req.resourceType();
|
|
188
|
+
if (['media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
|
|
189
|
+
req.abort();
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
req.continue();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
_m.label = 7;
|
|
196
|
+
case 7:
|
|
197
|
+
_m.trys.push([7, 20, , 22]);
|
|
198
|
+
// Set viewport for this generation
|
|
199
|
+
return [4 /*yield*/, page.setViewport({
|
|
200
|
+
width: width,
|
|
201
|
+
height: height,
|
|
202
|
+
deviceScaleFactor: 1,
|
|
203
|
+
})];
|
|
204
|
+
case 8:
|
|
205
|
+
// Set viewport for this generation
|
|
206
|
+
_m.sent();
|
|
207
|
+
return [4 /*yield*/, getHtml(templateProps)];
|
|
208
|
+
case 9:
|
|
209
|
+
htmlContent = _m.sent();
|
|
210
|
+
if (!htmlContent || typeof htmlContent !== 'string') {
|
|
211
|
+
throw new Error('Template html function must return a non-empty string');
|
|
212
|
+
}
|
|
213
|
+
// Load content with faster wait strategy
|
|
214
|
+
return [4 /*yield*/, Promise.race([
|
|
215
|
+
page.setContent(htmlContent, { waitUntil: waitUntil }),
|
|
216
|
+
new Promise(function (_, reject) {
|
|
217
|
+
return setTimeout(function () { return reject(new Error('Content loading timeout')); }, waitTimeout_1);
|
|
218
|
+
}),
|
|
219
|
+
])];
|
|
220
|
+
case 10:
|
|
221
|
+
// Load content with faster wait strategy
|
|
222
|
+
_m.sent();
|
|
223
|
+
if (!waitForFonts) return [3 /*break*/, 12];
|
|
224
|
+
return [4 /*yield*/, Promise.race([
|
|
225
|
+
page.evaluate(function () { return document.fonts.ready; }),
|
|
226
|
+
new Promise(function (_, reject) {
|
|
227
|
+
return setTimeout(function () { return reject(new Error('Font loading timeout')); }, waitTimeout_1);
|
|
228
|
+
}),
|
|
229
|
+
]).catch(function () { })];
|
|
230
|
+
case 11:
|
|
231
|
+
_m.sent();
|
|
232
|
+
_m.label = 12;
|
|
233
|
+
case 12:
|
|
234
|
+
if (!!skipAnimations) return [3 /*break*/, 14];
|
|
235
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 100); })];
|
|
236
|
+
case 13:
|
|
237
|
+
_m.sent();
|
|
238
|
+
_m.label = 14;
|
|
239
|
+
case 14:
|
|
240
|
+
if (!fullPage) return [3 /*break*/, 15];
|
|
241
|
+
_l = page;
|
|
242
|
+
return [3 /*break*/, 17];
|
|
243
|
+
case 15: return [4 /*yield*/, page.$('body')];
|
|
244
|
+
case 16:
|
|
245
|
+
_l = _m.sent();
|
|
246
|
+
_m.label = 17;
|
|
247
|
+
case 17:
|
|
248
|
+
content = _l;
|
|
249
|
+
if (!content) {
|
|
250
|
+
throw new Error('Failed to find content element');
|
|
251
|
+
}
|
|
252
|
+
screenshotOptions = __assign({ omitBackground: true, type: type }, (type === 'jpeg' && quality ? { quality: quality } : {}));
|
|
253
|
+
if (output && filename) {
|
|
254
|
+
if (!fs.existsSync(output)) {
|
|
255
|
+
fs.mkdirSync(output);
|
|
256
|
+
}
|
|
257
|
+
screenshotOptions.path = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
258
|
+
}
|
|
259
|
+
return [4 /*yield*/, content.screenshot(screenshotOptions)];
|
|
260
|
+
case 18:
|
|
261
|
+
imageBuffer = _m.sent();
|
|
262
|
+
return [4 /*yield*/, page.close()];
|
|
263
|
+
case 19:
|
|
264
|
+
_m.sent();
|
|
265
|
+
return [2 /*return*/, { value: imageBuffer }];
|
|
266
|
+
case 20:
|
|
267
|
+
innerError_1 = _m.sent();
|
|
268
|
+
return [4 /*yield*/, page.close().catch(function () { })];
|
|
269
|
+
case 21:
|
|
270
|
+
_m.sent();
|
|
271
|
+
throw innerError_1;
|
|
272
|
+
case 22: return [3 /*break*/, 26];
|
|
273
|
+
case 23:
|
|
274
|
+
error_2 = _m.sent();
|
|
275
|
+
lastError = error_2;
|
|
276
|
+
if (!(attempt < maxAttempts && isProtocolTimeoutError(error_2))) return [3 /*break*/, 25];
|
|
277
|
+
return [4 /*yield*/, this_1.cleanup()];
|
|
278
|
+
case 24:
|
|
279
|
+
_m.sent();
|
|
280
|
+
return [2 /*return*/, "continue"];
|
|
281
|
+
case 25: return [2 /*return*/, "break"];
|
|
282
|
+
case 26: return [2 /*return*/];
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
this_1 = this;
|
|
287
|
+
attempt = 1;
|
|
288
|
+
_c.label = 1;
|
|
143
289
|
case 1:
|
|
144
|
-
|
|
145
|
-
|
|
290
|
+
if (!(attempt <= maxAttempts)) return [3 /*break*/, 4];
|
|
291
|
+
return [5 /*yield**/, _loop_1(attempt)];
|
|
146
292
|
case 2:
|
|
147
|
-
|
|
148
|
-
|
|
293
|
+
state_1 = _c.sent();
|
|
294
|
+
if (typeof state_1 === "object")
|
|
295
|
+
return [2 /*return*/, state_1.value];
|
|
296
|
+
if (state_1 === "break")
|
|
297
|
+
return [3 /*break*/, 4];
|
|
298
|
+
_c.label = 3;
|
|
149
299
|
case 3:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
page.setDefaultNavigationTimeout((_a = this.options.timeout) !== null && _a !== void 0 ? _a : 30000);
|
|
153
|
-
page.setDefaultTimeout((_b = this.options.timeout) !== null && _b !== void 0 ? _b : 30000);
|
|
154
|
-
// Optimize page performance
|
|
155
|
-
return [4 /*yield*/, page.setCacheEnabled(false)];
|
|
300
|
+
attempt++;
|
|
301
|
+
return [3 /*break*/, 1];
|
|
156
302
|
case 4:
|
|
157
|
-
|
|
158
|
-
_l.sent();
|
|
159
|
-
return [4 /*yield*/, page.setJavaScriptEnabled(true)];
|
|
160
|
-
case 5:
|
|
161
|
-
_l.sent();
|
|
162
|
-
// Block unnecessary network requests for faster rendering
|
|
163
|
-
return [4 /*yield*/, page.setRequestInterception(true)];
|
|
164
|
-
case 6:
|
|
165
|
-
// Block unnecessary network requests for faster rendering
|
|
166
|
-
_l.sent();
|
|
167
|
-
page.on('request', function (req) {
|
|
168
|
-
var resourceType = req.resourceType();
|
|
169
|
-
// Block only truly unnecessary resources that don't affect rendering
|
|
170
|
-
// Allow images, stylesheets, scripts, fonts, and data URLs
|
|
171
|
-
if (['media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
|
|
172
|
-
req.abort();
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
req.continue();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
// Validate template
|
|
179
|
-
if (!template.width || !template.height || !template.html) {
|
|
180
|
-
throw new Error('Invalid template: missing required properties');
|
|
181
|
-
}
|
|
182
|
-
width = template.width, height = template.height, type = template.type, getHtml = template.html;
|
|
183
|
-
_d = options.quality, quality = _d === void 0 ? type === 'jpeg' ? 85 : undefined : _d, _e = options.fullPage, fullPage = _e === void 0 ? false : _e, _f = options.waitForFonts, waitForFonts = _f === void 0 ? true : _f, _g = options.waitTimeout, waitTimeout = _g === void 0 ? 2000 : _g, _h = options.waitUntil, waitUntil = _h === void 0 ? 'load' : _h, _j = options.skipAnimations, skipAnimations = _j === void 0 ? true : _j;
|
|
184
|
-
_l.label = 7;
|
|
185
|
-
case 7:
|
|
186
|
-
_l.trys.push([7, 20, , 21]);
|
|
187
|
-
// Set viewport for this generation
|
|
188
|
-
return [4 /*yield*/, page.setViewport({
|
|
189
|
-
width: width,
|
|
190
|
-
height: height,
|
|
191
|
-
deviceScaleFactor: 1,
|
|
192
|
-
})];
|
|
193
|
-
case 8:
|
|
194
|
-
// Set viewport for this generation
|
|
195
|
-
_l.sent();
|
|
196
|
-
return [4 /*yield*/, getHtml(templateProps)];
|
|
197
|
-
case 9:
|
|
198
|
-
htmlContent = _l.sent();
|
|
199
|
-
if (!htmlContent || typeof htmlContent !== 'string') {
|
|
200
|
-
throw new Error('Template html function must return a non-empty string');
|
|
201
|
-
}
|
|
202
|
-
// Load content with faster wait strategy
|
|
203
|
-
return [4 /*yield*/, Promise.race([
|
|
204
|
-
page.setContent(htmlContent, { waitUntil: waitUntil }),
|
|
205
|
-
new Promise(function (_, reject) {
|
|
206
|
-
return setTimeout(function () { return reject(new Error('Content loading timeout')); }, waitTimeout);
|
|
207
|
-
}),
|
|
208
|
-
])];
|
|
209
|
-
case 10:
|
|
210
|
-
// Load content with faster wait strategy
|
|
211
|
-
_l.sent();
|
|
212
|
-
if (!waitForFonts) return [3 /*break*/, 12];
|
|
213
|
-
return [4 /*yield*/, Promise.race([
|
|
214
|
-
page.evaluate(function () { return document.fonts.ready; }),
|
|
215
|
-
new Promise(function (_, reject) {
|
|
216
|
-
return setTimeout(function () { return reject(new Error('Font loading timeout')); }, waitTimeout);
|
|
217
|
-
}),
|
|
218
|
-
]).catch(function () {
|
|
219
|
-
// Font loading timeout is not critical, continue anyway
|
|
220
|
-
})];
|
|
221
|
-
case 11:
|
|
222
|
-
_l.sent();
|
|
223
|
-
_l.label = 12;
|
|
224
|
-
case 12:
|
|
225
|
-
if (!!skipAnimations) return [3 /*break*/, 14];
|
|
226
|
-
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 100); })];
|
|
227
|
-
case 13:
|
|
228
|
-
_l.sent();
|
|
229
|
-
_l.label = 14;
|
|
230
|
-
case 14:
|
|
231
|
-
if (!fullPage) return [3 /*break*/, 15];
|
|
232
|
-
_k = page;
|
|
233
|
-
return [3 /*break*/, 17];
|
|
234
|
-
case 15: return [4 /*yield*/, page.$('body')];
|
|
235
|
-
case 16:
|
|
236
|
-
_k = _l.sent();
|
|
237
|
-
_l.label = 17;
|
|
238
|
-
case 17:
|
|
239
|
-
content = _k;
|
|
240
|
-
if (!content) {
|
|
241
|
-
throw new Error('Failed to find content element');
|
|
242
|
-
}
|
|
243
|
-
screenshotOptions = __assign({ omitBackground: true, type: type }, (type === 'jpeg' && quality ? { quality: quality } : {}));
|
|
244
|
-
if (output && filename) {
|
|
245
|
-
if (!fs.existsSync(output)) {
|
|
246
|
-
fs.mkdirSync(output);
|
|
247
|
-
}
|
|
248
|
-
screenshotOptions.path = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
249
|
-
}
|
|
250
|
-
return [4 /*yield*/, content.screenshot(screenshotOptions)];
|
|
251
|
-
case 18:
|
|
252
|
-
imageBuffer = _l.sent();
|
|
253
|
-
return [4 /*yield*/, page.close()];
|
|
254
|
-
case 19:
|
|
255
|
-
_l.sent();
|
|
256
|
-
return [2 /*return*/, imageBuffer];
|
|
257
|
-
case 20:
|
|
258
|
-
error_2 = _l.sent();
|
|
259
|
-
errorMessage = error_2 instanceof Error ? error_2.message : 'Unknown error occurred';
|
|
303
|
+
errorMessage = lastError instanceof Error ? lastError.message : 'Unknown error occurred';
|
|
260
304
|
throw new Error("Failed to generate image: ".concat(errorMessage));
|
|
261
|
-
case 21: return [2 /*return*/];
|
|
262
305
|
}
|
|
263
306
|
});
|
|
264
307
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_ as __awaiter,a as __generator,d as downloadImage,g as getFile,b as getBase64Image}from'../../index-
|
|
1
|
+
import {_ as __awaiter,a as __generator,d as downloadImage,g as getFile,b as getBase64Image}from'../../index-dd1b4780.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var matchType = {
|
|
2
2
|
'match': 'Waiting for match',
|
|
3
3
|
'claim': 'Waiting for claim',
|
|
4
4
|
'claimed': 'Claimed',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image}from'../../index-
|
|
1
|
+
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image}from'../../index-dd1b4780.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};var dayjs_min = {exports: {}};(function (module, exports) {
|
|
2
2
|
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
3
3
|
} (dayjs_min));
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image}from'../../index-
|
|
1
|
+
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image}from'../../index-dd1b4780.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var template = {
|
|
2
2
|
width: 600,
|
|
3
3
|
height: 315,
|
|
4
4
|
type: 'jpeg',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image}from'../../index-
|
|
1
|
+
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image}from'../../index-dd1b4780.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var template = {
|
|
2
2
|
width: 416,
|
|
3
3
|
height: 250,
|
|
4
4
|
type: 'jpeg',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_ as __awaiter,a as __generator,d as downloadImage,g as getFile,b as getBase64Image}from'../../index-
|
|
1
|
+
import {_ as __awaiter,a as __generator,d as downloadImage,g as getFile,b as getBase64Image}from'../../index-dd1b4780.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var textByType = {
|
|
2
2
|
pnlPercent: 'PnL%',
|
|
3
3
|
pnl: 'PnL$',
|
|
4
4
|
consistencyScore: 'consistency score'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image,d as downloadImage}from'../../index-
|
|
1
|
+
import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image,d as downloadImage}from'../../index-dd1b4780.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var cardTypes = {
|
|
2
2
|
'business': {
|
|
3
3
|
bottomImg: 'images/business.png',
|
|
4
4
|
bgImg: 'images/bg-business.png',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_ as __awaiter,a as __generator,b as getBase64Image,g as getFile,d as downloadImage}from'../../index-
|
|
1
|
+
import {_ as __awaiter,a as __generator,b as getBase64Image,g as getFile,d as downloadImage}from'../../index-dd1b4780.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var hashCode = function (str) {
|
|
2
2
|
return Array.from(str).reduce(function (hash, c) { return (hash << 5) - hash + c.charCodeAt(0); }, 0);
|
|
3
3
|
};
|
|
4
4
|
var generateShapeAvatar = function (address, size, scale) {
|
package/lib/generator.d.ts
CHANGED
|
@@ -15650,7 +15650,7 @@ function requireCommon () {
|
|
|
15650
15650
|
|
|
15651
15651
|
const split = (typeof namespaces === 'string' ? namespaces : '')
|
|
15652
15652
|
.trim()
|
|
15653
|
-
.replace(
|
|
15653
|
+
.replace(/\s+/g, ',')
|
|
15654
15654
|
.split(',')
|
|
15655
15655
|
.filter(Boolean);
|
|
15656
15656
|
|
|
@@ -16000,7 +16000,7 @@ function requireBrowser () {
|
|
|
16000
16000
|
function load() {
|
|
16001
16001
|
let r;
|
|
16002
16002
|
try {
|
|
16003
|
-
r = exports.storage.getItem('debug');
|
|
16003
|
+
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
|
|
16004
16004
|
} catch (error) {
|
|
16005
16005
|
// Swallow
|
|
16006
16006
|
// XXX (@Qix-) should we be logging these?
|
package/lib/index.js
CHANGED
|
@@ -60,11 +60,17 @@ function __generator(thisArg, body) {
|
|
|
60
60
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
61
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}function isProtocolTimeoutError(error) {
|
|
64
|
+
if (!(error instanceof Error))
|
|
65
|
+
return false;
|
|
66
|
+
return (error.name === 'ProtocolError' ||
|
|
67
|
+
/protocol.*timeout|timed out/i.test(error.message));
|
|
68
|
+
}
|
|
69
|
+
var Generator = /** @class */ (function () {
|
|
64
70
|
function Generator(options) {
|
|
65
71
|
if (options === void 0) { options = {}; }
|
|
66
72
|
this.browser = null;
|
|
67
|
-
this.options = __assign({ headless: true, timeout: 30000, args: [
|
|
73
|
+
this.options = __assign({ headless: true, timeout: 30000, protocolTimeout: 60000, args: [
|
|
68
74
|
'--no-sandbox',
|
|
69
75
|
'--disable-setuid-sandbox',
|
|
70
76
|
'--disable-gpu',
|
|
@@ -73,7 +79,6 @@ function __generator(thisArg, body) {
|
|
|
73
79
|
'--disable-web-security',
|
|
74
80
|
'--disable-plugins',
|
|
75
81
|
'--disable-extensions',
|
|
76
|
-
'--disable-background-networking',
|
|
77
82
|
'--disable-background-timer-throttling',
|
|
78
83
|
'--disable-renderer-backgrounding',
|
|
79
84
|
'--disable-backgrounding-occluded-windows',
|
|
@@ -93,38 +98,39 @@ function __generator(thisArg, body) {
|
|
|
93
98
|
] }, options);
|
|
94
99
|
}
|
|
95
100
|
Generator.prototype.run = function () {
|
|
96
|
-
var _a;
|
|
101
|
+
var _a, _b;
|
|
97
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var launchOptions,
|
|
103
|
+
var launchOptions, _c, error_1;
|
|
99
104
|
var _this = this;
|
|
100
|
-
return __generator(this, function (
|
|
101
|
-
switch (
|
|
105
|
+
return __generator(this, function (_d) {
|
|
106
|
+
switch (_d.label) {
|
|
102
107
|
case 0:
|
|
103
108
|
if (this.browser) {
|
|
104
109
|
return [2 /*return*/];
|
|
105
110
|
}
|
|
106
|
-
|
|
111
|
+
_d.label = 1;
|
|
107
112
|
case 1:
|
|
108
|
-
|
|
113
|
+
_d.trys.push([1, 3, , 5]);
|
|
109
114
|
launchOptions = {
|
|
110
115
|
headless: (_a = this.options.headless) !== null && _a !== void 0 ? _a : true,
|
|
111
116
|
devtools: false,
|
|
112
117
|
args: this.options.args,
|
|
113
118
|
timeout: this.options.timeout,
|
|
119
|
+
protocolTimeout: (_b = this.options.protocolTimeout) !== null && _b !== void 0 ? _b : 60000,
|
|
114
120
|
};
|
|
115
|
-
|
|
121
|
+
_c = this;
|
|
116
122
|
return [4 /*yield*/, puppeteer__default["default"].launch(launchOptions)];
|
|
117
123
|
case 2:
|
|
118
|
-
|
|
124
|
+
_c.browser = _d.sent();
|
|
119
125
|
this.browser.on('disconnected', function () {
|
|
120
126
|
_this.browser = null;
|
|
121
127
|
});
|
|
122
128
|
return [3 /*break*/, 5];
|
|
123
129
|
case 3:
|
|
124
|
-
error_1 =
|
|
130
|
+
error_1 = _d.sent();
|
|
125
131
|
return [4 /*yield*/, this.cleanup()];
|
|
126
132
|
case 4:
|
|
127
|
-
|
|
133
|
+
_d.sent();
|
|
128
134
|
throw new Error("Failed to initialize generator: ".concat(error_1 instanceof Error ? error_1.message : 'Unknown error'));
|
|
129
135
|
case 5: return [2 /*return*/];
|
|
130
136
|
}
|
|
@@ -134,131 +140,168 @@ function __generator(thisArg, body) {
|
|
|
134
140
|
Generator.prototype.generate = function (props) {
|
|
135
141
|
var _a, _b;
|
|
136
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var
|
|
138
|
-
return __generator(this, function (
|
|
139
|
-
switch (
|
|
143
|
+
var maxAttempts, lastError, _loop_1, this_1, attempt, state_1, errorMessage;
|
|
144
|
+
return __generator(this, function (_c) {
|
|
145
|
+
switch (_c.label) {
|
|
140
146
|
case 0:
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
maxAttempts = 2;
|
|
148
|
+
_loop_1 = function (attempt) {
|
|
149
|
+
var template, templateProps, output, filename, _d, options, width, height, type, getHtml, _e, quality, _f, fullPage, _g, waitForFonts, _h, waitTimeout_1, _j, waitUntil, _k, skipAnimations, page, htmlContent, content, _l, screenshotOptions, imageBuffer, innerError_1, error_2;
|
|
150
|
+
return __generator(this, function (_m) {
|
|
151
|
+
switch (_m.label) {
|
|
152
|
+
case 0:
|
|
153
|
+
_m.trys.push([0, 23, , 26]);
|
|
154
|
+
if (!!this_1.browser) return [3 /*break*/, 2];
|
|
155
|
+
return [4 /*yield*/, this_1.run()];
|
|
156
|
+
case 1:
|
|
157
|
+
_m.sent();
|
|
158
|
+
_m.label = 2;
|
|
159
|
+
case 2:
|
|
160
|
+
template = props.template, templateProps = props.props, output = props.output, filename = props.filename, _d = props.options, options = _d === void 0 ? {} : _d;
|
|
161
|
+
// Validate template
|
|
162
|
+
if (!template.width || !template.height || !template.html) {
|
|
163
|
+
throw new Error('Invalid template: missing required properties');
|
|
164
|
+
}
|
|
165
|
+
width = template.width, height = template.height, type = template.type, getHtml = template.html;
|
|
166
|
+
_e = options.quality, quality = _e === void 0 ? type === 'jpeg' ? 85 : undefined : _e, _f = options.fullPage, fullPage = _f === void 0 ? false : _f, _g = options.waitForFonts, waitForFonts = _g === void 0 ? true : _g, _h = options.waitTimeout, waitTimeout_1 = _h === void 0 ? 2000 : _h, _j = options.waitUntil, waitUntil = _j === void 0 ? 'load' : _j, _k = options.skipAnimations, skipAnimations = _k === void 0 ? true : _k;
|
|
167
|
+
return [4 /*yield*/, this_1.browser.newPage()];
|
|
168
|
+
case 3:
|
|
169
|
+
page = _m.sent();
|
|
170
|
+
// Set reasonable timeout instead of infinite
|
|
171
|
+
page.setDefaultNavigationTimeout((_a = this_1.options.timeout) !== null && _a !== void 0 ? _a : 30000);
|
|
172
|
+
page.setDefaultTimeout((_b = this_1.options.timeout) !== null && _b !== void 0 ? _b : 30000);
|
|
173
|
+
// Optimize page performance
|
|
174
|
+
return [4 /*yield*/, page.setCacheEnabled(false)];
|
|
175
|
+
case 4:
|
|
176
|
+
// Optimize page performance
|
|
177
|
+
_m.sent();
|
|
178
|
+
return [4 /*yield*/, page.setJavaScriptEnabled(true)];
|
|
179
|
+
case 5:
|
|
180
|
+
_m.sent();
|
|
181
|
+
// Block unnecessary network requests for faster rendering
|
|
182
|
+
return [4 /*yield*/, page.setRequestInterception(true)];
|
|
183
|
+
case 6:
|
|
184
|
+
// Block unnecessary network requests for faster rendering
|
|
185
|
+
_m.sent();
|
|
186
|
+
page.on('request', function (req) {
|
|
187
|
+
var resourceType = req.resourceType();
|
|
188
|
+
if (['media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
|
|
189
|
+
req.abort();
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
req.continue();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
_m.label = 7;
|
|
196
|
+
case 7:
|
|
197
|
+
_m.trys.push([7, 20, , 22]);
|
|
198
|
+
// Set viewport for this generation
|
|
199
|
+
return [4 /*yield*/, page.setViewport({
|
|
200
|
+
width: width,
|
|
201
|
+
height: height,
|
|
202
|
+
deviceScaleFactor: 1,
|
|
203
|
+
})];
|
|
204
|
+
case 8:
|
|
205
|
+
// Set viewport for this generation
|
|
206
|
+
_m.sent();
|
|
207
|
+
return [4 /*yield*/, getHtml(templateProps)];
|
|
208
|
+
case 9:
|
|
209
|
+
htmlContent = _m.sent();
|
|
210
|
+
if (!htmlContent || typeof htmlContent !== 'string') {
|
|
211
|
+
throw new Error('Template html function must return a non-empty string');
|
|
212
|
+
}
|
|
213
|
+
// Load content with faster wait strategy
|
|
214
|
+
return [4 /*yield*/, Promise.race([
|
|
215
|
+
page.setContent(htmlContent, { waitUntil: waitUntil }),
|
|
216
|
+
new Promise(function (_, reject) {
|
|
217
|
+
return setTimeout(function () { return reject(new Error('Content loading timeout')); }, waitTimeout_1);
|
|
218
|
+
}),
|
|
219
|
+
])];
|
|
220
|
+
case 10:
|
|
221
|
+
// Load content with faster wait strategy
|
|
222
|
+
_m.sent();
|
|
223
|
+
if (!waitForFonts) return [3 /*break*/, 12];
|
|
224
|
+
return [4 /*yield*/, Promise.race([
|
|
225
|
+
page.evaluate(function () { return document.fonts.ready; }),
|
|
226
|
+
new Promise(function (_, reject) {
|
|
227
|
+
return setTimeout(function () { return reject(new Error('Font loading timeout')); }, waitTimeout_1);
|
|
228
|
+
}),
|
|
229
|
+
]).catch(function () { })];
|
|
230
|
+
case 11:
|
|
231
|
+
_m.sent();
|
|
232
|
+
_m.label = 12;
|
|
233
|
+
case 12:
|
|
234
|
+
if (!!skipAnimations) return [3 /*break*/, 14];
|
|
235
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 100); })];
|
|
236
|
+
case 13:
|
|
237
|
+
_m.sent();
|
|
238
|
+
_m.label = 14;
|
|
239
|
+
case 14:
|
|
240
|
+
if (!fullPage) return [3 /*break*/, 15];
|
|
241
|
+
_l = page;
|
|
242
|
+
return [3 /*break*/, 17];
|
|
243
|
+
case 15: return [4 /*yield*/, page.$('body')];
|
|
244
|
+
case 16:
|
|
245
|
+
_l = _m.sent();
|
|
246
|
+
_m.label = 17;
|
|
247
|
+
case 17:
|
|
248
|
+
content = _l;
|
|
249
|
+
if (!content) {
|
|
250
|
+
throw new Error('Failed to find content element');
|
|
251
|
+
}
|
|
252
|
+
screenshotOptions = __assign({ omitBackground: true, type: type }, (type === 'jpeg' && quality ? { quality: quality } : {}));
|
|
253
|
+
if (output && filename) {
|
|
254
|
+
if (!fs__default["default"].existsSync(output)) {
|
|
255
|
+
fs__default["default"].mkdirSync(output);
|
|
256
|
+
}
|
|
257
|
+
screenshotOptions.path = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
258
|
+
}
|
|
259
|
+
return [4 /*yield*/, content.screenshot(screenshotOptions)];
|
|
260
|
+
case 18:
|
|
261
|
+
imageBuffer = _m.sent();
|
|
262
|
+
return [4 /*yield*/, page.close()];
|
|
263
|
+
case 19:
|
|
264
|
+
_m.sent();
|
|
265
|
+
return [2 /*return*/, { value: imageBuffer }];
|
|
266
|
+
case 20:
|
|
267
|
+
innerError_1 = _m.sent();
|
|
268
|
+
return [4 /*yield*/, page.close().catch(function () { })];
|
|
269
|
+
case 21:
|
|
270
|
+
_m.sent();
|
|
271
|
+
throw innerError_1;
|
|
272
|
+
case 22: return [3 /*break*/, 26];
|
|
273
|
+
case 23:
|
|
274
|
+
error_2 = _m.sent();
|
|
275
|
+
lastError = error_2;
|
|
276
|
+
if (!(attempt < maxAttempts && isProtocolTimeoutError(error_2))) return [3 /*break*/, 25];
|
|
277
|
+
return [4 /*yield*/, this_1.cleanup()];
|
|
278
|
+
case 24:
|
|
279
|
+
_m.sent();
|
|
280
|
+
return [2 /*return*/, "continue"];
|
|
281
|
+
case 25: return [2 /*return*/, "break"];
|
|
282
|
+
case 26: return [2 /*return*/];
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
this_1 = this;
|
|
287
|
+
attempt = 1;
|
|
288
|
+
_c.label = 1;
|
|
143
289
|
case 1:
|
|
144
|
-
|
|
145
|
-
|
|
290
|
+
if (!(attempt <= maxAttempts)) return [3 /*break*/, 4];
|
|
291
|
+
return [5 /*yield**/, _loop_1(attempt)];
|
|
146
292
|
case 2:
|
|
147
|
-
|
|
148
|
-
|
|
293
|
+
state_1 = _c.sent();
|
|
294
|
+
if (typeof state_1 === "object")
|
|
295
|
+
return [2 /*return*/, state_1.value];
|
|
296
|
+
if (state_1 === "break")
|
|
297
|
+
return [3 /*break*/, 4];
|
|
298
|
+
_c.label = 3;
|
|
149
299
|
case 3:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
page.setDefaultNavigationTimeout((_a = this.options.timeout) !== null && _a !== void 0 ? _a : 30000);
|
|
153
|
-
page.setDefaultTimeout((_b = this.options.timeout) !== null && _b !== void 0 ? _b : 30000);
|
|
154
|
-
// Optimize page performance
|
|
155
|
-
return [4 /*yield*/, page.setCacheEnabled(false)];
|
|
300
|
+
attempt++;
|
|
301
|
+
return [3 /*break*/, 1];
|
|
156
302
|
case 4:
|
|
157
|
-
|
|
158
|
-
_l.sent();
|
|
159
|
-
return [4 /*yield*/, page.setJavaScriptEnabled(true)];
|
|
160
|
-
case 5:
|
|
161
|
-
_l.sent();
|
|
162
|
-
// Block unnecessary network requests for faster rendering
|
|
163
|
-
return [4 /*yield*/, page.setRequestInterception(true)];
|
|
164
|
-
case 6:
|
|
165
|
-
// Block unnecessary network requests for faster rendering
|
|
166
|
-
_l.sent();
|
|
167
|
-
page.on('request', function (req) {
|
|
168
|
-
var resourceType = req.resourceType();
|
|
169
|
-
// Block only truly unnecessary resources that don't affect rendering
|
|
170
|
-
// Allow images, stylesheets, scripts, fonts, and data URLs
|
|
171
|
-
if (['media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
|
|
172
|
-
req.abort();
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
req.continue();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
// Validate template
|
|
179
|
-
if (!template.width || !template.height || !template.html) {
|
|
180
|
-
throw new Error('Invalid template: missing required properties');
|
|
181
|
-
}
|
|
182
|
-
width = template.width, height = template.height, type = template.type, getHtml = template.html;
|
|
183
|
-
_d = options.quality, quality = _d === void 0 ? type === 'jpeg' ? 85 : undefined : _d, _e = options.fullPage, fullPage = _e === void 0 ? false : _e, _f = options.waitForFonts, waitForFonts = _f === void 0 ? true : _f, _g = options.waitTimeout, waitTimeout = _g === void 0 ? 2000 : _g, _h = options.waitUntil, waitUntil = _h === void 0 ? 'load' : _h, _j = options.skipAnimations, skipAnimations = _j === void 0 ? true : _j;
|
|
184
|
-
_l.label = 7;
|
|
185
|
-
case 7:
|
|
186
|
-
_l.trys.push([7, 20, , 21]);
|
|
187
|
-
// Set viewport for this generation
|
|
188
|
-
return [4 /*yield*/, page.setViewport({
|
|
189
|
-
width: width,
|
|
190
|
-
height: height,
|
|
191
|
-
deviceScaleFactor: 1,
|
|
192
|
-
})];
|
|
193
|
-
case 8:
|
|
194
|
-
// Set viewport for this generation
|
|
195
|
-
_l.sent();
|
|
196
|
-
return [4 /*yield*/, getHtml(templateProps)];
|
|
197
|
-
case 9:
|
|
198
|
-
htmlContent = _l.sent();
|
|
199
|
-
if (!htmlContent || typeof htmlContent !== 'string') {
|
|
200
|
-
throw new Error('Template html function must return a non-empty string');
|
|
201
|
-
}
|
|
202
|
-
// Load content with faster wait strategy
|
|
203
|
-
return [4 /*yield*/, Promise.race([
|
|
204
|
-
page.setContent(htmlContent, { waitUntil: waitUntil }),
|
|
205
|
-
new Promise(function (_, reject) {
|
|
206
|
-
return setTimeout(function () { return reject(new Error('Content loading timeout')); }, waitTimeout);
|
|
207
|
-
}),
|
|
208
|
-
])];
|
|
209
|
-
case 10:
|
|
210
|
-
// Load content with faster wait strategy
|
|
211
|
-
_l.sent();
|
|
212
|
-
if (!waitForFonts) return [3 /*break*/, 12];
|
|
213
|
-
return [4 /*yield*/, Promise.race([
|
|
214
|
-
page.evaluate(function () { return document.fonts.ready; }),
|
|
215
|
-
new Promise(function (_, reject) {
|
|
216
|
-
return setTimeout(function () { return reject(new Error('Font loading timeout')); }, waitTimeout);
|
|
217
|
-
}),
|
|
218
|
-
]).catch(function () {
|
|
219
|
-
// Font loading timeout is not critical, continue anyway
|
|
220
|
-
})];
|
|
221
|
-
case 11:
|
|
222
|
-
_l.sent();
|
|
223
|
-
_l.label = 12;
|
|
224
|
-
case 12:
|
|
225
|
-
if (!!skipAnimations) return [3 /*break*/, 14];
|
|
226
|
-
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 100); })];
|
|
227
|
-
case 13:
|
|
228
|
-
_l.sent();
|
|
229
|
-
_l.label = 14;
|
|
230
|
-
case 14:
|
|
231
|
-
if (!fullPage) return [3 /*break*/, 15];
|
|
232
|
-
_k = page;
|
|
233
|
-
return [3 /*break*/, 17];
|
|
234
|
-
case 15: return [4 /*yield*/, page.$('body')];
|
|
235
|
-
case 16:
|
|
236
|
-
_k = _l.sent();
|
|
237
|
-
_l.label = 17;
|
|
238
|
-
case 17:
|
|
239
|
-
content = _k;
|
|
240
|
-
if (!content) {
|
|
241
|
-
throw new Error('Failed to find content element');
|
|
242
|
-
}
|
|
243
|
-
screenshotOptions = __assign({ omitBackground: true, type: type }, (type === 'jpeg' && quality ? { quality: quality } : {}));
|
|
244
|
-
if (output && filename) {
|
|
245
|
-
if (!fs__default["default"].existsSync(output)) {
|
|
246
|
-
fs__default["default"].mkdirSync(output);
|
|
247
|
-
}
|
|
248
|
-
screenshotOptions.path = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
249
|
-
}
|
|
250
|
-
return [4 /*yield*/, content.screenshot(screenshotOptions)];
|
|
251
|
-
case 18:
|
|
252
|
-
imageBuffer = _l.sent();
|
|
253
|
-
return [4 /*yield*/, page.close()];
|
|
254
|
-
case 19:
|
|
255
|
-
_l.sent();
|
|
256
|
-
return [2 /*return*/, imageBuffer];
|
|
257
|
-
case 20:
|
|
258
|
-
error_2 = _l.sent();
|
|
259
|
-
errorMessage = error_2 instanceof Error ? error_2.message : 'Unknown error occurred';
|
|
303
|
+
errorMessage = lastError instanceof Error ? lastError.message : 'Unknown error occurred';
|
|
260
304
|
throw new Error("Failed to generate image: ".concat(errorMessage));
|
|
261
|
-
case 21: return [2 /*return*/];
|
|
262
305
|
}
|
|
263
306
|
});
|
|
264
307
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var index=require('../../index-
|
|
1
|
+
'use strict';var index=require('../../index-0f16798b.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var matchType = {
|
|
2
2
|
'match': 'Waiting for match',
|
|
3
3
|
'claim': 'Waiting for claim',
|
|
4
4
|
'claimed': 'Claimed',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var index=require('../../index-
|
|
1
|
+
'use strict';var index=require('../../index-0f16798b.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};var dayjs_min = {exports: {}};(function (module, exports) {
|
|
2
2
|
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
3
3
|
} (dayjs_min));
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var index=require('../../index-
|
|
1
|
+
'use strict';var index=require('../../index-0f16798b.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var template = {
|
|
2
2
|
width: 600,
|
|
3
3
|
height: 315,
|
|
4
4
|
type: 'jpeg',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var index=require('../../index-
|
|
1
|
+
'use strict';var index=require('../../index-0f16798b.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var template = {
|
|
2
2
|
width: 416,
|
|
3
3
|
height: 250,
|
|
4
4
|
type: 'jpeg',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var index=require('../../index-
|
|
1
|
+
'use strict';var index=require('../../index-0f16798b.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var textByType = {
|
|
2
2
|
pnlPercent: 'PnL%',
|
|
3
3
|
pnl: 'PnL$',
|
|
4
4
|
consistencyScore: 'consistency score'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var index=require('../../index-
|
|
1
|
+
'use strict';var index=require('../../index-0f16798b.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var cardTypes = {
|
|
2
2
|
'business': {
|
|
3
3
|
bottomImg: 'images/business.png',
|
|
4
4
|
bgImg: 'images/bg-business.png',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var index=require('../../index-
|
|
1
|
+
'use strict';var index=require('../../index-0f16798b.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var hashCode = function (str) {
|
|
2
2
|
return Array.from(str).reduce(function (hash, c) { return (hash << 5) - hash + c.charCodeAt(0); }, 0);
|
|
3
3
|
};
|
|
4
4
|
var generateShapeAvatar = function (address, size, scale) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azuro-org/images-generator",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.1",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"axios": "^1.12.2",
|
|
21
21
|
"builtin-modules": "^3.2.0",
|
|
22
22
|
"dayjs": "^1.11.7",
|
|
23
|
-
"puppeteer": "^24.
|
|
23
|
+
"puppeteer": "^24.39.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@babel/core": "^7.17.0",
|