@dcl-regenesislabs/sdk-commands 0.0.0-stage → 7.0.0-42707159203.commit-ff138cd

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 (250) hide show
  1. package/.dclrc +19 -0
  2. package/LICENSE +201 -0
  3. package/README.md +106 -2
  4. package/dist/commands/build/index.d.ts +23 -0
  5. package/dist/commands/build/index.js +80 -0
  6. package/dist/commands/build/index.js.map +1 -0
  7. package/dist/commands/code-to-composite/asset-migrator.d.ts +25 -0
  8. package/dist/commands/code-to-composite/asset-migrator.js +238 -0
  9. package/dist/commands/code-to-composite/asset-migrator.js.map +1 -0
  10. package/dist/commands/code-to-composite/code-commenter.d.ts +11 -0
  11. package/dist/commands/code-to-composite/code-commenter.js +87 -0
  12. package/dist/commands/code-to-composite/code-commenter.js.map +1 -0
  13. package/dist/commands/code-to-composite/composite-generator.d.ts +6 -0
  14. package/dist/commands/code-to-composite/composite-generator.js +65 -0
  15. package/dist/commands/code-to-composite/composite-generator.js.map +1 -0
  16. package/dist/commands/code-to-composite/index.d.ts +16 -0
  17. package/dist/commands/code-to-composite/index.js +130 -0
  18. package/dist/commands/code-to-composite/index.js.map +1 -0
  19. package/dist/commands/code-to-composite/name-generator.d.ts +9 -0
  20. package/dist/commands/code-to-composite/name-generator.js +139 -0
  21. package/dist/commands/code-to-composite/name-generator.js.map +1 -0
  22. package/dist/commands/code-to-composite/scene-executor.d.ts +15 -0
  23. package/dist/commands/code-to-composite/scene-executor.js +421 -0
  24. package/dist/commands/code-to-composite/scene-executor.js.map +1 -0
  25. package/dist/commands/deploy/analytics-features.d.ts +4 -0
  26. package/dist/commands/deploy/analytics-features.js +11 -0
  27. package/dist/commands/deploy/analytics-features.js.map +1 -0
  28. package/dist/commands/deploy/deployment.d.ts +51 -0
  29. package/dist/commands/deploy/deployment.js +122 -0
  30. package/dist/commands/deploy/deployment.js.map +1 -0
  31. package/dist/commands/deploy/index.d.ts +37 -0
  32. package/dist/commands/deploy/index.js +312 -0
  33. package/dist/commands/deploy/index.js.map +1 -0
  34. package/dist/commands/deploy/routes.d.ts +27 -0
  35. package/dist/commands/deploy/routes.js +144 -0
  36. package/dist/commands/deploy/routes.js.map +1 -0
  37. package/dist/commands/deploy/state.d.ts +60 -0
  38. package/dist/commands/deploy/state.js +144 -0
  39. package/dist/commands/deploy/state.js.map +1 -0
  40. package/dist/commands/deploy/upload.d.ts +23 -0
  41. package/dist/commands/deploy/upload.js +120 -0
  42. package/dist/commands/deploy/upload.js.map +1 -0
  43. package/dist/commands/deploy/utils.d.ts +131 -0
  44. package/dist/commands/deploy/utils.js +432 -0
  45. package/dist/commands/deploy/utils.js.map +1 -0
  46. package/dist/commands/export-static/index.d.ts +27 -0
  47. package/dist/commands/export-static/index.js +155 -0
  48. package/dist/commands/export-static/index.js.map +1 -0
  49. package/dist/commands/get-context-files/index.d.ts +12 -0
  50. package/dist/commands/get-context-files/index.js +119 -0
  51. package/dist/commands/get-context-files/index.js.map +1 -0
  52. package/dist/commands/init/download-github-folder.d.ts +2 -0
  53. package/dist/commands/init/download-github-folder.js +69 -0
  54. package/dist/commands/init/download-github-folder.js.map +1 -0
  55. package/dist/commands/init/index.d.ts +18 -0
  56. package/dist/commands/init/index.js +98 -0
  57. package/dist/commands/init/index.js.map +1 -0
  58. package/dist/commands/init/project.d.ts +7 -0
  59. package/dist/commands/init/project.js +36 -0
  60. package/dist/commands/init/project.js.map +1 -0
  61. package/dist/commands/init/repos.d.ts +4 -0
  62. package/dist/commands/init/repos.js +21 -0
  63. package/dist/commands/init/repos.js.map +1 -0
  64. package/dist/commands/pack-smart-wearable/index.d.ts +16 -0
  65. package/dist/commands/pack-smart-wearable/index.js +108 -0
  66. package/dist/commands/pack-smart-wearable/index.js.map +1 -0
  67. package/dist/commands/quests/index.d.ts +28 -0
  68. package/dist/commands/quests/index.js +271 -0
  69. package/dist/commands/quests/index.js.map +1 -0
  70. package/dist/commands/quests/types.d.ts +41 -0
  71. package/dist/commands/quests/types.js +3 -0
  72. package/dist/commands/quests/types.js.map +1 -0
  73. package/dist/commands/quests/utils.d.ts +20 -0
  74. package/dist/commands/quests/utils.js +253 -0
  75. package/dist/commands/quests/utils.js.map +1 -0
  76. package/dist/commands/start/data-layer/fs.d.ts +8 -0
  77. package/dist/commands/start/data-layer/fs.js +73 -0
  78. package/dist/commands/start/data-layer/fs.js.map +1 -0
  79. package/dist/commands/start/data-layer/rpc.d.ts +8 -0
  80. package/dist/commands/start/data-layer/rpc.js +54 -0
  81. package/dist/commands/start/data-layer/rpc.js.map +1 -0
  82. package/dist/commands/start/data-layer/ws.d.ts +4 -0
  83. package/dist/commands/start/data-layer/ws.js +17 -0
  84. package/dist/commands/start/data-layer/ws.js.map +1 -0
  85. package/dist/commands/start/explorer-alpha.d.ts +19 -0
  86. package/dist/commands/start/explorer-alpha.js +109 -0
  87. package/dist/commands/start/explorer-alpha.js.map +1 -0
  88. package/dist/commands/start/index.d.ts +46 -0
  89. package/dist/commands/start/index.js +300 -0
  90. package/dist/commands/start/index.js.map +1 -0
  91. package/dist/commands/start/server/endpoints.d.ts +5 -0
  92. package/dist/commands/start/server/endpoints.js +417 -0
  93. package/dist/commands/start/server/endpoints.js.map +1 -0
  94. package/dist/commands/start/server/file-watch-notifier.d.ts +12 -0
  95. package/dist/commands/start/server/file-watch-notifier.js +96 -0
  96. package/dist/commands/start/server/file-watch-notifier.js.map +1 -0
  97. package/dist/commands/start/server/realm.d.ts +7 -0
  98. package/dist/commands/start/server/realm.js +58 -0
  99. package/dist/commands/start/server/realm.js.map +1 -0
  100. package/dist/commands/start/server/routes.d.ts +6 -0
  101. package/dist/commands/start/server/routes.js +77 -0
  102. package/dist/commands/start/server/routes.js.map +1 -0
  103. package/dist/commands/start/server/ws.d.ts +11 -0
  104. package/dist/commands/start/server/ws.js +19 -0
  105. package/dist/commands/start/server/ws.js.map +1 -0
  106. package/dist/commands/start/types.d.ts +16 -0
  107. package/dist/commands/start/types.js +3 -0
  108. package/dist/commands/start/types.js.map +1 -0
  109. package/dist/commands/start/utils.d.ts +8 -0
  110. package/dist/commands/start/utils.js +57 -0
  111. package/dist/commands/start/utils.js.map +1 -0
  112. package/dist/components/analytics.d.ts +105 -0
  113. package/dist/components/analytics.js +76 -0
  114. package/dist/components/analytics.js.map +1 -0
  115. package/dist/components/config.d.ts +18 -0
  116. package/dist/components/config.js +58 -0
  117. package/dist/components/config.js.map +1 -0
  118. package/dist/components/eth.d.ts +2 -0
  119. package/dist/components/eth.js +6 -0
  120. package/dist/components/eth.js.map +1 -0
  121. package/dist/components/exit-signal.d.ts +5 -0
  122. package/dist/components/exit-signal.js +21 -0
  123. package/dist/components/exit-signal.js.map +1 -0
  124. package/dist/components/fetch.d.ts +6 -0
  125. package/dist/components/fetch.js +9 -0
  126. package/dist/components/fetch.js.map +1 -0
  127. package/dist/components/fs.d.ts +18 -0
  128. package/dist/components/fs.js +85 -0
  129. package/dist/components/fs.js.map +1 -0
  130. package/dist/components/index.d.ts +14 -0
  131. package/dist/components/index.js +25 -0
  132. package/dist/components/index.js.map +1 -0
  133. package/dist/components/log.d.ts +24 -0
  134. package/dist/components/log.js +67 -0
  135. package/dist/components/log.js.map +1 -0
  136. package/dist/generated/decentraland/common/border_rect.gen.d.ts +49 -0
  137. package/dist/generated/decentraland/common/border_rect.gen.js +199 -0
  138. package/dist/generated/decentraland/common/border_rect.gen.js.map +1 -0
  139. package/dist/generated/decentraland/common/vectors.gen.d.ts +71 -0
  140. package/dist/generated/decentraland/common/vectors.gen.js +334 -0
  141. package/dist/generated/decentraland/common/vectors.gen.js.map +1 -0
  142. package/dist/generated/decentraland/realm/about.gen.d.ts +229 -0
  143. package/dist/generated/decentraland/realm/about.gen.js +1175 -0
  144. package/dist/generated/decentraland/realm/about.gen.js.map +1 -0
  145. package/dist/generated/decentraland/sdk/development/local_development.gen.d.ts +70 -0
  146. package/dist/generated/decentraland/sdk/development/local_development.gen.js +278 -0
  147. package/dist/generated/decentraland/sdk/development/local_development.gen.js.map +1 -0
  148. package/dist/index.d.ts +2 -0
  149. package/dist/index.js +37 -0
  150. package/dist/index.js.map +1 -0
  151. package/dist/linker-dapp/routes.d.ts +32 -0
  152. package/dist/linker-dapp/routes.js +140 -0
  153. package/dist/linker-dapp/routes.js.map +1 -0
  154. package/dist/locales/en.json +84 -0
  155. package/dist/locales/es.json +84 -0
  156. package/dist/locales/zh.json +84 -0
  157. package/dist/logic/account.d.ts +6 -0
  158. package/dist/logic/account.js +25 -0
  159. package/dist/logic/account.js.map +1 -0
  160. package/dist/logic/args.d.ts +6 -0
  161. package/dist/logic/args.js +25 -0
  162. package/dist/logic/args.js.map +1 -0
  163. package/dist/logic/beautiful-logs.d.ts +14 -0
  164. package/dist/logic/beautiful-logs.js +55 -0
  165. package/dist/logic/beautiful-logs.js.map +1 -0
  166. package/dist/logic/bundle.d.ts +47 -0
  167. package/dist/logic/bundle.js +573 -0
  168. package/dist/logic/bundle.js.map +1 -0
  169. package/dist/logic/catalyst-requests.d.ts +20 -0
  170. package/dist/logic/catalyst-requests.js +54 -0
  171. package/dist/logic/catalyst-requests.js.map +1 -0
  172. package/dist/logic/commands.d.ts +3 -0
  173. package/dist/logic/commands.js +30 -0
  174. package/dist/logic/commands.js.map +1 -0
  175. package/dist/logic/composite.d.ts +15 -0
  176. package/dist/logic/composite.js +105 -0
  177. package/dist/logic/composite.js.map +1 -0
  178. package/dist/logic/config.d.ts +24 -0
  179. package/dist/logic/config.js +88 -0
  180. package/dist/logic/config.js.map +1 -0
  181. package/dist/logic/coordinates.d.ts +14 -0
  182. package/dist/logic/coordinates.js +31 -0
  183. package/dist/logic/coordinates.js.map +1 -0
  184. package/dist/logic/dcl-ignore.d.ts +8 -0
  185. package/dist/logic/dcl-ignore.js +53 -0
  186. package/dist/logic/dcl-ignore.js.map +1 -0
  187. package/dist/logic/debounce.d.ts +1 -0
  188. package/dist/logic/debounce.js +11 -0
  189. package/dist/logic/debounce.js.map +1 -0
  190. package/dist/logic/error.d.ts +7 -0
  191. package/dist/logic/error.js +13 -0
  192. package/dist/logic/error.js.map +1 -0
  193. package/dist/logic/exec.d.ts +12 -0
  194. package/dist/logic/exec.js +40 -0
  195. package/dist/logic/exec.js.map +1 -0
  196. package/dist/logic/fetch.d.ts +25 -0
  197. package/dist/logic/fetch.js +42 -0
  198. package/dist/logic/fetch.js.map +1 -0
  199. package/dist/logic/fs.d.ts +33 -0
  200. package/dist/logic/fs.js +57 -0
  201. package/dist/logic/fs.js.map +1 -0
  202. package/dist/logic/future.d.ts +6 -0
  203. package/dist/logic/future.js +14 -0
  204. package/dist/logic/future.js.map +1 -0
  205. package/dist/logic/get-free-port.d.ts +1 -0
  206. package/dist/logic/get-free-port.js +70 -0
  207. package/dist/logic/get-free-port.js.map +1 -0
  208. package/dist/logic/lang.d.ts +7 -0
  209. package/dist/logic/lang.js +41 -0
  210. package/dist/logic/lang.js.map +1 -0
  211. package/dist/logic/open.d.ts +1 -0
  212. package/dist/logic/open.js +41 -0
  213. package/dist/logic/open.js.map +1 -0
  214. package/dist/logic/portable-experience-sw-validations.d.ts +18 -0
  215. package/dist/logic/portable-experience-sw-validations.js +48 -0
  216. package/dist/logic/portable-experience-sw-validations.js.map +1 -0
  217. package/dist/logic/project-files.d.ts +40 -0
  218. package/dist/logic/project-files.js +158 -0
  219. package/dist/logic/project-files.js.map +1 -0
  220. package/dist/logic/project-validations.d.ts +45 -0
  221. package/dist/logic/project-validations.js +143 -0
  222. package/dist/logic/project-validations.js.map +1 -0
  223. package/dist/logic/promise-utils.d.ts +1 -0
  224. package/dist/logic/promise-utils.js +20 -0
  225. package/dist/logic/promise-utils.js.map +1 -0
  226. package/dist/logic/prompts.d.ts +23 -0
  227. package/dist/logic/prompts.js +74 -0
  228. package/dist/logic/prompts.js.map +1 -0
  229. package/dist/logic/realm.d.ts +3 -0
  230. package/dist/logic/realm.js +32 -0
  231. package/dist/logic/realm.js.map +1 -0
  232. package/dist/logic/runtime-script.d.ts +42 -0
  233. package/dist/logic/runtime-script.js +217 -0
  234. package/dist/logic/runtime-script.js.map +1 -0
  235. package/dist/logic/runtime-script.ts +270 -0
  236. package/dist/logic/scene-validations.d.ts +35 -0
  237. package/dist/logic/scene-validations.js +135 -0
  238. package/dist/logic/scene-validations.js.map +1 -0
  239. package/dist/logic/script-module.d.ts.template +87 -0
  240. package/dist/logic/workspace-validations.d.ts +27 -0
  241. package/dist/logic/workspace-validations.js +136 -0
  242. package/dist/logic/workspace-validations.js.map +1 -0
  243. package/dist/run-command.d.ts +7 -0
  244. package/dist/run-command.js +95 -0
  245. package/dist/run-command.js.map +1 -0
  246. package/dist/run-dapp.d.ts +23 -0
  247. package/dist/run-dapp.js +66 -0
  248. package/dist/run-dapp.js.map +1 -0
  249. package/package.json +74 -3
  250. package/scripts/postinstall.js +17 -0
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.daoCatalysts = daoCatalysts;
4
+ exports.fetchEntityByPointer = fetchEntityByPointer;
5
+ exports.getPointers = getPointers;
6
+ const config_1 = require("./config");
7
+ const fetch_1 = require("./fetch");
8
+ async function daoCatalysts(components, network) {
9
+ const tld = network === 'mainnet' ? 'org' : 'zone';
10
+ const catalystUrl = network === 'mainnet' ? await (0, config_1.getCatalystBaseUrl)(components) : `https://peer.decentraland.${tld}`;
11
+ const resp = await (await components.fetch.fetch(`${catalystUrl}/lambdas/contracts/servers`)).json();
12
+ return resp;
13
+ }
14
+ async function fetchEntityByPointer({ fetch }, baseUrl, pointers) {
15
+ if (pointers.length === 0)
16
+ return {
17
+ baseUrl,
18
+ deployments: []
19
+ };
20
+ const activeEntities = baseUrl + '/content/entities/active';
21
+ const response = await fetch.fetch(activeEntities, {
22
+ method: 'post',
23
+ headers: { 'content-type': 'application/json', connection: 'close' },
24
+ body: JSON.stringify({ pointers })
25
+ });
26
+ let deployments = [];
27
+ if (response.ok) {
28
+ deployments = (await response.json());
29
+ }
30
+ else {
31
+ await (0, fetch_1.drainResponse)(response);
32
+ }
33
+ return {
34
+ baseUrl,
35
+ deployments
36
+ };
37
+ }
38
+ async function getPointers(components, pointer, network) {
39
+ const catalysts = await daoCatalysts(components, network);
40
+ const catalystInfo = [];
41
+ for (const { baseUrl } of catalysts) {
42
+ try {
43
+ const result = await fetchEntityByPointer(components, baseUrl, [pointer]);
44
+ const timestamp = result.deployments[0]?.timestamp;
45
+ const entityId = result.deployments[0]?.id || '';
46
+ catalystInfo.push({ timestamp, entityId, url: baseUrl });
47
+ }
48
+ catch (err) {
49
+ components.logger.log('Error fetching catalyst pointers', err);
50
+ }
51
+ }
52
+ return catalystInfo;
53
+ }
54
+ //# sourceMappingURL=catalyst-requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalyst-requests.js","sourceRoot":"","sources":["../../src/logic/catalyst-requests.ts"],"names":[],"mappings":";;AAmBA,oCAQC;AAED,oDAiCC;AAED,kCAqBC;AAnFD,qCAA6C;AAC7C,mCAAuC;AAgBhC,KAAK,UAAU,YAAY,CAChC,UAAmD,EACnD,OAAgB;IAEhB,MAAM,GAAG,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAA;IAClD,MAAM,WAAW,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,IAAA,2BAAkB,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,6BAA6B,GAAG,EAAE,CAAA;IACrH,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,WAAW,4BAA4B,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACpG,OAAO,IAAqB,CAAA;AAC9B,CAAC;AAEM,KAAK,UAAU,oBAAoB,CACxC,EAAE,KAAK,EAAgC,EACvC,OAAe,EACf,QAAkB;IAKlB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QACvB,OAAO;YACL,OAAO;YACP,WAAW,EAAE,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C1D,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAA;QAChE,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CliComponents } from '../components';
2
+ export declare const COMMANDS_PATH: string;
3
+ export declare function getCommands({ fs }: Pick<CliComponents, 'fs'>): Promise<string[]>;
@@ -0,0 +1,30 @@
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.COMMANDS_PATH = void 0;
7
+ exports.getCommands = getCommands;
8
+ const path_1 = require("path");
9
+ const error_1 = require("./error");
10
+ const i18next_1 = __importDefault(require("i18next"));
11
+ exports.COMMANDS_PATH = (0, path_1.resolve)(__dirname, '../commands');
12
+ async function getCommands({ fs }) {
13
+ const commandDirs = await fs.readdir(exports.COMMANDS_PATH);
14
+ const commands = commandDirs.map(async (dir) => {
15
+ const path = (0, path_1.resolve)(exports.COMMANDS_PATH, dir);
16
+ if (!(await fs.directoryExists(path))) {
17
+ throw new error_1.CliError('COMMANDS_INVALID_FOLDER', i18next_1.default.t('errors.commands.invalid_folder'));
18
+ }
19
+ try {
20
+ require.resolve(`${path}`);
21
+ }
22
+ catch {
23
+ /* istanbul ignore next */
24
+ throw new error_1.CliError('COMMANDS_INVALID_INDEX_FILE', i18next_1.default.t('errors.commands.invalid_index_file'));
25
+ }
26
+ return dir;
27
+ });
28
+ return Promise.all(commands);
29
+ }
30
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/logic/commands.ts"],"names":[],"mappings":";;;;;;AAOA,kCAqBC;AA5BD,+BAA8B;AAE9B,mCAAkC;AAClC,sDAA6B;AAEhB,QAAA,aAAa,GAAG,IAAA,cAAO,EAAC,SAAS,EAAE,aAAa,CAAC,CAAA;AAEvD,KAAK,UAAU,WAAW,CAAC,EAAE,EAAE,EAA6B;IACjE,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,qBAAa,CAAC,CAAA;IAEnD,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC7C,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,qBAAa,EAAE,GAAG,CAAC,CAAA;QAExC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,gBAAQ,CAAC,yBAAyB,EAAE,iBAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAA;QAC5F,CAAC;QAED,IAAI,CAAC;YACH,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAA;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,0BAA0B;YAC1B,MAAM,IAAI,gBAAQ,CAAC,6BAA6B,EAAE,iBAAO,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAA;QACpG,CAAC;QAED,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { EditorComponentsTypes } from '@dcl/inspector';
2
+ import { CliComponents } from '../components';
3
+ type CompositeComponents = Pick<CliComponents, 'logger' | 'fs'>;
4
+ type ScriptItem = EditorComponentsTypes['Script']['value'][number];
5
+ export type Script = ScriptItem & {
6
+ entity: number;
7
+ };
8
+ export declare function getAllComposites(components: CompositeComponents, workingDirectory: string): Promise<{
9
+ watchFiles: string[];
10
+ compositeLines: string[];
11
+ scripts: Map<string, Script[]>;
12
+ withErrors: boolean;
13
+ maxCompositeEntity: number;
14
+ }>;
15
+ export {};
@@ -0,0 +1,105 @@
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.getAllComposites = getAllComposites;
7
+ const fs_1 = require("fs");
8
+ const path_1 = __importDefault(require("path"));
9
+ const dist_cjs_1 = require("@dcl/ecs/dist-cjs");
10
+ const inspector_1 = require("@dcl/inspector");
11
+ const beautiful_logs_1 = require("./beautiful-logs");
12
+ const COMPOSITE_FILE_MAX_BYTES = 16 * 1024 * 1024; // 16 MB — sanity cap on hand-authored composites; rejects DoS-shaped inputs without bothering legitimate ones.
13
+ async function getAllComposites(components, workingDirectory) {
14
+ let withErrors = false;
15
+ const composites = {};
16
+ // Discover every composite so build-time recursion (`instanceComposite` →
17
+ // `getCompositeOrNull(childCompositePath)`) can resolve nested references
18
+ // embedded in `main.composite`. Only `main.composite` is later inlined into
19
+ // the JS bundle (`compositeLines` below); secondary composites lazy-load at
20
+ // runtime via `~system/Runtime.readFile`.
21
+ const watchFiles = (0, fs_1.globSync)('**/*.composite', { cwd: workingDirectory });
22
+ if (watchFiles.length > 0)
23
+ components.logger.debug(`[composite] .composite: ${watchFiles.join(', ')}`);
24
+ const scripts = new Map();
25
+ const textDecoder = new TextDecoder();
26
+ for (const file of watchFiles) {
27
+ try {
28
+ const fileBuffer = await components.fs.readFile(path_1.default.join(workingDirectory, file));
29
+ if (fileBuffer.length > COMPOSITE_FILE_MAX_BYTES) {
30
+ throw new Error(`Composite file '${file}' is ${fileBuffer.length} bytes (cap ${COMPOSITE_FILE_MAX_BYTES}); refusing to parse.`);
31
+ }
32
+ const json = JSON.parse(textDecoder.decode(fileBuffer));
33
+ composites[file] = dist_cjs_1.Composite.fromJson(json);
34
+ }
35
+ catch (err) {
36
+ (0, beautiful_logs_1.printError)(components.logger, `Composite '${file}' can't be read. Please check if is a valid JSON and composite formated.`, err);
37
+ withErrors = true;
38
+ }
39
+ }
40
+ const compositeProvider = {
41
+ getCompositeOrNull(src) {
42
+ if (src in composites) {
43
+ return { src, composite: composites[src] };
44
+ }
45
+ return null;
46
+ }
47
+ };
48
+ const compositeLines = [];
49
+ const engine = (0, dist_cjs_1.Engine)();
50
+ for (const compositeSource in composites) {
51
+ try {
52
+ const composite = compositeProvider.getCompositeOrNull(compositeSource);
53
+ dist_cjs_1.Composite.instance(engine, composite, compositeProvider, {
54
+ entityMapping: {
55
+ type: dist_cjs_1.EntityMappingMode.EMM_DIRECT_MAPPING,
56
+ getCompositeEntity: (compositeEntity) => compositeEntity
57
+ }
58
+ });
59
+ const ScriptComponent = engine.getComponentOrNull(inspector_1.EditorComponentNames.Script);
60
+ if (ScriptComponent) {
61
+ for (const [entity, { value }] of engine.getEntitiesWith(ScriptComponent)) {
62
+ for (const script of value) {
63
+ const scriptInstances = scripts.get(script.path) || [];
64
+ scriptInstances.push({ ...script, entity });
65
+ scripts.set(script.path, scriptInstances);
66
+ }
67
+ }
68
+ }
69
+ // Only inline `main.composite` into `~sdk/all-composites`. Secondary
70
+ // composites stay on disk and are fetched at runtime via the provider's
71
+ // `loadComposite` (see packages/@dcl/sdk/src/composite-provider.ts).
72
+ if (compositeSource === 'main.composite') {
73
+ compositeLines.push(`'${composite.src}':${JSON.stringify(dist_cjs_1.Composite.toJson(composite.composite))}`);
74
+ }
75
+ }
76
+ catch (err) {
77
+ (0, beautiful_logs_1.printError)(components.logger, `Composite '${compositeSource}' can't be instanced.`, err);
78
+ withErrors = true;
79
+ }
80
+ }
81
+ // Compute composite's highest entity number
82
+ let maxCompositeEntity = 0;
83
+ for (const composite of Object.values(composites)) {
84
+ for (const component of composite.components) {
85
+ for (const entityId of component.data.keys()) {
86
+ const entityNumber = (entityId & 0xffff) >>> 0;
87
+ if (entityNumber > maxCompositeEntity) {
88
+ maxCompositeEntity = entityNumber;
89
+ }
90
+ }
91
+ }
92
+ }
93
+ // generate CRDT binary
94
+ const crdtFilePath = path_1.default.join(workingDirectory, 'main.crdt');
95
+ const crdtData = (0, inspector_1.dumpEngineToCrdtCommands)(engine);
96
+ await components.fs.writeFile(crdtFilePath, crdtData);
97
+ return {
98
+ compositeLines,
99
+ watchFiles,
100
+ scripts,
101
+ withErrors,
102
+ maxCompositeEntity
103
+ };
104
+ }
105
+ //# sourceMappingURL=composite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite.js","sourceRoot":"","sources":["../../src/logic/composite.ts"],"names":[],"mappings":";;;;;AAuBA,4CAgHC;AAvID,2BAA6B;AAC7B,gDAAuB;AACvB,gDAM0B;AAC1B,8CAAsG;AAGtG,qDAA6C;AAS7C,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,+GAA+G;AAE1J,KAAK,UAAU,gBAAgB,CACpC,UAA+B,EAC/B,gBAAwB;IAQxB,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,MAAM,UAAU,GAAyC,EAAE,CAAA;IAC3D,0EAA0E;IAC1E,0EAA0E;IAC1E,4EAA4E;IAC5E,4EAA4E;IAC5E,0CAA0C;IAC1C,MAAM,UAAU,GAAG,IAAA,aAAQ,EAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,CAAA;IACxE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACxG,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAA;IAE3C,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;IACrC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,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,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC7C,MAAM,YAAY,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;gBAC9C,IAAI,YAAY,GAAG,kBAAkB,EAAE,CAAC;oBACtC,kBAAkB,GAAG,YAAY,CAAA;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,uBAAuB;IACvB,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA;IAC7D,MAAM,QAAQ,GAAG,IAAA,oCAAwB,EAAC,MAAa,CAAC,CAAA;IACxD,MAAM,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;IAErD,OAAO;QACL,cAAc;QACd,UAAU;QACV,OAAO;QACP,UAAU;QACV,kBAAkB;KACnB,CAAA;AACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { CliComponents } from '../components';
2
+ /**
3
+ * Returns the version of the sdk-commands that is running
4
+ */
5
+ export declare function getSdkCommandsVersion(): Promise<any>;
6
+ /**
7
+ * Returns the installed version of a certain package that lives inside another package in the current working directory.
8
+ * Returns undefined if the package is not installed.
9
+ */
10
+ export declare function getInstalledPackageVersionInsidePackage(components: Pick<CliComponents, 'fs'>, packageName: string, packageRootName: string, workingDirectory: string): Promise<string>;
11
+ /**
12
+ * Returns the installed version of a certain package in the current working directory.
13
+ * Returns "unknown" if the package is not installed.
14
+ */
15
+ export declare function getInstalledPackageVersion(components: Pick<CliComponents, 'fs'>, packageName: string, workingDirectory: string): Promise<string>;
16
+ /**
17
+ * Returns true if the Decentraland Editor is running.
18
+ */
19
+ export declare function isEditor(): boolean;
20
+ export declare function isCI(): boolean;
21
+ export declare function getCatalystBaseUrl(components: Pick<CliComponents, 'config'>): Promise<string>;
22
+ export declare function getSegmentKey(): "sFdziRVDJo0taOnGzTZwafEL9nLIANZ3" | "mjCV5Dc4VAKXLJAH5g7LyHyW1jrIR3to";
23
+ export declare function getLandRegistry(components: Pick<CliComponents, 'config'>): Promise<string | undefined>;
24
+ export declare function getEstateRegistry(components: Pick<CliComponents, 'config'>): Promise<string | undefined>;
@@ -0,0 +1,88 @@
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.getSdkCommandsVersion = getSdkCommandsVersion;
7
+ exports.getInstalledPackageVersionInsidePackage = getInstalledPackageVersionInsidePackage;
8
+ exports.getInstalledPackageVersion = getInstalledPackageVersion;
9
+ exports.isEditor = isEditor;
10
+ exports.isCI = isCI;
11
+ exports.getCatalystBaseUrl = getCatalystBaseUrl;
12
+ exports.getSegmentKey = getSegmentKey;
13
+ exports.getLandRegistry = getLandRegistry;
14
+ exports.getEstateRegistry = getEstateRegistry;
15
+ const path_1 = __importDefault(require("path"));
16
+ const config_1 = require("../components/config");
17
+ const fs_1 = require("./fs");
18
+ const project_files_1 = require("./project-files");
19
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
20
+ const { version: sdkCommandsVersion } = require('../../package.json');
21
+ /**
22
+ * Returns the version of the sdk-commands that is running
23
+ */
24
+ async function getSdkCommandsVersion() {
25
+ return sdkCommandsVersion;
26
+ }
27
+ /**
28
+ * Returns the installed version of a certain package that lives inside another package in the current working directory.
29
+ * Returns undefined if the package is not installed.
30
+ */
31
+ async function getInstalledPackageVersionInsidePackage(components, packageName, packageRootName, workingDirectory) {
32
+ try {
33
+ const packagePath = path_1.default.dirname(require.resolve(`${packageRootName}/package.json`, {
34
+ paths: [workingDirectory]
35
+ }));
36
+ const packageJson = await (0, project_files_1.getPackageJson)(components, packagePath);
37
+ const version = (packageJson.dependencies && packageJson.dependencies[packageName]) ||
38
+ (packageJson.devDependencies && packageJson.devDependencies[packageName]);
39
+ return version ?? undefined;
40
+ }
41
+ catch (e) {
42
+ return 'unknown';
43
+ }
44
+ }
45
+ /**
46
+ * Returns the installed version of a certain package in the current working directory.
47
+ * Returns "unknown" if the package is not installed.
48
+ */
49
+ async function getInstalledPackageVersion(components, packageName, workingDirectory) {
50
+ try {
51
+ const packagePath = path_1.default.dirname(require.resolve(`${packageName}/package.json`, {
52
+ paths: [workingDirectory]
53
+ }));
54
+ const packageJson = await (0, fs_1.readJson)(components, path_1.default.resolve(packagePath, 'package.json'));
55
+ return packageJson.version ?? /* istanbul ignore next */ 'unknown';
56
+ }
57
+ catch (e) {
58
+ return 'unknown';
59
+ }
60
+ }
61
+ /**
62
+ * Returns true if the Decentraland Editor is running.
63
+ */
64
+ function isEditor() {
65
+ return process.env.EDITOR_SDK7 === 'true';
66
+ }
67
+ function isCI() {
68
+ return process.env.CI === 'true' || process.argv.includes('--ci') || process.argv.includes('--c');
69
+ }
70
+ async function getCatalystBaseUrl(components) {
71
+ const url = (await (0, config_1.readStringConfig)(components, 'DCL_CATALYST')) ?? 'https://peer.decentraland.org';
72
+ return url.replace(/\/$/, '');
73
+ }
74
+ function getSegmentKey() {
75
+ const isProduction = !process.env.DEVELOPER_MODE;
76
+ return isProduction
77
+ ? /* istanbul ignore next */ 'sFdziRVDJo0taOnGzTZwafEL9nLIANZ3'
78
+ : 'mjCV5Dc4VAKXLJAH5g7LyHyW1jrIR3to';
79
+ }
80
+ /* istanbul ignore next */
81
+ async function getLandRegistry(components) {
82
+ return (0, config_1.readStringConfig)(components, 'DCL_LAND_REGISTRY_ADDRESS');
83
+ }
84
+ /* istanbul ignore next */
85
+ async function getEstateRegistry(components) {
86
+ return (0, config_1.readStringConfig)(components, 'DCL_ESTATE_REGISTRY_ADDRESS');
87
+ }
88
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/logic/config.ts"],"names":[],"mappings":";;;;;AAYA,sDAEC;AAMD,0FAsBC;AAKD,gEAiBC;AAKD,4BAEC;AAED,oBAEC;AA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0,0 +1,14 @@
1
+ import { Coords } from '@dcl/ecs/dist-cjs';
2
+ /**
3
+ * Parses a string-based set of coordinates.
4
+ * - All spaces are removed
5
+ * - Leading zeroes are removed
6
+ * - `-0` is converted to `0`
7
+ * @param coordinates An string containing coordinates in the `x,y; x,y; ...` format
8
+ */
9
+ export declare function parse(coordinates: string): string[];
10
+ /**
11
+ * Converts a string-based set of coordinates to an object
12
+ * @param coords A string containing a set of coordinates
13
+ */
14
+ export declare function getObject(coords: string): Coords;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parse = parse;
4
+ exports.getObject = getObject;
5
+ /**
6
+ * Parses a string-based set of coordinates.
7
+ * - All spaces are removed
8
+ * - Leading zeroes are removed
9
+ * - `-0` is converted to `0`
10
+ * @param coordinates An string containing coordinates in the `x,y; x,y; ...` format
11
+ */
12
+ function parse(coordinates) {
13
+ return coordinates.split(';').map((coord) => {
14
+ const [x, y] = coord.split(',').map(($) => {
15
+ return parseInt($, 10)
16
+ .toString() // removes spaces :)
17
+ .replace('-0', '0')
18
+ .replace(/undefined|NaN/g, '0');
19
+ });
20
+ return `${x},${y}`;
21
+ });
22
+ }
23
+ /**
24
+ * Converts a string-based set of coordinates to an object
25
+ * @param coords A string containing a set of coordinates
26
+ */
27
+ function getObject(coords) {
28
+ const [x, y] = parse(coords)[0].split(',');
29
+ return { x: parseInt(x.toString(), 10), y: parseInt(y.toString(), 10) };
30
+ }
31
+ //# sourceMappingURL=coordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinates.js","sourceRoot":"","sources":["../../src/logic/coordinates.ts"],"names":[],"mappings":";;AASA,sBAUC;AAMD,8BAGC;AA1BD;;;;;;GAMG;AACH,SAAgB,KAAK,CAAC,WAAmB;IACvC,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE;QAClD,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACxC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;iBACnB,QAAQ,EAAE,CAAC,oBAAoB;iBAC/B,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;iBAClB,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;QACF,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1C,OAAO,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,CAAA;AACzE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { CliComponents } from '../components';
2
+ export declare const defaultDclIgnore: string[];
3
+ export declare function getDCLIgnoreFileContents(components: Pick<CliComponents, 'fs'>, dir: string): Promise<string | null>;
4
+ /**
5
+ * Returns the default .dclignore entries plus the ones provided by the user.
6
+ * In case of .dclignore not existing, it returns a pre-defined list.
7
+ */
8
+ export declare function getDCLIgnorePatterns(components: Pick<CliComponents, 'fs'>, dir: string): Promise<string[]>;
@@ -0,0 +1,53 @@
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.defaultDclIgnore = void 0;
7
+ exports.getDCLIgnoreFileContents = getDCLIgnoreFileContents;
8
+ exports.getDCLIgnorePatterns = getDCLIgnorePatterns;
9
+ const path_1 = __importDefault(require("path"));
10
+ exports.defaultDclIgnore = [
11
+ '.*',
12
+ 'package.json',
13
+ 'package-lock.json',
14
+ 'yarn-lock.json',
15
+ 'build.json',
16
+ 'export',
17
+ 'tsconfig.json',
18
+ 'tslint.json',
19
+ 'node_modules',
20
+ 'dclcontext',
21
+ '**/*.ts',
22
+ '**/*.tsx',
23
+ 'Dockerfile',
24
+ 'thumbnails',
25
+ 'dist',
26
+ 'README.md',
27
+ '*.blend',
28
+ '*.fbx',
29
+ '*.zip',
30
+ '*.rar',
31
+ '*.map'
32
+ ];
33
+ async function getDCLIgnoreFileContents(components, dir) {
34
+ try {
35
+ return await components.fs.readFile(path_1.default.resolve(dir, '.dclignore'), 'utf8');
36
+ // ^^^^^ never remove that await.
37
+ }
38
+ catch (e) { }
39
+ return null;
40
+ }
41
+ /**
42
+ * Returns the default .dclignore entries plus the ones provided by the user.
43
+ * In case of .dclignore not existing, it returns a pre-defined list.
44
+ */
45
+ async function getDCLIgnorePatterns(components, dir) {
46
+ const ignoredContent = await getDCLIgnoreFileContents(components, dir);
47
+ const ignored = (ignoredContent?.split('\n') || exports.defaultDclIgnore).filter(Boolean);
48
+ ignored.push(...exports.defaultDclIgnore);
49
+ // by default many files need to be ignored
50
+ ignored.push('.*', 'node_modules', '**/*.ts', '**/*.tsx', 'node_modules/**', '*.md');
51
+ return Array.from(new Set(ignored));
52
+ }
53
+ //# sourceMappingURL=dcl-ignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dcl-ignore.js","sourceRoot":"","sources":["../../src/logic/dcl-ignore.ts"],"names":[],"mappings":";;;;;;AA2BA,4DAUC;AAMD,oDASC;AApDD,gDAAuB;AAGV,QAAA,gBAAgB,GAAG;IAC9B,IAAI;IACJ,cAAc;IACd,mBAAmB;IACnB,gBAAgB;IAChB,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,aAAa;IACb,cAAc;IACd,YAAY;IACZ,SAAS;IACT,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,MAAM;IACN,WAAW;IACX,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;CACR,CAAA;AAEM,KAAK,UAAU,wBAAwB,CAC5C,UAAqC,EACrC,GAAW;IAEX,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAA;QAC5E,qCAAqC;IACvC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAEd,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CAAC,UAAqC,EAAE,GAAW;IAC3F,MAAM,cAAc,GAAG,MAAM,wBAAwB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;IACtE,MAAM,OAAO,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,wBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjF,OAAO,CAAC,IAAI,CAAC,GAAG,wBAAgB,CAAC,CAAA;IAEjC,2CAA2C;IAC3C,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAA;IAEpF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function debounce<T extends (...args: any[]) => void>(callback: T, delay: number): (...args: Parameters<T>) => void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debounce = debounce;
4
+ function debounce(callback, delay) {
5
+ let debounceTimer;
6
+ return (...args) => {
7
+ clearTimeout(debounceTimer);
8
+ debounceTimer = setTimeout(() => callback(...args), delay);
9
+ };
10
+ }
11
+ //# sourceMappingURL=debounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/logic/debounce.ts"],"names":[],"mappings":";;AAAA,4BAMC;AAND,SAAgB,QAAQ,CAAqC,QAAW,EAAE,KAAa;IACrF,IAAI,aAA6B,CAAA;IACjC,OAAO,CAAC,GAAG,IAAmB,EAAE,EAAE;QAChC,YAAY,CAAC,aAAa,CAAC,CAAA;QAC3B,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,CAAC,CAAA;IAC5D,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type CliErrorName = 'COMMAND_NOT_VALID' | 'COMMAND_NOT_FOUND' | 'DEPLOY_WORKSPACE_NOT_SUPPORTED' | 'DEPLOY_INVALID_PROJECT_TYPE' | 'DEPLOY_INVALID_ARGUMENTS' | 'DEPLOY_UPLOAD_FAILED' | 'DEPLOY_CANCELLED' | 'DEPLOY_CANCELLED_AFTER_UNDEPLOY' | 'DEPLOY_CANCEL_OUTCOME_UNCERTAIN' | 'DEPLOY_DELETE_FAILED' | 'DEPLOY_NO_PERMISSION' | 'DEPLOY_MISSING_TARGET_CONTENT' | 'DEPLOY_PARTIAL_NOT_SUPPORTED' | 'DEPLOY_CONTENT_CHECK_FAILED' | 'EXPORT_STATIC_BASE_URL_REQUIRED' | 'EXPORT_STATIC_INVALID_REALM_NAME' | 'EXPORT_STATIC_INVALID_OUTPUT_DIRECTORY' | 'INIT_DIR_NOT_EMPTY' | 'INIT_INVALID_ARGUMENTS' | 'INIT_INVALID_PROJECT' | 'INIT_INVALID_TEMPLATE_ZIP_URL' | 'QUESTS_INVALID_TARGET' | 'QUESTS_INVALID_JSON' | 'QUESTS_INVALID_QUEST_JSON' | 'QUESTS_FILE_DOES_NOT_EXIST' | 'QUESTS_CREATION_CANCELLED' | 'QUESTS_INVALID_ADDRESS' | 'QUESTS_INVALID_UUID' | 'CONFIG_NOT_PROVIDED' | 'GET_CONTEXT_FILES_LIST_FAILED' | 'GET_CONTEXT_FILES_DOWNLOAD_FAILED' | 'ACCOUNT_INVALID_PRIVATE_KEY' | 'ARGS_ARG_ERROR' | 'COMMANDS_INVALID_FOLDER' | 'COMMANDS_INVALID_INDEX_FILE' | 'PROJECT_FILES_DUPLICATE_FILE' | 'PROJECT_FILES_INVALID_PACKAGE_JSON' | 'PROJECT_VALIDATIONS_PACKAGE_JSON_REQUIRED' | 'PROJECT_VALIDATIONS_INVALID_PROJECT_KIND' | 'BUNDLE_SCENE_MAIN_REQUIRED' | 'BUNDLE_SCENE_RUNTIME_VERSION_REQUIRED' | 'BUNDLE_TSCONFIG_REQUIRED' | 'BUNDLE_NO_INPUT_FILES' | 'BUNDLE_REBUILD_FAILED' | 'BUNDLE_TYPE_CHECKER_FAILED' | 'PORTABLE_EXPERIENCE_SW_INVALID_SCENE_JSON' | 'PORTABLE_EXPERIENCE_SW_INVALID_WEARABLE_JSON' | 'SCENE_VALIDATIONS_INVALID_SCENE_JSON' | 'SCENE_VALIDATIONS_DUPLICATE_PARCELS' | 'SCENE_VALIDATIONS_BASE_PARCEL_REQUIRED' | 'SCENE_VALIDATIONS_COORDINATES_OUTSIDE_LIMITS' | 'SCENE_VALIDATIONS_PARCELS_NOT_CONNECTED' | 'SCENE_VALIDATIONS_INVALID_MAIN_FORMAT' | 'SCENE_VALIDATIONS_MAX_FILE_SIZE_EXCEEDED' | 'WORKSPACE_VALIDATIONS_INVALID_WORKSPACE_JSON' | 'WORKSPACE_VALIDATIONS_INVALID_WORKSPACE_JSON_READ' | 'CODE_TO_COMPOSITE_BUILD_FAILED' | 'CODE_TO_COMPOSITE_BUNDLE_NOT_FOUND' | 'CODE_TO_COMPOSITE_EXECUTION_FAILED';
2
+ export declare class CliError<T extends CliErrorName> extends Error {
3
+ name: T;
4
+ message: string;
5
+ stack?: string | undefined;
6
+ constructor(name?: T, message?: string, stack?: string | undefined);
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliError = void 0;
4
+ class CliError extends Error {
5
+ constructor(name = 'CliError', message = '', stack) {
6
+ super();
7
+ this.name = name;
8
+ this.message = message;
9
+ this.stack = stack;
10
+ }
11
+ }
12
+ exports.CliError = CliError;
13
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/logic/error.ts"],"names":[],"mappings":";;;AA0EA,MAAa,QAAiC,SAAQ,KAAK;IACzD,YAAmB,OAAU,UAAe,EAAS,UAAkB,EAAE,EAAS,KAAc;QAC9F,KAAK,EAAE,CAAA;QADU,SAAI,GAAJ,IAAI,CAAqB;QAAS,YAAO,GAAP,OAAO,CAAa;QAAS,UAAK,GAAL,KAAK,CAAS;IAEhG,CAAC;CACF;AAJD,4BAIC"}
@@ -0,0 +1,12 @@
1
+ import type { spawn } from 'child_process';
2
+ interface Options {
3
+ env: {
4
+ [key: string]: string;
5
+ };
6
+ silent: boolean;
7
+ }
8
+ export type IProcessSpawnerComponent = {
9
+ exec(cwd: string, command: string, args: string[], options?: Partial<Options>): Promise<void>;
10
+ };
11
+ export declare function createProcessSpawnerComponent(spawnFn: typeof spawn): IProcessSpawnerComponent;
12
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProcessSpawnerComponent = createProcessSpawnerComponent;
4
+ function createProcessSpawnerComponent(spawnFn) {
5
+ return {
6
+ exec(cwd, command, args, { env, silent } = {}) {
7
+ return new Promise((resolve, reject) => {
8
+ const child = spawnFn(command, args, {
9
+ shell: true,
10
+ cwd,
11
+ env: { ...process.env, NODE_ENV: '', ...env }
12
+ });
13
+ if (!silent) {
14
+ child.stdout.pipe(process.stdout);
15
+ child.stderr.pipe(process.stderr);
16
+ }
17
+ const cleanup = () => {
18
+ if (!child.killed)
19
+ child.kill('SIGTERM');
20
+ };
21
+ process.on('SIGTERM', cleanup);
22
+ process.on('SIGINT', cleanup);
23
+ process.on('exit', cleanup);
24
+ child.on('close', (code) => {
25
+ process.off('SIGTERM', cleanup);
26
+ process.off('SIGINT', cleanup);
27
+ process.off('exit', cleanup);
28
+ // Don't reject if we killed the child during shutdown
29
+ if (code !== 0 && !child.killed) {
30
+ const _ = `${command} ${args.join(' ')}`;
31
+ reject(new Error(`Command "${_}" exited with code ${code}. Please try running the command manually`));
32
+ return;
33
+ }
34
+ resolve(undefined);
35
+ });
36
+ });
37
+ }
38
+ };
39
+ }
40
+ //# sourceMappingURL=exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/logic/exec.ts"],"names":[],"mappings":";;AAWA,sEAwCC;AAxCD,SAAgB,6BAA6B,CAAC,OAAqB;IACjE,OAAO;QACL,IAAI,CAAC,GAAW,EAAE,OAAe,EAAE,IAAc,EAAE,EAAE,GAAG,EAAE,MAAM,KAAuB,EAAE;YACvF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACrC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE;oBACnC,KAAK,EAAE,IAAI;oBACX,GAAG;oBACH,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,GAAG,EAAE;iBAC9C,CAAC,CAAA;gBAEF,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;oBACjC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;gBACnC,CAAC;gBAED,MAAM,OAAO,GAAG,GAAG,EAAE;oBACnB,IAAI,CAAC,KAAK,CAAC,MAAM;wBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;gBAC1C,CAAC,CAAA;gBAED,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;gBAC9B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;gBAC7B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAE3B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE;oBACjC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;oBAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;oBAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;oBAE5B,sDAAsD;oBACtD,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;wBAChC,MAAM,CAAC,GAAG,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;wBACxC,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,sBAAsB,IAAI,2CAA2C,CAAC,CAAC,CAAA;wBACrG,OAAM;oBACR,CAAC;oBAED,OAAO,CAAC,SAAS,CAAC,CAAA;gBACpB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Discards an unread fetch Response body.
3
+ *
4
+ * Native fetch (undici) — used here via the global `fetch`, `undici.fetch`, and the
5
+ * fetch component — keeps the keep-alive socket pinned until the body is consumed or
6
+ * cancelled. Any path that discards a response without reading it (a non-ok early
7
+ * return/throw, or a success branch that only checks the status) must drain it first,
8
+ * or the socket leaks until garbage collection.
9
+ *
10
+ * Typed structurally so it accepts both the global `Response` and `undici.Response`.
11
+ */
12
+ export declare function drainResponse(response: {
13
+ bodyUsed: boolean;
14
+ body?: {
15
+ cancel(): Promise<void>;
16
+ } | null;
17
+ }): Promise<void>;
18
+ /**
19
+ * Runs `operation` with a signal aborted after `timeoutMs` or when `signal` aborts, and rejects as soon as it
20
+ * aborts even if the operation doesn't follow it (e.g. a response body that stalls after the headers arrived).
21
+ */
22
+ export declare function withDeadline<T>(operation: (signal: AbortSignal) => Promise<T>, options: {
23
+ timeoutMs?: number;
24
+ signal?: AbortSignal;
25
+ }): Promise<T>;