🎥 Make videos programmatically with React
remove localStorage
Jonny Burger7d921e3040e1
diff --git a/packages/core/src/config/input-props.ts b/packages/core/src/config/input-props.tsindex f05032f407..73dc292759 100644--- a/packages/core/src/config/input-props.ts+++ b/packages/core/src/config/input-props.ts@@ -1,7 +1,5 @@import {getRemotionEnvironment} from '../get-environment';-export const INPUT_PROPS_KEY = 'remotion.inputProps';-let didWarnSSRImport = false;const warnOnceSSRImport = () => {diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 4028620828..6e7cca3d56 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -12,6 +12,8 @@ declare global {remotion_setFrame: (frame: number) => void;remotion_initialFrame: number;remotion_puppeteerTimeout: number;+ remotion_inputProps: string;+ remotion_envVariables: string;remotion_collectAssets: () => TAsset[];remotion_isPlayer: boolean;remotion_imported: boolean;diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.tsindex 2cb0700aa4..e9187fcf88 100644--- a/packages/core/src/internals.ts+++ b/packages/core/src/internals.ts@@ -43,7 +43,6 @@ import {validateSelectedPixelFormatAndImageFormatCombination,} from './config/image-format';import {getShouldOutputImageSequence} from './config/image-sequence';-import {INPUT_PROPS_KEY} from './config/input-props';import * as Logging from './config/log';import {getMaxTimelineTracks} from './config/max-timeline-tracks';import {@@ -83,11 +82,7 @@ import * as perf from './perf';import {getRoot} from './register-root';import {RemotionRoot} from './RemotionRoot';import {SequenceContext} from './sequencing';-import {- ENV_VARIABLES_ENV_NAME,- ENV_VARIABLES_LOCAL_STORAGE_KEY,- setupEnvVariables,-} from './setup-env-variables';+import {ENV_VARIABLES_ENV_NAME, setupEnvVariables} from './setup-env-variables';import * as TimelineInOutPosition from './timeline-inout-position-state';import {SetTimelineInOutContextValue,@@ -125,11 +120,7 @@ import {useRemotionContexts,} from './wrap-remotion-context';import * as AssetCompression from './compress-assets';-import {- DEFAULT_PUPPETEER_TIMEOUT,- PUPPETEER_TIMEOUT_KEY,- setupPuppeteerTimeout,-} from './timeout';+import {DEFAULT_PUPPETEER_TIMEOUT, setupPuppeteerTimeout} from './timeout';import {getCurrentPuppeteerTimeout,setPuppeteerTimeout,@@ -189,7 +180,6 @@ export const Internals = {useLazyComponent,truthy,isAudioCodec,- INPUT_PROPS_KEY,Logging,SequenceContext,useRemotionContexts,@@ -198,7 +188,6 @@ export const Internals = {setupEnvVariables,setupInitialFrame,ENV_VARIABLES_ENV_NAME,- ENV_VARIABLES_LOCAL_STORAGE_KEY,INITIAL_FRAME_LOCAL_STORAGE_KEY,getDotEnvLocation,getServerPort,@@ -226,7 +215,6 @@ export const Internals = {AssetCompression,defaultOverrideFunction,DEFAULT_PUPPETEER_TIMEOUT,- PUPPETEER_TIMEOUT_KEY,setupPuppeteerTimeout,setPuppeteerTimeout,getCurrentPuppeteerTimeout,diff --git a/packages/core/src/setup-env-variables.ts b/packages/core/src/setup-env-variables.tsindex 27cab32763..fb68fb600c 100644--- a/packages/core/src/setup-env-variables.ts+++ b/packages/core/src/setup-env-variables.ts@@ -1,11 +1,10 @@import {getRemotionEnvironment} from './get-environment';-export const ENV_VARIABLES_LOCAL_STORAGE_KEY = 'remotion.envVariables';export const ENV_VARIABLES_ENV_NAME = 'ENV_VARIABLES' as const;const getEnvVariables = (): Record<string, string> => {if (getRemotionEnvironment() === 'rendering') {- const param = localStorage.getItem(ENV_VARIABLES_LOCAL_STORAGE_KEY);+ const param = window.remotion_envVariables;if (!param) {return {};}@@ -17,7 +16,7 @@ const getEnvVariables = (): Record<string, string> => {// Webpack will convert this to an object at compile time.// Don't convert this syntax to a computed property.return {- ...((process.env.ENV_VARIABLES as unknown) as Record<string, string>),+ ...(process.env.ENV_VARIABLES as unknown as Record<string, string>),NODE_ENV: process.env.NODE_ENV as string,};}diff --git a/packages/core/src/timeout.ts b/packages/core/src/timeout.tsindex 94e15b258b..822a8368e4 100644--- a/packages/core/src/timeout.ts+++ b/packages/core/src/timeout.ts@@ -1,9 +1,7 @@export const DEFAULT_PUPPETEER_TIMEOUT = 30000;-export const PUPPETEER_TIMEOUT_KEY = 'remotion.puppeteerTimeout';-const getPuppeteerTimeout = (): number => {- const param = localStorage.getItem(PUPPETEER_TIMEOUT_KEY);+ const param = window.remotion_puppeteerTimeout;return param ? Number(param) : DEFAULT_PUPPETEER_TIMEOUT;};diff --git a/packages/renderer/src/index.ts b/packages/renderer/src/index.tsindex d2c247c43b..b1b90cfb2d 100644--- a/packages/renderer/src/index.ts+++ b/packages/renderer/src/index.ts@@ -1,4 +1,3 @@-import {TAsset, TCompMetadata} from 'remotion';import {addSilentAudioIfNecessary} from './add-silent-audio-if-necessary';import {ffmpegHasFeature,@@ -25,15 +24,6 @@ import {downloadFile} from './assets/download-file';import {validateScale} from './validate-scale';import {killAllBrowsers} from './open-browser';-declare global {- interface Window {- ready: boolean;- getStaticCompositions: () => TCompMetadata[];- remotion_setFrame: (frame: number) => void;- remotion_collectAssets: () => TAsset[];- }-}-export {renderMedia,RenderMediaOnProgress,diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.tsindex d6ba4cf763..a021335b87 100644--- a/packages/renderer/src/set-props-and-env.ts+++ b/packages/renderer/src/set-props-and-env.ts@@ -52,31 +52,20 @@ export const setPropsAndEnv = async ({);}- await page.evaluate(- (key, value) => {- window.localStorage.setItem(key, value);- },- Internals.PUPPETEER_TIMEOUT_KEY,- actualTimeout- );+ await page.evaluate((timeout) => {+ window.remotion_puppeteerTimeout = timeout;+ }, actualTimeout);+if (inputProps) {- await page.evaluate(- (key, input) => {- window.localStorage.setItem(key, input);- },- Internals.INPUT_PROPS_KEY,- JSON.stringify(inputProps)- );+ await page.evaluate((input) => {+ window.remotion_inputProps = input;+ }, JSON.stringify(inputProps));}if (envVariables) {- await page.evaluate(- (key, input) => {- window.localStorage.setItem(key, input);- },- Internals.ENV_VARIABLES_LOCAL_STORAGE_KEY,- JSON.stringify(envVariables)- );+ await page.evaluate((input) => {+ window.remotion_envVariables = input;+ }, JSON.stringify(envVariables));}await page.evaluate(