mediasnacks 0.16.3 → 0.16.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasnacks",
3
- "version": "0.16.3",
3
+ "version": "0.16.4",
4
4
  "description": "Utilities for optimizing and preparing videos and images for the web",
5
5
  "license": "MIT",
6
6
  "author": "Eric Fortis",
package/src/avif.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { join, basename } from 'node:path'
3
+ import { join, basename, dirname } from 'node:path'
4
4
 
5
5
  import { parseOptions } from './utils/parseOptions.js'
6
6
  import { replaceExt, lstat } from './utils/fs-utils.js'
@@ -35,7 +35,7 @@ async function main() {
35
35
  for (const file of files)
36
36
  await toAvif({
37
37
  file,
38
- outFile: join(values['output-dir'], replaceExt(basename(file), 'avif')),
38
+ outFile: join(values['output-dir'] || dirname(file), replaceExt(basename(file), 'avif')),
39
39
  overwrite: values.overwrite
40
40
  })
41
41
  }
package/src/unemoji.sh CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/bin/sh
2
2
 
3
- # Removes emoji's from filenames
3
+ # Removes emoji's from filenames on the current working directory.
4
+ # Does not overwrite files.
4
5
 
5
6
  find . -depth | while IFS= read -r file; do
6
7
  dir=$(dirname "$file")
7
8
  base=$(basename "$file")
8
9
 
9
- # Remove emojis using Perl's Unicode-aware regex
10
+ # Remove Emojis
10
11
  newbase=$(printf '%s' "$base" | perl -CSD -pe '
11
12
  s/[\x{1F600}-\x{1F64F}]//g; # Emoticons
12
13
  s/[\x{1F300}-\x{1F5FF}]//g; # Misc Symbols and Pictographs
@@ -18,7 +19,7 @@ find . -depth | while IFS= read -r file; do
18
19
  s/[\x{1F1E6}-\x{1F1FF}]//g; # Regional Indicator Symbols
19
20
  ')
20
21
 
21
- # Normalize
22
+ # Normalize to Unicode NFKC
22
23
  newbase=$(printf '%s' "$newbase" | perl -CSD -MUnicode::Normalize -pe '$_ = NFKC($_)')
23
24
 
24
25
  if [ "$base" != "$newbase" ]; then
@@ -1,7 +1,7 @@
1
- import { join } from 'node:path'
2
- import { tmpdir } from 'node:os'
3
- import { spawnSync } from 'node:child_process'
4
- import { createHash } from 'node:crypto'
1
+ import { join } from 'node:path'
2
+ import { tmpdir } from 'node:os'
3
+ import { spawnSync } from 'node:child_process'
4
+ import { createHash } from 'node:crypto'
5
5
  import { mkdtempSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs'
6
6
 
7
7
  const rel = f => join(import.meta.dirname, f)