@lumy-pack/scene-sieve 0.0.2 → 0.0.3

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/cli.mjs CHANGED
@@ -21,7 +21,8 @@ var logger = {
21
21
  console.log(`${pc.blue("info")} ${message}`);
22
22
  },
23
23
  success(message) {
24
- console.log(`${pc.green("done")} ${message}`);
24
+ console.log(`
25
+ ${pc.green("done")} ${message}`);
25
26
  },
26
27
  warn(message) {
27
28
  console.warn(`${pc.yellow("warn")} ${message}`);
@@ -512,6 +513,7 @@ import ffmpegPath from "ffmpeg-static";
512
513
 
513
514
  // src/utils/paths.ts
514
515
  import { mkdir, stat } from "fs/promises";
516
+ import { homedir } from "os";
515
517
  import { basename, extname, resolve } from "path";
516
518
  async function ensureDir(dirPath) {
517
519
  await mkdir(dirPath, { recursive: true });
@@ -524,6 +526,16 @@ async function fileExists(filePath) {
524
526
  return false;
525
527
  }
526
528
  }
529
+ function expandTilde(p) {
530
+ if (p === "~") return homedir();
531
+ if (p.startsWith("~/") || p.startsWith("~\\")) {
532
+ return resolve(homedir(), p.slice(2));
533
+ }
534
+ return p;
535
+ }
536
+ function resolveAbsolute(p) {
537
+ return resolve(expandTilde(p));
538
+ }
527
539
  function deriveOutputPath(inputPath) {
528
540
  const dir = resolve(inputPath, "..");
529
541
  const name = basename(inputPath, extname(inputPath));
@@ -698,7 +710,7 @@ async function readFramesAsBuffers(frameNodes, quality) {
698
710
  // src/core/input-resolver.ts
699
711
  function resolveOptions(options) {
700
712
  const mode = options.mode;
701
- const inputPath = mode === "file" ? options.inputPath : void 0;
713
+ const inputPath = mode === "file" ? resolveAbsolute(options.inputPath) : void 0;
702
714
  const outputPath = options.outputPath ?? (inputPath ? deriveOutputPath(inputPath) : join4(process.cwd(), "scene-sieve-output"));
703
715
  const threshold = options.threshold ?? DEFAULT_THRESHOLD;
704
716
  if (threshold <= 0 || threshold > 1) {
@@ -722,7 +734,10 @@ function resolveOptions(options) {
722
734
  }
723
735
  async function resolveInput(options, workspacePath) {
724
736
  if (options.mode === "file") {
725
- return { frames: [], resolvedInputPath: options.inputPath };
737
+ return {
738
+ frames: [],
739
+ resolvedInputPath: resolveAbsolute(options.inputPath)
740
+ };
726
741
  }
727
742
  if (options.mode === "buffer") {
728
743
  const resolvedInputPath = await writeInputBuffer(
package/dist/index.cjs CHANGED
@@ -55,7 +55,8 @@ var logger = {
55
55
  console.log(`${import_picocolors.default.blue("info")} ${message}`);
56
56
  },
57
57
  success(message) {
58
- console.log(`${import_picocolors.default.green("done")} ${message}`);
58
+ console.log(`
59
+ ${import_picocolors.default.green("done")} ${message}`);
59
60
  },
60
61
  warn(message) {
61
62
  console.warn(`${import_picocolors.default.yellow("warn")} ${message}`);
@@ -546,6 +547,7 @@ var import_ffmpeg_static = __toESM(require("ffmpeg-static"), 1);
546
547
 
547
548
  // src/utils/paths.ts
548
549
  var import_promises = require("fs/promises");
550
+ var import_node_os2 = require("os");
549
551
  var import_node_path2 = require("path");
550
552
  async function ensureDir(dirPath) {
551
553
  await (0, import_promises.mkdir)(dirPath, { recursive: true });
@@ -558,6 +560,16 @@ async function fileExists(filePath) {
558
560
  return false;
559
561
  }
560
562
  }
563
+ function expandTilde(p) {
564
+ if (p === "~") return (0, import_node_os2.homedir)();
565
+ if (p.startsWith("~/") || p.startsWith("~\\")) {
566
+ return (0, import_node_path2.resolve)((0, import_node_os2.homedir)(), p.slice(2));
567
+ }
568
+ return p;
569
+ }
570
+ function resolveAbsolute(p) {
571
+ return (0, import_node_path2.resolve)(expandTilde(p));
572
+ }
561
573
  function deriveOutputPath(inputPath) {
562
574
  const dir = (0, import_node_path2.resolve)(inputPath, "..");
563
575
  const name = (0, import_node_path2.basename)(inputPath, (0, import_node_path2.extname)(inputPath));
@@ -732,7 +744,7 @@ async function readFramesAsBuffers(frameNodes, quality) {
732
744
  // src/core/input-resolver.ts
733
745
  function resolveOptions(options) {
734
746
  const mode = options.mode;
735
- const inputPath = mode === "file" ? options.inputPath : void 0;
747
+ const inputPath = mode === "file" ? resolveAbsolute(options.inputPath) : void 0;
736
748
  const outputPath = options.outputPath ?? (inputPath ? deriveOutputPath(inputPath) : (0, import_node_path5.join)(process.cwd(), "scene-sieve-output"));
737
749
  const threshold = options.threshold ?? DEFAULT_THRESHOLD;
738
750
  if (threshold <= 0 || threshold > 1) {
@@ -756,7 +768,10 @@ function resolveOptions(options) {
756
768
  }
757
769
  async function resolveInput(options, workspacePath) {
758
770
  if (options.mode === "file") {
759
- return { frames: [], resolvedInputPath: options.inputPath };
771
+ return {
772
+ frames: [],
773
+ resolvedInputPath: resolveAbsolute(options.inputPath)
774
+ };
760
775
  }
761
776
  if (options.mode === "buffer") {
762
777
  const resolvedInputPath = await writeInputBuffer(
package/dist/index.mjs CHANGED
@@ -15,7 +15,8 @@ var logger = {
15
15
  console.log(`${pc.blue("info")} ${message}`);
16
16
  },
17
17
  success(message) {
18
- console.log(`${pc.green("done")} ${message}`);
18
+ console.log(`
19
+ ${pc.green("done")} ${message}`);
19
20
  },
20
21
  warn(message) {
21
22
  console.warn(`${pc.yellow("warn")} ${message}`);
@@ -506,6 +507,7 @@ import ffmpegPath from "ffmpeg-static";
506
507
 
507
508
  // src/utils/paths.ts
508
509
  import { mkdir, stat } from "fs/promises";
510
+ import { homedir } from "os";
509
511
  import { basename, extname, resolve } from "path";
510
512
  async function ensureDir(dirPath) {
511
513
  await mkdir(dirPath, { recursive: true });
@@ -518,6 +520,16 @@ async function fileExists(filePath) {
518
520
  return false;
519
521
  }
520
522
  }
523
+ function expandTilde(p) {
524
+ if (p === "~") return homedir();
525
+ if (p.startsWith("~/") || p.startsWith("~\\")) {
526
+ return resolve(homedir(), p.slice(2));
527
+ }
528
+ return p;
529
+ }
530
+ function resolveAbsolute(p) {
531
+ return resolve(expandTilde(p));
532
+ }
521
533
  function deriveOutputPath(inputPath) {
522
534
  const dir = resolve(inputPath, "..");
523
535
  const name = basename(inputPath, extname(inputPath));
@@ -692,7 +704,7 @@ async function readFramesAsBuffers(frameNodes, quality) {
692
704
  // src/core/input-resolver.ts
693
705
  function resolveOptions(options) {
694
706
  const mode = options.mode;
695
- const inputPath = mode === "file" ? options.inputPath : void 0;
707
+ const inputPath = mode === "file" ? resolveAbsolute(options.inputPath) : void 0;
696
708
  const outputPath = options.outputPath ?? (inputPath ? deriveOutputPath(inputPath) : join4(process.cwd(), "scene-sieve-output"));
697
709
  const threshold = options.threshold ?? DEFAULT_THRESHOLD;
698
710
  if (threshold <= 0 || threshold > 1) {
@@ -716,7 +728,10 @@ function resolveOptions(options) {
716
728
  }
717
729
  async function resolveInput(options, workspacePath) {
718
730
  if (options.mode === "file") {
719
- return { frames: [], resolvedInputPath: options.inputPath };
731
+ return {
732
+ frames: [],
733
+ resolvedInputPath: resolveAbsolute(options.inputPath)
734
+ };
720
735
  }
721
736
  if (options.mode === "buffer") {
722
737
  const resolvedInputPath = await writeInputBuffer(
@@ -1,5 +1,15 @@
1
1
  export declare function ensureDir(dirPath: string): Promise<void>;
2
2
  export declare function fileExists(filePath: string): Promise<boolean>;
3
+ /**
4
+ * Expand leading ~ to homedir. Node's path.resolve() does not expand ~,
5
+ * so paths like ~/Desktop/foo depend on process.cwd() and can produce
6
+ * different results when run from different directories.
7
+ */
8
+ export declare function expandTilde(p: string): string;
9
+ /**
10
+ * Resolve path to absolute. Expands ~ to homedir first so that the result
11
+ * does not depend on process.cwd().
12
+ */
3
13
  export declare function resolveAbsolute(p: string): string;
4
14
  /**
5
15
  * Derive default output directory name from input file path.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumy-pack/scene-sieve",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "CLI tool for extracting key frames from video and GIF files",
5
5
  "keywords": [
6
6
  "cli",