@twick/vite-plugin 0.11.0

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/lib/index.d.ts +3 -0
  3. package/lib/index.js +23 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/main.d.ts +71 -0
  6. package/lib/main.js +40 -0
  7. package/lib/main.js.map +1 -0
  8. package/lib/openInExplorer.d.ts +1 -0
  9. package/lib/openInExplorer.js +44 -0
  10. package/lib/openInExplorer.js.map +1 -0
  11. package/lib/partials/assets.d.ts +6 -0
  12. package/lib/partials/assets.js +50 -0
  13. package/lib/partials/assets.js.map +1 -0
  14. package/lib/partials/editor.d.ts +8 -0
  15. package/lib/partials/editor.js +73 -0
  16. package/lib/partials/editor.js.map +1 -0
  17. package/lib/partials/ffmpegBridge.d.ts +40 -0
  18. package/lib/partials/ffmpegBridge.js +195 -0
  19. package/lib/partials/ffmpegBridge.js.map +1 -0
  20. package/lib/partials/imageExporter.d.ts +6 -0
  21. package/lib/partials/imageExporter.js +45 -0
  22. package/lib/partials/imageExporter.js.map +1 -0
  23. package/lib/partials/index.d.ts +11 -0
  24. package/lib/partials/index.js +28 -0
  25. package/lib/partials/index.js.map +1 -0
  26. package/lib/partials/meta.d.ts +2 -0
  27. package/lib/partials/meta.js +68 -0
  28. package/lib/partials/meta.js.map +1 -0
  29. package/lib/partials/metrics.d.ts +2 -0
  30. package/lib/partials/metrics.js +13 -0
  31. package/lib/partials/metrics.js.map +1 -0
  32. package/lib/partials/projects.d.ts +10 -0
  33. package/lib/partials/projects.js +34 -0
  34. package/lib/partials/projects.js.map +1 -0
  35. package/lib/partials/rive.d.ts +2 -0
  36. package/lib/partials/rive.js +70 -0
  37. package/lib/partials/rive.js.map +1 -0
  38. package/lib/partials/settings.d.ts +2 -0
  39. package/lib/partials/settings.js +65 -0
  40. package/lib/partials/settings.js.map +1 -0
  41. package/lib/partials/wasmExporter.d.ts +2 -0
  42. package/lib/partials/wasmExporter.js +87 -0
  43. package/lib/partials/wasmExporter.js.map +1 -0
  44. package/lib/partials/webgl.d.ts +10 -0
  45. package/lib/partials/webgl.js +88 -0
  46. package/lib/partials/webgl.js.map +1 -0
  47. package/lib/plugins.d.ts +99 -0
  48. package/lib/plugins.js +9 -0
  49. package/lib/plugins.js.map +1 -0
  50. package/lib/tsconfig.tsbuildinfo +1 -0
  51. package/lib/utils.d.ts +6 -0
  52. package/lib/utils.js +44 -0
  53. package/lib/utils.js.map +1 -0
  54. package/lib/versions.d.ts +6 -0
  55. package/lib/versions.js +28 -0
  56. package/lib/versions.js.map +1 -0
  57. package/package.json +36 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 motion-canvas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import motionCanvas from './main';
2
+ export default motionCanvas;
3
+ export * from './plugins';
package/lib/index.js ADDED
@@ -0,0 +1,23 @@
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"));
21
+ exports.default = main_1.default;
22
+ __exportStar(require("./plugins"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,kDAAkC;AAElC,kBAAe,cAAY,CAAC;AAC5B,4CAA0B"}
package/lib/main.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ import type { Plugin } from 'vite';
2
+ export interface MotionCanvasPluginConfig {
3
+ /**
4
+ * The import path of the project file or an array of paths.
5
+ * Also supports globs.
6
+ *
7
+ * @remarks
8
+ * Each file must contain a default export exposing an instance of the
9
+ * {@link Project} class.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * motionCanvas({
14
+ * project: [
15
+ * './src/firstProject.ts',
16
+ * './src/secondProject.ts',
17
+ * ]
18
+ * })
19
+ * ```
20
+ *
21
+ * @defaultValue './src/project.ts'
22
+ */
23
+ project?: string | string[];
24
+ /**
25
+ * A directory path to which the animation will be rendered.
26
+ *
27
+ * @defaultValue './output'
28
+ */
29
+ output?: string;
30
+ /**
31
+ * Defines which assets should be buffered before being sent to the browser.
32
+ *
33
+ * @remarks
34
+ * Streaming larger assets directly from the drive may cause issues with other
35
+ * applications. For instance, if an audio file is being used in the project,
36
+ * Adobe Audition will perceive it as "being used by another application"
37
+ * and refuse to override it.
38
+ *
39
+ * Buffered assets are first loaded to the memory and then streamed from
40
+ * there. This leaves the original files open for modification with hot module
41
+ * replacement still working.
42
+ *
43
+ * @defaultValue /^$/
44
+ */
45
+ bufferedAssets?: RegExp | false;
46
+ /**
47
+ * The import path of the editor package.
48
+ *
49
+ * @remarks
50
+ * This path will be resolved using Node.js module resolution rules.
51
+ * It should lead to a directory containing the following files:
52
+ * - `editor.html` - The HTML template for the editor.
53
+ * - `styles.css` - The editor styles.
54
+ * - `main.js` - A module exporting necessary factory functions.
55
+ *
56
+ * `main.js` should export the following functions:
57
+ * - `editor` - Receives the project factory as its first argument and creates
58
+ * the user interface.
59
+ * - `index` - Receives a list of all projects as its first argument and
60
+ * creates the initial page for selecting a project.
61
+ *
62
+ * @defaultValue '\@twick/ui'
63
+ */
64
+ editor?: string;
65
+ /**
66
+ * Build the project to run in the editor.
67
+ */
68
+ buildForEditor?: boolean;
69
+ }
70
+ declare const _default: ({ project, output, bufferedAssets, editor, buildForEditor, }?: MotionCanvasPluginConfig) => Plugin[];
71
+ export default _default;
package/lib/main.js ADDED
@@ -0,0 +1,40 @@
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
+ 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 = '@twick/ui', 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: 'twick',
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.exporterPlugin)({ outputPath }),
30
+ (0, partials_1.ffmpegBridgePlugin)({ output: 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.wasmExporterPlugin)(),
35
+ (0, partials_1.rivePlugin)(),
36
+ (0, partials_1.webglPlugin)(),
37
+ (0, partials_1.metricsPlugin)(),
38
+ ];
39
+ };
40
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,yCAYoB;AAEpB,uCAAmD;AACnD,mCAAoC;AAwEpC,kBAAe,CAAC,EACd,OAAO,GAAG,kBAAkB,EAC5B,MAAM,GAAG,UAAU,EACnB,cAAc,GAAG,IAAI,EACrB,MAAM,GAAG,WAAW,EACpB,cAAc,MACc,EAAE,EAAY,EAAE;IAC5C,MAAM,OAAO,GAAoB,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAAC,OAAO,CAAC,CAAC;IAEtC,OAAO;QACL;YACE,IAAI,EAAE,OAAO;YACb,KAAK,CAAC,cAAc,CAAC,cAAc;gBACjC,OAAO,CAAC,IAAI,CACV,GAAG,cAAc,CAAC,OAAO;qBACtB,MAAM,CAAC,kBAAQ,CAAC;qBAChB,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,wBAAc,CAAC,CAAC,CACzC,CAAC;gBACF,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CACnB,MAAM,CAAC,MAAM,EAAE,CAAC;oBACd,MAAM,EAAE,UAAU;oBAClB,QAAQ,EAAE,QAAQ,CAAC,IAAI;iBACxB,CAAC,CACH,CACF,CAAC;YACJ,CAAC;SACF;QACD,IAAA,qBAAU,GAAE;QACZ,IAAA,yBAAc,GAAE;QAChB,IAAA,yBAAc,EAAC,EAAC,UAAU,EAAC,CAAC;QAC5B,IAAA,6BAAkB,EAAC,EAAC,MAAM,EAAE,UAAU,EAAC,CAAC;QACxC,IAAA,uBAAY,EAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC;QAChC,IAAA,yBAAc,EAAC,EAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAC,CAAC;QACnD,IAAA,uBAAY,EAAC,EAAC,cAAc,EAAC,CAAC;QAC9B,IAAA,6BAAkB,GAAE;QACpB,IAAA,qBAAU,GAAE;QACZ,IAAA,sBAAW,GAAE;QACb,IAAA,wBAAa,GAAE;KAChB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function openInExplorer(file: string): void;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.openInExplorer = openInExplorer;
4
+ const child_process_1 = require("child_process");
5
+ const os_1 = require("os");
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
+ }
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
+ }
33
+ }
34
+ function isRunningOnWSL() {
35
+ try {
36
+ const uname = (0, child_process_1.execSync)('uname -a').toString().toLowerCase();
37
+ return uname.includes('microsoft');
38
+ }
39
+ catch (error) {
40
+ console.error(`exec error: ${error}`);
41
+ return false;
42
+ }
43
+ }
44
+ //# sourceMappingURL=openInExplorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openInExplorer.js","sourceRoot":"","sources":["../src/openInExplorer.ts"],"names":[],"mappings":";;AAGA,wCA2BC;AA9BD,iDAA8C;AAC9C,2BAA4B;AAE5B,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,IAAA,aAAQ,GAAE,CAAC;IAEtB,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,OAAO;YACV,OAAO,GAAG,UAAU,CAAC;YACrB,MAAM;QACR,KAAK,OAAO;YACV,IAAI,cAAc,EAAE,EAAE,CAAC;gBACrB,OAAO,GAAG,MAAM,CAAC;gBACjB,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,oBAAoB,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,UAAU,CAAC;YACvB,CAAC;YACD,MAAM;QACR,KAAK,QAAQ;YACX,OAAO,GAAG,MAAM,CAAC;YACjB,MAAM;IACV,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,IAAA,qBAAK,EAAC,OAAO,EAAE,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAA,wBAAQ,EAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAe,KAAK,EAAE,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from 'vite';
2
+ interface AssetsPluginConfig {
3
+ bufferedAssets: RegExp | false;
4
+ }
5
+ export declare function assetsPlugin({ bufferedAssets }: AssetsPluginConfig): Plugin;
6
+ export {};
@@ -0,0 +1,50 @@
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.assetsPlugin = assetsPlugin;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const stream_1 = require("stream");
10
+ const AUDIO_EXTENSION_REGEX = /\.(mp3|wav|ogg|aac|flac)(?:$|\?)/;
11
+ const AUDIO_HMR_DELAY = 1000;
12
+ function assetsPlugin({ bufferedAssets }) {
13
+ let config;
14
+ return {
15
+ name: 'twick: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('twick:assets', { urls });
45
+ }
46
+ return modules;
47
+ },
48
+ };
49
+ }
50
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/partials/assets.ts"],"names":[],"mappings":";;;;;AAYA,oCA6CC;AAzDD,4CAAoB;AACpB,gDAAwB;AACxB,mCAAgC;AAGhC,MAAM,qBAAqB,GAAG,kCAAkC,CAAC;AACjE,MAAM,eAAe,GAAG,IAAI,CAAC;AAM7B,SAAgB,YAAY,CAAC,EAAC,cAAc,EAAqB;IAC/D,IAAI,MAAsB,CAAC;IAC3B,OAAO;QACL,IAAI,EAAE,cAAc;QAEpB,cAAc,CAAC,cAAc;YAC3B,MAAM,GAAG,cAAc,CAAC;QAC1B,CAAC;QAED,eAAe,CAAC,MAAM;YACpB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;gBACxC,IAAI,GAAG,CAAC,GAAG,IAAI,cAAc,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC9D,MAAM,IAAI,GAAG,YAAE,CAAC,YAAY,CAC1B,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAC5C,CAAC;oBACF,iBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAC9B,OAAO;gBACT,CAAC;gBAED,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,eAAe,CAAC,GAAG;YACvB,MAAM,IAAI,GAAG,EAAE,CAAC;YAChB,MAAM,OAAO,GAAiB,EAAE,CAAC;YAEjC,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;gBACjC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACtB,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC5C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvB,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;wBAC1B,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;oBACvC,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpB,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,EAAC,IAAI,EAAC,CAAC,CAAC;YAC7C,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { Projects } from '../utils';
3
+ interface EditorPluginConfig {
4
+ editor: string;
5
+ projects: Projects;
6
+ }
7
+ export declare function editorPlugin({ editor, projects }: EditorPluginConfig): Plugin;
8
+ export {};
@@ -0,0 +1,73 @@
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.editorPlugin = editorPlugin;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ function editorPlugin({ editor, projects }) {
10
+ const editorPath = path_1.default.dirname(require.resolve(editor));
11
+ const editorFile = fs_1.default.readFileSync(path_1.default.resolve(editorPath, 'editor.html'));
12
+ const htmlParts = editorFile
13
+ .toString()
14
+ .replace('{{style}}', `/@fs/${path_1.default.resolve(editorPath, 'style.css')}`)
15
+ .split('{{source}}');
16
+ const createHtml = (src) => htmlParts[0] + src + htmlParts[1];
17
+ const resolvedEditorId = '\0virtual:editor';
18
+ return {
19
+ name: 'twick:editor',
20
+ async load(id) {
21
+ const [, query] = id.split('?');
22
+ if (id.startsWith(resolvedEditorId)) {
23
+ if (projects.list.length === 1) {
24
+ /* language=typescript */
25
+ return `\
26
+ import {editor} from '${editor}';
27
+ import project from '${projects.list[0].url}';
28
+ import {addEditorToProject} from '@twick/core';
29
+ editor(await addEditorToProject(project));
30
+ `;
31
+ }
32
+ if (query) {
33
+ const params = new URLSearchParams(query);
34
+ const name = params.get('project');
35
+ if (name && projects.lookup.has(name)) {
36
+ /* language=typescript */
37
+ return `\
38
+ import {editor} from '${editor}';
39
+ import project from '${projects.lookup.get(name).url}';
40
+ import {addEditorToProject} from '@twick/core';
41
+ editor(await addEditorToProject(project));
42
+ `;
43
+ }
44
+ }
45
+ /* language=typescript */
46
+ return `\
47
+ import {index} from '${editor}';
48
+ index(${JSON.stringify(projects.list)});
49
+ `;
50
+ }
51
+ },
52
+ configureServer(server) {
53
+ server.middlewares.use((req, res, next) => {
54
+ if (req.url) {
55
+ const url = new URL(req.url, `http://${req.headers.host}`);
56
+ if (url.pathname === '/') {
57
+ res.setHeader('Content-Type', 'text/html');
58
+ res.end(createHtml('/@id/__x00__virtual:editor'));
59
+ return;
60
+ }
61
+ const name = url.pathname.slice(1);
62
+ if (name && projects.lookup.has(name)) {
63
+ res.setHeader('Content-Type', 'text/html');
64
+ res.end(createHtml(`/@id/__x00__virtual:editor?project=${name}`));
65
+ return;
66
+ }
67
+ }
68
+ next();
69
+ });
70
+ },
71
+ };
72
+ }
73
+ //# sourceMappingURL=editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.js","sourceRoot":"","sources":["../../src/partials/editor.ts"],"names":[],"mappings":";;;;;AAUA,oCAwEC;AAlFD,4CAAoB;AACpB,gDAAwB;AASxB,SAAgB,YAAY,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAqB;IACjE,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5E,MAAM,SAAS,GAAG,UAAU;SACzB,QAAQ,EAAE;SACV,OAAO,CAAC,WAAW,EAAE,QAAQ,cAAI,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC;SACrE,KAAK,CAAC,YAAY,CAAC,CAAC;IACvB,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAEtE,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;IAE5C,OAAO;QACL,IAAI,EAAE,cAAc;QAEpB,KAAK,CAAC,IAAI,CAAC,EAAE;YACX,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAEhC,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBACpC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC/B,yBAAyB;oBACzB,OAAO;wBACO,MAAM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GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;wBACtC,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;wBAC3C,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,sCAAsC,IAAI,EAAE,CAAC,CAAC,CAAC;wBAClE,OAAO;oBACT,CAAC;gBACH,CAAC;gBAED,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { Plugin, WebSocketServer } from 'vite';
2
+ interface ExporterPluginConfig {
3
+ output: string;
4
+ }
5
+ export declare function ffmpegBridgePlugin({ output }: ExporterPluginConfig): Plugin;
6
+ /**
7
+ * A simple bridge between the FFmpegExporterServer and FFmpegExporterClient.
8
+ *
9
+ * @remarks
10
+ * This class lets the client exporter invoke methods on the server and receive
11
+ * responses using a simple Promise-based API.
12
+ */
13
+ export declare class FFmpegBridge {
14
+ private readonly ws;
15
+ private readonly config;
16
+ private process;
17
+ constructor(ws: WebSocketServer, config: ExporterPluginConfig);
18
+ private handleMessage;
19
+ private respondSuccess;
20
+ private respondError;
21
+ private videoFrameExtractors;
22
+ handleDownloadVideoChunks(videoDurations: {
23
+ src: string;
24
+ startTime: number;
25
+ endTime: number;
26
+ }[]): Promise<void>;
27
+ handleDecodeVideoFrame(data: {
28
+ id: string;
29
+ filePath: string;
30
+ startTime: number;
31
+ duration: number;
32
+ fps: number;
33
+ }): Promise<{
34
+ frame: Buffer | null;
35
+ width: number;
36
+ height: number;
37
+ }>;
38
+ handleRenderFinished(): Promise<void>;
39
+ }
40
+ export {};
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FFmpegBridge = void 0;
4
+ exports.ffmpegBridgePlugin = ffmpegBridgePlugin;
5
+ const ffmpeg_1 = require("@twick/ffmpeg");
6
+ const fs_1 = require("fs");
7
+ function ffmpegBridgePlugin({ output }) {
8
+ return {
9
+ name: 'twick/ffmpeg',
10
+ configureServer(server) {
11
+ const ffmpegBridge = new FFmpegBridge(server.ws, { output });
12
+ const handlePostRequest = async (req, res, handler) => {
13
+ if (req.method !== 'POST') {
14
+ res.statusCode = 405;
15
+ res.end('Method Not Allowed');
16
+ return;
17
+ }
18
+ try {
19
+ const body = await new Promise((resolve, reject) => {
20
+ let data = '';
21
+ req.on('data', (chunk) => (data += chunk));
22
+ req.on('end', () => resolve(data));
23
+ req.on('error', reject);
24
+ });
25
+ const parsedBody = JSON.parse(body);
26
+ const result = await handler(parsedBody);
27
+ if (res.writableEnded) {
28
+ return;
29
+ }
30
+ res.statusCode = 200;
31
+ if (result) {
32
+ res.setHeader('Content-Type', 'application/json');
33
+ res.end(JSON.stringify(result));
34
+ return;
35
+ }
36
+ res.end('OK');
37
+ }
38
+ catch (error) {
39
+ console.error('error in request handler', error);
40
+ res.statusCode = 500;
41
+ res.end('Internal Server Error');
42
+ }
43
+ };
44
+ server.middlewares.use('/audio-processing/generate-audio', (req, res) => handlePostRequest(req, res, async ({ tempDir, assets, startFrame, endFrame, fps }) => (0, ffmpeg_1.generateAudio)({
45
+ outputDir: output,
46
+ tempDir,
47
+ assets,
48
+ startFrame,
49
+ endFrame,
50
+ fps,
51
+ })));
52
+ server.middlewares.use('/audio-processing/merge-media', (req, res) => handlePostRequest(req, res, async ({ outputFilename, tempDir, format }) => (0, ffmpeg_1.mergeMedia)(outputFilename, output, tempDir, format)));
53
+ server.middlewares.use('/twick-ffmpeg-decoder/video-frame', (req, res) => handlePostRequest(req, res, async (data) => {
54
+ const { frame, width, height } = await ffmpegBridge.handleDecodeVideoFrame(data);
55
+ res.setHeader('X-Frame-Width', width.toString());
56
+ res.setHeader('X-Frame-Height', height.toString());
57
+ res.setHeader('Content-Type', 'application/octet-stream');
58
+ res.end(Buffer.from(frame));
59
+ }));
60
+ server.middlewares.use('/twick-ffmpeg-decoder/finished', (req, res) => {
61
+ handlePostRequest(req, res, async () => {
62
+ await ffmpegBridge.handleRenderFinished();
63
+ });
64
+ });
65
+ server.middlewares.use('/twick-ffmpeg-decoder/download-video-chunks', (req, res) => handlePostRequest(req, res, async (videoDurations) => {
66
+ const downloadedPaths = await ffmpegBridge.handleDownloadVideoChunks(videoDurations);
67
+ return { success: true, paths: downloadedPaths };
68
+ }));
69
+ },
70
+ };
71
+ }
72
+ /**
73
+ * A simple bridge between the FFmpegExporterServer and FFmpegExporterClient.
74
+ *
75
+ * @remarks
76
+ * This class lets the client exporter invoke methods on the server and receive
77
+ * responses using a simple Promise-based API.
78
+ */
79
+ class FFmpegBridge {
80
+ constructor(ws, config) {
81
+ this.ws = ws;
82
+ this.config = config;
83
+ this.process = null;
84
+ this.handleMessage = async ({ method, data }) => {
85
+ if (method === 'start') {
86
+ try {
87
+ this.process = new ffmpeg_1.FFmpegExporterServer({
88
+ ...data,
89
+ ...this.config,
90
+ });
91
+ this.respondSuccess(method, await this.process.start());
92
+ }
93
+ catch (e) {
94
+ this.respondError(method, e?.message);
95
+ }
96
+ return;
97
+ }
98
+ if (!this.process) {
99
+ this.respondError(method, 'The exporting process has not been started.');
100
+ return;
101
+ }
102
+ if (!(method in this.process)) {
103
+ this.respondError(method, `Unknown method: "${method}".`);
104
+ return;
105
+ }
106
+ try {
107
+ this.respondSuccess(method, await this.process[method](data));
108
+ }
109
+ catch (e) {
110
+ this.respondError(method, e?.message);
111
+ }
112
+ if (method === 'kill') {
113
+ this.process = null;
114
+ return;
115
+ }
116
+ };
117
+ // List of VideoFrameExtractors
118
+ this.videoFrameExtractors = new Map();
119
+ ws.on('twick:ffmpeg-exporter', this.handleMessage);
120
+ }
121
+ respondSuccess(method, data = {}) {
122
+ this.ws.send('twick:ffmpeg-exporter-ack', {
123
+ status: 'success',
124
+ method,
125
+ data,
126
+ });
127
+ }
128
+ respondError(method, message = 'Unknown error.') {
129
+ this.ws.send('twick:ffmpeg-exporter-ack', {
130
+ status: 'error',
131
+ method,
132
+ message,
133
+ });
134
+ }
135
+ async handleDownloadVideoChunks(videoDurations) {
136
+ const downloadPromises = videoDurations.map(({ src, startTime, endTime }) => ffmpeg_1.VideoFrameExtractor.downloadVideoChunk(src, startTime, endTime));
137
+ await Promise.all(downloadPromises);
138
+ }
139
+ async handleDecodeVideoFrame(data) {
140
+ const typedData = data;
141
+ // Check if we already have a VideoFrameExtractor for this video
142
+ const id = typedData.filePath + '-' + typedData.id;
143
+ let extractor = this.videoFrameExtractors.get(id);
144
+ const frameDuration = 1 / typedData.fps;
145
+ const isOldFrame = extractor &&
146
+ Math.abs(typedData.startTime - extractor.getLastTime()) <
147
+ frameDuration / 2;
148
+ // If time has not changed, return the last frame
149
+ if (isOldFrame) {
150
+ const frame = extractor.getLastFrame();
151
+ return {
152
+ frame,
153
+ width: extractor.getWidth(),
154
+ height: extractor.getHeight(),
155
+ };
156
+ }
157
+ // If the video has skipped back we need to create a new extractor
158
+ if (extractor &&
159
+ typedData.startTime + frameDuration < extractor.getTime()) {
160
+ extractor.destroy();
161
+ this.videoFrameExtractors.delete(id);
162
+ extractor = undefined;
163
+ }
164
+ // If the video has skipped forward we need to create a new extractor
165
+ if (extractor &&
166
+ typedData.startTime > extractor.getTime() + frameDuration) {
167
+ extractor.destroy();
168
+ this.videoFrameExtractors.delete(id);
169
+ extractor = undefined;
170
+ }
171
+ if (!extractor) {
172
+ extractor = new ffmpeg_1.VideoFrameExtractor(data.filePath, data.startTime, data.fps, data.duration);
173
+ this.videoFrameExtractors.set(id, extractor);
174
+ }
175
+ // Go to the frame that is closest to the requested time
176
+ const frame = await extractor.popImage();
177
+ return {
178
+ frame: frame,
179
+ width: extractor.getWidth(),
180
+ height: extractor.getHeight(),
181
+ };
182
+ }
183
+ async handleRenderFinished() {
184
+ this.videoFrameExtractors.forEach(extractor => {
185
+ extractor.destroy();
186
+ const localFile = ffmpeg_1.VideoFrameExtractor.downloadedVideoMap.get(extractor.filePath)?.localPath;
187
+ if (localFile && (0, fs_1.existsSync)(localFile)) {
188
+ (0, fs_1.unlinkSync)(localFile);
189
+ }
190
+ });
191
+ this.videoFrameExtractors.clear();
192
+ }
193
+ }
194
+ exports.FFmpegBridge = FFmpegBridge;
195
+ //# sourceMappingURL=ffmpegBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ffmpegBridge.js","sourceRoot":"","sources":["../../src/partials/ffmpegBridge.ts"],"names":[],"mappings":";;;AAoBA,gDAmGC;AAtHD,0CAKuB;AACvB,2BAA0C;AAa1C,SAAgB,kBAAkB,CAAC,EAAC,MAAM,EAAuB;IAC/D,OAAO;QACL,IAAI,EAAE,cAAc;QAEpB,eAAe,CAAC,MAAM;YACpB,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC;YAE3D,MAAM,iBAAiB,GAAG,KAAK,EAC7B,GAAoB,EACpB,GAAmB,EACnB,OAAoC,EACpC,EAAE;gBACF,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;oBAC1B,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;oBACrB,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;oBAC9B,OAAO;gBACT,CAAC;gBAED,IAAI,CAAC;oBACH,MAAM,IAAI,GAAQ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;wBACtD,IAAI,IAAI,GAAG,EAAE,CAAC;wBACd,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC;wBACnD,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;wBACnC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;oBAC1B,CAAC,CAAC,CAAC;oBAEH,MAAM,UAAU,GAAG,IAAI,CAAC,K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,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;QAED,wDAAwD;QACxD,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;QAEzC,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,SAAU,CAAC,QAAQ,EAAE;YAC5B,MAAM,EAAE,SAAU,CAAC,SAAS,EAAE;SAC/B,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,oBAAoB;QAC/B,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC5C,SAAS,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,SAAS,GAAG,4BAAmB,CAAC,kBAAkB,CAAC,GAAG,CAC1D,SAAS,CAAC,QAAQ,CACnB,EAAE,SAAS,CAAC;YACb,IAAI,SAAS,IAAI,IAAA,eAAU,EAAC,SAAS,CAAC,EAAE,CAAC;gBACvC,IAAA,eAAU,EAAC,SAAS,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;CACF;AAlKD,oCAkKC"}
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from 'vite';
2
+ interface ExporterPluginConfig {
3
+ outputPath: string;
4
+ }
5
+ export declare function exporterPlugin({ outputPath }: ExporterPluginConfig): Plugin;
6
+ export {};