@remotion/cloudrun 4.0.148 → 4.0.150

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,5 +1,5 @@
1
1
 
2
- > @remotion/cloudrun@4.0.147 build /Users/jonathanburger/remotion/packages/cloudrun
2
+ > @remotion/cloudrun@4.0.149 build /Users/jonathanburger/remotion/packages/cloudrun
3
3
  > bun build.ts
4
4
 
5
5
  $ ts-node src/admin/bundle-renderLogic.ts
@@ -0,0 +1,21 @@
1
+
2
+ > @remotion/cloudrun@4.0.149 test /Users/jonathanburger/remotion/packages/cloudrun
3
+ > vitest --run
4
+
5
+
6
+  RUN  v0.31.1 /Users/jonathanburger/remotion/packages/cloudrun
7
+
8
+ [?25l ✓ src/api/test/service-names.test.ts (1)
9
+ [?25l ✓ src/api/test/service-names.test.ts (1)
10
+ ✓ src/api/test/make-console.test.ts (2)
11
+ · src/api/test/running-in-what-server.test.ts (4)
12
+  ✓ src/api/test/service-names.test.ts (1)
13
+ ✓ src/api/test/make-console.test.ts (2)
14
+ ✓ src/api/test/running-in-what-server.test.ts (4)
15
+
16
+  Test Files  3 passed (3)
17
+  Tests  7 passed (7)
18
+  Start at  13:41:54
19
+  Duration  641ms (transform 201ms, setup 0ms, collect 399ms, tests 6ms, environment 0ms, prepare 52ms)
20
+
21
+ [?25h
package/build.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import {$} from 'bun';
2
2
 
3
- await $`bunx tsc -d`;
3
+ await $`bun x tsc -d`;
4
4
 
5
5
  const permissions = Bun.file('src/shared/sa-permissions.json');
6
6
  await Bun.write('dist/shared/sa-permissions.json', permissions);
@@ -1,7 +1,7 @@
1
1
  import type { GcpRegion } from '../pricing/gcp-regions';
2
2
  export type GetOrCreateBucketInput = {
3
3
  region: GcpRegion;
4
- updateBucketState?: (state: 'Checking for existing bucket' | 'Creating new bucket' | 'Created bucket' | 'Using existing bucket') => void;
4
+ updateBucketState?: (state: 'Checking bucket' | 'Creating bucket' | 'Created bucket' | 'Used bucket') => void;
5
5
  };
6
6
  export type GetOrCreateBucketOutput = {
7
7
  bucketName: string;
@@ -21,14 +21,14 @@ const getOrCreateBucket = async (params) => {
21
21
  .join(', ')}) in your Cloud Storage region (${params.region}) starting with "${constants_1.REMOTION_BUCKET_PREFIX}". This is an error, please delete buckets so that you have one maximum.`);
22
22
  }
23
23
  if (remotionBuckets.length === 1) {
24
- (_a = params === null || params === void 0 ? void 0 : params.updateBucketState) === null || _a === void 0 ? void 0 : _a.call(params, 'Using existing bucket');
24
+ (_a = params === null || params === void 0 ? void 0 : params.updateBucketState) === null || _a === void 0 ? void 0 : _a.call(params, 'Used bucket');
25
25
  return {
26
26
  bucketName: remotionBuckets[0].name,
27
27
  alreadyExisted: true,
28
28
  };
29
29
  }
30
30
  if (params === null || params === void 0 ? void 0 : params.region) {
31
- (_b = params.updateBucketState) === null || _b === void 0 ? void 0 : _b.call(params, 'Creating new bucket');
31
+ (_b = params.updateBucketState) === null || _b === void 0 ? void 0 : _b.call(params, 'Creating bucket');
32
32
  const bucketName = (0, validate_bucketname_1.makeBucketName)();
33
33
  await (0, create_bucket_1.createBucket)({
34
34
  bucketName,
@@ -58,7 +58,7 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
58
58
  },
59
59
  bucketProgress: {
60
60
  doneIn: null,
61
- creationState: 'Checking for existing bucket',
61
+ creationState: 'Checking bucket',
62
62
  },
63
63
  deployProgress: {
64
64
  doneIn: null,
@@ -67,12 +67,12 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
67
67
  stats: null,
68
68
  },
69
69
  };
70
- const updateProgress = () => {
70
+ const updateProgress = (newLine) => {
71
71
  progressBar.update([
72
72
  (0, progress_bar_1.makeBundleProgress)(multiProgress.bundleProgress),
73
73
  (0, progress_bar_1.makeBucketProgress)(multiProgress.bucketProgress),
74
74
  (0, progress_bar_1.makeDeployProgressBar)(multiProgress.deployProgress),
75
- ].join('\n'), false);
75
+ ].join('\n'), newLine);
76
76
  };
77
77
  const bucketStart = Date.now();
78
78
  const region = (0, get_gcp_region_1.getGcpRegion)();
@@ -80,11 +80,11 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
80
80
  region,
81
81
  updateBucketState: (state) => {
82
82
  multiProgress.bucketProgress.creationState = state;
83
- updateProgress();
83
+ updateProgress(false);
84
84
  },
85
85
  });
86
86
  multiProgress.bucketProgress.doneIn = Date.now() - bucketStart;
87
- updateProgress();
87
+ updateProgress(false);
88
88
  const bundleStart = Date.now();
89
89
  let uploadStart = Date.now();
90
90
  const { serveUrl, siteName, stats } = await (0, deploy_site_1.deploySite)({
@@ -108,14 +108,14 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
108
108
  doneIn: null,
109
109
  stats: null,
110
110
  };
111
- updateProgress();
111
+ updateProgress(false);
112
112
  },
113
113
  enableCaching: config_1.ConfigInternals.getWebpackCaching(),
114
114
  webpackOverride: (_b = config_1.ConfigInternals.getWebpackOverrideFn()) !== null && _b !== void 0 ? _b : ((f) => f),
115
115
  gitSource: null,
116
116
  },
117
117
  });
118
- updateProgress();
118
+ updateProgress(false);
119
119
  const uploadDuration = Date.now() - uploadStart;
120
120
  multiProgress.deployProgress = {
121
121
  sizeUploaded: 1,
@@ -127,11 +127,7 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
127
127
  untouchedFiles: stats.untouchedFiles,
128
128
  },
129
129
  };
130
- updateProgress();
131
- log_1.Log.info({ indent: false, logLevel });
132
- log_1.Log.info({ indent: false, logLevel });
133
- log_1.Log.info({ indent: false, logLevel }, 'Deployed to GCP Storage!');
134
- log_1.Log.info({ indent: false, logLevel });
130
+ updateProgress(true);
135
131
  log_1.Log.info({ indent: false, logLevel }, (0, _1.displaySiteInfo)({
136
132
  bucketName,
137
133
  id: siteName,
@@ -139,7 +135,7 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
139
135
  bucketRegion: region,
140
136
  }));
141
137
  log_1.Log.info({ indent: false, logLevel });
142
- log_1.Log.info({ indent: false, logLevel }, cli_1.CliInternals.chalk.blueBright('ℹ️ If you make changes to your code, you need to redeploy the site. You can overwrite the existing site by running:'));
138
+ log_1.Log.info({ indent: false, logLevel }, cli_1.CliInternals.chalk.blueBright('ℹ️ Redeploy your site everytime you make changes to it. You can overwrite the existing site by running:'));
143
139
  log_1.Log.info({ indent: false, logLevel }, cli_1.CliInternals.chalk.blueBright(['npx remotion cloudrun sites create', args[0], `--site-name=${siteName}`]
144
140
  .filter(remotion_1.Internals.truthy)
145
141
  .join(' ')));
@@ -11,12 +11,11 @@ const rm_1 = require("./rm");
11
11
  const rmall_1 = require("./rmall");
12
12
  exports.SITES_COMMAND = 'sites';
13
13
  const displaySiteInfo = (site) => {
14
- const LEFT_COL = 16;
15
14
  return [
16
- 'Site: '.padEnd(LEFT_COL, ' ') + ' ' + site.id,
17
- 'Bucket: '.padEnd(LEFT_COL, ' ') + ' ' + site.bucketName,
18
- 'Region: '.padEnd(LEFT_COL, ' ') + ' ' + site.bucketRegion,
19
- 'Serve Url: '.padEnd(LEFT_COL, ' ') + ' ' + site.serveUrl,
15
+ 'Site: '.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' ') + ' ' + site.id,
16
+ 'Bucket: '.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' ') + ' ' + site.bucketName,
17
+ 'Region: '.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' ') + ' ' + site.bucketRegion,
18
+ 'Serve Url: '.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' ') + ' ' + site.serveUrl,
20
19
  ].join('\n');
21
20
  };
22
21
  exports.displaySiteInfo = displaySiteInfo;
@@ -4,7 +4,7 @@ export type BundleProgress = {
4
4
  };
5
5
  export declare const makeBundleProgress: ({ progress, doneIn }: BundleProgress) => string;
6
6
  export type BucketCreationProgress = {
7
- creationState: 'Checking for existing bucket' | 'Creating new bucket' | 'Created bucket' | 'Using existing bucket';
7
+ creationState: 'Checking bucket' | 'Creating bucket' | 'Created bucket' | 'Used bucket';
8
8
  doneIn: number | null;
9
9
  };
10
10
  export declare const makeBucketProgress: ({ creationState, doneIn, }: BucketCreationProgress) => string;
@@ -5,9 +5,8 @@ const cli_1 = require("@remotion/cli");
5
5
  const remotion_1 = require("remotion");
6
6
  const makeBundleProgress = ({ progress, doneIn }) => {
7
7
  return [
8
- `(1/3)`,
8
+ `${doneIn === null ? 'Bundling' : 'Bundled'} video`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
9
9
  cli_1.CliInternals.makeProgressBar(progress / 100),
10
- `${doneIn === null ? 'Bundling' : 'Bundled'} video`,
11
10
  doneIn === null
12
11
  ? `${Math.round(progress)}%`
13
12
  : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
@@ -18,10 +17,10 @@ const makeBucketProgress = ({ creationState, doneIn, }) => {
18
17
  let progress = 0;
19
18
  let statesFinished = 0;
20
19
  switch (creationState) {
21
- case 'Checking for existing bucket':
20
+ case 'Checking bucket':
22
21
  progress = 1;
23
22
  break;
24
- case 'Creating new bucket':
23
+ case 'Creating bucket':
25
24
  progress = 2 / 3;
26
25
  statesFinished = 2;
27
26
  break;
@@ -29,7 +28,7 @@ const makeBucketProgress = ({ creationState, doneIn, }) => {
29
28
  progress = 3 / 3;
30
29
  statesFinished = 3;
31
30
  break;
32
- case 'Using existing bucket':
31
+ case 'Used bucket':
33
32
  progress = 3 / 3;
34
33
  statesFinished = 3;
35
34
  break;
@@ -38,9 +37,8 @@ const makeBucketProgress = ({ creationState, doneIn, }) => {
38
37
  break;
39
38
  }
40
39
  return [
41
- `(2/3)`,
40
+ creationState.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
42
41
  cli_1.CliInternals.makeProgressBar(progress),
43
- creationState,
44
42
  doneIn === null
45
43
  ? `${statesFinished} / ${3}`
46
44
  : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
@@ -65,9 +63,8 @@ const makeUploadDiff = ({ stats }) => {
65
63
  const makeDeployProgressBar = ({ sizeUploaded, totalSize, doneIn, stats, }) => {
66
64
  const progress = totalSize === null ? 0 : sizeUploaded / totalSize;
67
65
  return [
68
- `(3/3)`,
66
+ `${doneIn === null ? 'Uploading' : 'Uploaded'}`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
69
67
  cli_1.CliInternals.makeProgressBar(progress),
70
- `${doneIn === null ? 'Uploading' : 'Uploaded'} to GCP Storage Bucket`,
71
68
  doneIn === null
72
69
  ? typeof totalSize === 'number'
73
70
  ? `${cli_1.CliInternals.formatBytes(sizeUploaded)}/${cli_1.CliInternals.formatBytes(totalSize)}`
@@ -9,7 +9,7 @@ const getCompositionFromBody = async (body) => {
9
9
  browserExecutable: null,
10
10
  chromiumOptions: {
11
11
  ...((_a = body.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
12
- enableMultiProcessOnLinux: false,
12
+ enableMultiProcessOnLinux: true,
13
13
  },
14
14
  envVariables: (_b = body.envVariables) !== null && _b !== void 0 ? _b : {},
15
15
  id: body.composition,
@@ -93,7 +93,6 @@ const renderMediaSingleThread = async (body, res) => {
93
93
  offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,
94
94
  colorSpace: body.colorSpace,
95
95
  repro: false,
96
- finishRenderProgress: () => undefined,
97
96
  binariesDirectory: null,
98
97
  separateAudioTo: null,
99
98
  forSeamlessAacConcatenation: false,
@@ -0,0 +1 @@
1
+ export declare function base64ToHex(str: string): string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.base64ToHex = void 0;
4
+ function base64ToHex(str) {
5
+ // Decode the base64 string to a buffer containing the binary data
6
+ const raw = Buffer.from(str, 'base64');
7
+ // Convert the buffer to a hexadecimal string
8
+ let hex = '';
9
+ for (const byte of raw) {
10
+ hex += byte.toString(16).padStart(2, '0'); // Ensure two digits per byte
11
+ }
12
+ return hex;
13
+ }
14
+ exports.base64ToHex = base64ToHex;
@@ -6,19 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getEtagOfFile = void 0;
7
7
  const crypto_1 = __importDefault(require("crypto"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
- const chunk = 1024 * 1024 * 5; // 5MB
10
9
  const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
11
10
  const getEtagOfFile = async (filePath) => {
12
11
  const stream = await fs_1.default.promises.readFile(filePath);
13
- if (stream.length <= chunk) {
14
- return `"${md5(stream)}"`;
15
- }
16
- const md5Chunks = [];
17
- const chunksNumber = Math.ceil(stream.length / chunk);
18
- for (let i = 0; i < chunksNumber; i++) {
19
- const chunkStream = stream.slice(i * chunk, (i + 1) * chunk);
20
- md5Chunks.push(md5(chunkStream));
21
- }
22
- return `"${md5(Buffer.from(md5Chunks.join(''), 'hex'))}-${chunksNumber}"`;
12
+ return md5(stream);
23
13
  };
24
14
  exports.getEtagOfFile = getEtagOfFile;
@@ -1,30 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStorageDiffOperations = void 0;
4
+ const base64_to_hash_1 = require("./base64-to-hash");
4
5
  const read_dir_1 = require("./read-dir");
6
+ const stripPrefix = (file, prefix) => {
7
+ return file.substring(prefix.length + 1);
8
+ };
5
9
  const getStorageDiffOperations = async ({ objects, bundle, prefix, }) => {
6
10
  const dir = await (0, read_dir_1.readDirectory)({
7
11
  dir: bundle,
8
12
  etags: {},
9
13
  originalDir: bundle,
10
14
  });
11
- const filesOnStorageButNotLocal = objects.filter((fileOnStorage) => {
12
- var _a;
13
- const key = (_a = fileOnStorage.name) === null || _a === void 0 ? void 0 : _a.substring(prefix.length);
15
+ const hashMap = {};
16
+ for (const object of objects) {
17
+ hashMap[object.name] = (0, base64_to_hash_1.base64ToHex)(object.metadata.md5Hash);
18
+ }
19
+ const filesOnStorageButNotLocal = objects.filter((o) => {
20
+ const key = stripPrefix(o.name, prefix);
14
21
  return !dir[key];
15
22
  });
16
23
  const localFilesNotOnStorage = Object.keys(dir).filter((d) => {
17
24
  return !objects.find((o) => {
18
- var _a;
19
- const key = (_a = o.name) === null || _a === void 0 ? void 0 : _a.substring(prefix.length);
20
- return key === d && o.metadata.etag === dir[d];
25
+ const key = stripPrefix(o.name, prefix);
26
+ return key === d && hashMap[o.name] === dir[d];
21
27
  });
22
28
  });
23
29
  const existing = Object.keys(dir).filter((d) => {
24
30
  return objects.find((o) => {
25
- var _a;
26
- const key = (_a = o.name) === null || _a === void 0 ? void 0 : _a.substring(prefix.length);
27
- return key === d && o.metadata.etag === dir[d];
31
+ const key = stripPrefix(o.name, prefix);
32
+ return key === d && hashMap[o.name] === dir[d];
28
33
  });
29
34
  });
30
35
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cloudrun",
3
- "version": "4.0.148",
3
+ "version": "4.0.150",
4
4
  "description": "GCP Cloud Run alternative to lambda rendering",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
@@ -12,10 +12,10 @@
12
12
  "@google-cloud/logging": "^10.5.0",
13
13
  "google-auth-library": "^8.7.0",
14
14
  "zod": "3.22.3",
15
- "@remotion/bundler": "4.0.148",
16
- "@remotion/cli": "4.0.148",
17
- "@remotion/renderer": "4.0.148",
18
- "remotion": "4.0.148"
15
+ "@remotion/bundler": "4.0.150",
16
+ "@remotion/renderer": "4.0.150",
17
+ "remotion": "4.0.150",
18
+ "@remotion/cli": "4.0.150"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@jonny/eslint-config": "3.0.281",
@@ -26,7 +26,7 @@
26
26
  "prettier-plugin-organize-imports": "^3.2.4",
27
27
  "ts-node": "10.9.2",
28
28
  "vitest": "0.31.1",
29
- "@remotion/compositor-linux-x64-gnu": "4.0.148"
29
+ "@remotion/compositor-linux-x64-gnu": "4.0.150"
30
30
  },
31
31
  "exports": {
32
32
  "./package.json": "./package.json",
@@ -53,7 +53,6 @@
53
53
  "build": "bun build.ts",
54
54
  "buildContainer": "ts-node src/admin/bundle-renderLogic.ts",
55
55
  "tarInstaller": "ts-node src/admin/bundle-installer.ts",
56
- "watch": "tsc -w",
57
56
  "lint": "eslint src --ext ts,tsx",
58
57
  "test": "vitest --run"
59
58
  }