@dudko.dev/vectorize-cli 0.4.0 → 0.4.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 (3) hide show
  1. package/README.md +5 -0
  2. package/dist/cli.js +20 -1
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -25,6 +25,11 @@ internal business use. Ask: sergey@dudko.dev
25
25
  A hosted API is planned at `vectorize-api.dudko.dev`, where a paid account will
26
26
  carry commercial permission for use of that service. Accounts are not open yet.
27
27
 
28
+ Your rights to this package come from `LICENSE` and, for commercial use, from a
29
+ written agreement with the copyright holder. No web page grants them — not this
30
+ project's, and not anyone else's — so nothing published at any address can widen
31
+ or narrow what `LICENSE` says.
32
+
28
33
  The WebAssembly modules come from `@dudko.dev/vectorize-core`, whose
29
34
  `THIRD-PARTY-NOTICES.md` carries the notices for the Rust crates linked into
30
35
  them.
package/dist/cli.js CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import { realpathSync } from 'node:fs';
2
3
  import { readFile, writeFile } from 'node:fs/promises';
3
4
  import { basename, extname } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
4
6
  import { parseArgs } from 'node:util';
5
7
  import { toDxf, toEps, toPdf, traceEncoded, withSize } from '@dudko.dev/vectorize-core';
6
8
  const FORMATS = ['svg', 'eps', 'pdf', 'dxf'];
@@ -179,7 +181,24 @@ export async function main(argv) {
179
181
  return 0;
180
182
  }
181
183
  // Run when executed directly (not when imported by tests).
182
- if (process.argv[1] && import.meta.url === new URL(`file://${process.argv[1]}`).href) {
184
+ //
185
+ // argv[1] is the path the user invoked. For an installed CLI that is the
186
+ // node_modules/.bin symlink npm creates, while import.meta.url is always the
187
+ // real file — so comparing the two without resolving the link makes this
188
+ // condition false exactly when someone runs `vectorize`, and the command exits
189
+ // 0 having done nothing. That is how 0.4.1 shipped. Resolve both to real paths.
190
+ //
191
+ // fileURLToPath rather than building a file:// URL by hand, which mangles any
192
+ // path containing a space or a character URLs escape.
193
+ const invokedPath = (() => {
194
+ try {
195
+ return process.argv[1] ? realpathSync(process.argv[1]) : '';
196
+ }
197
+ catch {
198
+ return '';
199
+ }
200
+ })();
201
+ if (invokedPath && invokedPath === realpathSync(fileURLToPath(import.meta.url))) {
183
202
  main(process.argv.slice(2)).then((code) => process.exit(code), (err) => {
184
203
  process.stderr.write(`error: ${err instanceof Error ? err.message : String(err)}\n`);
185
204
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudko.dev/vectorize-cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Command-line raster → SVG converter",
5
5
  "type": "module",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",
@@ -18,7 +18,7 @@
18
18
  "test": "vitest run"
19
19
  },
20
20
  "dependencies": {
21
- "@dudko.dev/vectorize-core": "workspace:*"
21
+ "@dudko.dev/vectorize-core": "0.4.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.18.0",