@contentauth/c2pa-web 0.1.1 → 0.2.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 (42) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +52 -41
  5. package/dist/lib/reader.d.ts +16 -3
  6. package/dist/lib/reader.d.ts.map +1 -1
  7. package/dist/lib/settings.d.ts +1 -0
  8. package/dist/lib/settings.d.ts.map +1 -1
  9. package/dist/lib/worker.d.ts +3 -1
  10. package/dist/lib/worker.d.ts.map +1 -1
  11. package/dist/resources/c2pa_bg.wasm +0 -0
  12. package/package.json +8 -3
  13. package/CHANGELOG.md +0 -20
  14. package/eslint.config.mjs +0 -30
  15. package/project.json +0 -7
  16. package/src/index.ts +0 -15
  17. package/src/lib/c2pa.spec.ts +0 -166
  18. package/src/lib/c2pa.ts +0 -65
  19. package/src/lib/error.ts +0 -26
  20. package/src/lib/reader.ts +0 -150
  21. package/src/lib/settings.ts +0 -52
  22. package/src/lib/supportedFormats.ts +0 -72
  23. package/src/lib/worker/setupWorker.ts +0 -53
  24. package/src/lib/worker/workerManager.ts +0 -64
  25. package/src/lib/worker/workerObjectMap.ts +0 -35
  26. package/src/lib/worker/workerResponse.ts +0 -50
  27. package/src/lib/worker.ts +0 -77
  28. package/test/fixtures/assets/C_with_CAWG_data.jpg +0 -0
  29. package/test/fixtures/assets/C_with_CAWG_data.json +0 -144
  30. package/test/fixtures/assets/C_with_CAWG_data_thumbnail.jpg +0 -0
  31. package/test/fixtures/assets/C_with_CAWG_data_trusted.json +0 -149
  32. package/test/fixtures/assets/C_with_CAWG_data_untrusted.json +0 -157
  33. package/test/fixtures/assets/dash1.m4s +0 -0
  34. package/test/fixtures/assets/dashinit.json +0 -184
  35. package/test/fixtures/assets/dashinit.mp4 +0 -0
  36. package/test/fixtures/assets/no_alg.jpg +0 -0
  37. package/test/fixtures/trust/anchor-correct.pem +0 -15
  38. package/test/fixtures/trust/anchor-incorrect.pem +0 -16
  39. package/tsconfig.json +0 -13
  40. package/tsconfig.lib.json +0 -29
  41. package/tsconfig.spec.json +0 -36
  42. package/vite.config.ts +0 -91
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "files": [],
4
- "include": [],
5
- "references": [
6
- {
7
- "path": "./tsconfig.lib.json"
8
- },
9
- {
10
- "path": "./tsconfig.spec.json"
11
- }
12
- ]
13
- }
package/tsconfig.lib.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "rootDir": "src",
6
- "outDir": "dist",
7
- "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
8
- "emitDeclarationOnly": true,
9
- "forceConsistentCasingInFileNames": true,
10
- "types": ["vite/client"],
11
- "lib": ["DOM", "ES2023"]
12
- },
13
- "include": ["src/**/*.ts"],
14
- "references": [],
15
- "exclude": [
16
- "vite.config.ts",
17
- "vite.config.mts",
18
- "vitest.config.ts",
19
- "vitest.config.mts",
20
- "src/**/*.test.ts",
21
- "src/**/*.spec.ts",
22
- "src/**/*.test.tsx",
23
- "src/**/*.spec.tsx",
24
- "src/**/*.test.js",
25
- "src/**/*.spec.js",
26
- "src/**/*.test.jsx",
27
- "src/**/*.spec.jsx"
28
- ]
29
- }
@@ -1,36 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "./out-tsc/vitest",
5
- "types": [
6
- "vitest/importMeta",
7
- "vite/client",
8
- "vitest",
9
- "@vitest/browser/providers/playwright"
10
- ],
11
- "lib": ["DOM", "ES2023"],
12
- "forceConsistentCasingInFileNames": true,
13
- "resolveJsonModule": true,
14
- },
15
- "include": [
16
- "vite.config.ts",
17
- "vite.config.mts",
18
- "vitest.config.ts",
19
- "vitest.config.mts",
20
- "src/**/*.test.ts",
21
- "src/**/*.spec.ts",
22
- "src/**/*.test.tsx",
23
- "src/**/*.spec.tsx",
24
- "src/**/*.test.js",
25
- "src/**/*.spec.js",
26
- "src/**/*.test.jsx",
27
- "src/**/*.spec.jsx",
28
- "src/**/*.d.ts",
29
- "test/**/*.json"
30
- ],
31
- "references": [
32
- {
33
- "path": "./tsconfig.lib.json"
34
- }
35
- ]
36
- }
package/vite.config.ts DELETED
@@ -1,91 +0,0 @@
1
- /**
2
- * Copyright 2025 Adobe
3
- * All Rights Reserved.
4
- *
5
- * NOTICE: Adobe permits you to use, modify, and distribute this file in
6
- * accordance with the terms of the Adobe license agreement accompanying
7
- * it.
8
- */
9
- import { defineConfig, Plugin } from 'vite';
10
- import dts from 'vite-plugin-dts';
11
- import { workspaceRoot } from '@nx/devkit';
12
- import { rimrafSync } from 'rimraf';
13
- import { join } from 'path';
14
- import { mkdirSync, linkSync } from 'fs';
15
- export default defineConfig(() => ({
16
- root: __dirname,
17
- cacheDir: '../../node_modules/.vite/packages/web',
18
- plugins: [
19
- dts({
20
- entryRoot: 'src',
21
- tsconfigPath: join(__dirname, 'tsconfig.lib.json'),
22
- }),
23
- createBuildPlugin(),
24
- ],
25
- // Configuration for building your library.
26
- // See: https://vitejs.dev/guide/build.html#library-mode
27
- build: {
28
- outDir: './dist',
29
- emptyOutDir: false, // Done in our custom plugin so we can correctly create the "resources" folder
30
- reportCompressedSize: true,
31
- commonjsOptions: {
32
- transformMixedEsModules: true,
33
- },
34
- lib: {
35
- entry: 'src/index.ts',
36
- name: '@contentauth/c2pa-web',
37
- fileName: 'index',
38
- // Change this to the formats you want to support.
39
- // Don't forget to update your package.json as well.
40
- formats: ['es' as const],
41
- },
42
- rollupOptions: {
43
- // External packages that should not be bundled into your library.
44
- external: [],
45
- },
46
- },
47
- server: {
48
- fs: {
49
- deny: [],
50
- },
51
- },
52
- test: {
53
- watch: false,
54
- include: ['{src,test}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
55
- browser: {
56
- headless: true,
57
- enabled: true,
58
- provider: 'playwright',
59
- // https://vitest.dev/guide/browser/playwright
60
- instances: [{ browser: 'chromium' }],
61
- screenshotFailures: false,
62
- },
63
- },
64
- }));
65
-
66
- /**
67
- * This plugin has two responsibilities:
68
- * 1. Clears the output directory (Vite's default emptyOutDir behavior will delete the files copied in step 2)
69
- * 2. Links the WASM resources into the output directory so they can be packaged with the published library
70
- */
71
- function createBuildPlugin(): Plugin {
72
- return {
73
- name: 'contentauth-web-build',
74
- buildStart: () => {
75
- const wasmPackageName = 'c2pa-wasm';
76
- const wasmResourceName = 'c2pa_bg.wasm';
77
- const wasmPackagePath = join(workspaceRoot, 'packages', wasmPackageName);
78
- const wasmOutDir = join(wasmPackagePath, 'pkg');
79
- const wasmResourcePath = join(wasmOutDir, wasmResourceName);
80
-
81
- const pkgOutDir = join(__dirname, 'dist');
82
- const pkgResourceDir = join(pkgOutDir, 'resources');
83
- const pkgResourcePath = join(pkgResourceDir, wasmResourceName);
84
-
85
- rimrafSync(pkgOutDir);
86
-
87
- mkdirSync(pkgResourceDir, { recursive: true });
88
- linkSync(wasmResourcePath, pkgResourcePath);
89
- },
90
- };
91
- }