@tachybase/module-hera 1.9.8

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 (262) hide show
  1. package/.turbo/turbo-build.log +11 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/components/PDFViewer.d.ts +11 -0
  6. package/dist/client/components/SignatureInput.d.ts +2 -0
  7. package/dist/client/components/SignaturePad.d.ts +240 -0
  8. package/dist/client/components/custom-components/CustomAssociatedField.d.ts +2 -0
  9. package/dist/client/components/custom-components/CustomComponentDispatcher.d.ts +5 -0
  10. package/dist/client/components/custom-components/CustomField.d.ts +2 -0
  11. package/dist/client/components/custom-components/ErrorBoundary.d.ts +2 -0
  12. package/dist/client/components/custom-components/custom-components.d.ts +21 -0
  13. package/dist/client/components/excel-table/ExcelFile.d.ts +2 -0
  14. package/dist/client/components/excel-table/Sheet.d.ts +10 -0
  15. package/dist/client/components/fields/AssociatedField.d.ts +7 -0
  16. package/dist/client/components/fields/CalcResult.d.ts +1 -0
  17. package/dist/client/components/fields/Expression.d.ts +3 -0
  18. package/dist/client/components/index.d.ts +11 -0
  19. package/dist/client/components/modal-full-screen/ModalFullScreen.d.ts +15 -0
  20. package/dist/client/components/modal-full-screen/ModalFullScreenChild.d.ts +2 -0
  21. package/dist/client/features/block-group/GroupBlock.d.ts +4 -0
  22. package/dist/client/features/block-group/GroupBlockConfigure.d.ts +19 -0
  23. package/dist/client/features/block-group/GroupBlockInitializer.d.ts +9 -0
  24. package/dist/client/features/block-group/index.d.ts +4 -0
  25. package/dist/client/features/custom-components/index.d.ts +5 -0
  26. package/dist/client/features/departments/common/DepartmentTable.schema.d.ts +50 -0
  27. package/dist/client/features/departments/common/DepartmentTable.view.d.ts +5 -0
  28. package/dist/client/features/departments/common/FilterKeys.context.d.ts +10 -0
  29. package/dist/client/features/departments/common/InternalDepartmentTable.d.ts +6 -0
  30. package/dist/client/features/departments/common/Request.povider.d.ts +2 -0
  31. package/dist/client/features/departments/common/UserDepartmentsFieldNotSupport.d.ts +2 -0
  32. package/dist/client/features/departments/common/scopes/useDepartmentFilterActionProps.d.ts +5 -0
  33. package/dist/client/features/departments/common/scopes/useFilterActionProps.d.ts +5 -0
  34. package/dist/client/features/departments/index.d.ts +5 -0
  35. package/dist/client/features/departments/main-tab/DepartmentIndex.d.ts +6 -0
  36. package/dist/client/features/departments/main-tab/DepartmentIndex.provider.d.ts +4 -0
  37. package/dist/client/features/departments/main-tab/DepartmentManagement.component.d.ts +2 -0
  38. package/dist/client/features/departments/main-tab/DepartmentManagement.schema.d.ts +10 -0
  39. package/dist/client/features/departments/main-tab/DepartmentManagement.view.d.ts +2 -0
  40. package/dist/client/features/departments/main-tab/collections/departments.collection.d.ts +128 -0
  41. package/dist/client/features/departments/main-tab/collections/users.collection.d.ts +189 -0
  42. package/dist/client/features/departments/main-tab/components/DepartmentSelect.d.ts +2 -0
  43. package/dist/client/features/departments/main-tab/components/InternalSuperiorDepartmentSelect.d.ts +2 -0
  44. package/dist/client/features/departments/main-tab/components/SuperiorDepartmentSelect.d.ts +2 -0
  45. package/dist/client/features/departments/main-tab/context/Department.context.d.ts +23 -0
  46. package/dist/client/features/departments/main-tab/context/DepartmentsExpanded.context.d.ts +17 -0
  47. package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.schema.d.ts +67 -0
  48. package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.view.d.ts +2 -0
  49. package/dist/client/features/departments/main-tab/departments-block/DepartmentOwnersField.component.d.ts +6 -0
  50. package/dist/client/features/departments/main-tab/departments-block/DepartmentsBlock.d.ts +2 -0
  51. package/dist/client/features/departments/main-tab/departments-block/DepartmentsSearch.component.d.ts +2 -0
  52. package/dist/client/features/departments/main-tab/departments-block/DepartmentsTree.component.d.ts +9 -0
  53. package/dist/client/features/departments/main-tab/departments-block/Request.provider.d.ts +2 -0
  54. package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.schema.d.ts +136 -0
  55. package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.view.d.ts +2 -0
  56. package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentEdit.d.ts +62 -0
  57. package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentNewSub.d.ts +57 -0
  58. package/dist/client/features/departments/main-tab/departments-block/scopes/useCreateDepartment.d.ts +3 -0
  59. package/dist/client/features/departments/main-tab/departments-block/scopes/useUpdateDepartment.d.ts +3 -0
  60. package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.schema.d.ts +148 -0
  61. package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.view.d.ts +2 -0
  62. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentField.component.d.ts +2 -0
  63. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.d.ts +2 -0
  64. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.schema.d.ts +676 -0
  65. package/dist/client/features/departments/main-tab/departments-users-block/IsOwnerField.component.d.ts +2 -0
  66. package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.schema.d.ts +49 -0
  67. package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.view.d.ts +2 -0
  68. package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.schema.d.ts +16 -0
  69. package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.view.d.ts +2 -0
  70. package/dist/client/features/departments/main-tab/departments-users-block/UserDepartmentsField.component.d.ts +2 -0
  71. package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.schema.d.ts +42 -0
  72. package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.view.d.ts +2 -0
  73. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useBulkRemoveMembersAction.d.ts +3 -0
  74. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useDataSource.d.ts +40 -0
  75. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useMembersDataSource.d.ts +6 -0
  76. package/dist/client/features/departments/main-tab/departments-users-block/scopes/usePropsAddMember.d.ts +1 -0
  77. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRefreshActionProps.d.ts +3 -0
  78. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRemoveMemberAction.d.ts +3 -0
  79. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useShowTotal.d.ts +1 -0
  80. package/dist/client/features/departments/main-tab/hooks/useDeepTree.d.ts +14 -0
  81. package/dist/client/features/departments/main-tab/hooks/useGetDepTree.d.ts +18 -0
  82. package/dist/client/features/departments/main-tab/kit.d.ts +4 -0
  83. package/dist/client/features/departments/main-tab/providers/DepartmentsResource.provider.d.ts +4 -0
  84. package/dist/client/features/departments/main-tab/providers/UserResource.provider.d.ts +4 -0
  85. package/dist/client/features/departments/role-auth/DepartmentTitle.component.d.ts +2 -0
  86. package/dist/client/features/departments/role-auth/Departments.d.ts +2 -0
  87. package/dist/client/features/departments/role-auth/Departments.schema.d.ts +227 -0
  88. package/dist/client/features/departments/role-auth/kit.d.ts +4 -0
  89. package/dist/client/features/departments/role-auth/scopes/useAddDepartments.d.ts +3 -0
  90. package/dist/client/features/departments/role-auth/scopes/useBulkRemoveDepartments.d.ts +3 -0
  91. package/dist/client/features/departments/role-auth/scopes/useDataSource.d.ts +40 -0
  92. package/dist/client/features/departments/role-auth/scopes/useDisabled.d.ts +3 -0
  93. package/dist/client/features/departments/role-auth/scopes/useRemoveDepartment.d.ts +3 -0
  94. package/dist/client/features/departments/settings/DepartmentOwnersFieldSetting.d.ts +2 -0
  95. package/dist/client/features/departments/settings/UserDepartmentsFieldSetting.d.ts +2 -0
  96. package/dist/client/features/departments/settings/UserMainDepartmentFieldSetting.d.ts +2 -0
  97. package/dist/client/features/departments/settings/items/enableLinkItem.d.ts +2 -0
  98. package/dist/client/features/departments/settings/items/modeSelectItem.d.ts +2 -0
  99. package/dist/client/features/departments/settings/items/titleFieldItem.d.ts +2 -0
  100. package/dist/client/features/departments/utils/getDepartmentStr.d.ts +1 -0
  101. package/dist/client/features/departments/utils/getUserListByDepartment.d.ts +1 -0
  102. package/dist/client/features/embed/EmbedLayout.d.ts +2 -0
  103. package/dist/client/features/embed/EmbedPage.d.ts +2 -0
  104. package/dist/client/features/embed/EmbedSchemaComponent.d.ts +2 -0
  105. package/dist/client/features/embed/NotAuthorityResult.d.ts +2 -0
  106. package/dist/client/features/embed/index.d.ts +4 -0
  107. package/dist/client/features/embed/useEmbedToken.d.ts +1 -0
  108. package/dist/client/features/embed/usePageSettingsProps.d.ts +4 -0
  109. package/dist/client/features/field-appends/index.d.ts +4 -0
  110. package/dist/client/features/field-appends/show-code/Code.interface.d.ts +74 -0
  111. package/dist/client/features/field-appends/show-code/Code.view.d.ts +3 -0
  112. package/dist/client/features/field-appends/show-formula/Formula.interface.d.ts +75 -0
  113. package/dist/client/features/field-appends/show-formula/Formula.view.d.ts +3 -0
  114. package/dist/client/features/hera-version/HeraVersion.provider.d.ts +4 -0
  115. package/dist/client/features/hera-version/index.d.ts +4 -0
  116. package/dist/client/features/mode-highlight/ModeHighlight.provider.d.ts +4 -0
  117. package/dist/client/features/mode-highlight/index.d.ts +4 -0
  118. package/dist/client/features/outbound/OutboundLinkActionInitializer.d.ts +6 -0
  119. package/dist/client/features/outbound/OutboundPage.d.ts +2 -0
  120. package/dist/client/features/outbound/index.d.ts +4 -0
  121. package/dist/client/features/outbound/useOutboundActionProps.d.ts +3 -0
  122. package/dist/client/features/pdf/PDFVIewerBlockInitializer.d.ts +10 -0
  123. package/dist/client/features/pdf/PDFViewer.d.ts +2 -0
  124. package/dist/client/features/pdf/index.d.ts +4 -0
  125. package/dist/client/features/sheet/SheetBlockInitializer.d.ts +8 -0
  126. package/dist/client/features/sheet/index.d.ts +4 -0
  127. package/dist/client/hooks/useCustomComponent.d.ts +5 -0
  128. package/dist/client/hooks/useGetCustomAssociatedComponents.d.ts +4 -0
  129. package/dist/client/hooks/useGetCustomComponents.d.ts +4 -0
  130. package/dist/client/hooks/useNotifications.d.ts +2 -0
  131. package/dist/client/hooks/usePluginVersion.d.ts +1 -0
  132. package/dist/client/hooks/useTokenConfiguration.d.ts +3 -0
  133. package/dist/client/index.d.ts +16 -0
  134. package/dist/client/index.js +93 -0
  135. package/dist/client/interfaces/AssociatedFieldInterface.d.ts +118 -0
  136. package/dist/client/interfaces/CalcFieldInterface.d.ts +120 -0
  137. package/dist/client/interfaces/CustomAssociatedFieldInterface.d.ts +69 -0
  138. package/dist/client/interfaces/CustomFieldInterface.d.ts +45 -0
  139. package/dist/client/interfaces/ExcelFieldInterface.d.ts +38 -0
  140. package/dist/client/interfaces/SignaturePadFieldInterface.d.ts +38 -0
  141. package/dist/client/interfaces/TstzrangeFieldInterface.d.ts +41 -0
  142. package/dist/client/interfaces/index.d.ts +6 -0
  143. package/dist/client/locale.d.ts +9 -0
  144. package/dist/client/schema-initializer/blocks/SettingBlockInitializer.d.ts +2 -0
  145. package/dist/client/schema-initializer/index.d.ts +1 -0
  146. package/dist/client/schema-settings/SchemaSettingsDatePickerType.d.ts +2 -0
  147. package/dist/client/schema-settings/SchemaSettingsDatePresets.d.ts +11 -0
  148. package/dist/client/schema-settings/SchemaSettingsSubmitDataType.d.ts +5 -0
  149. package/dist/client/schema-settings/index.d.ts +4 -0
  150. package/dist/client/settings-manager-components/LinkManager.d.ts +2 -0
  151. package/dist/client/settings-manager-components/TokenConfiguration.d.ts +6 -0
  152. package/dist/client/settings-manager-components/index.d.ts +8 -0
  153. package/dist/client/utils.d.ts +2 -0
  154. package/dist/externalVersion.js +21 -0
  155. package/dist/index.d.ts +2 -0
  156. package/dist/index.js +39 -0
  157. package/dist/locale/en-US.json +94 -0
  158. package/dist/locale/zh-CN.json +94 -0
  159. package/dist/node_modules/fs-extra/LICENSE +15 -0
  160. package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
  161. package/dist/node_modules/fs-extra/lib/copy/copy.js +177 -0
  162. package/dist/node_modules/fs-extra/lib/copy/index.js +7 -0
  163. package/dist/node_modules/fs-extra/lib/empty/index.js +39 -0
  164. package/dist/node_modules/fs-extra/lib/ensure/file.js +66 -0
  165. package/dist/node_modules/fs-extra/lib/ensure/index.js +23 -0
  166. package/dist/node_modules/fs-extra/lib/ensure/link.js +64 -0
  167. package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +101 -0
  168. package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +34 -0
  169. package/dist/node_modules/fs-extra/lib/ensure/symlink.js +67 -0
  170. package/dist/node_modules/fs-extra/lib/fs/index.js +140 -0
  171. package/dist/node_modules/fs-extra/lib/index.js +1 -0
  172. package/dist/node_modules/fs-extra/lib/json/index.js +16 -0
  173. package/dist/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  174. package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  175. package/dist/node_modules/fs-extra/lib/json/output-json.js +12 -0
  176. package/dist/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  177. package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  178. package/dist/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  179. package/dist/node_modules/fs-extra/lib/move/index.js +7 -0
  180. package/dist/node_modules/fs-extra/lib/move/move-sync.js +55 -0
  181. package/dist/node_modules/fs-extra/lib/move/move.js +59 -0
  182. package/dist/node_modules/fs-extra/lib/output-file/index.js +31 -0
  183. package/dist/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  184. package/dist/node_modules/fs-extra/lib/remove/index.js +17 -0
  185. package/dist/node_modules/fs-extra/lib/util/stat.js +158 -0
  186. package/dist/node_modules/fs-extra/lib/util/utimes.js +36 -0
  187. package/dist/node_modules/fs-extra/package.json +1 -0
  188. package/dist/server/actions/departments.d.ts +5 -0
  189. package/dist/server/actions/departments.js +105 -0
  190. package/dist/server/actions/index.d.ts +7 -0
  191. package/dist/server/actions/index.js +33 -0
  192. package/dist/server/actions/link-manager-controller.d.ts +6 -0
  193. package/dist/server/actions/link-manager-controller.js +133 -0
  194. package/dist/server/actions/plugin-version.d.ts +6 -0
  195. package/dist/server/actions/plugin-version.js +91 -0
  196. package/dist/server/actions/robot-controller.d.ts +5 -0
  197. package/dist/server/actions/robot-controller.js +134 -0
  198. package/dist/server/actions/system-message-controller.d.ts +5 -0
  199. package/dist/server/actions/system-message-controller.js +106 -0
  200. package/dist/server/actions/token-configuration-controller.d.ts +5 -0
  201. package/dist/server/actions/token-configuration-controller.js +120 -0
  202. package/dist/server/actions/users.d.ts +4 -0
  203. package/dist/server/actions/users.js +142 -0
  204. package/dist/server/collections/departmentRoles.d.ts +2 -0
  205. package/dist/server/collections/departmentRoles.js +27 -0
  206. package/dist/server/collections/departments.d.ts +29 -0
  207. package/dist/server/collections/departments.js +162 -0
  208. package/dist/server/collections/departmentsUsers.d.ts +2 -0
  209. package/dist/server/collections/departmentsUsers.js +43 -0
  210. package/dist/server/collections/link-manage.d.ts +2 -0
  211. package/dist/server/collections/link-manage.js +42 -0
  212. package/dist/server/collections/roles.d.ts +2 -0
  213. package/dist/server/collections/roles.js +39 -0
  214. package/dist/server/collections/systemSettings.d.ts +2 -0
  215. package/dist/server/collections/systemSettings.js +33 -0
  216. package/dist/server/collections/system_message.d.ts +2 -0
  217. package/dist/server/collections/system_message.js +67 -0
  218. package/dist/server/collections/token-configuration.d.ts +2 -0
  219. package/dist/server/collections/token-configuration.js +54 -0
  220. package/dist/server/collections/users.d.ts +55 -0
  221. package/dist/server/collections/users.js +87 -0
  222. package/dist/server/features/departments.d.ts +7 -0
  223. package/dist/server/features/departments.js +132 -0
  224. package/dist/server/fields/calc.d.ts +11 -0
  225. package/dist/server/fields/calc.js +43 -0
  226. package/dist/server/fields/tstzrange.d.ts +7 -0
  227. package/dist/server/fields/tstzrange.js +28 -0
  228. package/dist/server/index.d.ts +3 -0
  229. package/dist/server/index.js +41 -0
  230. package/dist/server/middlewares/destroy-department-check.d.ts +2 -0
  231. package/dist/server/middlewares/destroy-department-check.js +53 -0
  232. package/dist/server/middlewares/index.d.ts +6 -0
  233. package/dist/server/middlewares/index.js +31 -0
  234. package/dist/server/middlewares/list-users-include-child-department.d.ts +2 -0
  235. package/dist/server/middlewares/list-users-include-child-department.js +77 -0
  236. package/dist/server/middlewares/reset-user-departments-cache.d.ts +2 -0
  237. package/dist/server/middlewares/reset-user-departments-cache.js +39 -0
  238. package/dist/server/middlewares/set-department-owners.d.ts +2 -0
  239. package/dist/server/middlewares/set-department-owners.js +74 -0
  240. package/dist/server/middlewares/set-departments-roles.d.ts +2 -0
  241. package/dist/server/middlewares/set-departments-roles.js +64 -0
  242. package/dist/server/middlewares/set-main-department.d.ts +2 -0
  243. package/dist/server/middlewares/set-main-department.js +105 -0
  244. package/dist/server/middlewares/update-department-isleaf.d.ts +2 -0
  245. package/dist/server/middlewares/update-department-isleaf.js +84 -0
  246. package/dist/server/models/department.d.ts +4 -0
  247. package/dist/server/models/department.js +38 -0
  248. package/dist/server/plugin.d.ts +6 -0
  249. package/dist/server/plugin.js +111 -0
  250. package/dist/server/services/plugin-version.d.ts +5 -0
  251. package/dist/server/services/plugin-version.js +89 -0
  252. package/dist/server/services/sql-loader.d.ts +10 -0
  253. package/dist/server/services/sql-loader.js +129 -0
  254. package/dist/server/services/system-setting-service.d.ts +7 -0
  255. package/dist/server/services/system-setting-service.js +87 -0
  256. package/dist/server/utils/curren-formula.d.ts +1 -0
  257. package/dist/server/utils/curren-formula.js +30 -0
  258. package/dist/server/utils/multiprocess.d.ts +2 -0
  259. package/dist/server/utils/multiprocess.js +38 -0
  260. package/package.json +64 -0
  261. package/server.d.ts +2 -0
  262. package/server.js +1 -0
@@ -0,0 +1,64 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromPromise
4
+ const path = require('path')
5
+ const fs = require('../fs')
6
+ const mkdir = require('../mkdirs')
7
+ const { pathExists } = require('../path-exists')
8
+ const { areIdentical } = require('../util/stat')
9
+
10
+ async function createLink (srcpath, dstpath) {
11
+ let dstStat
12
+ try {
13
+ dstStat = await fs.lstat(dstpath)
14
+ } catch {
15
+ // ignore error
16
+ }
17
+
18
+ let srcStat
19
+ try {
20
+ srcStat = await fs.lstat(srcpath)
21
+ } catch (err) {
22
+ err.message = err.message.replace('lstat', 'ensureLink')
23
+ throw err
24
+ }
25
+
26
+ if (dstStat && areIdentical(srcStat, dstStat)) return
27
+
28
+ const dir = path.dirname(dstpath)
29
+
30
+ const dirExists = await pathExists(dir)
31
+
32
+ if (!dirExists) {
33
+ await mkdir.mkdirs(dir)
34
+ }
35
+
36
+ await fs.link(srcpath, dstpath)
37
+ }
38
+
39
+ function createLinkSync (srcpath, dstpath) {
40
+ let dstStat
41
+ try {
42
+ dstStat = fs.lstatSync(dstpath)
43
+ } catch {}
44
+
45
+ try {
46
+ const srcStat = fs.lstatSync(srcpath)
47
+ if (dstStat && areIdentical(srcStat, dstStat)) return
48
+ } catch (err) {
49
+ err.message = err.message.replace('lstat', 'ensureLink')
50
+ throw err
51
+ }
52
+
53
+ const dir = path.dirname(dstpath)
54
+ const dirExists = fs.existsSync(dir)
55
+ if (dirExists) return fs.linkSync(srcpath, dstpath)
56
+ mkdir.mkdirsSync(dir)
57
+
58
+ return fs.linkSync(srcpath, dstpath)
59
+ }
60
+
61
+ module.exports = {
62
+ createLink: u(createLink),
63
+ createLinkSync
64
+ }
@@ -0,0 +1,101 @@
1
+ 'use strict'
2
+
3
+ const path = require('path')
4
+ const fs = require('../fs')
5
+ const { pathExists } = require('../path-exists')
6
+
7
+ const u = require('universalify').fromPromise
8
+
9
+ /**
10
+ * Function that returns two types of paths, one relative to symlink, and one
11
+ * relative to the current working directory. Checks if path is absolute or
12
+ * relative. If the path is relative, this function checks if the path is
13
+ * relative to symlink or relative to current working directory. This is an
14
+ * initiative to find a smarter `srcpath` to supply when building symlinks.
15
+ * This allows you to determine which path to use out of one of three possible
16
+ * types of source paths. The first is an absolute path. This is detected by
17
+ * `path.isAbsolute()`. When an absolute path is provided, it is checked to
18
+ * see if it exists. If it does it's used, if not an error is returned
19
+ * (callback)/ thrown (sync). The other two options for `srcpath` are a
20
+ * relative url. By default Node's `fs.symlink` works by creating a symlink
21
+ * using `dstpath` and expects the `srcpath` to be relative to the newly
22
+ * created symlink. If you provide a `srcpath` that does not exist on the file
23
+ * system it results in a broken symlink. To minimize this, the function
24
+ * checks to see if the 'relative to symlink' source file exists, and if it
25
+ * does it will use it. If it does not, it checks if there's a file that
26
+ * exists that is relative to the current working directory, if does its used.
27
+ * This preserves the expectations of the original fs.symlink spec and adds
28
+ * the ability to pass in `relative to current working direcotry` paths.
29
+ */
30
+
31
+ async function symlinkPaths (srcpath, dstpath) {
32
+ if (path.isAbsolute(srcpath)) {
33
+ try {
34
+ await fs.lstat(srcpath)
35
+ } catch (err) {
36
+ err.message = err.message.replace('lstat', 'ensureSymlink')
37
+ throw err
38
+ }
39
+
40
+ return {
41
+ toCwd: srcpath,
42
+ toDst: srcpath
43
+ }
44
+ }
45
+
46
+ const dstdir = path.dirname(dstpath)
47
+ const relativeToDst = path.join(dstdir, srcpath)
48
+
49
+ const exists = await pathExists(relativeToDst)
50
+ if (exists) {
51
+ return {
52
+ toCwd: relativeToDst,
53
+ toDst: srcpath
54
+ }
55
+ }
56
+
57
+ try {
58
+ await fs.lstat(srcpath)
59
+ } catch (err) {
60
+ err.message = err.message.replace('lstat', 'ensureSymlink')
61
+ throw err
62
+ }
63
+
64
+ return {
65
+ toCwd: srcpath,
66
+ toDst: path.relative(dstdir, srcpath)
67
+ }
68
+ }
69
+
70
+ function symlinkPathsSync (srcpath, dstpath) {
71
+ if (path.isAbsolute(srcpath)) {
72
+ const exists = fs.existsSync(srcpath)
73
+ if (!exists) throw new Error('absolute srcpath does not exist')
74
+ return {
75
+ toCwd: srcpath,
76
+ toDst: srcpath
77
+ }
78
+ }
79
+
80
+ const dstdir = path.dirname(dstpath)
81
+ const relativeToDst = path.join(dstdir, srcpath)
82
+ const exists = fs.existsSync(relativeToDst)
83
+ if (exists) {
84
+ return {
85
+ toCwd: relativeToDst,
86
+ toDst: srcpath
87
+ }
88
+ }
89
+
90
+ const srcExists = fs.existsSync(srcpath)
91
+ if (!srcExists) throw new Error('relative srcpath does not exist')
92
+ return {
93
+ toCwd: srcpath,
94
+ toDst: path.relative(dstdir, srcpath)
95
+ }
96
+ }
97
+
98
+ module.exports = {
99
+ symlinkPaths: u(symlinkPaths),
100
+ symlinkPathsSync
101
+ }
@@ -0,0 +1,34 @@
1
+ 'use strict'
2
+
3
+ const fs = require('../fs')
4
+ const u = require('universalify').fromPromise
5
+
6
+ async function symlinkType (srcpath, type) {
7
+ if (type) return type
8
+
9
+ let stats
10
+ try {
11
+ stats = await fs.lstat(srcpath)
12
+ } catch {
13
+ return 'file'
14
+ }
15
+
16
+ return (stats && stats.isDirectory()) ? 'dir' : 'file'
17
+ }
18
+
19
+ function symlinkTypeSync (srcpath, type) {
20
+ if (type) return type
21
+
22
+ let stats
23
+ try {
24
+ stats = fs.lstatSync(srcpath)
25
+ } catch {
26
+ return 'file'
27
+ }
28
+ return (stats && stats.isDirectory()) ? 'dir' : 'file'
29
+ }
30
+
31
+ module.exports = {
32
+ symlinkType: u(symlinkType),
33
+ symlinkTypeSync
34
+ }
@@ -0,0 +1,67 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromPromise
4
+ const path = require('path')
5
+ const fs = require('../fs')
6
+
7
+ const { mkdirs, mkdirsSync } = require('../mkdirs')
8
+
9
+ const { symlinkPaths, symlinkPathsSync } = require('./symlink-paths')
10
+ const { symlinkType, symlinkTypeSync } = require('./symlink-type')
11
+
12
+ const { pathExists } = require('../path-exists')
13
+
14
+ const { areIdentical } = require('../util/stat')
15
+
16
+ async function createSymlink (srcpath, dstpath, type) {
17
+ let stats
18
+ try {
19
+ stats = await fs.lstat(dstpath)
20
+ } catch { }
21
+
22
+ if (stats && stats.isSymbolicLink()) {
23
+ const [srcStat, dstStat] = await Promise.all([
24
+ fs.stat(srcpath),
25
+ fs.stat(dstpath)
26
+ ])
27
+
28
+ if (areIdentical(srcStat, dstStat)) return
29
+ }
30
+
31
+ const relative = await symlinkPaths(srcpath, dstpath)
32
+ srcpath = relative.toDst
33
+ const toType = await symlinkType(relative.toCwd, type)
34
+ const dir = path.dirname(dstpath)
35
+
36
+ if (!(await pathExists(dir))) {
37
+ await mkdirs(dir)
38
+ }
39
+
40
+ return fs.symlink(srcpath, dstpath, toType)
41
+ }
42
+
43
+ function createSymlinkSync (srcpath, dstpath, type) {
44
+ let stats
45
+ try {
46
+ stats = fs.lstatSync(dstpath)
47
+ } catch { }
48
+ if (stats && stats.isSymbolicLink()) {
49
+ const srcStat = fs.statSync(srcpath)
50
+ const dstStat = fs.statSync(dstpath)
51
+ if (areIdentical(srcStat, dstStat)) return
52
+ }
53
+
54
+ const relative = symlinkPathsSync(srcpath, dstpath)
55
+ srcpath = relative.toDst
56
+ type = symlinkTypeSync(relative.toCwd, type)
57
+ const dir = path.dirname(dstpath)
58
+ const exists = fs.existsSync(dir)
59
+ if (exists) return fs.symlinkSync(srcpath, dstpath, type)
60
+ mkdirsSync(dir)
61
+ return fs.symlinkSync(srcpath, dstpath, type)
62
+ }
63
+
64
+ module.exports = {
65
+ createSymlink: u(createSymlink),
66
+ createSymlinkSync
67
+ }
@@ -0,0 +1,140 @@
1
+ 'use strict'
2
+ // This is adapted from https://github.com/normalize/mz
3
+ // Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
4
+ const u = require('universalify').fromCallback
5
+ const fs = require('graceful-fs')
6
+
7
+ const api = [
8
+ 'access',
9
+ 'appendFile',
10
+ 'chmod',
11
+ 'chown',
12
+ 'close',
13
+ 'copyFile',
14
+ 'fchmod',
15
+ 'fchown',
16
+ 'fdatasync',
17
+ 'fstat',
18
+ 'fsync',
19
+ 'ftruncate',
20
+ 'futimes',
21
+ 'lchmod',
22
+ 'lchown',
23
+ 'link',
24
+ 'lstat',
25
+ 'mkdir',
26
+ 'mkdtemp',
27
+ 'open',
28
+ 'opendir',
29
+ 'readdir',
30
+ 'readFile',
31
+ 'readlink',
32
+ 'realpath',
33
+ 'rename',
34
+ 'rm',
35
+ 'rmdir',
36
+ 'stat',
37
+ 'symlink',
38
+ 'truncate',
39
+ 'unlink',
40
+ 'utimes',
41
+ 'writeFile'
42
+ ].filter(key => {
43
+ // Some commands are not available on some systems. Ex:
44
+ // fs.cp was added in Node.js v16.7.0
45
+ // fs.lchown is not available on at least some Linux
46
+ return typeof fs[key] === 'function'
47
+ })
48
+
49
+ // Export cloned fs:
50
+ Object.assign(exports, fs)
51
+
52
+ // Universalify async methods:
53
+ api.forEach(method => {
54
+ exports[method] = u(fs[method])
55
+ })
56
+
57
+ // We differ from mz/fs in that we still ship the old, broken, fs.exists()
58
+ // since we are a drop-in replacement for the native module
59
+ exports.exists = function (filename, callback) {
60
+ if (typeof callback === 'function') {
61
+ return fs.exists(filename, callback)
62
+ }
63
+ return new Promise(resolve => {
64
+ return fs.exists(filename, resolve)
65
+ })
66
+ }
67
+
68
+ // fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args
69
+
70
+ exports.read = function (fd, buffer, offset, length, position, callback) {
71
+ if (typeof callback === 'function') {
72
+ return fs.read(fd, buffer, offset, length, position, callback)
73
+ }
74
+ return new Promise((resolve, reject) => {
75
+ fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
76
+ if (err) return reject(err)
77
+ resolve({ bytesRead, buffer })
78
+ })
79
+ })
80
+ }
81
+
82
+ // Function signature can be
83
+ // fs.write(fd, buffer[, offset[, length[, position]]], callback)
84
+ // OR
85
+ // fs.write(fd, string[, position[, encoding]], callback)
86
+ // We need to handle both cases, so we use ...args
87
+ exports.write = function (fd, buffer, ...args) {
88
+ if (typeof args[args.length - 1] === 'function') {
89
+ return fs.write(fd, buffer, ...args)
90
+ }
91
+
92
+ return new Promise((resolve, reject) => {
93
+ fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
94
+ if (err) return reject(err)
95
+ resolve({ bytesWritten, buffer })
96
+ })
97
+ })
98
+ }
99
+
100
+ // Function signature is
101
+ // s.readv(fd, buffers[, position], callback)
102
+ // We need to handle the optional arg, so we use ...args
103
+ exports.readv = function (fd, buffers, ...args) {
104
+ if (typeof args[args.length - 1] === 'function') {
105
+ return fs.readv(fd, buffers, ...args)
106
+ }
107
+
108
+ return new Promise((resolve, reject) => {
109
+ fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
110
+ if (err) return reject(err)
111
+ resolve({ bytesRead, buffers })
112
+ })
113
+ })
114
+ }
115
+
116
+ // Function signature is
117
+ // s.writev(fd, buffers[, position], callback)
118
+ // We need to handle the optional arg, so we use ...args
119
+ exports.writev = function (fd, buffers, ...args) {
120
+ if (typeof args[args.length - 1] === 'function') {
121
+ return fs.writev(fd, buffers, ...args)
122
+ }
123
+
124
+ return new Promise((resolve, reject) => {
125
+ fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
126
+ if (err) return reject(err)
127
+ resolve({ bytesWritten, buffers })
128
+ })
129
+ })
130
+ }
131
+
132
+ // fs.realpath.native sometimes not available if fs is monkey-patched
133
+ if (typeof fs.realpath.native === 'function') {
134
+ exports.realpath.native = u(fs.realpath.native)
135
+ } else {
136
+ process.emitWarning(
137
+ 'fs.realpath.native is not a function. Is fs being monkey-patched?',
138
+ 'Warning', 'fs-extra-WARN0003'
139
+ )
140
+ }
@@ -0,0 +1 @@
1
+ (function(){var t={533:function(t,e,n){"use strict";const r=n(551);const i=n(928);const o=n(923).mkdirsSync;const c=n(592).utimesMillisSync;const s=n(81);function copySync(t,e,n){if(typeof n==="function"){n={filter:n}}n=n||{};n.clobber="clobber"in n?!!n.clobber:true;n.overwrite="overwrite"in n?!!n.overwrite:n.clobber;if(n.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002")}const{srcStat:c,destStat:a}=s.checkPathsSync(t,e,"copy",n);s.checkParentPathsSync(t,c,e,"copy");if(n.filter&&!n.filter(t,e))return;const u=i.dirname(e);if(!r.existsSync(u))o(u);return getStats(a,t,e,n)}function getStats(t,e,n,i){const o=i.dereference?r.statSync:r.lstatSync;const c=o(e);if(c.isDirectory())return onDir(c,t,e,n,i);else if(c.isFile()||c.isCharacterDevice()||c.isBlockDevice())return onFile(c,t,e,n,i);else if(c.isSymbolicLink())return onLink(t,e,n,i);else if(c.isSocket())throw new Error(`Cannot copy a socket file: ${e}`);else if(c.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${e}`);throw new Error(`Unknown file: ${e}`)}function onFile(t,e,n,r,i){if(!e)return copyFile(t,n,r,i);return mayCopyFile(t,n,r,i)}function mayCopyFile(t,e,n,i){if(i.overwrite){r.unlinkSync(n);return copyFile(t,e,n,i)}else if(i.errorOnExist){throw new Error(`'${n}' already exists`)}}function copyFile(t,e,n,i){r.copyFileSync(e,n);if(i.preserveTimestamps)handleTimestamps(t.mode,e,n);return setDestMode(n,t.mode)}function handleTimestamps(t,e,n){if(fileIsNotWritable(t))makeFileWritable(n,t);return setDestTimestamps(e,n)}function fileIsNotWritable(t){return(t&128)===0}function makeFileWritable(t,e){return setDestMode(t,e|128)}function setDestMode(t,e){return r.chmodSync(t,e)}function setDestTimestamps(t,e){const n=r.statSync(t);return c(e,n.atime,n.mtime)}function onDir(t,e,n,r,i){if(!e)return mkDirAndCopy(t.mode,n,r,i);return copyDir(n,r,i)}function mkDirAndCopy(t,e,n,i){r.mkdirSync(n);copyDir(e,n,i);return setDestMode(n,t)}function copyDir(t,e,n){r.readdirSync(t).forEach((r=>copyDirItem(r,t,e,n)))}function copyDirItem(t,e,n,r){const o=i.join(e,t);const c=i.join(n,t);if(r.filter&&!r.filter(o,c))return;const{destStat:a}=s.checkPathsSync(o,c,"copy",r);return getStats(a,o,c,r)}function onLink(t,e,n,o){let c=r.readlinkSync(e);if(o.dereference){c=i.resolve(process.cwd(),c)}if(!t){return r.symlinkSync(c,n)}else{let t;try{t=r.readlinkSync(n)}catch(t){if(t.code==="EINVAL"||t.code==="UNKNOWN")return r.symlinkSync(c,n);throw t}if(o.dereference){t=i.resolve(process.cwd(),t)}if(s.isSrcSubdir(c,t)){throw new Error(`Cannot copy '${c}' to a subdirectory of itself, '${t}'.`)}if(s.isSrcSubdir(t,c)){throw new Error(`Cannot overwrite '${t}' with '${c}'.`)}return copyLink(c,n)}}function copyLink(t,e){r.unlinkSync(e);return r.symlinkSync(t,e)}t.exports=copySync},597:function(t,e,n){"use strict";const r=n(312);const i=n(928);const{mkdirs:o}=n(923);const{pathExists:c}=n(467);const{utimesMillis:s}=n(592);const a=n(81);async function copy(t,e,n={}){if(typeof n==="function"){n={filter:n}}n.clobber="clobber"in n?!!n.clobber:true;n.overwrite="overwrite"in n?!!n.overwrite:n.clobber;if(n.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001")}const{srcStat:r,destStat:s}=await a.checkPaths(t,e,"copy",n);await a.checkParentPaths(t,r,e,"copy");const u=await runFilter(t,e,n);if(!u)return;const f=i.dirname(e);const l=await c(f);if(!l){await o(f)}await getStatsAndPerformCopy(s,t,e,n)}async function runFilter(t,e,n){if(!n.filter)return true;return n.filter(t,e)}async function getStatsAndPerformCopy(t,e,n,i){const o=i.dereference?r.stat:r.lstat;const c=await o(e);if(c.isDirectory())return onDir(c,t,e,n,i);if(c.isFile()||c.isCharacterDevice()||c.isBlockDevice())return onFile(c,t,e,n,i);if(c.isSymbolicLink())return onLink(t,e,n,i);if(c.isSocket())throw new Error(`Cannot copy a socket file: ${e}`);if(c.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${e}`);throw new Error(`Unknown file: ${e}`)}async function onFile(t,e,n,i,o){if(!e)return copyFile(t,n,i,o);if(o.overwrite){await r.unlink(i);return copyFile(t,n,i,o)}if(o.errorOnExist){throw new Error(`'${i}' already exists`)}}async function copyFile(t,e,n,i){await r.copyFile(e,n);if(i.preserveTimestamps){if(fileIsNotWritable(t.mode)){await makeFileWritable(n,t.mode)}const i=await r.stat(e);await s(n,i.atime,i.mtime)}return r.chmod(n,t.mode)}function fileIsNotWritable(t){return(t&128)===0}function makeFileWritable(t,e){return r.chmod(t,e|128)}async function onDir(t,e,n,o,c){if(!e){await r.mkdir(o)}const s=await r.readdir(n);await Promise.all(s.map((async t=>{const e=i.join(n,t);const r=i.join(o,t);const s=await runFilter(e,r,c);if(!s)return;const{destStat:u}=await a.checkPaths(e,r,"copy",c);return getStatsAndPerformCopy(u,e,r,c)})));if(!e){await r.chmod(o,t.mode)}}async function onLink(t,e,n,o){let c=await r.readlink(e);if(o.dereference){c=i.resolve(process.cwd(),c)}if(!t){return r.symlink(c,n)}let s=null;try{s=await r.readlink(n)}catch(t){if(t.code==="EINVAL"||t.code==="UNKNOWN")return r.symlink(c,n);throw t}if(o.dereference){s=i.resolve(process.cwd(),s)}if(a.isSrcSubdir(c,s)){throw new Error(`Cannot copy '${c}' to a subdirectory of itself, '${s}'.`)}if(a.isSrcSubdir(s,c)){throw new Error(`Cannot overwrite '${s}' with '${c}'.`)}await r.unlink(n);return r.symlink(c,n)}t.exports=copy},394:function(t,e,n){"use strict";const r=n(327).fromPromise;t.exports={copy:r(n(597)),copySync:n(533)}},60:function(t,e,n){"use strict";const r=n(327).fromPromise;const i=n(312);const o=n(928);const c=n(923);const s=n(887);const a=r((async function emptyDir(t){let e;try{e=await i.readdir(t)}catch{return c.mkdirs(t)}return Promise.all(e.map((e=>s.remove(o.join(t,e)))))}));function emptyDirSync(t){let e;try{e=i.readdirSync(t)}catch{return c.mkdirsSync(t)}e.forEach((e=>{e=o.join(t,e);s.removeSync(e)}))}t.exports={emptyDirSync:emptyDirSync,emptydirSync:emptyDirSync,emptyDir:a,emptydir:a}},111:function(t,e,n){"use strict";const r=n(327).fromPromise;const i=n(928);const o=n(312);const c=n(923);async function createFile(t){let e;try{e=await o.stat(t)}catch{}if(e&&e.isFile())return;const n=i.dirname(t);let r=null;try{r=await o.stat(n)}catch(e){if(e.code==="ENOENT"){await c.mkdirs(n);await o.writeFile(t,"");return}else{throw e}}if(r.isDirectory()){await o.writeFile(t,"")}else{await o.readdir(n)}}function createFileSync(t){let e;try{e=o.statSync(t)}catch{}if(e&&e.isFile())return;const n=i.dirname(t);try{if(!o.statSync(n).isDirectory()){o.readdirSync(n)}}catch(t){if(t&&t.code==="ENOENT")c.mkdirsSync(n);else throw t}o.writeFileSync(t,"")}t.exports={createFile:r(createFile),createFileSync:createFileSync}},845:function(t,e,n){"use strict";const{createFile:r,createFileSync:i}=n(111);const{createLink:o,createLinkSync:c}=n(825);const{createSymlink:s,createSymlinkSync:a}=n(554);t.exports={createFile:r,createFileSync:i,ensureFile:r,ensureFileSync:i,createLink:o,createLinkSync:c,ensureLink:o,ensureLinkSync:c,createSymlink:s,createSymlinkSync:a,ensureSymlink:s,ensureSymlinkSync:a}},825:function(t,e,n){"use strict";const r=n(327).fromPromise;const i=n(928);const o=n(312);const c=n(923);const{pathExists:s}=n(467);const{areIdentical:a}=n(81);async function createLink(t,e){let n;try{n=await o.lstat(e)}catch{}let r;try{r=await o.lstat(t)}catch(t){t.message=t.message.replace("lstat","ensureLink");throw t}if(n&&a(r,n))return;const u=i.dirname(e);const f=await s(u);if(!f){await c.mkdirs(u)}await o.link(t,e)}function createLinkSync(t,e){let n;try{n=o.lstatSync(e)}catch{}try{const e=o.lstatSync(t);if(n&&a(e,n))return}catch(t){t.message=t.message.replace("lstat","ensureLink");throw t}const r=i.dirname(e);const s=o.existsSync(r);if(s)return o.linkSync(t,e);c.mkdirsSync(r);return o.linkSync(t,e)}t.exports={createLink:r(createLink),createLinkSync:createLinkSync}},599:function(t,e,n){"use strict";const r=n(928);const i=n(312);const{pathExists:o}=n(467);const c=n(327).fromPromise;async function symlinkPaths(t,e){if(r.isAbsolute(t)){try{await i.lstat(t)}catch(t){t.message=t.message.replace("lstat","ensureSymlink");throw t}return{toCwd:t,toDst:t}}const n=r.dirname(e);const c=r.join(n,t);const s=await o(c);if(s){return{toCwd:c,toDst:t}}try{await i.lstat(t)}catch(t){t.message=t.message.replace("lstat","ensureSymlink");throw t}return{toCwd:t,toDst:r.relative(n,t)}}function symlinkPathsSync(t,e){if(r.isAbsolute(t)){const e=i.existsSync(t);if(!e)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}const n=r.dirname(e);const o=r.join(n,t);const c=i.existsSync(o);if(c){return{toCwd:o,toDst:t}}const s=i.existsSync(t);if(!s)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:r.relative(n,t)}}t.exports={symlinkPaths:c(symlinkPaths),symlinkPathsSync:symlinkPathsSync}},563:function(t,e,n){"use strict";const r=n(312);const i=n(327).fromPromise;async function symlinkType(t,e){if(e)return e;let n;try{n=await r.lstat(t)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}function symlinkTypeSync(t,e){if(e)return e;let n;try{n=r.lstatSync(t)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}t.exports={symlinkType:i(symlinkType),symlinkTypeSync:symlinkTypeSync}},554:function(t,e,n){"use strict";const r=n(327).fromPromise;const i=n(928);const o=n(312);const{mkdirs:c,mkdirsSync:s}=n(923);const{symlinkPaths:a,symlinkPathsSync:u}=n(599);const{symlinkType:f,symlinkTypeSync:l}=n(563);const{pathExists:y}=n(467);const{areIdentical:p}=n(81);async function createSymlink(t,e,n){let r;try{r=await o.lstat(e)}catch{}if(r&&r.isSymbolicLink()){const[n,r]=await Promise.all([o.stat(t),o.stat(e)]);if(p(n,r))return}const s=await a(t,e);t=s.toDst;const u=await f(s.toCwd,n);const l=i.dirname(e);if(!await y(l)){await c(l)}return o.symlink(t,e,u)}function createSymlinkSync(t,e,n){let r;try{r=o.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){const n=o.statSync(t);const r=o.statSync(e);if(p(n,r))return}const c=u(t,e);t=c.toDst;n=l(c.toCwd,n);const a=i.dirname(e);const f=o.existsSync(a);if(f)return o.symlinkSync(t,e,n);s(a);return o.symlinkSync(t,e,n)}t.exports={createSymlink:r(createSymlink),createSymlinkSync:createSymlinkSync}},312:function(t,e,n){"use strict";const r=n(327).fromCallback;const i=n(551);const o=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((t=>typeof i[t]==="function"));Object.assign(e,i);o.forEach((t=>{e[t]=r(i[t])}));e.exists=function(t,e){if(typeof e==="function"){return i.exists(t,e)}return new Promise((e=>i.exists(t,e)))};e.read=function(t,e,n,r,o,c){if(typeof c==="function"){return i.read(t,e,n,r,o,c)}return new Promise(((c,s)=>{i.read(t,e,n,r,o,((t,e,n)=>{if(t)return s(t);c({bytesRead:e,buffer:n})}))}))};e.write=function(t,e,...n){if(typeof n[n.length-1]==="function"){return i.write(t,e,...n)}return new Promise(((r,o)=>{i.write(t,e,...n,((t,e,n)=>{if(t)return o(t);r({bytesWritten:e,buffer:n})}))}))};e.readv=function(t,e,...n){if(typeof n[n.length-1]==="function"){return i.readv(t,e,...n)}return new Promise(((r,o)=>{i.readv(t,e,...n,((t,e,n)=>{if(t)return o(t);r({bytesRead:e,buffers:n})}))}))};e.writev=function(t,e,...n){if(typeof n[n.length-1]==="function"){return i.writev(t,e,...n)}return new Promise(((r,o)=>{i.writev(t,e,...n,((t,e,n)=>{if(t)return o(t);r({bytesWritten:e,buffers:n})}))}))};if(typeof i.realpath.native==="function"){e.realpath.native=r(i.realpath.native)}else{process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}},278:function(t,e,n){"use strict";t.exports={...n(312),...n(394),...n(60),...n(845),...n(333),...n(923),...n(66),...n(175),...n(467),...n(887)}},333:function(t,e,n){"use strict";const r=n(327).fromPromise;const i=n(393);i.outputJson=r(n(919));i.outputJsonSync=n(951);i.outputJSON=i.outputJson;i.outputJSONSync=i.outputJsonSync;i.writeJSON=i.writeJson;i.writeJSONSync=i.writeJsonSync;i.readJSON=i.readJson;i.readJSONSync=i.readJsonSync;t.exports=i},393:function(t,e,n){"use strict";const r=n(535);t.exports={readJson:r.readFile,readJsonSync:r.readFileSync,writeJson:r.writeFile,writeJsonSync:r.writeFileSync}},951:function(t,e,n){"use strict";const{stringify:r}=n(306);const{outputFileSync:i}=n(175);function outputJsonSync(t,e,n){const o=r(e,n);i(t,o,n)}t.exports=outputJsonSync},919:function(t,e,n){"use strict";const{stringify:r}=n(306);const{outputFile:i}=n(175);async function outputJson(t,e,n={}){const o=r(e,n);await i(t,o,n)}t.exports=outputJson},923:function(t,e,n){"use strict";const r=n(327).fromPromise;const{makeDir:i,makeDirSync:o}=n(43);const c=r(i);t.exports={mkdirs:c,mkdirsSync:o,mkdirp:c,mkdirpSync:o,ensureDir:c,ensureDirSync:o}},43:function(t,e,n){"use strict";const r=n(312);const{checkPath:i}=n(806);const getMode=t=>{const e={mode:511};if(typeof t==="number")return t;return{...e,...t}.mode};t.exports.makeDir=async(t,e)=>{i(t);return r.mkdir(t,{mode:getMode(e),recursive:true})};t.exports.makeDirSync=(t,e)=>{i(t);return r.mkdirSync(t,{mode:getMode(e),recursive:true})}},806:function(t,e,n){"use strict";const r=n(928);t.exports.checkPath=function checkPath(t){if(process.platform==="win32"){const e=/[<>:"|?*]/.test(t.replace(r.parse(t).root,""));if(e){const e=new Error(`Path contains invalid characters: ${t}`);e.code="EINVAL";throw e}}}},66:function(t,e,n){"use strict";const r=n(327).fromPromise;t.exports={move:r(n(949)),moveSync:n(245)}},245:function(t,e,n){"use strict";const r=n(551);const i=n(928);const o=n(394).copySync;const c=n(887).removeSync;const s=n(923).mkdirpSync;const a=n(81);function moveSync(t,e,n){n=n||{};const r=n.overwrite||n.clobber||false;const{srcStat:o,isChangingCase:c=false}=a.checkPathsSync(t,e,"move",n);a.checkParentPathsSync(t,o,e,"move");if(!isParentRoot(e))s(i.dirname(e));return doRename(t,e,r,c)}function isParentRoot(t){const e=i.dirname(t);const n=i.parse(e);return n.root===e}function doRename(t,e,n,i){if(i)return rename(t,e,n);if(n){c(e);return rename(t,e,n)}if(r.existsSync(e))throw new Error("dest already exists.");return rename(t,e,n)}function rename(t,e,n){try{r.renameSync(t,e)}catch(r){if(r.code!=="EXDEV")throw r;return moveAcrossDevice(t,e,n)}}function moveAcrossDevice(t,e,n){const r={overwrite:n,errorOnExist:true,preserveTimestamps:true};o(t,e,r);return c(t)}t.exports=moveSync},949:function(t,e,n){"use strict";const r=n(312);const i=n(928);const{copy:o}=n(394);const{remove:c}=n(887);const{mkdirp:s}=n(923);const{pathExists:a}=n(467);const u=n(81);async function move(t,e,n={}){const r=n.overwrite||n.clobber||false;const{srcStat:o,isChangingCase:c=false}=await u.checkPaths(t,e,"move",n);await u.checkParentPaths(t,o,e,"move");const a=i.dirname(e);const f=i.parse(a);if(f.root!==a){await s(a)}return doRename(t,e,r,c)}async function doRename(t,e,n,i){if(!i){if(n){await c(e)}else if(await a(e)){throw new Error("dest already exists.")}}try{await r.rename(t,e)}catch(r){if(r.code!=="EXDEV"){throw r}await moveAcrossDevice(t,e,n)}}async function moveAcrossDevice(t,e,n){const r={overwrite:n,errorOnExist:true,preserveTimestamps:true};await o(t,e,r);return c(t)}t.exports=move},175:function(t,e,n){"use strict";const r=n(327).fromPromise;const i=n(312);const o=n(928);const c=n(923);const s=n(467).pathExists;async function outputFile(t,e,n="utf-8"){const r=o.dirname(t);if(!await s(r)){await c.mkdirs(r)}return i.writeFile(t,e,n)}function outputFileSync(t,...e){const n=o.dirname(t);if(!i.existsSync(n)){c.mkdirsSync(n)}i.writeFileSync(t,...e)}t.exports={outputFile:r(outputFile),outputFileSync:outputFileSync}},467:function(t,e,n){"use strict";const r=n(327).fromPromise;const i=n(312);function pathExists(t){return i.access(t).then((()=>true)).catch((()=>false))}t.exports={pathExists:r(pathExists),pathExistsSync:i.existsSync}},887:function(t,e,n){"use strict";const r=n(551);const i=n(327).fromCallback;function remove(t,e){r.rm(t,{recursive:true,force:true},e)}function removeSync(t){r.rmSync(t,{recursive:true,force:true})}t.exports={remove:i(remove),removeSync:removeSync}},81:function(t,e,n){"use strict";const r=n(312);const i=n(928);const o=n(327).fromPromise;function getStats(t,e,n){const i=n.dereference?t=>r.stat(t,{bigint:true}):t=>r.lstat(t,{bigint:true});return Promise.all([i(t),i(e).catch((t=>{if(t.code==="ENOENT")return null;throw t}))]).then((([t,e])=>({srcStat:t,destStat:e})))}function getStatsSync(t,e,n){let i;const o=n.dereference?t=>r.statSync(t,{bigint:true}):t=>r.lstatSync(t,{bigint:true});const c=o(t);try{i=o(e)}catch(t){if(t.code==="ENOENT")return{srcStat:c,destStat:null};throw t}return{srcStat:c,destStat:i}}async function checkPaths(t,e,n,r){const{srcStat:o,destStat:c}=await getStats(t,e,r);if(c){if(areIdentical(o,c)){const r=i.basename(t);const s=i.basename(e);if(n==="move"&&r!==s&&r.toLowerCase()===s.toLowerCase()){return{srcStat:o,destStat:c,isChangingCase:true}}throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!c.isDirectory()){throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`)}if(!o.isDirectory()&&c.isDirectory()){throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}}if(o.isDirectory()&&isSrcSubdir(t,e)){throw new Error(errMsg(t,e,n))}return{srcStat:o,destStat:c}}function checkPathsSync(t,e,n,r){const{srcStat:o,destStat:c}=getStatsSync(t,e,r);if(c){if(areIdentical(o,c)){const r=i.basename(t);const s=i.basename(e);if(n==="move"&&r!==s&&r.toLowerCase()===s.toLowerCase()){return{srcStat:o,destStat:c,isChangingCase:true}}throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!c.isDirectory()){throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`)}if(!o.isDirectory()&&c.isDirectory()){throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}}if(o.isDirectory()&&isSrcSubdir(t,e)){throw new Error(errMsg(t,e,n))}return{srcStat:o,destStat:c}}async function checkParentPaths(t,e,n,o){const c=i.resolve(i.dirname(t));const s=i.resolve(i.dirname(n));if(s===c||s===i.parse(s).root)return;let a;try{a=await r.stat(s,{bigint:true})}catch(t){if(t.code==="ENOENT")return;throw t}if(areIdentical(e,a)){throw new Error(errMsg(t,n,o))}return checkParentPaths(t,e,s,o)}function checkParentPathsSync(t,e,n,o){const c=i.resolve(i.dirname(t));const s=i.resolve(i.dirname(n));if(s===c||s===i.parse(s).root)return;let a;try{a=r.statSync(s,{bigint:true})}catch(t){if(t.code==="ENOENT")return;throw t}if(areIdentical(e,a)){throw new Error(errMsg(t,n,o))}return checkParentPathsSync(t,e,s,o)}function areIdentical(t,e){return e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev}function isSrcSubdir(t,e){const n=i.resolve(t).split(i.sep).filter((t=>t));const r=i.resolve(e).split(i.sep).filter((t=>t));return n.every(((t,e)=>r[e]===t))}function errMsg(t,e,n){return`Cannot ${n} '${t}' to a subdirectory of itself, '${e}'.`}t.exports={checkPaths:o(checkPaths),checkPathsSync:checkPathsSync,checkParentPaths:o(checkParentPaths),checkParentPathsSync:checkParentPathsSync,isSrcSubdir:isSrcSubdir,areIdentical:areIdentical}},592:function(t,e,n){"use strict";const r=n(312);const i=n(327).fromPromise;async function utimesMillis(t,e,n){const i=await r.open(t,"r+");let o=null;try{await r.futimes(i,e,n)}finally{try{await r.close(i)}catch(t){o=t}}if(o){throw o}}function utimesMillisSync(t,e,n){const i=r.openSync(t,"r+");r.futimesSync(i,e,n);return r.closeSync(i)}t.exports={utimesMillis:i(utimesMillis),utimesMillisSync:utimesMillisSync}},403:function(t){"use strict";t.exports=clone;var e=Object.getPrototypeOf||function(t){return t.__proto__};function clone(t){if(t===null||typeof t!=="object")return t;if(t instanceof Object)var n={__proto__:e(t)};else var n=Object.create(null);Object.getOwnPropertyNames(t).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}));return n}},551:function(t,e,n){var r=n(896);var i=n(538);var o=n(611);var c=n(403);var s=n(23);var a;var u;if(typeof Symbol==="function"&&typeof Symbol.for==="function"){a=Symbol.for("graceful-fs.queue");u=Symbol.for("graceful-fs.previous")}else{a="___graceful-fs.queue";u="___graceful-fs.previous"}function noop(){}function publishQueue(t,e){Object.defineProperty(t,a,{get:function(){return e}})}var f=noop;if(s.debuglog)f=s.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))f=function(){var t=s.format.apply(s,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: ");console.error(t)};if(!r[a]){var l=global[a]||[];publishQueue(r,l);r.close=function(t){function close(e,n){return t.call(r,e,(function(t){if(!t){resetQueue()}if(typeof n==="function")n.apply(this,arguments)}))}Object.defineProperty(close,u,{value:t});return close}(r.close);r.closeSync=function(t){function closeSync(e){t.apply(r,arguments);resetQueue()}Object.defineProperty(closeSync,u,{value:t});return closeSync}(r.closeSync);if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")){process.on("exit",(function(){f(r[a]);n(613).equal(r[a].length,0)}))}}if(!global[a]){publishQueue(global,r[a])}t.exports=patch(c(r));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched){t.exports=patch(r);r.__patched=true}function patch(t){i(t);t.gracefulify=patch;t.createReadStream=createReadStream;t.createWriteStream=createWriteStream;var e=t.readFile;t.readFile=readFile;function readFile(t,n,r){if(typeof n==="function")r=n,n=null;return go$readFile(t,n,r);function go$readFile(t,n,r,i){return e(t,n,(function(e){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))enqueue([go$readFile,[t,n,r],e,i||Date.now(),Date.now()]);else{if(typeof r==="function")r.apply(this,arguments)}}))}}var n=t.writeFile;t.writeFile=writeFile;function writeFile(t,e,r,i){if(typeof r==="function")i=r,r=null;return go$writeFile(t,e,r,i);function go$writeFile(t,e,r,i,o){return n(t,e,r,(function(n){if(n&&(n.code==="EMFILE"||n.code==="ENFILE"))enqueue([go$writeFile,[t,e,r,i],n,o||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}var r=t.appendFile;if(r)t.appendFile=appendFile;function appendFile(t,e,n,i){if(typeof n==="function")i=n,n=null;return go$appendFile(t,e,n,i);function go$appendFile(t,e,n,i,o){return r(t,e,n,(function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))enqueue([go$appendFile,[t,e,n,i],r,o||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}var c=t.copyFile;if(c)t.copyFile=copyFile;function copyFile(t,e,n,r){if(typeof n==="function"){r=n;n=0}return go$copyFile(t,e,n,r);function go$copyFile(t,e,n,r,i){return c(t,e,n,(function(o){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))enqueue([go$copyFile,[t,e,n,r],o,i||Date.now(),Date.now()]);else{if(typeof r==="function")r.apply(this,arguments)}}))}}var s=t.readdir;t.readdir=readdir;var a=/^v[0-5]\./;function readdir(t,e,n){if(typeof e==="function")n=e,e=null;var r=a.test(process.version)?function go$readdir(t,e,n,r){return s(t,fs$readdirCallback(t,e,n,r))}:function go$readdir(t,e,n,r){return s(t,e,fs$readdirCallback(t,e,n,r))};return r(t,e,n);function fs$readdirCallback(t,e,n,i){return function(o,c){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))enqueue([r,[t,e,n],o,i||Date.now(),Date.now()]);else{if(c&&c.sort)c.sort();if(typeof n==="function")n.call(this,o,c)}}}}if(process.version.substr(0,4)==="v0.8"){var u=o(t);ReadStream=u.ReadStream;WriteStream=u.WriteStream}var f=t.ReadStream;if(f){ReadStream.prototype=Object.create(f.prototype);ReadStream.prototype.open=ReadStream$open}var l=t.WriteStream;if(l){WriteStream.prototype=Object.create(l.prototype);WriteStream.prototype.open=WriteStream$open}Object.defineProperty(t,"ReadStream",{get:function(){return ReadStream},set:function(t){ReadStream=t},enumerable:true,configurable:true});Object.defineProperty(t,"WriteStream",{get:function(){return WriteStream},set:function(t){WriteStream=t},enumerable:true,configurable:true});var y=ReadStream;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(t){y=t},enumerable:true,configurable:true});var p=WriteStream;Object.defineProperty(t,"FileWriteStream",{get:function(){return p},set:function(t){p=t},enumerable:true,configurable:true});function ReadStream(t,e){if(this instanceof ReadStream)return f.apply(this,arguments),this;else return ReadStream.apply(Object.create(ReadStream.prototype),arguments)}function ReadStream$open(){var t=this;open(t.path,t.flags,t.mode,(function(e,n){if(e){if(t.autoClose)t.destroy();t.emit("error",e)}else{t.fd=n;t.emit("open",n);t.read()}}))}function WriteStream(t,e){if(this instanceof WriteStream)return l.apply(this,arguments),this;else return WriteStream.apply(Object.create(WriteStream.prototype),arguments)}function WriteStream$open(){var t=this;open(t.path,t.flags,t.mode,(function(e,n){if(e){t.destroy();t.emit("error",e)}else{t.fd=n;t.emit("open",n)}}))}function createReadStream(e,n){return new t.ReadStream(e,n)}function createWriteStream(e,n){return new t.WriteStream(e,n)}var m=t.open;t.open=open;function open(t,e,n,r){if(typeof n==="function")r=n,n=null;return go$open(t,e,n,r);function go$open(t,e,n,r,i){return m(t,e,n,(function(o,c){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))enqueue([go$open,[t,e,n,r],o,i||Date.now(),Date.now()]);else{if(typeof r==="function")r.apply(this,arguments)}}))}}return t}function enqueue(t){f("ENQUEUE",t[0].name,t[1]);r[a].push(t);retry()}var y;function resetQueue(){var t=Date.now();for(var e=0;e<r[a].length;++e){if(r[a][e].length>2){r[a][e][3]=t;r[a][e][4]=t}}retry()}function retry(){clearTimeout(y);y=undefined;if(r[a].length===0)return;var t=r[a].shift();var e=t[0];var n=t[1];var i=t[2];var o=t[3];var c=t[4];if(o===undefined){f("RETRY",e.name,n);e.apply(null,n)}else if(Date.now()-o>=6e4){f("TIMEOUT",e.name,n);var s=n.pop();if(typeof s==="function")s.call(null,i)}else{var u=Date.now()-c;var l=Math.max(c-o,1);var p=Math.min(l*1.2,100);if(u>=p){f("RETRY",e.name,n);e.apply(null,n.concat([o]))}else{r[a].push(t)}}if(y===undefined){y=setTimeout(retry,0)}}},611:function(t,e,n){var r=n(203).Stream;t.exports=legacy;function legacy(t){return{ReadStream:ReadStream,WriteStream:WriteStream};function ReadStream(e,n){if(!(this instanceof ReadStream))return new ReadStream(e,n);r.call(this);var i=this;this.path=e;this.fd=null;this.readable=true;this.paused=false;this.flags="r";this.mode=438;this.bufferSize=64*1024;n=n||{};var o=Object.keys(n);for(var c=0,s=o.length;c<s;c++){var a=o[c];this[a]=n[a]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==undefined){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.end===undefined){this.end=Infinity}else if("number"!==typeof this.end){throw TypeError("end must be a Number")}if(this.start>this.end){throw new Error("start must be <= end")}this.pos=this.start}if(this.fd!==null){process.nextTick((function(){i._read()}));return}t.open(this.path,this.flags,this.mode,(function(t,e){if(t){i.emit("error",t);i.readable=false;return}i.fd=e;i.emit("open",e);i._read()}))}function WriteStream(e,n){if(!(this instanceof WriteStream))return new WriteStream(e,n);r.call(this);this.path=e;this.fd=null;this.writable=true;this.flags="w";this.encoding="binary";this.mode=438;this.bytesWritten=0;n=n||{};var i=Object.keys(n);for(var o=0,c=i.length;o<c;o++){var s=i[o];this[s]=n[s]}if(this.start!==undefined){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.start<0){throw new Error("start must be >= zero")}this.pos=this.start}this.busy=false;this._queue=[];if(this.fd===null){this._open=t.open;this._queue.push([this._open,this.path,this.flags,this.mode,undefined]);this.flush()}}}},538:function(t,e,n){var r=n(140);var i=process.cwd;var o=null;var c=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!o)o=i.call(process);return o};try{process.cwd()}catch(t){}if(typeof process.chdir==="function"){var s=process.chdir;process.chdir=function(t){o=null;s.call(process,t)};if(Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,s)}t.exports=patch;function patch(t){if(r.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)){patchLchmod(t)}if(!t.lutimes){patchLutimes(t)}t.chown=chownFix(t.chown);t.fchown=chownFix(t.fchown);t.lchown=chownFix(t.lchown);t.chmod=chmodFix(t.chmod);t.fchmod=chmodFix(t.fchmod);t.lchmod=chmodFix(t.lchmod);t.chownSync=chownFixSync(t.chownSync);t.fchownSync=chownFixSync(t.fchownSync);t.lchownSync=chownFixSync(t.lchownSync);t.chmodSync=chmodFixSync(t.chmodSync);t.fchmodSync=chmodFixSync(t.fchmodSync);t.lchmodSync=chmodFixSync(t.lchmodSync);t.stat=statFix(t.stat);t.fstat=statFix(t.fstat);t.lstat=statFix(t.lstat);t.statSync=statFixSync(t.statSync);t.fstatSync=statFixSync(t.fstatSync);t.lstatSync=statFixSync(t.lstatSync);if(t.chmod&&!t.lchmod){t.lchmod=function(t,e,n){if(n)process.nextTick(n)};t.lchmodSync=function(){}}if(t.chown&&!t.lchown){t.lchown=function(t,e,n,r){if(r)process.nextTick(r)};t.lchownSync=function(){}}if(c==="win32"){t.rename=typeof t.rename!=="function"?t.rename:function(e){function rename(n,r,i){var o=Date.now();var c=0;e(n,r,(function CB(s){if(s&&(s.code==="EACCES"||s.code==="EPERM"||s.code==="EBUSY")&&Date.now()-o<6e4){setTimeout((function(){t.stat(r,(function(t,o){if(t&&t.code==="ENOENT")e(n,r,CB);else i(s)}))}),c);if(c<100)c+=10;return}if(i)i(s)}))}if(Object.setPrototypeOf)Object.setPrototypeOf(rename,e);return rename}(t.rename)}t.read=typeof t.read!=="function"?t.read:function(e){function read(n,r,i,o,c,s){var a;if(s&&typeof s==="function"){var u=0;a=function(f,l,y){if(f&&f.code==="EAGAIN"&&u<10){u++;return e.call(t,n,r,i,o,c,a)}s.apply(this,arguments)}}return e.call(t,n,r,i,o,c,a)}if(Object.setPrototypeOf)Object.setPrototypeOf(read,e);return read}(t.read);t.readSync=typeof t.readSync!=="function"?t.readSync:function(e){return function(n,r,i,o,c){var s=0;while(true){try{return e.call(t,n,r,i,o,c)}catch(t){if(t.code==="EAGAIN"&&s<10){s++;continue}throw t}}}}(t.readSync);function patchLchmod(t){t.lchmod=function(e,n,i){t.open(e,r.O_WRONLY|r.O_SYMLINK,n,(function(e,r){if(e){if(i)i(e);return}t.fchmod(r,n,(function(e){t.close(r,(function(t){if(i)i(e||t)}))}))}))};t.lchmodSync=function(e,n){var i=t.openSync(e,r.O_WRONLY|r.O_SYMLINK,n);var o=true;var c;try{c=t.fchmodSync(i,n);o=false}finally{if(o){try{t.closeSync(i)}catch(t){}}else{t.closeSync(i)}}return c}}function patchLutimes(t){if(r.hasOwnProperty("O_SYMLINK")&&t.futimes){t.lutimes=function(e,n,i,o){t.open(e,r.O_SYMLINK,(function(e,r){if(e){if(o)o(e);return}t.futimes(r,n,i,(function(e){t.close(r,(function(t){if(o)o(e||t)}))}))}))};t.lutimesSync=function(e,n,i){var o=t.openSync(e,r.O_SYMLINK);var c;var s=true;try{c=t.futimesSync(o,n,i);s=false}finally{if(s){try{t.closeSync(o)}catch(t){}}else{t.closeSync(o)}}return c}}else if(t.futimes){t.lutimes=function(t,e,n,r){if(r)process.nextTick(r)};t.lutimesSync=function(){}}}function chmodFix(e){if(!e)return e;return function(n,r,i){return e.call(t,n,r,(function(t){if(chownErOk(t))t=null;if(i)i.apply(this,arguments)}))}}function chmodFixSync(e){if(!e)return e;return function(n,r){try{return e.call(t,n,r)}catch(t){if(!chownErOk(t))throw t}}}function chownFix(e){if(!e)return e;return function(n,r,i,o){return e.call(t,n,r,i,(function(t){if(chownErOk(t))t=null;if(o)o.apply(this,arguments)}))}}function chownFixSync(e){if(!e)return e;return function(n,r,i){try{return e.call(t,n,r,i)}catch(t){if(!chownErOk(t))throw t}}}function statFix(e){if(!e)return e;return function(n,r,i){if(typeof r==="function"){i=r;r=null}function callback(t,e){if(e){if(e.uid<0)e.uid+=4294967296;if(e.gid<0)e.gid+=4294967296}if(i)i.apply(this,arguments)}return r?e.call(t,n,r,callback):e.call(t,n,callback)}}function statFixSync(e){if(!e)return e;return function(n,r){var i=r?e.call(t,n,r):e.call(t,n);if(i){if(i.uid<0)i.uid+=4294967296;if(i.gid<0)i.gid+=4294967296}return i}}function chownErOk(t){if(!t)return true;if(t.code==="ENOSYS")return true;var e=!process.getuid||process.getuid()!==0;if(e){if(t.code==="EINVAL"||t.code==="EPERM")return true}return false}}},535:function(t,e,n){let r;try{r=n(551)}catch(t){r=n(896)}const i=n(327);const{stringify:o,stripBom:c}=n(306);async function _readFile(t,e={}){if(typeof e==="string"){e={encoding:e}}const n=e.fs||r;const o="throws"in e?e.throws:true;let s=await i.fromCallback(n.readFile)(t,e);s=c(s);let a;try{a=JSON.parse(s,e?e.reviver:null)}catch(e){if(o){e.message=`${t}: ${e.message}`;throw e}else{return null}}return a}const s=i.fromPromise(_readFile);function readFileSync(t,e={}){if(typeof e==="string"){e={encoding:e}}const n=e.fs||r;const i="throws"in e?e.throws:true;try{let r=n.readFileSync(t,e);r=c(r);return JSON.parse(r,e.reviver)}catch(e){if(i){e.message=`${t}: ${e.message}`;throw e}else{return null}}}async function _writeFile(t,e,n={}){const c=n.fs||r;const s=o(e,n);await i.fromCallback(c.writeFile)(t,s,n)}const a=i.fromPromise(_writeFile);function writeFileSync(t,e,n={}){const i=n.fs||r;const c=o(e,n);return i.writeFileSync(t,c,n)}const u={readFile:s,readFileSync:readFileSync,writeFile:a,writeFileSync:writeFileSync};t.exports=u},306:function(t){function stringify(t,{EOL:e="\n",finalEOL:n=true,replacer:r=null,spaces:i}={}){const o=n?e:"";const c=JSON.stringify(t,r,i);return c.replace(/\n/g,e)+o}function stripBom(t){if(Buffer.isBuffer(t))t=t.toString("utf8");return t.replace(/^\uFEFF/,"")}t.exports={stringify:stringify,stripBom:stripBom}},327:function(t,e){"use strict";e.fromCallback=function(t){return Object.defineProperty((function(...e){if(typeof e[e.length-1]==="function")t.apply(this,e);else{return new Promise(((n,r)=>{e.push(((t,e)=>t!=null?r(t):n(e)));t.apply(this,e)}))}}),"name",{value:t.name})};e.fromPromise=function(t){return Object.defineProperty((function(...e){const n=e[e.length-1];if(typeof n!=="function")return t.apply(this,e);else{e.pop();t.apply(this,e).then((t=>n(null,t)),n)}}),"name",{value:t.name})}},613:function(t){"use strict";t.exports=require("assert")},140:function(t){"use strict";t.exports=require("constants")},896:function(t){"use strict";t.exports=require("fs")},928:function(t){"use strict";t.exports=require("path")},203:function(t){"use strict";t.exports=require("stream")},23:function(t){"use strict";t.exports=require("util")}};var e={};function __nccwpck_require__(n){var r=e[n];if(r!==undefined){return r.exports}var i=e[n]={exports:{}};var o=true;try{t[n](i,i.exports,__nccwpck_require__);o=false}finally{if(o)delete e[n]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(278);module.exports=n})();
@@ -0,0 +1,16 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromPromise
4
+ const jsonFile = require('./jsonfile')
5
+
6
+ jsonFile.outputJson = u(require('./output-json'))
7
+ jsonFile.outputJsonSync = require('./output-json-sync')
8
+ // aliases
9
+ jsonFile.outputJSON = jsonFile.outputJson
10
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync
11
+ jsonFile.writeJSON = jsonFile.writeJson
12
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync
13
+ jsonFile.readJSON = jsonFile.readJson
14
+ jsonFile.readJSONSync = jsonFile.readJsonSync
15
+
16
+ module.exports = jsonFile
@@ -0,0 +1,11 @@
1
+ 'use strict'
2
+
3
+ const jsonFile = require('jsonfile')
4
+
5
+ module.exports = {
6
+ // jsonfile exports
7
+ readJson: jsonFile.readFile,
8
+ readJsonSync: jsonFile.readFileSync,
9
+ writeJson: jsonFile.writeFile,
10
+ writeJsonSync: jsonFile.writeFileSync
11
+ }
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+
3
+ const { stringify } = require('jsonfile/utils')
4
+ const { outputFileSync } = require('../output-file')
5
+
6
+ function outputJsonSync (file, data, options) {
7
+ const str = stringify(data, options)
8
+
9
+ outputFileSync(file, str, options)
10
+ }
11
+
12
+ module.exports = outputJsonSync
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+
3
+ const { stringify } = require('jsonfile/utils')
4
+ const { outputFile } = require('../output-file')
5
+
6
+ async function outputJson (file, data, options = {}) {
7
+ const str = stringify(data, options)
8
+
9
+ await outputFile(file, str, options)
10
+ }
11
+
12
+ module.exports = outputJson
@@ -0,0 +1,14 @@
1
+ 'use strict'
2
+ const u = require('universalify').fromPromise
3
+ const { makeDir: _makeDir, makeDirSync } = require('./make-dir')
4
+ const makeDir = u(_makeDir)
5
+
6
+ module.exports = {
7
+ mkdirs: makeDir,
8
+ mkdirsSync: makeDirSync,
9
+ // alias
10
+ mkdirp: makeDir,
11
+ mkdirpSync: makeDirSync,
12
+ ensureDir: makeDir,
13
+ ensureDirSync: makeDirSync
14
+ }
@@ -0,0 +1,27 @@
1
+ 'use strict'
2
+ const fs = require('../fs')
3
+ const { checkPath } = require('./utils')
4
+
5
+ const getMode = options => {
6
+ const defaults = { mode: 0o777 }
7
+ if (typeof options === 'number') return options
8
+ return ({ ...defaults, ...options }).mode
9
+ }
10
+
11
+ module.exports.makeDir = async (dir, options) => {
12
+ checkPath(dir)
13
+
14
+ return fs.mkdir(dir, {
15
+ mode: getMode(options),
16
+ recursive: true
17
+ })
18
+ }
19
+
20
+ module.exports.makeDirSync = (dir, options) => {
21
+ checkPath(dir)
22
+
23
+ return fs.mkdirSync(dir, {
24
+ mode: getMode(options),
25
+ recursive: true
26
+ })
27
+ }
@@ -0,0 +1,21 @@
1
+ // Adapted from https://github.com/sindresorhus/make-dir
2
+ // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+ // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6
+ 'use strict'
7
+ const path = require('path')
8
+
9
+ // https://github.com/nodejs/node/issues/8987
10
+ // https://github.com/libuv/libuv/pull/1088
11
+ module.exports.checkPath = function checkPath (pth) {
12
+ if (process.platform === 'win32') {
13
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
14
+
15
+ if (pathHasInvalidWinCharacters) {
16
+ const error = new Error(`Path contains invalid characters: ${pth}`)
17
+ error.code = 'EINVAL'
18
+ throw error
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromPromise
4
+ module.exports = {
5
+ move: u(require('./move')),
6
+ moveSync: require('./move-sync')
7
+ }