@editframe/cli 0.8.0-beta.9 → 0.9.0-beta.3

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/dist/VERSION.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.8.0-beta.9";
1
+ export declare const VERSION = "0.9.0-beta.3";
package/dist/VERSION.js CHANGED
@@ -1,4 +1,4 @@
1
- const VERSION = "0.8.0-beta.9";
1
+ const VERSION = "0.9.0-beta.3";
2
2
  export {
3
3
  VERSION
4
4
  };
@@ -1 +1 @@
1
- export {};
1
+ export declare const buildAssetId: (assetPath: string) => Promise<string>;
@@ -17,34 +17,19 @@ import { getRenderInfo } from "../operations/getRenderInfo.js";
17
17
  import { processRenderInfo } from "../operations/processRenderInfo.js";
18
18
  import { validateVideoResolution } from "../utils/validateVideoResolution.js";
19
19
  import { getFolderSize } from "../utils/getFolderSize.js";
20
- const buildProductionUrl = async (origin, tagName, assetPath) => {
20
+ const buildAssetId = async (assetPath) => {
21
21
  const md5Sum = await md5FilePath(assetPath);
22
22
  const basename = path.basename(assetPath);
23
- switch (tagName) {
24
- case "ef-audio":
25
- case "ef-video": {
26
- return `${origin}/api/video2/isobmff_files/${md5Sum}/${basename}`;
27
- }
28
- case "ef-captions": {
29
- return `${origin}/api/video2/caption_files/${md5Sum}/${basename}`;
30
- }
31
- case "ef-image": {
32
- return `${origin}/api/video2/image_files/${md5Sum}/${basename}`;
33
- }
34
- default: {
35
- return assetPath;
36
- }
37
- }
23
+ return `${md5Sum}:${basename}`;
38
24
  };
39
25
  class V1Builder {
40
- async buildProductionUrl(tagName, assetPath) {
41
- return buildProductionUrl("editframe://", tagName, assetPath);
26
+ async buildAssetId(assetPath) {
27
+ return buildAssetId(assetPath);
42
28
  }
43
29
  }
44
30
  class V2Builder {
45
- async buildProductionUrl(tagName, assetPath) {
46
- const efRenderHost = program.opts().efRenderHost;
47
- return buildProductionUrl(efRenderHost, tagName, assetPath);
31
+ async buildAssetId(assetPath) {
32
+ return buildAssetId(assetPath);
48
33
  }
49
34
  }
50
35
  const strategyBuilders = {
@@ -109,11 +94,8 @@ program.command("render [directory]").description(
109
94
  }
110
95
  const assetPath = path.join(srcDir, src);
111
96
  element.setAttribute(
112
- "src",
113
- await builder.buildProductionUrl(
114
- element.tagName.toLowerCase(),
115
- assetPath
116
- )
97
+ "asset-id",
98
+ await builder.buildAssetId(assetPath)
117
99
  );
118
100
  }
119
101
  await writeFile(path.join(distDir, "index.html"), doc.toString());
@@ -151,3 +133,6 @@ program.command("render [directory]").description(
151
133
  }
152
134
  );
153
135
  });
136
+ export {
137
+ buildAssetId
138
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/cli",
3
- "version": "0.8.0-beta.9",
3
+ "version": "0.9.0-beta.3",
4
4
  "description": "Command line interface for EditFrame",
5
5
  "bin": {
6
6
  "editframe": "./dist/index.js"
@@ -14,7 +14,6 @@
14
14
  "author": "",
15
15
  "license": "UNLICENSED",
16
16
  "devDependencies": {
17
- "@inquirer/prompts": "^5.3.8",
18
17
  "@types/dom-webcodecs": "^0.1.11",
19
18
  "@types/node": "^20.14.13",
20
19
  "@types/promptly": "^3.0.5",
@@ -24,10 +23,11 @@
24
23
  "vite-tsconfig-paths": "^4.3.2"
25
24
  },
26
25
  "dependencies": {
27
- "@editframe/api": "0.8.0-beta.9",
28
- "@editframe/assets": "0.8.0-beta.9",
29
- "@editframe/elements": "0.8.0-beta.9",
30
- "@editframe/vite-plugin": "0.8.0-beta.9",
26
+ "@editframe/api": "0.9.0-beta.3",
27
+ "@editframe/assets": "0.9.0-beta.3",
28
+ "@editframe/elements": "0.9.0-beta.3",
29
+ "@editframe/vite-plugin": "0.9.0-beta.3",
30
+ "@inquirer/prompts": "^5.3.8",
31
31
  "axios": "^1.6.8",
32
32
  "chalk": "^5.3.0",
33
33
  "commander": "^12.0.0",
@@ -0,0 +1,34 @@
1
+ // @vitest-environment node
2
+ import { join } from "node:path";
3
+ import { describe, expect, test } from "vitest";
4
+ import { buildAssetId } from "./render.ts";
5
+
6
+ const testAssetPath = join(__dirname, "test-asset.file");
7
+
8
+ describe("render", () => {
9
+ describe("buildProductionUrl", () => {
10
+ test("builds urls for ef-audio", async () => {
11
+ await expect(buildAssetId(testAssetPath)).resolves.toBe(
12
+ "d41d8cd9-8f00-b204-e980-0998ecf8427e:test-asset.file",
13
+ );
14
+ });
15
+
16
+ test("builds urls for ef-video", async () => {
17
+ await expect(buildAssetId(testAssetPath)).resolves.toBe(
18
+ "d41d8cd9-8f00-b204-e980-0998ecf8427e:test-asset.file",
19
+ );
20
+ });
21
+
22
+ test("builds urls for ef-captions", async () => {
23
+ await expect(buildAssetId(testAssetPath)).resolves.toBe(
24
+ "d41d8cd9-8f00-b204-e980-0998ecf8427e:test-asset.file",
25
+ );
26
+ });
27
+
28
+ test("builds urls for ef-image", async () => {
29
+ await expect(buildAssetId(testAssetPath)).resolves.toBe(
30
+ "d41d8cd9-8f00-b204-e980-0998ecf8427e:test-asset.file",
31
+ );
32
+ });
33
+ });
34
+ });
@@ -22,45 +22,26 @@ import { validateVideoResolution } from "../utils/validateVideoResolution.ts";
22
22
  import { getFolderSize } from "../utils/getFolderSize.ts";
23
23
 
24
24
  interface StrategyBuilder {
25
- buildProductionUrl: (tagName: string, assetPath: string) => Promise<string>;
25
+ buildAssetId: (assetPath: string) => Promise<string>;
26
26
  }
27
27
 
28
- const buildProductionUrl = async (
29
- origin: string,
30
- tagName: string,
31
- assetPath: string,
32
- ) => {
28
+ export const buildAssetId = async (assetPath: string) => {
33
29
  const md5Sum = await md5FilePath(assetPath);
34
30
 
35
31
  const basename = path.basename(assetPath);
36
32
 
37
- switch (tagName) {
38
- case "ef-audio":
39
- case "ef-video": {
40
- return `${origin}/api/video2/isobmff_files/${md5Sum}/${basename}`;
41
- }
42
- case "ef-captions": {
43
- return `${origin}/api/video2/caption_files/${md5Sum}/${basename}`;
44
- }
45
- case "ef-image": {
46
- return `${origin}/api/video2/image_files/${md5Sum}/${basename}`;
47
- }
48
- default: {
49
- return assetPath;
50
- }
51
- }
33
+ return `${md5Sum}:${basename}`;
52
34
  };
53
35
 
54
36
  class V1Builder implements StrategyBuilder {
55
- async buildProductionUrl(tagName: string, assetPath: string) {
56
- return buildProductionUrl("editframe://", tagName, assetPath);
37
+ async buildAssetId(assetPath: string) {
38
+ return buildAssetId(assetPath);
57
39
  }
58
40
  }
59
41
 
60
42
  class V2Builder implements StrategyBuilder {
61
- async buildProductionUrl(tagName: string, assetPath: string) {
62
- const efRenderHost = program.opts().efRenderHost;
63
- return buildProductionUrl(efRenderHost, tagName, assetPath);
43
+ async buildAssetId(assetPath: string) {
44
+ return buildAssetId(assetPath);
64
45
  }
65
46
  }
66
47
 
@@ -138,11 +119,8 @@ program
138
119
  const assetPath = path.join(srcDir, src);
139
120
 
140
121
  element.setAttribute(
141
- "src",
142
- await builder.buildProductionUrl(
143
- element.tagName.toLowerCase(),
144
- assetPath,
145
- ),
122
+ "asset-id",
123
+ await builder.buildAssetId(assetPath),
146
124
  );
147
125
  }
148
126
 
File without changes