@revideo/vite-plugin 0.5.10 → 0.5.11-alpha.1100
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/main.d.ts +1 -12
- package/lib/main.js +1 -3
- package/lib/main.js.map +1 -1
- package/lib/openInExplorer.js +1 -2
- package/lib/openInExplorer.js.map +1 -1
- package/lib/partials/assets.js +1 -2
- package/lib/partials/assets.js.map +1 -1
- package/lib/partials/editor.js +7 -6
- package/lib/partials/editor.js.map +1 -1
- package/lib/partials/ffmpegBridge.d.ts +0 -1
- package/lib/partials/ffmpegBridge.js +2 -2
- package/lib/partials/ffmpegBridge.js.map +1 -1
- package/lib/partials/imageExporter.js +1 -2
- package/lib/partials/imageExporter.js.map +1 -1
- package/lib/partials/index.d.ts +0 -2
- package/lib/partials/index.js +0 -2
- package/lib/partials/index.js.map +1 -1
- package/lib/partials/meta.js +1 -2
- package/lib/partials/meta.js.map +1 -1
- package/lib/partials/metrics.js +1 -2
- package/lib/partials/metrics.js.map +1 -1
- package/lib/partials/projects.d.ts +1 -1
- package/lib/partials/projects.js +5 -60
- package/lib/partials/projects.js.map +1 -1
- package/lib/partials/rive.js +1 -2
- package/lib/partials/rive.js.map +1 -1
- package/lib/partials/settings.js +1 -2
- package/lib/partials/settings.js.map +1 -1
- package/lib/partials/wasmExporter.js +1 -2
- package/lib/partials/wasmExporter.js.map +1 -1
- package/lib/partials/webgl.js +1 -2
- package/lib/partials/webgl.js.map +1 -1
- package/lib/plugins.d.ts +6 -6
- package/lib/plugins.js +2 -2
- package/lib/plugins.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +1 -10
- package/lib/utils.js.map +1 -1
- package/lib/versions.js +1 -2
- package/lib/versions.js.map +1 -1
- package/package.json +4 -8
- package/lib/partials/corsProxy.d.ts +0 -43
- package/lib/partials/corsProxy.js +0 -219
- package/lib/partials/corsProxy.js.map +0 -1
- package/lib/partials/scenes.d.ts +0 -2
- package/lib/partials/scenes.js +0 -47
- package/lib/partials/scenes.js.map +0 -1
|
@@ -1,219 +0,0 @@
|
|
|
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.corsProxyPlugin = void 0;
|
|
7
|
-
const follow_redirects_1 = __importDefault(require("follow-redirects"));
|
|
8
|
-
/**
|
|
9
|
-
* This module provides the proxy located at
|
|
10
|
-
* /cors-proxy/...
|
|
11
|
-
*
|
|
12
|
-
* It is needed when accessing remote resources.
|
|
13
|
-
* Trying to access remote resources works while
|
|
14
|
-
* in preview, but will fail when you try to
|
|
15
|
-
* output the image (= "read" the canvas)
|
|
16
|
-
*
|
|
17
|
-
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
|
|
18
|
-
* for reasons
|
|
19
|
-
*
|
|
20
|
-
* Using the proxy circumvents CORS-issues because
|
|
21
|
-
* this way all remote resources are served from the
|
|
22
|
-
* same host as the main app.
|
|
23
|
-
*/
|
|
24
|
-
function corsProxyPlugin(config) {
|
|
25
|
-
setupEnvVarsForProxy(config);
|
|
26
|
-
return {
|
|
27
|
-
name: 'revideo:cors-proxy',
|
|
28
|
-
configureServer(server) {
|
|
29
|
-
if (config !== false && config !== undefined) {
|
|
30
|
-
motionCanvasCorsProxy(server.middlewares, config === true ? {} : config);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.corsProxyPlugin = corsProxyPlugin;
|
|
36
|
-
function setupEnvVarsForProxy(config) {
|
|
37
|
-
// Define Keys for Env Var
|
|
38
|
-
const prefix = 'VITE_MC_PROXY_';
|
|
39
|
-
const isEnabledKey = prefix + 'ENABLED';
|
|
40
|
-
const allowList = prefix + 'ALLOW_LIST';
|
|
41
|
-
if (config === true) {
|
|
42
|
-
config = {}; // Use Default values
|
|
43
|
-
}
|
|
44
|
-
process.env[isEnabledKey] = String(!!config); // 'true' or 'false'
|
|
45
|
-
if (config) {
|
|
46
|
-
// These values are only configured if the Proxy is enabled
|
|
47
|
-
// You cannot access them via import.meta.env if the Proxy
|
|
48
|
-
// is set to false
|
|
49
|
-
process.env[allowList] = JSON.stringify(config.allowListHosts ?? []);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function motionCanvasCorsProxy(middleware, config) {
|
|
53
|
-
// Set the default config if no config was provided
|
|
54
|
-
config.allowedMimeTypes ??= ['image/*', 'video/*'];
|
|
55
|
-
config.allowListHosts ??= [];
|
|
56
|
-
// Check the Mime Types to have a correct structure (left/right)
|
|
57
|
-
// not having them in the correct format would crash the Middleware
|
|
58
|
-
// further down below
|
|
59
|
-
if ((config.allowedMimeTypes ?? []).some(e => e.split('/').length !== 2)) {
|
|
60
|
-
throw new Error("Invalid config for Proxy:\nAll Entries must have the following format:\n 'left/right' where left may be '*'");
|
|
61
|
-
}
|
|
62
|
-
middleware.use((req, res, next) => {
|
|
63
|
-
if (!req.url || !req.url.startsWith('/cors-proxy/')) {
|
|
64
|
-
// url does not start with /cors-proxy/, so this
|
|
65
|
-
// middleware does not care about it
|
|
66
|
-
return next();
|
|
67
|
-
}
|
|
68
|
-
// For now, only allow GET Requests
|
|
69
|
-
if (req.method !== 'GET') {
|
|
70
|
-
return writeError('Only GET Requests are allowed', res, 405);
|
|
71
|
-
}
|
|
72
|
-
let sourceUrl;
|
|
73
|
-
try {
|
|
74
|
-
sourceUrl = extractDestination(req.url);
|
|
75
|
-
}
|
|
76
|
-
catch (err) {
|
|
77
|
-
return writeError(err, res);
|
|
78
|
-
}
|
|
79
|
-
if (!isReceivedUrlInAllowedHosts(sourceUrl.hostname, config.allowListHosts)) {
|
|
80
|
-
return writeError(`Blocked by Proxy: ${sourceUrl.hostname} is not on Hosts Allowlist`, res);
|
|
81
|
-
}
|
|
82
|
-
// Get the resource, do some checks. Throws an Error
|
|
83
|
-
// if the checks fail. The catch then writes an Error
|
|
84
|
-
return tryGetResource(res, sourceUrl, config).catch(error => {
|
|
85
|
-
writeError(error, res);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Unwrap the destination from the URL.
|
|
91
|
-
*
|
|
92
|
-
* @remarks
|
|
93
|
-
* Throws an Error if the value could not be unwrapped.
|
|
94
|
-
*
|
|
95
|
-
* @param url - the entire URL with the `/cors-proxy/` prefix and containing the
|
|
96
|
-
* url-Encoded Path.
|
|
97
|
-
*
|
|
98
|
-
* @returns The URL that needs to be called.
|
|
99
|
-
*/
|
|
100
|
-
function extractDestination(url) {
|
|
101
|
-
const withoutPrefix = url.replace('/cors-proxy/', '');
|
|
102
|
-
const asUrl = new URL(decodeURIComponent(withoutPrefix));
|
|
103
|
-
if (asUrl.protocol !== 'http:' && asUrl.protocol !== 'https:') {
|
|
104
|
-
throw new Error('Only supported protocols are http and https');
|
|
105
|
-
}
|
|
106
|
-
return asUrl;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* A simple Error Helper that will write an Error and close the response.
|
|
110
|
-
*/
|
|
111
|
-
function writeError(message, res, statusCode = 400) {
|
|
112
|
-
res.writeHead(statusCode, message);
|
|
113
|
-
res.end();
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Check if the Proxy is allowed to get the requested resource based on the
|
|
117
|
-
* host.
|
|
118
|
-
*/
|
|
119
|
-
function isReceivedUrlInAllowedHosts(hostname, allowListHosts) {
|
|
120
|
-
if (!allowListHosts || allowListHosts.length === 0) {
|
|
121
|
-
// if the allowListHosts is just the predefinedAllowlist, the user has not
|
|
122
|
-
// set any additional hosts. In this case, allow any hostname
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
// Check if the hostname is any of the values set in allowListHosts
|
|
126
|
-
return allowListHosts.some(e => e.toLowerCase().trim() === hostname.toLowerCase().trim());
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Check if the Proxy is allowed to get the requested resource based on the
|
|
130
|
-
* MIME-Type.
|
|
131
|
-
*
|
|
132
|
-
* @remarks
|
|
133
|
-
* Also handles catch-All Declarations like `image/*`.
|
|
134
|
-
*/
|
|
135
|
-
function isResultOfAllowedResourceType(foundMimeType, allowedMimeTypes) {
|
|
136
|
-
if (!allowedMimeTypes || allowedMimeTypes.length === 0) {
|
|
137
|
-
return true; // no filters set
|
|
138
|
-
}
|
|
139
|
-
if (foundMimeType.split('/').length !== 2) {
|
|
140
|
-
return false; // invalid mime structure
|
|
141
|
-
}
|
|
142
|
-
const [leftSegment, rightSegment] = foundMimeType
|
|
143
|
-
.split('/')
|
|
144
|
-
.map(e => e.trim().toLowerCase());
|
|
145
|
-
// Get all Segments where the left Part is identical between foundMimeType and
|
|
146
|
-
// allowedMimeType.
|
|
147
|
-
const leftSegmentMatches = allowedMimeTypes.filter(e => e.trim().toLowerCase().split('/')[0] === leftSegment);
|
|
148
|
-
if (leftSegmentMatches.length === 0) {
|
|
149
|
-
// No matches at all, not even catchall - resource is rejected.
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
// This just gets the right part of the MIME Types from the
|
|
153
|
-
// configured allowList, e.g. "image/png" -> png
|
|
154
|
-
const rightSegmentOfLeftSegmentMatches = leftSegmentMatches.map(e => e.split('/')[1]);
|
|
155
|
-
// if an exact match or a catchall is found, the resource is allowed to be
|
|
156
|
-
// proxied.
|
|
157
|
-
return rightSegmentOfLeftSegmentMatches.some(e => e === '*' || e === rightSegment);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Requests a remote resource with the help of axios
|
|
161
|
-
* May throw a string in case of a bad mime-type or missing headers
|
|
162
|
-
*/
|
|
163
|
-
async function tryGetResource(res, sourceUrl, config) {
|
|
164
|
-
// Turn this callback into a Promise to avoid additional nesting
|
|
165
|
-
const result = await new Promise((res, rej) => {
|
|
166
|
-
try {
|
|
167
|
-
// We check what protocol was used and decide if we use http or https
|
|
168
|
-
const request = (sourceUrl.protocol.startsWith('https')
|
|
169
|
-
? follow_redirects_1.default.https
|
|
170
|
-
: follow_redirects_1.default.http).get(sourceUrl, data => {
|
|
171
|
-
res(data);
|
|
172
|
-
});
|
|
173
|
-
request.on('error', (err) => {
|
|
174
|
-
if (err.code && err.code === 'ENOTFOUND') {
|
|
175
|
-
// This is a bit hacky, but this basically returns as a
|
|
176
|
-
// 404 instead of crashing the Node Server with ENOTFOUND
|
|
177
|
-
res({ statusCode: 404 });
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
rej(err);
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
rej(err);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
if (!result.statusCode || result.statusCode >= 300) {
|
|
189
|
-
throw 'Unexpected Status: ' + result.statusCode ?? 'NO_STATUS';
|
|
190
|
-
}
|
|
191
|
-
const contentType = result.headers['content-type'];
|
|
192
|
-
const contentLength = result.headers['content-length'];
|
|
193
|
-
if (!contentType) {
|
|
194
|
-
throw 'Proxied Response does not contain a Content Type';
|
|
195
|
-
}
|
|
196
|
-
if (!contentLength) {
|
|
197
|
-
throw 'Proxied Response does not contain a Content Length';
|
|
198
|
-
}
|
|
199
|
-
if (!isResultOfAllowedResourceType(contentType.toString(), config.allowedMimeTypes ?? [])) {
|
|
200
|
-
throw 'Proxied response has blocked content-type: ' + contentType;
|
|
201
|
-
}
|
|
202
|
-
// Prepare Response
|
|
203
|
-
for (const key in result.headers) {
|
|
204
|
-
const header = result.headers[key];
|
|
205
|
-
if (header === undefined) {
|
|
206
|
-
console.warn('Proxy: Received Header is empty. Skipping…');
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
res.setHeader(key, header);
|
|
210
|
-
}
|
|
211
|
-
res.addListener('error', () => {
|
|
212
|
-
console.log('Proxy: Connection Reset');
|
|
213
|
-
});
|
|
214
|
-
res.setHeader('x-proxy-destination', sourceUrl.toString());
|
|
215
|
-
// Don't store on the server, just immediately pass on the
|
|
216
|
-
// received chunks
|
|
217
|
-
result.pipe(res);
|
|
218
|
-
}
|
|
219
|
-
//# sourceMappingURL=corsProxy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"corsProxy.js","sourceRoot":"","sources":["../../src/partials/corsProxy.ts"],"names":[],"mappings":";;;;;;AAAA,wEAA+C;AA8B/C;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,eAAe,CAC7B,MAAwC;IAExC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,eAAe,CAAC,MAAM;YACpB,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC7C,qBAAqB,CACnB,MAAM,CAAC,WAAW,EAClB,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAC9B,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAfD,0CAeC;AAED,SAAS,oBAAoB,CAC3B,MAAmD;IAEnD,0BAA0B;IAC1B,MAAM,MAAM,GAAG,gBAAgB,CAAC;IAChC,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;IACxC,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;IAExC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,GAAG,EAAE,CAAC,CAAC,qBAAqB;IACpC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB;IAElE,IAAI,MAAM,EAAE,CAAC;QACX,2DAA2D;QAC3D,0DAA0D;QAC1D,kBAAkB;QAClB,OAAO,CAAC,GA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AM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEvD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,kDAAkD,CAAC;IAC3D,CAAC;IACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,oDAAoD,CAAC;IAC7D,CAAC;IAED,IACE,CAAC,6BAA6B,CAC5B,WAAW,CAAC,QAAQ,EAAE,EACtB,MAAM,CAAC,gBAAgB,IAAI,EAAE,CAC9B,EACD,CAAC;QACD,MAAM,6CAA6C,GAAG,WAAW,CAAC;IACpE,CAAC;IAED,mBAAmB;IACnB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;YAC3D,SAAS;QACX,CAAC;QACD,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IACD,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,SAAS,CAAC,qBAAqB,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,0DAA0D;IAC1D,kBAAkB;IAClB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC"}
|
package/lib/partials/scenes.d.ts
DELETED
package/lib/partials/scenes.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
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.scenesPlugin = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const utils_1 = require("../utils");
|
|
9
|
-
const SCENE_QUERY_REGEX = /[?&]scene\b/;
|
|
10
|
-
function scenesPlugin() {
|
|
11
|
-
return {
|
|
12
|
-
name: 'revideo:scene',
|
|
13
|
-
async load(id) {
|
|
14
|
-
if (!SCENE_QUERY_REGEX.test(id)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const [base] = id.split('?');
|
|
18
|
-
const { name, dir } = path_1.default.posix.parse(base);
|
|
19
|
-
const metaFile = `${name}.meta`;
|
|
20
|
-
await (0, utils_1.createMeta)(path_1.default.join(dir, metaFile));
|
|
21
|
-
const sceneFile = `${name}`;
|
|
22
|
-
/* language=typescript */
|
|
23
|
-
return `\
|
|
24
|
-
import {ValueDispatcher} from '@revideo/core';
|
|
25
|
-
import metaFile from './${metaFile}';
|
|
26
|
-
import description from './${sceneFile}';
|
|
27
|
-
description.name = '${name}';
|
|
28
|
-
metaFile.attach(description.meta);
|
|
29
|
-
if (import.meta.hot) {
|
|
30
|
-
description.onReplaced = import.meta.hot.data.onReplaced;
|
|
31
|
-
}
|
|
32
|
-
description.onReplaced ??= new ValueDispatcher(description.config);
|
|
33
|
-
if (import.meta.hot) {
|
|
34
|
-
import.meta.hot.accept();
|
|
35
|
-
if (import.meta.hot.data.onReplaced) {
|
|
36
|
-
description.onReplaced.current = description;
|
|
37
|
-
} else {
|
|
38
|
-
import.meta.hot.data.onReplaced = description.onReplaced;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export default description;
|
|
42
|
-
`;
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
exports.scenesPlugin = scenesPlugin;
|
|
47
|
-
//# sourceMappingURL=scenes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scenes.js","sourceRoot":"","sources":["../../src/partials/scenes.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,oCAAoC;AAEpC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAExC,SAAgB,YAAY;IAC1B,OAAO;QACL,IAAI,EAAE,eAAe;QAErB,KAAK,CAAC,IAAI,CAAC,EAAE;YACX,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBAChC,OAAO;YACT,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,EAAC,IAAI,EAAE,GAAG,EAAC,GAAG,cAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAG,GAAG,IAAI,OAAO,CAAC;YAChC,MAAM,IAAA,kBAAU,EAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC3C,MAAM,SAAS,GAAG,GAAG,IAAI,EAAE,CAAC;YAE5B,yBAAyB;YACzB,OAAO;;0BAEa,QAAQ;6BACL,SAAS;sBAChB,IAAI;;;;;;;;;;;;;;;CAezB,CAAC;QACE,CAAC;KACF,CAAC;AACJ,CAAC;AAtCD,oCAsCC"}
|