@bobfrankston/brother-label 1.0.13 → 1.1.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/README.md +63 -3
- package/api.d.ts +27 -16
- package/api.d.ts.map +1 -1
- package/api.js +301 -361
- package/api.js.map +1 -1
- package/api.ts +427 -505
- package/cli.d.ts +1 -1
- package/cli.js +239 -129
- package/cli.js.map +1 -1
- package/cli.ts +301 -184
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +4 -2
- package/index.js.map +1 -1
- package/index.ts +40 -21
- package/package.json +18 -3
- package/render.d.ts +10 -33
- package/render.d.ts.map +1 -1
- package/render.js +11 -235
- package/render.js.map +1 -1
- package/render.ts +29 -280
- package/tsconfig.json +25 -19
- package/brother-print.d.ts +0 -3
- package/brother-print.d.ts.map +0 -1
- package/brother-print.js +0 -629
- package/brother-print.js.map +0 -1
- package/brother-print.ts +0 -697
package/cli.ts
CHANGED
|
@@ -1,184 +1,301 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Brother Label Printer CLI
|
|
4
|
-
* Thin wrapper around
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as fs from "fs";
|
|
8
|
-
import * as path from "path";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Brother Label Printer CLI
|
|
4
|
+
* Thin wrapper around api.ts using shared CLI primitives from label-core.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import {
|
|
10
|
+
preprocessSingleQuotes,
|
|
11
|
+
parseArgs,
|
|
12
|
+
PrintOptions as CorePrintOptions,
|
|
13
|
+
PrinterStatus,
|
|
14
|
+
Segment,
|
|
15
|
+
ValuedOptionSpec,
|
|
16
|
+
BooleanFlagSpec,
|
|
17
|
+
} from "@bobfrankston/label-core";
|
|
18
|
+
import {
|
|
19
|
+
print,
|
|
20
|
+
render,
|
|
21
|
+
renderSegments,
|
|
22
|
+
printSegments,
|
|
23
|
+
getConfig,
|
|
24
|
+
setConfig,
|
|
25
|
+
getConfigPath,
|
|
26
|
+
listPrinters,
|
|
27
|
+
detectTapeSize,
|
|
28
|
+
brotherPrinter,
|
|
29
|
+
TapeSize,
|
|
30
|
+
PrintOptions,
|
|
31
|
+
SegmentOptions,
|
|
32
|
+
} from "./api.js";
|
|
33
|
+
|
|
34
|
+
const VERSION = "1.1.0";
|
|
35
|
+
const VALID_TAPES: TapeSize[] = [6, 9, 12, 18, 24];
|
|
36
|
+
|
|
37
|
+
function parseTape(value: string): TapeSize {
|
|
38
|
+
const num = parseInt(value.replace("mm", ""), 10) as TapeSize;
|
|
39
|
+
if (!VALID_TAPES.includes(num)) {
|
|
40
|
+
throw new Error(`Invalid tape size: ${value}. Valid: ${VALID_TAPES.join(", ")}`);
|
|
41
|
+
}
|
|
42
|
+
return num;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const VALUED: ValuedOptionSpec[] = [
|
|
46
|
+
{ names: ["-tape"], key: "tape" },
|
|
47
|
+
{ names: ["-p", "-printer"], key: "printer" },
|
|
48
|
+
{ names: ["-o", "-output"], key: "output" },
|
|
49
|
+
{ names: ["-a", "-aspect"], key: "aspect" },
|
|
50
|
+
{ names: ["-H", "-height"], key: "height" },
|
|
51
|
+
{ names: ["-s", "-space"], key: "space" },
|
|
52
|
+
{ names: ["-timeout"], key: "timeout" },
|
|
53
|
+
{ names: ["-interval"], key: "interval" },
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const BOOLEAN: BooleanFlagSpec[] = [
|
|
57
|
+
{ names: ["-w", "-html"], key: "html" },
|
|
58
|
+
{ names: ["-i", "-image"], key: "image" },
|
|
59
|
+
{ names: ["-t"], key: "text" },
|
|
60
|
+
{ names: ["-c", "-clip"], key: "clip" },
|
|
61
|
+
{ names: ["-no-wait", "-nowait"], key: "nowait" },
|
|
62
|
+
{ names: ["-help", "-h", "-?"], key: "help" },
|
|
63
|
+
{ names: ["-version", "-v"], key: "version" },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const SUBCOMMANDS = ["list", "status", "config"];
|
|
67
|
+
|
|
68
|
+
function showHelp(): void {
|
|
69
|
+
console.log(`Brother Label Printer CLI v${VERSION}
|
|
70
|
+
|
|
71
|
+
Usage:
|
|
72
|
+
brother-print [options] <text> Print text
|
|
73
|
+
brother-print [options] <file> Print html/txt/image file (auto-detected)
|
|
74
|
+
brother-print -clip [options] Print clipboard contents (image or text)
|
|
75
|
+
brother-print -text <v> -qr <v> ... Print ordered text/qr segments
|
|
76
|
+
brother-print list List Brother printers and status
|
|
77
|
+
brother-print status [-p <name>] Show printer status
|
|
78
|
+
brother-print config Show / set defaults
|
|
79
|
+
|
|
80
|
+
Tape size is auto-detected from the printer. Use -tape to override.
|
|
81
|
+
Single quotes can wrap arguments: '7"' 'line1\\nline2'
|
|
82
|
+
|
|
83
|
+
Options:
|
|
84
|
+
-tape <size> Tape size: 6, 9, 12, 18, 24 (mm) [auto-detected]
|
|
85
|
+
-p, -printer <name> Printer queue name
|
|
86
|
+
-o, -output <file> Save PNG to file instead of printing
|
|
87
|
+
-a, -aspect <r> Aspect ratio width:height for HTML (e.g. 3.5:2)
|
|
88
|
+
-H, -height <size> Text height: 12mm, .5in, or 50% (of tape height)
|
|
89
|
+
-s, -space <size> Space between segments: 12px, 1mm, .2in
|
|
90
|
+
-t, -text Force input as literal text (-text <v> for segments)
|
|
91
|
+
-qr <data> QR code segment
|
|
92
|
+
-w, -html Force input as HTML file path
|
|
93
|
+
-i, -image Force input as image file path
|
|
94
|
+
-c, -clip Read content from clipboard (image preferred, then text)
|
|
95
|
+
-no-wait Fail immediately if printer is offline (default: wait)
|
|
96
|
+
-timeout <secs> Max wait time when printer is offline
|
|
97
|
+
-interval <secs> Polling interval while waiting (default 2)
|
|
98
|
+
-help Show this help
|
|
99
|
+
-version Show version`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function main(): Promise<void> {
|
|
103
|
+
const argv = preprocessSingleQuotes(process.argv.slice(2));
|
|
104
|
+
let parsed;
|
|
105
|
+
try {
|
|
106
|
+
parsed = parseArgs(argv, VALUED, BOOLEAN, SUBCOMMANDS);
|
|
107
|
+
} catch (e: any) {
|
|
108
|
+
console.error(`Error: ${e.message}`);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (parsed.unknown.length > 0) {
|
|
113
|
+
console.error(`Unknown option(s): ${parsed.unknown.join(", ")}`);
|
|
114
|
+
console.error(`Run "brother-print -help" for usage.`);
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (parsed.opts.help) { showHelp(); return; }
|
|
119
|
+
if (parsed.opts.version) { console.log(VERSION); return; }
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
switch (parsed.command) {
|
|
123
|
+
case "list": await cmdList(); return;
|
|
124
|
+
case "status": await cmdStatus(parsed.opts); return;
|
|
125
|
+
case "config": await cmdConfig(parsed.opts); return;
|
|
126
|
+
}
|
|
127
|
+
await cmdPrint(parsed.opts, parsed.segments, parsed.inputs);
|
|
128
|
+
} catch (e: any) {
|
|
129
|
+
console.error(`Error: ${e.message}`);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function cmdList(): Promise<void> {
|
|
135
|
+
const printers = await listPrinters();
|
|
136
|
+
if (printers.length === 0) {
|
|
137
|
+
console.log("No Brother printers found.");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
console.log(`Brother printers (${printers.length}):`);
|
|
141
|
+
for (const p of printers) {
|
|
142
|
+
let statusStr = "?";
|
|
143
|
+
try {
|
|
144
|
+
const s = await brotherPrinter.getStatus(p.name);
|
|
145
|
+
statusStr = s.online ? "online" : `offline (${s.statusText}${s.error ? ", " + s.error : ""})`;
|
|
146
|
+
} catch (e: any) {
|
|
147
|
+
statusStr = `status error: ${e.message}`;
|
|
148
|
+
}
|
|
149
|
+
console.log(` ${p.name} — ${statusStr}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function cmdStatus(opts: Record<string, string | boolean>): Promise<void> {
|
|
154
|
+
const name = (opts.printer as string) || undefined;
|
|
155
|
+
const s = await brotherPrinter.getStatus(name);
|
|
156
|
+
console.log(`Printer: ${s.name}`);
|
|
157
|
+
console.log(`Online: ${s.online ? "yes" : "no"}`);
|
|
158
|
+
console.log(`Status: ${s.statusText}`);
|
|
159
|
+
if (s.error) console.log(`Error: ${s.error}`);
|
|
160
|
+
console.log(`Queue: ${s.queueLength} job(s)`);
|
|
161
|
+
if (s.workOffline) console.log(`Work offline flag: true`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function cmdConfig(opts: Record<string, string | boolean>): Promise<void> {
|
|
165
|
+
const hasUpdate = !!(opts.tape || opts.printer);
|
|
166
|
+
if (!hasUpdate) {
|
|
167
|
+
const cfg = getConfig();
|
|
168
|
+
console.log(`Configuration:`);
|
|
169
|
+
console.log(` File: ${getConfigPath()}`);
|
|
170
|
+
console.log(` Default tape: ${cfg.defaultTape ? cfg.defaultTape + "mm" : "(not set)"}`);
|
|
171
|
+
console.log(` Default printer: ${cfg.defaultPrinter ?? "(not set)"}`);
|
|
172
|
+
console.log("\nValid tape sizes: 6, 9, 12, 18, 24");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (opts.tape) {
|
|
176
|
+
const t = parseTape(opts.tape as string);
|
|
177
|
+
setConfig({ defaultTape: t });
|
|
178
|
+
console.log(`Default tape set to: ${t}mm`);
|
|
179
|
+
}
|
|
180
|
+
if (opts.printer) {
|
|
181
|
+
setConfig({ defaultPrinter: opts.printer as string });
|
|
182
|
+
console.log(`Default printer set to: ${opts.printer}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function resolveTape(opts: Record<string, string | boolean>): Promise<TapeSize> {
|
|
187
|
+
const explicit = opts.tape ? parseTape(opts.tape as string) : null;
|
|
188
|
+
const detected = await detectTapeSize(opts.printer as string | undefined);
|
|
189
|
+
if (explicit) {
|
|
190
|
+
if (detected && detected !== explicit) {
|
|
191
|
+
console.warn(`Warning: -tape ${explicit}mm specified but printer reports ${detected}mm tape loaded`);
|
|
192
|
+
}
|
|
193
|
+
return explicit;
|
|
194
|
+
}
|
|
195
|
+
if (detected) return detected;
|
|
196
|
+
return getConfig().defaultTape ?? 24;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async function cmdPrint(
|
|
200
|
+
opts: Record<string, string | boolean>,
|
|
201
|
+
segments: Segment[],
|
|
202
|
+
inputs: string[]
|
|
203
|
+
): Promise<void> {
|
|
204
|
+
const tape = await resolveTape(opts);
|
|
205
|
+
|
|
206
|
+
// If there are 2+ positional inputs, treat each as a text segment.
|
|
207
|
+
// (A single positional input is handled below via classifyInput so it can
|
|
208
|
+
// auto-detect file paths.)
|
|
209
|
+
if (inputs.length > 1 || (inputs.length >= 1 && segments.length > 0)) {
|
|
210
|
+
for (const inp of inputs) {
|
|
211
|
+
segments.push({ type: "text", value: inp });
|
|
212
|
+
}
|
|
213
|
+
inputs.length = 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const baseOpts = {
|
|
217
|
+
printer: opts.printer as string | undefined,
|
|
218
|
+
wait: !opts.nowait,
|
|
219
|
+
waitTimeoutMs: opts.timeout ? Math.round(parseFloat(opts.timeout as string) * 1000) : undefined,
|
|
220
|
+
waitIntervalMs: opts.interval ? Math.round(parseFloat(opts.interval as string) * 1000) : undefined,
|
|
221
|
+
onWaiting: makeWaitCallback(),
|
|
222
|
+
log: (msg: string) => console.log(msg),
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// Multi-segment mode: explicit -text/-qr (>=1 segment), with positional joined in
|
|
226
|
+
if (segments.length > 1 || (segments.length === 1 && inputs.length === 0)) {
|
|
227
|
+
const segOpts: SegmentOptions = {
|
|
228
|
+
...baseOpts,
|
|
229
|
+
tape,
|
|
230
|
+
textHeight: opts.height as string | undefined,
|
|
231
|
+
space: opts.space as string | undefined,
|
|
232
|
+
};
|
|
233
|
+
if (opts.output) {
|
|
234
|
+
const buffer = await renderSegments(segments, tape, opts.height as string | undefined, opts.space as string | undefined);
|
|
235
|
+
fs.writeFileSync(opts.output as string, buffer);
|
|
236
|
+
console.log(`Saved to ${opts.output}`);
|
|
237
|
+
} else {
|
|
238
|
+
await printSegments(segments, segOpts);
|
|
239
|
+
console.log(`Printed ${segments.length} segment(s) on ${tape}mm tape`);
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Single content op
|
|
245
|
+
const printOpts: PrintOptions = {
|
|
246
|
+
...baseOpts,
|
|
247
|
+
tape,
|
|
248
|
+
aspect: opts.aspect as string | undefined,
|
|
249
|
+
textHeight: opts.height as string | undefined,
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
if (opts.clip) {
|
|
253
|
+
printOpts.clip = true;
|
|
254
|
+
} else if (inputs.length === 1) {
|
|
255
|
+
Object.assign(printOpts, classifyInput(inputs[0], opts));
|
|
256
|
+
} else if (inputs.length === 0 && segments.length === 0) {
|
|
257
|
+
showHelp();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (opts.output) {
|
|
262
|
+
const buffer = await render(printOpts);
|
|
263
|
+
fs.writeFileSync(opts.output as string, buffer);
|
|
264
|
+
console.log(`Saved to ${opts.output}`);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
await print(printOpts);
|
|
268
|
+
console.log(`Printed on ${tape}mm tape`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function classifyInput(input: string, opts: Record<string, string | boolean>): Partial<CorePrintOptions> {
|
|
272
|
+
if (opts.text) return { text: input };
|
|
273
|
+
if (opts.html) return { htmlPath: path.resolve(input) };
|
|
274
|
+
if (opts.image) return { imagePath: path.resolve(input) };
|
|
275
|
+
|
|
276
|
+
const lower = input.toLowerCase();
|
|
277
|
+
if (lower.endsWith(".html") || lower.endsWith(".htm")) return { htmlPath: path.resolve(input) };
|
|
278
|
+
if (lower.endsWith(".txt")) return { textFile: path.resolve(input) };
|
|
279
|
+
if (/\.(png|jpg|jpeg|bmp|gif)$/i.test(lower)) return { imagePath: path.resolve(input) };
|
|
280
|
+
if (fs.existsSync(input)) {
|
|
281
|
+
const ext = path.extname(lower);
|
|
282
|
+
if (ext === ".html" || ext === ".htm") return { htmlPath: path.resolve(input) };
|
|
283
|
+
return { textFile: path.resolve(input) };
|
|
284
|
+
}
|
|
285
|
+
return { text: input };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function makeWaitCallback() {
|
|
289
|
+
let lastReport = 0;
|
|
290
|
+
return (status: PrinterStatus, elapsedMs: number, alternatives: PrinterStatus[]) => {
|
|
291
|
+
const secs = Math.floor(elapsedMs / 1000);
|
|
292
|
+
if (secs - lastReport < 5) return;
|
|
293
|
+
lastReport = secs;
|
|
294
|
+
const altStr = alternatives.length > 0
|
|
295
|
+
? ` (online alternatives: ${alternatives.map(a => a.name).join(", ")})`
|
|
296
|
+
: "";
|
|
297
|
+
console.log(`[brother-print] still waiting for ${status.name} (${status.statusText}${status.error ? ", " + status.error : ""}); ${secs}s elapsed${altStr}`);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
main();
|
package/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
* Brother Label Printer API
|
|
3
3
|
* @module @bobfrankston/brother-label
|
|
4
4
|
*/
|
|
5
|
-
export { TapeSize, Orientation, PrinterConfig, PrinterInfo, PrintOptions, PrintResult, print, render, getConfig, setConfig, getConfigPath, listPrinters, } from "./api.js";
|
|
5
|
+
export { TapeSize, Orientation, PrinterConfig, PrinterInfo, PrintOptions, PrintResult, SegmentOptions, Segment, brotherPrinter, print, render, renderSegments, printSegments, getConfig, setConfig, getConfigPath, listPrinters, detectTapeSize, } from "./api.js";
|
|
6
|
+
export type { LabelPrinter, MediaInfo, PrinterStatus, WaitOptions, WaitCallback, LogFn, ClipboardKind, ClipboardResult, } from "@bobfrankston/label-core";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,OAAO,EAEP,cAAc,EAEd,KAAK,EACL,MAAM,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,GACjB,MAAM,UAAU,CAAC;AAGlB,YAAY,EACR,YAAY,EACZ,SAAS,EACT,aAAa,EACb,WAAW,EACX,YAAY,EACZ,KAAK,EACL,aAAa,EACb,eAAe,GAClB,MAAM,0BAA0B,CAAC"}
|
package/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* @module @bobfrankston/brother-label
|
|
4
4
|
*/
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/* The Brother-specific singleton (implements LabelPrinter from label-core) */
|
|
7
|
+
brotherPrinter,
|
|
8
|
+
/* Functions */
|
|
9
|
+
print, render, renderSegments, printSegments, getConfig, setConfig, getConfigPath, listPrinters, detectTapeSize, } from "./api.js";
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;AAUH,8EAA8E;AAC9E,cAAc;AACd,eAAe;AACf,KAAK,EACL,MAAM,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,GACjB,MAAM,UAAU,CAAC","sourcesContent":["/**\n * Brother Label Printer API\n * @module @bobfrankston/brother-label\n */\n\nexport {\n /* Brother-specific types (backward-compat) */\n TapeSize,\n Orientation,\n PrinterConfig,\n PrinterInfo,\n PrintOptions,\n PrintResult,\n SegmentOptions,\n Segment,\n /* The Brother-specific singleton (implements LabelPrinter from label-core) */\n brotherPrinter,\n /* Functions */\n print,\n render,\n renderSegments,\n printSegments,\n getConfig,\n setConfig,\n getConfigPath,\n listPrinters,\n detectTapeSize,\n} from \"./api.js\";\n\n/* Re-export the unified label-core types for cross-driver code. */\nexport type {\n LabelPrinter,\n MediaInfo,\n PrinterStatus,\n WaitOptions,\n WaitCallback,\n LogFn,\n ClipboardKind,\n ClipboardResult,\n} from \"@bobfrankston/label-core\";\n"]}
|
package/index.ts
CHANGED
|
@@ -1,21 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Brother Label Printer API
|
|
3
|
-
* @module @bobfrankston/brother-label
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
TapeSize,
|
|
9
|
-
Orientation,
|
|
10
|
-
PrinterConfig,
|
|
11
|
-
PrinterInfo,
|
|
12
|
-
PrintOptions,
|
|
13
|
-
PrintResult,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Brother Label Printer API
|
|
3
|
+
* @module @bobfrankston/brother-label
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
/* Brother-specific types (backward-compat) */
|
|
8
|
+
TapeSize,
|
|
9
|
+
Orientation,
|
|
10
|
+
PrinterConfig,
|
|
11
|
+
PrinterInfo,
|
|
12
|
+
PrintOptions,
|
|
13
|
+
PrintResult,
|
|
14
|
+
SegmentOptions,
|
|
15
|
+
Segment,
|
|
16
|
+
/* The Brother-specific singleton (implements LabelPrinter from label-core) */
|
|
17
|
+
brotherPrinter,
|
|
18
|
+
/* Functions */
|
|
19
|
+
print,
|
|
20
|
+
render,
|
|
21
|
+
renderSegments,
|
|
22
|
+
printSegments,
|
|
23
|
+
getConfig,
|
|
24
|
+
setConfig,
|
|
25
|
+
getConfigPath,
|
|
26
|
+
listPrinters,
|
|
27
|
+
detectTapeSize,
|
|
28
|
+
} from "./api.js";
|
|
29
|
+
|
|
30
|
+
/* Re-export the unified label-core types for cross-driver code. */
|
|
31
|
+
export type {
|
|
32
|
+
LabelPrinter,
|
|
33
|
+
MediaInfo,
|
|
34
|
+
PrinterStatus,
|
|
35
|
+
WaitOptions,
|
|
36
|
+
WaitCallback,
|
|
37
|
+
LogFn,
|
|
38
|
+
ClipboardKind,
|
|
39
|
+
ClipboardResult,
|
|
40
|
+
} from "@bobfrankston/label-core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/brother-label",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "API and CLI for printing labels on Brother P-touch printers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsc",
|
|
29
29
|
"prepublishOnly": "npm run build",
|
|
30
|
-
"start": "node cli.js"
|
|
30
|
+
"start": "node cli.js",
|
|
31
|
+
"release": "npmglobalize"
|
|
31
32
|
},
|
|
32
33
|
"keywords": [
|
|
33
34
|
"brother",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"url": "https://github.com/BobFrankston/brother-label.git"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"
|
|
48
|
+
"@bobfrankston/label-core": "^0.1.1",
|
|
48
49
|
"jimp": "^1.6.0",
|
|
49
50
|
"puppeteer": "^23.11.1",
|
|
50
51
|
"qrcode": "^1.5.4"
|
|
@@ -56,5 +57,19 @@
|
|
|
56
57
|
},
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
".dependencies": {
|
|
62
|
+
"@bobfrankston/label-core": "file:../../../utils/label-core",
|
|
63
|
+
"jimp": "^1.6.0",
|
|
64
|
+
"puppeteer": "^23.11.1",
|
|
65
|
+
"qrcode": "^1.5.4"
|
|
66
|
+
},
|
|
67
|
+
".transformedSnapshot": {
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@bobfrankston/label-core": "^0.1.1",
|
|
70
|
+
"jimp": "^1.6.0",
|
|
71
|
+
"puppeteer": "^23.11.1",
|
|
72
|
+
"qrcode": "^1.5.4"
|
|
73
|
+
}
|
|
59
74
|
}
|
|
60
75
|
}
|