@revideo/cli 0.3.7-beta.987 → 0.3.7-blue.987

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.
Files changed (2) hide show
  1. package/dist/server/player.js +73 -136
  2. package/package.json +3 -3
@@ -1,91 +1,41 @@
1
- 'use strict';
2
- var __createBinding =
3
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (
9
- !desc ||
10
- ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)
11
- ) {
12
- desc = {
13
- enumerable: true,
14
- get: function () {
15
- return m[k];
16
- },
17
- };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }
21
- : function (o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- });
25
- var __setModuleDefault =
26
- (this && this.__setModuleDefault) ||
27
- (Object.create
28
- ? function (o, v) {
29
- Object.defineProperty(o, 'default', {enumerable: true, value: v});
30
- }
31
- : function (o, v) {
32
- o['default'] = v;
33
- });
34
- var __importStar =
35
- (this && this.__importStar) ||
36
- function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null)
40
- for (var k in mod)
41
- if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k))
42
- __createBinding(result, mod, k);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- Object.defineProperty(exports, '__esModule', {value: true});
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 });
47
6
  exports.player = exports.createHotReloader = exports.buildProject = void 0;
48
- const chokidar_1 = require('chokidar');
49
- const fs_1 = require('fs');
50
- const path = __importStar(require('path'));
51
- const vite_1 = require('vite');
7
+ const vite_plugin_1 = __importDefault(require("@revideo/vite-plugin"));
8
+ const chokidar_1 = require("chokidar");
9
+ const fs_1 = require("fs");
10
+ const vite_1 = require("vite");
52
11
  const YELLOW_DOT = '\u001b[33m•\u001b[0m';
53
12
  const GREEN_CHECK = '\u001b[32m✔\u001b[0m';
54
13
  const RED_CROSS = '\u001b[31m✘\u001b[0m';
55
- const fileNotFoundMessage = filePath =>
56
- `${YELLOW_DOT} File ${filePath} not found. Building project...`;
57
- const fileNotFoundAfterBuildingMessage = (filePath, padding) =>
58
- `\r${RED_CROSS} File ${filePath} still not found after building project...`.padEnd(
59
- padding,
60
- ' ',
61
- ) + '\n';
62
- const fileChangedMessage = filePath =>
63
- `${YELLOW_DOT} File ${filePath} has changed. Rebuilding...`;
64
- const successMessage = (time, padding) =>
65
- `\r${GREEN_CHECK} Project built successfully. ${time}ms`.padEnd(
66
- padding,
67
- ' ',
68
- ) + '\n';
14
+ const fileNotFoundMessage = (filePath) => `${YELLOW_DOT} File ${filePath} not found. Building project...`;
15
+ const fileNotFoundAfterBuildingMessage = (filePath, padding) => `\r${RED_CROSS} File ${filePath} still not found after building project...`.padEnd(padding, ' ') + '\n';
16
+ const fileChangedMessage = (filePath) => `${YELLOW_DOT} File ${filePath} has changed. Rebuilding...`;
17
+ const successMessage = (time, padding) => `\r${GREEN_CHECK} Project built successfully. ${time}ms`.padEnd(padding, ' ') + '\n';
69
18
  async function buildProject() {
70
- try {
71
- await (0, vite_1.build)({
72
- configFile: path.join(process.cwd(), process.env.PROJECT_FILE || ''),
73
- publicDir: false,
74
- build: {
75
- outDir: 'dist',
76
- rollupOptions: {
77
- output: {
78
- entryFileNames: '[name].js',
79
- chunkFileNames: '[name].js',
80
- assetFileNames: '[name].[ext]',
81
- },
82
- },
83
- },
84
- });
85
- } catch (error) {
86
- console.error('Error building project:', error);
87
- throw error;
88
- }
19
+ try {
20
+ await (0, vite_1.build)({
21
+ configFile: false,
22
+ plugins: [(0, vite_plugin_1.default)()],
23
+ build: {
24
+ outDir: 'dist',
25
+ rollupOptions: {
26
+ output: {
27
+ entryFileNames: '[name].js',
28
+ chunkFileNames: '[name].js',
29
+ assetFileNames: '[name].[ext]',
30
+ },
31
+ },
32
+ },
33
+ });
34
+ }
35
+ catch (error) {
36
+ console.error('Error building project:', error);
37
+ throw error;
38
+ }
89
39
  }
90
40
  exports.buildProject = buildProject;
91
41
  /**
@@ -93,62 +43,49 @@ exports.buildProject = buildProject;
93
43
  * @param dir - Directory to watch for changes.
94
44
  */
95
45
  async function createHotReloader(dir) {
96
- const watcher = (0, chokidar_1.watch)(dir, {
97
- ignored: ['**/*.meta'],
98
- });
99
- watcher.on('change', async path => {
100
- const rebuildingMessage = fileChangedMessage(path);
101
- process.stdout.write(rebuildingMessage);
102
- const start = Date.now();
103
- try {
104
- await buildProject();
105
- process.stdout.write(
106
- successMessage(Date.now() - start, rebuildingMessage.length + 1),
107
- );
108
- } catch (e) {
109
- // TODO: Add more detailed error message
110
- console.error(
111
- 'Error building project. Try to run `npm run build` manually and check for errors.',
112
- );
113
- }
114
- });
46
+ const watcher = (0, chokidar_1.watch)(dir, {
47
+ ignored: ['**/*.meta'],
48
+ });
49
+ watcher.on('change', async (path) => {
50
+ const rebuildingMessage = fileChangedMessage(path);
51
+ process.stdout.write(rebuildingMessage);
52
+ const start = Date.now();
53
+ try {
54
+ await buildProject();
55
+ process.stdout.write(successMessage(Date.now() - start, rebuildingMessage.length + 1));
56
+ }
57
+ catch (e) {
58
+ // TODO: Add more detailed error message
59
+ console.error('Error building project. Try to run `npm run build` manually and check for errors.');
60
+ }
61
+ });
115
62
  }
116
63
  exports.createHotReloader = createHotReloader;
117
64
  async function player(req, res) {
118
- const path = `./dist/${req.params.file}`;
119
- let buildTime = undefined;
120
- let error = false;
121
- // Check if the file exists and build the project if it doesn't.
122
- await fs_1.promises.access(path).catch(async () => {
123
- buildTime = Date.now();
124
- process.stdout.write(fileNotFoundMessage(path));
125
- await buildProject().catch(() => {
126
- res.status(500).send('Error building project');
65
+ const path = `./dist/${req.params.file}`;
66
+ let buildTime = undefined;
67
+ let error = false;
68
+ // Check if the file exists and build the project if it doesn't.
69
+ await fs_1.promises.access(path).catch(async () => {
70
+ buildTime = Date.now();
71
+ process.stdout.write(fileNotFoundMessage(path));
72
+ await buildProject().catch(() => {
73
+ res.status(500).send('Error building project');
74
+ });
75
+ });
76
+ // If the file still doesn't exist, send an error response.
77
+ await fs_1.promises.access(path).catch(() => {
78
+ process.stdout.write(fileNotFoundAfterBuildingMessage(path, fileNotFoundMessage(path).length + 1));
79
+ res.status(404).send(`File ${path} not found`);
80
+ error = true;
127
81
  });
128
- });
129
- // If the file still doesn't exist, send an error response.
130
- await fs_1.promises.access(path).catch(() => {
131
- process.stdout.write(
132
- fileNotFoundAfterBuildingMessage(
133
- path,
134
- fileNotFoundMessage(path).length + 1,
135
- ),
136
- );
137
- res.status(404).send(`File ${path} not found`);
138
- error = true;
139
- });
140
- if (error) {
141
- return;
142
- }
143
- // If we built the project, update the log message.
144
- if (buildTime) {
145
- process.stdout.write(
146
- successMessage(
147
- Date.now() - buildTime,
148
- fileNotFoundMessage(path).length + 1,
149
- ),
150
- );
151
- }
152
- return res.sendFile(path, {root: './'});
82
+ if (error) {
83
+ return;
84
+ }
85
+ // If we built the project, update the log message.
86
+ if (buildTime) {
87
+ process.stdout.write(successMessage(Date.now() - buildTime, fileNotFoundMessage(path).length + 1));
88
+ }
89
+ return res.sendFile(path, { root: './' });
153
90
  }
154
91
  exports.player = player;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revideo/cli",
3
- "version": "0.3.7-beta.987+48e808f",
3
+ "version": "0.3.7-blue.987+48e808f",
4
4
  "description": "A CLI for revideo",
5
5
  "main": "dist/index.js",
6
6
  "author": "revideo",
@@ -25,8 +25,8 @@
25
25
  "typescript": "^5.4.3"
26
26
  },
27
27
  "dependencies": {
28
- "@revideo/renderer": "^0.3.7-beta.987+48e808f",
29
- "@revideo/telemetry": "^0.3.7-beta.987+48e808f",
28
+ "@revideo/renderer": "^0.3.7-blue.987+48e808f",
29
+ "@revideo/telemetry": "^0.3.7-blue.987+48e808f",
30
30
  "chokidar": "^3.5.3",
31
31
  "commander": "^12.0.0",
32
32
  "cors": "^2.8.5",