@remotion/studio 4.0.88 → 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.
- package/.turbo/turbo-build.log +1 -1
- package/dist/Studio.d.ts +6 -0
- package/dist/Studio.js +19 -0
- package/dist/components/AssetSelector.js +4 -3
- package/dist/components/Button.d.ts +11 -0
- package/dist/components/Button.js +35 -0
- package/dist/components/CurrentCompositionSideEffects.js +1 -1
- package/dist/components/Editor.d.ts +3 -1
- package/dist/components/Editor.js +2 -22
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/Modals.js +2 -1
- package/dist/components/NewComposition/RemInput.d.ts +2 -2
- package/dist/components/NewComposition/RemInputTypeColor.d.ts +1 -1
- package/dist/components/NewComposition/RemTextarea.d.ts +1 -1
- package/dist/components/NoRegisterRoot.js +2 -3
- package/dist/components/Notifications/ServerDisconnected.js +1 -1
- package/dist/components/RenderButton.js +3 -3
- package/dist/components/RenderModal/DataEditor.js +4 -4
- package/dist/components/RenderPreview.js +2 -1
- package/dist/components/RenderQueue/index.js +2 -1
- package/dist/components/SidebarRenderButton.js +2 -1
- package/dist/components/StaticFilePreview.js +2 -1
- package/dist/components/Studio.d.ts +4 -0
- package/dist/components/Studio.js +16 -0
- package/dist/components/render-defaults.d.ts +40 -0
- package/dist/components/render-defaults.js +2 -0
- package/dist/error-overlay/react-overlay/utils/make-stack-frame.d.ts +7 -0
- package/dist/error-overlay/react-overlay/utils/make-stack-frame.js +25 -0
- package/dist/helpers/client-id.d.ts +6 -4
- package/dist/helpers/client-id.js +92 -9
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/presets-labels.d.ts +1 -1
- package/dist/helpers/retry-payload.d.ts +3 -0
- package/dist/helpers/retry-payload.js +142 -0
- package/dist/helpers/use-file-existence.js +5 -6
- package/dist/helpers/use-menu-structure.js +1 -1
- package/dist/hot-middleware-client/client.d.ts +27 -0
- package/dist/hot-middleware-client/client.js +172 -0
- package/dist/hot-middleware-client/process-update.d.ts +12 -0
- package/dist/hot-middleware-client/process-update.js +157 -0
- package/dist/index.d.ts +4 -4
- package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
- package/dist/previewEntry.js +22 -15
- package/dist/routes.d.ts +0 -1
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/.turbo/turbo-lint.log +0 -10
- package/dist/components/BufferingIndicator.d.ts +0 -2
- package/dist/components/BufferingIndicator.js +0 -23
- package/dist/helpers/event-source.d.ts +0 -3
- package/dist/helpers/event-source.js +0 -76
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRetryPayload = void 0;
|
|
4
|
+
const no_react_1 = require("remotion/no-react");
|
|
5
|
+
const makeRetryPayload = (job) => {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
const defaults = window.remotion_renderDefaults;
|
|
8
|
+
if (!defaults) {
|
|
9
|
+
throw new Error('defaults not set');
|
|
10
|
+
}
|
|
11
|
+
if (job.type === 'still') {
|
|
12
|
+
return {
|
|
13
|
+
type: 'render',
|
|
14
|
+
compositionId: job.compositionId,
|
|
15
|
+
initialFrame: job.frame,
|
|
16
|
+
initialStillImageFormat: job.imageFormat,
|
|
17
|
+
initialVideoImageFormat: defaults.videoImageFormat,
|
|
18
|
+
initialJpegQuality: (_a = job.jpegQuality) !== null && _a !== void 0 ? _a : defaults.jpegQuality,
|
|
19
|
+
initialScale: job.scale,
|
|
20
|
+
initialLogLevel: job.logLevel,
|
|
21
|
+
initialConcurrency: defaults.concurrency,
|
|
22
|
+
maxConcurrency: defaults.maxConcurrency,
|
|
23
|
+
minConcurrency: defaults.minConcurrency,
|
|
24
|
+
initialMuted: defaults.muted,
|
|
25
|
+
initialEnforceAudioTrack: defaults.enforceAudioTrack,
|
|
26
|
+
initialProResProfile: defaults.proResProfile,
|
|
27
|
+
initialx264Preset: defaults.x264Preset,
|
|
28
|
+
initialPixelFormat: defaults.pixelFormat,
|
|
29
|
+
initialAudioBitrate: defaults.audioBitrate,
|
|
30
|
+
initialVideoBitrate: defaults.videoBitrate,
|
|
31
|
+
initialEveryNthFrame: defaults.everyNthFrame,
|
|
32
|
+
initialNumberOfGifLoops: defaults.numberOfGifLoops,
|
|
33
|
+
initialDelayRenderTimeout: job.delayRenderTimeout,
|
|
34
|
+
defaultConfigurationAudioCodec: defaults.audioCodec,
|
|
35
|
+
initialEnvVariables: job.envVariables,
|
|
36
|
+
initialDisableWebSecurity: job.chromiumOptions.disableWebSecurity,
|
|
37
|
+
initialOpenGlRenderer: job.chromiumOptions.gl,
|
|
38
|
+
initialHeadless: job.chromiumOptions.headless,
|
|
39
|
+
initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
|
|
40
|
+
defaultProps: no_react_1.NoReactInternals.deserializeJSONWithCustomFields(job.serializedInputPropsWithCustomSchema),
|
|
41
|
+
inFrameMark: null,
|
|
42
|
+
outFrameMark: null,
|
|
43
|
+
initialOffthreadVideoCacheSizeInBytes: job.offthreadVideoCacheSizeInBytes,
|
|
44
|
+
initialColorSpace: defaults.colorSpace,
|
|
45
|
+
initialMultiProcessOnLinux: job.multiProcessOnLinux,
|
|
46
|
+
defaultConfigurationVideoCodec: defaults.codec,
|
|
47
|
+
initialEncodingBufferSize: defaults.encodingBufferSize,
|
|
48
|
+
initialEncodingMaxRate: defaults.encodingMaxRate,
|
|
49
|
+
initialUserAgent: job.chromiumOptions.userAgent,
|
|
50
|
+
initialBeep: job.beepOnFinish,
|
|
51
|
+
initialRepro: job.repro,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (job.type === 'sequence') {
|
|
55
|
+
return {
|
|
56
|
+
type: 'render',
|
|
57
|
+
initialFrame: 0,
|
|
58
|
+
compositionId: job.compositionId,
|
|
59
|
+
initialVideoImageFormat: defaults.videoImageFormat,
|
|
60
|
+
initialJpegQuality: (_b = job.jpegQuality) !== null && _b !== void 0 ? _b : defaults.jpegQuality,
|
|
61
|
+
initialScale: job.scale,
|
|
62
|
+
initialLogLevel: job.logLevel,
|
|
63
|
+
initialConcurrency: defaults.concurrency,
|
|
64
|
+
maxConcurrency: defaults.maxConcurrency,
|
|
65
|
+
minConcurrency: defaults.minConcurrency,
|
|
66
|
+
initialMuted: defaults.muted,
|
|
67
|
+
initialEnforceAudioTrack: defaults.enforceAudioTrack,
|
|
68
|
+
initialProResProfile: defaults.proResProfile,
|
|
69
|
+
initialx264Preset: defaults.x264Preset,
|
|
70
|
+
initialPixelFormat: defaults.pixelFormat,
|
|
71
|
+
initialAudioBitrate: defaults.audioBitrate,
|
|
72
|
+
initialVideoBitrate: defaults.videoBitrate,
|
|
73
|
+
initialEveryNthFrame: defaults.everyNthFrame,
|
|
74
|
+
initialNumberOfGifLoops: defaults.numberOfGifLoops,
|
|
75
|
+
initialDelayRenderTimeout: job.delayRenderTimeout,
|
|
76
|
+
initialEnvVariables: job.envVariables,
|
|
77
|
+
initialDisableWebSecurity: job.chromiumOptions.disableWebSecurity,
|
|
78
|
+
initialOpenGlRenderer: job.chromiumOptions.gl,
|
|
79
|
+
initialHeadless: job.chromiumOptions.headless,
|
|
80
|
+
initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
|
|
81
|
+
defaultProps: no_react_1.NoReactInternals.deserializeJSONWithCustomFields(job.serializedInputPropsWithCustomSchema),
|
|
82
|
+
initialStillImageFormat: defaults.stillImageFormat,
|
|
83
|
+
inFrameMark: job.startFrame,
|
|
84
|
+
outFrameMark: job.endFrame,
|
|
85
|
+
initialOffthreadVideoCacheSizeInBytes: job.offthreadVideoCacheSizeInBytes,
|
|
86
|
+
initialColorSpace: defaults.colorSpace,
|
|
87
|
+
initialMultiProcessOnLinux: job.multiProcessOnLinux,
|
|
88
|
+
defaultConfigurationVideoCodec: defaults.codec,
|
|
89
|
+
defaultConfigurationAudioCodec: defaults.audioCodec,
|
|
90
|
+
initialEncodingBufferSize: defaults.encodingBufferSize,
|
|
91
|
+
initialEncodingMaxRate: defaults.encodingMaxRate,
|
|
92
|
+
initialUserAgent: job.chromiumOptions.userAgent,
|
|
93
|
+
initialBeep: job.beepOnFinish,
|
|
94
|
+
initialRepro: job.repro,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (job.type === 'video') {
|
|
98
|
+
return {
|
|
99
|
+
type: 'render',
|
|
100
|
+
compositionId: job.compositionId,
|
|
101
|
+
initialStillImageFormat: defaults.stillImageFormat,
|
|
102
|
+
initialVideoImageFormat: job.imageFormat,
|
|
103
|
+
initialJpegQuality: (_c = job.jpegQuality) !== null && _c !== void 0 ? _c : defaults.jpegQuality,
|
|
104
|
+
initialScale: job.scale,
|
|
105
|
+
initialLogLevel: job.logLevel,
|
|
106
|
+
initialFrame: 0,
|
|
107
|
+
initialConcurrency: job.concurrency,
|
|
108
|
+
maxConcurrency: defaults.maxConcurrency,
|
|
109
|
+
minConcurrency: defaults.minConcurrency,
|
|
110
|
+
initialMuted: job.muted,
|
|
111
|
+
initialEnforceAudioTrack: job.enforceAudioTrack,
|
|
112
|
+
initialProResProfile: (_d = job.proResProfile) !== null && _d !== void 0 ? _d : defaults.proResProfile,
|
|
113
|
+
initialx264Preset: (_e = job.x264Preset) !== null && _e !== void 0 ? _e : defaults.x264Preset,
|
|
114
|
+
initialPixelFormat: job.pixelFormat,
|
|
115
|
+
initialAudioBitrate: job.audioBitrate,
|
|
116
|
+
initialVideoBitrate: job.videoBitrate,
|
|
117
|
+
initialEveryNthFrame: job.everyNthFrame,
|
|
118
|
+
initialNumberOfGifLoops: job.numberOfGifLoops,
|
|
119
|
+
initialDelayRenderTimeout: job.delayRenderTimeout,
|
|
120
|
+
initialEnvVariables: job.envVariables,
|
|
121
|
+
initialDisableWebSecurity: job.chromiumOptions.disableWebSecurity,
|
|
122
|
+
initialOpenGlRenderer: job.chromiumOptions.gl,
|
|
123
|
+
initialHeadless: job.chromiumOptions.headless,
|
|
124
|
+
initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
|
|
125
|
+
defaultProps: no_react_1.NoReactInternals.deserializeJSONWithCustomFields(job.serializedInputPropsWithCustomSchema),
|
|
126
|
+
inFrameMark: job.startFrame,
|
|
127
|
+
outFrameMark: job.endFrame,
|
|
128
|
+
initialOffthreadVideoCacheSizeInBytes: job.offthreadVideoCacheSizeInBytes,
|
|
129
|
+
initialColorSpace: job.colorSpace,
|
|
130
|
+
initialMultiProcessOnLinux: job.multiProcessOnLinux,
|
|
131
|
+
defaultConfigurationVideoCodec: job.codec,
|
|
132
|
+
defaultConfigurationAudioCodec: job.audioCodec,
|
|
133
|
+
initialEncodingBufferSize: job.encodingBufferSize,
|
|
134
|
+
initialEncodingMaxRate: job.encodingMaxRate,
|
|
135
|
+
initialUserAgent: job.chromiumOptions.userAgent,
|
|
136
|
+
initialBeep: job.beepOnFinish,
|
|
137
|
+
initialRepro: job.repro,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
throw new Error(`Job ${JSON.stringify(job)} Not implemented`);
|
|
141
|
+
};
|
|
142
|
+
exports.makeRetryPayload = makeRetryPayload;
|
|
@@ -4,10 +4,9 @@ exports.useFileExistence = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const actions_1 = require("../components/RenderQueue/actions");
|
|
6
6
|
const client_id_1 = require("./client-id");
|
|
7
|
-
const event_source_1 = require("./event-source");
|
|
8
7
|
const useFileExistence = (outName) => {
|
|
9
8
|
const [exists, setExists] = (0, react_1.useState)(false);
|
|
10
|
-
const state = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
9
|
+
const { previewServerState: state, subscribeToEvent } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
11
10
|
const clientId = state.type === 'connected' ? state.clientId : undefined;
|
|
12
11
|
const currentOutName = (0, react_1.useRef)('');
|
|
13
12
|
currentOutName.current = outName;
|
|
@@ -39,11 +38,11 @@ const useFileExistence = (outName) => {
|
|
|
39
38
|
setExists(false);
|
|
40
39
|
}
|
|
41
40
|
};
|
|
42
|
-
const unsub =
|
|
41
|
+
const unsub = subscribeToEvent('watched-file-deleted', listener);
|
|
43
42
|
return () => {
|
|
44
43
|
unsub();
|
|
45
44
|
};
|
|
46
|
-
}, [outName]);
|
|
45
|
+
}, [outName, subscribeToEvent]);
|
|
47
46
|
(0, react_1.useEffect)(() => {
|
|
48
47
|
const listener = (event) => {
|
|
49
48
|
if (event.type !== 'watched-file-undeleted') {
|
|
@@ -56,11 +55,11 @@ const useFileExistence = (outName) => {
|
|
|
56
55
|
setExists(true);
|
|
57
56
|
}
|
|
58
57
|
};
|
|
59
|
-
const unsub =
|
|
58
|
+
const unsub = subscribeToEvent('watched-file-undeleted', listener);
|
|
60
59
|
return () => {
|
|
61
60
|
unsub();
|
|
62
61
|
};
|
|
63
|
-
}, [outName]);
|
|
62
|
+
}, [outName, subscribeToEvent]);
|
|
64
63
|
return exists;
|
|
65
64
|
};
|
|
66
65
|
exports.useFileExistence = useFileExistence;
|
|
@@ -38,7 +38,7 @@ const useMenuStructure = (closeMenu) => {
|
|
|
38
38
|
const { editorShowRulers, setEditorShowRulers } = (0, react_1.useContext)(editor_rulers_1.EditorShowRulersContext);
|
|
39
39
|
const { editorShowGuides, setEditorShowGuides } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
40
40
|
const { size, setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
|
|
41
|
-
const { type } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
41
|
+
const { type } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx).previewServerState;
|
|
42
42
|
const { setSidebarCollapsedState, sidebarCollapsedStateLeft, sidebarCollapsedStateRight, } = (0, react_1.useContext)(sidebar_1.SidebarContext);
|
|
43
43
|
const sizes = (0, SizeSelector_1.getUniqueSizes)(size);
|
|
44
44
|
const isFullscreenSupported = document.fullscreenEnabled || document.webkitFullscreenEnabled;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
/// <reference lib="dom.iterable" />
|
|
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
|
+
import type { HotMiddlewareMessage } from '@remotion/studio-shared';
|
|
9
|
+
declare function eventSourceWrapper(): {
|
|
10
|
+
addMessageListener(fn: (msg: MessageEvent) => void): void;
|
|
11
|
+
};
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
__whmEventSourceWrapper: {
|
|
15
|
+
[key: string]: ReturnType<typeof eventSourceWrapper>;
|
|
16
|
+
};
|
|
17
|
+
__webpack_hot_middleware_reporter__: Reporter;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
type Reporter = ReturnType<typeof createReporter>;
|
|
21
|
+
declare function createReporter(): {
|
|
22
|
+
cleanProblemsCache(): void;
|
|
23
|
+
problems(type: 'errors' | 'warnings', obj: HotMiddlewareMessage): boolean;
|
|
24
|
+
success: () => undefined;
|
|
25
|
+
};
|
|
26
|
+
export declare const enableHotMiddleware: () => void;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference lib="dom" />
|
|
3
|
+
/// <reference lib="dom.iterable" />
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.enableHotMiddleware = void 0;
|
|
6
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
|
+
const process_update_1 = require("./process-update");
|
|
8
|
+
function eventSourceWrapper() {
|
|
9
|
+
let source;
|
|
10
|
+
let lastActivity = Date.now();
|
|
11
|
+
const listeners = [];
|
|
12
|
+
init();
|
|
13
|
+
const timer = setInterval(() => {
|
|
14
|
+
if (Date.now() - lastActivity > studio_shared_1.hotMiddlewareOptions.timeout) {
|
|
15
|
+
handleDisconnect();
|
|
16
|
+
}
|
|
17
|
+
}, studio_shared_1.hotMiddlewareOptions.timeout / 2);
|
|
18
|
+
function init() {
|
|
19
|
+
source = new window.EventSource(studio_shared_1.hotMiddlewareOptions.path);
|
|
20
|
+
source.onopen = handleOnline;
|
|
21
|
+
source.onerror = handleDisconnect;
|
|
22
|
+
source.onmessage = handleMessage;
|
|
23
|
+
}
|
|
24
|
+
function handleOnline() {
|
|
25
|
+
lastActivity = Date.now();
|
|
26
|
+
}
|
|
27
|
+
function handleMessage(event) {
|
|
28
|
+
lastActivity = Date.now();
|
|
29
|
+
for (let i = 0; i < listeners.length; i++) {
|
|
30
|
+
listeners[i](event);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function handleDisconnect() {
|
|
34
|
+
clearInterval(timer);
|
|
35
|
+
source.close();
|
|
36
|
+
setTimeout(init, 1000);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
addMessageListener(fn) {
|
|
40
|
+
listeners.push(fn);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function getEventSourceWrapper() {
|
|
45
|
+
if (!window.__whmEventSourceWrapper) {
|
|
46
|
+
window.__whmEventSourceWrapper = {};
|
|
47
|
+
}
|
|
48
|
+
if (!window.__whmEventSourceWrapper[studio_shared_1.hotMiddlewareOptions.path]) {
|
|
49
|
+
// cache the wrapper for other entries loaded on
|
|
50
|
+
// the same page with the same hotMiddlewareOptions.path
|
|
51
|
+
window.__whmEventSourceWrapper[studio_shared_1.hotMiddlewareOptions.path] =
|
|
52
|
+
eventSourceWrapper();
|
|
53
|
+
}
|
|
54
|
+
return window.__whmEventSourceWrapper[studio_shared_1.hotMiddlewareOptions.path];
|
|
55
|
+
}
|
|
56
|
+
function connect() {
|
|
57
|
+
getEventSourceWrapper().addMessageListener(handleMessage);
|
|
58
|
+
function handleMessage(event) {
|
|
59
|
+
if (event.data === '\uD83D\uDC93') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
processMessage(JSON.parse(event.data));
|
|
64
|
+
}
|
|
65
|
+
catch (ex) {
|
|
66
|
+
if (studio_shared_1.hotMiddlewareOptions.warn) {
|
|
67
|
+
console.warn('Invalid HMR message: ' + event.data + '\n' + ex);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function createReporter() {
|
|
73
|
+
const styles = {
|
|
74
|
+
errors: 'color: #ff0000;',
|
|
75
|
+
warnings: 'color: #999933;',
|
|
76
|
+
};
|
|
77
|
+
let previousProblems = null;
|
|
78
|
+
function log(type, obj) {
|
|
79
|
+
if (obj.action === 'building') {
|
|
80
|
+
console.log('[Fast Refresh] Building');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const newProblems = obj[type]
|
|
84
|
+
.map((msg) => {
|
|
85
|
+
return (0, studio_shared_1.stripAnsi)(msg);
|
|
86
|
+
})
|
|
87
|
+
.join('\n');
|
|
88
|
+
if (previousProblems === newProblems) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
previousProblems = newProblems;
|
|
92
|
+
const style = styles[type];
|
|
93
|
+
const name = obj.name ? "'" + obj.name + "' " : '';
|
|
94
|
+
const title = '[Fast Refresh] bundle ' + name + 'has ' + obj[type].length + ' ' + type;
|
|
95
|
+
// NOTE: console.warn or console.error will print the stack trace
|
|
96
|
+
// which isn't helpful here, so using console.log to escape it.
|
|
97
|
+
if (console.group && console.groupEnd) {
|
|
98
|
+
console.group('%c' + title, style);
|
|
99
|
+
console.log('%c' + newProblems, style);
|
|
100
|
+
console.groupEnd();
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
console.log('%c' + title + '\n\t%c' + newProblems.replace(/\n/g, '\n\t'), style + 'font-weight: bold;', style + 'font-weight: normal;');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
cleanProblemsCache() {
|
|
108
|
+
previousProblems = null;
|
|
109
|
+
},
|
|
110
|
+
problems(type, obj) {
|
|
111
|
+
if (studio_shared_1.hotMiddlewareOptions.warn) {
|
|
112
|
+
log(type, obj);
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
},
|
|
116
|
+
success: () => undefined,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function processMessage(obj) {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
switch (obj.action) {
|
|
122
|
+
case 'building':
|
|
123
|
+
(_a = window.remotion_isBuilding) === null || _a === void 0 ? void 0 : _a.call(window);
|
|
124
|
+
break;
|
|
125
|
+
case 'sync':
|
|
126
|
+
case 'built': {
|
|
127
|
+
let applyUpdate = true;
|
|
128
|
+
if (obj.errors.length > 0) {
|
|
129
|
+
if (reporter)
|
|
130
|
+
reporter.problems('errors', obj);
|
|
131
|
+
applyUpdate = false;
|
|
132
|
+
}
|
|
133
|
+
else if (obj.warnings.length > 0) {
|
|
134
|
+
if (reporter) {
|
|
135
|
+
const overlayShown = reporter.problems('warnings', obj);
|
|
136
|
+
applyUpdate = overlayShown;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (reporter) {
|
|
140
|
+
reporter.cleanProblemsCache();
|
|
141
|
+
reporter.success();
|
|
142
|
+
}
|
|
143
|
+
if (applyUpdate) {
|
|
144
|
+
(_b = window.remotion_finishedBuilding) === null || _b === void 0 ? void 0 : _b.call(window);
|
|
145
|
+
(0, process_update_1.processUpdate)(obj.hash, obj.modules, studio_shared_1.hotMiddlewareOptions);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
default:
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let reporter;
|
|
154
|
+
const singletonKey = '__webpack_hot_middleware_reporter__';
|
|
155
|
+
const enableHotMiddleware = () => {
|
|
156
|
+
if (typeof window === 'undefined') {
|
|
157
|
+
// do nothing
|
|
158
|
+
}
|
|
159
|
+
else if (typeof window.EventSource === 'undefined') {
|
|
160
|
+
console.warn('Unsupported browser: You need a browser that supports EventSource ');
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
connect();
|
|
164
|
+
}
|
|
165
|
+
if (typeof window !== 'undefined') {
|
|
166
|
+
if (!window[singletonKey]) {
|
|
167
|
+
window[singletonKey] = createReporter();
|
|
168
|
+
}
|
|
169
|
+
reporter = window[singletonKey];
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
exports.enableHotMiddleware = enableHotMiddleware;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source code is adapted from
|
|
3
|
+
* https://github.com/webpack-contrib/webpack-hot-middleware#readme
|
|
4
|
+
* and rewritten in TypeScript. This file is MIT licensed
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Based heavily on https://github.com/webpack/webpack/blob/
|
|
8
|
+
* c0afdf9c6abc1dd70707c594e473802a566f7b6e/hot/only-dev-server.js
|
|
9
|
+
* Original copyright Tobias Koppers @sokra (MIT license)
|
|
10
|
+
*/
|
|
11
|
+
import type { HotMiddlewareOptions, ModuleMap } from '@remotion/studio-shared';
|
|
12
|
+
export declare const processUpdate: (hash: string | undefined, moduleMap: ModuleMap, options: HotMiddlewareOptions) => void;
|
|
@@ -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: "
|
|
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) =>
|
|
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 & {
|
|
@@ -51,7 +51,7 @@ export declare const StudioInternals: {
|
|
|
51
51
|
getDefaultOutLocation: ({ compositionName, defaultExtension, type, }: {
|
|
52
52
|
compositionName: string;
|
|
53
53
|
defaultExtension: string;
|
|
54
|
-
type: "
|
|
54
|
+
type: "sequence" | "asset";
|
|
55
55
|
}) => string;
|
|
56
56
|
installFileWatcher: ({ file, onChange, }: {
|
|
57
57
|
file: string;
|
|
@@ -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 |
|
|
14
|
+
export declare function parseRange(size: number, str: string | string[]): -1 | Ranges | -2;
|
|
15
15
|
export {};
|
package/dist/previewEntry.js
CHANGED
|
@@ -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
|
|
12
|
-
const
|
|
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
|
-
|
|
17
|
-
|
|
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
|
|
20
|
-
|
|
21
|
-
client_1.default.createRoot
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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