@remotion/studio-server 4.0.433 → 4.0.435

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.
@@ -0,0 +1,12 @@
1
+ import type { CanUpdateDefaultPropsResponse } from '@remotion/studio-shared';
2
+ export declare const subscribeToDefaultPropsWatchers: ({ compositionId, clientId, remotionRoot, entryPoint, }: {
3
+ compositionId: string;
4
+ clientId: string;
5
+ remotionRoot: string;
6
+ entryPoint: string;
7
+ }) => Promise<CanUpdateDefaultPropsResponse>;
8
+ export declare const unsubscribeFromDefaultPropsWatchers: ({ compositionId, clientId, }: {
9
+ compositionId: string;
10
+ clientId: string;
11
+ }) => void;
12
+ export declare const unsubscribeClientDefaultPropsWatchers: (clientId: string) => void;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unsubscribeClientDefaultPropsWatchers = exports.unsubscribeFromDefaultPropsWatchers = exports.subscribeToDefaultPropsWatchers = void 0;
4
+ const file_watcher_1 = require("../file-watcher");
5
+ const live_events_1 = require("./live-events");
6
+ const can_update_default_props_1 = require("./routes/can-update-default-props");
7
+ // Global file watcher — at most one for the root file
8
+ let globalWatcher = null;
9
+ // Per-compositionId set of subscribed clientIds
10
+ const subscriptions = {};
11
+ // Cached config for recomputation on file change
12
+ let watcherConfig = null;
13
+ const ensureGlobalWatcher = (rootFile) => {
14
+ if (globalWatcher) {
15
+ globalWatcher.refCount++;
16
+ return;
17
+ }
18
+ const { unwatch } = (0, file_watcher_1.installFileWatcher)({
19
+ file: rootFile,
20
+ onChange: (type) => {
21
+ if (type === 'deleted') {
22
+ return;
23
+ }
24
+ if (!watcherConfig) {
25
+ return;
26
+ }
27
+ const compositionIds = Object.keys(subscriptions);
28
+ for (const compositionId of compositionIds) {
29
+ if (subscriptions[compositionId].size === 0) {
30
+ continue;
31
+ }
32
+ const clientIds = [...subscriptions[compositionId]];
33
+ (0, can_update_default_props_1.computeCanUpdateDefaultProps)({
34
+ compositionId,
35
+ remotionRoot: watcherConfig.remotionRoot,
36
+ entryPoint: watcherConfig.entryPoint,
37
+ }).then(({ result: newResult }) => {
38
+ (0, live_events_1.waitForLiveEventsListener)().then((listener) => {
39
+ const event = {
40
+ type: 'default-props-updatable-changed',
41
+ compositionId,
42
+ result: newResult,
43
+ };
44
+ for (const cId of clientIds) {
45
+ listener.sendEventToClientId(cId, event);
46
+ }
47
+ });
48
+ });
49
+ }
50
+ },
51
+ });
52
+ globalWatcher = { unwatch, rootFile, refCount: 1 };
53
+ };
54
+ const releaseGlobalWatcher = () => {
55
+ if (!globalWatcher) {
56
+ return;
57
+ }
58
+ globalWatcher.refCount--;
59
+ if (globalWatcher.refCount <= 0) {
60
+ globalWatcher.unwatch();
61
+ globalWatcher = null;
62
+ watcherConfig = null;
63
+ }
64
+ };
65
+ const subscribeToDefaultPropsWatchers = async ({ compositionId, clientId, remotionRoot, entryPoint, }) => {
66
+ var _a;
67
+ const { result, rootFile } = await (0, can_update_default_props_1.computeCanUpdateDefaultProps)({
68
+ compositionId,
69
+ remotionRoot,
70
+ entryPoint,
71
+ });
72
+ // Remove from any previous subscription for this client+composition
73
+ if ((_a = subscriptions[compositionId]) === null || _a === void 0 ? void 0 : _a.has(clientId)) {
74
+ subscriptions[compositionId].delete(clientId);
75
+ releaseGlobalWatcher();
76
+ }
77
+ if (rootFile) {
78
+ watcherConfig = { remotionRoot, entryPoint };
79
+ if (!subscriptions[compositionId]) {
80
+ subscriptions[compositionId] = new Set();
81
+ }
82
+ subscriptions[compositionId].add(clientId);
83
+ ensureGlobalWatcher(rootFile);
84
+ }
85
+ return result;
86
+ };
87
+ exports.subscribeToDefaultPropsWatchers = subscribeToDefaultPropsWatchers;
88
+ const unsubscribeFromDefaultPropsWatchers = ({ compositionId, clientId, }) => {
89
+ var _a;
90
+ if (!((_a = subscriptions[compositionId]) === null || _a === void 0 ? void 0 : _a.has(clientId))) {
91
+ return;
92
+ }
93
+ subscriptions[compositionId].delete(clientId);
94
+ if (subscriptions[compositionId].size === 0) {
95
+ delete subscriptions[compositionId];
96
+ }
97
+ releaseGlobalWatcher();
98
+ };
99
+ exports.unsubscribeFromDefaultPropsWatchers = unsubscribeFromDefaultPropsWatchers;
100
+ const unsubscribeClientDefaultPropsWatchers = (clientId) => {
101
+ for (const compositionId of Object.keys(subscriptions)) {
102
+ if (subscriptions[compositionId].has(clientId)) {
103
+ subscriptions[compositionId].delete(clientId);
104
+ if (subscriptions[compositionId].size === 0) {
105
+ delete subscriptions[compositionId];
106
+ }
107
+ releaseGlobalWatcher();
108
+ }
109
+ }
110
+ };
111
+ exports.unsubscribeClientDefaultPropsWatchers = unsubscribeClientDefaultPropsWatchers;
@@ -0,0 +1,3 @@
1
+ import type { SubscribeToDefaultPropsRequest, SubscribeToDefaultPropsResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const subscribeToDefaultProps: ApiHandler<SubscribeToDefaultPropsRequest, SubscribeToDefaultPropsResponse>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribeToDefaultProps = void 0;
4
+ const default_props_watchers_1 = require("../default-props-watchers");
5
+ const subscribeToDefaultProps = ({ input: { compositionId, clientId }, remotionRoot, entryPoint }) => {
6
+ return (0, default_props_watchers_1.subscribeToDefaultPropsWatchers)({
7
+ compositionId,
8
+ clientId,
9
+ remotionRoot,
10
+ entryPoint,
11
+ });
12
+ };
13
+ exports.subscribeToDefaultProps = subscribeToDefaultProps;
@@ -0,0 +1,3 @@
1
+ import type { UnsubscribeFromDefaultPropsRequest } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const unsubscribeFromDefaultProps: ApiHandler<UnsubscribeFromDefaultPropsRequest, undefined>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unsubscribeFromDefaultProps = void 0;
4
+ const default_props_watchers_1 = require("../default-props-watchers");
5
+ const unsubscribeFromDefaultProps = ({ input: { compositionId, clientId } }) => {
6
+ (0, default_props_watchers_1.unsubscribeFromDefaultPropsWatchers)({
7
+ compositionId,
8
+ clientId,
9
+ });
10
+ return Promise.resolve(undefined);
11
+ };
12
+ exports.unsubscribeFromDefaultProps = unsubscribeFromDefaultProps;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
4
4
  },
5
5
  "name": "@remotion/studio-server",
6
- "version": "4.0.433",
6
+ "version": "4.0.435",
7
7
  "description": "Run a Remotion Studio with a server backend",
8
8
  "main": "dist",
9
9
  "sideEffects": false,
@@ -27,11 +27,11 @@
27
27
  "@babel/parser": "7.24.1",
28
28
  "semver": "7.5.3",
29
29
  "prettier": "3.8.1",
30
- "remotion": "4.0.433",
30
+ "remotion": "4.0.435",
31
31
  "recast": "0.23.11",
32
- "@remotion/bundler": "4.0.433",
33
- "@remotion/renderer": "4.0.433",
34
- "@remotion/studio-shared": "4.0.433",
32
+ "@remotion/bundler": "4.0.435",
33
+ "@remotion/renderer": "4.0.435",
34
+ "@remotion/studio-shared": "4.0.435",
35
35
  "memfs": "3.4.3",
36
36
  "source-map": "0.7.3",
37
37
  "open": "^8.4.2"
@@ -41,7 +41,7 @@
41
41
  "react": "19.2.3",
42
42
  "@babel/types": "7.24.0",
43
43
  "@types/semver": "^7.3.4",
44
- "@remotion/eslint-config-internal": "4.0.433",
44
+ "@remotion/eslint-config-internal": "4.0.435",
45
45
  "eslint": "9.19.0",
46
46
  "@types/node": "20.12.14",
47
47
  "@typescript/native-preview": "7.0.0-dev.20260217.1"