@revideo/vite-plugin 0.2.2 → 0.2.4-alpha.894
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/main.d.ts +86 -79
- package/lib/main.js +52 -37
- 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/exporter.d.ts +5 -3
- package/lib/partials/exporter.js +54 -42
- package/lib/partials/index.js +42 -26
- package/lib/partials/meta.d.ts +1 -1
- package/lib/partials/meta.js +59 -50
- 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/utils.d.ts +3 -3
- package/lib/utils.js +46 -39
- package/lib/versions.d.ts +4 -4
- package/lib/versions.js +28 -23
- package/package.json +2 -2
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/main.d.ts
CHANGED
|
@@ -1,82 +1,89 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type {Plugin} from 'vite';
|
|
2
|
+
import {CorsProxyPluginConfig} from './partials';
|
|
3
3
|
export interface MotionCanvasPluginConfig {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The import path of the project file or an array of paths.
|
|
6
|
+
* Also supports globs.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Each file must contain a default export exposing an instance of the
|
|
10
|
+
* {@link Project} class.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* motionCanvas({
|
|
15
|
+
* project: [
|
|
16
|
+
* './src/firstProject.ts',
|
|
17
|
+
* './src/secondProject.ts',
|
|
18
|
+
* ]
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @defaultValue './src/project.ts'
|
|
23
|
+
*/
|
|
24
|
+
project?: string | string[];
|
|
25
|
+
/**
|
|
26
|
+
* A directory path to which the animation will be rendered.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue './output'
|
|
29
|
+
*/
|
|
30
|
+
output?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Defines which assets should be buffered before being sent to the browser.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Streaming larger assets directly from the drive may cause issues with other
|
|
36
|
+
* applications. For instance, if an audio file is being used in the project,
|
|
37
|
+
* Adobe Audition will perceive it as "being used by another application"
|
|
38
|
+
* and refuse to override it.
|
|
39
|
+
*
|
|
40
|
+
* Buffered assets are first loaded to the memory and then streamed from
|
|
41
|
+
* there. This leaves the original files open for modification with hot module
|
|
42
|
+
* replacement still working.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue /^$/
|
|
45
|
+
*/
|
|
46
|
+
bufferedAssets?: RegExp | false;
|
|
47
|
+
/**
|
|
48
|
+
* The import path of the editor package.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* This path will be resolved using Node.js module resolution rules.
|
|
52
|
+
* It should lead to a directory containing the following files:
|
|
53
|
+
* - `editor.html` - The HTML template for the editor.
|
|
54
|
+
* - `styles.css` - The editor styles.
|
|
55
|
+
* - `main.js` - A module exporting necessary factory functions.
|
|
56
|
+
*
|
|
57
|
+
* `main.js` should export the following functions:
|
|
58
|
+
* - `editor` - Receives the project factory as its first argument and creates
|
|
59
|
+
* the user interface.
|
|
60
|
+
* - `index` - Receives a list of all projects as its first argument and
|
|
61
|
+
* creates the initial page for selecting a project.
|
|
62
|
+
*
|
|
63
|
+
* @defaultValue '\@revideo/ui'
|
|
64
|
+
*/
|
|
65
|
+
editor?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Configuration of the Proxy used for remote sources
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* This passes configuration to Motion Canvas' proxy.
|
|
71
|
+
* Note that the proxy is disabled by default.
|
|
72
|
+
* You can either pass `true` and a config object
|
|
73
|
+
* to enable it.
|
|
74
|
+
**/
|
|
75
|
+
proxy?: boolean | CorsProxyPluginConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Build the project to run in the editor.
|
|
78
|
+
*/
|
|
79
|
+
buildForEditor?: boolean;
|
|
80
80
|
}
|
|
81
|
-
declare const _default: ({
|
|
81
|
+
declare const _default: ({
|
|
82
|
+
project,
|
|
83
|
+
output,
|
|
84
|
+
bufferedAssets,
|
|
85
|
+
editor,
|
|
86
|
+
proxy,
|
|
87
|
+
buildForEditor,
|
|
88
|
+
}?: MotionCanvasPluginConfig) => Plugin[];
|
|
82
89
|
export default _default;
|
package/lib/main.js
CHANGED
|
@@ -1,38 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
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});
|
|
8
|
+
const path_1 = __importDefault(require('path'));
|
|
9
|
+
const partials_1 = require('./partials');
|
|
10
|
+
const plugins_1 = require('./plugins');
|
|
11
|
+
const utils_1 = require('./utils');
|
|
12
|
+
exports.default = ({
|
|
13
|
+
project = './src/project.ts',
|
|
14
|
+
output = './output',
|
|
15
|
+
bufferedAssets = /^$/,
|
|
16
|
+
editor = '@revideo/ui',
|
|
17
|
+
proxy,
|
|
18
|
+
buildForEditor,
|
|
19
|
+
} = {}) => {
|
|
20
|
+
const plugins = [];
|
|
21
|
+
const outputPath = path_1.default.resolve(output);
|
|
22
|
+
const projects = (0, utils_1.getProjects)(project);
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
name: 'revideo',
|
|
26
|
+
async configResolved(resolvedConfig) {
|
|
27
|
+
plugins.push(
|
|
28
|
+
...resolvedConfig.plugins
|
|
29
|
+
.filter(plugins_1.isPlugin)
|
|
30
|
+
.map(plugin => plugin[plugins_1.PLUGIN_OPTIONS]),
|
|
31
|
+
);
|
|
32
|
+
await Promise.all(
|
|
33
|
+
plugins.map(plugin =>
|
|
34
|
+
plugin.config?.({
|
|
35
|
+
output: outputPath,
|
|
36
|
+
projects: projects.list,
|
|
37
|
+
}),
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
(0, partials_1.metaPlugin)(),
|
|
43
|
+
(0, partials_1.settingsPlugin)(),
|
|
44
|
+
(0, partials_1.scenesPlugin)(),
|
|
45
|
+
(0, partials_1.exporterPlugin)({outputPath}),
|
|
46
|
+
(0, partials_1.editorPlugin)({editor, projects}),
|
|
47
|
+
(0, partials_1.projectsPlugin)({projects, plugins, buildForEditor}),
|
|
48
|
+
(0, partials_1.assetsPlugin)({bufferedAssets}),
|
|
49
|
+
(0, partials_1.webglPlugin)(),
|
|
50
|
+
(0, partials_1.corsProxyPlugin)(proxy),
|
|
51
|
+
];
|
|
4
52
|
};
|
|
5
|
-
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const partials_1 = require("./partials");
|
|
8
|
-
const plugins_1 = require("./plugins");
|
|
9
|
-
const utils_1 = require("./utils");
|
|
10
|
-
exports.default = ({ project = './src/project.ts', output = './output', bufferedAssets = /^$/, editor = '@revideo/ui', proxy, buildForEditor, } = {}) => {
|
|
11
|
-
const plugins = [];
|
|
12
|
-
const outputPath = path_1.default.resolve(output);
|
|
13
|
-
const projects = (0, utils_1.getProjects)(project);
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
name: 'revideo',
|
|
17
|
-
async configResolved(resolvedConfig) {
|
|
18
|
-
plugins.push(...resolvedConfig.plugins
|
|
19
|
-
.filter(plugins_1.isPlugin)
|
|
20
|
-
.map(plugin => plugin[plugins_1.PLUGIN_OPTIONS]));
|
|
21
|
-
await Promise.all(plugins.map(plugin => plugin.config?.({
|
|
22
|
-
output: outputPath,
|
|
23
|
-
projects: projects.list,
|
|
24
|
-
})));
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
(0, partials_1.metaPlugin)(),
|
|
28
|
-
(0, partials_1.settingsPlugin)(),
|
|
29
|
-
(0, partials_1.scenesPlugin)(),
|
|
30
|
-
(0, partials_1.exporterPlugin)({ outputPath }),
|
|
31
|
-
(0, partials_1.editorPlugin)({ editor, projects }),
|
|
32
|
-
(0, partials_1.projectsPlugin)({ projects, plugins, buildForEditor }),
|
|
33
|
-
(0, partials_1.assetsPlugin)({ bufferedAssets }),
|
|
34
|
-
(0, partials_1.webglPlugin)(),
|
|
35
|
-
(0, partials_1.corsProxyPlugin)(proxy),
|
|
36
|
-
];
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=main.js.map
|
|
53
|
+
//# sourceMappingURL=main.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;
|