@vesk/adapter 0.2.40 → 0.2.42
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-pipeline.d.ts","sourceRoot":"","sources":["../src/image-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image-pipeline.d.ts","sourceRoot":"","sources":["../src/image-pipeline.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsGrE,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAgD3F"}
|
package/dist/image-pipeline.js
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync, readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
2
3
|
import { resolve, extname, dirname } from 'node:path';
|
|
3
4
|
const SUPPORTED = new Set(['.jpg', '.jpeg', '.png', '.webp', '.avif', '.tiff']);
|
|
4
5
|
const OUTPUT_WIDTHS = [640, 768, 1024, 1280, 1536];
|
|
5
6
|
const FORMATS = ['webp', 'avif'];
|
|
6
7
|
let sharpFn = null;
|
|
7
8
|
try {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
// Probe in a child before importing sharp in this process. On older CPUs,
|
|
10
|
+
// importing the native module itself can terminate Node with SIGILL; an
|
|
11
|
+
// in-process try/catch cannot catch that signal.
|
|
12
|
+
const probe = spawnSync(process.execPath, [
|
|
13
|
+
'--input-type=module',
|
|
14
|
+
'-e',
|
|
15
|
+
"import sharp from 'sharp'; await sharp({ create: { width: 2, height: 2, channels: 3, background: 'red' } }).png().toBuffer();",
|
|
16
|
+
], { stdio: 'ignore' });
|
|
17
|
+
if (probe.status === 0) {
|
|
18
|
+
const mod = await import('sharp');
|
|
19
|
+
sharpFn = mod.default;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.warn('vesk images: sharp native probe failed; using copy-only image pipeline');
|
|
23
|
+
}
|
|
10
24
|
}
|
|
11
25
|
catch {
|
|
12
26
|
// sharp not available — fall through to copy-only
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/adapter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk adapter — builds deployable .vesk/ output for Deno and Node serverless",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"sharp": "^0.35.3"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@vesk/compiler": "^0.2.
|
|
27
|
-
"@vesk/runtime": "^0.2.
|
|
28
|
-
"@vesk/types": "^0.2.
|
|
26
|
+
"@vesk/compiler": "^0.2.42",
|
|
27
|
+
"@vesk/runtime": "^0.2.42",
|
|
28
|
+
"@vesk/types": "^0.2.42"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/ws": "^8.18.1",
|