Add .gitignore to exclude all node packages and lock files
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
import type { GitSource, RenderDefaults } from '@remotion/studio-shared';
|
||||
import webpack from 'webpack';
|
||||
import type { WebpackOverrideFn } from './webpack-config';
|
||||
export type MandatoryLegacyBundleOptions = {
|
||||
webpackOverride: WebpackOverrideFn;
|
||||
outDir: string | null;
|
||||
enableCaching: boolean;
|
||||
publicPath: string | null;
|
||||
rootDir: string | null;
|
||||
publicDir: string | null;
|
||||
onPublicDirCopyProgress: (bytes: number) => void;
|
||||
onSymlinkDetected: (path: string) => void;
|
||||
keyboardShortcutsEnabled: boolean;
|
||||
askAIEnabled: boolean;
|
||||
};
|
||||
export type LegacyBundleOptions = Partial<MandatoryLegacyBundleOptions>;
|
||||
export declare const getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, options, bufferStateDelayInMilliseconds, maxTimelineTracks, experimentalClientSideRenderingEnabled, }: {
|
||||
outDir: string;
|
||||
entryPoint: string;
|
||||
resolvedRemotionRoot: string;
|
||||
bufferStateDelayInMilliseconds: number | null;
|
||||
experimentalClientSideRenderingEnabled: boolean;
|
||||
maxTimelineTracks: number | null;
|
||||
onProgress?: (progress: number) => void;
|
||||
options?: LegacyBundleOptions;
|
||||
}) => Promise<[string, webpack.Configuration]>;
|
||||
type NewBundleOptions = {
|
||||
entryPoint: string;
|
||||
onProgress: (progress: number) => void;
|
||||
ignoreRegisterRootWarning: boolean;
|
||||
onDirectoryCreated: (dir: string) => void;
|
||||
gitSource: GitSource | null;
|
||||
maxTimelineTracks: number | null;
|
||||
bufferStateDelayInMilliseconds: number | null;
|
||||
audioLatencyHint: AudioContextLatencyCategory | null;
|
||||
experimentalClientSideRenderingEnabled: boolean;
|
||||
renderDefaults: RenderDefaults | null;
|
||||
};
|
||||
type MandatoryBundleOptions = {
|
||||
entryPoint: string;
|
||||
} & NewBundleOptions & MandatoryLegacyBundleOptions;
|
||||
export type BundleOptions = {
|
||||
entryPoint: string;
|
||||
} & Partial<NewBundleOptions> & LegacyBundleOptions;
|
||||
type Arguments = [options: BundleOptions] | [
|
||||
entryPoint: string,
|
||||
onProgress?: (progress: number) => void,
|
||||
options?: LegacyBundleOptions
|
||||
];
|
||||
export declare const findClosestFolderWithItem: (currentDir: string, file: string) => string | null;
|
||||
export declare const internalBundle: (actualArgs: MandatoryBundleOptions) => Promise<string>;
|
||||
export declare function bundle(...args: Arguments): Promise<string>;
|
||||
export {};
|
||||
+288
@@ -0,0 +1,288 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.internalBundle = exports.findClosestFolderWithItem = exports.getConfig = void 0;
|
||||
exports.bundle = bundle;
|
||||
const studio_shared_1 = require("@remotion/studio-shared");
|
||||
const node_fs_1 = __importStar(require("node:fs"));
|
||||
const node_os_1 = __importDefault(require("node:os"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const node_util_1 = require("node:util");
|
||||
const node_worker_threads_1 = require("node:worker_threads");
|
||||
const webpack_1 = __importDefault(require("webpack"));
|
||||
const copy_dir_1 = require("./copy-dir");
|
||||
const index_html_1 = require("./index-html");
|
||||
const read_recursively_1 = require("./read-recursively");
|
||||
const webpack_config_1 = require("./webpack-config");
|
||||
const promisified = (0, node_util_1.promisify)(webpack_1.default);
|
||||
const prepareOutDir = async (specified) => {
|
||||
if (specified) {
|
||||
await node_fs_1.default.promises.mkdir(specified, { recursive: true });
|
||||
return specified;
|
||||
}
|
||||
return node_fs_1.default.promises.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'remotion-webpack-bundle-'));
|
||||
};
|
||||
const trimLeadingSlash = (p) => {
|
||||
if (p.startsWith('/')) {
|
||||
return trimLeadingSlash(p.substr(1));
|
||||
}
|
||||
return p;
|
||||
};
|
||||
const trimTrailingSlash = (p) => {
|
||||
if (p.endsWith('/')) {
|
||||
return trimTrailingSlash(p.substr(0, p.length - 1));
|
||||
}
|
||||
return p;
|
||||
};
|
||||
const getConfig = ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, options, bufferStateDelayInMilliseconds, maxTimelineTracks, experimentalClientSideRenderingEnabled, }) => {
|
||||
var _a, _b, _c, _d;
|
||||
return (0, webpack_config_1.webpackConfig)({
|
||||
entry: node_path_1.default.join(require.resolve('@remotion/studio/renderEntry'), '..', 'esm', 'renderEntry.mjs'),
|
||||
userDefinedComponent: entryPoint,
|
||||
outDir,
|
||||
environment: 'production',
|
||||
webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : ((f) => f),
|
||||
onProgress: (p) => {
|
||||
onProgress === null || onProgress === void 0 ? void 0 : onProgress(p);
|
||||
},
|
||||
enableCaching: (_b = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _b !== void 0 ? _b : true,
|
||||
maxTimelineTracks,
|
||||
remotionRoot: resolvedRemotionRoot,
|
||||
keyboardShortcutsEnabled: (_c = options === null || options === void 0 ? void 0 : options.keyboardShortcutsEnabled) !== null && _c !== void 0 ? _c : true,
|
||||
bufferStateDelayInMilliseconds,
|
||||
poll: null,
|
||||
experimentalClientSideRenderingEnabled,
|
||||
askAIEnabled: (_d = options === null || options === void 0 ? void 0 : options.askAIEnabled) !== null && _d !== void 0 ? _d : true,
|
||||
});
|
||||
};
|
||||
exports.getConfig = getConfig;
|
||||
const convertArgumentsIntoOptions = (args) => {
|
||||
var _a;
|
||||
if (args.length === 0) {
|
||||
throw new TypeError('bundle() was called without arguments');
|
||||
}
|
||||
const firstArg = args[0];
|
||||
if (typeof firstArg === 'string') {
|
||||
return {
|
||||
entryPoint: firstArg,
|
||||
onProgress: args[1],
|
||||
...((_a = args[2]) !== null && _a !== void 0 ? _a : {}),
|
||||
};
|
||||
}
|
||||
if (typeof firstArg.entryPoint !== 'string') {
|
||||
throw new TypeError('bundle() was called without the `entryPoint` option');
|
||||
}
|
||||
return firstArg;
|
||||
};
|
||||
const recursionLimit = 5;
|
||||
const findClosestFolderWithItem = (currentDir, file) => {
|
||||
let possibleFile = '';
|
||||
for (let i = 0; i < recursionLimit; i++) {
|
||||
possibleFile = node_path_1.default.join(currentDir, file);
|
||||
const exists = node_fs_1.default.existsSync(possibleFile);
|
||||
if (exists) {
|
||||
return node_path_1.default.dirname(possibleFile);
|
||||
}
|
||||
currentDir = node_path_1.default.dirname(currentDir);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
exports.findClosestFolderWithItem = findClosestFolderWithItem;
|
||||
const findClosestPackageJsonFolder = (currentDir) => {
|
||||
return (0, exports.findClosestFolderWithItem)(currentDir, 'package.json');
|
||||
};
|
||||
const validateEntryPoint = async (entryPoint) => {
|
||||
const contents = await node_fs_1.promises.readFile(entryPoint, 'utf8');
|
||||
if (!contents.includes('registerRoot')) {
|
||||
throw new Error([
|
||||
`You passed ${entryPoint} as your entry point, but this file does not contain "registerRoot".`,
|
||||
'You should use the file that calls registerRoot() as the entry point.',
|
||||
'To ignore this error, pass "ignoreRegisterRootWarning" to bundle().',
|
||||
'This error cannot be ignored on the CLI.',
|
||||
].join(' '));
|
||||
}
|
||||
};
|
||||
const internalBundle = async (actualArgs) => {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
||||
const entryPoint = node_path_1.default.resolve(process.cwd(), actualArgs.entryPoint);
|
||||
const resolvedRemotionRoot = (_b = (_a = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.rootDir) !== null && _a !== void 0 ? _a : findClosestPackageJsonFolder(entryPoint)) !== null && _b !== void 0 ? _b : process.cwd();
|
||||
if (!actualArgs.ignoreRegisterRootWarning) {
|
||||
await validateEntryPoint(entryPoint);
|
||||
}
|
||||
const outDir = await prepareOutDir((_c = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.outDir) !== null && _c !== void 0 ? _c : null);
|
||||
(_d = actualArgs.onDirectoryCreated) === null || _d === void 0 ? void 0 : _d.call(actualArgs, outDir);
|
||||
// The config might use an override which might use
|
||||
// `process.cwd()`. The context should always be the Remotion root.
|
||||
// This is not supported in worker threads (used for tests)
|
||||
const currentCwd = process.cwd();
|
||||
if (node_worker_threads_1.isMainThread) {
|
||||
process.chdir(resolvedRemotionRoot);
|
||||
}
|
||||
const { onProgress, ...options } = actualArgs;
|
||||
const [, config] = await (0, exports.getConfig)({
|
||||
outDir,
|
||||
entryPoint,
|
||||
resolvedRemotionRoot,
|
||||
onProgress,
|
||||
options,
|
||||
// Should be null to keep cache hash working
|
||||
bufferStateDelayInMilliseconds: (_e = actualArgs.bufferStateDelayInMilliseconds) !== null && _e !== void 0 ? _e : null,
|
||||
maxTimelineTracks: actualArgs.maxTimelineTracks,
|
||||
experimentalClientSideRenderingEnabled: actualArgs.experimentalClientSideRenderingEnabled,
|
||||
});
|
||||
const output = (await promisified([config]));
|
||||
if (node_worker_threads_1.isMainThread) {
|
||||
process.chdir(currentCwd);
|
||||
}
|
||||
if (!output) {
|
||||
throw new Error('Expected webpack output');
|
||||
}
|
||||
const { errors } = output.toJson();
|
||||
if (errors !== undefined && errors.length > 0) {
|
||||
throw new Error(errors[0].message + '\n' + errors[0].details);
|
||||
}
|
||||
const publicPath = (_f = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.publicPath) !== null && _f !== void 0 ? _f : '/';
|
||||
const staticHash = '/' +
|
||||
[trimTrailingSlash(trimLeadingSlash(publicPath)), 'public']
|
||||
.filter(Boolean)
|
||||
.join('/');
|
||||
const from = (options === null || options === void 0 ? void 0 : options.publicDir)
|
||||
? node_path_1.default.resolve(resolvedRemotionRoot, options.publicDir)
|
||||
: node_path_1.default.join(resolvedRemotionRoot, 'public');
|
||||
const to = node_path_1.default.join(outDir, 'public');
|
||||
let symlinkWarningShown = false;
|
||||
const showSymlinkWarning = (ent, src) => {
|
||||
if (symlinkWarningShown) {
|
||||
return;
|
||||
}
|
||||
const absolutePath = node_path_1.default.join(src, ent.name);
|
||||
if (options.onSymlinkDetected) {
|
||||
options.onSymlinkDetected(absolutePath);
|
||||
return;
|
||||
}
|
||||
symlinkWarningShown = true;
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`\nFound a symbolic link in the public folder (${absolutePath}). The symlink will be forwarded into the bundle.`);
|
||||
};
|
||||
if (node_fs_1.default.existsSync(from)) {
|
||||
await (0, copy_dir_1.copyDir)({
|
||||
src: from,
|
||||
dest: to,
|
||||
onSymlinkDetected: showSymlinkWarning,
|
||||
onProgress: (prog) => {
|
||||
var _a;
|
||||
return (_a = options.onPublicDirCopyProgress) === null || _a === void 0 ? void 0 : _a.call(options, prog);
|
||||
},
|
||||
copiedBytes: 0,
|
||||
lastReportedProgress: 0,
|
||||
});
|
||||
}
|
||||
const html = (0, index_html_1.indexHtml)({
|
||||
staticHash,
|
||||
publicPath,
|
||||
editorName: null,
|
||||
inputProps: null,
|
||||
remotionRoot: resolvedRemotionRoot,
|
||||
studioServerCommand: null,
|
||||
renderQueue: null,
|
||||
numberOfAudioTags: 0,
|
||||
publicFiles: (0, read_recursively_1.readRecursively)({
|
||||
folder: '.',
|
||||
startPath: from,
|
||||
staticHash,
|
||||
limit: 10000,
|
||||
}).map((f) => {
|
||||
return {
|
||||
...f,
|
||||
name: f.name.split(node_path_1.default.sep).join('/'),
|
||||
};
|
||||
}),
|
||||
includeFavicon: true,
|
||||
title: 'Remotion Bundle',
|
||||
renderDefaults: (_g = actualArgs.renderDefaults) !== null && _g !== void 0 ? _g : undefined,
|
||||
publicFolderExists: `${publicPath + (publicPath.endsWith('/') ? '' : '/')}public`,
|
||||
gitSource: (_h = actualArgs.gitSource) !== null && _h !== void 0 ? _h : null,
|
||||
projectName: (0, studio_shared_1.getProjectName)({
|
||||
gitSource: (_j = actualArgs.gitSource) !== null && _j !== void 0 ? _j : null,
|
||||
resolvedRemotionRoot,
|
||||
basename: node_path_1.default.basename,
|
||||
}),
|
||||
installedDependencies: null,
|
||||
packageManager: 'unknown',
|
||||
// Actual log level is set in setPropsAndEnv()
|
||||
logLevel: 'info',
|
||||
mode: 'bundle',
|
||||
audioLatencyHint: (_k = actualArgs.audioLatencyHint) !== null && _k !== void 0 ? _k : 'interactive',
|
||||
});
|
||||
node_fs_1.default.writeFileSync(node_path_1.default.join(outDir, 'index.html'), html);
|
||||
node_fs_1.default.copyFileSync(node_path_1.default.join(__dirname, '../favicon.ico'), node_path_1.default.join(outDir, 'favicon.ico'));
|
||||
node_fs_1.default.copyFileSync(node_path_1.default.resolve(require.resolve('source-map'), '..', 'lib', 'mappings.wasm'), node_path_1.default.join(outDir, studio_shared_1.SOURCE_MAP_ENDPOINT.replace('/', '')));
|
||||
return outDir;
|
||||
};
|
||||
exports.internalBundle = internalBundle;
|
||||
/*
|
||||
* @description Bundles a Remotion project using Webpack and prepares it for rendering.
|
||||
* @see [Documentation](https://remotion.dev/docs/bundle)
|
||||
*/
|
||||
async function bundle(...args) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
||||
const actualArgs = convertArgumentsIntoOptions(args);
|
||||
const result = await (0, exports.internalBundle)({
|
||||
bufferStateDelayInMilliseconds: (_a = actualArgs.bufferStateDelayInMilliseconds) !== null && _a !== void 0 ? _a : null,
|
||||
enableCaching: (_b = actualArgs.enableCaching) !== null && _b !== void 0 ? _b : true,
|
||||
entryPoint: actualArgs.entryPoint,
|
||||
gitSource: (_c = actualArgs.gitSource) !== null && _c !== void 0 ? _c : null,
|
||||
ignoreRegisterRootWarning: (_d = actualArgs.ignoreRegisterRootWarning) !== null && _d !== void 0 ? _d : false,
|
||||
maxTimelineTracks: (_e = actualArgs.maxTimelineTracks) !== null && _e !== void 0 ? _e : null,
|
||||
onDirectoryCreated: (_f = actualArgs.onDirectoryCreated) !== null && _f !== void 0 ? _f : (() => { }),
|
||||
onProgress: (_g = actualArgs.onProgress) !== null && _g !== void 0 ? _g : (() => { }),
|
||||
onPublicDirCopyProgress: (_h = actualArgs.onPublicDirCopyProgress) !== null && _h !== void 0 ? _h : (() => { }),
|
||||
onSymlinkDetected: (_j = actualArgs.onSymlinkDetected) !== null && _j !== void 0 ? _j : (() => { }),
|
||||
outDir: (_k = actualArgs.outDir) !== null && _k !== void 0 ? _k : null,
|
||||
publicDir: (_l = actualArgs.publicDir) !== null && _l !== void 0 ? _l : null,
|
||||
publicPath: (_m = actualArgs.publicPath) !== null && _m !== void 0 ? _m : null,
|
||||
rootDir: (_o = actualArgs.rootDir) !== null && _o !== void 0 ? _o : null,
|
||||
webpackOverride: (_p = actualArgs.webpackOverride) !== null && _p !== void 0 ? _p : ((f) => f),
|
||||
audioLatencyHint: (_q = actualArgs.audioLatencyHint) !== null && _q !== void 0 ? _q : null,
|
||||
experimentalClientSideRenderingEnabled: (_r = actualArgs.experimentalClientSideRenderingEnabled) !== null && _r !== void 0 ? _r : false,
|
||||
renderDefaults: (_s = actualArgs.renderDefaults) !== null && _s !== void 0 ? _s : null,
|
||||
askAIEnabled: (_t = actualArgs.askAIEnabled) !== null && _t !== void 0 ? _t : true,
|
||||
keyboardShortcutsEnabled: (_u = actualArgs.keyboardShortcutsEnabled) !== null && _u !== void 0 ? _u : true,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
import type { Compiler } from 'webpack';
|
||||
export declare class CaseSensitivePathsPlugin {
|
||||
fs: Compiler['inputFileSystem'];
|
||||
context: string;
|
||||
cacheMap: Map<string, string[]>;
|
||||
deferrerMap: Map<string, Promise<string[]>>;
|
||||
/**
|
||||
* Check if resource need to be checked
|
||||
*/
|
||||
isCheckable(res: string, type?: string, issuer?: string): boolean;
|
||||
/**
|
||||
* Check if file exists with case sensitive
|
||||
*/
|
||||
checkFileExistsWithCase(res: string): Promise<unknown>;
|
||||
/**
|
||||
* reset this plugin, wait for the next compilation
|
||||
*/
|
||||
reset(): void;
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
Generated
Vendored
+143
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CaseSensitivePathsPlugin = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
// Inlined from https://github.com/umijs/case-sensitive-paths-webpack-plugin/blob/master/src/index.ts
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022-present UmiJS Team
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
const PLUGIN_NAME = 'CaseSensitive';
|
||||
class CaseSensitivePathsPlugin {
|
||||
constructor() {
|
||||
this.context = '';
|
||||
this.cacheMap = new Map();
|
||||
this.deferrerMap = new Map();
|
||||
}
|
||||
/**
|
||||
* Check if resource need to be checked
|
||||
*/
|
||||
isCheckable(res, type, issuer) {
|
||||
return (
|
||||
// skip base64 url in css files
|
||||
type !== 'asset/inline' &&
|
||||
// skip resources which outside project
|
||||
res.startsWith(this.context) &&
|
||||
// skip node_modules
|
||||
!/(\/|\\)node_modules\1/.test(res) &&
|
||||
// skip duplicated css resource by unknown reason
|
||||
res !== issuer);
|
||||
}
|
||||
/**
|
||||
* Check if file exists with case sensitive
|
||||
*/
|
||||
checkFileExistsWithCase(res) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let full = res;
|
||||
let caseError = null;
|
||||
const deferrers = [];
|
||||
// check every level directories for resource, except outside project
|
||||
while (full.length > this.context.length) {
|
||||
const { dir, base: current } = path_1.default.parse(full);
|
||||
let deferrer;
|
||||
if (this.cacheMap.get(dir)) {
|
||||
// use cache first
|
||||
deferrer = Promise.resolve(this.cacheMap.get(dir));
|
||||
}
|
||||
else if (this.deferrerMap.get(dir)) {
|
||||
// wait another same directory to be resolved
|
||||
deferrer = this.deferrerMap.get(dir);
|
||||
}
|
||||
else {
|
||||
// read directory for the first time
|
||||
deferrer = new Promise((resolve2) => {
|
||||
this.fs.readdir(dir, (_, files = []) => {
|
||||
// save cache, resolve promise and release deferrer
|
||||
this.cacheMap.set(dir, files);
|
||||
resolve2(files);
|
||||
this.deferrerMap.delete(dir);
|
||||
});
|
||||
});
|
||||
// save deferrer for another called
|
||||
this.deferrerMap.set(dir, deferrer);
|
||||
}
|
||||
// check current file synchronously, for performance
|
||||
deferrer.then((files) => {
|
||||
// try to find correct name
|
||||
// if current file not exists in current directory and there has no existing error
|
||||
if (!files.includes(current) && !caseError) {
|
||||
const correctName = files.find((file) => file.toLowerCase() === current.toLowerCase());
|
||||
// only throw first error for the single resource
|
||||
if (correctName) {
|
||||
caseError = new Error(`Capitalization mismatch in \`${path_1.default.join(res)}\`: \`${current}\` does not match the name on disk \`${correctName}\``);
|
||||
reject(caseError);
|
||||
}
|
||||
}
|
||||
});
|
||||
deferrers.push(deferrer);
|
||||
// continue to check upper directory
|
||||
full = dir;
|
||||
}
|
||||
Promise.all(deferrers).then(() => {
|
||||
// resolve if no error
|
||||
if (!caseError) {
|
||||
resolve(caseError);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* reset this plugin, wait for the next compilation
|
||||
*/
|
||||
reset() {
|
||||
this.cacheMap = new Map();
|
||||
this.deferrerMap = new Map();
|
||||
}
|
||||
apply(compiler) {
|
||||
this.context = compiler.options.context || process.cwd();
|
||||
this.fs = compiler.inputFileSystem;
|
||||
compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (factory) => {
|
||||
factory.hooks.afterResolve.tapAsync(PLUGIN_NAME, (data, done) => {
|
||||
var _a, _b;
|
||||
// compatible with webpack 4.x
|
||||
const { createData = data } = data;
|
||||
if (createData.resource &&
|
||||
this.isCheckable(createData.resource, createData.type, (_b = (_a = createData.resourceResolveData) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.issuer)) {
|
||||
this.checkFileExistsWithCase(createData.resource
|
||||
.replace(/\?.+$/, '')
|
||||
// replace escaped \0# with # see: https://github.com/webpack/enhanced-resolve#escaping
|
||||
.replace('\u0000#', '#')).then(() => done(null), (err) => done(err));
|
||||
}
|
||||
else {
|
||||
done(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
compiler.hooks.done.tap(PLUGIN_NAME, () => {
|
||||
this.reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.CaseSensitivePathsPlugin = CaseSensitivePathsPlugin;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import fs from 'node:fs';
|
||||
export declare function copyDir({ src, dest, onSymlinkDetected, onProgress, copiedBytes, lastReportedProgress, }: {
|
||||
src: string;
|
||||
dest: string;
|
||||
onSymlinkDetected: (entry: fs.Dirent, dir: string) => void;
|
||||
onProgress: (bytes: number) => void;
|
||||
copiedBytes: number;
|
||||
lastReportedProgress: number;
|
||||
}): Promise<number>;
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.copyDir = copyDir;
|
||||
const node_fs_1 = __importDefault(require("node:fs"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
async function copyDir({ src, dest, onSymlinkDetected, onProgress, copiedBytes = 0, lastReportedProgress = 0, }) {
|
||||
await node_fs_1.default.promises.mkdir(dest, { recursive: true });
|
||||
const entries = await node_fs_1.default.promises.readdir(src, { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
const srcPath = node_path_1.default.join(src, entry.name);
|
||||
const destPath = node_path_1.default.join(dest, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
copiedBytes = await copyDir({
|
||||
src: srcPath,
|
||||
dest: destPath,
|
||||
onSymlinkDetected,
|
||||
onProgress,
|
||||
copiedBytes,
|
||||
lastReportedProgress,
|
||||
});
|
||||
}
|
||||
else if (entry.isSymbolicLink()) {
|
||||
const realpath = await node_fs_1.default.promises.realpath(srcPath);
|
||||
onSymlinkDetected(entry, src);
|
||||
await node_fs_1.default.promises.symlink(realpath, destPath);
|
||||
}
|
||||
else {
|
||||
const [, { size }] = await Promise.all([
|
||||
node_fs_1.default.promises.copyFile(srcPath, destPath),
|
||||
node_fs_1.default.promises.stat(srcPath),
|
||||
]);
|
||||
copiedBytes += size;
|
||||
if (copiedBytes - lastReportedProgress > 1024 * 1024 * 10) {
|
||||
onProgress(copiedBytes);
|
||||
lastReportedProgress = copiedBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
return copiedBytes;
|
||||
}
|
||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import type webpack from 'webpack';
|
||||
import type { LoaderOptions } from './interfaces';
|
||||
declare function ESBuildLoader(this: webpack.LoaderContext<LoaderOptions>, source: string): Promise<void>;
|
||||
export default ESBuildLoader;
|
||||
Generated
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const esbuild_1 = require("esbuild");
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const isTsExtensionPtrn = /\.ts$/i;
|
||||
const isTypescriptInstalled = () => {
|
||||
try {
|
||||
require.resolve('typescript');
|
||||
return true;
|
||||
}
|
||||
catch (_a) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
async function ESBuildLoader(source) {
|
||||
var _a, _b, _c;
|
||||
const done = this.async();
|
||||
const options = this.getOptions();
|
||||
const { implementation, remotionRoot, ...esbuildTransformOptions } = options;
|
||||
const tsConfigPath = node_path_1.default.join(remotionRoot, 'tsconfig.json');
|
||||
if (implementation && typeof implementation.transform !== 'function') {
|
||||
done(new TypeError(`esbuild-loader: options.implementation.transform must be an ESBuild transform function. Received ${typeof implementation.transform}`));
|
||||
return;
|
||||
}
|
||||
const transform = (_a = implementation === null || implementation === void 0 ? void 0 : implementation.transform) !== null && _a !== void 0 ? _a : esbuild_1.transform;
|
||||
const transformOptions = {
|
||||
...esbuildTransformOptions,
|
||||
target: (_b = options.target) !== null && _b !== void 0 ? _b : 'es2015',
|
||||
loader: (_c = options.loader) !== null && _c !== void 0 ? _c : 'js',
|
||||
sourcemap: this.sourceMap,
|
||||
sourcefile: this.resourcePath,
|
||||
};
|
||||
if (!('tsconfigRaw' in transformOptions) && isTypescriptInstalled()) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
const typescript = require('typescript');
|
||||
const tsConfig = typescript.readConfigFile(tsConfigPath, typescript.sys.readFile);
|
||||
transformOptions.tsconfigRaw = tsConfig.config;
|
||||
}
|
||||
// https://github.com/privatenumber/esbuild-loader/pull/107
|
||||
if (transformOptions.loader === 'tsx' &&
|
||||
isTsExtensionPtrn.test(this.resourcePath)) {
|
||||
transformOptions.loader = 'ts';
|
||||
}
|
||||
try {
|
||||
const { code, map } = await transform(source, transformOptions);
|
||||
done(null, code, map && JSON.parse(map));
|
||||
}
|
||||
catch (error) {
|
||||
done(error);
|
||||
}
|
||||
}
|
||||
exports.default = ESBuildLoader;
|
||||
Generated
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
import type { transform, TransformOptions } from 'esbuild';
|
||||
type Implementation = {
|
||||
transform: typeof transform;
|
||||
};
|
||||
type Except<ObjectType, Properties> = {
|
||||
[Key in keyof ObjectType as Key extends Properties ? never : Key]: ObjectType[Key];
|
||||
};
|
||||
export type LoaderOptions = Except<TransformOptions, 'sourcemap' | 'sourcefile'> & {
|
||||
implementation: Implementation;
|
||||
remotionRoot: string;
|
||||
};
|
||||
export {};
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
Generated
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
declare function registerExportsForReactRefresh(moduleExports: unknown, moduleID: unknown): void;
|
||||
declare function isReactRefreshBoundary(moduleExports: unknown): boolean;
|
||||
declare function getRefreshBoundarySignature(moduleExports: unknown): any[];
|
||||
declare function shouldInvalidateReactRefreshBoundary(prevExports: unknown, nextExports: unknown): boolean;
|
||||
declare function scheduleUpdate(): void;
|
||||
declare const _default: {
|
||||
registerExportsForReactRefresh: typeof registerExportsForReactRefresh;
|
||||
isReactRefreshBoundary: typeof isReactRefreshBoundary;
|
||||
shouldInvalidateReactRefreshBoundary: typeof shouldInvalidateReactRefreshBoundary;
|
||||
getRefreshBoundarySignature: typeof getRefreshBoundarySignature;
|
||||
scheduleUpdate: typeof scheduleUpdate;
|
||||
};
|
||||
export default _default;
|
||||
Generated
Vendored
+146
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// This file is copied from the Metro JavaScript bundler, with minor tweaks for
|
||||
// webpack compatibility.
|
||||
//
|
||||
// https://github.com/facebook/metro/blob/d6b9685c730d0d63577db40f41369157f28dfa3a/packages/metro/src/lib/polyfills/require.js
|
||||
const RefreshRuntime = require('react-refresh/runtime');
|
||||
function isSafeExport(key) {
|
||||
return (key === '__esModule' ||
|
||||
key === '__N_SSG' ||
|
||||
key === '__N_SSP' ||
|
||||
key === 'config');
|
||||
}
|
||||
function registerExportsForReactRefresh(moduleExports, moduleID) {
|
||||
RefreshRuntime.register(moduleExports, moduleID + ' %exports%');
|
||||
if (moduleExports === null ||
|
||||
moduleExports === undefined ||
|
||||
typeof moduleExports !== 'object') {
|
||||
// Exit if we can't iterate over exports.
|
||||
// (This is important for legacy environments.)
|
||||
return;
|
||||
}
|
||||
for (const key in moduleExports) {
|
||||
if (isSafeExport(key)) {
|
||||
continue;
|
||||
}
|
||||
// @ts-expect-error
|
||||
const exportValue = moduleExports[key];
|
||||
const typeID = moduleID + ' %exports% ' + key;
|
||||
RefreshRuntime.register(exportValue, typeID);
|
||||
}
|
||||
}
|
||||
function isReactRefreshBoundary(moduleExports) {
|
||||
if (RefreshRuntime.isLikelyComponentType(moduleExports)) {
|
||||
return true;
|
||||
}
|
||||
if (moduleExports === null ||
|
||||
moduleExports === undefined ||
|
||||
typeof moduleExports !== 'object') {
|
||||
// Exit if we can't iterate over exports.
|
||||
return false;
|
||||
}
|
||||
let hasExports = false;
|
||||
let areAllExportsComponents = true;
|
||||
for (const key in moduleExports) {
|
||||
hasExports = true;
|
||||
if (isSafeExport(key)) {
|
||||
continue;
|
||||
}
|
||||
// @ts-expect-error
|
||||
const exportValue = moduleExports[key];
|
||||
if (!RefreshRuntime.isLikelyComponentType(exportValue)) {
|
||||
areAllExportsComponents = false;
|
||||
}
|
||||
}
|
||||
return hasExports && areAllExportsComponents;
|
||||
}
|
||||
function getRefreshBoundarySignature(moduleExports) {
|
||||
const signature = [];
|
||||
signature.push(RefreshRuntime.getFamilyByType(moduleExports));
|
||||
if (moduleExports === null ||
|
||||
moduleExports === undefined ||
|
||||
typeof moduleExports !== 'object') {
|
||||
// Exit if we can't iterate over exports.
|
||||
// (This is important for legacy environments.)
|
||||
return signature;
|
||||
}
|
||||
for (const key in moduleExports) {
|
||||
if (isSafeExport(key)) {
|
||||
continue;
|
||||
}
|
||||
// @ts-expect-error
|
||||
const exportValue = moduleExports[key];
|
||||
signature.push(key);
|
||||
signature.push(RefreshRuntime.getFamilyByType(exportValue));
|
||||
}
|
||||
return signature;
|
||||
}
|
||||
function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
|
||||
const prevSignature = getRefreshBoundarySignature(prevExports);
|
||||
const nextSignature = getRefreshBoundarySignature(nextExports);
|
||||
if (prevSignature.length !== nextSignature.length) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < nextSignature.length; i++) {
|
||||
if (prevSignature[i] !== nextSignature[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function scheduleUpdate() {
|
||||
var _a, _b;
|
||||
const execute = () => {
|
||||
try {
|
||||
RefreshRuntime.performReactRefresh();
|
||||
}
|
||||
catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Warning: Failed to re-render. We will retry on the next Fast Refresh event.\n' +
|
||||
err);
|
||||
}
|
||||
};
|
||||
// Only trigger refresh if the webpack HMR state is idle
|
||||
if (((_a = __webpack_module__.hot) === null || _a === void 0 ? void 0 : _a.status()) === 'idle') {
|
||||
return;
|
||||
}
|
||||
(_b = __webpack_module__.hot) === null || _b === void 0 ? void 0 : _b.addStatusHandler((status) => {
|
||||
if (status === 'idle') {
|
||||
execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.default = {
|
||||
registerExportsForReactRefresh,
|
||||
isReactRefreshBoundary,
|
||||
shouldInvalidateReactRefreshBoundary,
|
||||
getRefreshBoundarySignature,
|
||||
scheduleUpdate,
|
||||
};
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Vercel, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import type webpack from 'webpack';
|
||||
export declare class ReactFreshWebpackPlugin {
|
||||
apply(compiler: webpack.Compiler): void;
|
||||
}
|
||||
Generated
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReactFreshWebpackPlugin = void 0;
|
||||
const webpack_1 = require("webpack");
|
||||
class ReactRefreshRuntimeModule extends webpack_1.RuntimeModule {
|
||||
constructor() {
|
||||
super('react refresh', 5);
|
||||
}
|
||||
generate() {
|
||||
const { runtimeTemplate } = this.compilation;
|
||||
return webpack_1.Template.asString([
|
||||
`${webpack_1.RuntimeGlobals.interceptModuleExecution}.push(${runtimeTemplate.basicFunction('options', [
|
||||
`const originalFactory = options.factory;`,
|
||||
`options.factory = ${runtimeTemplate.basicFunction('moduleObject, moduleExports, webpackRequire', [
|
||||
// Legacy CSS implementations will `eval` browser code in a Node.js
|
||||
// context to extract CSS. For backwards compatibility, we need to check
|
||||
// we're in a browser context before continuing.
|
||||
`const hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$;`,
|
||||
`const cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : () => {};`,
|
||||
'try {',
|
||||
webpack_1.Template.indent('originalFactory.call(this, moduleObject, moduleExports, webpackRequire);'),
|
||||
'} finally {',
|
||||
webpack_1.Template.indent(`cleanup();`),
|
||||
'}',
|
||||
])}`,
|
||||
])})`,
|
||||
]);
|
||||
}
|
||||
}
|
||||
class ReactFreshWebpackPlugin {
|
||||
apply(compiler) {
|
||||
const webpackMajorVersion = parseInt(webpack_1.version !== null && webpack_1.version !== void 0 ? webpack_1.version : '', 10);
|
||||
if (webpackMajorVersion < 5) {
|
||||
throw new Error(`ReactFreshWebpackPlugin does not support webpack v${webpackMajorVersion}.`);
|
||||
}
|
||||
compiler.hooks.compilation.tap(this.constructor.name, (compilation) => {
|
||||
compilation.mainTemplate.hooks.localVars.tap(this.constructor.name, (source) => webpack_1.Template.asString([
|
||||
source,
|
||||
'',
|
||||
'// noop fns to prevent runtime errors during initialization',
|
||||
'if (typeof self !== "undefined") {',
|
||||
webpack_1.Template.indent('self.$RefreshReg$ = function () {};'),
|
||||
webpack_1.Template.indent('self.$RefreshSig$ = function () {'),
|
||||
webpack_1.Template.indent(webpack_1.Template.indent('return function (type) {')),
|
||||
webpack_1.Template.indent(webpack_1.Template.indent(webpack_1.Template.indent('return type;'))),
|
||||
webpack_1.Template.indent(webpack_1.Template.indent('};')),
|
||||
webpack_1.Template.indent('};'),
|
||||
'}',
|
||||
]));
|
||||
compilation.hooks.additionalTreeRuntimeRequirements.tap(this.constructor.name, (chunk) => {
|
||||
compilation.addRuntimeModule(chunk, new ReactRefreshRuntimeModule());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ReactFreshWebpackPlugin = ReactFreshWebpackPlugin;
|
||||
Generated
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* ⚠️ Be careful when refactoring this file!
|
||||
* This gets injected into every file of the browser.
|
||||
* You cannot have returns, optional chains, inverse the if statement etc.
|
||||
* Check the Typescript output in dist/ to see that no extra `var` statements were produced
|
||||
*/
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Vercel, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import type { LoaderDefinition } from 'webpack';
|
||||
declare global {
|
||||
const __webpack_hash__: unknown;
|
||||
interface HotNotifierInfo {
|
||||
type: 'self-declined' | 'declined' | 'unaccepted' | 'accepted' | 'disposed' | 'accept-errored' | 'self-accept-errored' | 'self-accept-error-handler-errored';
|
||||
/**
|
||||
* The module in question.
|
||||
*/
|
||||
moduleId: number;
|
||||
/**
|
||||
* For errors: the module id owning the accept handler.
|
||||
*/
|
||||
dependencyId?: number | undefined;
|
||||
/**
|
||||
* For declined/accepted/unaccepted: the chain from where the update was propagated.
|
||||
*/
|
||||
chain?: number[] | undefined;
|
||||
/**
|
||||
* For declined: the module id of the declining parent
|
||||
*/
|
||||
parentId?: number | undefined;
|
||||
/**
|
||||
* For accepted: the modules that are outdated and will be disposed
|
||||
*/
|
||||
outdatedModules?: number[] | undefined;
|
||||
/**
|
||||
* For accepted: The location of accept handlers that will handle the update
|
||||
*/
|
||||
outdatedDependencies?: {
|
||||
[dependencyId: number]: number[];
|
||||
} | undefined;
|
||||
/**
|
||||
* For errors: the thrown error
|
||||
*/
|
||||
error?: Error | undefined;
|
||||
/**
|
||||
* For self-accept-error-handler-errored: the error thrown by the module
|
||||
* before the error handler tried to handle it.
|
||||
*/
|
||||
originalError?: Error | undefined;
|
||||
}
|
||||
interface AcceptOptions {
|
||||
/**
|
||||
* If true the update process continues even if some modules are not accepted (and would bubble to the entry point).
|
||||
*/
|
||||
ignoreUnaccepted?: boolean | undefined;
|
||||
/**
|
||||
* Ignore changes made to declined modules.
|
||||
*/
|
||||
ignoreDeclined?: boolean | undefined;
|
||||
/**
|
||||
* Ignore errors throw in accept handlers, error handlers and while reevaluating module.
|
||||
*/
|
||||
ignoreErrored?: boolean | undefined;
|
||||
/**
|
||||
* Notifier for declined modules.
|
||||
*/
|
||||
onDeclined?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for unaccepted modules.
|
||||
*/
|
||||
onUnaccepted?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for accepted modules.
|
||||
*/
|
||||
onAccepted?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for disposed modules.
|
||||
*/
|
||||
onDisposed?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for errors.
|
||||
*/
|
||||
onErrored?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Indicates that apply() is automatically called by check function
|
||||
*/
|
||||
autoApply?: boolean | undefined;
|
||||
}
|
||||
const __webpack_module__: {
|
||||
id: string;
|
||||
exports: unknown;
|
||||
hot: {
|
||||
accept: () => void;
|
||||
dispose: (onDispose: (data: Record<string, unknown>) => void) => void;
|
||||
invalidate: () => void;
|
||||
data?: Record<string, unknown>;
|
||||
addStatusHandler(callback: (status: string) => void): void;
|
||||
status(): string;
|
||||
apply(options?: AcceptOptions): Promise<ModuleId[]>;
|
||||
check(autoApply?: boolean): Promise<null | ModuleId[]>;
|
||||
};
|
||||
};
|
||||
type ModuleId = string | number;
|
||||
}
|
||||
declare const ReactRefreshLoader: LoaderDefinition;
|
||||
export default ReactRefreshLoader;
|
||||
Generated
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
/**
|
||||
* ⚠️ Be careful when refactoring this file!
|
||||
* This gets injected into every file of the browser.
|
||||
* You cannot have returns, optional chains, inverse the if statement etc.
|
||||
* Check the Typescript output in dist/ to see that no extra `var` statements were produced
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// This file is copied from the @vercel/next.js, with removed TS annotations
|
||||
//
|
||||
// https://github.com/vercel/next.js/blob/canary/packages/react-refresh-utils/loader.ts
|
||||
// This function gets unwrapped into global scope, which is why we don't invert
|
||||
// if-blocks. Also, you cannot use `return`.
|
||||
function RefreshModuleRuntime() {
|
||||
var _a, _b;
|
||||
// Legacy CSS implementations will `eval` browser code in a Node.js context
|
||||
// to extract CSS. For backwards compatibility, we need to check we're in a
|
||||
// browser context before continuing.
|
||||
if (typeof self !== 'undefined' &&
|
||||
// AMP / No-JS mode does not inject these helpers:
|
||||
'$RefreshHelpers$' in self) {
|
||||
const currentExports = __webpack_module__.exports;
|
||||
const prevExports = (_b = (_a = __webpack_module__.hot.data) === null || _a === void 0 ? void 0 : _a.prevExports) !== null && _b !== void 0 ? _b : null;
|
||||
// This cannot happen in MainTemplate because the exports mismatch between
|
||||
// templating and execution.
|
||||
self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports, __webpack_module__.id);
|
||||
// A module can be accepted automatically based on its exports, e.g. when
|
||||
// it is a Refresh Boundary.
|
||||
if (self.$RefreshHelpers$.isReactRefreshBoundary(currentExports)) {
|
||||
// Save the previous exports on update so we can compare the boundary
|
||||
// signatures.
|
||||
__webpack_module__.hot.dispose((data) => {
|
||||
data.prevExports = currentExports;
|
||||
});
|
||||
// Unconditionally accept an update to this module, we'll check if it's
|
||||
// still a Refresh Boundary later.
|
||||
__webpack_module__.hot.accept();
|
||||
// This field is set when the previous version of this module was a
|
||||
// Refresh Boundary, letting us know we need to check for invalidation or
|
||||
// enqueue an update.
|
||||
if (prevExports !== null) {
|
||||
// A boundary can become ineligible if its exports are incompatible
|
||||
// with the previous exports.
|
||||
//
|
||||
// For example, if you add/remove/change exports, we'll want to
|
||||
// re-execute the importing modules, and force those components to
|
||||
// re-render. Similarly, if you convert a class component to a
|
||||
// function, we want to invalidate the boundary.
|
||||
if (self.$RefreshHelpers$.shouldInvalidateReactRefreshBoundary(prevExports, currentExports)) {
|
||||
__webpack_module__.hot.invalidate();
|
||||
}
|
||||
else {
|
||||
self.$RefreshHelpers$.scheduleUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Since we just executed the code for the module, it's possible that the
|
||||
// new exports made it ineligible for being a boundary.
|
||||
// We only care about the case when we were _previously_ a boundary,
|
||||
// because we already accepted this update (accidental side effect).
|
||||
const isNoLongerABoundary = prevExports !== null;
|
||||
if (isNoLongerABoundary) {
|
||||
__webpack_module__.hot.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let refreshModuleRuntime = RefreshModuleRuntime.toString();
|
||||
refreshModuleRuntime = refreshModuleRuntime.slice(refreshModuleRuntime.indexOf('{') + 1, refreshModuleRuntime.lastIndexOf('}'));
|
||||
const ReactRefreshLoader = function (source, inputSourceMap) {
|
||||
// Importing a module that declares the global variables _a and _b
|
||||
// will conflict with the global variables that React Fast Refresh uses.
|
||||
// https://github.com/remotion-dev/remotion/issues/3699
|
||||
const renamedSymbols = refreshModuleRuntime
|
||||
.replace(/_a/g, '_remotion_globalVariableA')
|
||||
.replace(/_b/g, '_remotion_globalVariableB');
|
||||
this.callback(null, `${source}\n;${renamedSymbols}`, inputSourceMap);
|
||||
};
|
||||
exports.default = ReactRefreshLoader;
|
||||
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Vercel, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
declare global {
|
||||
interface Window {
|
||||
$RefreshReg$: (type: string, id?: string) => void;
|
||||
$RefreshSig$: () => (type: string) => unknown;
|
||||
$RefreshHelpers$: typeof RefreshHelpers;
|
||||
$RefreshInterceptModuleExecution$: (webpackId: unknown) => () => void;
|
||||
}
|
||||
}
|
||||
import RefreshHelpers from './helpers';
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const RefreshRuntime = require('react-refresh/runtime');
|
||||
const helpers_1 = __importDefault(require("./helpers"));
|
||||
// Hook into ReactDOM initialization
|
||||
RefreshRuntime.injectIntoGlobalHook(self);
|
||||
// noop fns to prevent runtime errors during initialization
|
||||
self.$RefreshReg$ = () => undefined;
|
||||
self.$RefreshSig$ = () => (type) => type;
|
||||
// Register global helpers
|
||||
self.$RefreshHelpers$ = helpers_1.default;
|
||||
// Register a helper for module execution interception
|
||||
self.$RefreshInterceptModuleExecution$ = function (webpackModuleId) {
|
||||
const prevRefreshReg = self.$RefreshReg$;
|
||||
const prevRefreshSig = self.$RefreshSig$;
|
||||
self.$RefreshReg$ = (type, id) => {
|
||||
RefreshRuntime.register(type, webpackModuleId + ' ' + id);
|
||||
};
|
||||
self.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
||||
// Modeled after `useEffect` cleanup pattern:
|
||||
return () => {
|
||||
self.$RefreshReg$ = prevRefreshReg;
|
||||
self.$RefreshSig$ = prevRefreshSig;
|
||||
};
|
||||
};
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import type { Compiler } from 'webpack';
|
||||
export declare class AllowDependencyExpressionPlugin {
|
||||
filter(error: Error): boolean;
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
// When Webpack cannot resolve these dependencies, it will not print an error message.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AllowDependencyExpressionPlugin = void 0;
|
||||
// If importing TypeScript, it will give this warning:
|
||||
// WARNING in ./node_modules/typescript/lib/typescript.js 6304:33-52
|
||||
// Critical dependency: the request of a dependency is an expression
|
||||
class AllowDependencyExpressionPlugin {
|
||||
filter(error) {
|
||||
if (error.message.includes('the request of a dependency is an expression')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
apply(compiler) {
|
||||
compiler.hooks.afterCompile.tap('Com', (compilation) => {
|
||||
compilation.errors = compilation.errors.filter(this.filter);
|
||||
});
|
||||
compiler.hooks.afterEmit.tap('AllowOptionalDependenciesPlugin', (compilation) => {
|
||||
compilation.errors = compilation.errors.filter(this.filter);
|
||||
compilation.warnings = compilation.warnings.filter(this.filter);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.AllowDependencyExpressionPlugin = AllowDependencyExpressionPlugin;
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import type { Compiler } from 'webpack';
|
||||
export declare class IgnorePackFileCacheWarningsPlugin {
|
||||
filter(error: Error): boolean;
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
// Suppress the frequent Webpack warnings about serializing large strings in the cache
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IgnorePackFileCacheWarningsPlugin = void 0;
|
||||
class IgnorePackFileCacheWarningsPlugin {
|
||||
filter(error) {
|
||||
if (error.message.includes('Serializing big strings')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
apply(compiler) {
|
||||
compiler.hooks.afterCompile.tap('IgnorePackFileCacheWarningsPlugin', (compilation) => {
|
||||
compilation.warnings = compilation.warnings.filter(this.filter);
|
||||
});
|
||||
compiler.hooks.afterEmit.tap('IgnorePackFileCacheWarningsPlugin', (compilation) => {
|
||||
compilation.warnings = compilation.warnings.filter(this.filter);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.IgnorePackFileCacheWarningsPlugin = IgnorePackFileCacheWarningsPlugin;
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
import type { GitSource, PackageManager, RenderDefaults } from '@remotion/studio-shared';
|
||||
import type { LogLevel, StaticFile } from 'remotion';
|
||||
export declare const indexHtml: ({ publicPath, editorName, inputProps, envVariables, staticHash, remotionRoot, studioServerCommand, renderQueue, completedClientRenders, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, publicFolderExists, gitSource, projectName, installedDependencies, packageManager, audioLatencyHint, logLevel, mode, }: {
|
||||
staticHash: string;
|
||||
publicPath: string;
|
||||
editorName: string | null;
|
||||
inputProps: object | null;
|
||||
envVariables?: Record<string, string>;
|
||||
remotionRoot: string;
|
||||
studioServerCommand: string | null;
|
||||
renderQueue: unknown | null;
|
||||
completedClientRenders?: unknown | null;
|
||||
numberOfAudioTags: number;
|
||||
audioLatencyHint: AudioContextLatencyCategory;
|
||||
publicFiles: StaticFile[];
|
||||
publicFolderExists: string | null;
|
||||
includeFavicon: boolean;
|
||||
title: string;
|
||||
renderDefaults: RenderDefaults | undefined;
|
||||
gitSource: GitSource | null;
|
||||
projectName: string;
|
||||
installedDependencies: string[] | null;
|
||||
packageManager: PackageManager | "unknown";
|
||||
logLevel: LogLevel;
|
||||
mode: "dev" | "bundle";
|
||||
}) => string;
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.indexHtml = void 0;
|
||||
const remotion_1 = require("remotion");
|
||||
const indexHtml = ({ publicPath, editorName, inputProps, envVariables, staticHash, remotionRoot, studioServerCommand, renderQueue, completedClientRenders, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, publicFolderExists, gitSource, projectName, installedDependencies, packageManager, audioLatencyHint, logLevel, mode, }) =>
|
||||
// Must setup remotion_editorName and remotion.remotion_projectName before bundle.js is loaded
|
||||
`
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
${includeFavicon
|
||||
? `<link id="__remotion_favicon" rel="icon" type="image/png" href="${publicPath}favicon.ico" />`
|
||||
: ''}
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>window.remotion_numberOfAudioTags = ${numberOfAudioTags};</script>
|
||||
<script>window.remotion_audioLatencyHint = "${audioLatencyHint}";</script>
|
||||
${mode === 'dev' ? `<script>window.remotion_logLevel = "${logLevel}";</script>` : ''}
|
||||
<script>window.remotion_staticBase = "${staticHash}";</script>
|
||||
${editorName
|
||||
? `<script>window.remotion_editorName = "${editorName}";</script>`
|
||||
: '<script>window.remotion_editorName = null;</script>'}
|
||||
<script>window.remotion_projectName = ${JSON.stringify(projectName)};</script>
|
||||
<script>window.remotion_publicPath = ${JSON.stringify(publicPath)};</script>
|
||||
<script>window.remotion_audioEnabled = true;</script>
|
||||
<script>window.remotion_videoEnabled = true;</script>
|
||||
<script>window.remotion_renderDefaults = ${JSON.stringify(renderDefaults)};</script>
|
||||
<script>window.remotion_cwd = ${JSON.stringify(remotionRoot)};</script>
|
||||
<script>window.remotion_studioServerCommand = ${studioServerCommand ? JSON.stringify(studioServerCommand) : 'null'};</script>
|
||||
${inputProps
|
||||
? `<script>window.remotion_inputProps = ${JSON.stringify(JSON.stringify(inputProps))};</script>`
|
||||
: ''}
|
||||
${renderQueue
|
||||
? `<script>window.remotion_initialRenderQueue = ${JSON.stringify(renderQueue)};</script>`
|
||||
: ''}
|
||||
${completedClientRenders
|
||||
? `<script>window.remotion_initialClientRenders = ${JSON.stringify(completedClientRenders)};</script>`
|
||||
: ''}
|
||||
${envVariables
|
||||
? `<script>window.process = {env: ${JSON.stringify(envVariables)}};</script>`
|
||||
: ''}
|
||||
${gitSource
|
||||
? `<script>window.remotion_gitSource = ${JSON.stringify(gitSource)};</script>`
|
||||
: ''}
|
||||
${mode === 'dev'
|
||||
? `
|
||||
<script>window.remotion_isStudio = true;</script>
|
||||
<script>window.remotion_isReadOnlyStudio = false;</script>`.trimStart()
|
||||
: ''}
|
||||
<script>window.remotion_staticFiles = ${JSON.stringify(publicFiles)}</script>
|
||||
<script>window.remotion_installedPackages = ${JSON.stringify(installedDependencies)}</script>
|
||||
<script>window.remotion_packageManager = ${JSON.stringify(packageManager)}</script>
|
||||
<script>window.remotion_publicFolderExists = ${publicFolderExists ? `"${publicFolderExists}"` : 'null'};</script>
|
||||
<script>
|
||||
window.siteVersion = '11';
|
||||
window.remotion_version = '${remotion_1.VERSION}';
|
||||
</script>
|
||||
|
||||
<div id="video-container"></div>
|
||||
<div id="${remotion_1.Internals.REMOTION_STUDIO_CONTAINER_ELEMENT}"></div>
|
||||
<div id="menuportal-0"></div>
|
||||
<div id="menuportal-1"></div>
|
||||
<div id="menuportal-2"></div>
|
||||
<div id="menuportal-3"></div>
|
||||
<div id="menuportal-4"></div>
|
||||
<div id="menuportal-5"></div>
|
||||
<div id="remotion-error-overlay"></div>
|
||||
<div id="server-disconnected-overlay"></div>
|
||||
<script src="${publicPath}bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
`.trim();
|
||||
exports.indexHtml = indexHtml;
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
import esbuild = require('esbuild');
|
||||
import webpack = require('webpack');
|
||||
export declare const BundlerInternals: {
|
||||
esbuild: typeof esbuild;
|
||||
webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, poll, experimentalClientSideRenderingEnabled, askAIEnabled, }: {
|
||||
entry: string;
|
||||
userDefinedComponent: string;
|
||||
outDir: string | null;
|
||||
environment: "development" | "production";
|
||||
webpackOverride: import("./webpack-config").WebpackOverrideFn;
|
||||
onProgress?: (f: number) => void;
|
||||
enableCaching?: boolean;
|
||||
maxTimelineTracks: number | null;
|
||||
keyboardShortcutsEnabled: boolean;
|
||||
bufferStateDelayInMilliseconds: number | null;
|
||||
remotionRoot: string;
|
||||
poll: number | null;
|
||||
askAIEnabled: boolean;
|
||||
experimentalClientSideRenderingEnabled: boolean;
|
||||
}) => Promise<[string, import("./webpack-config").WebpackConfiguration]>;
|
||||
indexHtml: ({ publicPath, editorName, inputProps, envVariables, staticHash, remotionRoot, studioServerCommand, renderQueue, completedClientRenders, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, publicFolderExists, gitSource, projectName, installedDependencies, packageManager, audioLatencyHint, logLevel, mode, }: {
|
||||
staticHash: string;
|
||||
publicPath: string;
|
||||
editorName: string | null;
|
||||
inputProps: object | null;
|
||||
envVariables?: Record<string, string>;
|
||||
remotionRoot: string;
|
||||
studioServerCommand: string | null;
|
||||
renderQueue: unknown | null;
|
||||
completedClientRenders?: unknown | null;
|
||||
numberOfAudioTags: number;
|
||||
audioLatencyHint: AudioContextLatencyCategory;
|
||||
publicFiles: import("remotion").StaticFile[];
|
||||
publicFolderExists: string | null;
|
||||
includeFavicon: boolean;
|
||||
title: string;
|
||||
renderDefaults: import("@remotion/studio-shared").RenderDefaults | undefined;
|
||||
gitSource: import("@remotion/studio-shared").GitSource | null;
|
||||
projectName: string;
|
||||
installedDependencies: string[] | null;
|
||||
packageManager: import("@remotion/studio-shared").PackageManager | "unknown";
|
||||
logLevel: import("remotion").LogLevel;
|
||||
mode: "dev" | "bundle";
|
||||
}) => string;
|
||||
cacheExists: (remotionRoot: string, environment: "development" | "production", hash: string) => "exists" | "other-exists" | "does-not-exist";
|
||||
clearCache: (remotionRoot: string, env: "development" | "production") => Promise<void>;
|
||||
getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, options, bufferStateDelayInMilliseconds, maxTimelineTracks, experimentalClientSideRenderingEnabled, }: {
|
||||
outDir: string;
|
||||
entryPoint: string;
|
||||
resolvedRemotionRoot: string;
|
||||
bufferStateDelayInMilliseconds: number | null;
|
||||
experimentalClientSideRenderingEnabled: boolean;
|
||||
maxTimelineTracks: number | null;
|
||||
onProgress?: (progress: number) => void;
|
||||
options?: import("./bundle").LegacyBundleOptions;
|
||||
}) => Promise<[string, webpack.Configuration]>;
|
||||
readRecursively: ({ folder, output, startPath, staticHash, limit, }: {
|
||||
folder: string;
|
||||
startPath: string;
|
||||
output?: import("remotion").StaticFile[];
|
||||
staticHash: string;
|
||||
limit: number;
|
||||
}) => import("remotion").StaticFile[];
|
||||
findClosestFolderWithItem: (currentDir: string, file: string) => string | null;
|
||||
internalBundle: (actualArgs: {
|
||||
entryPoint: string;
|
||||
} & {
|
||||
entryPoint: string;
|
||||
onProgress: (progress: number) => void;
|
||||
ignoreRegisterRootWarning: boolean;
|
||||
onDirectoryCreated: (dir: string) => void;
|
||||
gitSource: import("@remotion/studio-shared").GitSource | null;
|
||||
maxTimelineTracks: number | null;
|
||||
bufferStateDelayInMilliseconds: number | null;
|
||||
audioLatencyHint: AudioContextLatencyCategory | null;
|
||||
experimentalClientSideRenderingEnabled: boolean;
|
||||
renderDefaults: import("@remotion/studio-shared").RenderDefaults | null;
|
||||
} & import("./bundle").MandatoryLegacyBundleOptions) => Promise<string>;
|
||||
};
|
||||
export type { GitSource } from '@remotion/studio-shared';
|
||||
export { bundle, BundleOptions, LegacyBundleOptions, MandatoryLegacyBundleOptions, } from './bundle';
|
||||
export { WebpackConfiguration, WebpackOverrideFn } from './webpack-config';
|
||||
export { webpack };
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.webpack = exports.bundle = exports.BundlerInternals = void 0;
|
||||
const bundle_1 = require("./bundle");
|
||||
const index_html_1 = require("./index-html");
|
||||
const read_recursively_1 = require("./read-recursively");
|
||||
const webpack_cache_1 = require("./webpack-cache");
|
||||
const webpack_config_1 = require("./webpack-config");
|
||||
const esbuild = require("esbuild");
|
||||
const webpack = require("webpack");
|
||||
exports.webpack = webpack;
|
||||
exports.BundlerInternals = {
|
||||
esbuild,
|
||||
webpackConfig: webpack_config_1.webpackConfig,
|
||||
indexHtml: index_html_1.indexHtml,
|
||||
cacheExists: webpack_cache_1.cacheExists,
|
||||
clearCache: webpack_cache_1.clearCache,
|
||||
getConfig: bundle_1.getConfig,
|
||||
readRecursively: read_recursively_1.readRecursively,
|
||||
findClosestFolderWithItem: bundle_1.findClosestFolderWithItem,
|
||||
internalBundle: bundle_1.internalBundle,
|
||||
};
|
||||
var bundle_2 = require("./bundle");
|
||||
Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_2.bundle; } });
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import type { Compiler } from 'webpack';
|
||||
export declare class AllowOptionalDependenciesPlugin {
|
||||
filter(error: Error): boolean;
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
Generated
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
// When Webpack cannot resolve these dependencies, it will not print an error message.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AllowOptionalDependenciesPlugin = void 0;
|
||||
const OPTIONAL_DEPENDENCIES = [
|
||||
'zod',
|
||||
'@remotion/zod-types',
|
||||
'react-native-reanimated',
|
||||
'react-native-reanimated/package.json',
|
||||
];
|
||||
const SOURCE_MAP_IGNORE = ['path', 'fs'];
|
||||
class AllowOptionalDependenciesPlugin {
|
||||
filter(error) {
|
||||
for (const dependency of OPTIONAL_DEPENDENCIES) {
|
||||
if (error.message.includes(`Can't resolve '${dependency}'`)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const dependency of SOURCE_MAP_IGNORE) {
|
||||
if (error.message.includes(`Can't resolve '${dependency}'`) &&
|
||||
error.message.includes('source-map')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
apply(compiler) {
|
||||
compiler.hooks.afterCompile.tap('Com', (compilation) => {
|
||||
compilation.errors = compilation.errors.filter(this.filter);
|
||||
});
|
||||
compiler.hooks.afterEmit.tap('AllowOptionalDependenciesPlugin', (compilation) => {
|
||||
compilation.errors = compilation.errors.filter(this.filter);
|
||||
compilation.warnings = compilation.warnings.filter(this.filter);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.AllowOptionalDependenciesPlugin = AllowOptionalDependenciesPlugin;
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import type { StaticFile } from 'remotion';
|
||||
export declare const readRecursively: ({ folder, output, startPath, staticHash, limit, }: {
|
||||
folder: string;
|
||||
startPath: string;
|
||||
output?: StaticFile[];
|
||||
staticHash: string;
|
||||
limit: number;
|
||||
}) => StaticFile[];
|
||||
Generated
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.readRecursively = void 0;
|
||||
const node_fs_1 = __importStar(require("node:fs"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
// There can be symbolic links that point to files that don't exist.
|
||||
// https://github.com/remotion-dev/remotion/issues/2587
|
||||
const statOrNull = (p) => {
|
||||
try {
|
||||
return (0, node_fs_1.statSync)(p);
|
||||
}
|
||||
catch (_a) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const encodeBySplitting = (p) => {
|
||||
// Intentional: split by path.sep, then join by /
|
||||
const splitBySlash = p.split(node_path_1.default.sep);
|
||||
const encodedArray = splitBySlash.map((element) => {
|
||||
return encodeURIComponent(element);
|
||||
});
|
||||
const merged = encodedArray.join('/');
|
||||
return merged;
|
||||
};
|
||||
const readRecursively = ({ folder, output = [], startPath, staticHash, limit, }) => {
|
||||
const absFolder = node_path_1.default.join(startPath, folder);
|
||||
if (!node_fs_1.default.existsSync(absFolder)) {
|
||||
return [];
|
||||
}
|
||||
const files = node_fs_1.default.readdirSync(absFolder);
|
||||
for (const file of files) {
|
||||
if (output.length >= limit) {
|
||||
break;
|
||||
}
|
||||
if (file.startsWith('.DS_Store')) {
|
||||
continue;
|
||||
}
|
||||
const stat = statOrNull(node_path_1.default.join(absFolder, file));
|
||||
if (!stat) {
|
||||
continue;
|
||||
}
|
||||
if (stat.isDirectory()) {
|
||||
(0, exports.readRecursively)({
|
||||
startPath,
|
||||
folder: node_path_1.default.join(folder, file),
|
||||
output,
|
||||
staticHash,
|
||||
limit,
|
||||
});
|
||||
}
|
||||
else if (stat.isFile()) {
|
||||
output.push({
|
||||
name: node_path_1.default.join(folder, file),
|
||||
lastModified: Math.floor(stat.mtimeMs),
|
||||
sizeInBytes: stat.size,
|
||||
src: staticHash + '/' + encodeBySplitting(node_path_1.default.join(folder, file)),
|
||||
});
|
||||
}
|
||||
else if (stat.isSymbolicLink()) {
|
||||
const realpath = node_fs_1.default.realpathSync(node_path_1.default.join(folder, file));
|
||||
const realStat = statOrNull(realpath);
|
||||
if (!realStat) {
|
||||
continue;
|
||||
}
|
||||
if (realStat.isFile()) {
|
||||
output.push({
|
||||
name: realpath,
|
||||
lastModified: Math.floor(realStat.mtimeMs),
|
||||
sizeInBytes: realStat.size,
|
||||
src: staticHash + '/' + encodeBySplitting(realpath),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return output.sort((a, b) => a.name.localeCompare(b.name));
|
||||
};
|
||||
exports.readRecursively = readRecursively;
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export declare const injectCSS: (css: string) => void;
|
||||
Generated
Vendored
+142
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
// https://github.com/remotion-dev/remotion/issues/3412#issuecomment-1910120552
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.injectCSS = void 0;
|
||||
function getEnvVar() {
|
||||
const parts = ['proc', 'ess', '.', 'en', 'v', '.', 'NOD', 'E_EN', 'V'];
|
||||
return parts.join('');
|
||||
}
|
||||
const getEnvVariables = () => {
|
||||
if (window.remotion_isStudio) {
|
||||
// For the Studio, we already set the environment variables in index-html.ts.
|
||||
// We just add NODE_ENV here.
|
||||
if (!process.env.NODE_ENV) {
|
||||
throw new Error(`${getEnvVar()} is not set`);
|
||||
}
|
||||
return {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
};
|
||||
}
|
||||
const param = window.remotion_envVariables;
|
||||
if (!param) {
|
||||
return {};
|
||||
}
|
||||
return { ...JSON.parse(param), NODE_ENV: process.env.NODE_ENV };
|
||||
};
|
||||
const setupEnvVariables = () => {
|
||||
const env = getEnvVariables();
|
||||
if (!window.process) {
|
||||
window.process = {};
|
||||
}
|
||||
if (!window.process.env) {
|
||||
window.process.env = {};
|
||||
}
|
||||
Object.keys(env).forEach((key) => {
|
||||
window.process.env[key] = env[key];
|
||||
});
|
||||
};
|
||||
setupEnvVariables();
|
||||
const injected = {};
|
||||
const injectCSS = (css) => {
|
||||
// Skip in node
|
||||
if (typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (injected[css]) {
|
||||
return;
|
||||
}
|
||||
const head = document.head || document.getElementsByTagName('head')[0];
|
||||
const style = document.createElement('style');
|
||||
style.appendChild(document.createTextNode(css));
|
||||
head.prepend(style);
|
||||
injected[css] = true;
|
||||
};
|
||||
exports.injectCSS = injectCSS;
|
||||
(0, exports.injectCSS)(`
|
||||
.css-reset, .css-reset * {
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
color: white;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background: transparent;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.algolia-docsearch-suggestion--highlight {
|
||||
font-size: 15px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.__remotion-info-button-container code {
|
||||
font-family: monospace;
|
||||
font-size: 14px;
|
||||
color: #0584f2
|
||||
}
|
||||
|
||||
.__remotion-vertical-scrollbar::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
.__remotion-vertical-scrollbar::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(0, 0, 0, 0.0);
|
||||
}
|
||||
.__remotion-vertical-scrollbar:hover::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
.__remotion-vertical-scrollbar:hover::-webkit-scrollbar-thumb:hover {
|
||||
background-color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
.__remotion-horizontal-scrollbar::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
}
|
||||
.__remotion-horizontal-scrollbar::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(0, 0, 0, 0.0);
|
||||
}
|
||||
.__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
.__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb:hover {
|
||||
background-color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
@-moz-document url-prefix() {
|
||||
.__remotion-vertical-scrollbar {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(0, 0, 0, 0.6) rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.__remotion-vertical-scrollbar:hover {
|
||||
scrollbar-color: rgba(0, 0, 0, 1) rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.__remotion-horizontal-scrollbar {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(0, 0, 0, 0.6) rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.__remotion-horizontal-scrollbar:hover {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(0, 0, 0, 1) rgba(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.__remotion-timeline-slider {
|
||||
appearance: none;
|
||||
width: 100px;
|
||||
border-radius: 3px;
|
||||
height: 6px;
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
accent-color: #ffffff;
|
||||
}
|
||||
|
||||
.__remotion-timeline-slider::-moz-range-thumb {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
background-color: #ffffff;
|
||||
appearance: none;
|
||||
}
|
||||
`);
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export declare const jsonStringifyWithCircularReferences: (circ: unknown) => string;
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jsonStringifyWithCircularReferences = void 0;
|
||||
const jsonStringifyWithCircularReferences = (circ) => {
|
||||
let seen = [];
|
||||
const val = JSON.stringify(circ, (_, value) => {
|
||||
if (typeof value === 'object' && value !== null && seen) {
|
||||
if (seen.includes(value)) {
|
||||
return '[Circular]';
|
||||
}
|
||||
seen.push(value);
|
||||
}
|
||||
return value;
|
||||
});
|
||||
seen = null;
|
||||
return val;
|
||||
};
|
||||
exports.jsonStringifyWithCircularReferences = jsonStringifyWithCircularReferences;
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export declare const validatePublicDir: (p: string) => void;
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validatePublicDir = void 0;
|
||||
const node_fs_1 = __importDefault(require("node:fs"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const validatePublicDir = (p) => {
|
||||
const { root } = node_path_1.default.parse(process.cwd());
|
||||
if (p === root) {
|
||||
throw new Error(`The public directory was specified as "${p}", which is the root directory. This is not allowed.`);
|
||||
}
|
||||
try {
|
||||
const stat = node_fs_1.default.lstatSync(p);
|
||||
if (!stat.isDirectory()) {
|
||||
throw new Error(`The public directory was specified as "${p}", and while this path exists on the filesystem, it is not a directory.`);
|
||||
}
|
||||
}
|
||||
catch (_a) {
|
||||
// Path does not exist
|
||||
// Check if the parent path exists
|
||||
const parentPath = node_path_1.default.dirname(p);
|
||||
const exists = node_fs_1.default.existsSync(parentPath);
|
||||
if (!exists) {
|
||||
throw new Error(`The public directory was specified as "${p}", but this folder does not exist and the parent directory "${parentPath}" does also not exist. Create at least the parent directory.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.validatePublicDir = validatePublicDir;
|
||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
type Environment = 'development' | 'production';
|
||||
type CacheState = 'exists' | 'other-exists' | 'does-not-exist';
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessVersions {
|
||||
pnp?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare const getWebpackCacheEnvDir: (environment: Environment) => string;
|
||||
export declare const getWebpackCacheName: (environment: Environment, hash: string) => string;
|
||||
export declare const clearCache: (remotionRoot: string, env: Environment) => Promise<void>;
|
||||
export declare const cacheExists: (remotionRoot: string, environment: Environment, hash: string) => CacheState;
|
||||
export {};
|
||||
Generated
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.cacheExists = exports.clearCache = exports.getWebpackCacheName = exports.getWebpackCacheEnvDir = void 0;
|
||||
const node_fs_1 = __importDefault(require("node:fs"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const version_1 = require("remotion/version");
|
||||
// Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
|
||||
// An algorithm to determine where Webpack will cache the depencies
|
||||
const getWebpackCacheDir = (remotionRoot) => {
|
||||
let dir = remotionRoot;
|
||||
for (;;) {
|
||||
try {
|
||||
if (node_fs_1.default.statSync(node_path_1.default.join(dir, 'package.json')).isFile()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (_a) { }
|
||||
const parent = node_path_1.default.dirname(dir);
|
||||
if (dir === parent) {
|
||||
dir = undefined;
|
||||
break;
|
||||
}
|
||||
dir = parent;
|
||||
}
|
||||
if (!dir) {
|
||||
return node_path_1.default.resolve(remotionRoot, '.cache/webpack');
|
||||
}
|
||||
if (process.versions.pnp === '1') {
|
||||
return node_path_1.default.resolve(dir, '.pnp/.cache/webpack');
|
||||
}
|
||||
if (process.versions.pnp === '3') {
|
||||
return node_path_1.default.resolve(dir, '.yarn/.cache/webpack');
|
||||
}
|
||||
return node_path_1.default.resolve(dir, 'node_modules/.cache/webpack');
|
||||
};
|
||||
const getPrefix = (environment) => {
|
||||
return `remotion-${environment}-${version_1.VERSION}`;
|
||||
};
|
||||
const getWebpackCacheEnvDir = (environment) => {
|
||||
return getPrefix(environment);
|
||||
};
|
||||
exports.getWebpackCacheEnvDir = getWebpackCacheEnvDir;
|
||||
const getWebpackCacheName = (environment, hash) => {
|
||||
return [(0, exports.getWebpackCacheEnvDir)(environment), hash].join(node_path_1.default.sep);
|
||||
};
|
||||
exports.getWebpackCacheName = getWebpackCacheName;
|
||||
const remotionCacheLocationForEnv = (remotionRoot, environment) => {
|
||||
return node_path_1.default.join(getWebpackCacheDir(remotionRoot), (0, exports.getWebpackCacheEnvDir)(environment));
|
||||
};
|
||||
const remotionCacheLocation = (remotionRoot, environment, hash) => {
|
||||
return node_path_1.default.join(getWebpackCacheDir(remotionRoot), (0, exports.getWebpackCacheName)(environment, hash));
|
||||
};
|
||||
const clearCache = (remotionRoot, env) => {
|
||||
return node_fs_1.default.promises.rm(remotionCacheLocationForEnv(remotionRoot, env), {
|
||||
recursive: true,
|
||||
});
|
||||
};
|
||||
exports.clearCache = clearCache;
|
||||
const hasOtherCache = ({ remotionRoot, environment, }) => {
|
||||
const cacheDir = node_fs_1.default.readdirSync(getWebpackCacheDir(remotionRoot));
|
||||
if (cacheDir.find((c) => {
|
||||
return c.startsWith(getPrefix(environment));
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const cacheExists = (remotionRoot, environment, hash) => {
|
||||
if (node_fs_1.default.existsSync(remotionCacheLocation(remotionRoot, environment, hash))) {
|
||||
return 'exists';
|
||||
}
|
||||
if (!node_fs_1.default.existsSync(getWebpackCacheDir(remotionRoot))) {
|
||||
return 'does-not-exist';
|
||||
}
|
||||
if (hasOtherCache({ remotionRoot, environment })) {
|
||||
return 'other-exists';
|
||||
}
|
||||
return 'does-not-exist';
|
||||
};
|
||||
exports.cacheExists = cacheExists;
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
import type { Configuration } from 'webpack';
|
||||
export type WebpackConfiguration = Configuration;
|
||||
export type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) => WebpackConfiguration | Promise<WebpackConfiguration>;
|
||||
export declare const webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, poll, experimentalClientSideRenderingEnabled, askAIEnabled, }: {
|
||||
entry: string;
|
||||
userDefinedComponent: string;
|
||||
outDir: string | null;
|
||||
environment: "development" | "production";
|
||||
webpackOverride: WebpackOverrideFn;
|
||||
onProgress?: (f: number) => void;
|
||||
enableCaching?: boolean;
|
||||
maxTimelineTracks: number | null;
|
||||
keyboardShortcutsEnabled: boolean;
|
||||
bufferStateDelayInMilliseconds: number | null;
|
||||
remotionRoot: string;
|
||||
poll: number | null;
|
||||
askAIEnabled: boolean;
|
||||
experimentalClientSideRenderingEnabled: boolean;
|
||||
}) => Promise<[string, WebpackConfiguration]>;
|
||||
Generated
Vendored
+234
@@ -0,0 +1,234 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.webpackConfig = void 0;
|
||||
const node_crypto_1 = require("node:crypto");
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const react_dom_1 = __importDefault(require("react-dom"));
|
||||
const no_react_1 = require("remotion/no-react");
|
||||
const webpack_1 = __importStar(require("webpack"));
|
||||
const case_sensitive_paths_1 = require("./case-sensitive-paths");
|
||||
const fast_refresh_1 = require("./fast-refresh");
|
||||
const hide_expression_dependency_1 = require("./hide-expression-dependency");
|
||||
const ignore_packfilecache_warnings_1 = require("./ignore-packfilecache-warnings");
|
||||
const optional_dependencies_1 = require("./optional-dependencies");
|
||||
const stringify_with_circular_references_1 = require("./stringify-with-circular-references");
|
||||
const webpack_cache_1 = require("./webpack-cache");
|
||||
const esbuild = require("esbuild");
|
||||
if (!(react_dom_1.default === null || react_dom_1.default === void 0 ? void 0 : react_dom_1.default.version)) {
|
||||
throw new Error('Could not find "react-dom" package. Did you install it?');
|
||||
}
|
||||
const reactDomVersion = react_dom_1.default.version.split('.')[0];
|
||||
if (reactDomVersion === '0') {
|
||||
throw new Error(`Version ${reactDomVersion} of "react-dom" is not supported by Remotion`);
|
||||
}
|
||||
const shouldUseReactDomClient = no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES
|
||||
? true
|
||||
: parseInt(reactDomVersion, 10) >= 18;
|
||||
function truthy(value) {
|
||||
return Boolean(value);
|
||||
}
|
||||
const webpackConfig = async ({ entry, userDefinedComponent, outDir, environment, webpackOverride = (f) => f, onProgress, enableCaching = true, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, poll, experimentalClientSideRenderingEnabled, askAIEnabled, }) => {
|
||||
const esbuildLoaderOptions = {
|
||||
target: 'chrome85',
|
||||
loader: 'tsx',
|
||||
implementation: esbuild,
|
||||
remotionRoot,
|
||||
};
|
||||
let lastProgress = 0;
|
||||
const isBun = typeof Bun !== 'undefined';
|
||||
const define = new webpack_1.default.DefinePlugin({
|
||||
'process.env.MAX_TIMELINE_TRACKS': maxTimelineTracks,
|
||||
'process.env.ASK_AI_ENABLED': askAIEnabled,
|
||||
'process.env.KEYBOARD_SHORTCUTS_ENABLED': keyboardShortcutsEnabled,
|
||||
'process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS': bufferStateDelayInMilliseconds,
|
||||
'process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED': experimentalClientSideRenderingEnabled,
|
||||
});
|
||||
const conf = await webpackOverride({
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
experiments: {
|
||||
lazyCompilation: isBun
|
||||
? false
|
||||
: environment === 'production'
|
||||
? false
|
||||
: {
|
||||
entries: false,
|
||||
},
|
||||
},
|
||||
watchOptions: {
|
||||
poll: poll !== null && poll !== void 0 ? poll : undefined,
|
||||
aggregateTimeout: 0,
|
||||
ignored: ['**/.git/**', '**/.turbo/**', '**/node_modules/**'],
|
||||
},
|
||||
// Higher source map quality in development to power line numbers for stack traces
|
||||
devtool: environment === 'development' ? 'source-map' : 'cheap-module-source-map',
|
||||
entry: [
|
||||
// Fast Refresh must come first,
|
||||
// because setup-environment imports ReactDOM.
|
||||
// If React DOM is imported before Fast Refresh, Fast Refresh does not work
|
||||
environment === 'development'
|
||||
? require.resolve('./fast-refresh/runtime.js')
|
||||
: null,
|
||||
require.resolve('./setup-environment'),
|
||||
userDefinedComponent,
|
||||
require.resolve('../react-shim.js'),
|
||||
entry,
|
||||
].filter(Boolean),
|
||||
mode: environment,
|
||||
plugins: environment === 'development'
|
||||
? [
|
||||
new fast_refresh_1.ReactFreshWebpackPlugin(),
|
||||
new case_sensitive_paths_1.CaseSensitivePathsPlugin(),
|
||||
new webpack_1.default.HotModuleReplacementPlugin(),
|
||||
define,
|
||||
new optional_dependencies_1.AllowOptionalDependenciesPlugin(),
|
||||
new hide_expression_dependency_1.AllowDependencyExpressionPlugin(),
|
||||
new ignore_packfilecache_warnings_1.IgnorePackFileCacheWarningsPlugin(),
|
||||
]
|
||||
: [
|
||||
new webpack_1.ProgressPlugin((p) => {
|
||||
if (onProgress) {
|
||||
if ((p === 1 && p > lastProgress) || p - lastProgress > 0.05) {
|
||||
lastProgress = p;
|
||||
onProgress(Number((p * 100).toFixed(2)));
|
||||
}
|
||||
}
|
||||
}),
|
||||
define,
|
||||
new optional_dependencies_1.AllowOptionalDependenciesPlugin(),
|
||||
new hide_expression_dependency_1.AllowDependencyExpressionPlugin(),
|
||||
new ignore_packfilecache_warnings_1.IgnorePackFileCacheWarningsPlugin(),
|
||||
],
|
||||
output: {
|
||||
hashFunction: 'xxhash64',
|
||||
filename: no_react_1.NoReactInternals.bundleName,
|
||||
devtoolModuleFilenameTemplate: '[resource-path]',
|
||||
assetModuleFilename: environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.web.js', '.js', '.jsx', '.mjs', '.cjs'],
|
||||
alias: {
|
||||
// Only one version of react
|
||||
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
|
||||
'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),
|
||||
react: require.resolve('react'),
|
||||
// Needed to not fail on this: https://github.com/remotion-dev/remotion/issues/5045
|
||||
'remotion/no-react': node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'no-react.mjs'),
|
||||
'remotion/version': node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'version.mjs'),
|
||||
remotion: node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'index.mjs'),
|
||||
'@remotion/media-parser/worker': node_path_1.default.resolve(require.resolve('@remotion/media-parser'), '..', 'esm', 'worker.mjs'),
|
||||
// test visual controls before removing this
|
||||
'@remotion/studio': require.resolve('@remotion/studio'),
|
||||
'react-dom/client': shouldUseReactDomClient
|
||||
? require.resolve('react-dom/client')
|
||||
: require.resolve('react-dom'),
|
||||
},
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [require.resolve('style-loader'), require.resolve('css-loader')],
|
||||
type: 'javascript/auto',
|
||||
},
|
||||
{
|
||||
test: /\.(png|svg|jpg|jpeg|webp|gif|bmp|webm|mp4|mov|mp3|m4a|wav|aac)$/,
|
||||
type: 'asset/resource',
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('./esbuild-loader/index.js'),
|
||||
options: esbuildLoaderOptions,
|
||||
},
|
||||
// Keep the order to match babel-loader
|
||||
environment === 'development'
|
||||
? {
|
||||
loader: require.resolve('./fast-refresh/loader.js'),
|
||||
}
|
||||
: null,
|
||||
].filter(truthy),
|
||||
},
|
||||
{
|
||||
test: /\.(woff(2)?|otf|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
type: 'asset/resource',
|
||||
},
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('./esbuild-loader/index.js'),
|
||||
options: esbuildLoaderOptions,
|
||||
},
|
||||
environment === 'development'
|
||||
? {
|
||||
loader: require.resolve('./fast-refresh/loader.js'),
|
||||
}
|
||||
: null,
|
||||
].filter(truthy),
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
const hash = (0, node_crypto_1.createHash)('md5')
|
||||
.update((0, stringify_with_circular_references_1.jsonStringifyWithCircularReferences)(conf))
|
||||
.digest('hex');
|
||||
return [
|
||||
hash,
|
||||
{
|
||||
...conf,
|
||||
cache: enableCaching
|
||||
? {
|
||||
type: 'filesystem',
|
||||
name: (0, webpack_cache_1.getWebpackCacheName)(environment, hash),
|
||||
version: hash,
|
||||
}
|
||||
: false,
|
||||
output: {
|
||||
...conf.output,
|
||||
...(outDir ? { path: outDir } : {}),
|
||||
},
|
||||
context: remotionRoot,
|
||||
},
|
||||
];
|
||||
};
|
||||
exports.webpackConfig = webpackConfig;
|
||||
Reference in New Issue
Block a user