@revideo/vite-plugin 0.4.7-alpha.1027 → 0.4.7-five.1022
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/lib/index.js +40 -22
- package/lib/openInExplorer.js +38 -39
- package/lib/partials/assets.d.ts +5 -3
- package/lib/partials/assets.js +49 -46
- package/lib/partials/corsProxy.d.ts +24 -22
- package/lib/partials/corsProxy.js +175 -151
- package/lib/partials/editor.d.ts +8 -5
- package/lib/partials/editor.js +65 -58
- package/lib/partials/ffmpegExporter.d.ts +25 -0
- package/lib/partials/ffmpegExporter.js +132 -0
- package/lib/partials/ffmpegExporter.js.map +1 -0
- package/lib/partials/imageExporter.d.ts +5 -3
- package/lib/partials/imageExporter.js +54 -42
- package/lib/partials/meta.d.ts +1 -1
- package/lib/partials/meta.js +61 -52
- package/lib/partials/metrics.d.ts +1 -1
- package/lib/partials/metrics.js +10 -10
- package/lib/partials/projects.d.ts +11 -7
- package/lib/partials/projects.js +73 -69
- package/lib/partials/scenes.d.ts +1 -1
- package/lib/partials/scenes.js +25 -23
- package/lib/partials/settings.d.ts +1 -1
- package/lib/partials/settings.js +67 -62
- package/lib/partials/webgl.d.ts +7 -7
- package/lib/partials/webgl.js +87 -79
- package/lib/plugins.d.ts +76 -76
- package/lib/plugins.js +4 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.d.ts +3 -3
- package/lib/utils.js +47 -40
- package/lib/versions.d.ts +4 -4
- package/lib/versions.js +28 -23
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -1,23 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(
|
|
20
|
-
|
|
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 __exportStar =
|
|
26
|
+
(this && this.__exportStar) ||
|
|
27
|
+
function (m, exports) {
|
|
28
|
+
for (var p in m)
|
|
29
|
+
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
30
|
+
__createBinding(exports, m, p);
|
|
31
|
+
};
|
|
32
|
+
var __importDefault =
|
|
33
|
+
(this && this.__importDefault) ||
|
|
34
|
+
function (mod) {
|
|
35
|
+
return mod && mod.__esModule ? mod : {default: mod};
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
38
|
+
const main_1 = __importDefault(require('./main'));
|
|
21
39
|
exports.default = main_1.default;
|
|
22
|
-
__exportStar(require(
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
40
|
+
__exportStar(require('./plugins'), exports);
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
package/lib/openInExplorer.js
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
3
3
|
exports.openInExplorer = void 0;
|
|
4
|
-
const child_process_1 = require(
|
|
5
|
-
const os_1 = require(
|
|
4
|
+
const child_process_1 = require('child_process');
|
|
5
|
+
const os_1 = require('os');
|
|
6
6
|
function openInExplorer(file) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
console.warn(`Unsupported OS: ${os}`);
|
|
32
|
-
}
|
|
7
|
+
let command = null;
|
|
8
|
+
let args = [file];
|
|
9
|
+
const os = (0, os_1.platform)();
|
|
10
|
+
switch (os) {
|
|
11
|
+
case 'win32':
|
|
12
|
+
command = 'explorer';
|
|
13
|
+
break;
|
|
14
|
+
case 'linux':
|
|
15
|
+
if (isRunningOnWSL()) {
|
|
16
|
+
command = 'bash';
|
|
17
|
+
args = ['-c', `cd ${file} && explorer.exe .`];
|
|
18
|
+
} else {
|
|
19
|
+
command = 'xdg-open';
|
|
20
|
+
}
|
|
21
|
+
break;
|
|
22
|
+
case 'darwin':
|
|
23
|
+
command = 'open';
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
if (command) {
|
|
27
|
+
(0, child_process_1.spawn)(command, args, {detached: true}).unref();
|
|
28
|
+
} else {
|
|
29
|
+
console.warn(`Unsupported OS: ${os}`);
|
|
30
|
+
}
|
|
33
31
|
}
|
|
34
32
|
exports.openInExplorer = openInExplorer;
|
|
35
33
|
function isRunningOnWSL() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
try {
|
|
35
|
+
const uname = (0, child_process_1.execSync)('uname -a')
|
|
36
|
+
.toString()
|
|
37
|
+
.toLowerCase();
|
|
38
|
+
return uname.includes('microsoft');
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error(`exec error: ${error}`);
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
44
43
|
}
|
|
45
|
-
//# sourceMappingURL=openInExplorer.js.map
|
|
44
|
+
//# sourceMappingURL=openInExplorer.js.map
|
package/lib/partials/assets.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Plugin} from 'vite';
|
|
2
2
|
interface AssetsPluginConfig {
|
|
3
|
-
|
|
3
|
+
bufferedAssets: RegExp | false;
|
|
4
4
|
}
|
|
5
|
-
export declare function assetsPlugin({
|
|
5
|
+
export declare function assetsPlugin({
|
|
6
|
+
bufferedAssets,
|
|
7
|
+
}: AssetsPluginConfig): Plugin;
|
|
6
8
|
export {};
|
package/lib/partials/assets.js
CHANGED
|
@@ -1,51 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : {default: mod};
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
6
8
|
exports.assetsPlugin = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require(
|
|
8
|
-
const path_1 = __importDefault(require(
|
|
9
|
-
const stream_1 = require(
|
|
9
|
+
const fs_1 = __importDefault(require('fs'));
|
|
10
|
+
const path_1 = __importDefault(require('path'));
|
|
11
|
+
const stream_1 = require('stream');
|
|
10
12
|
const AUDIO_EXTENSION_REGEX = /\.(mp3|wav|ogg|aac|flac)(?:$|\?)/;
|
|
11
13
|
const AUDIO_HMR_DELAY = 1000;
|
|
12
|
-
function assetsPlugin({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
14
|
+
function assetsPlugin({bufferedAssets}) {
|
|
15
|
+
let config;
|
|
16
|
+
return {
|
|
17
|
+
name: 'revideo:assets',
|
|
18
|
+
configResolved(resolvedConfig) {
|
|
19
|
+
config = resolvedConfig;
|
|
20
|
+
},
|
|
21
|
+
configureServer(server) {
|
|
22
|
+
server.middlewares.use((req, res, next) => {
|
|
23
|
+
if (req.url && bufferedAssets && bufferedAssets.test(req.url)) {
|
|
24
|
+
const file = fs_1.default.readFileSync(
|
|
25
|
+
path_1.default.resolve(config.root, req.url.slice(1)),
|
|
26
|
+
);
|
|
27
|
+
stream_1.Readable.from(file).pipe(res);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
next();
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
async handleHotUpdate(ctx) {
|
|
34
|
+
const urls = [];
|
|
35
|
+
const modules = [];
|
|
36
|
+
for (const module of ctx.modules) {
|
|
37
|
+
urls.push(module.url);
|
|
38
|
+
if (!AUDIO_EXTENSION_REGEX.test(module.url)) {
|
|
39
|
+
modules.push(module);
|
|
40
|
+
} else {
|
|
41
|
+
await new Promise(resolve => {
|
|
42
|
+
setTimeout(resolve, AUDIO_HMR_DELAY);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (urls.length > 0) {
|
|
47
|
+
ctx.server.ws.send('revideo:assets', {urls});
|
|
48
|
+
}
|
|
49
|
+
return modules;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
49
52
|
}
|
|
50
53
|
exports.assetsPlugin = assetsPlugin;
|
|
51
|
-
//# sourceMappingURL=assets.js.map
|
|
54
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Plugin} from 'vite';
|
|
2
2
|
/**
|
|
3
3
|
* Configuration used by the Proxy plugin
|
|
4
4
|
*/
|
|
5
5
|
export interface CorsProxyPluginConfig {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Set which types of resources are allowed by default.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Catchall on the right side is supported.
|
|
11
|
+
* Pass an empty Array to allow all types of resources, although this is not
|
|
12
|
+
* recommended.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue ["image/*", "video/*"]
|
|
15
|
+
*/
|
|
16
|
+
allowedMimeTypes?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Set which hosts are allowed
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Note that the host is everything to the left of the first `/`, and to the
|
|
22
|
+
* right of the protocol `https://`. AllowList is not used by default,
|
|
23
|
+
* although you should consider setting up just the relevant hosts.
|
|
24
|
+
*/
|
|
25
|
+
allowListHosts?: string[];
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* This module provides the proxy located at
|
|
@@ -40,4 +40,6 @@ export interface CorsProxyPluginConfig {
|
|
|
40
40
|
* this way all remote resources are served from the
|
|
41
41
|
* same host as the main app.
|
|
42
42
|
*/
|
|
43
|
-
export declare function corsProxyPlugin(
|
|
43
|
+
export declare function corsProxyPlugin(
|
|
44
|
+
config?: CorsProxyPluginConfig | boolean,
|
|
45
|
+
): Plugin;
|