@revideo/vite-plugin 0.4.7-two.1024 → 0.4.7

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 CHANGED
@@ -1,41 +1,23 @@
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'));
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const main_1 = __importDefault(require("./main"));
39
21
  exports.default = main_1.default;
40
- __exportStar(require('./plugins'), exports);
41
- //# sourceMappingURL=index.js.map
22
+ __exportStar(require("./plugins"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -1,44 +1,45 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', {value: true});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.openInExplorer = void 0;
4
- const child_process_1 = require('child_process');
5
- const os_1 = require('os');
4
+ const child_process_1 = require("child_process");
5
+ const os_1 = require("os");
6
6
  function openInExplorer(file) {
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
- }
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
+ }
19
+ else {
20
+ command = 'xdg-open';
21
+ }
22
+ break;
23
+ case 'darwin':
24
+ command = 'open';
25
+ break;
26
+ }
27
+ if (command) {
28
+ (0, child_process_1.spawn)(command, args, { detached: true }).unref();
29
+ }
30
+ else {
31
+ console.warn(`Unsupported OS: ${os}`);
32
+ }
31
33
  }
32
34
  exports.openInExplorer = openInExplorer;
33
35
  function isRunningOnWSL() {
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
- }
36
+ try {
37
+ const uname = (0, child_process_1.execSync)('uname -a').toString().toLowerCase();
38
+ return uname.includes('microsoft');
39
+ }
40
+ catch (error) {
41
+ console.error(`exec error: ${error}`);
42
+ return false;
43
+ }
43
44
  }
44
- //# sourceMappingURL=openInExplorer.js.map
45
+ //# sourceMappingURL=openInExplorer.js.map
@@ -1,8 +1,6 @@
1
- import {Plugin} from 'vite';
1
+ import { Plugin } from 'vite';
2
2
  interface AssetsPluginConfig {
3
- bufferedAssets: RegExp | false;
3
+ bufferedAssets: RegExp | false;
4
4
  }
5
- export declare function assetsPlugin({
6
- bufferedAssets,
7
- }: AssetsPluginConfig): Plugin;
5
+ export declare function assetsPlugin({ bufferedAssets }: AssetsPluginConfig): Plugin;
8
6
  export {};
@@ -1,54 +1,51 @@
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});
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 });
8
6
  exports.assetsPlugin = void 0;
9
- const fs_1 = __importDefault(require('fs'));
10
- const path_1 = __importDefault(require('path'));
11
- const stream_1 = require('stream');
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const stream_1 = require("stream");
12
10
  const AUDIO_EXTENSION_REGEX = /\.(mp3|wav|ogg|aac|flac)(?:$|\?)/;
13
11
  const AUDIO_HMR_DELAY = 1000;
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
- };
12
+ function assetsPlugin({ bufferedAssets }) {
13
+ let config;
14
+ return {
15
+ name: 'revideo:assets',
16
+ configResolved(resolvedConfig) {
17
+ config = resolvedConfig;
18
+ },
19
+ configureServer(server) {
20
+ server.middlewares.use((req, res, next) => {
21
+ if (req.url && bufferedAssets && bufferedAssets.test(req.url)) {
22
+ const file = fs_1.default.readFileSync(path_1.default.resolve(config.root, req.url.slice(1)));
23
+ stream_1.Readable.from(file).pipe(res);
24
+ return;
25
+ }
26
+ next();
27
+ });
28
+ },
29
+ async handleHotUpdate(ctx) {
30
+ const urls = [];
31
+ const modules = [];
32
+ for (const module of ctx.modules) {
33
+ urls.push(module.url);
34
+ if (!AUDIO_EXTENSION_REGEX.test(module.url)) {
35
+ modules.push(module);
36
+ }
37
+ else {
38
+ await new Promise(resolve => {
39
+ setTimeout(resolve, AUDIO_HMR_DELAY);
40
+ });
41
+ }
42
+ }
43
+ if (urls.length > 0) {
44
+ ctx.server.ws.send('revideo:assets', { urls });
45
+ }
46
+ return modules;
47
+ },
48
+ };
52
49
  }
53
50
  exports.assetsPlugin = assetsPlugin;
54
- //# sourceMappingURL=assets.js.map
51
+ //# sourceMappingURL=assets.js.map
@@ -1,28 +1,28 @@
1
- import {Plugin} from 'vite';
1
+ import { Plugin } from 'vite';
2
2
  /**
3
3
  * Configuration used by the Proxy plugin
4
4
  */
5
5
  export interface CorsProxyPluginConfig {
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[];
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,6 +40,4 @@ 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(
44
- config?: CorsProxyPluginConfig | boolean,
45
- ): Plugin;
43
+ export declare function corsProxyPlugin(config?: CorsProxyPluginConfig | boolean): Plugin;