@theia/filesystem 1.67.0-next.13 → 1.67.0-next.56

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 (347) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -3
  3. package/src/browser/upload/file-upload-service-impl.ts +2 -2
  4. package/lib/browser/breadcrumbs/filepath-breadcrumb.d.ts +0 -16
  5. package/lib/browser/breadcrumbs/filepath-breadcrumb.d.ts.map +0 -1
  6. package/lib/browser/breadcrumbs/filepath-breadcrumb.js +0 -42
  7. package/lib/browser/breadcrumbs/filepath-breadcrumb.js.map +0 -1
  8. package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts +0 -13
  9. package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts.map +0 -1
  10. package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js +0 -67
  11. package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js.map +0 -1
  12. package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.d.ts +0 -28
  13. package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.d.ts.map +0 -1
  14. package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.js +0 -119
  15. package/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution.js.map +0 -1
  16. package/lib/browser/download/file-download-command-contribution.d.ts +0 -19
  17. package/lib/browser/download/file-download-command-contribution.d.ts.map +0 -1
  18. package/lib/browser/download/file-download-command-contribution.js +0 -76
  19. package/lib/browser/download/file-download-command-contribution.js.map +0 -1
  20. package/lib/browser/download/file-download-frontend-module.d.ts +0 -4
  21. package/lib/browser/download/file-download-frontend-module.d.ts.map +0 -1
  22. package/lib/browser/download/file-download-frontend-module.js +0 -27
  23. package/lib/browser/download/file-download-frontend-module.js.map +0 -1
  24. package/lib/browser/download/file-download-service.d.ts +0 -21
  25. package/lib/browser/download/file-download-service.d.ts.map +0 -1
  26. package/lib/browser/download/file-download-service.js +0 -169
  27. package/lib/browser/download/file-download-service.js.map +0 -1
  28. package/lib/browser/file-dialog/file-dialog-container.d.ts +0 -6
  29. package/lib/browser/file-dialog/file-dialog-container.d.ts.map +0 -1
  30. package/lib/browser/file-dialog/file-dialog-container.js +0 -61
  31. package/lib/browser/file-dialog/file-dialog-container.js.map +0 -1
  32. package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.d.ts +0 -16
  33. package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.d.ts.map +0 -1
  34. package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.js +0 -60
  35. package/lib/browser/file-dialog/file-dialog-hidden-files-renderer.js.map +0 -1
  36. package/lib/browser/file-dialog/file-dialog-model.d.ts +0 -26
  37. package/lib/browser/file-dialog/file-dialog-model.d.ts.map +0 -1
  38. package/lib/browser/file-dialog/file-dialog-model.js +0 -101
  39. package/lib/browser/file-dialog/file-dialog-model.js.map +0 -1
  40. package/lib/browser/file-dialog/file-dialog-module.d.ts +0 -4
  41. package/lib/browser/file-dialog/file-dialog-module.d.ts.map +0 -1
  42. package/lib/browser/file-dialog/file-dialog-module.js +0 -46
  43. package/lib/browser/file-dialog/file-dialog-module.js.map +0 -1
  44. package/lib/browser/file-dialog/file-dialog-service.d.ts +0 -33
  45. package/lib/browser/file-dialog/file-dialog-service.d.ts.map +0 -1
  46. package/lib/browser/file-dialog/file-dialog-service.js +0 -102
  47. package/lib/browser/file-dialog/file-dialog-service.js.map +0 -1
  48. package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.d.ts +0 -40
  49. package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.d.ts.map +0 -1
  50. package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.js +0 -82
  51. package/lib/browser/file-dialog/file-dialog-tree-filters-renderer.js.map +0 -1
  52. package/lib/browser/file-dialog/file-dialog-tree.d.ts +0 -27
  53. package/lib/browser/file-dialog/file-dialog-tree.d.ts.map +0 -1
  54. package/lib/browser/file-dialog/file-dialog-tree.js +0 -84
  55. package/lib/browser/file-dialog/file-dialog-tree.js.map +0 -1
  56. package/lib/browser/file-dialog/file-dialog-widget.d.ts +0 -18
  57. package/lib/browser/file-dialog/file-dialog-widget.d.ts.map +0 -1
  58. package/lib/browser/file-dialog/file-dialog-widget.js +0 -85
  59. package/lib/browser/file-dialog/file-dialog-widget.js.map +0 -1
  60. package/lib/browser/file-dialog/file-dialog.d.ts +0 -130
  61. package/lib/browser/file-dialog/file-dialog.d.ts.map +0 -1
  62. package/lib/browser/file-dialog/file-dialog.js +0 -352
  63. package/lib/browser/file-dialog/file-dialog.js.map +0 -1
  64. package/lib/browser/file-dialog/index.d.ts +0 -5
  65. package/lib/browser/file-dialog/index.d.ts.map +0 -1
  66. package/lib/browser/file-dialog/index.js +0 -23
  67. package/lib/browser/file-dialog/index.js.map +0 -1
  68. package/lib/browser/file-resource.d.ts +0 -72
  69. package/lib/browser/file-resource.d.ts.map +0 -1
  70. package/lib/browser/file-resource.js +0 -385
  71. package/lib/browser/file-resource.js.map +0 -1
  72. package/lib/browser/file-resource.spec.d.ts +0 -2
  73. package/lib/browser/file-resource.spec.d.ts.map +0 -1
  74. package/lib/browser/file-resource.spec.js +0 -191
  75. package/lib/browser/file-resource.spec.js.map +0 -1
  76. package/lib/browser/file-selection.d.ts +0 -15
  77. package/lib/browser/file-selection.d.ts.map +0 -1
  78. package/lib/browser/file-selection.js +0 -37
  79. package/lib/browser/file-selection.js.map +0 -1
  80. package/lib/browser/file-service.d.ts +0 -427
  81. package/lib/browser/file-service.d.ts.map +0 -1
  82. package/lib/browser/file-service.js +0 -1370
  83. package/lib/browser/file-service.js.map +0 -1
  84. package/lib/browser/file-tree/file-tree-container.d.ts +0 -4
  85. package/lib/browser/file-tree/file-tree-container.d.ts.map +0 -1
  86. package/lib/browser/file-tree/file-tree-container.js +0 -36
  87. package/lib/browser/file-tree/file-tree-container.js.map +0 -1
  88. package/lib/browser/file-tree/file-tree-decorator-adapter.d.ts +0 -31
  89. package/lib/browser/file-tree/file-tree-decorator-adapter.d.ts.map +0 -1
  90. package/lib/browser/file-tree/file-tree-decorator-adapter.js +0 -170
  91. package/lib/browser/file-tree/file-tree-decorator-adapter.js.map +0 -1
  92. package/lib/browser/file-tree/file-tree-label-provider.d.ts +0 -13
  93. package/lib/browser/file-tree/file-tree-label-provider.d.ts.map +0 -1
  94. package/lib/browser/file-tree/file-tree-label-provider.js +0 -55
  95. package/lib/browser/file-tree/file-tree-label-provider.js.map +0 -1
  96. package/lib/browser/file-tree/file-tree-model.d.ts +0 -34
  97. package/lib/browser/file-tree/file-tree-model.d.ts.map +0 -1
  98. package/lib/browser/file-tree/file-tree-model.js +0 -201
  99. package/lib/browser/file-tree/file-tree-model.js.map +0 -1
  100. package/lib/browser/file-tree/file-tree-widget.d.ts +0 -45
  101. package/lib/browser/file-tree/file-tree-widget.d.ts.map +0 -1
  102. package/lib/browser/file-tree/file-tree-widget.js +0 -318
  103. package/lib/browser/file-tree/file-tree-widget.js.map +0 -1
  104. package/lib/browser/file-tree/file-tree.d.ts +0 -47
  105. package/lib/browser/file-tree/file-tree.d.ts.map +0 -1
  106. package/lib/browser/file-tree/file-tree.js +0 -177
  107. package/lib/browser/file-tree/file-tree.js.map +0 -1
  108. package/lib/browser/file-tree/index.d.ts +0 -7
  109. package/lib/browser/file-tree/index.d.ts.map +0 -1
  110. package/lib/browser/file-tree/index.js +0 -25
  111. package/lib/browser/file-tree/index.js.map +0 -1
  112. package/lib/browser/filesystem-frontend-contribution.d.ts +0 -76
  113. package/lib/browser/filesystem-frontend-contribution.d.ts.map +0 -1
  114. package/lib/browser/filesystem-frontend-contribution.js +0 -372
  115. package/lib/browser/filesystem-frontend-contribution.js.map +0 -1
  116. package/lib/browser/filesystem-frontend-module.d.ts +0 -6
  117. package/lib/browser/filesystem-frontend-module.d.ts.map +0 -1
  118. package/lib/browser/filesystem-frontend-module.js +0 -70
  119. package/lib/browser/filesystem-frontend-module.js.map +0 -1
  120. package/lib/browser/filesystem-saveable-service.d.ts +0 -36
  121. package/lib/browser/filesystem-saveable-service.d.ts.map +0 -1
  122. package/lib/browser/filesystem-saveable-service.js +0 -164
  123. package/lib/browser/filesystem-saveable-service.js.map +0 -1
  124. package/lib/browser/filesystem-watcher-error-handler.d.ts +0 -11
  125. package/lib/browser/filesystem-watcher-error-handler.d.ts.map +0 -1
  126. package/lib/browser/filesystem-watcher-error-handler.js +0 -62
  127. package/lib/browser/filesystem-watcher-error-handler.js.map +0 -1
  128. package/lib/browser/index.d.ts +0 -5
  129. package/lib/browser/index.d.ts.map +0 -1
  130. package/lib/browser/index.js +0 -23
  131. package/lib/browser/index.js.map +0 -1
  132. package/lib/browser/location/index.d.ts +0 -3
  133. package/lib/browser/location/index.d.ts.map +0 -1
  134. package/lib/browser/location/index.js +0 -21
  135. package/lib/browser/location/index.js.map +0 -1
  136. package/lib/browser/location/location-renderer.d.ts +0 -101
  137. package/lib/browser/location/location-renderer.d.ts.map +0 -1
  138. package/lib/browser/location/location-renderer.js +0 -345
  139. package/lib/browser/location/location-renderer.js.map +0 -1
  140. package/lib/browser/location/location-service.d.ts +0 -6
  141. package/lib/browser/location/location-service.d.ts.map +0 -1
  142. package/lib/browser/location/location-service.js +0 -18
  143. package/lib/browser/location/location-service.js.map +0 -1
  144. package/lib/browser/remote-file-service-contribution.d.ts +0 -7
  145. package/lib/browser/remote-file-service-contribution.d.ts.map +0 -1
  146. package/lib/browser/remote-file-service-contribution.js +0 -40
  147. package/lib/browser/remote-file-service-contribution.js.map +0 -1
  148. package/lib/browser/upload/file-upload-service-impl.d.ts +0 -77
  149. package/lib/browser/upload/file-upload-service-impl.d.ts.map +0 -1
  150. package/lib/browser/upload/file-upload-service-impl.js +0 -449
  151. package/lib/browser/upload/file-upload-service-impl.js.map +0 -1
  152. package/lib/browser/vscode-file-service-contribution.d.ts +0 -25
  153. package/lib/browser/vscode-file-service-contribution.d.ts.map +0 -1
  154. package/lib/browser/vscode-file-service-contribution.js +0 -99
  155. package/lib/browser/vscode-file-service-contribution.js.map +0 -1
  156. package/lib/browser-only/browser-only-filesystem-frontend-module.d.ts +0 -4
  157. package/lib/browser-only/browser-only-filesystem-frontend-module.d.ts.map +0 -1
  158. package/lib/browser-only/browser-only-filesystem-frontend-module.js +0 -49
  159. package/lib/browser-only/browser-only-filesystem-frontend-module.js.map +0 -1
  160. package/lib/browser-only/browser-only-filesystem-provider-server.d.ts +0 -12
  161. package/lib/browser-only/browser-only-filesystem-provider-server.d.ts.map +0 -1
  162. package/lib/browser-only/browser-only-filesystem-provider-server.js +0 -40
  163. package/lib/browser-only/browser-only-filesystem-provider-server.js.map +0 -1
  164. package/lib/browser-only/download/file-download-command-contribution.d.ts +0 -15
  165. package/lib/browser-only/download/file-download-command-contribution.d.ts.map +0 -1
  166. package/lib/browser-only/download/file-download-command-contribution.js +0 -55
  167. package/lib/browser-only/download/file-download-command-contribution.js.map +0 -1
  168. package/lib/browser-only/download/file-download-frontend-module.d.ts +0 -4
  169. package/lib/browser-only/download/file-download-frontend-module.d.ts.map +0 -1
  170. package/lib/browser-only/download/file-download-frontend-module.js +0 -27
  171. package/lib/browser-only/download/file-download-frontend-module.js.map +0 -1
  172. package/lib/browser-only/download/file-download-service.d.ts +0 -86
  173. package/lib/browser-only/download/file-download-service.d.ts.map +0 -1
  174. package/lib/browser-only/download/file-download-service.js +0 -551
  175. package/lib/browser-only/download/file-download-service.js.map +0 -1
  176. package/lib/browser-only/file-search.d.ts +0 -38
  177. package/lib/browser-only/file-search.d.ts.map +0 -1
  178. package/lib/browser-only/file-search.js +0 -153
  179. package/lib/browser-only/file-search.js.map +0 -1
  180. package/lib/browser-only/opfs-filesystem-initialization.d.ts +0 -13
  181. package/lib/browser-only/opfs-filesystem-initialization.d.ts.map +0 -1
  182. package/lib/browser-only/opfs-filesystem-initialization.js +0 -36
  183. package/lib/browser-only/opfs-filesystem-initialization.js.map +0 -1
  184. package/lib/browser-only/opfs-filesystem-provider.d.ts +0 -108
  185. package/lib/browser-only/opfs-filesystem-provider.d.ts.map +0 -1
  186. package/lib/browser-only/opfs-filesystem-provider.js +0 -487
  187. package/lib/browser-only/opfs-filesystem-provider.js.map +0 -1
  188. package/lib/browser-only/upload/file-upload-service-impl.d.ts +0 -67
  189. package/lib/browser-only/upload/file-upload-service-impl.d.ts.map +0 -1
  190. package/lib/browser-only/upload/file-upload-service-impl.js +0 -328
  191. package/lib/browser-only/upload/file-upload-service-impl.js.map +0 -1
  192. package/lib/common/delegating-file-system-provider.d.ts +0 -77
  193. package/lib/common/delegating-file-system-provider.d.ts.map +0 -1
  194. package/lib/common/delegating-file-system-provider.js +0 -169
  195. package/lib/common/delegating-file-system-provider.js.map +0 -1
  196. package/lib/common/download/file-download.d.ts +0 -17
  197. package/lib/common/download/file-download.d.ts.map +0 -1
  198. package/lib/common/download/file-download.js +0 -28
  199. package/lib/common/download/file-download.js.map +0 -1
  200. package/lib/common/file-upload.d.ts +0 -2
  201. package/lib/common/file-upload.d.ts.map +0 -1
  202. package/lib/common/file-upload.js +0 -20
  203. package/lib/common/file-upload.js.map +0 -1
  204. package/lib/common/files.d.ts +0 -668
  205. package/lib/common/files.d.ts.map +0 -1
  206. package/lib/common/files.js +0 -390
  207. package/lib/common/files.js.map +0 -1
  208. package/lib/common/files.spec.d.ts +0 -2
  209. package/lib/common/files.spec.d.ts.map +0 -1
  210. package/lib/common/files.spec.js +0 -52
  211. package/lib/common/files.spec.js.map +0 -1
  212. package/lib/common/filesystem-preferences.d.ts +0 -33
  213. package/lib/common/filesystem-preferences.d.ts.map +0 -1
  214. package/lib/common/filesystem-preferences.js +0 -122
  215. package/lib/common/filesystem-preferences.js.map +0 -1
  216. package/lib/common/filesystem-utils.d.ts +0 -15
  217. package/lib/common/filesystem-utils.d.ts.map +0 -1
  218. package/lib/common/filesystem-utils.js +0 -64
  219. package/lib/common/filesystem-utils.js.map +0 -1
  220. package/lib/common/filesystem-utils.spec.d.ts +0 -2
  221. package/lib/common/filesystem-utils.spec.d.ts.map +0 -1
  222. package/lib/common/filesystem-utils.spec.js +0 -379
  223. package/lib/common/filesystem-utils.spec.js.map +0 -1
  224. package/lib/common/filesystem-watcher-protocol.d.ts +0 -72
  225. package/lib/common/filesystem-watcher-protocol.d.ts.map +0 -1
  226. package/lib/common/filesystem-watcher-protocol.js +0 -21
  227. package/lib/common/filesystem-watcher-protocol.js.map +0 -1
  228. package/lib/common/filesystem.d.ts +0 -23
  229. package/lib/common/filesystem.d.ts.map +0 -1
  230. package/lib/common/filesystem.js +0 -43
  231. package/lib/common/filesystem.js.map +0 -1
  232. package/lib/common/index.d.ts +0 -4
  233. package/lib/common/index.d.ts.map +0 -1
  234. package/lib/common/index.js +0 -22
  235. package/lib/common/index.js.map +0 -1
  236. package/lib/common/io.d.ts +0 -20
  237. package/lib/common/io.d.ts.map +0 -1
  238. package/lib/common/io.js +0 -117
  239. package/lib/common/io.js.map +0 -1
  240. package/lib/common/remote-file-system-provider.d.ts +0 -174
  241. package/lib/common/remote-file-system-provider.d.ts.map +0 -1
  242. package/lib/common/remote-file-system-provider.js +0 -435
  243. package/lib/common/remote-file-system-provider.js.map +0 -1
  244. package/lib/common/upload/file-upload.d.ts +0 -45
  245. package/lib/common/upload/file-upload.d.ts.map +0 -1
  246. package/lib/common/upload/file-upload.js +0 -20
  247. package/lib/common/upload/file-upload.js.map +0 -1
  248. package/lib/electron-browser/file-dialog/electron-file-dialog-module.d.ts +0 -4
  249. package/lib/electron-browser/file-dialog/electron-file-dialog-module.d.ts.map +0 -1
  250. package/lib/electron-browser/file-dialog/electron-file-dialog-module.js +0 -25
  251. package/lib/electron-browser/file-dialog/electron-file-dialog-module.js.map +0 -1
  252. package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts +0 -20
  253. package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts.map +0 -1
  254. package/lib/electron-browser/file-dialog/electron-file-dialog-service.js +0 -149
  255. package/lib/electron-browser/file-dialog/electron-file-dialog-service.js.map +0 -1
  256. package/lib/electron-browser/preload.d.ts +0 -2
  257. package/lib/electron-browser/preload.d.ts.map +0 -1
  258. package/lib/electron-browser/preload.js +0 -31
  259. package/lib/electron-browser/preload.js.map +0 -1
  260. package/lib/electron-common/electron-api.d.ts +0 -35
  261. package/lib/electron-common/electron-api.d.ts.map +0 -1
  262. package/lib/electron-common/electron-api.js +0 -21
  263. package/lib/electron-common/electron-api.js.map +0 -1
  264. package/lib/electron-main/electron-api-main.d.ts +0 -6
  265. package/lib/electron-main/electron-api-main.d.ts.map +0 -1
  266. package/lib/electron-main/electron-api-main.js +0 -74
  267. package/lib/electron-main/electron-api-main.js.map +0 -1
  268. package/lib/electron-main/electron-main-module.d.ts +0 -4
  269. package/lib/electron-main/electron-main-module.d.ts.map +0 -1
  270. package/lib/electron-main/electron-main-module.js +0 -25
  271. package/lib/electron-main/electron-main-module.js.map +0 -1
  272. package/lib/node/disk-file-system-provider.d.ts +0 -73
  273. package/lib/node/disk-file-system-provider.d.ts.map +0 -1
  274. package/lib/node/disk-file-system-provider.js +0 -786
  275. package/lib/node/disk-file-system-provider.js.map +0 -1
  276. package/lib/node/disk-file-system-provider.spec.d.ts +0 -2
  277. package/lib/node/disk-file-system-provider.spec.d.ts.map +0 -1
  278. package/lib/node/disk-file-system-provider.spec.js +0 -123
  279. package/lib/node/disk-file-system-provider.spec.js.map +0 -1
  280. package/lib/node/download/directory-archiver.d.ts +0 -10
  281. package/lib/node/download/directory-archiver.d.ts.map +0 -1
  282. package/lib/node/download/directory-archiver.js +0 -128
  283. package/lib/node/download/directory-archiver.js.map +0 -1
  284. package/lib/node/download/directory-archiver.spec.d.ts +0 -2
  285. package/lib/node/download/directory-archiver.spec.d.ts.map +0 -1
  286. package/lib/node/download/directory-archiver.spec.js +0 -98
  287. package/lib/node/download/directory-archiver.spec.js.map +0 -1
  288. package/lib/node/download/file-download-backend-module.d.ts +0 -4
  289. package/lib/node/download/file-download-backend-module.d.ts.map +0 -1
  290. package/lib/node/download/file-download-backend-module.js +0 -33
  291. package/lib/node/download/file-download-backend-module.js.map +0 -1
  292. package/lib/node/download/file-download-cache.d.ts +0 -22
  293. package/lib/node/download/file-download-cache.d.ts.map +0 -1
  294. package/lib/node/download/file-download-cache.js +0 -81
  295. package/lib/node/download/file-download-cache.js.map +0 -1
  296. package/lib/node/download/file-download-endpoint.d.ts +0 -12
  297. package/lib/node/download/file-download-endpoint.d.ts.map +0 -1
  298. package/lib/node/download/file-download-endpoint.js +0 -68
  299. package/lib/node/download/file-download-endpoint.js.map +0 -1
  300. package/lib/node/download/file-download-handler.d.ts +0 -51
  301. package/lib/node/download/file-download-handler.d.ts.map +0 -1
  302. package/lib/node/download/file-download-handler.js +0 -307
  303. package/lib/node/download/file-download-handler.js.map +0 -1
  304. package/lib/node/download/test/mock-directory-archiver.d.ts +0 -8
  305. package/lib/node/download/test/mock-directory-archiver.d.ts.map +0 -1
  306. package/lib/node/download/test/mock-directory-archiver.js +0 -30
  307. package/lib/node/download/test/mock-directory-archiver.js.map +0 -1
  308. package/lib/node/file-change-collection.d.ts +0 -23
  309. package/lib/node/file-change-collection.d.ts.map +0 -1
  310. package/lib/node/file-change-collection.js +0 -78
  311. package/lib/node/file-change-collection.js.map +0 -1
  312. package/lib/node/file-change-collection.spec.d.ts +0 -2
  313. package/lib/node/file-change-collection.spec.d.ts.map +0 -1
  314. package/lib/node/file-change-collection.spec.js +0 -91
  315. package/lib/node/file-change-collection.spec.js.map +0 -1
  316. package/lib/node/filesystem-backend-module.d.ts +0 -27
  317. package/lib/node/filesystem-backend-module.d.ts.map +0 -1
  318. package/lib/node/filesystem-backend-module.js +0 -123
  319. package/lib/node/filesystem-backend-module.js.map +0 -1
  320. package/lib/node/filesystem-watcher-client.d.ts +0 -23
  321. package/lib/node/filesystem-watcher-client.d.ts.map +0 -1
  322. package/lib/node/filesystem-watcher-client.js +0 -75
  323. package/lib/node/filesystem-watcher-client.js.map +0 -1
  324. package/lib/node/filesystem-watcher-dispatcher.d.ts +0 -24
  325. package/lib/node/filesystem-watcher-dispatcher.d.ts.map +0 -1
  326. package/lib/node/filesystem-watcher-dispatcher.js +0 -81
  327. package/lib/node/filesystem-watcher-dispatcher.js.map +0 -1
  328. package/lib/node/parcel-watcher/index.d.ts +0 -4
  329. package/lib/node/parcel-watcher/index.d.ts.map +0 -1
  330. package/lib/node/parcel-watcher/index.js +0 -40
  331. package/lib/node/parcel-watcher/index.js.map +0 -1
  332. package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts +0 -193
  333. package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts.map +0 -1
  334. package/lib/node/parcel-watcher/parcel-filesystem-service.js +0 -406
  335. package/lib/node/parcel-watcher/parcel-filesystem-service.js.map +0 -1
  336. package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.d.ts +0 -2
  337. package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.d.ts.map +0 -1
  338. package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.js +0 -145
  339. package/lib/node/parcel-watcher/parcel-filesystem-watcher.spec.js.map +0 -1
  340. package/lib/node/parcel-watcher/parcel-options.d.ts +0 -7
  341. package/lib/node/parcel-watcher/parcel-options.d.ts.map +0 -1
  342. package/lib/node/parcel-watcher/parcel-options.js +0 -23
  343. package/lib/node/parcel-watcher/parcel-options.js.map +0 -1
  344. package/lib/node/upload/node-file-upload-service.d.ts +0 -17
  345. package/lib/node/upload/node-file-upload-service.d.ts.map +0 -1
  346. package/lib/node/upload/node-file-upload-service.js +0 -87
  347. package/lib/node/upload/node-file-upload-service.js.map +0 -1
@@ -1,786 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- /*---------------------------------------------------------------------------------------------
18
- * Copyright (c) Microsoft Corporation. All rights reserved.
19
- * Licensed under the MIT License. See License.txt in the project root for license information.
20
- *--------------------------------------------------------------------------------------------*/
21
- // based on https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/platform/files/node/diskFileSystemProvider.ts
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.DiskFileSystemProvider = void 0;
24
- const tslib_1 = require("tslib");
25
- /* eslint-disable no-null/no-null */
26
- /* eslint-disable @typescript-eslint/no-shadow */
27
- const inversify_1 = require("@theia/core/shared/inversify");
28
- const path_1 = require("path");
29
- const uuid_1 = require("@theia/core/lib/common/uuid");
30
- const os = require("os");
31
- const fs = require("fs");
32
- const fs_1 = require("fs");
33
- const util_1 = require("util");
34
- const uri_1 = require("@theia/core/lib/common/uri");
35
- const path_2 = require("@theia/core/lib/common/path");
36
- const file_uri_1 = require("@theia/core/lib/common/file-uri");
37
- const event_1 = require("@theia/core/lib/common/event");
38
- const disposable_1 = require("@theia/core/lib/common/disposable");
39
- const os_1 = require("@theia/core/lib/common/os");
40
- const promise_util_1 = require("@theia/core/lib/common/promise-util");
41
- const files_1 = require("../common/files");
42
- const filesystem_watcher_protocol_1 = require("../common/filesystem-watcher-protocol");
43
- const trash = require("trash");
44
- const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
45
- const encoding_service_1 = require("@theia/core/lib/common/encoding-service");
46
- const buffer_1 = require("@theia/core/lib/common/buffer");
47
- const stream_1 = require("@theia/core/lib/common/stream");
48
- const io_1 = require("../common/io");
49
- const stat_mode_1 = require("stat-mode");
50
- let DiskFileSystemProvider = class DiskFileSystemProvider {
51
- constructor() {
52
- this.BUFFER_SIZE = 64 * 1024;
53
- this.onDidChangeFileEmitter = new event_1.Emitter();
54
- this.onDidChangeFile = this.onDidChangeFileEmitter.event;
55
- this.onFileWatchErrorEmitter = new event_1.Emitter();
56
- this.onFileWatchError = this.onFileWatchErrorEmitter.event;
57
- this.toDispose = new disposable_1.DisposableCollection(this.onDidChangeFileEmitter);
58
- // #region File Capabilities
59
- this.onDidChangeCapabilities = event_1.Event.None;
60
- this.mapHandleToPos = new Map();
61
- this.writeHandles = new Set();
62
- this.canFlush = true;
63
- }
64
- init() {
65
- this.toDispose.push(this.watcher);
66
- this.watcher.setClient({
67
- onDidFilesChanged: params => this.onDidChangeFileEmitter.fire(params.changes.map(({ uri, type }) => ({
68
- resource: new uri_1.default(uri),
69
- type
70
- }))),
71
- onError: () => this.onFileWatchErrorEmitter.fire()
72
- });
73
- }
74
- get capabilities() {
75
- if (!this._capabilities) {
76
- this._capabilities =
77
- 2 /* FileSystemProviderCapabilities.FileReadWrite */ |
78
- 4 /* FileSystemProviderCapabilities.FileOpenReadWriteClose */ |
79
- 16 /* FileSystemProviderCapabilities.FileReadStream */ |
80
- 8 /* FileSystemProviderCapabilities.FileFolderCopy */ |
81
- 16777216 /* FileSystemProviderCapabilities.Access */ |
82
- 4096 /* FileSystemProviderCapabilities.Trash */ |
83
- 33554432 /* FileSystemProviderCapabilities.Update */;
84
- if (os_1.OS.type() === os_1.OS.Type.Linux) {
85
- this._capabilities |= 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */;
86
- }
87
- }
88
- return this._capabilities;
89
- }
90
- // #endregion
91
- // #region File Metadata Resolving
92
- async stat(resource) {
93
- try {
94
- const { stat, symbolicLink } = await this.statLink(this.toFilePath(resource)); // cannot use fs.stat() here to support links properly
95
- const mode = new stat_mode_1.Mode(stat);
96
- return {
97
- type: this.toType(stat, symbolicLink),
98
- ctime: stat.birthtime.getTime(), // intentionally not using ctime here, we want the creation time
99
- mtime: stat.mtime.getTime(),
100
- size: stat.size,
101
- permissions: !mode.owner.write ? files_1.FilePermission.Readonly : undefined,
102
- };
103
- }
104
- catch (error) {
105
- throw this.toFileSystemProviderError(error);
106
- }
107
- }
108
- async access(resource, mode) {
109
- try {
110
- await (0, util_1.promisify)(fs.access)(this.toFilePath(resource), mode);
111
- }
112
- catch (error) {
113
- throw this.toFileSystemProviderError(error);
114
- }
115
- }
116
- async fsPath(resource) {
117
- return file_uri_1.FileUri.fsPath(resource);
118
- }
119
- async statLink(path) {
120
- // First stat the link
121
- let lstats;
122
- try {
123
- lstats = await (0, util_1.promisify)(fs_1.lstat)(path);
124
- // Return early if the stat is not a symbolic link at all
125
- if (!lstats.isSymbolicLink()) {
126
- return { stat: lstats };
127
- }
128
- }
129
- catch (error) {
130
- /* ignore - use stat() instead */
131
- }
132
- // If the stat is a symbolic link or failed to stat, use fs.stat()
133
- // which for symbolic links will stat the target they point to
134
- try {
135
- const stats = await (0, util_1.promisify)(fs_1.stat)(path);
136
- return { stat: stats, symbolicLink: (lstats === null || lstats === void 0 ? void 0 : lstats.isSymbolicLink()) ? { dangling: false } : undefined };
137
- }
138
- catch (error) {
139
- // If the link points to a non-existing file we still want
140
- // to return it as result while setting dangling: true flag
141
- if (error.code === 'ENOENT' && lstats) {
142
- return { stat: lstats, symbolicLink: { dangling: true } };
143
- }
144
- throw error;
145
- }
146
- }
147
- async readdir(resource) {
148
- try {
149
- const children = await (0, util_1.promisify)(fs.readdir)(this.toFilePath(resource));
150
- const result = [];
151
- await Promise.all(children.map(async (child) => {
152
- try {
153
- const stat = await this.stat(resource.resolve(child));
154
- result.push([child, stat.type]);
155
- }
156
- catch (error) {
157
- console.trace(error); // ignore errors for individual entries that can arise from permission denied
158
- }
159
- }));
160
- return result;
161
- }
162
- catch (error) {
163
- throw this.toFileSystemProviderError(error);
164
- }
165
- }
166
- toType(entry, symbolicLink) {
167
- // Signal file type by checking for file / directory, except:
168
- // - symbolic links pointing to non-existing files are FileType.Unknown
169
- // - files that are neither file nor directory are FileType.Unknown
170
- let type;
171
- if (symbolicLink === null || symbolicLink === void 0 ? void 0 : symbolicLink.dangling) {
172
- type = files_1.FileType.Unknown;
173
- }
174
- else if (entry.isFile()) {
175
- type = files_1.FileType.File;
176
- }
177
- else if (entry.isDirectory()) {
178
- type = files_1.FileType.Directory;
179
- }
180
- else {
181
- type = files_1.FileType.Unknown;
182
- }
183
- // Always signal symbolic link as file type additionally
184
- if (symbolicLink) {
185
- type |= files_1.FileType.SymbolicLink;
186
- }
187
- return type;
188
- }
189
- // #endregion
190
- // #region File Reading/Writing
191
- async readFile(resource) {
192
- try {
193
- const filePath = this.toFilePath(resource);
194
- return await (0, util_1.promisify)(fs_1.readFile)(filePath);
195
- }
196
- catch (error) {
197
- throw this.toFileSystemProviderError(error);
198
- }
199
- }
200
- readFileStream(resource, opts, token) {
201
- const stream = (0, stream_1.newWriteableStream)(data => buffer_1.BinaryBuffer.concat(data.map(data => buffer_1.BinaryBuffer.wrap(data))).buffer);
202
- (0, io_1.readFileIntoStream)(this, resource, stream, data => data.buffer, {
203
- ...opts,
204
- bufferSize: this.BUFFER_SIZE
205
- }, token);
206
- return stream;
207
- }
208
- async writeFile(resource, content, opts) {
209
- let handle = undefined;
210
- try {
211
- const filePath = this.toFilePath(resource);
212
- // Validate target unless { create: true, overwrite: true }
213
- if (!opts.create || !opts.overwrite) {
214
- const fileExists = await (0, util_1.promisify)(fs_1.exists)(filePath);
215
- if (fileExists) {
216
- if (!opts.overwrite) {
217
- throw (0, files_1.createFileSystemProviderError)('File already exists', files_1.FileSystemProviderErrorCode.FileExists);
218
- }
219
- }
220
- else if (!opts.create) {
221
- throw (0, files_1.createFileSystemProviderError)('File does not exist', files_1.FileSystemProviderErrorCode.FileNotFound);
222
- }
223
- }
224
- // Open
225
- handle = await this.open(resource, { create: true });
226
- // Write content at once
227
- await this.write(handle, 0, content, 0, content.byteLength);
228
- }
229
- catch (error) {
230
- throw this.toFileSystemProviderError(error);
231
- }
232
- finally {
233
- if (typeof handle === 'number') {
234
- await this.close(handle);
235
- }
236
- }
237
- }
238
- async open(resource, opts) {
239
- try {
240
- const filePath = this.toFilePath(resource);
241
- let flags = undefined;
242
- if (opts.create) {
243
- if (os_1.isWindows && await (0, util_1.promisify)(fs_1.exists)(filePath)) {
244
- try {
245
- // On Windows and if the file exists, we use a different strategy of saving the file
246
- // by first truncating the file and then writing with r+ flag. This helps to save hidden files on Windows
247
- // (see https://github.com/Microsoft/vscode/issues/931) and prevent removing alternate data streams
248
- // (see https://github.com/Microsoft/vscode/issues/6363)
249
- await (0, util_1.promisify)(fs_1.truncate)(filePath, 0);
250
- // After a successful truncate() the flag can be set to 'r+' which will not truncate.
251
- flags = 'r+';
252
- }
253
- catch (error) {
254
- console.trace(error);
255
- }
256
- }
257
- // we take opts.create as a hint that the file is opened for writing
258
- // as such we use 'w' to truncate an existing or create the
259
- // file otherwise. we do not allow reading.
260
- if (!flags) {
261
- flags = 'w';
262
- }
263
- }
264
- else {
265
- // otherwise we assume the file is opened for reading
266
- // as such we use 'r' to neither truncate, nor create
267
- // the file.
268
- flags = 'r';
269
- }
270
- const handle = await (0, util_1.promisify)(fs_1.open)(filePath, flags);
271
- // remember this handle to track file position of the handle
272
- // we init the position to 0 since the file descriptor was
273
- // just created and the position was not moved so far (see
274
- // also http://man7.org/linux/man-pages/man2/open.2.html -
275
- // "The file offset is set to the beginning of the file.")
276
- this.mapHandleToPos.set(handle, 0);
277
- // remember that this handle was used for writing
278
- if (opts.create) {
279
- this.writeHandles.add(handle);
280
- }
281
- return handle;
282
- }
283
- catch (error) {
284
- throw this.toFileSystemProviderError(error);
285
- }
286
- }
287
- async close(fd) {
288
- try {
289
- // remove this handle from map of positions
290
- this.mapHandleToPos.delete(fd);
291
- // if a handle is closed that was used for writing, ensure
292
- // to flush the contents to disk if possible.
293
- if (this.writeHandles.delete(fd) && this.canFlush) {
294
- try {
295
- await (0, util_1.promisify)(fs_1.fdatasync)(fd);
296
- }
297
- catch (error) {
298
- // In some exotic setups it is well possible that node fails to sync
299
- // In that case we disable flushing and log the error to our logger
300
- this.canFlush = false;
301
- console.error(error);
302
- }
303
- }
304
- return await (0, util_1.promisify)(fs_1.close)(fd);
305
- }
306
- catch (error) {
307
- throw this.toFileSystemProviderError(error);
308
- }
309
- }
310
- async read(fd, pos, data, offset, length) {
311
- const normalizedPos = this.normalizePos(fd, pos);
312
- let bytesRead = null;
313
- try {
314
- const result = await (0, util_1.promisify)(fs_1.read)(fd, data, offset, length, normalizedPos);
315
- if (typeof result === 'number') {
316
- bytesRead = result; // node.d.ts fail
317
- }
318
- else {
319
- bytesRead = result.bytesRead;
320
- }
321
- return bytesRead;
322
- }
323
- catch (error) {
324
- throw this.toFileSystemProviderError(error);
325
- }
326
- finally {
327
- this.updatePos(fd, normalizedPos, bytesRead);
328
- }
329
- }
330
- normalizePos(fd, pos) {
331
- // when calling fs.read/write we try to avoid passing in the "pos" argument and
332
- // rather prefer to pass in "null" because this avoids an extra seek(pos)
333
- // call that in some cases can even fail (e.g. when opening a file over FTP -
334
- // see https://github.com/microsoft/vscode/issues/73884).
335
- //
336
- // as such, we compare the passed in position argument with our last known
337
- // position for the file descriptor and use "null" if they match.
338
- if (pos === this.mapHandleToPos.get(fd)) {
339
- return null;
340
- }
341
- return pos;
342
- }
343
- updatePos(fd, pos, bytesLength) {
344
- const lastKnownPos = this.mapHandleToPos.get(fd);
345
- if (typeof lastKnownPos === 'number') {
346
- // pos !== null signals that previously a position was used that is
347
- // not null. node.js documentation explains, that in this case
348
- // the internal file pointer is not moving and as such we do not move
349
- // our position pointer.
350
- //
351
- // Docs: "If position is null, data will be read from the current file position,
352
- // and the file position will be updated. If position is an integer, the file position
353
- // will remain unchanged."
354
- if (typeof pos === 'number') {
355
- // do not modify the position
356
- }
357
- else if (typeof bytesLength === 'number') {
358
- this.mapHandleToPos.set(fd, lastKnownPos + bytesLength);
359
- }
360
- else {
361
- this.mapHandleToPos.delete(fd);
362
- }
363
- }
364
- }
365
- async write(fd, pos, data, offset, length) {
366
- // we know at this point that the file to write to is truncated and thus empty
367
- // if the write now fails, the file remains empty. as such we really try hard
368
- // to ensure the write succeeds by retrying up to three times.
369
- return (0, promise_util_1.retry)(() => this.doWrite(fd, pos, data, offset, length), 100 /* ms delay */, 3 /* retries */);
370
- }
371
- async doWrite(fd, pos, data, offset, length) {
372
- const normalizedPos = this.normalizePos(fd, pos);
373
- let bytesWritten = null;
374
- try {
375
- const result = await (0, util_1.promisify)(fs_1.write)(fd, data, offset, length, normalizedPos);
376
- if (typeof result === 'number') {
377
- bytesWritten = result; // node.d.ts fail
378
- }
379
- else {
380
- bytesWritten = result.bytesWritten;
381
- }
382
- return bytesWritten;
383
- }
384
- catch (error) {
385
- throw this.toFileSystemProviderError(error);
386
- }
387
- finally {
388
- this.updatePos(fd, normalizedPos, bytesWritten);
389
- }
390
- }
391
- // #endregion
392
- // #region Move/Copy/Delete/Create Folder
393
- async mkdir(resource) {
394
- try {
395
- await (0, util_1.promisify)(fs_1.mkdir)(this.toFilePath(resource));
396
- }
397
- catch (error) {
398
- throw this.toFileSystemProviderError(error);
399
- }
400
- }
401
- async delete(resource, opts) {
402
- try {
403
- const filePath = this.toFilePath(resource);
404
- await this.doDelete(filePath, opts);
405
- }
406
- catch (error) {
407
- throw this.toFileSystemProviderError(error);
408
- }
409
- }
410
- async doDelete(filePath, opts) {
411
- if (!opts.useTrash) {
412
- if (opts.recursive) {
413
- await this.rimraf(filePath);
414
- }
415
- else {
416
- const stat = await (0, util_1.promisify)(fs_1.lstat)(filePath);
417
- if (stat.isDirectory() && !stat.isSymbolicLink()) {
418
- await (0, util_1.promisify)(fs_1.rmdir)(filePath);
419
- }
420
- else {
421
- await (0, util_1.promisify)(fs_1.unlink)(filePath);
422
- }
423
- }
424
- }
425
- else {
426
- await trash(filePath);
427
- }
428
- }
429
- rimraf(path) {
430
- if (new path_2.Path(path).isRoot) {
431
- throw new Error('rimraf - will refuse to recursively delete root');
432
- }
433
- return this.rimrafMove(path);
434
- }
435
- async rimrafMove(path) {
436
- try {
437
- const pathInTemp = (0, path_1.join)(os.tmpdir(), (0, uuid_1.generateUuid)());
438
- try {
439
- await (0, util_1.promisify)(fs_1.rename)(path, pathInTemp);
440
- }
441
- catch (error) {
442
- return this.rimrafUnlink(path); // if rename fails, delete without tmp dir
443
- }
444
- // Delete but do not return as promise
445
- this.rimrafUnlink(pathInTemp);
446
- }
447
- catch (error) {
448
- if (error.code !== 'ENOENT') {
449
- throw error;
450
- }
451
- }
452
- }
453
- async rimrafUnlink(path) {
454
- try {
455
- const stat = await (0, util_1.promisify)(fs_1.lstat)(path);
456
- // Folder delete (recursive) - NOT for symbolic links though!
457
- if (stat.isDirectory() && !stat.isSymbolicLink()) {
458
- // Children
459
- const children = await (0, util_1.promisify)(fs_1.readdir)(path);
460
- await Promise.all(children.map(child => this.rimrafUnlink((0, path_1.join)(path, child))));
461
- // Folder
462
- await (0, util_1.promisify)(fs_1.rmdir)(path);
463
- }
464
- else {
465
- // chmod as needed to allow for unlink
466
- const mode = stat.mode;
467
- if (!(mode & 128)) { // 128 === 0200
468
- await (0, util_1.promisify)(fs_1.chmod)(path, mode | 128);
469
- }
470
- return (0, util_1.promisify)(fs_1.unlink)(path);
471
- }
472
- }
473
- catch (error) {
474
- if (error.code !== 'ENOENT') {
475
- throw error;
476
- }
477
- }
478
- }
479
- async rename(from, to, opts) {
480
- const fromFilePath = this.toFilePath(from);
481
- const toFilePath = this.toFilePath(to);
482
- if (fromFilePath === toFilePath) {
483
- return; // simulate node.js behaviour here and do a no-op if paths match
484
- }
485
- try {
486
- // Ensure target does not exist
487
- await this.validateTargetDeleted(from, to, 'move', opts.overwrite);
488
- // Move
489
- await this.move(fromFilePath, toFilePath);
490
- }
491
- catch (error) {
492
- // rewrite some typical errors that can happen especially around symlinks
493
- // to something the user can better understand
494
- if (error.code === 'EINVAL' || error.code === 'EBUSY' || error.code === 'ENAMETOOLONG') {
495
- error = new Error(`Unable to move '${(0, path_1.basename)(fromFilePath)}' into '${(0, path_1.basename)((0, path_1.dirname)(toFilePath))}' (${error.toString()}).`);
496
- }
497
- throw this.toFileSystemProviderError(error);
498
- }
499
- }
500
- async move(source, target) {
501
- if (source === target) {
502
- return Promise.resolve();
503
- }
504
- async function updateMtime(path) {
505
- const stat = await (0, util_1.promisify)(fs_1.lstat)(path);
506
- if (stat.isDirectory() || stat.isSymbolicLink()) {
507
- return Promise.resolve(); // only for files
508
- }
509
- const fd = await (0, util_1.promisify)(fs_1.open)(path, 'a');
510
- try {
511
- await (0, util_1.promisify)(fs_1.futimes)(fd, stat.atime, new Date());
512
- }
513
- catch (error) {
514
- // ignore
515
- }
516
- return (0, util_1.promisify)(fs_1.close)(fd);
517
- }
518
- try {
519
- await (0, util_1.promisify)(fs_1.rename)(source, target);
520
- await updateMtime(target);
521
- }
522
- catch (error) {
523
- // In two cases we fallback to classic copy and delete:
524
- //
525
- // 1.) The EXDEV error indicates that source and target are on different devices
526
- // In this case, fallback to using a copy() operation as there is no way to
527
- // rename() between different devices.
528
- //
529
- // 2.) The user tries to rename a file/folder that ends with a dot. This is not
530
- // really possible to move then, at least on UNC devices.
531
- if (source.toLowerCase() !== target.toLowerCase() && error.code === 'EXDEV' || source.endsWith('.')) {
532
- await this.doCopy(source, target);
533
- await this.rimraf(source);
534
- await updateMtime(target);
535
- }
536
- else {
537
- throw error;
538
- }
539
- }
540
- }
541
- async copy(from, to, opts) {
542
- const fromFilePath = this.toFilePath(from);
543
- const toFilePath = this.toFilePath(to);
544
- if (fromFilePath === toFilePath) {
545
- return; // simulate node.js behaviour here and do a no-op if paths match
546
- }
547
- try {
548
- // Ensure target does not exist
549
- await this.validateTargetDeleted(from, to, 'copy', opts.overwrite);
550
- // Copy
551
- await this.doCopy(fromFilePath, toFilePath);
552
- }
553
- catch (error) {
554
- // rewrite some typical errors that can happen especially around symlinks
555
- // to something the user can better understand
556
- if (error.code === 'EINVAL' || error.code === 'EBUSY' || error.code === 'ENAMETOOLONG') {
557
- error = new Error(`Unable to copy '${(0, path_1.basename)(fromFilePath)}' into '${(0, path_1.basename)((0, path_1.dirname)(toFilePath))}' (${error.toString()}).`);
558
- }
559
- throw this.toFileSystemProviderError(error);
560
- }
561
- }
562
- async validateTargetDeleted(from, to, mode, overwrite) {
563
- const isPathCaseSensitive = !!(this.capabilities & 1024 /* FileSystemProviderCapabilities.PathCaseSensitive */);
564
- const fromFilePath = this.toFilePath(from);
565
- const toFilePath = this.toFilePath(to);
566
- let isSameResourceWithDifferentPathCase = false;
567
- if (!isPathCaseSensitive) {
568
- isSameResourceWithDifferentPathCase = fromFilePath.toLowerCase() === toFilePath.toLowerCase();
569
- }
570
- if (isSameResourceWithDifferentPathCase && mode === 'copy') {
571
- throw (0, files_1.createFileSystemProviderError)("'File cannot be copied to same path with different path case", files_1.FileSystemProviderErrorCode.FileExists);
572
- }
573
- // handle existing target (unless this is a case change)
574
- if (!isSameResourceWithDifferentPathCase && await (0, util_1.promisify)(fs_1.exists)(toFilePath)) {
575
- if (!overwrite) {
576
- throw (0, files_1.createFileSystemProviderError)('File at target already exists', files_1.FileSystemProviderErrorCode.FileExists);
577
- }
578
- // Delete target
579
- await this.delete(to, { recursive: true, useTrash: false });
580
- }
581
- }
582
- async doCopy(source, target, copiedSourcesIn) {
583
- const copiedSources = copiedSourcesIn ? copiedSourcesIn : Object.create(null);
584
- const fileStat = await (0, util_1.promisify)(fs_1.stat)(source);
585
- if (!fileStat.isDirectory()) {
586
- return this.doCopyFile(source, target, fileStat.mode & 511);
587
- }
588
- if (copiedSources[source]) {
589
- return Promise.resolve(); // escape when there are cycles (can happen with symlinks)
590
- }
591
- copiedSources[source] = true; // remember as copied
592
- // Create folder
593
- await this.mkdirp(target, fileStat.mode & 511);
594
- // Copy each file recursively
595
- const files = await (0, util_1.promisify)(fs_1.readdir)(source);
596
- for (let i = 0; i < files.length; i++) {
597
- const file = files[i];
598
- await this.doCopy((0, path_1.join)(source, file), (0, path_1.join)(target, file), copiedSources);
599
- }
600
- }
601
- async mkdirp(path, mode) {
602
- const mkdir = async () => {
603
- try {
604
- await (0, util_1.promisify)(fs.mkdir)(path, mode);
605
- }
606
- catch (error) {
607
- // ENOENT: a parent folder does not exist yet
608
- if (error.code === 'ENOENT') {
609
- throw error;
610
- }
611
- // Any other error: check if folder exists and
612
- // return normally in that case if its a folder
613
- let targetIsFile = false;
614
- try {
615
- const fileStat = await (0, util_1.promisify)(fs.stat)(path);
616
- targetIsFile = !fileStat.isDirectory();
617
- }
618
- catch (statError) {
619
- throw error; // rethrow original error if stat fails
620
- }
621
- if (targetIsFile) {
622
- throw new Error(`'${path}' exists and is not a directory.`);
623
- }
624
- }
625
- };
626
- // stop at root
627
- if (path === (0, path_1.dirname)(path)) {
628
- return;
629
- }
630
- try {
631
- await mkdir();
632
- }
633
- catch (error) {
634
- // ENOENT: a parent folder does not exist yet, continue
635
- // to create the parent folder and then try again.
636
- if (error.code === 'ENOENT') {
637
- await this.mkdirp((0, path_1.dirname)(path), mode);
638
- return mkdir();
639
- }
640
- // Any other error
641
- throw error;
642
- }
643
- }
644
- doCopyFile(source, target, mode) {
645
- return new Promise((resolve, reject) => {
646
- const reader = fs.createReadStream(source);
647
- const writer = fs.createWriteStream(target, { mode });
648
- let finished = false;
649
- const finish = (error) => {
650
- if (!finished) {
651
- finished = true;
652
- // in error cases, pass to callback
653
- if (error) {
654
- return reject(error);
655
- }
656
- // we need to explicitly chmod because of https://github.com/nodejs/node/issues/1104
657
- fs.chmod(target, mode, error => error ? reject(error) : resolve());
658
- }
659
- };
660
- // handle errors properly
661
- reader.once('error', error => finish(error));
662
- writer.once('error', error => finish(error));
663
- // we are done (underlying fd has been closed)
664
- writer.once('close', () => finish());
665
- // start piping
666
- reader.pipe(writer);
667
- });
668
- }
669
- // #endregion
670
- // #region File Watching
671
- watch(resource, opts) {
672
- const watcherService = this.watcher;
673
- /**
674
- * Disposable handle. Can be disposed early (before the watcher is allocated.)
675
- */
676
- const handle = {
677
- disposed: false,
678
- watcherId: undefined,
679
- dispose() {
680
- if (this.disposed) {
681
- return;
682
- }
683
- if (this.watcherId !== undefined) {
684
- watcherService.unwatchFileChanges(this.watcherId);
685
- }
686
- this.disposed = true;
687
- },
688
- };
689
- watcherService.watchFileChanges(resource.toString(), {
690
- // Convert from `files.WatchOptions` to internal `watcher-protocol.WatchOptions`:
691
- ignored: opts.excludes
692
- }).then(watcherId => {
693
- if (handle.disposed) {
694
- watcherService.unwatchFileChanges(watcherId);
695
- }
696
- else {
697
- handle.watcherId = watcherId;
698
- }
699
- });
700
- this.toDispose.push(handle);
701
- return handle;
702
- }
703
- // #endregion
704
- async updateFile(resource, changes, opts) {
705
- try {
706
- const content = await this.readFile(resource);
707
- const decoded = this.encodingService.decode(buffer_1.BinaryBuffer.wrap(content), opts.readEncoding);
708
- const newContent = vscode_languageserver_textdocument_1.TextDocument.update(vscode_languageserver_textdocument_1.TextDocument.create('', '', 1, decoded), changes, 2).getText();
709
- const encoding = await this.encodingService.toResourceEncoding(opts.writeEncoding, {
710
- overwriteEncoding: opts.overwriteEncoding,
711
- read: async (length) => {
712
- const fd = await this.open(resource, { create: false });
713
- try {
714
- const data = new Uint8Array(length);
715
- await this.read(fd, 0, data, 0, length);
716
- return data;
717
- }
718
- finally {
719
- await this.close(fd);
720
- }
721
- }
722
- });
723
- const encoded = this.encodingService.encode(newContent, encoding);
724
- await this.writeFile(resource, encoded.buffer, { create: false, overwrite: true });
725
- const stat = await this.stat(resource);
726
- return Object.assign(stat, { encoding: encoding.encoding });
727
- }
728
- catch (error) {
729
- throw this.toFileSystemProviderError(error);
730
- }
731
- }
732
- // #region Helpers
733
- toFilePath(resource) {
734
- return (0, path_1.normalize)(file_uri_1.FileUri.fsPath(resource));
735
- }
736
- toFileSystemProviderError(error) {
737
- if (error instanceof files_1.FileSystemProviderError) {
738
- return error; // avoid double conversion
739
- }
740
- let code;
741
- switch (error.code) {
742
- case 'ENOENT':
743
- code = files_1.FileSystemProviderErrorCode.FileNotFound;
744
- break;
745
- case 'EISDIR':
746
- code = files_1.FileSystemProviderErrorCode.FileIsADirectory;
747
- break;
748
- case 'ENOTDIR':
749
- code = files_1.FileSystemProviderErrorCode.FileNotADirectory;
750
- break;
751
- case 'EEXIST':
752
- code = files_1.FileSystemProviderErrorCode.FileExists;
753
- break;
754
- case 'EPERM':
755
- case 'EACCES':
756
- code = files_1.FileSystemProviderErrorCode.NoPermissions;
757
- break;
758
- default:
759
- code = files_1.FileSystemProviderErrorCode.Unknown;
760
- }
761
- return (0, files_1.createFileSystemProviderError)(error, code);
762
- }
763
- // #endregion
764
- dispose() {
765
- this.toDispose.dispose();
766
- }
767
- };
768
- exports.DiskFileSystemProvider = DiskFileSystemProvider;
769
- tslib_1.__decorate([
770
- (0, inversify_1.inject)(filesystem_watcher_protocol_1.FileSystemWatcherServer),
771
- tslib_1.__metadata("design:type", Object)
772
- ], DiskFileSystemProvider.prototype, "watcher", void 0);
773
- tslib_1.__decorate([
774
- (0, inversify_1.inject)(encoding_service_1.EncodingService),
775
- tslib_1.__metadata("design:type", encoding_service_1.EncodingService)
776
- ], DiskFileSystemProvider.prototype, "encodingService", void 0);
777
- tslib_1.__decorate([
778
- (0, inversify_1.postConstruct)(),
779
- tslib_1.__metadata("design:type", Function),
780
- tslib_1.__metadata("design:paramtypes", []),
781
- tslib_1.__metadata("design:returntype", void 0)
782
- ], DiskFileSystemProvider.prototype, "init", null);
783
- exports.DiskFileSystemProvider = DiskFileSystemProvider = tslib_1.__decorate([
784
- (0, inversify_1.injectable)()
785
- ], DiskFileSystemProvider);
786
- //# sourceMappingURL=disk-file-system-provider.js.map