@cloudcare/cocos-sdk 0.1.0-alpha.5 → 0.1.0-alpha.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.
Files changed (180) hide show
  1. package/README.md +13 -1
  2. package/bin/cli.cjs +40 -21
  3. package/bin/legacy-asset-hashes.json +27 -0
  4. package/bin/managed-assets.cjs +67 -0
  5. package/dist/creator2/core/client.d.ts +55 -7
  6. package/dist/creator2/core/client.d.ts.map +1 -1
  7. package/dist/creator2/core/client.js +74 -28
  8. package/dist/creator2/core/client.js.map +1 -1
  9. package/dist/creator2/core/index.d.ts +1 -1
  10. package/dist/creator2/core/index.d.ts.map +1 -1
  11. package/dist/creator2/core/index.js.map +1 -1
  12. package/dist/creator2/core/plugin-api.d.ts +15 -0
  13. package/dist/creator2/core/plugin-api.d.ts.map +1 -0
  14. package/dist/creator2/core/plugin-api.js +3 -0
  15. package/dist/creator2/core/plugin-api.js.map +1 -0
  16. package/dist/creator2/core/transport.d.ts +20 -0
  17. package/dist/creator2/core/transport.d.ts.map +1 -1
  18. package/dist/creator2/core/transport.js.map +1 -1
  19. package/dist/creator2/core/types.d.ts +0 -78
  20. package/dist/creator2/core/types.d.ts.map +1 -1
  21. package/dist/creator2/core/validation.d.ts +0 -11
  22. package/dist/creator2/core/validation.d.ts.map +1 -1
  23. package/dist/creator2/core/validation.js +0 -63
  24. package/dist/creator2/core/validation.js.map +1 -1
  25. package/dist/creator2/core/version.d.ts +1 -1
  26. package/dist/creator2/core/version.js +1 -1
  27. package/dist/creator2/creator2/auto.d.ts +1 -3
  28. package/dist/creator2/creator2/auto.d.ts.map +1 -1
  29. package/dist/creator2/creator2/auto.js +0 -25
  30. package/dist/creator2/creator2/auto.js.map +1 -1
  31. package/dist/creator2/creator2/index.d.ts +0 -7
  32. package/dist/creator2/creator2/index.d.ts.map +1 -1
  33. package/dist/creator2/creator2/index.js +1 -13
  34. package/dist/creator2/creator2/index.js.map +1 -1
  35. package/dist/creator2/creator2/transport.d.ts +0 -1
  36. package/dist/creator2/creator2/transport.d.ts.map +1 -1
  37. package/dist/creator2/creator2/transport.js +0 -4
  38. package/dist/creator2/creator2/transport.js.map +1 -1
  39. package/dist/creator3/core/client.d.ts +55 -7
  40. package/dist/creator3/core/client.d.ts.map +1 -1
  41. package/dist/creator3/core/client.js +72 -28
  42. package/dist/creator3/core/client.js.map +1 -1
  43. package/dist/creator3/core/index.d.ts +1 -1
  44. package/dist/creator3/core/index.d.ts.map +1 -1
  45. package/dist/creator3/core/index.js.map +1 -1
  46. package/dist/creator3/core/plugin-api.d.ts +15 -0
  47. package/dist/creator3/core/plugin-api.d.ts.map +1 -0
  48. package/dist/creator3/core/plugin-api.js +2 -0
  49. package/dist/creator3/core/plugin-api.js.map +1 -0
  50. package/dist/creator3/core/transport.d.ts +20 -0
  51. package/dist/creator3/core/transport.d.ts.map +1 -1
  52. package/dist/creator3/core/transport.js.map +1 -1
  53. package/dist/creator3/core/types.d.ts +0 -78
  54. package/dist/creator3/core/types.d.ts.map +1 -1
  55. package/dist/creator3/core/validation.d.ts +0 -11
  56. package/dist/creator3/core/validation.d.ts.map +1 -1
  57. package/dist/creator3/core/validation.js +0 -61
  58. package/dist/creator3/core/validation.js.map +1 -1
  59. package/dist/creator3/core/version.d.ts +1 -1
  60. package/dist/creator3/core/version.js +1 -1
  61. package/dist/creator3/creator3/auto.d.ts +1 -3
  62. package/dist/creator3/creator3/auto.d.ts.map +1 -1
  63. package/dist/creator3/creator3/auto.js +1 -26
  64. package/dist/creator3/creator3/auto.js.map +1 -1
  65. package/dist/creator3/creator3/index.d.ts +0 -7
  66. package/dist/creator3/creator3/index.d.ts.map +1 -1
  67. package/dist/creator3/creator3/index.js +1 -12
  68. package/dist/creator3/creator3/index.js.map +1 -1
  69. package/dist/creator3/creator3/transport.d.ts +0 -1
  70. package/dist/creator3/creator3/transport.d.ts.map +1 -1
  71. package/dist/creator3/creator3/transport.js +0 -4
  72. package/dist/creator3/creator3/transport.js.map +1 -1
  73. package/extensions/creator2/install-native.cjs +52 -30
  74. package/extensions/creator2/install-spm.cjs +16 -8
  75. package/extensions/creator2/legacy-asset-hashes.json +27 -0
  76. package/extensions/creator2/managed-assets.cjs +67 -0
  77. package/extensions/creator3/install-native.cjs +52 -30
  78. package/extensions/creator3/install-spm.cjs +16 -8
  79. package/extensions/creator3/legacy-asset-hashes.json +27 -0
  80. package/extensions/creator3/managed-assets.cjs +67 -0
  81. package/native/android/src/main/java/com/ft/sdk/cocos/FTBridgeTransport.java +85 -0
  82. package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosBridge.java +2 -192
  83. package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosBridgeModules.java +9 -0
  84. package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosBridgeProvider.java +1 -1
  85. package/native/ios/FTCocosBridge.m +0 -202
  86. package/native/ios/FTCocosBridge.podspec +2 -3
  87. package/native/ios/Package.swift +1 -2
  88. package/package.json +10 -5
  89. package/plugin-api/package.json +4 -0
  90. package/components/creator2/ReplayPrivacy.ts +0 -23
  91. package/components/creator3/ReplayPrivacy.ts +0 -25
  92. package/dist/creator2/core/replay-async-transport.d.ts +0 -4
  93. package/dist/creator2/core/replay-async-transport.d.ts.map +0 -1
  94. package/dist/creator2/core/replay-async-transport.js +0 -67
  95. package/dist/creator2/core/replay-async-transport.js.map +0 -1
  96. package/dist/creator2/core/replay-budget.d.ts +0 -28
  97. package/dist/creator2/core/replay-budget.d.ts.map +0 -1
  98. package/dist/creator2/core/replay-budget.js +0 -113
  99. package/dist/creator2/core/replay-budget.js.map +0 -1
  100. package/dist/creator2/core/replay-diagnostics.d.ts +0 -36
  101. package/dist/creator2/core/replay-diagnostics.d.ts.map +0 -1
  102. package/dist/creator2/core/replay-diagnostics.js +0 -40
  103. package/dist/creator2/core/replay-diagnostics.js.map +0 -1
  104. package/dist/creator2/core/replay-encoding.d.ts +0 -31
  105. package/dist/creator2/core/replay-encoding.d.ts.map +0 -1
  106. package/dist/creator2/core/replay-encoding.js +0 -63
  107. package/dist/creator2/core/replay-encoding.js.map +0 -1
  108. package/dist/creator2/core/replay-file.d.ts +0 -5
  109. package/dist/creator2/core/replay-file.d.ts.map +0 -1
  110. package/dist/creator2/core/replay-file.js +0 -101
  111. package/dist/creator2/core/replay-file.js.map +0 -1
  112. package/dist/creator2/core/replay-pixels.d.ts +0 -3
  113. package/dist/creator2/core/replay-pixels.d.ts.map +0 -1
  114. package/dist/creator2/core/replay-pixels.js +0 -16
  115. package/dist/creator2/core/replay-pixels.js.map +0 -1
  116. package/dist/creator2/core/replay-privacy-nodes.d.ts +0 -14
  117. package/dist/creator2/core/replay-privacy-nodes.d.ts.map +0 -1
  118. package/dist/creator2/core/replay-privacy-nodes.js +0 -18
  119. package/dist/creator2/core/replay-privacy-nodes.js.map +0 -1
  120. package/dist/creator2/core/replay-privacy.d.ts +0 -15
  121. package/dist/creator2/core/replay-privacy.d.ts.map +0 -1
  122. package/dist/creator2/core/replay-privacy.js +0 -36
  123. package/dist/creator2/core/replay-privacy.js.map +0 -1
  124. package/dist/creator2/core/replay.d.ts +0 -99
  125. package/dist/creator2/core/replay.d.ts.map +0 -1
  126. package/dist/creator2/core/replay.js +0 -611
  127. package/dist/creator2/core/replay.js.map +0 -1
  128. package/dist/creator2/creator2/capture.d.ts +0 -17
  129. package/dist/creator2/creator2/capture.d.ts.map +0 -1
  130. package/dist/creator2/creator2/capture.js +0 -168
  131. package/dist/creator2/creator2/capture.js.map +0 -1
  132. package/dist/creator3/core/replay-async-transport.d.ts +0 -4
  133. package/dist/creator3/core/replay-async-transport.d.ts.map +0 -1
  134. package/dist/creator3/core/replay-async-transport.js +0 -16
  135. package/dist/creator3/core/replay-async-transport.js.map +0 -1
  136. package/dist/creator3/core/replay-budget.d.ts +0 -28
  137. package/dist/creator3/core/replay-budget.d.ts.map +0 -1
  138. package/dist/creator3/core/replay-budget.js +0 -105
  139. package/dist/creator3/core/replay-budget.js.map +0 -1
  140. package/dist/creator3/core/replay-diagnostics.d.ts +0 -36
  141. package/dist/creator3/core/replay-diagnostics.d.ts.map +0 -1
  142. package/dist/creator3/core/replay-diagnostics.js +0 -36
  143. package/dist/creator3/core/replay-diagnostics.js.map +0 -1
  144. package/dist/creator3/core/replay-encoding.d.ts +0 -31
  145. package/dist/creator3/core/replay-encoding.d.ts.map +0 -1
  146. package/dist/creator3/core/replay-encoding.js +0 -62
  147. package/dist/creator3/core/replay-encoding.js.map +0 -1
  148. package/dist/creator3/core/replay-file.d.ts +0 -5
  149. package/dist/creator3/core/replay-file.d.ts.map +0 -1
  150. package/dist/creator3/core/replay-file.js +0 -31
  151. package/dist/creator3/core/replay-file.js.map +0 -1
  152. package/dist/creator3/core/replay-pixels.d.ts +0 -3
  153. package/dist/creator3/core/replay-pixels.d.ts.map +0 -1
  154. package/dist/creator3/core/replay-pixels.js +0 -13
  155. package/dist/creator3/core/replay-pixels.js.map +0 -1
  156. package/dist/creator3/core/replay-privacy-nodes.d.ts +0 -14
  157. package/dist/creator3/core/replay-privacy-nodes.d.ts.map +0 -1
  158. package/dist/creator3/core/replay-privacy-nodes.js +0 -15
  159. package/dist/creator3/core/replay-privacy-nodes.js.map +0 -1
  160. package/dist/creator3/core/replay-privacy.d.ts +0 -15
  161. package/dist/creator3/core/replay-privacy.d.ts.map +0 -1
  162. package/dist/creator3/core/replay-privacy.js +0 -33
  163. package/dist/creator3/core/replay-privacy.js.map +0 -1
  164. package/dist/creator3/core/replay.d.ts +0 -99
  165. package/dist/creator3/core/replay.d.ts.map +0 -1
  166. package/dist/creator3/core/replay.js +0 -534
  167. package/dist/creator3/core/replay.js.map +0 -1
  168. package/dist/creator3/creator3/capture.d.ts +0 -17
  169. package/dist/creator3/creator3/capture.d.ts.map +0 -1
  170. package/dist/creator3/creator3/capture.js +0 -112
  171. package/dist/creator3/creator3/capture.js.map +0 -1
  172. package/dist/creator3/creator3/replay-render-cycle.d.ts +0 -9
  173. package/dist/creator3/creator3/replay-render-cycle.d.ts.map +0 -1
  174. package/dist/creator3/creator3/replay-render-cycle.js +0 -12
  175. package/dist/creator3/creator3/replay-render-cycle.js.map +0 -1
  176. package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosReplayImageJobs.java +0 -55
  177. package/native/ios/FTCocosReplayImageJobs.h +0 -11
  178. package/native/ios/FTCocosReplayImageJobs.m +0 -54
  179. package/native/shared/FTReplayFileBridge.h +0 -62
  180. package/native/shared/FTReplayFileWorker.h +0 -88
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  ## Introduction
9
9
 
10
- Guance Cloud Application Monitoring collects and analyzes RUM, Log, Trace, and Session Replay data from Cocos Creator applications. The SDK supports native Android and iOS builds for Cocos Creator 2.4 and 3.x.
10
+ Guance Cloud Application Monitoring collects and analyzes RUM, Log, and Trace data from Cocos Creator applications. The SDK supports native Android and iOS builds for Cocos Creator 2.4 and 3.x.
11
11
 
12
12
  ## Supported Scope
13
13
 
@@ -18,6 +18,18 @@ Guance Cloud Application Monitoring collects and analyzes RUM, Log, Trace, and S
18
18
 
19
19
  Cocos Creator 3.0–3.6.2 is supported on a best-effort basis because the stable native build extension API starts at 3.6.3. Web, mini-game, and desktop targets are not currently supported.
20
20
 
21
+ ## Optional Session Replay
22
+
23
+ Session Replay is distributed separately as `@cloudcare/cocos-session-replay`.
24
+ Install both packages at the exact same version and run `npx guance-cocos install --replay`.
25
+ Compose the SDK with `withSessionReplay` from the matching `/creator2` or `/creator3` entry
26
+ before using Replay configuration. Camera selection moves to `sdk.setReplayCamera(camera)`.
27
+
28
+ Base-only applications continue using this package and its normal initialization API.
29
+ Run `npx guance-cocos install --no-replay` and rebuild to remove an existing SDK-managed
30
+ Replay native integration. Existing scene component scripts and metadata are preserved.
31
+ See the [Replay package guide](https://github.com/GuanceCloud/datakit-cocos/tree/main/packages/cocos-session-replay).
32
+
21
33
  ## iOS dependency manager
22
34
 
23
35
  CocoaPods remains the default. To use Swift Package Manager, add
package/bin/cli.cjs CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
+ const { createRequire } = require('module');
7
+ const { syncManagedDirectory } = require('./managed-assets.cjs');
6
8
 
7
9
  const packageRoot = path.resolve(__dirname, '..');
8
10
  const metadata = require(path.join(packageRoot, 'package.json'));
@@ -34,19 +36,45 @@ if (manager !== undefined && !['spm', 'cocoapods'].includes(manager)) {
34
36
  }
35
37
  const configFile = path.join(projectRoot, 'cocos-sdk.config.json');
36
38
  const config = readJson(configFile) || {};
37
- if (manager !== undefined) {
38
- config.ios = { ...config.ios, dependencyManager: manager };
39
- fs.writeFileSync(configFile, `${JSON.stringify(config, null, 2)}\n`);
39
+ if (rawArguments.includes('--replay') && rawArguments.includes('--no-replay')) fail('Choose either --replay or --no-replay.');
40
+ const replayEnabled = rawArguments.includes('--replay') ? true
41
+ : rawArguments.includes('--no-replay') ? false : config.replay?.enabled === true;
42
+ let replayRoot;
43
+ let replayDescriptor;
44
+ if (replayEnabled) {
45
+ try {
46
+ const projectRequire = createRequire(path.join(projectRoot, 'package.json'));
47
+ replayRoot = path.dirname(projectRequire.resolve('@cloudcare/cocos-session-replay/package.json'));
48
+ } catch {
49
+ fail('Session Replay is not installed. Install @cloudcare/cocos-session-replay at the same version as @cloudcare/cocos-sdk, then rerun with --replay.');
50
+ }
51
+ const replayPackage = readJson(path.join(replayRoot, 'package.json'));
52
+ replayDescriptor = readJson(path.join(replayRoot, 'native-integration.json'));
53
+ if (replayPackage.version !== metadata.version || replayPackage.peerDependencies?.[metadata.name] !== metadata.version
54
+ || replayDescriptor?.schemaVersion !== 1 || replayDescriptor?.version !== metadata.version || replayDescriptor?.baseVersion !== metadata.version) {
55
+ fail('Replay package and native integration must exactly match the base SDK version.');
56
+ }
40
57
  }
41
-
42
- copyDirectory(extensionSource, destination);
43
- copyDirectory(path.join(packageRoot, 'native'), path.join(destination, 'native'));
58
+ const sources = [{ root: extensionSource }, { root: path.join(packageRoot, 'native'), prefix: 'native/' }];
59
+ if (replayRoot) sources.push({ root: path.join(replayRoot, 'native'), prefix: 'replay-native/' });
60
+ const generated = {
61
+ 'sdk-integration.json': JSON.stringify({ schemaVersion: 1, version: metadata.version, replay: replayEnabled }, null, 2) + '\n',
62
+ };
63
+ if (replayDescriptor) generated['replay-integration.json'] = JSON.stringify(replayDescriptor, null, 2) + '\n';
64
+ syncManagedDirectory(destination, sources, generated);
44
65
  const componentDestination = path.join(projectRoot, 'assets', 'guance-cocos-sdk');
45
- copyDirectory(path.join(packageRoot, 'components', `creator${creatorMajor}`), componentDestination);
46
-
66
+ if (replayRoot) syncManagedDirectory(componentDestination, [{ root: path.join(replayRoot, 'components', `creator${creatorMajor}`) }]);
67
+ // Keep existing component scripts and .meta files when disabling Replay: scenes may reference them.
68
+ if (manager !== undefined) config.ios = { ...config.ios, dependencyManager: manager };
69
+ if (rawArguments.includes('--replay') || rawArguments.includes('--no-replay') || config.replay) {
70
+ config.replay = { ...config.replay, enabled: replayEnabled };
71
+ }
72
+ if (manager !== undefined || rawArguments.includes('--replay') || rawArguments.includes('--no-replay')) {
73
+ fs.writeFileSync(configFile, `${JSON.stringify(config, null, 2)}\n`);
74
+ }
47
75
  process.stdout.write(
48
- `Installed ${metadata.name} for Cocos Creator ${creatorMajor} at ${destination}\n`
49
- + `Installed ReplayPrivacy at ${componentDestination}. Add it through Session Replay/ReplayPrivacy in the component menu.\n`
76
+ `Installed ${metadata.name} for Cocos Creator ${creatorMajor} at ${destination} (Replay: ${replayEnabled ? 'enabled' : 'disabled'})\n`
77
+ + (replayEnabled ? `Installed ReplayPrivacy at ${componentDestination}. Add it through Session Replay/ReplayPrivacy in the component menu.\n` : '')
50
78
  + 'Re-open Cocos Creator, enable the guance-cocos-sdk extension, and rebuild the native project.\n',
51
79
  );
52
80
  if (fs.existsSync(legacyDestination)) {
@@ -111,17 +139,6 @@ function readOption(argumentsList, name) {
111
139
  return inline ? inline.slice(prefix.length) : undefined;
112
140
  }
113
141
 
114
- function copyDirectory(source, destinationPath) {
115
- if (!fs.existsSync(source)) fail(`Missing package asset: ${source}`);
116
- fs.mkdirSync(destinationPath, { recursive: true });
117
- for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
118
- const from = path.join(source, entry.name);
119
- const to = path.join(destinationPath, entry.name);
120
- if (entry.isDirectory()) copyDirectory(from, to);
121
- else fs.copyFileSync(from, to);
122
- }
123
- }
124
-
125
142
  function printHelp() {
126
143
  process.stdout.write([
127
144
  'Usage: npx @cloudcare/cocos-sdk install [options]',
@@ -129,6 +146,8 @@ function printHelp() {
129
146
  'Options:',
130
147
  ' --project <path> Cocos project root (defaults to the current directory)',
131
148
  ' --creator <2|3> Override automatic Cocos Creator version detection',
149
+ ' --replay Include the separately installed Session Replay package',
150
+ ' --no-replay Remove SDK-managed Replay native integration on rebuild',
132
151
  ' --ios-dependency-manager <spm|cocoapods> Save the iOS dependency manager in cocos-sdk.config.json',
133
152
  ' -h, --help Show this help',
134
153
  '',
@@ -0,0 +1,27 @@
1
+ [
2
+ "058341971ed42ddfde76c28ce19fcc0bba5020fec1f7e1c613c7bda7d2df7677",
3
+ "11ee16e609096ccfe90b17f61d87ab65275a39df4bef6f8c29577e7395aa00f8",
4
+ "15338071a78f1505265cc8efbdc9628e9362f7a2c9fc00989d57461126f8f3f5",
5
+ "1a51af27d68cdf0bf3ce709c9cd60f9b8a2d7defd46d06896ce9a916e1dfc767",
6
+ "2caa0d3d542f5cca0b6b7f3aa2851c7e296b08fce286202a844b52920b1f6dc0",
7
+ "3189144de638b936e14d64ddbf9d4c95e95146ceecc357021473ca8adcc757d1",
8
+ "48ff77a12a7b9b59172f5470a642f23e4c61e9f7e10ee6d9d3f4f41377d696ac",
9
+ "4d2dcd924f1073b8a6fb94d342bee33a281f93c19302104be172e5de9981b3f0",
10
+ "51c71e12df61cfe7e75c3d97080e31a398fbea8719a3e964cec5dd332df1202c",
11
+ "5f33108f27f38836214f2c11badd7bb76ba9ec090f9d5b1490834a9257976939",
12
+ "85ad9622480d954c33a4f9442a391f6d3d9d617a2f1261e5ad769170c6e9cf12",
13
+ "86cf732195aad676898520192ac8aa878267877dc09f85fcf425279d8badc9b8",
14
+ "910792f383c25cd46ddc7d851080a687fa532a93d605fb709b7baff9bb2789cf",
15
+ "95bdc516c4e1b72833af3bec13b18e3c2ac6ae83de284c3f711e97765ed1b461",
16
+ "a748564f0bba03effbf4aa381308f60eedcb618cbd2a37e1c67cdbee596e9ceb",
17
+ "a8a57b5892e7a5063078d561fce790b44d900d2bb3869e43ed4c4de82f1f62ed",
18
+ "cd03df57f7861d19b0a8e0a97e8aff1fa08e5c26d4f43152743968245632535b",
19
+ "d26fb42c6bee416eaf29bc2ed8579edc7a28ca3d0e18433dcb8abea11fac9920",
20
+ "d2d171e4ef1777facdb6fe665105372ea2e6452028d4c32f5e2ccc74dacc8850",
21
+ "d538d9eebaf181687ebf8537fc6ce7c8fae59fa424daeb45c3f900a8e210ecfc",
22
+ "df8e3014e583d60922cd1b7f7f16964c433b260a7e1a7e6c285cb08ce2d9e7e4",
23
+ "e70ca2a537cec56f8424ff4d551c1e97af133938fc7ba863a3944859dcfd194d",
24
+ "f0211acbaaa312bd5a4478bba81fa98293c855692ceca69f141600ff991c5904",
25
+ "f09f9b35ddfb17a7c4e4439384afae93ded6ee0285e778ad013d320cfc880cab",
26
+ "fa88198c5434613ff5ab2d44dce6e7eb8b825085b5b498402810eb144cf81f96"
27
+ ]
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { createHash } = require('crypto');
5
+ const legacyHashes = new Set(require('./legacy-asset-hashes.json'));
6
+ // Older combined installations predate the ownership manifest. Never leave a
7
+ // locally modified obsolete Replay bridge compiling beside the new bridge.
8
+ const legacyReplayNames = new Set(['FTCocosReplayImageJobs.java', 'FTCocosReplayImageJobs.h', 'FTCocosReplayImageJobs.m', 'FTReplayFileBridge.h', 'FTReplayFileWorker.h']);
9
+ const manifestName = '.cocos-sdk-managed.json';
10
+ const hash = bytes => createHash('sha256').update(bytes).digest('hex');
11
+
12
+ function files(root) {
13
+ const result = [];
14
+ if (!fs.existsSync(root)) return result;
15
+ function visit(directory) {
16
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
17
+ if (entry.name === manifestName || entry.name === '.DS_Store') continue;
18
+ const file = path.join(directory, entry.name);
19
+ if (entry.isSymbolicLink()) throw new Error(`[cocos-sdk] Refusing to copy symbolic link: ${file}`);
20
+ if (entry.isDirectory()) visit(file);
21
+ else result.push(path.relative(root, file).split(path.sep).join('/'));
22
+ }
23
+ }
24
+ visit(root);
25
+ return result;
26
+ }
27
+
28
+ /** Reconciles only files written by the SDK, preserving unrelated project assets. */
29
+ function syncManagedDirectory(destination, sources, overrides = {}) {
30
+ const desired = new Map();
31
+ for (const { root, prefix = '' } of sources) {
32
+ if (!fs.existsSync(root)) throw new Error(`[cocos-sdk] Missing package assets: ${root}`);
33
+ for (const file of files(root)) desired.set(prefix + file, fs.readFileSync(path.join(root, file)));
34
+ }
35
+ for (const [file, content] of Object.entries(overrides)) desired.set(file, Buffer.from(content));
36
+ const manifest = path.join(destination, manifestName);
37
+ const previous = fs.existsSync(manifest) ? JSON.parse(fs.readFileSync(manifest, 'utf8')) : {};
38
+ const existing = files(destination);
39
+ const remove = [];
40
+ // Check every conflict before writing or deleting any managed file.
41
+ for (const file of existing) {
42
+ const digest = hash(fs.readFileSync(path.join(destination, file)));
43
+ const old = previous[file];
44
+ const next = desired.get(file);
45
+ const legacy = legacyHashes.has(digest);
46
+ if (!next && !old && !legacy && legacyReplayNames.has(path.basename(file))) {
47
+ throw new Error(`[cocos-sdk] Preserve or reconcile modified legacy Replay asset before reinstalling: ${path.join(destination, file)}`);
48
+ }
49
+ if ((old || next) && digest !== old && !legacy && (!next || digest !== hash(next))) {
50
+ throw new Error(`[cocos-sdk] Preserve or reconcile modified SDK asset before reinstalling: ${path.join(destination, file)}`);
51
+ }
52
+ if (!next && (old || legacy) && !file.endsWith('.meta')) remove.push(file);
53
+ }
54
+ fs.mkdirSync(destination, { recursive: true });
55
+ for (const file of remove) fs.unlinkSync(path.join(destination, file));
56
+ const nextManifest = {};
57
+ for (const [file, content] of desired) {
58
+ const target = path.resolve(destination, file);
59
+ if (!target.startsWith(path.resolve(destination) + path.sep)) throw new Error('Invalid SDK asset path');
60
+ fs.mkdirSync(path.dirname(target), { recursive: true });
61
+ if (!fs.existsSync(target) || hash(fs.readFileSync(target)) !== hash(content)) fs.writeFileSync(target, content);
62
+ nextManifest[file] = hash(content);
63
+ }
64
+ fs.writeFileSync(manifest, `${JSON.stringify(nextManifest, null, 2)}\n`);
65
+ }
66
+
67
+ module.exports = { syncManagedDirectory };
@@ -1,11 +1,55 @@
1
1
  import { FTLogger, FTMobileAgent, FTRUM, FTTrace } from './modules.js';
2
- import { FTSessionReplay, type FTCanvasCapture, type FTReplayPointerSource } from './replay.js';
3
2
  import type { FTNativeTransport } from './transport.js';
4
3
  import type { FTAutoTrackingConfig, FTCocosConfig, FTCocosEnterOptions, FTCocosHybridConfig } from './types.js';
5
4
  export interface FTAutoTrackingController {
6
5
  start(config: FTAutoTrackingConfig, viewName?: string): void;
7
6
  stop(): void;
8
7
  }
8
+ export interface FTSDKLifecycle {
9
+ /**
10
+ * Validates or prepares the extension before standalone native SDK initialization.
11
+ * Throwing aborts startup before the base SDK is initialized.
12
+ */
13
+ beforeStart?(): void;
14
+ /**
15
+ * Starts the extension after the base SDK and configured modules initialize,
16
+ * but before Cocos automatic tracking starts. If this hook throws, the native
17
+ * SDK remains initialized; startup is not automatically rolled back.
18
+ */
19
+ afterStart?(): void;
20
+ /**
21
+ * Prepares the extension before the native Hybrid attachment call.
22
+ * The native host already owns SDK initialization at this point.
23
+ */
24
+ beforeAttach?(): void;
25
+ /**
26
+ * Undoes extension preparation if beforeAttach or the native attachment call
27
+ * fails. Must tolerate partial preparation; errors from this hook are ignored
28
+ * so the original attachment error can be rethrown.
29
+ */
30
+ rollbackAttach?(): void;
31
+ /**
32
+ * Starts extension activity when entering Cocos in Hybrid mode, before Cocos
33
+ * automatic tracking starts. A failure triggers the leave hook for cleanup.
34
+ */
35
+ enter?(): void;
36
+ /**
37
+ * Stops extension activity when leaving Cocos in Hybrid mode, after automatic
38
+ * tracking cleanup is attempted. Also runs if entering Cocos fails, so it must
39
+ * tolerate partial startup. The native host SDK must remain running.
40
+ */
41
+ leave?(): void;
42
+ /**
43
+ * Releases standalone extension resources after automatic tracking cleanup is
44
+ * attempted and before the base native SDK shuts down. Base SDK shutdown is
45
+ * still attempted if this hook throws. Not called for Hybrid applications.
46
+ */
47
+ shutdown?(): void;
48
+ }
49
+ export interface FTSDKExtension<T> {
50
+ value: T;
51
+ lifecycle: FTSDKLifecycle;
52
+ }
9
53
  /**
10
54
  * Cocos SDK facade exposed through the platform entry point's SDK
11
55
  * singleton. Do not construct this class directly.
@@ -13,6 +57,7 @@ export interface FTAutoTrackingController {
13
57
  export declare class FTCocosSDK {
14
58
  private readonly transport;
15
59
  private readonly autoTracking?;
60
+ readonly engine: 'creator2' | 'creator3';
16
61
  /** Base SDK lifecycle and user-binding operations. */
17
62
  readonly mobile: FTMobileAgent;
18
63
  /** Real User Monitoring operations. */
@@ -21,12 +66,15 @@ export declare class FTCocosSDK {
21
66
  readonly logger: FTLogger;
22
67
  /** Distributed-tracing operations. */
23
68
  readonly trace: FTTrace;
24
- /** Session Replay operations. */
25
- readonly replay: FTSessionReplay;
69
+ readonly extensionProtocol = 1;
70
+ private extension;
71
+ private extensionId;
26
72
  private state;
27
73
  private hybridAutoTracking;
28
74
  private readonly ownership;
29
- constructor(transport: FTNativeTransport, capture: FTCanvasCapture, autoTracking?: FTAutoTrackingController | undefined, pointerSource?: FTReplayPointerSource);
75
+ constructor(transport: FTNativeTransport, autoTracking?: FTAutoTrackingController | undefined, engine?: 'creator2' | 'creator3');
76
+ /** Attaches an optional package before SDK initialization. */
77
+ registerExtension<T>(id: string, version: string, engine: string, factory: () => FTSDKExtension<T>): T;
30
78
  /**
31
79
  * Initializes the native SDK and the configured modules for a standalone
32
80
  * Cocos application.
@@ -46,12 +94,12 @@ export declare class FTCocosSDK {
46
94
  * Call this once before the first {@link enterCocos}. This method does not
47
95
  * initialize or shut down the native SDK.
48
96
  *
49
- * @param config - Cocos tracking and replay settings owned by the native host.
97
+ * @param config - Cocos tracking settings for the SDK owned by the native host.
50
98
  * @throws If standalone initialization has already started.
51
99
  */
52
100
  attach(config?: FTCocosHybridConfig): void;
53
101
  /**
54
- * Starts Cocos automatic tracking and canvas replay capture in Hybrid mode.
102
+ * Starts Cocos automatic tracking and registered extensions in Hybrid mode.
55
103
  *
56
104
  * @param options - Options for the Cocos view being entered.
57
105
  * @throws If {@link attach} has not been called, or if `viewName` is omitted
@@ -59,7 +107,7 @@ export declare class FTCocosSDK {
59
107
  */
60
108
  enterCocos(options?: FTCocosEnterOptions): void;
61
109
  /**
62
- * Stops Cocos automatic tracking and canvas replay capture in Hybrid mode.
110
+ * Stops Cocos automatic tracking and registered extensions in Hybrid mode.
63
111
  * The native host SDK remains running.
64
112
  */
65
113
  leaveCocos(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAkB,OAAO,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EACL,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,MAAM,EAAE,oBAAoB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7D,IAAI,IAAI,IAAI,CAAC;C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ACtD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;gBAG/B,SAAS,EAAE,iBAAiB,EAC5B,YAAY,CAAC,EAAE,wBAAwB,YAAA,EAC/C,MAAM,GAAE,UAAU,GAAG,UAAuB;IAQvD,8DAA8D;IAC9D,iBAAiB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC;IAetG;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAiBlC;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,GAAE,mBAAwB,GAAG,IAAI;IAsB9C;;;;;;OAMG;IACH,UAAU,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI;IA6BnD;;;OAGG;IACH,UAAU,IAAI,IAAI;IAclB;;;;;OAKG;IACH,QAAQ,IAAI,IAAI;CAcjB"}
@@ -13,16 +13,18 @@ var __assign = (this && this.__assign) || function () {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.FTCocosSDK = void 0;
15
15
  var modules_js_1 = require("./modules.js");
16
- var replay_js_1 = require("./replay.js");
17
16
  var version_js_1 = require("./version.js");
18
17
  /**
19
18
  * Cocos SDK facade exposed through the platform entry point's SDK
20
19
  * singleton. Do not construct this class directly.
21
20
  */
22
21
  var FTCocosSDK = /** @class */ (function () {
23
- function FTCocosSDK(transport, capture, autoTracking, pointerSource) {
22
+ function FTCocosSDK(transport, autoTracking, engine) {
23
+ if (engine === void 0) { engine = 'creator3'; }
24
24
  this.transport = transport;
25
25
  this.autoTracking = autoTracking;
26
+ this.engine = engine;
27
+ this.extensionProtocol = 1;
26
28
  this.state = 'idle';
27
29
  this.hybridAutoTracking = {};
28
30
  this.ownership = new modules_js_1.FTSDKOwnership();
@@ -30,8 +32,24 @@ var FTCocosSDK = /** @class */ (function () {
30
32
  this.rum = new modules_js_1.FTRUM(transport, this.ownership);
31
33
  this.logger = new modules_js_1.FTLogger(transport, this.ownership);
32
34
  this.trace = new modules_js_1.FTTrace(transport, this.ownership);
33
- this.replay = new replay_js_1.FTSessionReplay(transport, capture, pointerSource);
34
35
  }
36
+ /** Attaches an optional package before SDK initialization. */
37
+ FTCocosSDK.prototype.registerExtension = function (id, version, engine, factory) {
38
+ if (version !== version_js_1.FT_COCOS_SDK_VERSION || engine !== this.engine) {
39
+ throw new Error('SDK extension version or Creator engine does not match the base SDK');
40
+ }
41
+ if (this.extension) {
42
+ if (id !== this.extensionId)
43
+ throw new Error('A different SDK extension is already installed');
44
+ return this.extension.value;
45
+ }
46
+ if (this.state !== 'idle')
47
+ throw new Error('Install SDK extensions before start() or attach()');
48
+ var extension = factory();
49
+ this.extension = extension;
50
+ this.extensionId = id;
51
+ return extension.value;
52
+ };
35
53
  /**
36
54
  * Initializes the native SDK and the configured modules for a standalone
37
55
  * Cocos application.
@@ -44,10 +62,12 @@ var FTCocosSDK = /** @class */ (function () {
44
62
  * @throws If the SDK is already started or attached.
45
63
  */
46
64
  FTCocosSDK.prototype.start = function (config) {
47
- var _a;
65
+ var _a, _b, _c, _d, _e, _f, _g;
66
+ rejectReplayConfig(config);
48
67
  if (this.state !== 'idle') {
49
68
  throw new Error('start() and attach() are mutually exclusive');
50
69
  }
70
+ (_c = (_a = this.extension) === null || _a === void 0 ? void 0 : (_b = _a.lifecycle).beforeStart) === null || _c === void 0 ? void 0 : _c.call(_b);
51
71
  this.mobile.start(config.sdk);
52
72
  // Base SDK installation already belongs to this Cocos runtime after the
53
73
  // first bridge call succeeds, even if a later optional module fails.
@@ -58,10 +78,9 @@ var FTCocosSDK = /** @class */ (function () {
58
78
  this.logger.start(config.logger);
59
79
  if (config.trace)
60
80
  this.trace.start(config.trace);
61
- if (config.replay)
62
- this.replay.start(config.replay);
81
+ (_f = (_d = this.extension) === null || _d === void 0 ? void 0 : (_e = _d.lifecycle).afterStart) === null || _f === void 0 ? void 0 : _f.call(_e);
63
82
  if (config.autoTrack)
64
- (_a = this.autoTracking) === null || _a === void 0 ? void 0 : _a.start(config.autoTrack);
83
+ (_g = this.autoTracking) === null || _g === void 0 ? void 0 : _g.start(config.autoTrack);
65
84
  };
66
85
  /**
67
86
  * Attaches Cocos instrumentation to an SDK instance initialized by the
@@ -70,11 +89,13 @@ var FTCocosSDK = /** @class */ (function () {
70
89
  * Call this once before the first {@link enterCocos}. This method does not
71
90
  * initialize or shut down the native SDK.
72
91
  *
73
- * @param config - Cocos tracking and replay settings owned by the native host.
92
+ * @param config - Cocos tracking settings for the SDK owned by the native host.
74
93
  * @throws If standalone initialization has already started.
75
94
  */
76
95
  FTCocosSDK.prototype.attach = function (config) {
96
+ var _a, _b, _c, _d, _e, _f;
77
97
  if (config === void 0) { config = {}; }
98
+ rejectReplayConfig(config);
78
99
  if (this.state === 'standalone') {
79
100
  throw new Error('start() and attach() are mutually exclusive');
80
101
  }
@@ -82,14 +103,16 @@ var FTCocosSDK = /** @class */ (function () {
82
103
  return;
83
104
  this.ownership.claimNativeHost();
84
105
  try {
85
- this.replay.attachHybrid(config.replay);
106
+ (_c = (_a = this.extension) === null || _a === void 0 ? void 0 : (_b = _a.lifecycle).beforeAttach) === null || _c === void 0 ? void 0 : _c.call(_b);
86
107
  this.transport.invoke('hybrid.attach', {
87
- requiresReplay: config.replay !== undefined,
88
108
  sdkVersion: version_js_1.FT_COCOS_SDK_VERSION,
89
109
  });
90
110
  }
91
111
  catch (error) {
92
- this.replay.detachHybrid();
112
+ try {
113
+ (_f = (_d = this.extension) === null || _d === void 0 ? void 0 : (_e = _d.lifecycle).rollbackAttach) === null || _f === void 0 ? void 0 : _f.call(_e);
114
+ }
115
+ catch ( /* Preserve attachment error. */_g) { /* Preserve attachment error. */ }
93
116
  this.ownership.releaseNativeHost();
94
117
  throw error;
95
118
  }
@@ -97,14 +120,14 @@ var FTCocosSDK = /** @class */ (function () {
97
120
  this.state = 'hybrid-attached';
98
121
  };
99
122
  /**
100
- * Starts Cocos automatic tracking and canvas replay capture in Hybrid mode.
123
+ * Starts Cocos automatic tracking and registered extensions in Hybrid mode.
101
124
  *
102
125
  * @param options - Options for the Cocos view being entered.
103
126
  * @throws If {@link attach} has not been called, or if `viewName` is omitted
104
127
  * while automatic scene tracking is disabled.
105
128
  */
106
129
  FTCocosSDK.prototype.enterCocos = function (options) {
107
- var _a, _b;
130
+ var _a, _b, _c, _d, _e, _f, _g, _h;
108
131
  if (options === void 0) { options = {}; }
109
132
  if (this.state === 'standalone') {
110
133
  throw new Error('enterCocos() is only available after attach()');
@@ -119,35 +142,42 @@ var FTCocosSDK = /** @class */ (function () {
119
142
  throw new TypeError('enterCocos.viewName is required when scene tracking is disabled');
120
143
  }
121
144
  try {
122
- this.replay.enterHybrid();
123
- (_a = this.autoTracking) === null || _a === void 0 ? void 0 : _a.start(this.hybridAutoTracking, viewName);
145
+ (_c = (_a = this.extension) === null || _a === void 0 ? void 0 : (_b = _a.lifecycle).enter) === null || _c === void 0 ? void 0 : _c.call(_b);
146
+ (_d = this.autoTracking) === null || _d === void 0 ? void 0 : _d.start(this.hybridAutoTracking, viewName);
124
147
  this.state = 'hybrid-entered';
125
148
  }
126
149
  catch (error) {
127
- (_b = this.autoTracking) === null || _b === void 0 ? void 0 : _b.stop();
128
150
  try {
129
- this.replay.leaveHybrid();
151
+ (_e = this.autoTracking) === null || _e === void 0 ? void 0 : _e.stop();
130
152
  }
131
- catch (_c) {
153
+ catch ( /* Preserve the entry error. */_j) { /* Preserve the entry error. */ }
154
+ try {
155
+ (_h = (_f = this.extension) === null || _f === void 0 ? void 0 : (_g = _f.lifecycle).leave) === null || _h === void 0 ? void 0 : _h.call(_g);
156
+ }
157
+ catch (_k) {
132
158
  // Preserve the error that prevented entering Cocos.
133
159
  }
134
160
  throw error;
135
161
  }
136
162
  };
137
163
  /**
138
- * Stops Cocos automatic tracking and canvas replay capture in Hybrid mode.
164
+ * Stops Cocos automatic tracking and registered extensions in Hybrid mode.
139
165
  * The native host SDK remains running.
140
166
  */
141
167
  FTCocosSDK.prototype.leaveCocos = function () {
142
- var _a;
168
+ var _a, _b, _c, _d;
143
169
  if (this.state === 'standalone') {
144
170
  throw new Error('leaveCocos() is only available after attach()');
145
171
  }
146
172
  if (this.state === 'idle' || this.state === 'hybrid-attached')
147
173
  return;
148
- (_a = this.autoTracking) === null || _a === void 0 ? void 0 : _a.stop();
149
- this.replay.leaveHybrid();
150
- this.state = 'hybrid-attached';
174
+ try {
175
+ (_a = this.autoTracking) === null || _a === void 0 ? void 0 : _a.stop();
176
+ }
177
+ finally {
178
+ (_d = (_b = this.extension) === null || _b === void 0 ? void 0 : (_c = _b.lifecycle).leave) === null || _d === void 0 ? void 0 : _d.call(_c);
179
+ this.state = 'hybrid-attached';
180
+ }
151
181
  };
152
182
  /**
153
183
  * Stops a standalone SDK instance and releases its Cocos instrumentation.
@@ -156,16 +186,27 @@ var FTCocosSDK = /** @class */ (function () {
156
186
  * native host owns SDK shutdown.
157
187
  */
158
188
  FTCocosSDK.prototype.shutdown = function () {
159
- var _a;
189
+ var _this = this;
160
190
  if (this.state === 'hybrid-attached' || this.state === 'hybrid-entered') {
161
191
  throw new Error('The native host owns the native SDK; call leaveCocos() instead of shutdown()');
162
192
  }
163
193
  if (this.state === 'idle')
164
194
  return;
165
- (_a = this.autoTracking) === null || _a === void 0 ? void 0 : _a.stop();
166
- this.replay.stop();
167
- this.mobile.shutdown();
168
- this.state = 'idle';
195
+ var failure;
196
+ var cleanup = function (operation) {
197
+ try {
198
+ operation();
199
+ }
200
+ catch (error) {
201
+ if (failure === undefined)
202
+ failure = error;
203
+ }
204
+ };
205
+ cleanup(function () { var _a; return (_a = _this.autoTracking) === null || _a === void 0 ? void 0 : _a.stop(); });
206
+ cleanup(function () { var _a, _b, _c; return (_c = (_a = _this.extension) === null || _a === void 0 ? void 0 : (_b = _a.lifecycle).shutdown) === null || _c === void 0 ? void 0 : _c.call(_b); });
207
+ cleanup(function () { _this.mobile.shutdown(); _this.state = 'idle'; });
208
+ if (failure !== undefined)
209
+ throw failure;
169
210
  };
170
211
  return FTCocosSDK;
171
212
  }());
@@ -173,4 +214,9 @@ exports.FTCocosSDK = FTCocosSDK;
173
214
  function nonEmptyText(value) {
174
215
  return typeof value === 'string' && value.trim().length > 0 ? value : undefined;
175
216
  }
217
+ function rejectReplayConfig(config) {
218
+ if ('replay' in config) {
219
+ throw new Error('Session Replay requires @cloudcare/cocos-session-replay. Install the package and use withSessionReplay() before passing replay configuration.');
220
+ }
221
+ }
176
222
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/core/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAuF;AACvF,yCAIqB;AAQrB,2CAAoD;AASpD;;;GAGG;AACH;IAgBE,oBACmB,SAA4B,EAC7C,OAAwB,EACP,YAAuC,EACxD,aAAqC;QAHpB,cAAS,GAAT,SAAS,CAAmB;QAE5B,iBAAY,GAAZ,YAAY,CAA2B;QAPlD,UAAK,GAAoB,MAAM,CAAC;QAChC,uBAAkB,GAAyB,EAAE,CAAC;QACrC,cAAS,GAAG,IAAI,2BAAc,EAAE,CAAC;QAQhD,IAAI,CAAC,MAAM,GAAG,IAAI,0BAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,kBAAK,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,IAAI,oBAAO,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,IAAI,2BAAe,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;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CAAC,KAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,OAAO,CAAC;IAC3C,CAAC;IACH,iBAAC;AAAD,CAAC,AAlLD,IAkLC;AAlLY,gCAAU;AAoLvB,SAAS,YAAY,CAAC,KAAyB;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAc;IACxC,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+IAA+I,CAAC,CAAC;IACnK,CAAC;AACH,CAAC"}
@@ -1,3 +1,3 @@
1
- export type { FTAttributes, FTAutoTrackingConfig, FTCocosConfig, FTCocosEnterOptions, FTCocosHybridConfig, FTEnvironment, FTHybridSessionReplayConfig, FTLoggerConfig, FTLogLevel, FTPrimitive, FTReplayImagePolicy, FTReplayPrivacyMode, FTReplayQuality, FTReplayTouchPrivacy, FTResourceContent, FTResourceMetrics, FTRUMConfig, FTSDKConfig, FTSessionReplayConfig, FTTraceConfig, FTTraceType, FTUserData, FTValue, } from './types.js';
1
+ export type { FTAttributes, FTAutoTrackingConfig, FTCocosConfig, FTCocosEnterOptions, FTCocosHybridConfig, FTEnvironment, FTLoggerConfig, FTLogLevel, FTPrimitive, FTResourceContent, FTResourceMetrics, FTRUMConfig, FTSDKConfig, FTTraceConfig, FTTraceType, FTUserData, FTValue, } from './types.js';
2
2
  export { FT_COCOS_SDK_VERSION } from './version.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,GACR,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,GACR,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/index.ts"],"names":[],"mappings":";;;AA0BA,2CAAoD;AAA3C,kHAAA,oBAAoB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/index.ts"],"names":[],"mappings":";;;AAoBA,2CAAoD;AAA3C,kHAAA,oBAAoB,OAAA"}
@@ -0,0 +1,15 @@
1
+ import type { FTCocosSDK as SDK } from './client.js';
2
+ export type { FTSDKLifecycle, FTSDKExtension } from './client.js';
3
+ export type { FTNativeTransport } from './transport.js';
4
+ export type { FTAttributes, FTCocosConfig, FTCocosHybridConfig, FTCocosEnterOptions, FTValue } from './types.js';
5
+ type Public<T> = {
6
+ [K in keyof T]: T[K];
7
+ };
8
+ /** Structural contract shared by the CommonJS and ES module engine builds. */
9
+ export type FTCocosSDK = Omit<Public<SDK>, 'mobile' | 'rum' | 'logger' | 'trace'> & {
10
+ mobile: Public<SDK['mobile']>;
11
+ rum: Public<SDK['rum']>;
12
+ logger: Public<SDK['logger']>;
13
+ trace: Public<SDK['trace']>;
14
+ };
15
+ //# sourceMappingURL=plugin-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-api.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugin-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEjH,KAAK,MAAM,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE1C,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG;IAClF,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=plugin-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-api.js","sourceRoot":"","sources":["../../../../../src/core/plugin-api.ts"],"names":[],"mappings":""}