Skip to content

🎥 Make videos programmatically with React

nice

Jonny Burger5e26f5adc256
diff --git a/packages/bundler/.eslintrc b/packages/bundler/.eslintrc
index d4cc0fb226..5b53a4bafd 100644
--- a/packages/bundler/.eslintrc
+++ b/packages/bundler/.eslintrc
@@ -1,3 +1,11 @@
{
- "extends": "@jonny"
+ "extends": "@jonny",
+ "rules": {
+ "no-restricted-imports": [
+ "error",
+ {
+ "patterns": ["@remotion/*/src/*", "remotion/src/*"]
+ }
+ ]
+ }
}
diff --git a/packages/bundler/src/renderEntry.tsx b/packages/bundler/src/renderEntry.tsx
index 0c3d7e7e71..514d44513d 100644
--- a/packages/bundler/src/renderEntry.tsx
+++ b/packages/bundler/src/renderEntry.tsx
@@ -82,7 +82,7 @@ const GetVideo: React.FC<{state: BundleState}> = ({state}) => {
}
compositions.setCurrentCompositionMetadata({
- props: Internals.deserializeJSONWithCustomFields(
+ props: NoReactInternals.deserializeJSONWithCustomFields(
state.serializedResolvedPropsWithSchema,
),
durationInFrames: state.compositionDurationInFrames,
diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.ts
index cc30343212..a6f923d687 100644
--- a/packages/bundler/src/webpack-config.ts
+++ b/packages/bundler/src/webpack-config.ts
@@ -7,7 +7,7 @@ import {jsonStringifyWithCircularReferences} from './stringify-with-circular-ref
import {getWebpackCacheName} from './webpack-cache';
import esbuild = require('esbuild');
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import type {Configuration} from 'webpack';
import {AllowOptionalDependenciesPlugin} from './optional-dependencies';
export type WebpackConfiguration = Configuration;
@@ -131,7 +131,7 @@ export const webpackConfig = ({
],
output: {
hashFunction: 'xxhash64',
- filename: Internals.bundleName,
+ filename: NoReactInternals.bundleName,
devtoolModuleFilenameTemplate: '[resource-path]',
assetModuleFilename:
environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
diff --git a/packages/cli/src/config/still-frame.ts b/packages/cli/src/config/still-frame.ts
index 044f6700f2..b035d37410 100644
--- a/packages/cli/src/config/still-frame.ts
+++ b/packages/cli/src/config/still-frame.ts
@@ -1,9 +1,9 @@
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
let stillFrame = 0;
export const setStillFrame = (frame: number) => {
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame,
durationInFrames: Infinity,
allowFloats: false,
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx
index 49d9b8e511..31d69bbd10 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx
@@ -1,6 +1,6 @@
import React, {useCallback, useEffect, useMemo} from 'react';
import type {SerializedJSONWithCustomFields} from 'remotion';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/src/no-react';
import type {z} from 'zod';
import {Button} from '../../../preview-server/error-overlay/remotion-overlay/Button';
import {FAIL_COLOR} from '../../helpers/colors';
@@ -27,7 +27,7 @@ const scrollable: React.CSSProperties = {
const parseJSON = (str: string, schema: z.ZodTypeAny): State => {
try {
- const value = Internals.deserializeJSONWithCustomFields(str);
+ const value = NoReactInternals.deserializeJSONWithCustomFields(str);
const zodValidation = schema.safeParse(value);
return {str, value, validJSON: true, zodValidation};
} catch (e) {
diff --git a/packages/cli/src/preview-server/render-queue/make-retry-payload.ts b/packages/cli/src/preview-server/render-queue/make-retry-payload.ts
index 452e65e8fb..de76984c07 100644
--- a/packages/cli/src/preview-server/render-queue/make-retry-payload.ts
+++ b/packages/cli/src/preview-server/render-queue/make-retry-payload.ts
@@ -6,7 +6,7 @@ import type {
ProResProfile,
X264Preset,
} from '@remotion/renderer';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import type {RenderModalState} from '../../editor/state/modals';
import type {RenderJob} from './job';
@@ -46,7 +46,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
initialHeadless: job.chromiumOptions.headless,
initialIgnoreCertificateErrors:
job.chromiumOptions.ignoreCertificateErrors,
- defaultProps: Internals.deserializeJSONWithCustomFields(
+ defaultProps: NoReactInternals.deserializeJSONWithCustomFields(
job.serializedInputPropsWithCustomSchema,
),
inFrameMark: null,
@@ -86,7 +86,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
initialHeadless: job.chromiumOptions.headless,
initialIgnoreCertificateErrors:
job.chromiumOptions.ignoreCertificateErrors,
- defaultProps: Internals.deserializeJSONWithCustomFields(
+ defaultProps: NoReactInternals.deserializeJSONWithCustomFields(
job.serializedInputPropsWithCustomSchema,
),
initialStillImageFormat: defaults.stillImageFormat,
@@ -130,7 +130,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
initialHeadless: job.chromiumOptions.headless,
initialIgnoreCertificateErrors:
job.chromiumOptions.ignoreCertificateErrors,
- defaultProps: Internals.deserializeJSONWithCustomFields(
+ defaultProps: NoReactInternals.deserializeJSONWithCustomFields(
job.serializedInputPropsWithCustomSchema,
),
inFrameMark: job.startFrame,
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 1e8ca54ac3..3d7c36d330 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -113,9 +113,10 @@ export {
ExtrapolateType,
interpolate,
InterpolateOptions,
+ random,
+ RandomSeed,
} from './no-react';
export {prefetch} from './prefetch.js';
-export {random, RandomSeed} from './random.js';
export {registerRoot} from './register-root.js';
export {
LayoutAndStyle,
diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.ts
index 9f60458b30..78b2a7b830 100644
--- a/packages/core/src/internals.ts
+++ b/packages/core/src/internals.ts
@@ -17,7 +17,6 @@ import {compositionsRef} from './CompositionManager.js';
import type {CompositionManagerContext} from './CompositionManagerContext.js';
import {CompositionManager} from './CompositionManagerContext.js';
import * as CSSUtils from './default-css.js';
-import {DELAY_RENDER_CALLSTACK_TOKEN} from './delay-render.js';
import {EditorPropsContext, EditorPropsProvider} from './EditorProps.js';
import {
getPreviewDomElement,
@@ -26,11 +25,7 @@ import {
import type {RemotionEnvironment} from './get-remotion-environment.js';
import {getRemotionEnvironment} from './get-remotion-environment.js';
import type {SerializedJSONWithCustomFields} from './input-props-serialization.js';
-import {
- DATE_TOKEN,
- deserializeJSONWithCustomFields,
- FILE_TOKEN,
-} from './input-props-serialization.js';
+import {DATE_TOKEN, FILE_TOKEN} from './input-props-serialization.js';
import {IsPlayerContextProvider, useIsPlayer} from './is-player.js';
import {NativeLayersProvider} from './NativeLayers.js';
import {NonceContext} from './nonce.js';
@@ -62,7 +57,6 @@ import {truthy} from './truthy.js';
import {useLazyComponent} from './use-lazy-component.js';
import {useUnsafeVideoConfig} from './use-unsafe-video-config.js';
import {useVideo} from './use-video.js';
-import {validateFrame} from './validate-frame.js';
import {
invalidCompositionErrorMessage,
isCompositionIdValid,
@@ -114,7 +108,6 @@ export const Internals = {
isCompositionIdValid,
getPreviewDomElement,
compositionsRef,
- DELAY_RENDER_CALLSTACK_TOKEN,
portalNode,
waitForRoot,
CanUseRemotionHooksProvider,
@@ -123,7 +116,6 @@ export const Internals = {
DurationsContextProvider,
IsPlayerContextProvider,
useIsPlayer,
- validateFrame,
EditorPropsProvider,
EditorPropsContext,
usePreload,
@@ -134,11 +126,8 @@ export const Internals = {
ResolveCompositionConfig,
REMOTION_STUDIO_CONTAINER_ELEMENT,
RenderAssetManager,
- bundleName: 'bundle.js',
- bundleMapName: 'bundle.js.map',
persistCurrentFrame,
useTimelineSetFrame,
- deserializeJSONWithCustomFields,
FILE_TOKEN,
DATE_TOKEN,
NativeLayersProvider,
diff --git a/packages/core/src/no-react.ts b/packages/core/src/no-react.ts
index c50632fe5b..dc46324b58 100644
--- a/packages/core/src/no-react.ts
+++ b/packages/core/src/no-react.ts
@@ -1,17 +1,25 @@
-import {serializeJSONWithDate} from './input-props-serialization';
-import {processColor} from './interpolate-colors';
-import {truthy} from './truthy';
-import {validateDefaultAndInputProps} from './validation/validate-default-props';
-import {validateDimension} from './validation/validate-dimensions';
-import {validateDurationInFrames} from './validation/validate-duration-in-frames';
-import {validateFps} from './validation/validate-fps';
+export type {TRenderAsset} from './CompositionManager';
export {
EasingFunction,
ExtrapolateType,
interpolate,
InterpolateOptions,
} from './interpolate';
+export type {ClipRegion} from './NativeLayers';
+export {random, RandomSeed} from './random.js';
export type {VideoConfig} from './video-config';
+import {DELAY_RENDER_CALLSTACK_TOKEN} from './delay-render';
+import {
+ deserializeJSONWithCustomFields,
+ serializeJSONWithDate,
+} from './input-props-serialization';
+import {processColor} from './interpolate-colors';
+import {truthy} from './truthy';
+import {validateFrame} from './validate-frame';
+import {validateDefaultAndInputProps} from './validation/validate-default-props';
+import {validateDimension} from './validation/validate-dimensions';
+import {validateDurationInFrames} from './validation/validate-duration-in-frames';
+import {validateFps} from './validation/validate-fps';
export const NoReactInternals = {
processColor,
@@ -20,5 +28,10 @@ export const NoReactInternals = {
validateDimension,
validateDurationInFrames,
validateDefaultAndInputProps,
+ validateFrame,
serializeJSONWithDate,
+ bundleName: 'bundle.js',
+ bundleMapName: 'bundle.js.map',
+ deserializeJSONWithCustomFields,
+ DELAY_RENDER_CALLSTACK_TOKEN,
};
diff --git a/packages/lambda/.eslintrc b/packages/lambda/.eslintrc
index 8007c63154..2653ce45dd 100644
--- a/packages/lambda/.eslintrc
+++ b/packages/lambda/.eslintrc
@@ -6,7 +6,7 @@
"no-restricted-imports": [
"error",
{
- "patterns": ["@remotion/cli", "@remotion/*/src/*"],
+ "patterns": ["@remotion/cli", "@remotion/*/src/*", "remotion/src/*"],
"paths": ["remotion", "react", "react-dom"]
}
]
@@ -19,7 +19,8 @@
"no-restricted-imports": [
"error",
{
- "patterns": ["@remotion/*/src/*"]
+ "patterns": ["@remotion/*/src/*", "remotion/src/*"],
+ "paths": ["remotion", "react", "react-dom"]
}
]
}
diff --git a/packages/lambda/src/cli/commands/render/progress.ts b/packages/lambda/src/cli/commands/render/progress.ts
index 16fb9bb02c..194fbe42e0 100644
--- a/packages/lambda/src/cli/commands/render/progress.ts
+++ b/packages/lambda/src/cli/commands/render/progress.ts
@@ -1,7 +1,7 @@
import {CliInternals} from '@remotion/cli';
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import type {
CleanupInfo,
EncodingProgress,
@@ -169,7 +169,7 @@ const makeDownloadProgress = (
? null
: `${CliInternals.formatBytes(downloadInfo.totalSize)}`,
]
- .filter(Internals.truthy)
+ .filter(NoReactInternals.truthy)
.join('/')
: CliInternals.chalk.gray(`${downloadInfo.doneIn}ms`),
].join(' ');
@@ -242,6 +242,6 @@ export const makeProgressString = ({
makeCleanupProgress(progress.cleanupInfo, steps, logLevel === 'verbose'),
downloadInfo ? makeDownloadProgress(downloadInfo, steps) : null,
]
- .filter(Internals.truthy)
+ .filter(NoReactInternals.truthy)
.join('\n');
};
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index df4138b1da..4451330910 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -2,7 +2,7 @@ import {CliInternals} from '@remotion/cli';
import {ConfigInternals} from '@remotion/cli/config';
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
-import {NoReactInternals} from 'remotion/src/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import {downloadMedia} from '../../../api/download-media';
import {getRenderProgress} from '../../../api/get-render-progress';
import {internalRenderMediaOnLambdaRaw} from '../../../api/render-media-on-lambda';
diff --git a/packages/lambda/src/cli/commands/sites/create.ts b/packages/lambda/src/cli/commands/sites/create.ts
index d64ba8ba59..d789bffebc 100644
--- a/packages/lambda/src/cli/commands/sites/create.ts
+++ b/packages/lambda/src/cli/commands/sites/create.ts
@@ -3,7 +3,7 @@ import {ConfigInternals} from '@remotion/cli/config';
import type {LogLevel} from '@remotion/renderer';
import {BrowserSafeApis} from '@remotion/renderer/client';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {deploySite} from '../../../api/deploy-site';
import {internalGetOrCreateBucket} from '../../../api/get-or-create-bucket';
import type {Privacy} from '../../../shared/constants';
@@ -181,7 +181,7 @@ export const sitesCreateSubcommand = async (
Log.info(
CliInternals.chalk.blueBright(
['npx remotion lambda sites create', args[0], `--site-name=${siteName}`]
- .filter(Internals.truthy)
+ .filter(NoReactInternals.truthy)
.join(' '),
),
);
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index ae4c19fa98..c417ffeffa 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -3,7 +3,7 @@ import {ConfigInternals} from '@remotion/cli/config';
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
import {BrowserSafeApis} from '@remotion/renderer/client';
-import {NoReactInternals} from 'remotion/src/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import {downloadMedia} from '../../api/download-media';
import {renderStillOnLambda} from '../../api/render-still-on-lambda';
import {
diff --git a/packages/lambda/src/cli/helpers/progress-bar.ts b/packages/lambda/src/cli/helpers/progress-bar.ts
index 1153f13738..e2b385bde5 100644
--- a/packages/lambda/src/cli/helpers/progress-bar.ts
+++ b/packages/lambda/src/cli/helpers/progress-bar.ts
@@ -1,5 +1,5 @@
import {CliInternals} from '@remotion/cli';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
export type BundleProgress = {
progress: number;
@@ -60,7 +60,7 @@ const makeUploadDiff = ({stats}: {stats: UploadStats | null}) => {
stats.addedFiles ? `+${stats.addedFiles}` : null,
stats.removedFiles ? `-${stats.removedFiles}` : null,
]
- .filter(Internals.truthy)
+ .filter(NoReactInternals.truthy)
.join(',')} ${total === 1 ? 'file' : 'files'})`,
);
};
@@ -85,6 +85,6 @@ export const makeDeployProgressBar = ({
: CliInternals.chalk.gray(`${doneIn}ms`),
makeUploadDiff({stats}),
]
- .filter(Internals.truthy)
+ .filter(NoReactInternals.truthy)
.join(' ');
};
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index afdeb42562..d522685d19 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -2,7 +2,7 @@ import type {StillImageFormat} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
import fs from 'node:fs';
import path from 'node:path';
-import {NoReactInternals} from 'remotion/src/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import {VERSION} from 'remotion/version';
import {estimatePrice} from '../api/estimate-price';
import {internalGetOrCreateBucket} from '../api/get-or-create-bucket';
diff --git a/packages/renderer/.eslintrc b/packages/renderer/.eslintrc
index 78c857b78e..98755bc29a 100644
--- a/packages/renderer/.eslintrc
+++ b/packages/renderer/.eslintrc
@@ -1,17 +1,29 @@
{
"extends": "@jonny",
"rules": {
- "@typescript-eslint/no-use-before-define": "off"
+ "@typescript-eslint/no-use-before-define": "off",
+ "no-restricted-imports": [
+ "error",
+ {
+ "patterns": ["@remotion/*/src/*", "remotion/src/*"],
+ "paths": ["remotion", "react", "react-dom"]
+ }
+ ]
},
"overrides": [
{
"files": "src/browser/**",
"rules": {
- "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-explicit-any": "off"
+ }
+ },
+ {
+ "files": "src/test/**",
+ "rules": {
"no-restricted-imports": [
"error",
{
- "patterns": ["@remotion/*/src/*"]
+ "patterns": ["@remotion/*/src/*", "remotion/src/*"]
}
]
}
diff --git a/packages/renderer/src/assets/calculate-asset-positions.ts b/packages/renderer/src/assets/calculate-asset-positions.ts
index 3fb7125769..b6ad0a81ad 100644
--- a/packages/renderer/src/assets/calculate-asset-positions.ts
+++ b/packages/renderer/src/assets/calculate-asset-positions.ts
@@ -1,4 +1,4 @@
-import type {TRenderAsset} from 'remotion';
+import type {TRenderAsset} from 'remotion/no-react';
import {resolveAssetSrc} from '../resolve-asset-src';
import {convertAssetToFlattenedVolume} from './flatten-volume-array';
import type {Assets, MediaAsset, UnsafeAsset} from './types';
diff --git a/packages/renderer/src/assets/convert-assets-to-file-urls.ts b/packages/renderer/src/assets/convert-assets-to-file-urls.ts
index 98bbd36fea..0e412d0640 100644
--- a/packages/renderer/src/assets/convert-assets-to-file-urls.ts
+++ b/packages/renderer/src/assets/convert-assets-to-file-urls.ts
@@ -1,4 +1,4 @@
-import type {TRenderAsset} from 'remotion';
+import type {TRenderAsset} from 'remotion/no-react';
import type {LogLevel} from '../log-level';
import type {RenderMediaOnDownload} from './download-and-map-assets-to-file';
import {downloadAndMapAssetsToFileUrl} from './download-and-map-assets-to-file';
diff --git a/packages/renderer/src/assets/download-and-map-assets-to-file.ts b/packages/renderer/src/assets/download-and-map-assets-to-file.ts
index b1c695389e..dc218d5760 100644
--- a/packages/renderer/src/assets/download-and-map-assets-to-file.ts
+++ b/packages/renderer/src/assets/download-and-map-assets-to-file.ts
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import path, {extname} from 'node:path';
-import type {TRenderAsset} from 'remotion';
-import {random} from 'remotion';
+import type {TRenderAsset} from 'remotion/no-react';
+import {random} from 'remotion/no-react';
import {isAssetCompressed} from '../compress-assets';
import {ensureOutputDirectory} from '../ensure-output-directory';
import type {LogLevel} from '../log-level';
diff --git a/packages/renderer/src/assets/download-map.ts b/packages/renderer/src/assets/download-map.ts
index ffa92968a6..e0dc663cb0 100644
--- a/packages/renderer/src/assets/download-map.ts
+++ b/packages/renderer/src/assets/download-map.ts
@@ -1,6 +1,6 @@
import fs, {mkdirSync} from 'node:fs';
import path from 'node:path';
-import type {TRenderAsset} from 'remotion';
+import type {TRenderAsset} from 'remotion/no-react';
import {deleteDirectory} from '../delete-directory';
import {OffthreadVideoServerEmitter} from '../offthread-video-server';
import {tmpDir} from '../tmp-dir';
diff --git a/packages/renderer/src/assets/types.ts b/packages/renderer/src/assets/types.ts
index 0bb627a680..c6b47c5362 100644
--- a/packages/renderer/src/assets/types.ts
+++ b/packages/renderer/src/assets/types.ts
@@ -1,4 +1,4 @@
-import type {TRenderAsset} from 'remotion';
+import type {TRenderAsset} from 'remotion/no-react';
// An unsafe asset is an asset with looser types, which occurs
// during construction of the asset list. Prefer the MediaAsset
diff --git a/packages/renderer/src/browser/BrowserPage.ts b/packages/renderer/src/browser/BrowserPage.ts
index 9cfcac5778..c747719ea0 100644
--- a/packages/renderer/src/browser/BrowserPage.ts
+++ b/packages/renderer/src/browser/BrowserPage.ts
@@ -13,8 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {formatRemoteObject} from '../format-logs';
import type {LogLevel} from '../log-level';
import {Log} from '../logger';
@@ -198,7 +197,7 @@ export class Page extends EventEmitter {
}
if (
- url?.endsWith(Internals.bundleName) &&
+ url?.endsWith(NoReactInternals.bundleName) &&
lineNumber &&
this.sourceMapGetter()
) {
diff --git a/packages/renderer/src/compress-assets.ts b/packages/renderer/src/compress-assets.ts
index b1f48cbe2e..b0d6c28aaf 100644
--- a/packages/renderer/src/compress-assets.ts
+++ b/packages/renderer/src/compress-assets.ts
@@ -3,7 +3,7 @@
* Since we track the `src` property for every frame, Node.JS can run out of memory easily. Instead of duplicating the src for every frame, we save memory by replacing the full base 64 encoded data with a string `same-as-[asset-id]-[frame]` referencing a previous asset with the same src.
*/
-import type {TRenderAsset} from 'remotion';
+import type {TRenderAsset} from 'remotion/no-react';
export const compressAsset = (
previousRenderAssets: TRenderAsset[],
diff --git a/packages/renderer/src/delay-render-embedded-stack.ts b/packages/renderer/src/delay-render-embedded-stack.ts
index 952bad1881..fda255a6cf 100644
--- a/packages/renderer/src/delay-render-embedded-stack.ts
+++ b/packages/renderer/src/delay-render-embedded-stack.ts
@@ -1,17 +1,17 @@
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import type {UnsymbolicatedStackFrame} from './parse-browser-error-stack';
import {parseStack} from './parse-browser-error-stack';
export const parseDelayRenderEmbeddedStack = (
message: string,
): UnsymbolicatedStackFrame[] | null => {
- const index = message.indexOf(Internals.DELAY_RENDER_CALLSTACK_TOKEN);
+ const index = message.indexOf(NoReactInternals.DELAY_RENDER_CALLSTACK_TOKEN);
if (index === -1) {
return null;
}
const msg = message
- .substring(index + Internals.DELAY_RENDER_CALLSTACK_TOKEN.length)
+ .substring(index + NoReactInternals.DELAY_RENDER_CALLSTACK_TOKEN.length)
.trim();
const parsed = parseStack(msg.split('\n'));
diff --git a/packages/renderer/src/error-handling/handle-javascript-exception.ts b/packages/renderer/src/error-handling/handle-javascript-exception.ts
index 1c8c7c3169..9a35a5ba22 100644
--- a/packages/renderer/src/error-handling/handle-javascript-exception.ts
+++ b/packages/renderer/src/error-handling/handle-javascript-exception.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import type {Page} from '../browser/BrowserPage';
import type {CallFrame, ExceptionThrownEvent} from '../browser/devtools-types';
import type {UnsymbolicatedStackFrame} from '../parse-browser-error-stack';
@@ -55,7 +55,7 @@ const cleanUpErrorMessage = (exception: ExceptionThrownEvent) => {
};
const removeDelayRenderStack = (message: string) => {
- const index = message.indexOf(Internals.DELAY_RENDER_CALLSTACK_TOKEN);
+ const index = message.indexOf(NoReactInternals.DELAY_RENDER_CALLSTACK_TOKEN);
if (index === -1) {
return message;
}
diff --git a/packages/renderer/src/get-bundle-url-from-serve-url.ts b/packages/renderer/src/get-bundle-url-from-serve-url.ts
index 694e5c2523..b17405d565 100644
--- a/packages/renderer/src/get-bundle-url-from-serve-url.ts
+++ b/packages/renderer/src/get-bundle-url-from-serve-url.ts
@@ -1,5 +1,5 @@
import path from 'path';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {isServeUrl} from './is-serve-url';
const map = (webpackBundleOrServeUrl: string, suffix: string) => {
@@ -19,9 +19,9 @@ const map = (webpackBundleOrServeUrl: string, suffix: string) => {
};
export const getBundleUrlFromServeUrl = (serveUrl: string) => {
- return map(serveUrl, Internals.bundleName);
+ return map(serveUrl, NoReactInternals.bundleName);
};
export const getBundleMapUrlFromServeUrl = (serveUrl: string) => {
- return map(serveUrl, Internals.bundleMapName);
+ return map(serveUrl, NoReactInternals.bundleMapName);
};
diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.ts
index 26277299e2..7760815d0e 100644
--- a/packages/renderer/src/get-compositions.ts
+++ b/packages/renderer/src/get-compositions.ts
@@ -1,5 +1,5 @@
-import {Internals, type VideoConfig} from 'remotion';
-import {NoReactInternals} from 'remotion/src/no-react';
+import type {VideoConfig} from 'remotion/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import type {BrowserExecutable} from './browser-executable';
import type {BrowserLog} from './browser-log';
import type {HeadlessBrowser} from './browser/Browser';
@@ -139,10 +139,10 @@ const innerGetCompositions = async ({
height,
fps,
durationInFrames,
- props: Internals.deserializeJSONWithCustomFields(
+ props: NoReactInternals.deserializeJSONWithCustomFields(
r.serializedResolvedPropsWithCustomSchema,
),
- defaultProps: Internals.deserializeJSONWithCustomFields(
+ defaultProps: NoReactInternals.deserializeJSONWithCustomFields(
r.serializedDefaultPropsWithCustomSchema,
),
defaultCodec,
diff --git a/packages/renderer/src/options/option.ts b/packages/renderer/src/options/option.ts
index 3f6b786590..dc7ef78353 100644
--- a/packages/renderer/src/options/option.ts
+++ b/packages/renderer/src/options/option.ts
@@ -1,3 +1,4 @@
+// eslint-disable-next-line no-restricted-imports
import type React from 'react';
export type RemotionOption<SsrName extends string, Type> = {
diff --git a/packages/renderer/src/prepare-server.ts b/packages/renderer/src/prepare-server.ts
index 2e4b9071b9..e3465dbd0e 100644
--- a/packages/renderer/src/prepare-server.ts
+++ b/packages/renderer/src/prepare-server.ts
@@ -1,6 +1,6 @@
import {existsSync} from 'node:fs';
import path from 'node:path';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import type {RenderMediaOnDownload} from './assets/download-and-map-assets-to-file';
import {attachDownloadListenerToEmitter} from './assets/download-and-map-assets-to-file';
import type {DownloadMap} from './assets/download-map';
@@ -113,7 +113,7 @@ export const prepareServer = async ({
let localSourceMap: AnySourceMapConsumer | null = null;
getSourceMapFromLocalFile(
- path.join(webpackConfigOrServeUrl, Internals.bundleName),
+ path.join(webpackConfigOrServeUrl, NoReactInternals.bundleName),
)
.then((s) => {
localSourceMap = s;
diff --git a/packages/renderer/src/provide-screenshot.ts b/packages/renderer/src/provide-screenshot.ts
index b14df67e31..c4c23c2134 100644
--- a/packages/renderer/src/provide-screenshot.ts
+++ b/packages/renderer/src/provide-screenshot.ts
@@ -1,4 +1,4 @@
-import type {ClipRegion} from 'remotion';
+import type {ClipRegion} from 'remotion/no-react';
import type {Page} from './browser/BrowserPage';
import type {StillImageFormat} from './image-format';
import {screenshotDOMElement} from './screenshot-dom-element';
diff --git a/packages/renderer/src/puppeteer-screenshot.ts b/packages/renderer/src/puppeteer-screenshot.ts
index f3f8e903e6..f53cc9e3a8 100644
--- a/packages/renderer/src/puppeteer-screenshot.ts
+++ b/packages/renderer/src/puppeteer-screenshot.ts
@@ -1,5 +1,5 @@
import * as assert from 'node:assert';
-import type {ClipRegion} from 'remotion';
+import type {ClipRegion} from 'remotion/no-react';
import type {Page} from './browser/BrowserPage';
import type {StillImageFormat} from './image-format';
import {screenshotTask} from './screenshot-task';
diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.ts
index f5f86f04d8..966ff459bd 100644
--- a/packages/renderer/src/render-frames.ts
+++ b/packages/renderer/src/render-frames.ts
@@ -1,8 +1,8 @@
import fs from 'node:fs';
import path from 'node:path';
import {performance} from 'perf_hooks';
-import type {TRenderAsset, VideoConfig} from 'remotion';
-import {NoReactInternals} from 'remotion/src/no-react';
+import type {TRenderAsset, VideoConfig} from 'remotion/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import type {RenderMediaOnDownload} from './assets/download-and-map-assets-to-file';
import {downloadAndMapAssetsToFileUrl} from './assets/download-and-map-assets-to-file';
import type {DownloadMap} from './assets/download-map';
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index 90c4a9387b..82007796bf 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -2,8 +2,8 @@ import type {ExecaChildProcess} from 'execa';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
-import type {VideoConfig} from 'remotion';
-import {NoReactInternals} from 'remotion/src/no-react';
+import type {VideoConfig} from 'remotion/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import {type RenderMediaOnDownload} from './assets/download-and-map-assets-to-file';
import type {AudioCodec} from './audio-codec';
import type {BrowserExecutable} from './browser-executable';
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index 3817f99ae7..3071770870 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -1,8 +1,7 @@
import fs, {statSync} from 'node:fs';
import path from 'node:path';
-import type {VideoConfig} from 'remotion';
-import {Internals} from 'remotion';
-import {NoReactInternals} from 'remotion/src/no-react';
+import type {VideoConfig} from 'remotion/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import type {RenderMediaOnDownload} from './assets/download-and-map-assets-to-file';
import type {DownloadMap} from './assets/download-map';
import {DEFAULT_BROWSER} from './browser';
@@ -165,7 +164,7 @@ const innerRenderStill = async ({
allowFloats: false,
});
validateStillImageFormat(imageFormat);
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame,
durationInFrames: composition.durationInFrames,
allowFloats: false,
diff --git a/packages/renderer/src/screenshot-dom-element.ts b/packages/renderer/src/screenshot-dom-element.ts
index 90e4342509..a4189a4773 100644
--- a/packages/renderer/src/screenshot-dom-element.ts
+++ b/packages/renderer/src/screenshot-dom-element.ts
@@ -1,4 +1,4 @@
-import type {ClipRegion} from 'remotion';
+import type {ClipRegion} from 'remotion/no-react';
import type {Page} from './browser/BrowserPage';
import type {StillImageFormat} from './image-format';
import {puppeteerEvaluateWithCatch} from './puppeteer-evaluate';
diff --git a/packages/renderer/src/screenshot-task.ts b/packages/renderer/src/screenshot-task.ts
index 037752dd57..7578cf707f 100644
--- a/packages/renderer/src/screenshot-task.ts
+++ b/packages/renderer/src/screenshot-task.ts
@@ -1,5 +1,5 @@
import fs from 'node:fs';
-import type {ClipRegion} from 'remotion';
+import type {ClipRegion} from 'remotion/no-react';
import type {Page} from './browser/BrowserPage';
import type {StillImageFormat} from './image-format';
import {startPerfMeasure, stopPerfMeasure} from './perf';
diff --git a/packages/renderer/src/select-composition.ts b/packages/renderer/src/select-composition.ts
index 4468e839e7..3c80de33a0 100644
--- a/packages/renderer/src/select-composition.ts
+++ b/packages/renderer/src/select-composition.ts
@@ -1,5 +1,5 @@
-import {Internals, type VideoConfig} from 'remotion';
-import {NoReactInternals} from 'remotion/src/no-react';
+import type {VideoConfig} from 'remotion/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import type {BrowserExecutable} from './browser-executable';
import type {BrowserLog} from './browser-log';
import type {HeadlessBrowser} from './browser/Browser';
@@ -162,10 +162,10 @@ const innerSelectComposition = async ({
height,
fps,
durationInFrames,
- props: Internals.deserializeJSONWithCustomFields(
+ props: NoReactInternals.deserializeJSONWithCustomFields(
res.serializedResolvedPropsWithCustomSchema,
),
- defaultProps: Internals.deserializeJSONWithCustomFields(
+ defaultProps: NoReactInternals.deserializeJSONWithCustomFields(
res.serializedDefaultPropsWithCustomSchema,
),
defaultCodec,
diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.ts
index e43bc771c7..f50d451f16 100644
--- a/packages/renderer/src/stitch-frames-to-video.ts
+++ b/packages/renderer/src/stitch-frames-to-video.ts
@@ -1,7 +1,7 @@
import fs, {promises} from 'node:fs';
import path from 'node:path';
-import type {TRenderAsset} from 'remotion';
-import {Internals} from 'remotion';
+import type {TRenderAsset} from 'remotion/no-react';
+import {NoReactInternals} from 'remotion/no-react';
import {calculateAssetPositions} from './assets/calculate-asset-positions';
import {convertAssetsToFileUrls} from './assets/convert-assets-to-file-urls';
import type {RenderMediaOnDownload} from './assets/download-and-map-assets-to-file';
@@ -374,7 +374,7 @@ const innerStitchFramesToVideo = async (
audioBitrate ? audioBitrate : '320k',
force ? '-y' : null,
outputLocation ?? tempFile,
- ].filter(Internals.truthy),
+ ].filter(NoReactInternals.truthy),
indent,
logLevel,
);
diff --git a/packages/renderer/src/take-frame-and-compose.ts b/packages/renderer/src/take-frame-and-compose.ts
index bacc82cfbd..aadcd17c64 100644
--- a/packages/renderer/src/take-frame-and-compose.ts
+++ b/packages/renderer/src/take-frame-and-compose.ts
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import path from 'node:path';
-import type {ClipRegion, TRenderAsset} from 'remotion';
+import type {ClipRegion, TRenderAsset} from 'remotion/no-react';
import type {DownloadMap} from './assets/download-map';
import type {Page} from './browser/BrowserPage';
import {compose} from './compositor/compose';
diff --git a/packages/renderer/src/test/asset-calculation.test.tsx b/packages/renderer/src/test/asset-calculation.test.tsx
index e39be8718c..4a9f7e0d0f 100644
--- a/packages/renderer/src/test/asset-calculation.test.tsx
+++ b/packages/renderer/src/test/asset-calculation.test.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable no-restricted-imports */
/**
* @vitest-environment jsdom
*/
diff --git a/packages/renderer/src/test/frame.test.ts b/packages/renderer/src/test/frame.test.ts
index 93a5c8443a..49162de835 100644
--- a/packages/renderer/src/test/frame.test.ts
+++ b/packages/renderer/src/test/frame.test.ts
@@ -1,16 +1,16 @@
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {expect, test} from 'vitest';
test('Validate frame', () => {
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
durationInFrames: Infinity,
frame: Infinity,
allowFloats: false,
}),
).toThrow(/Frame Infinity is not finite/);
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
// @ts-expect-error
frame: 'hithere',
allowFloats: false,
@@ -18,19 +18,23 @@ test('Validate frame', () => {
}),
).toThrow(/Argument passed for "frame" is not a number: hithere/);
expect(() =>
- Internals.validateFrame({frame: 3, durationInFrames: 1, allowFloats: true}),
+ NoReactInternals.validateFrame({
+ frame: 3,
+ durationInFrames: 1,
+ allowFloats: true,
+ }),
).toThrow(
/Cannot use frame 3: Duration of composition is 1, therefore the highest frame that can be rendered is 0/,
);
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame: 2.99,
durationInFrames: 10,
allowFloats: false,
}),
).toThrow(/Argument for frame must be an integer, but got 2.99/);
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame: 2.99,
durationInFrames: 10,
allowFloats: true,
@@ -38,35 +42,35 @@ test('Validate frame', () => {
).not.toThrow();
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame: 0,
durationInFrames: 1,
allowFloats: false,
}),
).not.toThrow();
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame: 1,
durationInFrames: 2,
allowFloats: false,
}),
).not.toThrow();
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame: -1,
durationInFrames: 100,
allowFloats: false,
}),
).not.toThrow();
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame: -100,
durationInFrames: 100,
allowFloats: false,
}),
).not.toThrow();
expect(() =>
- Internals.validateFrame({
+ NoReactInternals.validateFrame({
frame: -101,
durationInFrames: 100,
allowFloats: false,
diff --git a/packages/renderer/src/test/get-assets-for-markup.tsx b/packages/renderer/src/test/get-assets-for-markup.tsx
index 3469aeea67..6ce271092c 100644
--- a/packages/renderer/src/test/get-assets-for-markup.tsx
+++ b/packages/renderer/src/test/get-assets-for-markup.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable no-restricted-imports */
/**
* @vitest-environment jsdom
*/