drone-path-engine 1.1.1 → 1.2.1
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/pipeline.js +7 -9
- package/dist/render-cancellation.d.ts +1 -0
- package/dist/render-cancellation.js +4 -0
- package/dist/render.js +7 -9
- package/package.json +16 -5
package/dist/pipeline.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { ERR_OUTPUT_VERIFICATION,
|
|
3
|
+
import { ERR_OUTPUT_VERIFICATION, codedError, errorMessage } from 'drone-path-core/errors';
|
|
4
|
+
import { renderCanceledError } from './render-cancellation.js';
|
|
4
5
|
import { probeVideo } from 'drone-path-core/ffmpeg';
|
|
5
6
|
import { outputMatchesSource, verifyOutput } from './ffmpeg-output.js';
|
|
6
7
|
import { resolveFfmpegTools } from 'drone-path-core/ffmpeg-tools';
|
|
@@ -175,12 +176,9 @@ async function viewPlanStage(env, tel) {
|
|
|
175
176
|
log(describeView(config, overview, config.style));
|
|
176
177
|
return overview;
|
|
177
178
|
}
|
|
178
|
-
function canceledError(cause) {
|
|
179
|
-
return codedError(ERR_RENDER_CANCELED, { code: 'RENDER_CANCELED', cause });
|
|
180
|
-
}
|
|
181
179
|
async function tileWarmStage(deps, config, overview, log, signal) {
|
|
182
180
|
if (signal?.aborted)
|
|
183
|
-
throw
|
|
181
|
+
throw renderCanceledError();
|
|
184
182
|
let tileStats;
|
|
185
183
|
try {
|
|
186
184
|
tileStats = await deps.prefetchTiles({
|
|
@@ -192,11 +190,11 @@ async function tileWarmStage(deps, config, overview, log, signal) {
|
|
|
192
190
|
}
|
|
193
191
|
catch (err) {
|
|
194
192
|
if (signal?.aborted)
|
|
195
|
-
throw
|
|
193
|
+
throw renderCanceledError(err);
|
|
196
194
|
throw err;
|
|
197
195
|
}
|
|
198
196
|
if (signal?.aborted)
|
|
199
|
-
throw
|
|
197
|
+
throw renderCanceledError();
|
|
200
198
|
if (tileStats.downloaded) {
|
|
201
199
|
log(`tiles: ${tileStats.downloaded} downloaded, ${tileStats.failed} placeholders`);
|
|
202
200
|
}
|
|
@@ -361,7 +359,7 @@ export async function processRecording(videoPath, config, log, outPath = outputP
|
|
|
361
359
|
const deps = resolveDeps(options.deps, config.tileCache);
|
|
362
360
|
const tools = options.tools ?? resolveFfmpegTools(config);
|
|
363
361
|
if (options.signal?.aborted)
|
|
364
|
-
throw
|
|
362
|
+
throw renderCanceledError();
|
|
365
363
|
const prep = await prepareWithEnv({
|
|
366
364
|
videoPath,
|
|
367
365
|
config,
|
|
@@ -371,7 +369,7 @@ export async function processRecording(videoPath, config, log, outPath = outputP
|
|
|
371
369
|
report: createPrepareReporter(options.onProgress),
|
|
372
370
|
});
|
|
373
371
|
if (options.signal?.aborted)
|
|
374
|
-
throw
|
|
372
|
+
throw renderCanceledError();
|
|
375
373
|
if (config.trackOut) {
|
|
376
374
|
writeTrackExport(config.trackOut, prep, log);
|
|
377
375
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderCanceledError(cause?: unknown): Error;
|
package/dist/render.js
CHANGED
|
@@ -2,8 +2,9 @@ import http from 'node:http';
|
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
3
|
import { once } from 'node:events';
|
|
4
4
|
import { MIME } from './assets.js';
|
|
5
|
-
import { ERR_RENDER_CANCELED,
|
|
5
|
+
import { ERR_RENDER_CANCELED, errorMessage } from 'drone-path-core/errors';
|
|
6
6
|
import { RENDERER_DIR, serveAsset } from './serve.js';
|
|
7
|
+
import { renderCanceledError } from './render-cancellation.js';
|
|
7
8
|
const PAGE_LOAD_TIMEOUT_MS = 60000;
|
|
8
9
|
const SCREENSHOT_TIMEOUT_MS = 60000;
|
|
9
10
|
function startServer({ html, style, tileCache, log, }) {
|
|
@@ -267,9 +268,6 @@ async function captureFrame(run, loop, page, idx) {
|
|
|
267
268
|
run.onCapture?.({ done, total: run.frames });
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
|
-
function canceledError(cause) {
|
|
271
|
-
return codedError(ERR_RENDER_CANCELED, { code: 'RENDER_CANCELED', cause });
|
|
272
|
-
}
|
|
273
271
|
async function workerLoop(run, loop, workerId) {
|
|
274
272
|
const page = await run.active.newPage({
|
|
275
273
|
viewport: { width: run.width, height: run.height },
|
|
@@ -282,7 +280,7 @@ async function workerLoop(run, loop, workerId) {
|
|
|
282
280
|
if (loop.failed)
|
|
283
281
|
return;
|
|
284
282
|
if (run.signal?.aborted)
|
|
285
|
-
throw
|
|
283
|
+
throw renderCanceledError();
|
|
286
284
|
const idx = loop.cursor++;
|
|
287
285
|
if (idx >= run.frames)
|
|
288
286
|
break;
|
|
@@ -329,13 +327,13 @@ async function captureAndEncode(active, env) {
|
|
|
329
327
|
const stream = new OrderedFrameStream(encoder, workerCount);
|
|
330
328
|
const abortEncode = () => {
|
|
331
329
|
encoder.kill();
|
|
332
|
-
stream.abort(
|
|
330
|
+
stream.abort(renderCanceledError());
|
|
333
331
|
};
|
|
334
332
|
signal?.addEventListener('abort', abortEncode, { once: true });
|
|
335
333
|
try {
|
|
336
334
|
await runWorkers({ ...ctx, active, url, stream, timing }, workerCount);
|
|
337
335
|
if (signal?.aborted)
|
|
338
|
-
throw
|
|
336
|
+
throw renderCanceledError();
|
|
339
337
|
await finishEncode(encoder, stream, log, outPath);
|
|
340
338
|
}
|
|
341
339
|
catch (e) {
|
|
@@ -344,7 +342,7 @@ async function captureAndEncode(active, env) {
|
|
|
344
342
|
if (signal?.aborted) {
|
|
345
343
|
throw e instanceof Error && e.message === ERR_RENDER_CANCELED
|
|
346
344
|
? e
|
|
347
|
-
:
|
|
345
|
+
: renderCanceledError(e);
|
|
348
346
|
}
|
|
349
347
|
throw e;
|
|
350
348
|
}
|
|
@@ -382,7 +380,7 @@ export async function renderVideo(opts) {
|
|
|
382
380
|
tools,
|
|
383
381
|
};
|
|
384
382
|
if (signal?.aborted)
|
|
385
|
-
throw
|
|
383
|
+
throw renderCanceledError();
|
|
386
384
|
const timing = { evalMs: 0, captureMs: 0, emitMs: 0 };
|
|
387
385
|
const { server, url } = await startServer({ html, style, tileCache, log });
|
|
388
386
|
const env = { ctx, url, timing, workerCount };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drone-path-engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Plan and render flight-path map overlays from drone telemetry.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -18,19 +18,30 @@
|
|
|
18
18
|
"node": ">=24"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "
|
|
22
|
-
"prepack": "
|
|
21
|
+
"build": "tsc -b",
|
|
22
|
+
"prepack": "node ../../scripts/clean-package-dist.mjs && tsc -b"
|
|
23
23
|
},
|
|
24
24
|
"author": "Manuel Warum",
|
|
25
25
|
"license": "MIT",
|
|
26
|
+
"homepage": "https://www.dronepath.dev",
|
|
27
|
+
"keywords": [
|
|
28
|
+
"dji",
|
|
29
|
+
"drone",
|
|
30
|
+
"telemetry",
|
|
31
|
+
"gpx",
|
|
32
|
+
"srt",
|
|
33
|
+
"kml",
|
|
34
|
+
"mcp",
|
|
35
|
+
"davinci-resolve"
|
|
36
|
+
],
|
|
26
37
|
"repository": {
|
|
27
38
|
"type": "git",
|
|
28
39
|
"url": "git+https://github.com/MrManny/drone-path.git",
|
|
29
40
|
"directory": "packages/engine"
|
|
30
41
|
},
|
|
31
42
|
"dependencies": {
|
|
32
|
-
"@types/leaflet": "~1.9.
|
|
33
|
-
"drone-path-core": "~1.
|
|
43
|
+
"@types/leaflet": "~1.9.23",
|
|
44
|
+
"drone-path-core": "~1.2.1",
|
|
34
45
|
"leaflet": "~1.9.4",
|
|
35
46
|
"p-queue": "~10.0.0",
|
|
36
47
|
"playwright-core": "~1.65.0",
|