@remotion/bundler 3.2.12 → 3.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare type BundleOptions = {
6
6
  enableCaching?: boolean;
7
7
  publicPath?: string;
8
8
  rootDir?: string;
9
+ publicDir?: string | null;
9
10
  };
10
11
  export declare const getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgressUpdate, options, }: {
11
12
  outDir: string;
package/dist/bundle.js CHANGED
@@ -87,8 +87,9 @@ const bundle = async (entryPoint, onProgressUpdate, options) => {
87
87
  [trimTrailingSlash(trimLeadingSlash(baseDir)), 'public']
88
88
  .filter(Boolean)
89
89
  .join('/');
90
- // TODO: Unhardcode public directory
91
- const from = path_1.default.join(resolvedRemotionRoot, 'public');
90
+ const from = (options === null || options === void 0 ? void 0 : options.publicDir)
91
+ ? path_1.default.resolve(resolvedRemotionRoot, options.publicDir)
92
+ : path_1.default.join(resolvedRemotionRoot, 'public');
92
93
  const to = path_1.default.join(outDir, 'public');
93
94
  if (fs_1.default.existsSync(from)) {
94
95
  await (0, copy_dir_1.copyDir)(from, to);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const vitest_1 = require("vitest");
8
+ const validate_public_dir_1 = require("../validate-public-dir");
9
+ (0, vitest_1.describe)('validatePublicDir()', () => {
10
+ (0, vitest_1.test)('Should not allow root directory as public dir.', () => {
11
+ (0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(path_1.default.parse(process.cwd()).root)).toThrow(/which is the root directory. This is not allowed./);
12
+ });
13
+ (0, vitest_1.test)('Should not allow a path where the parent directory does not exist', () => {
14
+ const pathToPass = process.platform === 'win32' ? 'C:\\foo\\bar' : '/foo/bar';
15
+ const expectedParent = process.platform === 'win32' ? 'C:\\foo' : '/foo';
16
+ (0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(pathToPass)).toThrow(`The public directory was specified as "${pathToPass}", but this folder does not exist and the parent directory "${expectedParent}" does also not exist.`);
17
+ });
18
+ (0, vitest_1.test)('Should allow /foo as a path since that directory can be created', () => {
19
+ (0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(process.platform === 'win32' ? 'C:\\foo' : '/foo')).not.toThrow();
20
+ });
21
+ });
@@ -0,0 +1 @@
1
+ export declare const validatePublicDir: (p: string) => void;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validatePublicDir = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const validatePublicDir = (p) => {
10
+ const { root } = path_1.default.parse(process.cwd());
11
+ if (p === root) {
12
+ throw new Error(`The public directory was specified as "${p}", which is the root directory. This is not allowed.`);
13
+ }
14
+ try {
15
+ const stat = fs_1.default.lstatSync(p);
16
+ if (!stat.isDirectory()) {
17
+ throw new Error(`The public directory was specified as "${p}", and while this path exists on the filesystem, it is not a directory.`);
18
+ }
19
+ }
20
+ catch (e) {
21
+ // Path does not exist
22
+ // Check if the parent path exists
23
+ const parentPath = path_1.default.dirname(p);
24
+ const exists = fs_1.default.existsSync(parentPath);
25
+ if (!exists) {
26
+ 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.`);
27
+ }
28
+ }
29
+ };
30
+ exports.validatePublicDir = validatePublicDir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "3.2.12",
3
+ "version": "3.2.13",
4
4
  "description": "Bundler for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -13,11 +13,11 @@
13
13
  "scripts": {
14
14
  "lint": "eslint src --ext ts,tsx",
15
15
  "build": "tsc -d",
16
- "watch": "tsc -w"
16
+ "watch": "tsc -w",
17
+ "test": "vitest --run"
17
18
  },
18
19
  "files": [
19
20
  "dist",
20
- "web",
21
21
  "react-shim.js"
22
22
  ],
23
23
  "author": "",
@@ -26,7 +26,7 @@
26
26
  "css-loader": "5.2.7",
27
27
  "esbuild": "0.14.19",
28
28
  "react-refresh": "0.9.0",
29
- "remotion": "3.2.12",
29
+ "remotion": "3.2.13",
30
30
  "style-loader": "2.0.0",
31
31
  "webpack": "5.72.0"
32
32
  },
@@ -50,7 +50,8 @@
50
50
  "prettier-plugin-organize-imports": "^2.3.4",
51
51
  "react": "^18.0.0",
52
52
  "react-dom": "^18.0.0",
53
- "typescript": "^4.7.0"
53
+ "typescript": "^4.7.0",
54
+ "vitest": "^0.18.0"
54
55
  },
55
56
  "keywords": [
56
57
  "remotion",
@@ -63,5 +64,5 @@
63
64
  "publishConfig": {
64
65
  "access": "public"
65
66
  },
66
- "gitHead": "72c9a148cafdd4468fff41bbc7ca70a1776fb15e"
67
+ "gitHead": "989d20fc0ace36685c71396847e1b7b7a06d00d7"
67
68
  }