@remotion/studio 4.0.87 → 4.0.89

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 (62) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/Studio.d.ts +6 -0
  3. package/dist/Studio.js +19 -0
  4. package/dist/components/AssetSelector.js +4 -3
  5. package/dist/components/Button.d.ts +11 -0
  6. package/dist/components/Button.js +35 -0
  7. package/dist/components/CurrentCompositionSideEffects.js +1 -1
  8. package/dist/components/Editor.d.ts +3 -1
  9. package/dist/components/Editor.js +2 -22
  10. package/dist/components/MenuBuildIndicator.js +1 -1
  11. package/dist/components/Modals.js +3 -2
  12. package/dist/components/NewComposition/RemInput.d.ts +2 -2
  13. package/dist/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  14. package/dist/components/NewComposition/RemTextarea.d.ts +1 -1
  15. package/dist/components/NoRegisterRoot.js +2 -3
  16. package/dist/components/Notifications/ServerDisconnected.js +1 -1
  17. package/dist/components/RenderButton.js +4 -3
  18. package/dist/components/RenderModal/DataEditor.js +4 -4
  19. package/dist/components/RenderModal/RenderModal.d.ts +1 -0
  20. package/dist/components/RenderModal/RenderModal.js +7 -2
  21. package/dist/components/RenderModal/RenderModalAdvanced.d.ts +3 -1
  22. package/dist/components/RenderModal/RenderModalAdvanced.js +5 -2
  23. package/dist/components/RenderPreview.js +2 -1
  24. package/dist/components/RenderQueue/actions.d.ts +4 -2
  25. package/dist/components/RenderQueue/actions.js +4 -2
  26. package/dist/components/RenderQueue/index.js +2 -1
  27. package/dist/components/SidebarRenderButton.js +3 -1
  28. package/dist/components/StaticFilePreview.js +2 -1
  29. package/dist/components/Studio.d.ts +4 -0
  30. package/dist/components/Studio.js +16 -0
  31. package/dist/components/render-defaults.d.ts +40 -0
  32. package/dist/components/render-defaults.js +2 -0
  33. package/dist/error-overlay/react-overlay/utils/make-stack-frame.d.ts +7 -0
  34. package/dist/error-overlay/react-overlay/utils/make-stack-frame.js +25 -0
  35. package/dist/helpers/checkerboard-background.d.ts +1 -1
  36. package/dist/helpers/client-id.d.ts +6 -4
  37. package/dist/helpers/client-id.js +92 -9
  38. package/dist/helpers/colors.d.ts +1 -1
  39. package/dist/helpers/presets-labels.d.ts +1 -1
  40. package/dist/helpers/retry-payload.d.ts +3 -0
  41. package/dist/helpers/retry-payload.js +142 -0
  42. package/dist/helpers/use-file-existence.js +5 -6
  43. package/dist/helpers/use-menu-structure.js +1 -1
  44. package/dist/hot-middleware-client/client.d.ts +27 -0
  45. package/dist/hot-middleware-client/client.js +172 -0
  46. package/dist/hot-middleware-client/process-update.d.ts +12 -0
  47. package/dist/hot-middleware-client/process-update.js +157 -0
  48. package/dist/index.d.ts +3 -3
  49. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  50. package/dist/preview-server/job.d.ts +3 -0
  51. package/dist/preview-server/retry-payload.js +3 -0
  52. package/dist/preview-server/routes/add-render.js +3 -0
  53. package/dist/previewEntry.js +22 -15
  54. package/dist/routes.d.ts +0 -1
  55. package/dist/state/modals.d.ts +1 -0
  56. package/package.json +7 -7
  57. package/tsconfig.tsbuildinfo +1 -1
  58. package/.turbo/turbo-lint.log +0 -10
  59. package/dist/components/BufferingIndicator.d.ts +0 -2
  60. package/dist/components/BufferingIndicator.js +0 -23
  61. package/dist/helpers/event-source.d.ts +0 -3
  62. package/dist/helpers/event-source.js +0 -76
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ /* eslint-disable no-console */
3
+ /**
4
+ * Source code is adapted from
5
+ * https://github.com/webpack-contrib/webpack-hot-middleware#readme
6
+ * and rewritten in TypeScript. This file is MIT licensed
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.processUpdate = void 0;
10
+ const NotificationCenter_1 = require("../components/Notifications/NotificationCenter");
11
+ if (!__webpack_module__.hot) {
12
+ throw new Error('[Fast refresh] Hot Module Replacement is disabled.');
13
+ }
14
+ const hmrDocsUrl = 'https://webpack.js.org/concepts/hot-module-replacement/'; // eslint-disable-line max-len
15
+ let lastHash;
16
+ const failureStatuses = { abort: 1, fail: 1 };
17
+ const applyOptions = {
18
+ ignoreUnaccepted: true,
19
+ ignoreDeclined: true,
20
+ ignoreErrored: true,
21
+ onUnaccepted(data) {
22
+ var _a;
23
+ console.warn('Ignored an update to unaccepted module ' +
24
+ ((_a = data.chain) !== null && _a !== void 0 ? _a : []).join(' -> '));
25
+ },
26
+ onDeclined(data) {
27
+ var _a;
28
+ console.warn('Ignored an update to declined module ' + ((_a = data.chain) !== null && _a !== void 0 ? _a : []).join(' -> '));
29
+ },
30
+ onErrored(data) {
31
+ console.error(data.error);
32
+ console.warn('Ignored an error while updating module ' +
33
+ data.moduleId +
34
+ ' (' +
35
+ data.type +
36
+ ')');
37
+ },
38
+ };
39
+ function upToDate(hash) {
40
+ if (hash)
41
+ lastHash = hash;
42
+ return lastHash === __webpack_hash__;
43
+ }
44
+ const processUpdate = function (hash, moduleMap, options) {
45
+ var _a;
46
+ const { reload } = options;
47
+ if (!upToDate(hash) && ((_a = __webpack_module__.hot) === null || _a === void 0 ? void 0 : _a.status()) === 'idle') {
48
+ check();
49
+ }
50
+ async function check() {
51
+ var _a;
52
+ const cb = function (err, updatedModules) {
53
+ var _a;
54
+ if (err)
55
+ return handleError(err);
56
+ if (!updatedModules) {
57
+ if (options.warn) {
58
+ console.warn('[Fast refresh] Cannot find update (Full reload needed)');
59
+ console.warn('[Fast refresh] (Probably because of restarting the server)');
60
+ }
61
+ performReload();
62
+ return null;
63
+ }
64
+ const applyCallback = function (applyErr, renewedModules) {
65
+ if (applyErr)
66
+ return handleError(applyErr);
67
+ if (!upToDate()) {
68
+ check();
69
+ }
70
+ logUpdates(updatedModules, renewedModules);
71
+ };
72
+ const applyResult = (_a = __webpack_module__.hot) === null || _a === void 0 ? void 0 : _a.apply(applyOptions);
73
+ if (applyResult === null || applyResult === void 0 ? void 0 : applyResult.then) {
74
+ // HotModuleReplacement.runtime.js refers to the result as `outdatedModules`
75
+ applyResult
76
+ .then((outdatedModules) => {
77
+ applyCallback(null, outdatedModules);
78
+ })
79
+ .catch((_err) => applyCallback(_err, []));
80
+ }
81
+ };
82
+ try {
83
+ const result = await ((_a = __webpack_module__.hot) === null || _a === void 0 ? void 0 : _a.check(false));
84
+ cb(null, result);
85
+ }
86
+ catch (err) {
87
+ cb(err, []);
88
+ }
89
+ }
90
+ function logUpdates(updatedModules, renewedModules) {
91
+ var _a;
92
+ const unacceptedModules = (_a = updatedModules === null || updatedModules === void 0 ? void 0 : updatedModules.filter((moduleId) => {
93
+ return renewedModules && renewedModules.indexOf(moduleId) < 0;
94
+ })) !== null && _a !== void 0 ? _a : [];
95
+ if (unacceptedModules.length > 0) {
96
+ if (options.warn) {
97
+ console.warn("[Fast refresh] The following modules couldn't be hot updated: " +
98
+ '(Full reload needed)\n' +
99
+ 'This is usually because the modules which have changed ' +
100
+ '(and their parents) do not know how to hot reload themselves. ' +
101
+ 'See ' +
102
+ hmrDocsUrl +
103
+ ' for more details.');
104
+ unacceptedModules.forEach((moduleId) => {
105
+ console.warn('[Fast refresh] - ' + (moduleMap[moduleId] || moduleId));
106
+ });
107
+ }
108
+ performReload();
109
+ return;
110
+ }
111
+ if (!renewedModules || renewedModules.length === 0) {
112
+ console.log('[Fast refresh] Nothing hot updated.');
113
+ }
114
+ else {
115
+ renewedModules.forEach((moduleId) => {
116
+ console.log(`[Fast refresh] ${moduleMap[moduleId] || moduleId} fast refreshed.`);
117
+ });
118
+ }
119
+ }
120
+ function handleError(err) {
121
+ var _a, _b;
122
+ if (((_b = (_a = __webpack_module__.hot) === null || _a === void 0 ? void 0 : _a.status()) !== null && _b !== void 0 ? _b : 'nope') in failureStatuses) {
123
+ if (options.warn) {
124
+ console.warn('[Fast refresh] Cannot check for update (Full reload needed)');
125
+ console.warn('[Fast refresh] ' + (err.stack || err.message));
126
+ }
127
+ performReload();
128
+ return;
129
+ }
130
+ if (options.warn) {
131
+ console.warn('[Fast refresh] Update check failed: ' + (err.stack || err.message));
132
+ if (!window.remotion_unsavedProps) {
133
+ window.location.reload();
134
+ }
135
+ }
136
+ }
137
+ function performReload() {
138
+ var _a;
139
+ if (!reload) {
140
+ return;
141
+ }
142
+ if (options.warn)
143
+ console.warn('[Fast refresh] Reloading page');
144
+ if (window.remotion_unsavedProps) {
145
+ (_a = NotificationCenter_1.notificationCenter.current) === null || _a === void 0 ? void 0 : _a.addNotification({
146
+ id: 'random',
147
+ content: 'Fast refresh needs to reload the page, but you have unsaved props. Save then reload the page to apply changes.',
148
+ created: new Date().getMilliseconds(),
149
+ duration: 1,
150
+ });
151
+ }
152
+ else {
153
+ window.location.reload();
154
+ }
155
+ }
156
+ };
157
+ exports.processUpdate = processUpdate;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const StudioInternals: {
7
7
  startStudio: ({ browserArgs, browserFlag, configValueShouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, userPassedPublicDir, webpackOverride, poll, getRenderDefaults, getRenderQueue, numberOfAudioTags, queueMethods, parsedCliOpen, }: {
8
8
  browserArgs: string;
9
9
  browserFlag: string;
10
- logLevel: "error" | "verbose" | "info" | "warn";
10
+ logLevel: "verbose" | "info" | "warn" | "error";
11
11
  configValueShouldOpenBrowser: boolean;
12
12
  fullEntryPath: string;
13
13
  getCurrentInputProps: () => object;
@@ -33,12 +33,12 @@ export declare const StudioInternals: {
33
33
  installCommand: string;
34
34
  startCommand: string;
35
35
  }[];
36
- getPackageManager: (remotionRoot: string, packageManager: string | undefined) => "unknown" | {
36
+ getPackageManager: (remotionRoot: string, packageManager: string | undefined) => {
37
37
  manager: import("./preview-server/get-package-manager").PackageManager;
38
38
  path: string;
39
39
  installCommand: string;
40
40
  startCommand: string;
41
- };
41
+ } | "unknown";
42
42
  getMaxTimelineTracks: () => number;
43
43
  setMaxTimelineTracks: (maxTracks: number) => void;
44
44
  formatBytes: (number: number, options?: Intl.NumberFormatOptions & {
@@ -11,5 +11,5 @@ type Range = {
11
11
  type Ranges = Range[] & {
12
12
  type?: string;
13
13
  };
14
- export declare function parseRange(size: number, str: string | string[]): -1 | -2 | Ranges;
14
+ export declare function parseRange(size: number, str: string | string[]): -1 | Ranges | -2;
15
15
  export {};
@@ -115,6 +115,7 @@ export type RenderJob = {
115
115
  serializedInputPropsWithCustomSchema: string;
116
116
  multiProcessOnLinux: boolean;
117
117
  beepOnFinish: boolean;
118
+ repro: boolean;
118
119
  } & RenderJobDynamicFields;
119
120
  export type RenderJobWithCleanup = RenderJob & {
120
121
  cleanup: (() => void)[];
@@ -136,6 +137,7 @@ type AddRenderRequestDynamicFields = {
136
137
  startFrame: number;
137
138
  endFrame: number;
138
139
  disallowParallelEncoding: boolean;
140
+ repro: boolean;
139
141
  } | {
140
142
  type: 'video';
141
143
  codec: Codec;
@@ -161,6 +163,7 @@ type AddRenderRequestDynamicFields = {
161
163
  numberOfGifLoops: number | null;
162
164
  disallowParallelEncoding: boolean;
163
165
  colorSpace: ColorSpace;
166
+ repro: boolean;
164
167
  };
165
168
  export type CancelRenderRequest = {
166
169
  jobId: string;
@@ -48,6 +48,7 @@ const makeRetryPayload = (job) => {
48
48
  initialEncodingMaxRate: defaults.encodingMaxRate,
49
49
  initialUserAgent: job.chromiumOptions.userAgent,
50
50
  initialBeep: job.beepOnFinish,
51
+ initialRepro: job.repro,
51
52
  };
52
53
  }
53
54
  if (job.type === 'sequence') {
@@ -90,6 +91,7 @@ const makeRetryPayload = (job) => {
90
91
  initialEncodingMaxRate: defaults.encodingMaxRate,
91
92
  initialUserAgent: job.chromiumOptions.userAgent,
92
93
  initialBeep: job.beepOnFinish,
94
+ initialRepro: job.repro,
93
95
  };
94
96
  }
95
97
  if (job.type === 'video') {
@@ -132,6 +134,7 @@ const makeRetryPayload = (job) => {
132
134
  initialEncodingMaxRate: job.encodingMaxRate,
133
135
  initialUserAgent: job.chromiumOptions.userAgent,
134
136
  initialBeep: job.beepOnFinish,
137
+ initialRepro: job.repro,
135
138
  };
136
139
  }
137
140
  throw new Error(`Job ${JSON.stringify(job)} Not implemented`);
@@ -48,6 +48,7 @@ const handleAddRender = ({ input, entryPoint, remotionRoot, logLevel, methods: {
48
48
  colorSpace: input.colorSpace,
49
49
  multiProcessOnLinux: input.multiProcessOnLinux,
50
50
  beepOnFinish: input.beepOnFinish,
51
+ repro: input.repro,
51
52
  },
52
53
  logLevel,
53
54
  });
@@ -80,6 +81,7 @@ const handleAddRender = ({ input, entryPoint, remotionRoot, logLevel, methods: {
80
81
  offthreadVideoCacheSizeInBytes: input.offthreadVideoCacheSizeInBytes,
81
82
  multiProcessOnLinux: input.multiProcessOnLinux,
82
83
  beepOnFinish: input.beepOnFinish,
84
+ repro: input.repro,
83
85
  },
84
86
  logLevel,
85
87
  });
@@ -108,6 +110,7 @@ const handleAddRender = ({ input, entryPoint, remotionRoot, logLevel, methods: {
108
110
  offthreadVideoCacheSizeInBytes: input.offthreadVideoCacheSizeInBytes,
109
111
  multiProcessOnLinux: input.multiProcessOnLinux,
110
112
  beepOnFinish: input.beepOnFinish,
113
+ repro: false,
111
114
  },
112
115
  entryPoint,
113
116
  remotionRoot,
@@ -4,23 +4,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_dom_1 = require("react-dom");
8
7
  const client_1 = __importDefault(require("react-dom/client"));
9
8
  const remotion_1 = require("remotion");
10
9
  require("../styles/styles.css");
11
- const Editor_1 = require("./components/Editor");
12
- const EditorContexts_1 = require("./components/EditorContexts");
13
- const ServerDisconnected_1 = require("./components/Notifications/ServerDisconnected");
14
- const event_source_1 = require("./helpers/event-source");
10
+ const NoRegisterRoot_1 = require("./components/NoRegisterRoot");
11
+ const Studio_1 = require("./components/Studio");
15
12
  remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(null, '#1f2428'));
16
- const getServerDisconnectedDomElement = () => {
17
- return document.getElementById('server-disconnected-overlay');
13
+ let root = null;
14
+ const getRootForElement = () => {
15
+ if (root) {
16
+ return root;
17
+ }
18
+ root = client_1.default.createRoot(remotion_1.Internals.getPreviewDomElement());
19
+ return root;
18
20
  };
19
- const content = ((0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionRoot, { numberOfAudioTags: window.remotion_numberOfAudioTags, children: (0, jsx_runtime_1.jsxs)(EditorContexts_1.EditorContexts, { children: [(0, jsx_runtime_1.jsx)(Editor_1.Editor, {}), (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ServerDisconnected_1.ServerDisconnected, {}), getServerDisconnectedDomElement())] }) }));
20
- if (client_1.default.createRoot) {
21
- client_1.default.createRoot(remotion_1.Internals.getPreviewDomElement()).render(content);
22
- }
23
- else {
24
- client_1.default.render(content, remotion_1.Internals.getPreviewDomElement());
25
- }
26
- (0, event_source_1.openEventSource)();
21
+ const renderToDOM = (content) => {
22
+ // @ts-expect-error
23
+ if (client_1.default.createRoot) {
24
+ getRootForElement().render(content);
25
+ }
26
+ else {
27
+ client_1.default.render(content, remotion_1.Internals.getPreviewDomElement());
28
+ }
29
+ };
30
+ renderToDOM((0, jsx_runtime_1.jsx)(NoRegisterRoot_1.NoRegisterRoot, {}));
31
+ remotion_1.Internals.waitForRoot((NewRoot) => {
32
+ renderToDOM((0, jsx_runtime_1.jsx)(Studio_1.Studio, { rootComponent: NewRoot }));
33
+ });
package/dist/routes.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { RenderDefaults } from '@remotion/bundler/dist/index-html';
3
2
  import type { LogLevel } from '@remotion/renderer';
4
3
  import type { IncomingMessage, ServerResponse } from 'node:http';
@@ -35,6 +35,7 @@ export type RenderModalState = {
35
35
  initialEncodingMaxRate: string | null;
36
36
  initialEncodingBufferSize: string | null;
37
37
  initialBeep: boolean;
38
+ initialRepro: boolean;
38
39
  minConcurrency: number;
39
40
  maxConcurrency: number;
40
41
  defaultProps: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/studio",
3
- "version": "4.0.87",
3
+ "version": "4.0.89",
4
4
  "description": "Remotion Editor",
5
5
  "main": "dist",
6
6
  "sideEffects": false,
@@ -18,11 +18,11 @@
18
18
  "memfs": "3.4.3",
19
19
  "source-map": "0.7.3",
20
20
  "open": "^8.4.2",
21
- "remotion": "4.0.87",
22
- "@remotion/player": "4.0.87",
23
- "@remotion/media-utils": "4.0.87",
24
- "@remotion/renderer": "4.0.87",
25
- "@remotion/bundler": "4.0.87"
21
+ "remotion": "4.0.89",
22
+ "@remotion/bundler": "4.0.89",
23
+ "@remotion/media-utils": "4.0.89",
24
+ "@remotion/player": "4.0.89",
25
+ "@remotion/renderer": "4.0.89"
26
26
  },
27
27
  "devDependencies": {
28
28
  "react": "18.2.0",
@@ -40,7 +40,7 @@
40
40
  "prettier-plugin-organize-imports": "3.2.4",
41
41
  "vitest": "0.31.1",
42
42
  "zod": "^3.22.3",
43
- "@remotion/zod-types": "4.0.87"
43
+ "@remotion/zod-types": "4.0.89"
44
44
  },
45
45
  "scripts": {
46
46
  "lint": "eslint src --ext ts,tsx",