forge-terminal 0.1.0 → 0.2.0
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/README.md +305 -24
- package/dist/chunks/adm-zip-SQKLKBDP.js +3 -0
- package/dist/chunks/available-2VX7K7W6.js +3 -0
- package/dist/chunks/boot-ODZZHFUI.js +3 -0
- package/dist/chunks/cfb-V6M2PYOD.js +13 -0
- package/dist/chunks/chunk-2WYHI73Y.js +3 -0
- package/dist/chunks/chunk-4YHKTP7I.js +3 -0
- package/dist/chunks/chunk-5PYTOHLZ.js +3 -0
- package/dist/chunks/chunk-7YQR2MVH.js +3 -0
- package/dist/chunks/chunk-DRBA23IQ.js +3 -0
- package/dist/chunks/chunk-EOYBXOCV.js +4 -0
- package/dist/chunks/chunk-FQV57RMH.js +3 -0
- package/dist/chunks/chunk-IMKI5F4I.js +4 -0
- package/dist/chunks/chunk-J7FLFHQJ.js +3 -0
- package/dist/chunks/chunk-L2WK7CJG.js +3 -0
- package/dist/chunks/chunk-LFE3WRU4.js +3 -0
- package/dist/chunks/chunk-MHFY7HF6.js +10 -0
- package/dist/chunks/chunk-PBIS2ONZ.js +3 -0
- package/dist/chunks/chunk-QVACE4IE.js +3 -0
- package/dist/chunks/chunk-TMUK2DD3.js +3 -0
- package/dist/chunks/chunk-UNVHKJW4.js +41 -0
- package/dist/chunks/chunk-V4GHQGQM.js +4 -0
- package/dist/chunks/chunk-VB665HTV.js +3 -0
- package/dist/chunks/chunk-YHK5VE5R.js +3 -0
- package/dist/chunks/colour-QV2C3R7R.js +3 -0
- package/dist/chunks/config-command-UXJY623L.js +3 -0
- package/dist/chunks/dist-J2V6ITHG.js +29 -0
- package/dist/chunks/es-T2U7NBLD.js +3 -0
- package/dist/chunks/execute-4WJCUM7J.js +3 -0
- package/dist/chunks/extensions-command-6WZV2AES.js +3 -0
- package/dist/chunks/launch-2OI4ZLBQ.js +66 -0
- package/dist/chunks/lib-TPEJ5CJJ.js +46 -0
- package/dist/chunks/lock-R6GZXCCW.js +3 -0
- package/dist/chunks/manager-H52ENJOH.js +4 -0
- package/dist/chunks/paths-XY2345OS.js +3 -0
- package/dist/chunks/pdf-compress-IMRFBLZF.js +3 -0
- package/dist/chunks/react-devtools-core-UM4FS6CU.js +3 -0
- package/dist/chunks/run-N3F4EM7E.js +4 -0
- package/dist/chunks/server-5RWSVTOM.js +73 -0
- package/dist/chunks/theme-GW7CQPUO.js +3 -0
- package/dist/chunks/word-OGQ2KZAJ.js +24 -0
- package/dist/index.js +67 -95
- package/dist/third-party-licenses.txt +2856 -0
- package/package.json +28 -21
- package/skills/forge/SKILL.md +128 -0
- package/dist/cli/args.js +0 -278
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/config-command.js +0 -55
- package/dist/cli/config-command.js.map +0 -1
- package/dist/cli/execute.js +0 -377
- package/dist/cli/execute.js.map +0 -1
- package/dist/cli/report.js +0 -123
- package/dist/cli/report.js.map +0 -1
- package/dist/cli/spinner.js +0 -60
- package/dist/cli/spinner.js.map +0 -1
- package/dist/cli/stdin.js +0 -47
- package/dist/cli/stdin.js.map +0 -1
- package/dist/config/preferences.js +0 -143
- package/dist/config/preferences.js.map +0 -1
- package/dist/core/actions/compress.js +0 -157
- package/dist/core/actions/compress.js.map +0 -1
- package/dist/core/actions/convert.js +0 -270
- package/dist/core/actions/convert.js.map +0 -1
- package/dist/core/actions/extract.js +0 -94
- package/dist/core/actions/extract.js.map +0 -1
- package/dist/core/actions/index.js +0 -23
- package/dist/core/actions/index.js.map +0 -1
- package/dist/core/actions/merge.js +0 -16
- package/dist/core/actions/merge.js.map +0 -1
- package/dist/core/actions/rotate.js +0 -36
- package/dist/core/actions/rotate.js.map +0 -1
- package/dist/core/actions/split.js +0 -65
- package/dist/core/actions/split.js.map +0 -1
- package/dist/core/atomic.js +0 -61
- package/dist/core/atomic.js.map +0 -1
- package/dist/core/capabilities.js +0 -59
- package/dist/core/capabilities.js.map +0 -1
- package/dist/core/compress.js +0 -76
- package/dist/core/compress.js.map +0 -1
- package/dist/core/describe.js +0 -49
- package/dist/core/describe.js.map +0 -1
- package/dist/core/errors.js +0 -469
- package/dist/core/errors.js.map +0 -1
- package/dist/core/execute-jobs.js +0 -122
- package/dist/core/execute-jobs.js.map +0 -1
- package/dist/core/formats.js +0 -108
- package/dist/core/formats.js.map +0 -1
- package/dist/core/order.js +0 -44
- package/dist/core/order.js.map +0 -1
- package/dist/core/output-path.js +0 -176
- package/dist/core/output-path.js.map +0 -1
- package/dist/core/pages.js +0 -107
- package/dist/core/pages.js.map +0 -1
- package/dist/core/pdf-compress.js +0 -206
- package/dist/core/pdf-compress.js.map +0 -1
- package/dist/core/plan.js +0 -42
- package/dist/core/plan.js.map +0 -1
- package/dist/core/resolve.js +0 -115
- package/dist/core/resolve.js.map +0 -1
- package/dist/core/run.js +0 -66
- package/dist/core/run.js.map +0 -1
- package/dist/core/suggest.js +0 -50
- package/dist/core/suggest.js.map +0 -1
- package/dist/core/types.js +0 -2
- package/dist/core/types.js.map +0 -1
- package/dist/core/units.js +0 -94
- package/dist/core/units.js.map +0 -1
- package/dist/core/write-safety.js +0 -128
- package/dist/core/write-safety.js.map +0 -1
- package/dist/engines/heic.js +0 -166
- package/dist/engines/heic.js.map +0 -1
- package/dist/engines/image.js +0 -342
- package/dist/engines/image.js.map +0 -1
- package/dist/engines/pdf.js +0 -444
- package/dist/engines/pdf.js.map +0 -1
- package/dist/engines/pdfium.js +0 -161
- package/dist/engines/pdfium.js.map +0 -1
- package/dist/engines/registry.js +0 -65
- package/dist/engines/registry.js.map +0 -1
- package/dist/engines/types.js +0 -2
- package/dist/engines/types.js.map +0 -1
- package/dist/engines/word.js +0 -385
- package/dist/engines/word.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/shell/App.js +0 -1972
- package/dist/shell/App.js.map +0 -1
- package/dist/shell/ClickTargets.js +0 -183
- package/dist/shell/ClickTargets.js.map +0 -1
- package/dist/shell/ThemeContext.js +0 -21
- package/dist/shell/ThemeContext.js.map +0 -1
- package/dist/shell/blocks.js +0 -160
- package/dist/shell/blocks.js.map +0 -1
- package/dist/shell/clipboard.js +0 -64
- package/dist/shell/clipboard.js.map +0 -1
- package/dist/shell/commands.js +0 -51
- package/dist/shell/commands.js.map +0 -1
- package/dist/shell/components/Banner.js +0 -73
- package/dist/shell/components/Banner.js.map +0 -1
- package/dist/shell/components/CommandPalette.js +0 -37
- package/dist/shell/components/CommandPalette.js.map +0 -1
- package/dist/shell/components/FileCard.js +0 -59
- package/dist/shell/components/FileCard.js.map +0 -1
- package/dist/shell/components/HintBar.js +0 -18
- package/dist/shell/components/HintBar.js.map +0 -1
- package/dist/shell/components/Hints.js +0 -21
- package/dist/shell/components/Hints.js.map +0 -1
- package/dist/shell/components/MergeList.js +0 -268
- package/dist/shell/components/MergeList.js.map +0 -1
- package/dist/shell/components/ModeHeader.js +0 -21
- package/dist/shell/components/ModeHeader.js.map +0 -1
- package/dist/shell/components/PageGrid.js +0 -324
- package/dist/shell/components/PageGrid.js.map +0 -1
- package/dist/shell/components/PathInput.js +0 -147
- package/dist/shell/components/PathInput.js.map +0 -1
- package/dist/shell/components/Progress.js +0 -43
- package/dist/shell/components/Progress.js.map +0 -1
- package/dist/shell/components/Prompt.js +0 -667
- package/dist/shell/components/Prompt.js.map +0 -1
- package/dist/shell/components/ResultLinks.js +0 -26
- package/dist/shell/components/ResultLinks.js.map +0 -1
- package/dist/shell/components/Select.js +0 -152
- package/dist/shell/components/Select.js.map +0 -1
- package/dist/shell/components/Slider.js +0 -48
- package/dist/shell/components/Slider.js.map +0 -1
- package/dist/shell/components/StagedFiles.js +0 -92
- package/dist/shell/components/StagedFiles.js.map +0 -1
- package/dist/shell/components/ThemePicker.js +0 -18
- package/dist/shell/components/ThemePicker.js.map +0 -1
- package/dist/shell/components/UnitRow.js +0 -30
- package/dist/shell/components/UnitRow.js.map +0 -1
- package/dist/shell/flows/pdf.js +0 -424
- package/dist/shell/flows/pdf.js.map +0 -1
- package/dist/shell/frame-geometry.js +0 -56
- package/dist/shell/frame-geometry.js.map +0 -1
- package/dist/shell/hyperlink.js +0 -27
- package/dist/shell/hyperlink.js.map +0 -1
- package/dist/shell/intro.js +0 -101
- package/dist/shell/intro.js.map +0 -1
- package/dist/shell/launch.js +0 -75
- package/dist/shell/launch.js.map +0 -1
- package/dist/shell/mark.js +0 -134
- package/dist/shell/mark.js.map +0 -1
- package/dist/shell/mouse.js +0 -209
- package/dist/shell/mouse.js.map +0 -1
- package/dist/shell/redraw.js +0 -36
- package/dist/shell/redraw.js.map +0 -1
- package/dist/shell/reveal.js +0 -24
- package/dist/shell/reveal.js.map +0 -1
- package/dist/shell/stage.js +0 -34
- package/dist/shell/stage.js.map +0 -1
- package/dist/shell/terminal-write.js +0 -16
- package/dist/shell/terminal-write.js.map +0 -1
- package/dist/shell/theme.js +0 -178
- package/dist/shell/theme.js.map +0 -1
- package/dist/shell/useFrameOrigin.js +0 -175
- package/dist/shell/useFrameOrigin.js.map +0 -1
- package/dist/shell/useKeys.js +0 -28
- package/dist/shell/useKeys.js.map +0 -1
- package/dist/shell/useMouse.js +0 -150
- package/dist/shell/useMouse.js.map +0 -1
- package/dist/shell/useMouseRouting.js +0 -69
- package/dist/shell/useMouseRouting.js.map +0 -1
- package/dist/shell/width.js +0 -62
- package/dist/shell/width.js.map +0 -1
- package/dist/utils/display-path.js +0 -31
- package/dist/utils/display-path.js.map +0 -1
- package/dist/utils/unescape-path.js +0 -68
- package/dist/utils/unescape-path.js.map +0 -1
package/dist/core/errors.js
DELETED
|
@@ -1,469 +0,0 @@
|
|
|
1
|
-
import { basename, dirname } from 'node:path';
|
|
2
|
-
import { FORMATS } from './formats.js';
|
|
3
|
-
import { formatBytes } from './units.js';
|
|
4
|
-
export class ForgeError extends Error {
|
|
5
|
-
code;
|
|
6
|
-
title;
|
|
7
|
-
detail;
|
|
8
|
-
/** The way forward, phrased for the CLI — flags, not slash commands. */
|
|
9
|
-
hint;
|
|
10
|
-
/**
|
|
11
|
-
* The same advice phrased for the interactive shell, where it differs.
|
|
12
|
-
*
|
|
13
|
-
* A slash command (`/convert`, `/pdf`) is only something you can type
|
|
14
|
-
* inside the shell; printed by the CLI it is advice nobody can follow. The
|
|
15
|
-
* reverse holds for flags like `--debug`. Absent means `hint` reads the
|
|
16
|
-
* same on both surfaces. Data only — choosing which to show is the
|
|
17
|
-
* renderer's job (`renderError` for the CLI, `shell/blocks.tsx`).
|
|
18
|
-
*/
|
|
19
|
-
shellHint;
|
|
20
|
-
constructor(init) {
|
|
21
|
-
super(`${init.title}: ${init.detail}`, init.cause === undefined ? undefined : { cause: init.cause });
|
|
22
|
-
this.name = 'ForgeError';
|
|
23
|
-
this.code = init.code;
|
|
24
|
-
this.title = init.title;
|
|
25
|
-
this.detail = init.detail;
|
|
26
|
-
this.hint = init.hint;
|
|
27
|
-
this.shellHint = init.shellHint;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export function isForgeError(e) {
|
|
31
|
-
return e instanceof ForgeError;
|
|
32
|
-
}
|
|
33
|
-
export function fileNotFound(path) {
|
|
34
|
-
return new ForgeError({
|
|
35
|
-
code: 'file-not-found',
|
|
36
|
-
title: 'File not found',
|
|
37
|
-
detail: `${basename(path)} could not be found.`,
|
|
38
|
-
hint: 'Check the filename and try again.',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export function notAFile(path) {
|
|
42
|
-
return new ForgeError({
|
|
43
|
-
code: 'not-a-file',
|
|
44
|
-
title: 'Not a file',
|
|
45
|
-
detail: `${basename(path)} is not a file.`,
|
|
46
|
-
hint: 'Point Forge at an image, or at a directory of images.',
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export function permissionDenied(path) {
|
|
50
|
-
return new ForgeError({
|
|
51
|
-
code: 'permission-denied',
|
|
52
|
-
title: 'Permission denied',
|
|
53
|
-
detail: `${basename(path)} could not be read.`,
|
|
54
|
-
hint: 'Check the file permissions and try again.',
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/** `stat` reports ENOTDIR when some earlier segment of the path — not necessarily the last one — is a file, not a directory. A mistyped or concatenated path is the common cause. */
|
|
58
|
-
export function notADirectory(path) {
|
|
59
|
-
return new ForgeError({
|
|
60
|
-
code: 'not-a-directory',
|
|
61
|
-
title: 'Invalid path',
|
|
62
|
-
detail: `${basename(path)} could not be found: part of its path is not a directory.`,
|
|
63
|
-
hint: 'Check the path and try again.',
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
export function symlinkLoop(path) {
|
|
67
|
-
return new ForgeError({
|
|
68
|
-
code: 'symlink-loop',
|
|
69
|
-
title: 'Too many symbolic links',
|
|
70
|
-
detail: `${basename(path)} could not be resolved: its path contains a symbolic-link loop.`,
|
|
71
|
-
hint: 'Check for a circular symlink somewhere in the path.',
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export function pathTooLong(path) {
|
|
75
|
-
return new ForgeError({
|
|
76
|
-
code: 'path-too-long',
|
|
77
|
-
title: 'Path too long',
|
|
78
|
-
detail: `${basename(path)}'s path is too long for the filesystem to resolve.`,
|
|
79
|
-
hint: 'Use a shorter path and try again.',
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* The fallback for any `stat` failure that isn't one of the specific cases
|
|
84
|
-
* above — Forge 0.1 aims to name every errno it has a good message for, but
|
|
85
|
-
* the filesystem can still fail in ways it hasn't anticipated, and that must
|
|
86
|
-
* become a readable error rather than an unhandled throw. `cause` is kept so
|
|
87
|
-
* `--debug` can still show what actually happened.
|
|
88
|
-
*/
|
|
89
|
-
export function unreadablePath(path, cause) {
|
|
90
|
-
return new ForgeError({
|
|
91
|
-
code: 'unreadable-path',
|
|
92
|
-
title: 'Could not read path',
|
|
93
|
-
detail: `${basename(path)} could not be checked.`,
|
|
94
|
-
hint: 'Check the path and try again.',
|
|
95
|
-
cause,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
export function unsupportedSource(path, detected) {
|
|
99
|
-
return new ForgeError({
|
|
100
|
-
code: 'unsupported-source',
|
|
101
|
-
title: 'Unsupported file type',
|
|
102
|
-
detail: `${basename(path)} is ${detected}, which Forge cannot read.`,
|
|
103
|
-
hint: 'Forge 0.1 handles images only.',
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* HEIC is decoded by macOS's own `sips`, because Sharp's prebuilt binary
|
|
108
|
-
* ships libheif without an HEVC decoder for licensing reasons. This is the
|
|
109
|
-
* one condition that can take HEIC away, and it deserves to say so rather
|
|
110
|
-
* than surfacing as a generic conversion failure.
|
|
111
|
-
*/
|
|
112
|
-
export function heicDecoderUnavailable(path) {
|
|
113
|
-
return new ForgeError({
|
|
114
|
-
code: 'heic-decoder-unavailable',
|
|
115
|
-
title: 'Cannot read HEIC here',
|
|
116
|
-
detail: `${basename(path)} is a HEIC photo, which Forge decodes with the macOS sips tool.`,
|
|
117
|
-
hint: 'sips could not be run. It ships with macOS at /usr/bin/sips.',
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* A lossless format has no quality to trade away, so `/compress` on one would
|
|
122
|
-
* promise something the encoder cannot do. Naming that is better than a
|
|
123
|
-
* silent no-op, and the hint points at the thing that *would* work.
|
|
124
|
-
*/
|
|
125
|
-
export function unsupportedCompress(source) {
|
|
126
|
-
const name = basename(source.path);
|
|
127
|
-
/**
|
|
128
|
-
* A PDF gets its own wording because the lossless line below is FALSE for
|
|
129
|
-
* one. A PDF is a container: its pages are usually JPEGs, and re-encoding
|
|
130
|
-
* them measured 79% smaller on a photo brochure. Telling someone there is
|
|
131
|
-
* "no quality to trade away" sent them hunting for a workaround that does
|
|
132
|
-
* not exist, when the real answer is that Forge has not built this yet.
|
|
133
|
-
*/
|
|
134
|
-
if (source.kind === 'document' && source.format === 'pdf') {
|
|
135
|
-
return new ForgeError({
|
|
136
|
-
code: 'unsupported-compress',
|
|
137
|
-
title: 'Forge cannot compress a PDF yet',
|
|
138
|
-
detail: `${name} is a PDF. Compression works on images for now.`,
|
|
139
|
-
hint: 'Try a page operation such as --extract, or --to <format> to turn its pages into images.',
|
|
140
|
-
shellHint: 'Try /pdf for page operations, or /convert to turn its pages into images.',
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
// A docx/doc has no images for this action to re-encode — same conclusion
|
|
144
|
-
// as the lossless-image case below, reached for a different reason, so it
|
|
145
|
-
// needs its own wording rather than falling into "is lossless."
|
|
146
|
-
if (source.kind === 'document') {
|
|
147
|
-
return new ForgeError({
|
|
148
|
-
code: 'unsupported-compress',
|
|
149
|
-
title: 'Nothing to compress',
|
|
150
|
-
detail: `${name} is ${FORMATS[source.format].label}, which has no images Forge can re-encode.`,
|
|
151
|
-
hint: `Use --to pdf to change it to PDF instead: forge ${name} --to pdf`,
|
|
152
|
-
shellHint: 'Use /convert to change it to PDF instead.',
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
return new ForgeError({
|
|
156
|
-
code: 'unsupported-compress',
|
|
157
|
-
title: 'Nothing to compress',
|
|
158
|
-
detail: `${name} is ${FORMATS[source.format].label}, which is lossless — there is no quality to trade away.`,
|
|
159
|
-
hint: 'Use --to to change it to a smaller format instead. forge --formats lists them.',
|
|
160
|
-
shellHint: 'Use /convert to change it to a smaller format instead.',
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* `/pdf` mode is armed and expects the next dropped file to be a PDF — its
|
|
165
|
-
* five page operations (merge, split, extract, delete, rotate) have nothing
|
|
166
|
-
* to act on otherwise. Falls back to `/convert`'s target picker, the same
|
|
167
|
-
* "route it somewhere useful instead of a dead end" rule `unsupportedCompress`
|
|
168
|
-
* follows for its own mismatches.
|
|
169
|
-
*/
|
|
170
|
-
export function unsupportedPdf(source) {
|
|
171
|
-
const name = basename(source.path);
|
|
172
|
-
return new ForgeError({
|
|
173
|
-
code: 'unsupported-pdf',
|
|
174
|
-
title: '/pdf needs a PDF',
|
|
175
|
-
detail: `${name} is ${FORMATS[source.format].label}, not a PDF.`,
|
|
176
|
-
hint: 'Converting it instead.',
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* The search found nothing small enough. Reporting the smallest achievable
|
|
181
|
-
* size teaches the user what is actually possible; writing a file that
|
|
182
|
-
* quietly misses the number they asked for does not.
|
|
183
|
-
*/
|
|
184
|
-
export function targetUnreachable(source, targetBytes, smallest) {
|
|
185
|
-
return new ForgeError({
|
|
186
|
-
code: 'target-unreachable',
|
|
187
|
-
title: 'Cannot get that small',
|
|
188
|
-
detail: `${basename(source.path)} is ${formatBytes(smallest)} even at the lowest quality, which is still over ${formatBytes(targetBytes)}.`,
|
|
189
|
-
hint: 'Try a larger --max-size, or --to a smaller format.',
|
|
190
|
-
shellHint: 'Try a larger target, or /convert to a smaller format.',
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
export function unsupportedTarget(source, requested, available) {
|
|
194
|
-
return new ForgeError({
|
|
195
|
-
code: 'unsupported-target',
|
|
196
|
-
title: `Can't convert ${basename(source.path)} to ${requested}`,
|
|
197
|
-
detail: `${basename(source.path)} is a ${FORMATS[source.format].label} ${source.kind === 'image' ? 'image' : 'document'}.`,
|
|
198
|
-
hint: `Available: ${available.join(', ')}`,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Thrown when a source could not be decoded and nothing identified its
|
|
203
|
-
* format first — `imageEngine.probe`'s generic `sharp(path).metadata()`
|
|
204
|
-
* failure, or (via `engines/registry.ts`'s `probe`) whichever engine's
|
|
205
|
-
* classified error wins when every engine declines. The wording must stay
|
|
206
|
-
* format-neutral for exactly that reason: with more than one engine
|
|
207
|
-
* registered, claiming "as an image" (or any other format) here would
|
|
208
|
-
* assert something the probe never actually determined.
|
|
209
|
-
*
|
|
210
|
-
* Where the format HAS already been identified from content before decoding
|
|
211
|
-
* failed — HEIC via its `ftyp` container brand, for instance — use
|
|
212
|
-
* `corruptFormatSource` instead, which names it: vagueness is only honest
|
|
213
|
-
* when the vagueness is real.
|
|
214
|
-
*/
|
|
215
|
-
export function corruptSource(path, cause) {
|
|
216
|
-
return new ForgeError({
|
|
217
|
-
code: 'corrupt-source',
|
|
218
|
-
title: 'Damaged file',
|
|
219
|
-
detail: `${basename(path)} could not be read. It may be damaged, or not a format Forge recognises.`,
|
|
220
|
-
hint: 'The file may be incomplete or corrupted.',
|
|
221
|
-
cause,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Thrown when a source's format was already identified from its own content
|
|
226
|
-
* — before decoding it was attempted, not guessed afterwards — but decoding
|
|
227
|
-
* then failed anyway. `corruptSource`'s wording must stay neutral because at
|
|
228
|
-
* that point the format is genuinely unknown; this sibling exists for the
|
|
229
|
-
* opposite case, where the caller already knows what the file is and the
|
|
230
|
-
* message should say so.
|
|
231
|
-
*/
|
|
232
|
-
export function corruptFormatSource(path, format, cause) {
|
|
233
|
-
return new ForgeError({
|
|
234
|
-
code: 'corrupt-source',
|
|
235
|
-
title: `Damaged ${FORMATS[format].label}`,
|
|
236
|
-
detail: `${basename(path)} is a ${FORMATS[format].label} file, but its content could not be read.`,
|
|
237
|
-
hint: 'The file may be incomplete or corrupted.',
|
|
238
|
-
cause,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* A password-protected PDF probes successfully (`load` passes
|
|
243
|
-
* `ignoreEncryption: true` so `encrypted: true` can be reported), but no page
|
|
244
|
-
* operation can actually read its content until it is unlocked. This is
|
|
245
|
-
* thrown at the start of each operation rather than left to surface as
|
|
246
|
-
* whatever pdf-lib does partway through — a generic parse failure at the
|
|
247
|
-
* last step would not tell the user what is actually wrong.
|
|
248
|
-
*/
|
|
249
|
-
export function encryptedSource(path) {
|
|
250
|
-
const name = basename(path);
|
|
251
|
-
return new ForgeError({
|
|
252
|
-
code: 'encrypted-source',
|
|
253
|
-
title: 'This PDF is password-protected',
|
|
254
|
-
detail: `${name} is password-protected.`,
|
|
255
|
-
// Forge cannot decrypt-and-write a PDF — the only libraries that can are
|
|
256
|
-
// AGPL, and Forge is MIT (see the phase-4a spec's ruling on this). The
|
|
257
|
-
// shell also has no password field by design (spec §8), so this points
|
|
258
|
-
// at the one front end that reads an encrypted PDF rather than only
|
|
259
|
-
// refusing.
|
|
260
|
-
hint: `Convert it to images instead: forge ${name} --to jpeg --password-stdin`,
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Whether the operation that produced this output takes `--output` at all.
|
|
265
|
-
*
|
|
266
|
-
* Only `convert` does: a page operation names its outputs from its sources
|
|
267
|
-
* and `cli/args.ts` refuses `--output` on one outright, so offering the flag
|
|
268
|
-
* as the way out of a refusal would be advising something the same run
|
|
269
|
-
* rejects. Defaulted to `convert` because `core/plan.ts`, the other caller of
|
|
270
|
-
* both refusals below, only ever builds conversions.
|
|
271
|
-
*/
|
|
272
|
-
const takesOutputFlag = (op) => op === 'convert';
|
|
273
|
-
export function outputExists(path, op = 'convert') {
|
|
274
|
-
return new ForgeError({
|
|
275
|
-
code: 'output-exists',
|
|
276
|
-
title: 'File already exists',
|
|
277
|
-
detail: `${basename(path)} is already there.`,
|
|
278
|
-
hint: takesOutputFlag(op)
|
|
279
|
-
? 'Pass --force to replace it, or choose a different --output.'
|
|
280
|
-
: 'Pass --force to replace it, or move the existing file out of the way.',
|
|
281
|
-
// The shell has no --force or --output: it asks instead (Replace, and
|
|
282
|
-
// Keep both for a conversion) whenever it meets an existing file.
|
|
283
|
-
shellHint: 'Run it again and Forge will ask before replacing it.',
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Two distinct sources resolved to the same output path. Unlike outputExists,
|
|
288
|
-
* nothing was "already there" before this run started — the collision is
|
|
289
|
-
* between two of the user's own inputs, so --force (which means "overwrite
|
|
290
|
-
* what's on disk") must never suppress it.
|
|
291
|
-
*/
|
|
292
|
-
export function outputCollision(paths, output) {
|
|
293
|
-
return new ForgeError({
|
|
294
|
-
code: 'output-collision',
|
|
295
|
-
title: 'Two files want the same output',
|
|
296
|
-
detail: `${basename(paths[0])} and ${basename(paths[1])} would both become ${basename(output)}.`,
|
|
297
|
-
hint: 'Convert them separately, or use --output to send them to different folders.',
|
|
298
|
-
shellHint: 'Convert them one at a time.',
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* One job whose own `outputs` name the same path twice — a separated extract
|
|
303
|
-
* handed a repeated page, say. Distinct from `outputCollision`, which is
|
|
304
|
-
* shaped for two *different* sources landing on one name: reusing it here
|
|
305
|
-
* printed "source.pdf and source.pdf would both become out.pdf", a sentence
|
|
306
|
-
* about a situation that is not the one that happened.
|
|
307
|
-
*
|
|
308
|
-
* Shares the `output-collision` code because it is the same kind of fault
|
|
309
|
-
* and, like its sibling, is never overridable by `--force`: it is the job's
|
|
310
|
-
* own plan asking to write two different things to one path, which can only
|
|
311
|
-
* be a bug in whatever produced the job.
|
|
312
|
-
*/
|
|
313
|
-
export function selfCollision(source, output) {
|
|
314
|
-
return new ForgeError({
|
|
315
|
-
code: 'output-collision',
|
|
316
|
-
title: 'One output, written twice',
|
|
317
|
-
detail: `${basename(source)} would write ${basename(output)} twice, and only the second would survive.`,
|
|
318
|
-
hint: 'Every output has to be its own file. Check the selection for a repeated page.',
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
export function outputIsInput(path, op = 'convert') {
|
|
322
|
-
return new ForgeError({
|
|
323
|
-
code: 'output-is-input',
|
|
324
|
-
title: 'Output would replace the original',
|
|
325
|
-
detail: `${basename(path)} is both the input and the output.`,
|
|
326
|
-
hint: takesOutputFlag(op)
|
|
327
|
-
? 'Choose a different --output, or pass --force to overwrite in place.'
|
|
328
|
-
: 'Move or rename that file first, or pass --force to overwrite it in place.',
|
|
329
|
-
// The shell deliberately offers no in-place overwrite: a conversion goes
|
|
330
|
-
// back to its destination step, a page operation back to /pdf.
|
|
331
|
-
shellHint: takesOutputFlag(op)
|
|
332
|
-
? 'Choose a different folder to save it in.'
|
|
333
|
-
: 'Move or rename that file first.',
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* The write-side sibling of `permissionDenied`: the destination folder exists
|
|
338
|
-
* (or would be created inside one) that this user cannot write to.
|
|
339
|
-
*
|
|
340
|
-
* Shares the `permission-denied` code because it is the same fault the user
|
|
341
|
-
* fixes the same way. Names the folder, not the source — the source was read
|
|
342
|
-
* fine, and "photo.png could not be read" would send them to the wrong file.
|
|
343
|
-
*/
|
|
344
|
-
export function outputPermissionDenied(path, cause) {
|
|
345
|
-
return new ForgeError({
|
|
346
|
-
code: 'permission-denied',
|
|
347
|
-
title: 'Permission denied',
|
|
348
|
-
detail: `${basename(dirname(path))} is not a folder you can write to.`,
|
|
349
|
-
hint: 'Choose a different --output, or check the folder permissions.',
|
|
350
|
-
shellHint: 'Choose a different folder, or check its permissions.',
|
|
351
|
-
cause,
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
/** The errno codes that mean "you may not write here", not "this path is bad". */
|
|
355
|
-
const PERMISSION_CODES = new Set(['EACCES', 'EPERM', 'EROFS']);
|
|
356
|
-
/**
|
|
357
|
-
* Names a failed write by its errno, so a refusal by the filesystem reads as
|
|
358
|
-
* one instead of as a generic conversion failure. Anything it has no better
|
|
359
|
-
* name for is returned untouched for the caller to wrap as it already does.
|
|
360
|
-
*/
|
|
361
|
-
export function classifyWriteError(path, cause) {
|
|
362
|
-
if (isForgeError(cause))
|
|
363
|
-
return cause;
|
|
364
|
-
const code = cause?.code;
|
|
365
|
-
if (code !== undefined && PERMISSION_CODES.has(code))
|
|
366
|
-
return outputPermissionDenied(path, cause);
|
|
367
|
-
return cause;
|
|
368
|
-
}
|
|
369
|
-
export function outputInvalid(path, cause) {
|
|
370
|
-
return new ForgeError({
|
|
371
|
-
code: 'output-invalid',
|
|
372
|
-
title: 'Cannot write there',
|
|
373
|
-
detail: `${path} could not be written to.`,
|
|
374
|
-
hint: 'Check that the path is valid and that you have permission to write to it.',
|
|
375
|
-
cause,
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
export function emptyDirectory(path) {
|
|
379
|
-
return new ForgeError({
|
|
380
|
-
code: 'empty-directory',
|
|
381
|
-
title: 'No images found',
|
|
382
|
-
detail: `${basename(path)} contains no images Forge can convert.`,
|
|
383
|
-
hint: 'Try --recursive to look inside subfolders.',
|
|
384
|
-
// The shell reads a dropped folder non-recursively and has no --recursive.
|
|
385
|
-
shellHint: 'Only files directly inside a folder are read — drop the files themselves, or the folder that holds them.',
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
export function invalidArguments(detail, hint) {
|
|
389
|
-
return new ForgeError({ code: 'invalid-arguments', title: 'Invalid arguments', detail, hint });
|
|
390
|
-
}
|
|
391
|
-
export function invalidPageRange(_input, detail, pageCount) {
|
|
392
|
-
return new ForgeError({
|
|
393
|
-
code: 'invalid-page-range',
|
|
394
|
-
title: 'Page range not understood',
|
|
395
|
-
detail,
|
|
396
|
-
hint: `This document has ${pageCount} pages. Use numbers and spans, like "3-7, 12, 20-".`,
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Extract and delete both refuse to write an empty document rather than
|
|
401
|
-
* silently producing one — an extract with no pages selected, or a delete
|
|
402
|
-
* that would remove every page. `detail` says which.
|
|
403
|
-
*/
|
|
404
|
-
export function emptySelection(detail) {
|
|
405
|
-
return new ForgeError({
|
|
406
|
-
code: 'empty-selection',
|
|
407
|
-
title: 'Nothing to write',
|
|
408
|
-
detail,
|
|
409
|
-
hint: 'Select at least one page to keep.',
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* `--dpi` and the shell's resolution picker both funnel here. The bounds
|
|
414
|
-
* are measured, not arbitrary: below 36 the render is illegible, and 600 on
|
|
415
|
-
* a several-hundred-page scan is tens of gigabytes of PNG and minutes of
|
|
416
|
-
* rendering — worth refusing rather than letting someone discover it.
|
|
417
|
-
*/
|
|
418
|
-
export function invalidDpi(value) {
|
|
419
|
-
return new ForgeError({
|
|
420
|
-
code: 'invalid-dpi',
|
|
421
|
-
title: 'Invalid resolution',
|
|
422
|
-
detail: `${String(value)} is not a resolution Forge can use.`,
|
|
423
|
-
hint: 'Give a number between 36 and 600. The default is 150.',
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
export function conversionFailed(path, cause) {
|
|
427
|
-
return new ForgeError({
|
|
428
|
-
code: 'conversion-failed',
|
|
429
|
-
title: 'Conversion failed',
|
|
430
|
-
detail: `${basename(path)} could not be converted.`,
|
|
431
|
-
hint: 'Run again with --debug for the underlying error.',
|
|
432
|
-
// The shell has no --debug of its own; the command line does.
|
|
433
|
-
shellHint: 'Run the same conversion with forge --debug from the command line to see why.',
|
|
434
|
-
cause,
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* The last resort: something threw that isn't a `ForgeError` and has no
|
|
439
|
-
* specific, well-worded constructor above — an unanticipated failure shape
|
|
440
|
-
* rather than a plain "this file could not be read". A caller that only
|
|
441
|
-
* knows how to render a `ForgeError` (the shell's history blocks, in
|
|
442
|
-
* particular) must never be left with nothing to show for it, so this wraps
|
|
443
|
-
* whatever was thrown into one, carrying its message for whatever that's
|
|
444
|
-
* worth and keeping `cause` for `--debug` — without ever surfacing a raw
|
|
445
|
-
* stack trace to the user (spec §11).
|
|
446
|
-
*/
|
|
447
|
-
export function unexpectedError(cause) {
|
|
448
|
-
return new ForgeError({
|
|
449
|
-
code: 'unexpected',
|
|
450
|
-
title: 'Something went wrong',
|
|
451
|
-
detail: cause instanceof Error ? cause.message : String(cause),
|
|
452
|
-
hint: 'This was not expected. Try again — if it keeps happening, it may be worth reporting.',
|
|
453
|
-
cause,
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Returns display lines rather than printing, so the core stays free of stdout.
|
|
458
|
-
* The symbol is paired with a word so the meaning survives a monochrome terminal.
|
|
459
|
-
*/
|
|
460
|
-
export function renderError(e, opts = {}) {
|
|
461
|
-
const lines = [`✕ ${e.title}`, '', ` ${e.detail}`];
|
|
462
|
-
if (e.hint)
|
|
463
|
-
lines.push('', ` ${e.hint}`);
|
|
464
|
-
if (opts.debug && e.cause instanceof Error) {
|
|
465
|
-
lines.push('', ` ${e.cause.stack ?? e.cause.message}`);
|
|
466
|
-
}
|
|
467
|
-
return lines;
|
|
468
|
-
}
|
|
469
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/core/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAuCxC,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,IAAI,CAAW;IACf,KAAK,CAAQ;IACb,MAAM,CAAQ;IACvB,wEAAwE;IAC/D,IAAI,CAAS;IACtB;;;;;;;;OAQG;IACM,SAAS,CAAS;IAE3B,YAAY,IAAoB;QAC9B,KAAK,CACH,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE,EAC/B,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAC7D,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM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;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,IAAI,UAAU,CAAC;QACpB,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9D,IAAI,EAAE,sFAAsF;QAC5F,KAAK;KACN,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAa,EAAE,IAAI,GAAwB,EAAE;IACvE,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;IACnD,IAAI,CAAC,CAAC,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IACzC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { engineForJob } from '../engines/registry.js';
|
|
2
|
-
import { findQuality } from './compress.js';
|
|
3
|
-
import { targetUnreachable, unsupportedCompress } from './errors.js';
|
|
4
|
-
import { runJobs } from './run.js';
|
|
5
|
-
import { checkWriteSafety } from './write-safety.js';
|
|
6
|
-
/**
|
|
7
|
-
* Runs a set of jobs: refuse what is unsafe, resolve what needs searching, run
|
|
8
|
-
* the rest.
|
|
9
|
-
*
|
|
10
|
-
* Composition lives here rather than in each caller. It used to live in five
|
|
11
|
-
* places — three in `cli/execute.ts`, two in `shell/App.tsx` — and the five
|
|
12
|
-
* disagreed in four separate ways: the shell never reached the target-size
|
|
13
|
-
* search for a document, discarded every warning a page job produced,
|
|
14
|
-
* mislabelled a multi-output convert, and the CLI's compress path ran no
|
|
15
|
-
* write-safety at all. Each was a caller composing the same steps differently,
|
|
16
|
-
* which is what a single seam removes.
|
|
17
|
-
*
|
|
18
|
-
* Three refusal channels rather than one because callers act on them
|
|
19
|
-
* differently: `refusals` may be retried with `force`, `unreachable` with
|
|
20
|
-
* relaxed settings, `failures` not at all.
|
|
21
|
-
*
|
|
22
|
-
* Nothing here asks the user anything. Refusals come back as data and the
|
|
23
|
-
* caller decides — the CLI reports them, the shell turns `output-exists` into
|
|
24
|
-
* its overwrite step and calls again with `force`. That keeps this a plain
|
|
25
|
-
* async function rather than something holding a promise across React
|
|
26
|
-
* re-renders.
|
|
27
|
-
*/
|
|
28
|
-
export async function runPlan(jobs, policy) {
|
|
29
|
-
const emit = policy.onEvent ?? (() => { });
|
|
30
|
-
const resolveEngine = policy.engineFor ?? engineForJob;
|
|
31
|
-
/**
|
|
32
|
-
* Write safety first. It is a few `existsSync` calls; the search below is up
|
|
33
|
-
* to thirty-two encodes. Checking first means a job that will be refused is
|
|
34
|
-
* never searched for half a minute. Safe to reorder because resolution
|
|
35
|
-
* changes `options`, never `outputs`, so the answer cannot depend on it.
|
|
36
|
-
*/
|
|
37
|
-
const safe = checkWriteSafety(jobs, { force: policy.force });
|
|
38
|
-
const refusals = [...safe.failures];
|
|
39
|
-
const unreachable = [];
|
|
40
|
-
const ready = [];
|
|
41
|
-
let cancelled = false;
|
|
42
|
-
for (const job of safe.jobs) {
|
|
43
|
-
// Only `convert` carries `ConvertOptions`; a page operation has no quality
|
|
44
|
-
// dial, so a target size is simply not applicable to one.
|
|
45
|
-
if (policy.targetBytes === undefined || job.op !== 'convert') {
|
|
46
|
-
ready.push(job);
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const measurer = await resolveEngine(job)?.measurer?.(job);
|
|
50
|
-
if (!measurer) {
|
|
51
|
-
refusals.push({ path: job.sources[0].path, error: unsupportedCompress(job.sources[0]) });
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
const targetBytes = policy.targetBytes;
|
|
55
|
-
let smallest = Number.POSITIVE_INFINITY;
|
|
56
|
-
let closest;
|
|
57
|
-
let settled = false;
|
|
58
|
-
for (const rung of measurer.ladder) {
|
|
59
|
-
const found = await findQuality({
|
|
60
|
-
encode: (quality) => measurer.measure({ ...job.options, ...rung, quality }),
|
|
61
|
-
targetBytes,
|
|
62
|
-
onAttempt: (attempt, of) => emit({ type: 'search:attempt', job, attempt, of, rung }),
|
|
63
|
-
...(policy.signal === undefined ? {} : { signal: policy.signal }),
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* A cancelled search has no answer — not a settled quality, and not a
|
|
67
|
-
* measured floor to offer as "use it anyway" either, since the ladder
|
|
68
|
-
* was abandoned partway. So this job neither runs nor becomes a
|
|
69
|
-
* question: it simply stops.
|
|
70
|
-
*/
|
|
71
|
-
if (found.cancelled) {
|
|
72
|
-
cancelled = true;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
if (found.bytes < smallest) {
|
|
76
|
-
smallest = found.bytes;
|
|
77
|
-
closest = { ...rung, quality: found.quality };
|
|
78
|
-
}
|
|
79
|
-
if (!found.missed) {
|
|
80
|
-
Object.assign(job.options, rung, { quality: found.quality });
|
|
81
|
-
ready.push(job);
|
|
82
|
-
settled = true;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (cancelled)
|
|
87
|
-
break;
|
|
88
|
-
if (!settled && closest) {
|
|
89
|
-
unreachable.push({
|
|
90
|
-
job,
|
|
91
|
-
smallest,
|
|
92
|
-
settings: closest,
|
|
93
|
-
error: targetUnreachable(job.sources[0], targetBytes, smallest),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (cancelled) {
|
|
98
|
-
return {
|
|
99
|
-
results: [],
|
|
100
|
-
refusals,
|
|
101
|
-
unreachable: [],
|
|
102
|
-
failures: [],
|
|
103
|
-
inputBytes: 0,
|
|
104
|
-
outputBytes: 0,
|
|
105
|
-
cancelled: true,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
const done = await runJobs(ready, {
|
|
109
|
-
...(policy.concurrency === undefined ? {} : { concurrency: policy.concurrency }),
|
|
110
|
-
...(policy.engineFor === undefined ? {} : { engineFor: policy.engineFor }),
|
|
111
|
-
onEvent: emit,
|
|
112
|
-
});
|
|
113
|
-
return {
|
|
114
|
-
results: done.results,
|
|
115
|
-
refusals,
|
|
116
|
-
unreachable,
|
|
117
|
-
failures: done.failures,
|
|
118
|
-
inputBytes: done.inputBytes,
|
|
119
|
-
outputBytes: done.outputBytes,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=execute-jobs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execute-jobs.js","sourceRoot":"","sources":["../../src/core/execute-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAmB,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAErF,OAAO,EAAiB,OAAO,EAAE,MAAM,UAAU,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AA6EpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAW,EAAE,MAAiB;IAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACzC,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,IAAI,YAAY,CAAA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