@devlas/dte-sii 2.8.0 → 2.8.2

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.
Files changed (2) hide show
  1. package/package.json +2 -4
  2. package/utils/browser.js +17 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlas/dte-sii",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Facturación y boletas electrónicas para el SII de Chile. Genera, timbra, firma y envía DTEs, libros electrónicos y automatiza la certificación.",
5
5
  "main": "index.js",
6
6
  "types": "dte-sii.d.ts",
@@ -29,6 +29,7 @@
29
29
  "node": ">=18.0.0"
30
30
  },
31
31
  "dependencies": {
32
+ "@sparticuz/chromium": "^147.0.0",
32
33
  "@xmldom/xmldom": "^0.8.11",
33
34
  "bwip-js": "^4.8.0",
34
35
  "dotenv": "^17.3.1",
@@ -40,9 +41,6 @@
40
41
  "xml-c14n": "^0.0.6",
41
42
  "xml-crypto": "^6.1.2"
42
43
  },
43
- "optionalDependencies": {
44
- "@sparticuz/chromium": "^133.0.0"
45
- },
46
44
  "files": [
47
45
  "index.js",
48
46
  "dte-sii.d.ts",
package/utils/browser.js CHANGED
@@ -21,17 +21,23 @@ const puppeteer = require('puppeteer');
21
21
  * @returns {Promise<import('puppeteer').LaunchOptions>}
22
22
  */
23
23
  async function getLaunchOptions() {
24
- // 1. Intentar @sparticuz/chromium (viene en el paquete, funciona en serverless)
25
- try {
26
- const chromium = require('@sparticuz/chromium');
27
- return {
28
- args: chromium.args,
29
- defaultViewport: chromium.defaultViewport,
30
- executablePath: await chromium.executablePath(),
31
- headless: chromium.headless ?? true,
32
- };
33
- } catch {
34
- // No está disponible, continuar con fallback
24
+ // 1. @sparticuz/chromium solo en Linux (Railway/serverless). En Windows entrega
25
+ // un binario ELF que existe en disco pero no es ejecutable.
26
+ if (process.platform !== 'win32') {
27
+ try {
28
+ const chromium = require('@sparticuz/chromium');
29
+ const executablePath = await chromium.executablePath();
30
+ if (executablePath) {
31
+ return {
32
+ args: chromium.args,
33
+ defaultViewport: chromium.defaultViewport,
34
+ executablePath,
35
+ headless: chromium.headless ?? true,
36
+ };
37
+ }
38
+ } catch {
39
+ // No está disponible, continuar con fallback
40
+ }
35
41
  }
36
42
 
37
43
  // 2. Ruta explícita por variable de entorno