@remotion/cli 3.0.25 → 3.0.26

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.
@@ -1,2 +1,3 @@
1
1
  import type { DownloadProgress } from './progress-bar';
2
+ export declare const getFileSizeDownloadBar: (downloaded: number) => string;
2
3
  export declare const makeMultiDownloadProgress: (progresses: DownloadProgress[]) => string | null;
@@ -1,25 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeMultiDownloadProgress = void 0;
3
+ exports.makeMultiDownloadProgress = exports.getFileSizeDownloadBar = void 0;
4
+ const format_bytes_1 = require("./format-bytes");
4
5
  const make_progress_bar_1 = require("./make-progress-bar");
6
+ const getFileSizeDownloadBar = (downloaded) => {
7
+ const desiredLength = (0, make_progress_bar_1.makeProgressBar)(0).length;
8
+ return `[${(0, format_bytes_1.formatBytes)(downloaded).padEnd(desiredLength - 2, ' ')}]`;
9
+ };
10
+ exports.getFileSizeDownloadBar = getFileSizeDownloadBar;
5
11
  const makeMultiDownloadProgress = (progresses) => {
6
12
  if (progresses.length === 0) {
7
13
  return null;
8
14
  }
9
15
  if (progresses.length === 1) {
10
16
  const [progress] = progresses;
11
- const truncatedFileName = progress.name.length >= 100
12
- ? progress.name.substring(0, 97) + '...'
17
+ const truncatedFileName = progress.name.length >= 60
18
+ ? progress.name.substring(0, 57) + '...'
13
19
  : progress.name;
14
20
  return [
15
21
  ` +`,
16
- (0, make_progress_bar_1.makeProgressBar)(progress.progress),
22
+ progress.progress
23
+ ? (0, make_progress_bar_1.makeProgressBar)(progress.progress)
24
+ : (0, exports.getFileSizeDownloadBar)(progress.downloaded),
17
25
  `Downloading ${truncatedFileName}`,
18
26
  ].join(' ');
19
27
  }
28
+ const everyFileHasContentLength = progresses.every((p) => p.totalBytes !== null);
20
29
  return [
21
30
  ` +`,
22
- (0, make_progress_bar_1.makeProgressBar)(progresses.reduce((a, b) => a + b.progress, 0) / progresses.length),
31
+ everyFileHasContentLength
32
+ ? (0, make_progress_bar_1.makeProgressBar)(progresses.reduce((a, b) => a + b.progress, 0) /
33
+ progresses.length)
34
+ : (0, exports.getFileSizeDownloadBar)(progresses.reduce((a, b) => a + b.downloaded, 0)),
23
35
  `Downloading ${progresses.length} files`,
24
36
  ].join(' ');
25
37
  };
@@ -0,0 +1,6 @@
1
+ export declare const formatBytes: (number: number, options?: Intl.NumberFormatOptions & {
2
+ locale: string;
3
+ bits?: boolean;
4
+ binary?: boolean;
5
+ signed: boolean;
6
+ }) => string;
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatBytes = void 0;
4
+ const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
5
+ const BIBYTE_UNITS = [
6
+ 'B',
7
+ 'kiB',
8
+ 'MiB',
9
+ 'GiB',
10
+ 'TiB',
11
+ 'PiB',
12
+ 'EiB',
13
+ 'ZiB',
14
+ 'YiB',
15
+ ];
16
+ const BIT_UNITS = [
17
+ 'b',
18
+ 'kbit',
19
+ 'Mbit',
20
+ 'Gbit',
21
+ 'Tbit',
22
+ 'Pbit',
23
+ 'Ebit',
24
+ 'Zbit',
25
+ 'Ybit',
26
+ ];
27
+ const BIBIT_UNITS = [
28
+ 'b',
29
+ 'kibit',
30
+ 'Mibit',
31
+ 'Gibit',
32
+ 'Tibit',
33
+ 'Pibit',
34
+ 'Eibit',
35
+ 'Zibit',
36
+ 'Yibit',
37
+ ];
38
+ /*
39
+ Formats the given number using `Number#toLocaleString`.
40
+ - If locale is a string, the value is expected to be a locale-key (for example: `de`).
41
+ - If locale is true, the system default locale is used for translation.
42
+ - If no value for locale is specified, the number is returned unmodified.
43
+ */
44
+ const toLocaleString = (number, locale, options) => {
45
+ if (typeof locale === 'string' || Array.isArray(locale)) {
46
+ return number.toLocaleString(locale, options);
47
+ }
48
+ if (locale === true || options !== undefined) {
49
+ return number.toLocaleString(undefined, options);
50
+ }
51
+ return String(number);
52
+ };
53
+ const formatBytes = (number, options = {
54
+ locale: 'en-US',
55
+ signed: false,
56
+ maximumFractionDigits: 1,
57
+ }) => {
58
+ if (!Number.isFinite(number)) {
59
+ throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
60
+ }
61
+ options = { bits: false, binary: false, ...options };
62
+ const UNITS = options.bits
63
+ ? options.binary
64
+ ? BIBIT_UNITS
65
+ : BIT_UNITS
66
+ : options.binary
67
+ ? BIBYTE_UNITS
68
+ : BYTE_UNITS;
69
+ if (options.signed && number === 0) {
70
+ return `0 $ {
71
+ UNITS[0]
72
+ }`;
73
+ }
74
+ const isNegative = number < 0;
75
+ const prefix = isNegative ? '-' : options.signed ? '+' : '';
76
+ if (isNegative) {
77
+ number = -number;
78
+ }
79
+ let localeOptions;
80
+ if (options.minimumFractionDigits !== undefined) {
81
+ localeOptions = {
82
+ minimumFractionDigits: options.minimumFractionDigits,
83
+ };
84
+ }
85
+ if (options.maximumFractionDigits !== undefined) {
86
+ localeOptions = {
87
+ maximumFractionDigits: options.maximumFractionDigits,
88
+ ...localeOptions,
89
+ };
90
+ }
91
+ if (number < 1) {
92
+ const numString = toLocaleString(number, options.locale, localeOptions);
93
+ return prefix + numString + ' ' + UNITS[0];
94
+ }
95
+ const exponent = Math.min(Math.floor(options.binary
96
+ ? Math.log(number) / Math.log(1024)
97
+ : Math.log10(number) / 3), UNITS.length - 1);
98
+ number /= (options.binary ? 1024 : 1000) ** exponent;
99
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
100
+ const unit = UNITS[exponent];
101
+ return prefix + numberString + ' ' + unit;
102
+ };
103
+ exports.formatBytes = formatBytes;
@@ -31,7 +31,6 @@ const getFinalCodec = async (options) => {
31
31
  ? null
32
32
  : renderer_1.RenderInternals.getExtensionOfFilename((0, user_passed_output_location_1.getUserPassedOutputLocation)()),
33
33
  emitWarning: true,
34
- isLambda: options.isLambda,
35
34
  });
36
35
  const ffmpegExecutable = remotion_1.Internals.getCustomFfmpegExecutable();
37
36
  if (codec === 'vp8' &&
package/dist/index.d.ts CHANGED
@@ -101,4 +101,11 @@ export declare const CliInternals: {
101
101
  quietFlagProvided: () => boolean;
102
102
  parsedCli: import("./parse-command-line").CommandLineOptions & import("minimist").ParsedArgs;
103
103
  handleCommonError: (err: Error) => Promise<void>;
104
+ formatBytes: (number: number, options?: Intl.NumberFormatOptions & {
105
+ locale: string;
106
+ bits?: boolean | undefined;
107
+ binary?: boolean | undefined;
108
+ signed: boolean;
109
+ }) => string;
110
+ getFileSizeDownloadBar: (downloaded: number) => string;
104
111
  };
package/dist/index.js CHANGED
@@ -15,9 +15,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.CliInternals = exports.cli = void 0;
18
+ const renderer_1 = require("@remotion/renderer");
18
19
  const chalk_1 = require("./chalk");
19
20
  const check_version_1 = require("./check-version");
20
21
  const compositions_1 = require("./compositions");
22
+ const download_progress_1 = require("./download-progress");
23
+ const format_bytes_1 = require("./format-bytes");
21
24
  const get_cli_options_1 = require("./get-cli-options");
22
25
  const get_config_file_name_1 = require("./get-config-file-name");
23
26
  const handle_common_errors_1 = require("./handle-common-errors");
@@ -46,6 +49,7 @@ const cli = async () => {
46
49
  if (command !== versions_1.VERSIONS_COMMAND) {
47
50
  await (0, versions_1.validateVersionsBeforeCommand)();
48
51
  }
52
+ const errorSymbolicationLock = renderer_1.RenderInternals.registerErrorSymbolicationLock();
49
53
  try {
50
54
  if (command === 'compositions') {
51
55
  await (0, compositions_1.listCompositionsCommand)();
@@ -83,6 +87,9 @@ const cli = async () => {
83
87
  await (0, handle_common_errors_1.handleCommonError)(err);
84
88
  process.exit(1);
85
89
  }
90
+ finally {
91
+ renderer_1.RenderInternals.unlockErrorSymbolicationLock(errorSymbolicationLock);
92
+ }
86
93
  };
87
94
  exports.cli = cli;
88
95
  __exportStar(require("./render"), exports);
@@ -100,4 +107,6 @@ exports.CliInternals = {
100
107
  quietFlagProvided: parse_command_line_1.quietFlagProvided,
101
108
  parsedCli: parse_command_line_1.parsedCli,
102
109
  handleCommonError: handle_common_errors_1.handleCommonError,
110
+ formatBytes: format_bytes_1.formatBytes,
111
+ getFileSizeDownloadBar: download_progress_1.getFileSizeDownloadBar,
103
112
  };
@@ -30,7 +30,9 @@ export declare const makeStitchingProgress: ({ frames, totalFrames, steps, doneI
30
30
  export declare type DownloadProgress = {
31
31
  name: string;
32
32
  id: number;
33
- progress: number;
33
+ progress: number | null;
34
+ totalBytes: number | null;
35
+ downloaded: number;
34
36
  };
35
37
  export declare const makeRenderingAndStitchingProgress: ({ rendering, stitching, downloads, }: {
36
38
  rendering: RenderingProgressInput;
package/dist/render.js CHANGED
@@ -59,11 +59,15 @@ const render = async () => {
59
59
  id,
60
60
  name: src,
61
61
  progress: 0,
62
+ downloaded: 0,
63
+ totalBytes: null,
62
64
  };
63
65
  downloads.push(download);
64
66
  updateRenderProgress();
65
- return ({ percent }) => {
67
+ return ({ percent, downloaded, totalSize }) => {
66
68
  download.progress = percent;
69
+ download.totalBytes = totalSize;
70
+ download.downloaded = downloaded;
67
71
  updateRenderProgress();
68
72
  };
69
73
  };
package/dist/still.js CHANGED
@@ -105,6 +105,8 @@ const still = async () => {
105
105
  id,
106
106
  name: src,
107
107
  progress: 0,
108
+ downloaded: 0,
109
+ totalBytes: null,
108
110
  };
109
111
  downloads.push(download);
110
112
  updateProgress();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.0.25",
3
+ "version": "3.0.26",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -23,15 +23,15 @@
23
23
  "author": "Jonny Burger <jonny@remotion.dev>",
24
24
  "license": "SEE LICENSE IN LICENSE.md",
25
25
  "dependencies": {
26
- "@remotion/bundler": "3.0.25",
27
- "@remotion/media-utils": "3.0.25",
28
- "@remotion/player": "3.0.25",
29
- "@remotion/renderer": "3.0.25",
26
+ "@remotion/bundler": "3.0.26",
27
+ "@remotion/media-utils": "3.0.26",
28
+ "@remotion/player": "3.0.26",
29
+ "@remotion/renderer": "3.0.26",
30
30
  "better-opn": "2.1.1",
31
31
  "dotenv": "9.0.2",
32
32
  "memfs": "3.4.3",
33
33
  "minimist": "1.2.6",
34
- "remotion": "3.0.25",
34
+ "remotion": "3.0.26",
35
35
  "semver": "7.3.5",
36
36
  "source-map": "0.6.1"
37
37
  },
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "27ec369ebe9cf3d063095383c1e30dc83c60f010"
76
+ "gitHead": "790e9bb2d66f2fe97efc209237cc57d7cad2e793"
77
77
  }