@siteed/expo-audio-studio 2.3.0 → 2.3.1

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/CHANGELOG.md CHANGED
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
 
11
+ ## [2.3.1] - 2025-04-03
12
+ ### Changed
13
+ - feat: no external crc32 libs (#195) ([394b3b3](https://github.com/deeeed/expo-audio-stream/commit/394b3b3bb04e3f969db2a502af85d69c0f955b97))
11
14
  ## [2.3.0] - 2025-03-29
12
15
  ### Changed
13
16
  - fix: always generate a new UUID unless filename is provided (#182) ([f98a9a5](https://github.com/deeeed/expo-audio-stream/commit/f98a9a52393829e6c4a79aee3575fbfcc9416c19))
@@ -182,7 +185,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
182
185
  - Feature: Audio features extraction during recording.
183
186
  - Feature: Consistent WAV PCM recording format across all platforms.
184
187
 
185
- [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.3.0...HEAD
188
+ [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.3.1...HEAD
189
+ [2.3.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.3.0...@siteed/expo-audio-studio@2.3.1
186
190
  [2.3.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.2.0...@siteed/expo-audio-studio@2.3.0
187
191
  [2.2.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.1.1...@siteed/expo-audio-studio@2.2.0
188
192
  [2.1.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.1.0...@siteed/expo-audio-studio@2.1.1
@@ -1,4 +1,4 @@
1
- interface CRC32 {
1
+ export interface CRC32 {
2
2
  (data: string | Uint8Array): number;
3
3
  buf(data: Uint8Array): number;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"crc32.d.ts","sourceRoot":"","sources":["../../src/utils/crc32.ts"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACX,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACpC,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;CACjC;AAED,QAAA,IAAI,mBAAmB,EAAE,KAAK,CAAA;AAa9B,eAAe,mBAAmB,CAAA"}
1
+ {"version":3,"file":"crc32.d.ts","sourceRoot":"","sources":["../../src/utils/crc32.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,KAAK;IAClB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;IACnC,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAA;CAChC;AAsCD,QAAA,IAAI,mBAAmB,EAAE,KAAK,CAAA;AAY9B,eAAe,mBAAmB,CAAA"}
@@ -1,8 +1,46 @@
1
+ // Bundler (Metro/Webpack) will automatically resolve to crc32.web.ts or crc32.native.ts.
1
2
  import { Platform } from 'react-native';
3
+ // --- Web CRC32 Calculation Logic ---
4
+ let webCrcTable;
5
+ function computeWebCrc32(data) {
6
+ // Lazily compute the table only on web when first needed
7
+ if (!webCrcTable) {
8
+ webCrcTable = (() => {
9
+ const table = new Uint32Array(256);
10
+ for (let i = 0; i < 256; ++i) {
11
+ let crc = i;
12
+ for (let j = 0; j < 8; ++j) {
13
+ crc = crc & 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1;
14
+ }
15
+ table[i] = crc;
16
+ }
17
+ return table;
18
+ })();
19
+ }
20
+ let crc = -1; // Initialize with 0xFFFFFFFF
21
+ if (typeof data === 'string') {
22
+ const strBytes = new TextEncoder().encode(data);
23
+ for (let i = 0; i < strBytes.length; ++i) {
24
+ crc = (crc >>> 8) ^ webCrcTable[(crc ^ strBytes[i]) & 0xff];
25
+ }
26
+ }
27
+ else if (data instanceof Uint8Array) {
28
+ for (let i = 0; i < data.length; ++i) {
29
+ crc = (crc >>> 8) ^ webCrcTable[(crc ^ data[i]) & 0xff];
30
+ }
31
+ }
32
+ else {
33
+ throw new Error('Unsupported data type for CRC32 calculation.');
34
+ }
35
+ return (crc ^ -1) >>> 0; // Final XOR and ensure unsigned 32-bit
36
+ }
37
+ // --- End Web CRC32 Calculation Logic ---
2
38
  let crc32Implementation;
3
39
  if (Platform.OS === 'web') {
4
- // eslint-disable-next-line @typescript-eslint/no-var-requires
5
- crc32Implementation = require('crc-32');
40
+ // Assign the web implementation
41
+ crc32Implementation = Object.assign(computeWebCrc32, {
42
+ buf: (data) => computeWebCrc32(data),
43
+ });
6
44
  }
7
45
  else {
8
46
  // No-op implementation for native platforms
@@ -1 +1 @@
1
- {"version":3,"file":"crc32.js","sourceRoot":"","sources":["../../src/utils/crc32.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAOvC,IAAI,mBAA0B,CAAA;AAE9B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;IACxB,8DAA8D;IAC9D,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC3C,CAAC;KAAM,CAAC;IACJ,4CAA4C;IAC5C,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAC/B,GAAG,EAAE,CAAC,CAAC,EACP,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CACnB,CAAA;AACL,CAAC;AAED,eAAe,mBAAmB,CAAA","sourcesContent":["import { Platform } from 'react-native'\n\ninterface CRC32 {\n (data: string | Uint8Array): number;\n buf(data: Uint8Array): number;\n}\n\nlet crc32Implementation: CRC32\n\nif (Platform.OS === 'web') {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n crc32Implementation = require('crc-32')\n} else {\n // No-op implementation for native platforms\n crc32Implementation = Object.assign(\n () => 0,\n { buf: () => 0 }\n )\n}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CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;QAC/D,CAAC;IACL,CAAC;SAAM,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YACnC,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;QAC3D,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;IACnE,CAAC;IAED,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA,CAAC,uCAAuC;AACnE,CAAC;AACD,0CAA0C;AAE1C,IAAI,mBAA0B,CAAA;AAE9B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;IACxB,gCAAgC;IAChC,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;QACjD,GAAG,EAAE,CAAC,IAAgB,EAAU,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC;KAC3D,CAAC,CAAA;AACN,CAAC;KAAM,CAAC;IACJ,4CAA4C;IAC5C,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;AAClE,CAAC;AAED,eAAe,mBAAmB,CAAA","sourcesContent":["// Bundler (Metro/Webpack) will automatically resolve to crc32.web.ts or crc32.native.ts.\n\nimport { Platform } from 'react-native'\n\n// Define the interface first\nexport interface CRC32 {\n (data: string | Uint8Array): number\n buf(data: Uint8Array): number\n}\n\n// --- Web CRC32 Calculation Logic ---\nlet webCrcTable: Uint32Array | undefined\nfunction computeWebCrc32(data: string | Uint8Array): number {\n // Lazily compute the table only on web when first needed\n if (!webCrcTable) {\n webCrcTable = (() => {\n const table = new Uint32Array(256)\n for (let i = 0; i < 256; ++i) {\n let crc = i\n for (let j = 0; j < 8; ++j) {\n crc = crc & 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1\n }\n table[i] = crc\n }\n return table\n })()\n }\n\n let crc = -1 // Initialize with 0xFFFFFFFF\n if (typeof data === 'string') {\n const strBytes = new TextEncoder().encode(data)\n for (let i = 0; i < strBytes.length; ++i) {\n crc = (crc >>> 8) ^ webCrcTable[(crc ^ strBytes[i]) & 0xff]\n }\n } else if (data instanceof Uint8Array) {\n for (let i = 0; i < data.length; ++i) {\n crc = (crc >>> 8) ^ webCrcTable[(crc ^ data[i]) & 0xff]\n }\n } else {\n throw new Error('Unsupported data type for CRC32 calculation.')\n }\n\n return (crc ^ -1) >>> 0 // Final XOR and ensure unsigned 32-bit\n}\n// --- End Web CRC32 Calculation Logic ---\n\nlet crc32Implementation: CRC32\n\nif (Platform.OS === 'web') {\n // Assign the web implementation\n crc32Implementation = Object.assign(computeWebCrc32, {\n buf: (data: Uint8Array): number => computeWebCrc32(data),\n })\n} else {\n // No-op implementation for native platforms\n crc32Implementation = Object.assign(() => 0, { buf: () => 0 })\n}\n\nexport default crc32Implementation\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteed/expo-audio-studio",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Comprehensive audio processing library for React Native and Expo with recording, analysis, visualization, and streaming capabilities across iOS, Android, and web",
5
5
  "license": "MIT",
6
6
  "main": "build/index.js",
@@ -116,11 +116,6 @@
116
116
  "react": "*",
117
117
  "react-native": "*"
118
118
  },
119
- "peerDependenciesMeta": {
120
- "crc-32": {
121
- "optional": true
122
- }
123
- },
124
119
  "publishConfig": {
125
120
  "access": "public",
126
121
  "registry": "https://registry.npmjs.org"
@@ -1,21 +1,59 @@
1
+ // Bundler (Metro/Webpack) will automatically resolve to crc32.web.ts or crc32.native.ts.
2
+
1
3
  import { Platform } from 'react-native'
2
4
 
3
- interface CRC32 {
4
- (data: string | Uint8Array): number;
5
- buf(data: Uint8Array): number;
5
+ // Define the interface first
6
+ export interface CRC32 {
7
+ (data: string | Uint8Array): number
8
+ buf(data: Uint8Array): number
9
+ }
10
+
11
+ // --- Web CRC32 Calculation Logic ---
12
+ let webCrcTable: Uint32Array | undefined
13
+ function computeWebCrc32(data: string | Uint8Array): number {
14
+ // Lazily compute the table only on web when first needed
15
+ if (!webCrcTable) {
16
+ webCrcTable = (() => {
17
+ const table = new Uint32Array(256)
18
+ for (let i = 0; i < 256; ++i) {
19
+ let crc = i
20
+ for (let j = 0; j < 8; ++j) {
21
+ crc = crc & 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1
22
+ }
23
+ table[i] = crc
24
+ }
25
+ return table
26
+ })()
27
+ }
28
+
29
+ let crc = -1 // Initialize with 0xFFFFFFFF
30
+ if (typeof data === 'string') {
31
+ const strBytes = new TextEncoder().encode(data)
32
+ for (let i = 0; i < strBytes.length; ++i) {
33
+ crc = (crc >>> 8) ^ webCrcTable[(crc ^ strBytes[i]) & 0xff]
34
+ }
35
+ } else if (data instanceof Uint8Array) {
36
+ for (let i = 0; i < data.length; ++i) {
37
+ crc = (crc >>> 8) ^ webCrcTable[(crc ^ data[i]) & 0xff]
38
+ }
39
+ } else {
40
+ throw new Error('Unsupported data type for CRC32 calculation.')
41
+ }
42
+
43
+ return (crc ^ -1) >>> 0 // Final XOR and ensure unsigned 32-bit
6
44
  }
45
+ // --- End Web CRC32 Calculation Logic ---
7
46
 
8
47
  let crc32Implementation: CRC32
9
48
 
10
49
  if (Platform.OS === 'web') {
11
- // eslint-disable-next-line @typescript-eslint/no-var-requires
12
- crc32Implementation = require('crc-32')
50
+ // Assign the web implementation
51
+ crc32Implementation = Object.assign(computeWebCrc32, {
52
+ buf: (data: Uint8Array): number => computeWebCrc32(data),
53
+ })
13
54
  } else {
14
55
  // No-op implementation for native platforms
15
- crc32Implementation = Object.assign(
16
- () => 0,
17
- { buf: () => 0 }
18
- )
56
+ crc32Implementation = Object.assign(() => 0, { buf: () => 0 })
19
57
  }
20
58
 
21
59
  export default crc32Implementation
@@ -1,2 +0,0 @@
1
- export default function crc32(): number;
2
- //# sourceMappingURL=crc32.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crc32.native.d.ts","sourceRoot":"","sources":["../../src/utils/crc32.native.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,UAAU,KAAK,IAAI,MAAM,CAEtC"}
@@ -1,5 +0,0 @@
1
- // No-op implementation for native platforms
2
- export default function crc32() {
3
- return 0;
4
- }
5
- //# sourceMappingURL=crc32.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crc32.native.js","sourceRoot":"","sources":["../../src/utils/crc32.native.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,MAAM,CAAC,OAAO,UAAU,KAAK;IACzB,OAAO,CAAC,CAAC;AACb,CAAC","sourcesContent":["// No-op implementation for native platforms\nexport default function crc32(): number {\n return 0;\n}"]}
@@ -1,4 +0,0 @@
1
- /// <reference path="../../src/types/crc-32.d.ts" />
2
- import crc32 from 'crc-32';
3
- export default crc32;
4
- //# sourceMappingURL=crc32.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crc32.web.d.ts","sourceRoot":"","sources":["../../src/utils/crc32.web.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,QAAQ,CAAA;AAE1B,eAAe,KAAK,CAAA"}
@@ -1,3 +0,0 @@
1
- import crc32 from 'crc-32';
2
- export default crc32;
3
- //# sourceMappingURL=crc32.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crc32.web.js","sourceRoot":"","sources":["../../src/utils/crc32.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,QAAQ,CAAA;AAE1B,eAAe,KAAK,CAAA","sourcesContent":["import crc32 from 'crc-32'\n\nexport default crc32\n"]}
@@ -1,4 +0,0 @@
1
- // No-op implementation for native platforms
2
- export default function crc32(): number {
3
- return 0;
4
- }
@@ -1,3 +0,0 @@
1
- import crc32 from 'crc-32'
2
-
3
- export default crc32