fluncle 0.50.0 → 0.51.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.
Files changed (2) hide show
  1. package/bin/fluncle.mjs +42 -17
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -408,7 +408,7 @@ function compareVersions(left, right) {
408
408
  const leftParts = parseVersion(left);
409
409
  const rightParts = parseVersion(right);
410
410
  for (let index = 0;index < 3; index += 1) {
411
- const difference = leftParts[index] - rightParts[index];
411
+ const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);
412
412
  if (difference !== 0) {
413
413
  return difference;
414
414
  }
@@ -417,16 +417,13 @@ function compareVersions(left, right) {
417
417
  }
418
418
  function parseVersion(version) {
419
419
  const parts = version.split(".").map((part) => Number.parseInt(part, 10));
420
- return [
421
- Number.isInteger(parts[0]) ? parts[0] : 0,
422
- Number.isInteger(parts[1]) ? parts[1] : 0,
423
- Number.isInteger(parts[2]) ? parts[2] : 0
424
- ];
420
+ const integerOrZero = (value) => value !== undefined && Number.isInteger(value) ? value : 0;
421
+ return [integerOrZero(parts[0]), integerOrZero(parts[1]), integerOrZero(parts[2])];
425
422
  }
426
423
  var currentVersion;
427
424
  var init_version = __esm(() => {
428
425
  init_output();
429
- currentVersion = "0.50.0".trim() ? "0.50.0".trim() : "0.1.0";
426
+ currentVersion = "0.51.0".trim() ? "0.51.0".trim() : "0.1.0";
430
427
  });
431
428
 
432
429
  // src/update-notifier.ts
@@ -483,6 +480,9 @@ function shouldNotify(args) {
483
480
  function firstPositional(args) {
484
481
  for (let index = 0;index < args.length; index += 1) {
485
482
  const arg = args[index];
483
+ if (arg === undefined) {
484
+ continue;
485
+ }
486
486
  if (arg === "--env") {
487
487
  index += 1;
488
488
  continue;
@@ -1237,6 +1237,9 @@ async function mixtapeDistributeCommand(idOrLogId, options, onProgress = () => {
1237
1237
  }
1238
1238
  const results = [];
1239
1239
  if (doYoutube) {
1240
+ if (!options.video) {
1241
+ throw new CliError2("missing_video", "YouTube distribution needs --video <mp4>");
1242
+ }
1240
1243
  onProgress("YouTube: uploading video…");
1241
1244
  const { distributeYoutube: distributeYoutube2 } = await Promise.resolve().then(() => (init_mixtape_youtube(), exports_mixtape_youtube));
1242
1245
  const result = await distributeYoutube2(mixtapeId, options.video, onProgress);
@@ -1244,6 +1247,9 @@ async function mixtapeDistributeCommand(idOrLogId, options, onProgress = () => {
1244
1247
  onProgress(`YouTube: ${result.url}`);
1245
1248
  }
1246
1249
  if (doMixcloud) {
1250
+ if (!options.audio) {
1251
+ throw new CliError2("missing_audio", "Mixcloud distribution needs --audio <file>");
1252
+ }
1247
1253
  onProgress("Mixcloud: uploading audio…");
1248
1254
  const { distributeMixcloud: distributeMixcloud2 } = await Promise.resolve().then(() => (init_mixtape_mixcloud(), exports_mixtape_mixcloud));
1249
1255
  const result = await distributeMixcloud2(mixtapeId, options.audio, onProgress, options.unlisted);
@@ -1327,11 +1333,15 @@ function parseCueSheet(text) {
1327
1333
  }
1328
1334
  const match = trimmed.match(/^(\d{1,2}:\d{2}(?::\d{2})?)\s+(.+)$/);
1329
1335
  if (match) {
1330
- const startMs = parseDuration(match[1]);
1336
+ const [, time, ref] = match;
1337
+ if (time === undefined || ref === undefined) {
1338
+ continue;
1339
+ }
1340
+ const startMs = parseDuration(time);
1331
1341
  if (startMs === null) {
1332
1342
  continue;
1333
1343
  }
1334
- entries.push({ ref: match[2].trim(), startMs });
1344
+ entries.push({ ref: ref.trim(), startMs });
1335
1345
  } else {
1336
1346
  entries.push({ ref: trimmed });
1337
1347
  }
@@ -1354,12 +1364,18 @@ function parseDuration(input) {
1354
1364
  }
1355
1365
  if (parts.length === 3) {
1356
1366
  const [hours, minutes2, seconds2] = nums;
1367
+ if (hours === undefined || minutes2 === undefined || seconds2 === undefined) {
1368
+ return null;
1369
+ }
1357
1370
  if (minutes2 >= 60 || seconds2 >= 60) {
1358
1371
  return null;
1359
1372
  }
1360
1373
  return Math.round((hours * 3600 + minutes2 * 60 + seconds2) * 1000);
1361
1374
  }
1362
1375
  const [minutes, seconds] = nums;
1376
+ if (minutes === undefined || seconds === undefined) {
1377
+ return null;
1378
+ }
1363
1379
  if (seconds >= 60) {
1364
1380
  return null;
1365
1381
  }
@@ -1881,7 +1897,7 @@ function compareVersions2(left, right) {
1881
1897
  const leftParts = parseVersion2(left);
1882
1898
  const rightParts = parseVersion2(right);
1883
1899
  for (let index = 0;index < 3; index += 1) {
1884
- const difference = leftParts[index] - rightParts[index];
1900
+ const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);
1885
1901
  if (difference !== 0) {
1886
1902
  return difference;
1887
1903
  }
@@ -1890,16 +1906,13 @@ function compareVersions2(left, right) {
1890
1906
  }
1891
1907
  function parseVersion2(version) {
1892
1908
  const parts = version.split(".").map((part) => Number.parseInt(part, 10));
1893
- return [
1894
- Number.isInteger(parts[0]) ? parts[0] : 0,
1895
- Number.isInteger(parts[1]) ? parts[1] : 0,
1896
- Number.isInteger(parts[2]) ? parts[2] : 0
1897
- ];
1909
+ const integerOrZero = (value) => value !== undefined && Number.isInteger(value) ? value : 0;
1910
+ return [integerOrZero(parts[0]), integerOrZero(parts[1]), integerOrZero(parts[2])];
1898
1911
  }
1899
1912
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
1900
1913
  var init_version2 = __esm(() => {
1901
1914
  init_output();
1902
- currentVersion2 = "0.50.0".trim() ? "0.50.0".trim() : "0.1.0";
1915
+ currentVersion2 = "0.51.0".trim() ? "0.51.0".trim() : "0.1.0";
1903
1916
  });
1904
1917
 
1905
1918
  // src/commands/track.ts
@@ -2992,6 +3005,9 @@ async function paginateWithKeyboard(options) {
2992
3005
  const columns = stdout.columns ?? 80;
2993
3006
  const before = pages.slice(0, index).reduce((count, page2) => count + page2.lines.length, 0);
2994
3007
  const page = pages[index];
3008
+ if (page === undefined) {
3009
+ return;
3010
+ }
2995
3011
  const start = before + 1;
2996
3012
  const end = before + page.lines.length;
2997
3013
  const loading = busy ? " · loading…" : "";
@@ -3003,7 +3019,7 @@ async function paginateWithKeyboard(options) {
3003
3019
  `);
3004
3020
  }
3005
3021
  function loadNext() {
3006
- const cursor = pages[index].nextCursor;
3022
+ const cursor = pages[index]?.nextCursor;
3007
3023
  if (cursor === undefined) {
3008
3024
  return;
3009
3025
  }
@@ -6224,6 +6240,9 @@ function assertParseArgsCompatibleOptionValues(args) {
6224
6240
  }
6225
6241
  for (let index = 0;index < args.length; index += 1) {
6226
6242
  const arg = args[index];
6243
+ if (arg === undefined) {
6244
+ continue;
6245
+ }
6227
6246
  if (arg === "--") {
6228
6247
  return;
6229
6248
  }
@@ -6253,6 +6272,9 @@ function positionalArgs(args) {
6253
6272
  const positionals = [];
6254
6273
  for (let index = 0;index < args.length; index += 1) {
6255
6274
  const arg = args[index];
6275
+ if (arg === undefined) {
6276
+ continue;
6277
+ }
6256
6278
  if (arg === "--") {
6257
6279
  positionals.push(...args.slice(index + 1));
6258
6280
  return positionals;
@@ -6281,6 +6303,9 @@ function positionalArgs(args) {
6281
6303
  function topLevelCommand(args) {
6282
6304
  for (let index = 0;index < args.length; index += 1) {
6283
6305
  const arg = args[index];
6306
+ if (arg === undefined) {
6307
+ continue;
6308
+ }
6284
6309
  if (arg === "--env") {
6285
6310
  index += 1;
6286
6311
  continue;
package/package.json CHANGED
@@ -31,5 +31,5 @@
31
31
  "url": "git+https://github.com/mauricekleine/fluncle.git"
32
32
  },
33
33
  "type": "module",
34
- "version": "0.50.0"
34
+ "version": "0.51.0"
35
35
  }