@slicemachine/adapter-next 0.0.12 → 0.0.13-dev-plugins-validation.0

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 (261) hide show
  1. package/LICENSE +1 -1
  2. package/dist/{node_modules → _node_modules}/data-uri-to-buffer/dist/index.cjs +1 -1
  3. package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -0
  4. package/dist/{node_modules → _node_modules}/data-uri-to-buffer/dist/index.js +1 -1
  5. package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
  6. package/dist/_node_modules/fetch-blob/file.cjs.map +1 -0
  7. package/dist/_node_modules/fetch-blob/file.js.map +1 -0
  8. package/dist/_node_modules/fetch-blob/index.cjs.map +1 -0
  9. package/dist/_node_modules/fetch-blob/index.js.map +1 -0
  10. package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -0
  11. package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
  12. package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
  13. package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
  14. package/dist/_node_modules/node-domexception/index.cjs.map +1 -0
  15. package/dist/_node_modules/node-domexception/index.js.map +1 -0
  16. package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -0
  17. package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
  18. package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -0
  19. package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
  20. package/dist/_node_modules/node-fetch/src/errors/base.cjs.map +1 -0
  21. package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -0
  22. package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -0
  23. package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
  24. package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -0
  25. package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
  26. package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -0
  27. package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
  28. package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -0
  29. package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
  30. package/dist/_node_modules/node-fetch/src/response.cjs.map +1 -0
  31. package/dist/_node_modules/node-fetch/src/response.js.map +1 -0
  32. package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.map +1 -0
  33. package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -0
  34. package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs.map +1 -0
  35. package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
  36. package/dist/_node_modules/node-fetch/src/utils/is.cjs.map +1 -0
  37. package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -0
  38. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -0
  39. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
  40. package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +1 -0
  41. package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -0
  42. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
  43. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
  44. package/dist/hooks/customType-asset-delete.cjs +6 -1
  45. package/dist/hooks/customType-asset-delete.cjs.map +1 -1
  46. package/dist/hooks/customType-asset-delete.js +6 -1
  47. package/dist/hooks/customType-asset-delete.js.map +1 -1
  48. package/dist/hooks/customType-asset-read.cjs +6 -1
  49. package/dist/hooks/customType-asset-read.cjs.map +1 -1
  50. package/dist/hooks/customType-asset-read.js +6 -1
  51. package/dist/hooks/customType-asset-read.js.map +1 -1
  52. package/dist/hooks/customType-asset-update.cjs +6 -1
  53. package/dist/hooks/customType-asset-update.cjs.map +1 -1
  54. package/dist/hooks/customType-asset-update.js +6 -1
  55. package/dist/hooks/customType-asset-update.js.map +1 -1
  56. package/dist/hooks/customType-create.cjs +5 -1
  57. package/dist/hooks/customType-create.cjs.map +1 -1
  58. package/dist/hooks/customType-create.js +5 -1
  59. package/dist/hooks/customType-create.js.map +1 -1
  60. package/dist/hooks/customType-delete.cjs +5 -1
  61. package/dist/hooks/customType-delete.cjs.map +1 -1
  62. package/dist/hooks/customType-delete.js +5 -1
  63. package/dist/hooks/customType-delete.js.map +1 -1
  64. package/dist/hooks/customType-read.cjs +20 -1
  65. package/dist/hooks/customType-read.cjs.map +1 -1
  66. package/dist/hooks/customType-read.js +3 -1
  67. package/dist/hooks/customType-read.js.map +1 -1
  68. package/dist/hooks/customTypeLibrary-read.cjs +2 -1
  69. package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
  70. package/dist/hooks/customTypeLibrary-read.js +2 -1
  71. package/dist/hooks/customTypeLibrary-read.js.map +1 -1
  72. package/dist/hooks/{command-init.cjs → project-init.cjs} +3 -3
  73. package/dist/hooks/{command-init.cjs.map → project-init.cjs.map} +1 -1
  74. package/dist/hooks/project-init.d.ts +3 -0
  75. package/dist/hooks/{command-init.js → project-init.js} +3 -3
  76. package/dist/hooks/{command-init.js.map → project-init.js.map} +1 -1
  77. package/dist/hooks/slice-asset-delete.cjs +8 -2
  78. package/dist/hooks/slice-asset-delete.cjs.map +1 -1
  79. package/dist/hooks/slice-asset-delete.js +8 -2
  80. package/dist/hooks/slice-asset-delete.js.map +1 -1
  81. package/dist/hooks/slice-asset-read.cjs +8 -2
  82. package/dist/hooks/slice-asset-read.cjs.map +1 -1
  83. package/dist/hooks/slice-asset-read.js +8 -2
  84. package/dist/hooks/slice-asset-read.js.map +1 -1
  85. package/dist/hooks/slice-asset-update.cjs +8 -2
  86. package/dist/hooks/slice-asset-update.cjs.map +1 -1
  87. package/dist/hooks/slice-asset-update.js +8 -2
  88. package/dist/hooks/slice-asset-update.js.map +1 -1
  89. package/dist/hooks/slice-create.cjs +12 -10
  90. package/dist/hooks/slice-create.cjs.map +1 -1
  91. package/dist/hooks/slice-create.js +12 -10
  92. package/dist/hooks/slice-create.js.map +1 -1
  93. package/dist/hooks/slice-delete.cjs +6 -2
  94. package/dist/hooks/slice-delete.cjs.map +1 -1
  95. package/dist/hooks/slice-delete.js +6 -2
  96. package/dist/hooks/slice-delete.js.map +1 -1
  97. package/dist/hooks/slice-read.cjs +5 -1
  98. package/dist/hooks/slice-read.cjs.map +1 -1
  99. package/dist/hooks/slice-read.js +5 -1
  100. package/dist/hooks/slice-read.js.map +1 -1
  101. package/dist/hooks/slice-rename.cjs +10 -2
  102. package/dist/hooks/slice-rename.cjs.map +1 -1
  103. package/dist/hooks/slice-rename.js +10 -2
  104. package/dist/hooks/slice-rename.js.map +1 -1
  105. package/dist/hooks/sliceLibrary-read.cjs +5 -1
  106. package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
  107. package/dist/hooks/sliceLibrary-read.js +5 -1
  108. package/dist/hooks/sliceLibrary-read.js.map +1 -1
  109. package/dist/hooks/sliceSimulator-setup-read.cjs +1 -1
  110. package/dist/hooks/sliceSimulator-setup-read.js +1 -1
  111. package/dist/lib/buildCustomTypeAssetPath.cjs +29 -0
  112. package/dist/lib/buildCustomTypeAssetPath.cjs.map +1 -0
  113. package/dist/lib/buildCustomTypeAssetPath.d.ts +9 -0
  114. package/dist/lib/buildCustomTypeAssetPath.js +12 -0
  115. package/dist/lib/buildCustomTypeAssetPath.js.map +1 -0
  116. package/dist/lib/buildCustomTypeDirectoryPath.cjs +26 -0
  117. package/dist/lib/buildCustomTypeDirectoryPath.cjs.map +1 -0
  118. package/dist/lib/buildCustomTypeDirectoryPath.d.ts +8 -0
  119. package/dist/lib/buildCustomTypeDirectoryPath.js +9 -0
  120. package/dist/lib/buildCustomTypeDirectoryPath.js.map +1 -0
  121. package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs +7 -0
  122. package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs.map +1 -0
  123. package/dist/lib/buildCustomTypeLibraryDirectoryPath.d.ts +7 -0
  124. package/dist/lib/buildCustomTypeLibraryDirectoryPath.js +7 -0
  125. package/dist/lib/buildCustomTypeLibraryDirectoryPath.js.map +1 -0
  126. package/dist/lib/buildSliceAssetPath.cjs +34 -0
  127. package/dist/lib/buildSliceAssetPath.cjs.map +1 -0
  128. package/dist/lib/buildSliceAssetPath.d.ts +11 -0
  129. package/dist/lib/buildSliceAssetPath.js +17 -0
  130. package/dist/lib/buildSliceAssetPath.js.map +1 -0
  131. package/dist/lib/buildSliceDirectoryPath.cjs +30 -0
  132. package/dist/lib/buildSliceDirectoryPath.cjs.map +1 -0
  133. package/dist/lib/buildSliceDirectoryPath.d.ts +10 -0
  134. package/dist/lib/buildSliceDirectoryPath.js +13 -0
  135. package/dist/lib/buildSliceDirectoryPath.js.map +1 -0
  136. package/dist/lib/buildSliceLibraryDirectoryPath.cjs +7 -0
  137. package/dist/lib/buildSliceLibraryDirectoryPath.cjs.map +1 -0
  138. package/dist/lib/buildSliceLibraryDirectoryPath.d.ts +8 -0
  139. package/dist/lib/buildSliceLibraryDirectoryPath.js +7 -0
  140. package/dist/lib/buildSliceLibraryDirectoryPath.js.map +1 -0
  141. package/dist/lib/updateSliceModelFile.cjs +4 -2
  142. package/dist/lib/updateSliceModelFile.cjs.map +1 -1
  143. package/dist/lib/updateSliceModelFile.js +3 -2
  144. package/dist/lib/updateSliceModelFile.js.map +1 -1
  145. package/dist/lib/upsertSliceLibraryIndexFile.cjs +7 -1
  146. package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
  147. package/dist/lib/upsertSliceLibraryIndexFile.js +6 -1
  148. package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
  149. package/dist/plugin.cjs +3 -3
  150. package/dist/plugin.cjs.map +1 -1
  151. package/dist/plugin.js +3 -3
  152. package/dist/plugin.js.map +1 -1
  153. package/package.json +18 -14
  154. package/src/hooks/customType-asset-delete.ts +7 -5
  155. package/src/hooks/customType-asset-read.ts +7 -5
  156. package/src/hooks/customType-asset-update.ts +7 -5
  157. package/src/hooks/customType-create.ts +5 -1
  158. package/src/hooks/customType-delete.ts +5 -1
  159. package/src/hooks/customType-read.ts +4 -3
  160. package/src/hooks/customTypeLibrary-read.ts +2 -1
  161. package/src/hooks/{command-init.ts → project-init.ts} +4 -4
  162. package/src/hooks/slice-asset-delete.ts +8 -6
  163. package/src/hooks/slice-asset-read.ts +8 -6
  164. package/src/hooks/slice-asset-update.ts +8 -6
  165. package/src/hooks/slice-create.ts +12 -17
  166. package/src/hooks/slice-delete.ts +6 -5
  167. package/src/hooks/slice-read.ts +5 -1
  168. package/src/hooks/slice-rename.ts +11 -9
  169. package/src/hooks/sliceLibrary-read.ts +5 -1
  170. package/src/lib/buildCustomTypeAssetPath.ts +24 -0
  171. package/src/lib/buildCustomTypeDirectoryPath.ts +20 -0
  172. package/src/lib/buildCustomTypeLibraryDirectoryPath.ts +13 -0
  173. package/src/lib/buildSliceAssetPath.ts +32 -0
  174. package/src/lib/buildSliceDirectoryPath.ts +26 -0
  175. package/src/lib/buildSliceLibraryDirectoryPath.ts +14 -0
  176. package/src/lib/updateSliceModelFile.ts +5 -4
  177. package/src/lib/upsertSliceLibraryIndexFile.ts +7 -2
  178. package/src/plugin.ts +2 -2
  179. package/dist/hooks/command-init.d.ts +0 -3
  180. package/dist/node_modules/data-uri-to-buffer/dist/index.cjs.map +0 -1
  181. package/dist/node_modules/data-uri-to-buffer/dist/index.js.map +0 -1
  182. package/dist/node_modules/fetch-blob/file.cjs.map +0 -1
  183. package/dist/node_modules/fetch-blob/file.js.map +0 -1
  184. package/dist/node_modules/fetch-blob/index.cjs.map +0 -1
  185. package/dist/node_modules/fetch-blob/index.js.map +0 -1
  186. package/dist/node_modules/fetch-blob/streams.cjs.map +0 -1
  187. package/dist/node_modules/fetch-blob/streams.js.map +0 -1
  188. package/dist/node_modules/formdata-polyfill/esm.min.cjs.map +0 -1
  189. package/dist/node_modules/formdata-polyfill/esm.min.js.map +0 -1
  190. package/dist/node_modules/node-domexception/index.cjs.map +0 -1
  191. package/dist/node_modules/node-domexception/index.js.map +0 -1
  192. package/dist/node_modules/node-fetch/src/body.cjs.map +0 -1
  193. package/dist/node_modules/node-fetch/src/body.js.map +0 -1
  194. package/dist/node_modules/node-fetch/src/errors/abort-error.cjs.map +0 -1
  195. package/dist/node_modules/node-fetch/src/errors/abort-error.js.map +0 -1
  196. package/dist/node_modules/node-fetch/src/errors/base.cjs.map +0 -1
  197. package/dist/node_modules/node-fetch/src/errors/base.js.map +0 -1
  198. package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs.map +0 -1
  199. package/dist/node_modules/node-fetch/src/errors/fetch-error.js.map +0 -1
  200. package/dist/node_modules/node-fetch/src/headers.cjs.map +0 -1
  201. package/dist/node_modules/node-fetch/src/headers.js.map +0 -1
  202. package/dist/node_modules/node-fetch/src/index.cjs.map +0 -1
  203. package/dist/node_modules/node-fetch/src/index.js.map +0 -1
  204. package/dist/node_modules/node-fetch/src/request.cjs.map +0 -1
  205. package/dist/node_modules/node-fetch/src/request.js.map +0 -1
  206. package/dist/node_modules/node-fetch/src/response.cjs.map +0 -1
  207. package/dist/node_modules/node-fetch/src/response.js.map +0 -1
  208. package/dist/node_modules/node-fetch/src/utils/get-search.cjs.map +0 -1
  209. package/dist/node_modules/node-fetch/src/utils/get-search.js.map +0 -1
  210. package/dist/node_modules/node-fetch/src/utils/is-redirect.cjs.map +0 -1
  211. package/dist/node_modules/node-fetch/src/utils/is-redirect.js.map +0 -1
  212. package/dist/node_modules/node-fetch/src/utils/is.cjs.map +0 -1
  213. package/dist/node_modules/node-fetch/src/utils/is.js.map +0 -1
  214. package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs.map +0 -1
  215. package/dist/node_modules/node-fetch/src/utils/multipart-parser.js.map +0 -1
  216. package/dist/node_modules/node-fetch/src/utils/referrer.cjs.map +0 -1
  217. package/dist/node_modules/node-fetch/src/utils/referrer.js.map +0 -1
  218. package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +0 -1
  219. package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +0 -1
  220. /package/dist/{node_modules → _node_modules}/fetch-blob/file.cjs +0 -0
  221. /package/dist/{node_modules → _node_modules}/fetch-blob/file.js +0 -0
  222. /package/dist/{node_modules → _node_modules}/fetch-blob/index.cjs +0 -0
  223. /package/dist/{node_modules → _node_modules}/fetch-blob/index.js +0 -0
  224. /package/dist/{node_modules → _node_modules}/fetch-blob/streams.cjs +0 -0
  225. /package/dist/{node_modules → _node_modules}/fetch-blob/streams.js +0 -0
  226. /package/dist/{node_modules → _node_modules}/formdata-polyfill/esm.min.cjs +0 -0
  227. /package/dist/{node_modules → _node_modules}/formdata-polyfill/esm.min.js +0 -0
  228. /package/dist/{node_modules → _node_modules}/node-domexception/index.cjs +0 -0
  229. /package/dist/{node_modules → _node_modules}/node-domexception/index.js +0 -0
  230. /package/dist/{node_modules → _node_modules}/node-fetch/src/body.cjs +0 -0
  231. /package/dist/{node_modules → _node_modules}/node-fetch/src/body.js +0 -0
  232. /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/abort-error.cjs +0 -0
  233. /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/abort-error.js +0 -0
  234. /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/base.cjs +0 -0
  235. /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/base.js +0 -0
  236. /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/fetch-error.cjs +0 -0
  237. /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/fetch-error.js +0 -0
  238. /package/dist/{node_modules → _node_modules}/node-fetch/src/headers.cjs +0 -0
  239. /package/dist/{node_modules → _node_modules}/node-fetch/src/headers.js +0 -0
  240. /package/dist/{node_modules → _node_modules}/node-fetch/src/index.cjs +0 -0
  241. /package/dist/{node_modules → _node_modules}/node-fetch/src/index.js +0 -0
  242. /package/dist/{node_modules → _node_modules}/node-fetch/src/request.cjs +0 -0
  243. /package/dist/{node_modules → _node_modules}/node-fetch/src/request.js +0 -0
  244. /package/dist/{node_modules → _node_modules}/node-fetch/src/response.cjs +0 -0
  245. /package/dist/{node_modules → _node_modules}/node-fetch/src/response.js +0 -0
  246. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/get-search.cjs +0 -0
  247. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/get-search.js +0 -0
  248. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is-redirect.cjs +0 -0
  249. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is-redirect.js +0 -0
  250. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is.cjs +0 -0
  251. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is.js +0 -0
  252. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/multipart-parser.cjs +0 -0
  253. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/multipart-parser.js +0 -0
  254. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/referrer.cjs +0 -0
  255. /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/referrer.js +0 -0
  256. /package/dist/{node_modules → _node_modules}/web-streams-polyfill/dist/ponyfill.es2018.cjs +0 -0
  257. /package/dist/{node_modules → _node_modules}/web-streams-polyfill/dist/ponyfill.es2018.js +0 -0
  258. /package/dist/{package.json.cjs → packages/adapter-next/package.json.cjs} +0 -0
  259. /package/dist/{package.json.cjs.map → packages/adapter-next/package.json.cjs.map} +0 -0
  260. /package/dist/{package.json.js → packages/adapter-next/package.json.js} +0 -0
  261. /package/dist/{package.json.js.map → packages/adapter-next/package.json.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
+ const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
4
5
  function _interopNamespaceDefault(e) {
5
6
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
7
  if (e) {
@@ -19,7 +20,11 @@ function _interopNamespaceDefault(e) {
19
20
  }
20
21
  const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
21
22
  const customTypeAssetDelete = async (data, context) => {
22
- const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.assetID);
23
+ const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
24
+ customTypeID: data.customTypeID,
25
+ assetID: data.assetID,
26
+ helpers: context.helpers
27
+ });
23
28
  await fs__namespace.rm(filePath);
24
29
  };
25
30
  exports.customTypeAssetDelete = customTypeAssetDelete;
@@ -1 +1 @@
1
- {"version":3,"file":"customType-asset-delete.cjs","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tawait fs.rm(filePath);\n};\n"],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGP,QAAAA,cAAG,GAAG,QAAQ;AACrB;;"}
1
+ {"version":3,"file":"customType-asset-delete.cjs","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":["buildCustomTypeAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,GAAG,QAAQ;AACrB;;"}
@@ -1,6 +1,11 @@
1
1
  import * as fs from "node:fs/promises";
2
+ import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
2
3
  const customTypeAssetDelete = async (data, context) => {
3
- const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.assetID);
4
+ const filePath = buildCustomTypeAssetPath({
5
+ customTypeID: data.customTypeID,
6
+ assetID: data.assetID,
7
+ helpers: context.helpers
8
+ });
4
9
  await fs.rm(filePath);
5
10
  };
6
11
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"customType-asset-delete.js","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tawait fs.rm(filePath);\n};\n"],"names":[],"mappings":";AAKa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGP,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
1
+ {"version":3,"file":"customType-asset-delete.js","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
+ const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
4
5
  function _interopNamespaceDefault(e) {
5
6
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
7
  if (e) {
@@ -19,7 +20,11 @@ function _interopNamespaceDefault(e) {
19
20
  }
20
21
  const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
21
22
  const customTypeAssetRead = async (data, context) => {
22
- const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.assetID);
23
+ const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
24
+ customTypeID: data.customTypeID,
25
+ assetID: data.assetID,
26
+ helpers: context.helpers
27
+ });
23
28
  const assetData = await fs__namespace.readFile(filePath);
24
29
  return {
25
30
  data: assetData
@@ -1 +1 @@
1
- {"version":3,"file":"customType-asset-read.cjs","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKa,MAAA,sBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGb,QAAM,YAAY,MAAMA,cAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;;"}
1
+ {"version":3,"file":"customType-asset-read.cjs","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":["buildCustomTypeAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,sBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAMC,cAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;;"}
@@ -1,6 +1,11 @@
1
1
  import * as fs from "node:fs/promises";
2
+ import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
2
3
  const customTypeAssetRead = async (data, context) => {
3
- const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.assetID);
4
+ const filePath = buildCustomTypeAssetPath({
5
+ customTypeID: data.customTypeID,
6
+ assetID: data.assetID,
7
+ helpers: context.helpers
8
+ });
4
9
  const assetData = await fs.readFile(filePath);
5
10
  return {
6
11
  data: assetData
@@ -1 +1 @@
1
- {"version":3,"file":"customType-asset-read.js","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":[],"mappings":";AAKa,MAAA,sBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGb,QAAM,YAAY,MAAM,GAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;"}
1
+ {"version":3,"file":"customType-asset-read.js","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":[],"mappings":";;AAOa,MAAA,sBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAM,GAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
4
  const path = require("node:path");
5
+ const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
5
6
  function _interopNamespaceDefault(e) {
6
7
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
8
  if (e) {
@@ -21,7 +22,11 @@ function _interopNamespaceDefault(e) {
21
22
  const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
22
23
  const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
23
24
  const customTypeAssetUpdate = async (data, context) => {
24
- const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.asset.id);
25
+ const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
26
+ customTypeID: data.customTypeID,
27
+ assetID: data.asset.id,
28
+ helpers: context.helpers
29
+ });
25
30
  await fs__namespace.mkdir(path__namespace.dirname(filePath), { recursive: true });
26
31
  await fs__namespace.writeFile(filePath, data.asset.data);
27
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"customType-asset-update.cjs","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.asset.id,\n\t);\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":["fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,MAAM,EAAE;AAGR,QAAAA,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAMD,cAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;;"}
1
+ {"version":3,"file":"customType-asset-update.cjs","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":["buildCustomTypeAssetPath","fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAMD,cAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;;"}
@@ -1,7 +1,12 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
+ import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
3
4
  const customTypeAssetUpdate = async (data, context) => {
4
- const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.asset.id);
5
+ const filePath = buildCustomTypeAssetPath({
6
+ customTypeID: data.customTypeID,
7
+ assetID: data.asset.id,
8
+ helpers: context.helpers
9
+ });
5
10
  await fs.mkdir(path.dirname(filePath), { recursive: true });
6
11
  await fs.writeFile(filePath, data.asset.data);
7
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"customType-asset-update.js","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.asset.id,\n\t);\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":[],"mappings":";;AAMa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,MAAM,EAAE;AAGR,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}
1
+ {"version":3,"file":"customType-asset-update.js","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
4
  const path = require("node:path");
5
+ const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
5
6
  const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
6
7
  function _interopNamespaceDefault(e) {
7
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -30,7 +31,10 @@ const createModelFile = async ({ dir, data, helpers, options }) => {
30
31
  await fs__namespace.writeFile(filePath, contents);
31
32
  };
32
33
  const customTypeCreate = async (data, context) => {
33
- const dir = context.helpers.joinPathFromRoot("customtypes", data.model.id);
34
+ const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
35
+ customTypeID: data.model.id,
36
+ helpers: context.helpers
37
+ });
34
38
  await fs__namespace.mkdir(dir, { recursive: true });
35
39
  await createModelFile({ dir, data, ...context });
36
40
  await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
@@ -1 +1 @@
1
- {"version":3,"file":"customType-create.cjs","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["path","fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAWA,gBAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAMA,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
1
+ {"version":3,"file":"customType-create.cjs","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["path","fs","buildCustomTypeDirectoryPath","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAWA,gBAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMC,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMD,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAME,yBAAAA,yBAAyB,OAAO;AACvC;;"}
@@ -1,5 +1,6 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
+ import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
3
4
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
4
5
  const createModelFile = async ({ dir, data, helpers, options }) => {
5
6
  const filePath = path.join(dir, "index.json");
@@ -10,7 +11,10 @@ const createModelFile = async ({ dir, data, helpers, options }) => {
10
11
  await fs.writeFile(filePath, contents);
11
12
  };
12
13
  const customTypeCreate = async (data, context) => {
13
- const dir = context.helpers.joinPathFromRoot("customtypes", data.model.id);
14
+ const dir = buildCustomTypeDirectoryPath({
15
+ customTypeID: data.model.id,
16
+ helpers: context.helpers
17
+ });
14
18
  await fs.mkdir(dir, { recursive: true });
15
19
  await createModelFile({ dir, data, ...context });
16
20
  await upsertGlobalContentTypes(context);
@@ -1 +1 @@
1
- {"version":3,"file":"customType-create.js","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;AAiBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAW,KAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAM,yBAAyB,OAAO;AACvC;"}
1
+ {"version":3,"file":"customType-create.js","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;;AAkBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAW,KAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAM,yBAAyB,OAAO;AACvC;"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
+ const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
4
5
  const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
5
6
  function _interopNamespaceDefault(e) {
6
7
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -20,7 +21,10 @@ function _interopNamespaceDefault(e) {
20
21
  }
21
22
  const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
22
23
  const customTypeDelete = async (data, context) => {
23
- const dir = context.helpers.joinPathFromRoot("customtypes", data.model.id);
24
+ const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
25
+ customTypeID: data.model.id,
26
+ helpers: context.helpers
27
+ });
24
28
  await fs__namespace.rm(dir, { recursive: true });
25
29
  await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
26
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"customType-delete.cjs","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAMA,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
1
+ {"version":3,"file":"customType-delete.cjs","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["buildCustomTypeDirectoryPath","fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMA,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMC,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
@@ -1,7 +1,11 @@
1
1
  import * as fs from "node:fs/promises";
2
+ import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
2
3
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
3
4
  const customTypeDelete = async (data, context) => {
4
- const dir = context.helpers.joinPathFromRoot("customtypes", data.model.id);
5
+ const dir = buildCustomTypeDirectoryPath({
6
+ customTypeID: data.model.id,
7
+ helpers: context.helpers
8
+ });
5
9
  await fs.rm(dir, { recursive: true });
6
10
  await upsertGlobalContentTypes(context);
7
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"customType-delete.js","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAM,yBAAyB,OAAO;AACvC;"}
1
+ {"version":3,"file":"customType-delete.js","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAM,yBAAyB,OAAO;AACvC;"}
@@ -1,8 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const path = require("node:path");
4
+ const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
3
5
  const readJSONFile = require("../lib/readJSONFile.cjs");
6
+ function _interopNamespaceDefault(e) {
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
4
23
  const customTypeRead = async (data, { helpers }) => {
5
- const filePath = helpers.joinPathFromRoot("customtypes", data.id, "index.json");
24
+ const filePath = path__namespace.join(buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
6
25
  const model = await readJSONFile.readJSONFile(filePath);
7
26
  return {
8
27
  model
@@ -1 +1 @@
1
- {"version":3,"file":"customType-read.cjs","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.id,\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":["readJSONFile"],"mappings":";;;AAOO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACH,QAAM,WAAW,QAAQ,iBACxB,eACA,KAAK,IACL,YAAY;AAGP,QAAA,QAAQ,MAAMA,0BAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;;"}
1
+ {"version":3,"file":"customType-read.cjs","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":["path","buildCustomTypeDirectoryPath","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAWA,gBAAK,KACrBC,6BAA6B,6BAAA,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAMC,0BAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;;"}
@@ -1,6 +1,8 @@
1
+ import * as path from "node:path";
2
+ import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
1
3
  import { readJSONFile } from "../lib/readJSONFile.js";
2
4
  const customTypeRead = async (data, { helpers }) => {
3
- const filePath = helpers.joinPathFromRoot("customtypes", data.id, "index.json");
5
+ const filePath = path.join(buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
4
6
  const model = await readJSONFile(filePath);
5
7
  return {
6
8
  model
@@ -1 +1 @@
1
- {"version":3,"file":"customType-read.js","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.id,\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":[],"mappings":";AAOO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACH,QAAM,WAAW,QAAQ,iBACxB,eACA,KAAK,IACL,YAAY;AAGP,QAAA,QAAQ,MAAM,aAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"customType-read.js","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":[],"mappings":";;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAW,KAAK,KACrB,6BAA6B,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAM,aAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
4
  const path = require("node:path");
5
+ const buildCustomTypeLibraryDirectoryPath = require("../lib/buildCustomTypeLibraryDirectoryPath.cjs");
5
6
  const readJSONFile = require("../lib/readJSONFile.cjs");
6
7
  function _interopNamespaceDefault(e) {
7
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -25,7 +26,7 @@ const isCustomTypeModel = (input) => {
25
26
  return typeof input === "object" && input !== null && "json" in input;
26
27
  };
27
28
  const customTypeLibraryRead = async (_data, { helpers }) => {
28
- const dirPath = helpers.joinPathFromRoot("customtypes");
29
+ const dirPath = buildCustomTypeLibraryDirectoryPath.buildCustomTypeLibraryDirectoryPath({ helpers });
29
30
  await fs__namespace.mkdir(dirPath, { recursive: true });
30
31
  const childDirs = await fs__namespace.readdir(dirPath);
31
32
  const ids = [];
@@ -1 +1 @@
1
- {"version":3,"file":"customTypeLibrary-read.cjs","sources":["../../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = helpers.joinPathFromRoot(\"customtypes\");\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst childDirContents = await fs.readdir(path.join(dirPath, childDir), {\n\t\t\t\twithFileTypes: true,\n\t\t\t});\n\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t});\n\n\t\t\tif (isCustomTypeDir) {\n\t\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":["fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAC1B,QAAA,UAAU,QAAQ,iBAAiB,aAAa;AAGtD,QAAMA,cAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAMA,cAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC1B,UAAA,mBAAmB,MAAMA,cAAG,QAAQC,gBAAK,KAAK,SAAS,QAAQ,GAAG;AAAA,MACvE,eAAe;AAAA,IAAA,CACf;AACD,UAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,aAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,IAAA,CACxC;AAED,QAAI,iBAAiB;AACpB,YAAM,YAAYA,gBAAK,KAAK,SAAS,UAAU,YAAY;AAErD,YAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,UAAA,kBAAkB,aAAa,GAAG;AACjC,YAAA,KAAK,cAAc,EAAE;AAAA,MACzB;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;;"}
1
+ {"version":3,"file":"customTypeLibrary-read.cjs","sources":["../../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeLibraryDirectoryPath } from \"../lib/buildCustomTypeLibraryDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = buildCustomTypeLibraryDirectoryPath({ helpers });\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst childDirContents = await fs.readdir(path.join(dirPath, childDir), {\n\t\t\t\twithFileTypes: true,\n\t\t\t});\n\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t});\n\n\t\t\tif (isCustomTypeDir) {\n\t\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":["buildCustomTypeLibraryDirectoryPath","fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAChC,QAAM,UAAUA,oCAAAA,oCAAoC,EAAE,QAAS,CAAA;AAG/D,QAAMC,cAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAMA,cAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC1B,UAAA,mBAAmB,MAAMA,cAAG,QAAQC,gBAAK,KAAK,SAAS,QAAQ,GAAG;AAAA,MACvE,eAAe;AAAA,IAAA,CACf;AACD,UAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,aAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,IAAA,CACxC;AAED,QAAI,iBAAiB;AACpB,YAAM,YAAYA,gBAAK,KAAK,SAAS,UAAU,YAAY;AAErD,YAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,UAAA,kBAAkB,aAAa,GAAG;AACjC,YAAA,KAAK,cAAc,EAAE;AAAA,MACzB;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;;"}
@@ -1,11 +1,12 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
+ import { buildCustomTypeLibraryDirectoryPath } from "../lib/buildCustomTypeLibraryDirectoryPath.js";
3
4
  import { readJSONFile } from "../lib/readJSONFile.js";
4
5
  const isCustomTypeModel = (input) => {
5
6
  return typeof input === "object" && input !== null && "json" in input;
6
7
  };
7
8
  const customTypeLibraryRead = async (_data, { helpers }) => {
8
- const dirPath = helpers.joinPathFromRoot("customtypes");
9
+ const dirPath = buildCustomTypeLibraryDirectoryPath({ helpers });
9
10
  await fs.mkdir(dirPath, { recursive: true });
10
11
  const childDirs = await fs.readdir(dirPath);
11
12
  const ids = [];
@@ -1 +1 @@
1
- {"version":3,"file":"customTypeLibrary-read.js","sources":["../../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = helpers.joinPathFromRoot(\"customtypes\");\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst childDirContents = await fs.readdir(path.join(dirPath, childDir), {\n\t\t\t\twithFileTypes: true,\n\t\t\t});\n\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t});\n\n\t\t\tif (isCustomTypeDir) {\n\t\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;AASA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAC1B,QAAA,UAAU,QAAQ,iBAAiB,aAAa;AAGtD,QAAM,GAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAM,GAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC1B,UAAA,mBAAmB,MAAM,GAAG,QAAQ,KAAK,KAAK,SAAS,QAAQ,GAAG;AAAA,MACvE,eAAe;AAAA,IAAA,CACf;AACD,UAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,aAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,IAAA,CACxC;AAED,QAAI,iBAAiB;AACpB,YAAM,YAAY,KAAK,KAAK,SAAS,UAAU,YAAY;AAErD,YAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,UAAA,kBAAkB,aAAa,GAAG;AACjC,YAAA,KAAK,cAAc,EAAE;AAAA,MACzB;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;"}
1
+ {"version":3,"file":"customTypeLibrary-read.js","sources":["../../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeLibraryDirectoryPath } from \"../lib/buildCustomTypeLibraryDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = buildCustomTypeLibraryDirectoryPath({ helpers });\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst childDirContents = await fs.readdir(path.join(dirPath, childDir), {\n\t\t\t\twithFileTypes: true,\n\t\t\t});\n\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t});\n\n\t\t\tif (isCustomTypeDir) {\n\t\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;;AAUA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAChC,QAAM,UAAU,oCAAoC,EAAE,QAAS,CAAA;AAG/D,QAAM,GAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAM,GAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC1B,UAAA,mBAAmB,MAAM,GAAG,QAAQ,KAAK,KAAK,SAAS,QAAQ,GAAG;AAAA,MACvE,eAAe;AAAA,IAAA,CACf;AACD,UAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,aAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,IAAA,CACxC;AAED,QAAI,iBAAiB;AACpB,YAAM,YAAY,KAAK,KAAK,SAAS,UAAU,YAAY;AAErD,YAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,UAAA,kBAAkB,aAAa,GAAG;AACjC,YAAA,KAAK,cAAc,EAAE;AAAA,MACzB;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;"}
@@ -187,12 +187,12 @@ const createSliceSimulatorPage = async ({ helpers, options }) => {
187
187
  }
188
188
  await fs__namespace.writeFile(filePath, contents);
189
189
  };
190
- const commandInit = async ({ installDependencies: _installDependencies }, context) => {
190
+ const projectInit = async ({ installDependencies: _installDependencies }, context) => {
191
191
  rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
192
192
  await installDependencies({ installDependencies: _installDependencies }),
193
193
  await createPrismicIOFile(context),
194
194
  await createSliceSimulatorPage(context)
195
195
  ]));
196
196
  };
197
- exports.commandInit = commandInit;
198
- //# sourceMappingURL=command-init.cjs.map
197
+ exports.projectInit = projectInit;
198
+ //# sourceMappingURL=project-init.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-init.cjs","sources":["../../../src/hooks/command-init.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type {\n\tCommandInitHook,\n\tCommandInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkPathExists } from \"../lib/checkPathExists\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: CommandInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/client\": \"latest\",\n\t\t\t\"@prismicio/helpers\": \"latest\",\n\t\t\t\"@prismicio/react\": \"latest\",\n\t\t\t\"@prismicio/next\": \"latest\",\n\t\t},\n\t});\n\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/types\": \"latest\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype CreatePrismicIOFileArgs = SliceMachineContext<PluginOptions>;\n\nconst createPrismicIOFile = async ({\n\thelpers,\n\toptions,\n}: CreatePrismicIOFileArgs) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tisTypeScriptProject ? \"prismicio.ts\" : \"prismicio.js\",\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tlet contents: string;\n\n\tif (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes: prismic.ClientConfig[\"routes\"] = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config: prismicNext.CreateClientConfig = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t *\n\t\t\t * @type {prismic.ClientConfig[\"routes\"]}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t}\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst srcDirectoryExists = await checkPathExists(\n\t\thelpers.joinPathFromRoot(\"src\"),\n\t);\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tsrcDirectoryExists ? \"src/pages\" : \"pages\",\n\t\t`slice-simulator.${await getJSOrTSXFileExtension({ helpers, options })}`,\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\n\tlet contents = stripIndent`\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\timport { components } from \"../slices\";\n\n\t\tconst SliceSimulatorPage = () => {\n\t\t\treturn (\n\t\t\t\t<SliceSimulator\n\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\texport default SliceSimulatorPage;\n\t`;\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const commandInit: CommandInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tawait installDependencies({ installDependencies: _installDependencies }),\n\t\t\tawait createPrismicIOFile(context),\n\t\t\tawait createSliceSimulatorPage(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies","checkIsTypeScriptProject","checkPathExists","stripIndent","fs","getJSOrTSXFileExtension","path","rejectIfNecessary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACnB;AAAA,EAAA,CACD;AAED,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,oBAAoB;AAAA,IACpB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,sBAAsB,OAAO,EAClC,SACA,cAC6B;AACvB,QAAA,sBAAsB,MAAMC,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,QAAM,WAAW,QAAQ,iBACxB,sBAAsB,iBAAiB,cAAc;AAGlD,MAAA,MAAMC,gBAAAA,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEG,MAAA;AAEJ,MAAI,qBAAqB;AACb,eAAAC,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAAA,OAiDL;AACK,eAAAA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAmDX;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAIA,MAAM,2BAA2B,OAAO,EACvC,SACA,cACkC;AAClC,QAAM,qBAAqB,MAAMF,gBAAA,gBAChC,QAAQ,iBAAiB,KAAK,CAAC;AAGhC,QAAM,WAAW,QAAQ,iBACxB,qBAAqB,cAAc,SACnC,mBAAmB,MAAMG,wBAAAA,wBAAwB,EAAE,SAAS,QAAA,CAAS,GAAG;AAGrE,MAAA,MAAMH,gBAAAA,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEK,QAAAE,cAAG,MAAME,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAE1D,MAAI,WAAWH,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAiBf,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEO,MAAM,cAA8C,OAC1D,EAAE,qBAAqB,qBAAA,GACvB,YACG;AAEFG,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,MAAM,oBAAoB,EAAE,qBAAqB,sBAAsB;AAAA,IACvE,MAAM,oBAAoB,OAAO;AAAA,IACjC,MAAM,yBAAyB,OAAO;AAAA,EACtC,CAAA,CAAC;AAEJ;;"}
1
+ {"version":3,"file":"project-init.cjs","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkPathExists } from \"../lib/checkPathExists\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/client\": \"latest\",\n\t\t\t\"@prismicio/helpers\": \"latest\",\n\t\t\t\"@prismicio/react\": \"latest\",\n\t\t\t\"@prismicio/next\": \"latest\",\n\t\t},\n\t});\n\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/types\": \"latest\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype CreatePrismicIOFileArgs = SliceMachineContext<PluginOptions>;\n\nconst createPrismicIOFile = async ({\n\thelpers,\n\toptions,\n}: CreatePrismicIOFileArgs) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tisTypeScriptProject ? \"prismicio.ts\" : \"prismicio.js\",\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tlet contents: string;\n\n\tif (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes: prismic.ClientConfig[\"routes\"] = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config: prismicNext.CreateClientConfig = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t *\n\t\t\t * @type {prismic.ClientConfig[\"routes\"]}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t}\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst srcDirectoryExists = await checkPathExists(\n\t\thelpers.joinPathFromRoot(\"src\"),\n\t);\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tsrcDirectoryExists ? \"src/pages\" : \"pages\",\n\t\t`slice-simulator.${await getJSOrTSXFileExtension({ helpers, options })}`,\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\n\tlet contents = stripIndent`\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\timport { components } from \"../slices\";\n\n\t\tconst SliceSimulatorPage = () => {\n\t\t\treturn (\n\t\t\t\t<SliceSimulator\n\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\texport default SliceSimulatorPage;\n\t`;\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tawait installDependencies({ installDependencies: _installDependencies }),\n\t\t\tawait createPrismicIOFile(context),\n\t\t\tawait createSliceSimulatorPage(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies","checkIsTypeScriptProject","checkPathExists","stripIndent","fs","getJSOrTSXFileExtension","path","rejectIfNecessary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACnB;AAAA,EAAA,CACD;AAED,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,oBAAoB;AAAA,IACpB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,sBAAsB,OAAO,EAClC,SACA,cAC6B;AACvB,QAAA,sBAAsB,MAAMC,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,QAAM,WAAW,QAAQ,iBACxB,sBAAsB,iBAAiB,cAAc;AAGlD,MAAA,MAAMC,gBAAAA,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEG,MAAA;AAEJ,MAAI,qBAAqB;AACb,eAAAC,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAAA,OAiDL;AACK,eAAAA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAmDX;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAIA,MAAM,2BAA2B,OAAO,EACvC,SACA,cACkC;AAClC,QAAM,qBAAqB,MAAMF,gBAAA,gBAChC,QAAQ,iBAAiB,KAAK,CAAC;AAGhC,QAAM,WAAW,QAAQ,iBACxB,qBAAqB,cAAc,SACnC,mBAAmB,MAAMG,wBAAAA,wBAAwB,EAAE,SAAS,QAAA,CAAS,GAAG;AAGrE,MAAA,MAAMH,gBAAAA,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEK,QAAAE,cAAG,MAAME,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAE1D,MAAI,WAAWH,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAiBf,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEO,MAAM,cAA8C,OAC1D,EAAE,qBAAqB,qBAAA,GACvB,YACG;AAEFG,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,MAAM,oBAAoB,EAAE,qBAAqB,sBAAsB;AAAA,IACvE,MAAM,oBAAoB,OAAO;AAAA,IACjC,MAAM,yBAAyB,OAAO;AAAA,EACtC,CAAA,CAAC;AAEJ;;"}
@@ -0,0 +1,3 @@
1
+ import type { ProjectInitHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const projectInit: ProjectInitHook<PluginOptions>;
@@ -167,7 +167,7 @@ const createSliceSimulatorPage = async ({ helpers, options }) => {
167
167
  }
168
168
  await fs.writeFile(filePath, contents);
169
169
  };
170
- const commandInit = async ({ installDependencies: _installDependencies }, context) => {
170
+ const projectInit = async ({ installDependencies: _installDependencies }, context) => {
171
171
  rejectIfNecessary(await Promise.allSettled([
172
172
  await installDependencies({ installDependencies: _installDependencies }),
173
173
  await createPrismicIOFile(context),
@@ -175,6 +175,6 @@ const commandInit = async ({ installDependencies: _installDependencies }, contex
175
175
  ]));
176
176
  };
177
177
  export {
178
- commandInit
178
+ projectInit
179
179
  };
180
- //# sourceMappingURL=command-init.js.map
180
+ //# sourceMappingURL=project-init.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-init.js","sources":["../../../src/hooks/command-init.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type {\n\tCommandInitHook,\n\tCommandInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkPathExists } from \"../lib/checkPathExists\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: CommandInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/client\": \"latest\",\n\t\t\t\"@prismicio/helpers\": \"latest\",\n\t\t\t\"@prismicio/react\": \"latest\",\n\t\t\t\"@prismicio/next\": \"latest\",\n\t\t},\n\t});\n\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/types\": \"latest\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype CreatePrismicIOFileArgs = SliceMachineContext<PluginOptions>;\n\nconst createPrismicIOFile = async ({\n\thelpers,\n\toptions,\n}: CreatePrismicIOFileArgs) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tisTypeScriptProject ? \"prismicio.ts\" : \"prismicio.js\",\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tlet contents: string;\n\n\tif (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes: prismic.ClientConfig[\"routes\"] = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config: prismicNext.CreateClientConfig = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t *\n\t\t\t * @type {prismic.ClientConfig[\"routes\"]}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t}\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst srcDirectoryExists = await checkPathExists(\n\t\thelpers.joinPathFromRoot(\"src\"),\n\t);\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tsrcDirectoryExists ? \"src/pages\" : \"pages\",\n\t\t`slice-simulator.${await getJSOrTSXFileExtension({ helpers, options })}`,\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\n\tlet contents = stripIndent`\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\timport { components } from \"../slices\";\n\n\t\tconst SliceSimulatorPage = () => {\n\t\t\treturn (\n\t\t\t\t<SliceSimulator\n\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\texport default SliceSimulatorPage;\n\t`;\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const commandInit: CommandInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tawait installDependencies({ installDependencies: _installDependencies }),\n\t\t\tawait createPrismicIOFile(context),\n\t\t\tawait createSliceSimulatorPage(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies"],"mappings":";;;;;;;AAoBA,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACnB;AAAA,EAAA,CACD;AAED,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,oBAAoB;AAAA,IACpB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,sBAAsB,OAAO,EAClC,SACA,cAC6B;AACvB,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,QAAM,WAAW,QAAQ,iBACxB,sBAAsB,iBAAiB,cAAc;AAGlD,MAAA,MAAM,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEG,MAAA;AAEJ,MAAI,qBAAqB;AACb,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA,OAiDL;AACK,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmDX;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAIA,MAAM,2BAA2B,OAAO,EACvC,SACA,cACkC;AAClC,QAAM,qBAAqB,MAAM,gBAChC,QAAQ,iBAAiB,KAAK,CAAC;AAGhC,QAAM,WAAW,QAAQ,iBACxB,qBAAqB,cAAc,SACnC,mBAAmB,MAAM,wBAAwB,EAAE,SAAS,QAAA,CAAS,GAAG;AAGrE,MAAA,MAAM,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAE1D,MAAI,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBf,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEO,MAAM,cAA8C,OAC1D,EAAE,qBAAqB,qBAAA,GACvB,YACG;AAEF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,MAAM,oBAAoB,EAAE,qBAAqB,sBAAsB;AAAA,IACvE,MAAM,oBAAoB,OAAO;AAAA,IACjC,MAAM,yBAAyB,OAAO;AAAA,EACtC,CAAA,CAAC;AAEJ;"}
1
+ {"version":3,"file":"project-init.js","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkPathExists } from \"../lib/checkPathExists\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/client\": \"latest\",\n\t\t\t\"@prismicio/helpers\": \"latest\",\n\t\t\t\"@prismicio/react\": \"latest\",\n\t\t\t\"@prismicio/next\": \"latest\",\n\t\t},\n\t});\n\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/types\": \"latest\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype CreatePrismicIOFileArgs = SliceMachineContext<PluginOptions>;\n\nconst createPrismicIOFile = async ({\n\thelpers,\n\toptions,\n}: CreatePrismicIOFileArgs) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tisTypeScriptProject ? \"prismicio.ts\" : \"prismicio.js\",\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tlet contents: string;\n\n\tif (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes: prismic.ClientConfig[\"routes\"] = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config: prismicNext.CreateClientConfig = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t *\n\t\t\t * @type {prismic.ClientConfig[\"routes\"]}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t}\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst srcDirectoryExists = await checkPathExists(\n\t\thelpers.joinPathFromRoot(\"src\"),\n\t);\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tsrcDirectoryExists ? \"src/pages\" : \"pages\",\n\t\t`slice-simulator.${await getJSOrTSXFileExtension({ helpers, options })}`,\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\n\tlet contents = stripIndent`\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\timport { components } from \"../slices\";\n\n\t\tconst SliceSimulatorPage = () => {\n\t\t\treturn (\n\t\t\t\t<SliceSimulator\n\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\texport default SliceSimulatorPage;\n\t`;\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tawait installDependencies({ installDependencies: _installDependencies }),\n\t\t\tawait createPrismicIOFile(context),\n\t\t\tawait createSliceSimulatorPage(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies"],"mappings":";;;;;;;AAoBA,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACnB;AAAA,EAAA,CACD;AAED,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,oBAAoB;AAAA,IACpB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,sBAAsB,OAAO,EAClC,SACA,cAC6B;AACvB,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,QAAM,WAAW,QAAQ,iBACxB,sBAAsB,iBAAiB,cAAc;AAGlD,MAAA,MAAM,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEG,MAAA;AAEJ,MAAI,qBAAqB;AACb,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA,OAiDL;AACK,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmDX;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAIA,MAAM,2BAA2B,OAAO,EACvC,SACA,cACkC;AAClC,QAAM,qBAAqB,MAAM,gBAChC,QAAQ,iBAAiB,KAAK,CAAC;AAGhC,QAAM,WAAW,QAAQ,iBACxB,qBAAqB,cAAc,SACnC,mBAAmB,MAAM,wBAAwB,EAAE,SAAS,QAAA,CAAS,GAAG;AAGrE,MAAA,MAAM,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAE1D,MAAI,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBf,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEO,MAAM,cAA8C,OAC1D,EAAE,qBAAqB,qBAAA,GACvB,YACG;AAEF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,MAAM,oBAAoB,EAAE,qBAAqB,sBAAsB;AAAA,IACvE,MAAM,oBAAoB,OAAO;AAAA,IACjC,MAAM,yBAAyB,OAAO;AAAA,EACtC,CAAA,CAAC;AAEJ;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
- const pascalCase = require("../lib/pascalCase.cjs");
4
+ const buildSliceAssetPath = require("../lib/buildSliceAssetPath.cjs");
5
5
  function _interopNamespaceDefault(e) {
6
6
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
7
  if (e) {
@@ -20,7 +20,13 @@ function _interopNamespaceDefault(e) {
20
20
  }
21
21
  const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
22
22
  const sliceAssetDelete = async (data, context) => {
23
- const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.sliceID), data.assetID);
23
+ const filePath = await buildSliceAssetPath.buildSliceAssetPath({
24
+ libraryID: data.libraryID,
25
+ sliceID: data.sliceID,
26
+ assetID: data.assetID,
27
+ helpers: context.helpers,
28
+ actions: context.actions
29
+ });
24
30
  await fs__namespace.rm(filePath);
25
31
  };
26
32
  exports.sliceAssetDelete = sliceAssetDelete;
@@ -1 +1 @@
1
- {"version":3,"file":"slice-asset-delete.cjs","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.sliceID),\n\t\tdata.assetID,\n\t);\n\n\tawait fs.rm(filePath);\n};\n"],"names":["pascalCase","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,QAAQ,QAAQ,iBAChC,KAAK,WACLA,WAAA,WAAW,KAAK,OAAO,GACvB,KAAK,OAAO;AAGP,QAAAC,cAAG,GAAG,QAAQ;AACrB;;"}
1
+ {"version":3,"file":"slice-asset-delete.cjs","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":["buildSliceAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,MAAMA,wCAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,GAAG,QAAQ;AACrB;;"}
@@ -1,7 +1,13 @@
1
1
  import * as fs from "node:fs/promises";
2
- import { pascalCase } from "../lib/pascalCase.js";
2
+ import { buildSliceAssetPath } from "../lib/buildSliceAssetPath.js";
3
3
  const sliceAssetDelete = async (data, context) => {
4
- const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.sliceID), data.assetID);
4
+ const filePath = await buildSliceAssetPath({
5
+ libraryID: data.libraryID,
6
+ sliceID: data.sliceID,
7
+ assetID: data.assetID,
8
+ helpers: context.helpers,
9
+ actions: context.actions
10
+ });
5
11
  await fs.rm(filePath);
6
12
  };
7
13
  export {