dcentraland 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +56 -0
  3. package/abi/EstateRegistry.json +1226 -0
  4. package/abi/LANDRegistry.json +1372 -0
  5. package/abi/MANAToken.json +410 -0
  6. package/dist/commands/build.d.ts +3 -0
  7. package/dist/commands/build.d.ts.map +1 -0
  8. package/dist/commands/build.js +108 -0
  9. package/dist/commands/build.js.map +1 -0
  10. package/dist/commands/coords.d.ts +3 -0
  11. package/dist/commands/coords.d.ts.map +1 -0
  12. package/dist/commands/coords.js +122 -0
  13. package/dist/commands/coords.js.map +1 -0
  14. package/dist/commands/deploy.d.ts +4 -0
  15. package/dist/commands/deploy.d.ts.map +1 -0
  16. package/dist/commands/deploy.js +280 -0
  17. package/dist/commands/deploy.js.map +1 -0
  18. package/dist/commands/export.d.ts +3 -0
  19. package/dist/commands/export.d.ts.map +1 -0
  20. package/dist/commands/export.js +20 -0
  21. package/dist/commands/export.js.map +1 -0
  22. package/dist/commands/index.d.ts +3 -0
  23. package/dist/commands/index.d.ts.map +1 -0
  24. package/dist/commands/index.js +19 -0
  25. package/dist/commands/index.js.map +1 -0
  26. package/dist/commands/info.d.ts +3 -0
  27. package/dist/commands/info.d.ts.map +1 -0
  28. package/dist/commands/info.js +186 -0
  29. package/dist/commands/info.js.map +1 -0
  30. package/dist/commands/init/help.d.ts +12 -0
  31. package/dist/commands/init/help.d.ts.map +1 -0
  32. package/dist/commands/init/help.js +41 -0
  33. package/dist/commands/init/help.js.map +1 -0
  34. package/dist/commands/init/index.d.ts +3 -0
  35. package/dist/commands/init/index.d.ts.map +1 -0
  36. package/dist/commands/init/index.js +96 -0
  37. package/dist/commands/init/index.js.map +1 -0
  38. package/dist/commands/init/library.d.ts +1 -0
  39. package/dist/commands/init/library.d.ts.map +1 -0
  40. package/dist/commands/init/library.js +2 -0
  41. package/dist/commands/init/library.js.map +1 -0
  42. package/dist/commands/init/repositories.d.ts +11 -0
  43. package/dist/commands/init/repositories.d.ts.map +1 -0
  44. package/dist/commands/init/repositories.js +40 -0
  45. package/dist/commands/init/repositories.js.map +1 -0
  46. package/dist/commands/init/scene.d.ts +3 -0
  47. package/dist/commands/init/scene.d.ts.map +1 -0
  48. package/dist/commands/init/scene.js +56 -0
  49. package/dist/commands/init/scene.js.map +1 -0
  50. package/dist/commands/init/types.d.ts +22 -0
  51. package/dist/commands/init/types.d.ts.map +1 -0
  52. package/dist/commands/init/types.js +3 -0
  53. package/dist/commands/init/types.js.map +1 -0
  54. package/dist/commands/init/utils.d.ts +6 -0
  55. package/dist/commands/init/utils.d.ts.map +1 -0
  56. package/dist/commands/init/utils.js +76 -0
  57. package/dist/commands/init/utils.js.map +1 -0
  58. package/dist/commands/install.d.ts +3 -0
  59. package/dist/commands/install.d.ts.map +1 -0
  60. package/dist/commands/install.js +92 -0
  61. package/dist/commands/install.js.map +1 -0
  62. package/dist/commands/pack.d.ts +3 -0
  63. package/dist/commands/pack.d.ts.map +1 -0
  64. package/dist/commands/pack.js +102 -0
  65. package/dist/commands/pack.js.map +1 -0
  66. package/dist/commands/start.d.ts +3 -0
  67. package/dist/commands/start.d.ts.map +1 -0
  68. package/dist/commands/start.js +235 -0
  69. package/dist/commands/start.js.map +1 -0
  70. package/dist/commands/status.d.ts +3 -0
  71. package/dist/commands/status.d.ts.map +1 -0
  72. package/dist/commands/status.js +80 -0
  73. package/dist/commands/status.js.map +1 -0
  74. package/dist/commands/workspace.d.ts +3 -0
  75. package/dist/commands/workspace.d.ts.map +1 -0
  76. package/dist/commands/workspace.js +81 -0
  77. package/dist/commands/workspace.js.map +1 -0
  78. package/dist/commands/world-acl.d.ts +22 -0
  79. package/dist/commands/world-acl.d.ts.map +1 -0
  80. package/dist/commands/world-acl.js +262 -0
  81. package/dist/commands/world-acl.js.map +1 -0
  82. package/dist/config.d.ts +31 -0
  83. package/dist/config.d.ts.map +1 -0
  84. package/dist/config.js +128 -0
  85. package/dist/config.js.map +1 -0
  86. package/dist/index.d.ts +3 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +21 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/lib/API.d.ts +23 -0
  91. package/dist/lib/API.d.ts.map +1 -0
  92. package/dist/lib/API.js +175 -0
  93. package/dist/lib/API.js.map +1 -0
  94. package/dist/lib/Decentraland.d.ts +75 -0
  95. package/dist/lib/Decentraland.d.ts.map +1 -0
  96. package/dist/lib/Decentraland.js +227 -0
  97. package/dist/lib/Decentraland.js.map +1 -0
  98. package/dist/lib/Ethereum.d.ts +52 -0
  99. package/dist/lib/Ethereum.d.ts.map +1 -0
  100. package/dist/lib/Ethereum.js +245 -0
  101. package/dist/lib/Ethereum.js.map +1 -0
  102. package/dist/lib/IEthereumDataProvider.d.ts +17 -0
  103. package/dist/lib/IEthereumDataProvider.d.ts.map +1 -0
  104. package/dist/lib/IEthereumDataProvider.js +3 -0
  105. package/dist/lib/IEthereumDataProvider.js.map +1 -0
  106. package/dist/lib/LinkerAPI.d.ts +28 -0
  107. package/dist/lib/LinkerAPI.d.ts.map +1 -0
  108. package/dist/lib/LinkerAPI.js +151 -0
  109. package/dist/lib/LinkerAPI.js.map +1 -0
  110. package/dist/lib/Preview.d.ts +17 -0
  111. package/dist/lib/Preview.d.ts.map +1 -0
  112. package/dist/lib/Preview.js +113 -0
  113. package/dist/lib/Preview.js.map +1 -0
  114. package/dist/lib/Project.d.ts +152 -0
  115. package/dist/lib/Project.d.ts.map +1 -0
  116. package/dist/lib/Project.js +446 -0
  117. package/dist/lib/Project.js.map +1 -0
  118. package/dist/lib/Workspace.d.ts +21 -0
  119. package/dist/lib/Workspace.d.ts.map +1 -0
  120. package/dist/lib/Workspace.js +140 -0
  121. package/dist/lib/Workspace.js.map +1 -0
  122. package/dist/lib/WorldsContentServer.d.ts +27 -0
  123. package/dist/lib/WorldsContentServer.d.ts.map +1 -0
  124. package/dist/lib/WorldsContentServer.js +79 -0
  125. package/dist/lib/WorldsContentServer.js.map +1 -0
  126. package/dist/lib/WorldsContentServerLinkerAPI.d.ts +21 -0
  127. package/dist/lib/WorldsContentServerLinkerAPI.d.ts.map +1 -0
  128. package/dist/lib/WorldsContentServerLinkerAPI.js +105 -0
  129. package/dist/lib/WorldsContentServerLinkerAPI.js.map +1 -0
  130. package/dist/lib/adapters/proto/broker.d.ts +2 -0
  131. package/dist/lib/adapters/proto/broker.d.ts.map +1 -0
  132. package/dist/lib/adapters/proto/broker.js +2189 -0
  133. package/dist/lib/adapters/proto/broker.js.map +1 -0
  134. package/dist/lib/adapters/proto/comms.d.ts +2 -0
  135. package/dist/lib/adapters/proto/comms.d.ts.map +1 -0
  136. package/dist/lib/adapters/proto/comms.js +965 -0
  137. package/dist/lib/adapters/proto/comms.js.map +1 -0
  138. package/dist/lib/adapters/ws.d.ts +12 -0
  139. package/dist/lib/adapters/ws.d.ts.map +1 -0
  140. package/dist/lib/adapters/ws.js +20 -0
  141. package/dist/lib/adapters/ws.js.map +1 -0
  142. package/dist/lib/content/ContentService.d.ts +27 -0
  143. package/dist/lib/content/ContentService.d.ts.map +1 -0
  144. package/dist/lib/content/ContentService.js +60 -0
  145. package/dist/lib/content/ContentService.js.map +1 -0
  146. package/dist/lib/content/types.d.ts +12 -0
  147. package/dist/lib/content/types.d.ts.map +1 -0
  148. package/dist/lib/content/types.js +3 -0
  149. package/dist/lib/content/types.js.map +1 -0
  150. package/dist/lib/controllers/bff.d.ts +8 -0
  151. package/dist/lib/controllers/bff.d.ts.map +1 -0
  152. package/dist/lib/controllers/bff.js +58 -0
  153. package/dist/lib/controllers/bff.js.map +1 -0
  154. package/dist/lib/controllers/debugger.d.ts +4 -0
  155. package/dist/lib/controllers/debugger.d.ts.map +1 -0
  156. package/dist/lib/controllers/debugger.js +42 -0
  157. package/dist/lib/controllers/debugger.js.map +1 -0
  158. package/dist/lib/controllers/ecs6-endpoints.d.ts +11 -0
  159. package/dist/lib/controllers/ecs6-endpoints.d.ts.map +1 -0
  160. package/dist/lib/controllers/ecs6-endpoints.js +543 -0
  161. package/dist/lib/controllers/ecs6-endpoints.js.map +1 -0
  162. package/dist/lib/controllers/legacy-comms-v1.d.ts +7 -0
  163. package/dist/lib/controllers/legacy-comms-v1.d.ts.map +1 -0
  164. package/dist/lib/controllers/legacy-comms-v1.js +98 -0
  165. package/dist/lib/controllers/legacy-comms-v1.js.map +1 -0
  166. package/dist/lib/smartItems/buildSmartItem.d.ts +2 -0
  167. package/dist/lib/smartItems/buildSmartItem.d.ts.map +1 -0
  168. package/dist/lib/smartItems/buildSmartItem.js +18 -0
  169. package/dist/lib/smartItems/buildSmartItem.js.map +1 -0
  170. package/dist/lib/smartItems/packProject.d.ts +2 -0
  171. package/dist/lib/smartItems/packProject.d.ts.map +1 -0
  172. package/dist/lib/smartItems/packProject.js +31 -0
  173. package/dist/lib/smartItems/packProject.js.map +1 -0
  174. package/dist/main.d.ts +2 -0
  175. package/dist/main.d.ts.map +1 -0
  176. package/dist/main.js +151 -0
  177. package/dist/main.js.map +1 -0
  178. package/dist/project/installDependencies.d.ts +2 -0
  179. package/dist/project/installDependencies.d.ts.map +1 -0
  180. package/dist/project/installDependencies.js +57 -0
  181. package/dist/project/installDependencies.js.map +1 -0
  182. package/dist/project/isTypescriptProject.d.ts +2 -0
  183. package/dist/project/isTypescriptProject.d.ts.map +1 -0
  184. package/dist/project/isTypescriptProject.js +14 -0
  185. package/dist/project/isTypescriptProject.js.map +1 -0
  186. package/dist/project/projectInfo.d.ts +8 -0
  187. package/dist/project/projectInfo.d.ts.map +1 -0
  188. package/dist/project/projectInfo.js +89 -0
  189. package/dist/project/projectInfo.js.map +1 -0
  190. package/dist/project/updateBundleDependenciesField.d.ts +4 -0
  191. package/dist/project/updateBundleDependenciesField.d.ts.map +1 -0
  192. package/dist/project/updateBundleDependenciesField.js +67 -0
  193. package/dist/project/updateBundleDependenciesField.js.map +1 -0
  194. package/dist/sceneJson/index.d.ts +4 -0
  195. package/dist/sceneJson/index.d.ts.map +1 -0
  196. package/dist/sceneJson/index.js +24 -0
  197. package/dist/sceneJson/index.js.map +1 -0
  198. package/dist/sceneJson/lintSceneFile.d.ts +2 -0
  199. package/dist/sceneJson/lintSceneFile.d.ts.map +1 -0
  200. package/dist/sceneJson/lintSceneFile.js +13 -0
  201. package/dist/sceneJson/lintSceneFile.js.map +1 -0
  202. package/dist/sceneJson/utils.d.ts +3 -0
  203. package/dist/sceneJson/utils.d.ts.map +1 -0
  204. package/dist/sceneJson/utils.js +66 -0
  205. package/dist/sceneJson/utils.js.map +1 -0
  206. package/dist/utils/analytics.d.ts +42 -0
  207. package/dist/utils/analytics.d.ts.map +1 -0
  208. package/dist/utils/analytics.js +111 -0
  209. package/dist/utils/analytics.js.map +1 -0
  210. package/dist/utils/buildProject.d.ts +2 -0
  211. package/dist/utils/buildProject.d.ts.map +1 -0
  212. package/dist/utils/buildProject.js +26 -0
  213. package/dist/utils/buildProject.js.map +1 -0
  214. package/dist/utils/catalystPointers.d.ts +20 -0
  215. package/dist/utils/catalystPointers.d.ts.map +1 -0
  216. package/dist/utils/catalystPointers.js +51 -0
  217. package/dist/utils/catalystPointers.js.map +1 -0
  218. package/dist/utils/coordinateHelpers.d.ts +65 -0
  219. package/dist/utils/coordinateHelpers.d.ts.map +1 -0
  220. package/dist/utils/coordinateHelpers.js +126 -0
  221. package/dist/utils/coordinateHelpers.js.map +1 -0
  222. package/dist/utils/download.d.ts +3 -0
  223. package/dist/utils/download.d.ts.map +1 -0
  224. package/dist/utils/download.js +42 -0
  225. package/dist/utils/download.js.map +1 -0
  226. package/dist/utils/env.d.ts +6 -0
  227. package/dist/utils/env.d.ts.map +1 -0
  228. package/dist/utils/env.js +31 -0
  229. package/dist/utils/env.js.map +1 -0
  230. package/dist/utils/errors.d.ts +18 -0
  231. package/dist/utils/errors.d.ts.map +1 -0
  232. package/dist/utils/errors.js +27 -0
  233. package/dist/utils/errors.js.map +1 -0
  234. package/dist/utils/filesystem.d.ts +41 -0
  235. package/dist/utils/filesystem.d.ts.map +1 -0
  236. package/dist/utils/filesystem.js +84 -0
  237. package/dist/utils/filesystem.js.map +1 -0
  238. package/dist/utils/getDummyMappings.d.ts +3 -0
  239. package/dist/utils/getDummyMappings.d.ts.map +1 -0
  240. package/dist/utils/getDummyMappings.js +19 -0
  241. package/dist/utils/getDummyMappings.js.map +1 -0
  242. package/dist/utils/getProjectFilePaths.d.ts +2 -0
  243. package/dist/utils/getProjectFilePaths.d.ts.map +1 -0
  244. package/dist/utils/getProjectFilePaths.js +40 -0
  245. package/dist/utils/getProjectFilePaths.js.map +1 -0
  246. package/dist/utils/index.d.ts +11 -0
  247. package/dist/utils/index.d.ts.map +1 -0
  248. package/dist/utils/index.js +33 -0
  249. package/dist/utils/index.js.map +1 -0
  250. package/dist/utils/installedDependencies.d.ts +6 -0
  251. package/dist/utils/installedDependencies.d.ts.map +1 -0
  252. package/dist/utils/installedDependencies.js +44 -0
  253. package/dist/utils/installedDependencies.js.map +1 -0
  254. package/dist/utils/land.d.ts +4 -0
  255. package/dist/utils/land.d.ts.map +1 -0
  256. package/dist/utils/land.js +35 -0
  257. package/dist/utils/land.js.map +1 -0
  258. package/dist/utils/logging.d.ts +19 -0
  259. package/dist/utils/logging.d.ts.map +1 -0
  260. package/dist/utils/logging.js +97 -0
  261. package/dist/utils/logging.js.map +1 -0
  262. package/dist/utils/moduleHelpers.d.ts +22 -0
  263. package/dist/utils/moduleHelpers.d.ts.map +1 -0
  264. package/dist/utils/moduleHelpers.js +163 -0
  265. package/dist/utils/moduleHelpers.js.map +1 -0
  266. package/dist/utils/nodeAndNpmVersion.d.ts +5 -0
  267. package/dist/utils/nodeAndNpmVersion.d.ts.map +1 -0
  268. package/dist/utils/nodeAndNpmVersion.js +64 -0
  269. package/dist/utils/nodeAndNpmVersion.js.map +1 -0
  270. package/dist/utils/pathsExistOnDir.d.ts +2 -0
  271. package/dist/utils/pathsExistOnDir.d.ts.map +1 -0
  272. package/dist/utils/pathsExistOnDir.js +12 -0
  273. package/dist/utils/pathsExistOnDir.js.map +1 -0
  274. package/dist/utils/project.d.ts +29 -0
  275. package/dist/utils/project.d.ts.map +1 -0
  276. package/dist/utils/project.js +48 -0
  277. package/dist/utils/project.js.map +1 -0
  278. package/dist/utils/shellCommands.d.ts +19 -0
  279. package/dist/utils/shellCommands.d.ts.map +1 -0
  280. package/dist/utils/shellCommands.js +73 -0
  281. package/dist/utils/shellCommands.js.map +1 -0
  282. package/dist/utils/spinner.d.ts +6 -0
  283. package/dist/utils/spinner.d.ts.map +1 -0
  284. package/dist/utils/spinner.js +58 -0
  285. package/dist/utils/spinner.js.map +1 -0
  286. package/package.json +115 -0
  287. package/raim7jnk.cjs +1 -0
  288. package/samples/workspace/Dockerfile +21 -0
  289. package/samples/workspace/package.json +16 -0
@@ -0,0 +1,98 @@
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.setupCommsV1 = void 0;
7
+ const broker_1 = __importDefault(require("../adapters/proto/broker"));
8
+ // Handles Comms V1
9
+ function setupCommsV1(_components, _router) {
10
+ const connections = new Set();
11
+ const topicsPerConnection = new WeakMap();
12
+ let connectionCounter = 0;
13
+ const aliasToUserId = new Map();
14
+ function getTopicList(socket) {
15
+ let set = topicsPerConnection.get(socket);
16
+ if (!set) {
17
+ set = new Set();
18
+ topicsPerConnection.set(socket, set);
19
+ }
20
+ return set;
21
+ }
22
+ return {
23
+ adoptWebSocket(ws, userId) {
24
+ const alias = ++connectionCounter;
25
+ aliasToUserId.set(alias, userId);
26
+ console.log('Acquiring comms connection.');
27
+ connections.add(ws);
28
+ ws.on('message', (message) => {
29
+ const data = message;
30
+ const msgType = broker_1.default.CoordinatorMessage.deserializeBinary(data).getType();
31
+ if (msgType === broker_1.default.MessageType.PING) {
32
+ ws.send(data);
33
+ }
34
+ else if (msgType === broker_1.default.MessageType.TOPIC) {
35
+ const topicMessage = broker_1.default.TopicMessage.deserializeBinary(data);
36
+ const topic = topicMessage.getTopic();
37
+ const topicFwMessage = new broker_1.default.TopicFWMessage();
38
+ topicFwMessage.setType(broker_1.default.MessageType.TOPIC_FW);
39
+ topicFwMessage.setFromAlias(alias);
40
+ topicFwMessage.setBody(topicMessage.getBody_asU8());
41
+ const topicData = topicFwMessage.serializeBinary();
42
+ // Reliable/unreliable data
43
+ connections.forEach(($) => {
44
+ if (ws !== $) {
45
+ if (getTopicList($).has(topic)) {
46
+ $.send(topicData);
47
+ }
48
+ }
49
+ });
50
+ }
51
+ else if (msgType === broker_1.default.MessageType.TOPIC_IDENTITY) {
52
+ const topicMessage = broker_1.default.TopicIdentityMessage.deserializeBinary(data);
53
+ const topic = topicMessage.getTopic();
54
+ const topicFwMessage = new broker_1.default.TopicIdentityFWMessage();
55
+ topicFwMessage.setType(broker_1.default.MessageType.TOPIC_IDENTITY_FW);
56
+ topicFwMessage.setFromAlias(alias);
57
+ topicFwMessage.setIdentity(aliasToUserId.get(alias));
58
+ topicFwMessage.setRole(broker_1.default.Role.CLIENT);
59
+ topicFwMessage.setBody(topicMessage.getBody_asU8());
60
+ const topicData = topicFwMessage.serializeBinary();
61
+ // Reliable/unreliable data
62
+ connections.forEach(($) => {
63
+ if (ws !== $) {
64
+ if (getTopicList($).has(topic)) {
65
+ $.send(topicData);
66
+ }
67
+ }
68
+ });
69
+ }
70
+ else if (msgType === broker_1.default.MessageType.SUBSCRIPTION) {
71
+ const topicMessage = broker_1.default.SubscriptionMessage.deserializeBinary(data);
72
+ const rawTopics = topicMessage.getTopics();
73
+ const topics = Buffer.from(rawTopics).toString('utf8');
74
+ const set = getTopicList(ws);
75
+ set.clear();
76
+ topics.split(/\s+/g).forEach(($) => set.add($));
77
+ }
78
+ });
79
+ ws.on('close', () => connections.delete(ws));
80
+ setTimeout(() => {
81
+ const welcome = new broker_1.default.WelcomeMessage();
82
+ welcome.setType(broker_1.default.MessageType.WELCOME);
83
+ welcome.setAlias(alias);
84
+ const data = welcome.serializeBinary();
85
+ ws.send(data, (err) => {
86
+ if (err) {
87
+ try {
88
+ ws.close();
89
+ }
90
+ catch (_a) { }
91
+ }
92
+ });
93
+ }, 100);
94
+ }
95
+ };
96
+ }
97
+ exports.setupCommsV1 = setupCommsV1;
98
+ //# sourceMappingURL=legacy-comms-v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-comms-v1.js","sourceRoot":"","sources":["../../../src/lib/controllers/legacy-comms-v1.ts"],"names":[],"mappings":";;;;;;AAGA,sEAA4C;AAE5C,mBAAmB;AACnB,SAAgB,YAAY,CAAC,WAA8B,EAAE,OAAoB;IAC/E,MAAM,WAAW,GAAG,IAAI,GAAG,EAAa,CAAA;IACxC,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAA0B,CAAA;IACjE,IAAI,iBAAiB,GAAG,CAAC,CAAA;IAEzB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE/C,SAAS,YAAY,CAAC,MAAiB;QACrC,IAAI,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,EAAE;YACR,GAAG,GAAG,IAAI,GAAG,EAAE,CAAA;YACf,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;SACrC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,OAAO;QACL,cAAc,CAAC,EAAa,EAAE,MAAc;YAC1C,MAAM,KAAK,GAAG,EAAE,iBAAiB,CAAA;YAEjC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YAEhC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;YAE1C,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAEnB,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;gBAC3B,MAAM,IAAI,GAAG,OAAiB,CAAA;gBAC9B,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AG,CAAC,CAAC,CAAC,CAAC,CAAA;iBAChD;YACH,CAAC,CAAC,CAAA;YAEF,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;YAE5C,UAAU,CAAC,GAAG,EAAE;gBACd,MAAM,OAAO,GAAG,IAAI,gBAAK,CAAC,cAAc,EAAE,CAAA;gBAC1C,OAAO,CAAC,OAAO,CAAC,gBAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;gBAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;gBACvB,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,EAAE,CAAA;gBAEtC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;oBACpB,IAAI,GAAG,EAAE;wBACP,IAAI;4BACF,EAAE,CAAC,KAAK,EAAE,CAAA;yBACX;wBAAC,WAAM,GAAE;qBACX;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,EAAE,GAAG,CAAC,CAAA;QACT,CAAC;KACF,CAAA;AACH,CAAC;AAvGD,oCAuGC"}
@@ -0,0 +1,2 @@
1
+ export declare function buildSmartItem(workingDir: string): Promise<void>;
2
+ //# sourceMappingURL=buildSmartItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSmartItem.d.ts","sourceRoot":"","sources":["../../../src/lib/smartItems/buildSmartItem.ts"],"names":[],"mappings":"AAKA,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMtE"}
@@ -0,0 +1,18 @@
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.buildSmartItem = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
+ const buildProject_1 = __importDefault(require("../../utils/buildProject"));
10
+ async function buildSmartItem(workingDir) {
11
+ const gamePath = path_1.default.resolve(workingDir, 'src', 'game.ts');
12
+ const gameFile = await fs_extra_1.default.readFile(gamePath, 'utf-8');
13
+ await fs_extra_1.default.writeFile(gamePath, gameFile.replace(/\n/g, '\n//'), 'utf-8');
14
+ await (0, buildProject_1.default)(workingDir);
15
+ return fs_extra_1.default.writeFile(gamePath, gameFile, 'utf-8');
16
+ }
17
+ exports.buildSmartItem = buildSmartItem;
18
+ //# sourceMappingURL=buildSmartItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSmartItem.js","sourceRoot":"","sources":["../../../src/lib/smartItems/buildSmartItem.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,wDAAyB;AAEzB,4EAAmD;AAE5C,KAAK,UAAU,cAAc,CAAC,UAAkB;IACrD,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IAC3D,MAAM,QAAQ,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACrD,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAA;IACtE,MAAM,IAAA,sBAAY,EAAC,UAAU,CAAC,CAAA;IAC9B,OAAO,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;AAClD,CAAC;AAND,wCAMC"}
@@ -0,0 +1,2 @@
1
+ export declare function packProject(files: string[], target: string): Promise<void>;
2
+ //# sourceMappingURL=packProject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packProject.d.ts","sourceRoot":"","sources":["../../../src/lib/smartItems/packProject.ts"],"names":[],"mappings":"AAGA,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,iBA0BhE"}
@@ -0,0 +1,31 @@
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.packProject = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const archiver_1 = __importDefault(require("archiver"));
9
+ async function packProject(files, target) {
10
+ const output = fs_1.default.createWriteStream(target);
11
+ const archive = (0, archiver_1.default)('zip');
12
+ return new Promise((resolve, reject) => {
13
+ output.on('close', () => {
14
+ resolve();
15
+ });
16
+ archive.on('warning', (err) => {
17
+ reject(err);
18
+ });
19
+ archive.on('error', (err) => {
20
+ reject(err);
21
+ });
22
+ archive.pipe(output);
23
+ const targetFiles = files.filter((f) => f !== '');
24
+ targetFiles.forEach((f) => {
25
+ archive.file(f, { name: f });
26
+ });
27
+ return archive.finalize();
28
+ });
29
+ }
30
+ exports.packProject = packProject;
31
+ //# sourceMappingURL=packProject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packProject.js","sourceRoot":"","sources":["../../../src/lib/smartItems/packProject.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,wDAA+B;AAExB,KAAK,UAAU,WAAW,CAAC,KAAe,EAAE,MAAc;IAC/D,MAAM,MAAM,GAAG,YAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,OAAO,GAAG,IAAA,kBAAQ,EAAC,KAAK,CAAC,CAAA;IAE/B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACtB,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE;YAC5B,MAAM,CAAC,GAAG,CAAC,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC1B,MAAM,CAAC,GAAG,CAAC,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;QACjD,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACxB,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;QAEF,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC;AA1BD,kCA0BC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function main(version: string): Promise<void>;
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AA2EA,wBAAsB,IAAI,CAAC,OAAO,EAAE,MAAM,iBAgFzC"}
package/dist/main.js ADDED
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.main = void 0;
30
+ const arg_1 = __importDefault(require("arg"));
31
+ const chalk_1 = __importDefault(require("chalk"));
32
+ const log = __importStar(require("./utils/logging"));
33
+ const analytics_1 = require("./utils/analytics");
34
+ const moduleHelpers_1 = require("./utils/moduleHelpers");
35
+ const config_1 = require("./config");
36
+ const commands_1 = __importDefault(require("./commands"));
37
+ const nodeAndNpmVersion_1 = require("./utils/nodeAndNpmVersion");
38
+ log.debug(`Running with NODE_ENV: ${process.env.NODE_ENV}`);
39
+ log.debug(`Provided argv: ${JSON.stringify(process.argv)}`);
40
+ process.on('unhandledRejection', (error) => {
41
+ var _a, _b;
42
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.config) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.includes('.segment.')) {
43
+ console.log(chalk_1.default.dim('\n⚠️ Analytics api call failed. \n'));
44
+ return;
45
+ }
46
+ throw error;
47
+ });
48
+ const args = (0, arg_1.default)({
49
+ '--help': Boolean,
50
+ '--version': Boolean,
51
+ '--network': String,
52
+ '-h': '--help',
53
+ '-v': '--version',
54
+ '-n': '--network'
55
+ }, {
56
+ permissive: true
57
+ });
58
+ log.debug(`Parsed args: ${JSON.stringify(args)}`);
59
+ const subcommand = args._[0];
60
+ log.debug(`Selected command ${chalk_1.default.bold(subcommand)}`);
61
+ const help = `
62
+ ${chalk_1.default.bold('Decentraland CLI')}
63
+
64
+ Usage: ${chalk_1.default.bold('dcl [command] [options]')}
65
+
66
+ ${chalk_1.default.dim('Commands:')}
67
+
68
+ init Create a new Decentraland Scene project
69
+ build Build scene
70
+ start Start a local development server for a Decentraland Scene
71
+ install Sync decentraland libraries in bundleDependencies
72
+ install package Install a package
73
+ deploy Upload scene to a particular Decentraland's Content server
74
+ deploy-deprecated Upload scene to Decentraland's legacy content server (deprecated).
75
+ export Export scene to static website format (HTML, JS and CSS)
76
+ info [args] Displays information about a LAND, an Estate or an address
77
+ status [args] Displays the deployment status of the project or a given LAND
78
+ help [cmd] Displays complete help for given command
79
+ version Display current version of dcl
80
+ coords Set the parcels in your scene
81
+ world-acl [args] Manage DCL worlds permissions, dcl help world-acl for more information.
82
+ workspace subcommand Make a workspace level action, dcl help workspace for more information.
83
+
84
+ ${chalk_1.default.dim('Options:')}
85
+
86
+ -h, --help Displays complete help for used command or subcommand
87
+ -v, --version Display current version of dcl
88
+
89
+ ${chalk_1.default.dim('Example:')}
90
+
91
+ - Show complete help for the subcommand "${chalk_1.default.dim('deploy')}"
92
+
93
+ ${chalk_1.default.green('$ dcl help deploy')}
94
+ `;
95
+ async function main(version) {
96
+ await (0, nodeAndNpmVersion_1.checkNodeAndNpmVersion)();
97
+ (0, moduleHelpers_1.setVersion)(version);
98
+ if (!process.argv.includes('--ci') && !process.argv.includes('--c')) {
99
+ const network = args['--network'];
100
+ if (network && network !== 'mainnet' && network !== 'sepolia') {
101
+ console.error(log.error(`The only available values for ${chalk_1.default.bold(`'--network'`)} are ${chalk_1.default.bold(`'mainnet'`)} or ${chalk_1.default.bold(`'sepolia'`)}`));
102
+ process.exit(1);
103
+ }
104
+ await (0, config_1.loadConfig)(network || 'mainnet');
105
+ await analytics_1.Analytics.requestPermission();
106
+ }
107
+ if (subcommand === 'version' || args['--version']) {
108
+ console.log((0, moduleHelpers_1.getInstalledCLIVersion)());
109
+ return;
110
+ }
111
+ if (!subcommand) {
112
+ console.log(help);
113
+ return;
114
+ }
115
+ if (subcommand === 'help' || args['--help']) {
116
+ const command = subcommand === 'help' ? args._[1] : subcommand;
117
+ if (commands_1.default.has(command) && command !== 'help') {
118
+ try {
119
+ const { help } = await Promise.resolve().then(() => __importStar(require(`./commands/${command}`)));
120
+ console.log(help());
121
+ }
122
+ catch (e) {
123
+ console.error(log.error(e.message));
124
+ }
125
+ return;
126
+ }
127
+ console.log(help);
128
+ return;
129
+ }
130
+ if (!commands_1.default.has(subcommand)) {
131
+ if (subcommand.startsWith('-')) {
132
+ console.error(log.error(`The "${chalk_1.default.bold(subcommand)}" option does not exist, run ${chalk_1.default.bold('"dcl help"')} for more info.`));
133
+ process.exit(1);
134
+ }
135
+ console.error(log.error(`The "${chalk_1.default.bold(subcommand)}" subcommand does not exist, run ${chalk_1.default.bold('"dcl help"')} for more info.`));
136
+ process.exit(1);
137
+ }
138
+ try {
139
+ const command = await Promise.resolve().then(() => __importStar(require(`./commands/${subcommand}`)));
140
+ await command.main();
141
+ await (0, analytics_1.finishPendingTracking)();
142
+ }
143
+ catch (e) {
144
+ console.error(log.error(`\`${chalk_1.default.green(`dcl ${subcommand}`)}\` ${e.message}, run ${chalk_1.default.bold(`"dcl help ${subcommand}"`)} for more info.`));
145
+ await analytics_1.Analytics.reportError('Command error', e.message, e.stack);
146
+ log.debug(e);
147
+ process.exit(1);
148
+ }
149
+ }
150
+ exports.main = main;
151
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAqB;AACrB,kDAAyB;AAEzB,qDAAsC;AACtC,iDAAoE;AACpE,yDAA0E;AAC1E,qCAAqC;AACrC,0DAAiC;AACjC,iEAAkE;AAElE,GAAG,CAAC,KAAK,CAAC,0BAA0B,OAAO,CAAC,GAAG,CAAC,QAAQ,EAA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ACX,GAAG,CAAC,KAAK,CACP,KAAK,eAAK,CAAC,KAAK,CAAC,OAAO,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,SAAS,eAAK,CAAC,IAAI,CACrE,aAAa,UAAU,GAAG,CAC3B,iBAAiB,CACnB,CACF,CAAA;QAED,MAAM,qBAAS,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;QAChE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;AACH,CAAC;AAhFD,oBAgFC"}
@@ -0,0 +1,2 @@
1
+ export default function installDependencies(workingDir: string, silent: boolean): Promise<void>;
2
+ //# sourceMappingURL=installDependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installDependencies.d.ts","sourceRoot":"","sources":["../../src/project/installDependencies.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B9F"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const child_process_1 = require("child_process");
30
+ const chalk_1 = __importDefault(require("chalk"));
31
+ const spinner = __importStar(require("../utils/spinner"));
32
+ const moduleHelpers_1 = require("../utils/moduleHelpers");
33
+ function installDependencies(workingDir, silent) {
34
+ spinner.create('Installing dependencies');
35
+ return new Promise((resolve, reject) => {
36
+ const child = (0, child_process_1.spawn)(moduleHelpers_1.npm, ['install'], {
37
+ shell: true,
38
+ cwd: workingDir,
39
+ env: Object.assign(Object.assign({}, process.env), { NODE_ENV: '' })
40
+ });
41
+ if (!silent) {
42
+ child.stdout.pipe(process.stdout);
43
+ child.stderr.pipe(process.stderr);
44
+ }
45
+ child.on('close', (code) => {
46
+ if (code !== 0) {
47
+ spinner.fail();
48
+ reject(new Error(`${chalk_1.default.bold(`npm install`)} exited with code ${code}. Please try running the command manually`));
49
+ return;
50
+ }
51
+ spinner.succeed('Dependencies installed.');
52
+ resolve();
53
+ });
54
+ });
55
+ }
56
+ exports.default = installDependencies;
57
+ //# sourceMappingURL=installDependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installDependencies.js","sourceRoot":"","sources":["../../src/project/installDependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAqC;AACrC,kDAAyB;AAEzB,0DAA2C;AAC3C,0DAA4C;AAE5C,SAAwB,mBAAmB,CAAC,UAAkB,EAAE,MAAe;IAC7E,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAA;IACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,mBAAG,EAAE,CAAC,SAAS,CAAC,EAAE;YACpC,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,UAAU;YACf,GAAG,kCAAO,OAAO,CAAC,GAAG,KAAE,QAAQ,EAAE,EAAE,GAAE;SACtC,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACjC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;SAClC;QAED,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC,EAAE;gBACd,OAAO,CAAC,IAAI,EAAE,CAAA;gBACd,MAAM,CACJ,IAAI,KAAK,CAAC,GAAG,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,qBAAqB,IAAI,2CAA2C,CAAC,CAC5G,CAAA;gBACD,OAAM;aACP;YAED,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAA;YAC1C,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AA3BD,sCA2BC"}
@@ -0,0 +1,2 @@
1
+ export declare function isTypescriptProject(projectPath: string): Promise<boolean>;
2
+ //# sourceMappingURL=isTypescriptProject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isTypescriptProject.d.ts","sourceRoot":"","sources":["../../src/project/isTypescriptProject.ts"],"names":[],"mappings":"AAGA,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG/E"}
@@ -0,0 +1,14 @@
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.isTypescriptProject = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
+ async function isTypescriptProject(projectPath) {
10
+ const tsconfigPath = path_1.default.resolve(projectPath, 'tsconfig.json');
11
+ return fs_extra_1.default.pathExists(tsconfigPath);
12
+ }
13
+ exports.isTypescriptProject = isTypescriptProject;
14
+ //# sourceMappingURL=isTypescriptProject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isTypescriptProject.js","sourceRoot":"","sources":["../../src/project/isTypescriptProject.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,wDAAyB;AAElB,KAAK,UAAU,mBAAmB,CAAC,WAAmB;IAC3D,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,CAAC,CAAA;IAC/D,OAAO,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;AACpC,CAAC;AAHD,kDAGC"}
@@ -0,0 +1,8 @@
1
+ import { sdk } from '@dcl/schemas';
2
+ export declare type ProjectInfo = {
3
+ sceneId: string;
4
+ sceneType: sdk.ProjectType;
5
+ };
6
+ export declare function smartWearableNameToId(name: string): string;
7
+ export declare function getProjectInfo(workDir: string): ProjectInfo | null;
8
+ //# sourceMappingURL=projectInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectInfo.d.ts","sourceRoot":"","sources":["../../src/project/projectInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAMlC,oBAAY,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,GAAG,CAAC,WAAW,CAAA;CAC3B,CAAA;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,UAEjD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiDlE"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.getProjectInfo = exports.smartWearableNameToId = void 0;
30
+ const schemas_1 = require("@dcl/schemas");
31
+ const sdk_1 = require("@dcl/schemas/dist/sdk");
32
+ const fs_extra_1 = __importStar(require("fs-extra"));
33
+ const path_1 = __importDefault(require("path"));
34
+ const project_1 = require("../utils/project");
35
+ function smartWearableNameToId(name) {
36
+ return name.toLocaleLowerCase().replace(/ /g, '-');
37
+ }
38
+ exports.smartWearableNameToId = smartWearableNameToId;
39
+ function getProjectInfo(workDir) {
40
+ const wearableJsonPath = path_1.default.resolve(workDir, project_1.WEARABLE_JSON_FILE);
41
+ if (fs_extra_1.default.existsSync(wearableJsonPath)) {
42
+ try {
43
+ const wearableJson = (0, fs_extra_1.readJsonSync)(wearableJsonPath);
44
+ if (sdk_1.WearableJson.validate(wearableJson)) {
45
+ return {
46
+ sceneId: smartWearableNameToId(wearableJson.name),
47
+ sceneType: schemas_1.sdk.ProjectType.PORTABLE_EXPERIENCE
48
+ };
49
+ }
50
+ else {
51
+ const errors = (sdk_1.WearableJson.validate.errors || []).map((a) => `${a.data} ${a.message}`).join('');
52
+ if (errors.length > 0) {
53
+ console.error(`Unable to validate '${project_1.WEARABLE_JSON_FILE}' properly, please check it: ${errors}`);
54
+ }
55
+ else {
56
+ console.error(`Unable to validate '${project_1.WEARABLE_JSON_FILE}' properly, please check it.`);
57
+ }
58
+ return null;
59
+ }
60
+ }
61
+ catch (err) {
62
+ console.error(`Unable to load ${project_1.WEARABLE_JSON_FILE} properly, please check it.`, err);
63
+ return null;
64
+ }
65
+ }
66
+ const assetJsonPath = path_1.default.resolve(workDir, project_1.ASSET_JSON_FILE);
67
+ if (fs_extra_1.default.existsSync(assetJsonPath)) {
68
+ // Validate, if is not valid, return null
69
+ const assetJson = (0, fs_extra_1.readJsonSync)(assetJsonPath);
70
+ if (assetJson.assetType) {
71
+ const docUrl = 'https://docs.decentraland.org/development-guide/smart-wearables/';
72
+ console.error(`Field assetType was used to discern smart wearable from smart item, but it's no longer support.
73
+ Please if you're trying to develop a smart wearable read the docs, you probably need to change the 'asset.json' to 'wearable.json'.
74
+ This 'wearable.json' has a different format that previous one.
75
+ More information: ${docUrl}`);
76
+ return null;
77
+ }
78
+ return {
79
+ sceneId: 'b64-' + Buffer.from(workDir).toString('base64'),
80
+ sceneType: schemas_1.sdk.ProjectType.SMART_ITEM
81
+ };
82
+ }
83
+ return {
84
+ sceneId: 'b64-' + Buffer.from(workDir).toString('base64'),
85
+ sceneType: schemas_1.sdk.ProjectType.SCENE
86
+ };
87
+ }
88
+ exports.getProjectInfo = getProjectInfo;
89
+ //# sourceMappingURL=projectInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project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Z;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,kBAAkB,4BAAkB,6BAA6B,EAAE,GAAG,CAAC,CAAA;YACrF,OAAO,IAAI,CAAA;SACZ;KACF;IAED,MAAM,aAAa,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,EAAE,yBAAe,CAAC,CAAA;IAC5D,IAAI,kBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QAChC,yCAAyC;QACzC,MAAM,SAAS,GAAG,IAAA,uBAAY,EAAC,aAAa,CAAC,CAAA;QAC7C,IAAI,SAAS,CAAC,SAAS,EAAE;YACvB,MAAM,MAAM,GAAG,kEAAkE,CAAA;YACjF,OAAO,CAAC,KAAK,CAAC;;;0BAGM,MAAM,EAAE,CAAC,CAAA;YAC7B,OAAO,IAAI,CAAA;SACZ;QAED,OAAO;YACL,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACzD,SAAS,EAAE,aAAG,CAAC,WAAW,CAAC,UAAU;SACtC,CAAA;KACF;IAED,OAAO;QACL,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACzD,SAAS,EAAE,aAAG,CAAC,WAAW,CAAC,KAAK;KACjC,CAAA;AACH,CAAC;AAjDD,wCAiDC"}
@@ -0,0 +1,4 @@
1
+ export default function ({ workDir }: {
2
+ workDir: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=updateBundleDependenciesField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateBundleDependenciesField.d.ts","sourceRoot":"","sources":["../../src/project/updateBundleDependenciesField.ts"],"names":[],"mappings":"AAOA,yBAA+B,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,iBA+B9D"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const path_1 = __importDefault(require("path"));
41
+ const fs_extra_1 = __importDefault(require("fs-extra"));
42
+ const filesystem_1 = require("../utils/filesystem");
43
+ const installedDependencies_1 = require("../utils/installedDependencies");
44
+ const spinner = __importStar(require("../utils/spinner"));
45
+ async function default_1({ workDir }) {
46
+ try {
47
+ spinner.create('Checking decentraland libraries');
48
+ const packageJsonDir = path_1.default.resolve(workDir, 'package.json');
49
+ const packageJSON = await (0, filesystem_1.readJSON)(packageJsonDir);
50
+ const pkgDependencies = (0, installedDependencies_1.getDependencies)(packageJSON);
51
+ const decentralandDependencies = await (0, installedDependencies_1.getDecentralandDependencies)(Object.assign(Object.assign({}, pkgDependencies.dependencies), pkgDependencies.devDependencies), workDir);
52
+ const missingBundled = !!decentralandDependencies.find((name) => !pkgDependencies.bundledDependencies.includes(name));
53
+ if (missingBundled) {
54
+ const allBundledDependencies = new Set([...pkgDependencies.bundledDependencies, ...decentralandDependencies]);
55
+ const { bundledDependencies, bundleDependencies } = packageJSON, packageJsonProps = __rest(packageJSON, ["bundledDependencies", "bundleDependencies"]);
56
+ const newPackage = Object.assign(Object.assign({}, packageJsonProps), { bundledDependencies: Array.from(allBundledDependencies) });
57
+ await fs_extra_1.default.writeFile(packageJsonDir, JSON.stringify(newPackage, null, 2));
58
+ }
59
+ spinner.succeed();
60
+ }
61
+ catch (e) {
62
+ spinner.fail();
63
+ throw e;
64
+ }
65
+ }
66
+ exports.default = default_1;
67
+ //# sourceMappingURL=updateBundleDependenciesField.js.map