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

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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slicemachine/adapter-next",
3
- "version": "0.0.12",
3
+ "version": "0.0.13-dev-plugins-validation.1",
4
4
  "description": "Slice Machine adapter for Next.js.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -52,17 +52,20 @@
52
52
  "release:alpha:dry": "standard-version --release-as major --prerelease alpha --dry-run",
53
53
  "release:dry": "standard-version --dry-run",
54
54
  "size": "size-limit",
55
- "test": "npm run lint && npm run unit && npm run build && npm run size",
55
+ "test": "npm run lint && npm run types && npm run unit && npm run build && npm run size",
56
+ "types": "tsc --noEmit",
56
57
  "unit": "vitest run --coverage",
57
- "unit:watch": "vitest watch"
58
+ "unit:watch": "vitest watch",
59
+ "depcheck": "depcheck --config=.depcheckrc",
60
+ "audit": "better-npm-audit audit -l high -p"
58
61
  },
59
62
  "dependencies": {
60
63
  "@prismicio/slice-simulator-core": "^0.2.7",
61
64
  "@prismicio/types": "^0.2.7",
62
- "@slicemachine/plugin-kit": "0.1.8-dev-plugins.12",
65
+ "@slicemachine/plugin-kit": "0.1.8-dev-plugins-validation.1",
63
66
  "common-tags": "^1.8.2",
64
67
  "fs-extra": "^11.1.0",
65
- "node-fetch": "^3.3.0",
68
+ "node-fetch": "^3.3.1",
66
69
  "pascal-case": "^3.1.2",
67
70
  "prismic-ts-codegen": "^0.1.5"
68
71
  },
@@ -74,15 +77,15 @@
74
77
  "@types/prettier": "^2.7.2",
75
78
  "@types/react": "^18.0.28",
76
79
  "@types/semver": "^7.3.13",
77
- "@typescript-eslint/eslint-plugin": "^5.54.0",
78
- "@typescript-eslint/parser": "^5.54.0",
80
+ "@typescript-eslint/eslint-plugin": "^5.55.0",
81
+ "@typescript-eslint/parser": "^5.55.0",
79
82
  "@vitejs/plugin-react": "^3.1.0",
80
- "@vitest/coverage-c8": "^0.29.1",
81
- "eslint": "^8.35.0",
82
- "eslint-config-prettier": "^8.6.0",
83
+ "@vitest/coverage-c8": "^0.27.3",
84
+ "better-npm-audit": "^3.7.3",
85
+ "eslint": "^8.36.0",
86
+ "eslint-config-prettier": "^8.7.0",
83
87
  "eslint-plugin-prettier": "^4.2.1",
84
88
  "eslint-plugin-tsdoc": "^0.2.17",
85
- "npm-run-all": "^4.1.5",
86
89
  "prettier": "^2.8.4",
87
90
  "prettier-plugin-jsdoc": "^0.4.2",
88
91
  "react": "^18.2.0",
@@ -91,8 +94,8 @@
91
94
  "ts-morph": "^17.0.1",
92
95
  "typescript": "^4.9.5",
93
96
  "vite": "^4.1.4",
94
- "vite-plugin-sdk": "^0.1.0",
95
- "vitest": "^0.29.1"
97
+ "vite-plugin-sdk": "^0.1.1",
98
+ "vitest": "^0.27.3"
96
99
  },
97
100
  "peerDependencies": {
98
101
  "next": "^11 || ^12 || ^13",
@@ -103,5 +106,6 @@
103
106
  },
104
107
  "publishConfig": {
105
108
  "access": "public"
106
- }
109
+ },
110
+ "gitHead": "be509347c1cfaed23c9b9f714051a38436d4d9de"
107
111
  }
@@ -1,16 +1,18 @@
1
1
  import type { CustomTypeAssetDeleteHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
 
4
+ import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath";
5
+
4
6
  import type { PluginOptions } from "../types";
5
7
 
6
8
  export const customTypeAssetDelete: CustomTypeAssetDeleteHook<
7
9
  PluginOptions
8
10
  > = async (data, context) => {
9
- const filePath = context.helpers.joinPathFromRoot(
10
- "customtypes",
11
- data.customTypeID,
12
- data.assetID,
13
- );
11
+ const filePath = buildCustomTypeAssetPath({
12
+ customTypeID: data.customTypeID,
13
+ assetID: data.assetID,
14
+ helpers: context.helpers,
15
+ });
14
16
 
15
17
  await fs.rm(filePath);
16
18
  };
@@ -1,16 +1,18 @@
1
1
  import type { CustomTypeAssetReadHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
 
4
+ import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath";
5
+
4
6
  import type { PluginOptions } from "../types";
5
7
 
6
8
  export const customTypeAssetRead: CustomTypeAssetReadHook<
7
9
  PluginOptions
8
10
  > = async (data, context) => {
9
- const filePath = context.helpers.joinPathFromRoot(
10
- "customtypes",
11
- data.customTypeID,
12
- data.assetID,
13
- );
11
+ const filePath = buildCustomTypeAssetPath({
12
+ customTypeID: data.customTypeID,
13
+ assetID: data.assetID,
14
+ helpers: context.helpers,
15
+ });
14
16
 
15
17
  const assetData = await fs.readFile(filePath);
16
18
 
@@ -2,16 +2,18 @@ import type { CustomTypeAssetUpdateHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
 
5
+ import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath";
6
+
5
7
  import type { PluginOptions } from "../types";
6
8
 
7
9
  export const customTypeAssetUpdate: CustomTypeAssetUpdateHook<
8
10
  PluginOptions
9
11
  > = async (data, context) => {
10
- const filePath = context.helpers.joinPathFromRoot(
11
- "customtypes",
12
- data.customTypeID,
13
- data.asset.id,
14
- );
12
+ const filePath = buildCustomTypeAssetPath({
13
+ customTypeID: data.customTypeID,
14
+ assetID: data.asset.id,
15
+ helpers: context.helpers,
16
+ });
15
17
 
16
18
  await fs.mkdir(path.dirname(filePath), { recursive: true });
17
19
  await fs.writeFile(filePath, data.asset.data);
@@ -6,6 +6,7 @@ import type {
6
6
  import * as fs from "node:fs/promises";
7
7
  import * as path from "node:path";
8
8
 
9
+ import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath";
9
10
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
10
11
 
11
12
  import type { PluginOptions } from "../types";
@@ -31,7 +32,10 @@ export const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (
31
32
  data,
32
33
  context,
33
34
  ) => {
34
- const dir = context.helpers.joinPathFromRoot("customtypes", data.model.id);
35
+ const dir = buildCustomTypeDirectoryPath({
36
+ customTypeID: data.model.id,
37
+ helpers: context.helpers,
38
+ });
35
39
 
36
40
  await fs.mkdir(dir, { recursive: true });
37
41
 
@@ -1,6 +1,7 @@
1
1
  import type { CustomTypeDeleteHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
 
4
+ import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath";
4
5
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
5
6
 
6
7
  import type { PluginOptions } from "../types";
@@ -9,7 +10,10 @@ export const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (
9
10
  data,
10
11
  context,
11
12
  ) => {
12
- const dir = context.helpers.joinPathFromRoot("customtypes", data.model.id);
13
+ const dir = buildCustomTypeDirectoryPath({
14
+ customTypeID: data.model.id,
15
+ helpers: context.helpers,
16
+ });
13
17
 
14
18
  await fs.rm(dir, { recursive: true });
15
19
 
@@ -1,6 +1,8 @@
1
1
  import type { CustomTypeReadHook } from "@slicemachine/plugin-kit";
2
2
  import * as prismicT from "@prismicio/types";
3
+ import * as path from "node:path";
3
4
 
5
+ import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath";
4
6
  import { readJSONFile } from "../lib/readJSONFile";
5
7
 
6
8
  import type { PluginOptions } from "../types";
@@ -9,9 +11,8 @@ export const customTypeRead: CustomTypeReadHook<PluginOptions> = async (
9
11
  data,
10
12
  { helpers },
11
13
  ) => {
12
- const filePath = helpers.joinPathFromRoot(
13
- "customtypes",
14
- data.id,
14
+ const filePath = path.join(
15
+ buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),
15
16
  "index.json",
16
17
  );
17
18
 
@@ -3,6 +3,7 @@ import * as prismicT from "@prismicio/types";
3
3
  import * as fs from "node:fs/promises";
4
4
  import * as path from "node:path";
5
5
 
6
+ import { buildCustomTypeLibraryDirectoryPath } from "../lib/buildCustomTypeLibraryDirectoryPath";
6
7
  import { readJSONFile } from "../lib/readJSONFile";
7
8
 
8
9
  import type { PluginOptions } from "../types";
@@ -17,7 +18,7 @@ const isCustomTypeModel = (
17
18
  export const customTypeLibraryRead: CustomTypeLibraryReadHook<
18
19
  PluginOptions
19
20
  > = async (_data, { helpers }) => {
20
- const dirPath = helpers.joinPathFromRoot("customtypes");
21
+ const dirPath = buildCustomTypeLibraryDirectoryPath({ helpers });
21
22
 
22
23
  // Ensure the directory exists.
23
24
  await fs.mkdir(dirPath, { recursive: true });
@@ -1,8 +1,8 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
3
  import type {
4
- CommandInitHook,
5
- CommandInitHookData,
4
+ ProjectInitHook,
5
+ ProjectInitHookData,
6
6
  SliceMachineContext,
7
7
  } from "@slicemachine/plugin-kit";
8
8
  import { stripIndent } from "common-tags";
@@ -15,7 +15,7 @@ import type { PluginOptions } from "../types";
15
15
  import { checkIsTypeScriptProject } from "../lib/checkIsTypeScriptProject";
16
16
 
17
17
  type InstallDependenciesArgs = {
18
- installDependencies: CommandInitHookData["installDependencies"];
18
+ installDependencies: ProjectInitHookData["installDependencies"];
19
19
  };
20
20
 
21
21
  const installDependencies = async ({
@@ -215,7 +215,7 @@ const createSliceSimulatorPage = async ({
215
215
  await fs.writeFile(filePath, contents);
216
216
  };
217
217
 
218
- export const commandInit: CommandInitHook<PluginOptions> = async (
218
+ export const projectInit: ProjectInitHook<PluginOptions> = async (
219
219
  { installDependencies: _installDependencies },
220
220
  context,
221
221
  ) => {
@@ -1,7 +1,7 @@
1
1
  import type { SliceAssetDeleteHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
 
4
- import { pascalCase } from "../lib/pascalCase";
4
+ import { buildSliceAssetPath } from "../lib/buildSliceAssetPath";
5
5
 
6
6
  import type { PluginOptions } from "../types";
7
7
 
@@ -9,11 +9,13 @@ export const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (
9
9
  data,
10
10
  context,
11
11
  ) => {
12
- const filePath = context.helpers.joinPathFromRoot(
13
- data.libraryID,
14
- pascalCase(data.sliceID),
15
- data.assetID,
16
- );
12
+ const filePath = await buildSliceAssetPath({
13
+ libraryID: data.libraryID,
14
+ sliceID: data.sliceID,
15
+ assetID: data.assetID,
16
+ helpers: context.helpers,
17
+ actions: context.actions,
18
+ });
17
19
 
18
20
  await fs.rm(filePath);
19
21
  };
@@ -1,7 +1,7 @@
1
1
  import type { SliceAssetReadHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
 
4
- import { pascalCase } from "../lib/pascalCase";
4
+ import { buildSliceAssetPath } from "../lib/buildSliceAssetPath";
5
5
 
6
6
  import type { PluginOptions } from "../types";
7
7
 
@@ -9,11 +9,13 @@ export const sliceAssetRead: SliceAssetReadHook<PluginOptions> = async (
9
9
  data,
10
10
  context,
11
11
  ) => {
12
- const filePath = context.helpers.joinPathFromRoot(
13
- data.libraryID,
14
- pascalCase(data.sliceID),
15
- data.assetID,
16
- );
12
+ const filePath = await buildSliceAssetPath({
13
+ libraryID: data.libraryID,
14
+ sliceID: data.sliceID,
15
+ assetID: data.assetID,
16
+ helpers: context.helpers,
17
+ actions: context.actions,
18
+ });
17
19
 
18
20
  const assetData = await fs.readFile(filePath);
19
21
 
@@ -2,7 +2,7 @@ import type { SliceAssetUpdateHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
 
5
- import { pascalCase } from "../lib/pascalCase";
5
+ import { buildSliceAssetPath } from "../lib/buildSliceAssetPath";
6
6
 
7
7
  import type { PluginOptions } from "../types";
8
8
 
@@ -10,11 +10,13 @@ export const sliceAssetUpdate: SliceAssetUpdateHook<PluginOptions> = async (
10
10
  data,
11
11
  context,
12
12
  ) => {
13
- const filePath = context.helpers.joinPathFromRoot(
14
- data.libraryID,
15
- pascalCase(data.sliceID),
16
- data.asset.id,
17
- );
13
+ const filePath = await buildSliceAssetPath({
14
+ libraryID: data.libraryID,
15
+ sliceID: data.sliceID,
16
+ assetID: data.asset.id,
17
+ helpers: context.helpers,
18
+ actions: context.actions,
19
+ });
18
20
 
19
21
  await fs.mkdir(path.dirname(filePath), { recursive: true });
20
22
  await fs.writeFile(filePath, data.asset.data);
@@ -7,10 +7,12 @@ import { stripIndent } from "common-tags";
7
7
  import * as fs from "node:fs/promises";
8
8
  import * as path from "node:path";
9
9
 
10
+ import { buildSliceDirectoryPath } from "../lib/buildSliceDirectoryPath";
10
11
  import { checkIsTypeScriptProject } from "../lib/checkIsTypeScriptProject";
11
12
  import { getJSOrTSXFileExtension } from "../lib/getJSOrTSXFileExtension";
12
13
  import { pascalCase } from "../lib/pascalCase";
13
14
  import { rejectIfNecessary } from "../lib/rejectIfNecessary";
15
+ import { updateSliceModelFile } from "../lib/updateSliceModelFile";
14
16
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
15
17
  import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile";
16
18
 
@@ -21,18 +23,6 @@ type Args = {
21
23
  data: SliceCreateHookData;
22
24
  } & SliceMachineContext<PluginOptions>;
23
25
 
24
- const createModelFile = async ({ dir, data, helpers, options }: Args) => {
25
- const filePath = path.join(dir, "model.json");
26
-
27
- let contents = JSON.stringify(data.model);
28
-
29
- if (options.format) {
30
- contents = await helpers.format(contents, filePath);
31
- }
32
-
33
- await fs.writeFile(filePath, contents);
34
- };
35
-
36
26
  const createComponentFile = async ({ dir, data, helpers, options }: Args) => {
37
27
  const filePath = path.join(
38
28
  dir,
@@ -107,16 +97,21 @@ export const sliceCreate: SliceCreateHook<PluginOptions> = async (
107
97
  data,
108
98
  context,
109
99
  ) => {
110
- const dir = context.helpers.joinPathFromRoot(
111
- data.libraryID,
112
- pascalCase(data.model.name),
113
- );
100
+ const dir = buildSliceDirectoryPath({
101
+ libraryID: data.libraryID,
102
+ model: data.model,
103
+ helpers: context.helpers,
104
+ });
114
105
 
115
106
  await fs.mkdir(dir, { recursive: true });
116
107
 
117
108
  rejectIfNecessary(
118
109
  await Promise.allSettled([
119
- createModelFile({ dir, data, ...context }),
110
+ updateSliceModelFile({
111
+ libraryID: data.libraryID,
112
+ model: data.model,
113
+ ...context,
114
+ }),
120
115
  createComponentFile({ dir, data, ...context }),
121
116
  ]),
122
117
  );
@@ -5,7 +5,7 @@ import type {
5
5
  } from "@slicemachine/plugin-kit";
6
6
  import * as fs from "node:fs/promises";
7
7
 
8
- import { pascalCase } from "../lib/pascalCase";
8
+ import { buildSliceDirectoryPath } from "../lib/buildSliceDirectoryPath";
9
9
  import { rejectIfNecessary } from "../lib/rejectIfNecessary";
10
10
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
11
11
  import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile";
@@ -17,10 +17,11 @@ type Args = {
17
17
  } & SliceMachineContext<PluginOptions>;
18
18
 
19
19
  const deleteSliceDir = async ({ data, helpers }: Args) => {
20
- const dir = helpers.joinPathFromRoot(
21
- data.libraryID,
22
- pascalCase(data.model.name),
23
- );
20
+ const dir = buildSliceDirectoryPath({
21
+ libraryID: data.libraryID,
22
+ model: data.model,
23
+ helpers,
24
+ });
24
25
 
25
26
  await fs.rm(dir, { recursive: true });
26
27
  };
@@ -2,6 +2,7 @@ import type { SliceReadHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
 
5
+ import { buildSliceLibraryDirectoryPath } from "../lib/buildSliceLibraryDirectoryPath";
5
6
  import { isSharedSliceModel } from "../lib/isSharedSliceModel";
6
7
  import { readJSONFile } from "../lib/readJSONFile";
7
8
 
@@ -11,7 +12,10 @@ export const sliceRead: SliceReadHook<PluginOptions> = async (
11
12
  data,
12
13
  { helpers },
13
14
  ) => {
14
- const libraryDir = helpers.joinPathFromRoot(data.libraryID);
15
+ const libraryDir = buildSliceLibraryDirectoryPath({
16
+ libraryID: data.libraryID,
17
+ helpers,
18
+ });
15
19
 
16
20
  // Ensure the directory exists.
17
21
  await fs.mkdir(libraryDir, { recursive: true });
@@ -1,7 +1,7 @@
1
1
  import type { SliceRenameHook } from "@slicemachine/plugin-kit";
2
2
  import * as fse from "fs-extra";
3
3
 
4
- import { pascalCase } from "../lib/pascalCase";
4
+ import { buildSliceDirectoryPath } from "../lib/buildSliceDirectoryPath";
5
5
  import { rejectIfNecessary } from "../lib/rejectIfNecessary";
6
6
  import { updateSliceModelFile } from "../lib/updateSliceModelFile";
7
7
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
@@ -19,14 +19,16 @@ export const sliceRename: SliceRenameHook<PluginOptions> = async (
19
19
  });
20
20
 
21
21
  await fse.move(
22
- context.helpers.joinPathFromRoot(
23
- data.libraryID,
24
- pascalCase(currentModel.name),
25
- ),
26
- context.helpers.joinPathFromRoot(
27
- data.libraryID,
28
- pascalCase(data.model.name),
29
- ),
22
+ buildSliceDirectoryPath({
23
+ libraryID: data.libraryID,
24
+ model: currentModel,
25
+ helpers: context.helpers,
26
+ }),
27
+ buildSliceDirectoryPath({
28
+ libraryID: data.libraryID,
29
+ model: data.model,
30
+ helpers: context.helpers,
31
+ }),
30
32
  );
31
33
 
32
34
  await updateSliceModelFile({
@@ -2,6 +2,7 @@ import type { SliceLibraryReadHook } from "@slicemachine/plugin-kit";
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
 
5
+ import { buildSliceLibraryDirectoryPath } from "../lib/buildSliceLibraryDirectoryPath";
5
6
  import { isSharedSliceModel } from "../lib/isSharedSliceModel";
6
7
  import { readJSONFile } from "../lib/readJSONFile";
7
8
 
@@ -11,7 +12,10 @@ export const sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (
11
12
  data,
12
13
  { helpers },
13
14
  ) => {
14
- const dir = helpers.joinPathFromRoot(data.libraryID);
15
+ const dir = buildSliceLibraryDirectoryPath({
16
+ libraryID: data.libraryID,
17
+ helpers,
18
+ });
15
19
 
16
20
  // Ensure the directory exists.
17
21
  await fs.mkdir(dir, { recursive: true });
@@ -0,0 +1,24 @@
1
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+ import * as path from "node:path";
3
+
4
+ import { PluginOptions } from "../types";
5
+
6
+ import { buildCustomTypeDirectoryPath } from "./buildCustomTypeDirectoryPath";
7
+
8
+ type BuildCustomTypeAssetPathArgs = {
9
+ customTypeID: string;
10
+ assetID: string;
11
+ helpers: SliceMachineContext<PluginOptions>["helpers"];
12
+ };
13
+
14
+ export const buildCustomTypeAssetPath = (
15
+ args: BuildCustomTypeAssetPathArgs,
16
+ ): string => {
17
+ return path.join(
18
+ buildCustomTypeDirectoryPath({
19
+ customTypeID: args.customTypeID,
20
+ helpers: args.helpers,
21
+ }),
22
+ args.assetID,
23
+ );
24
+ };
@@ -0,0 +1,20 @@
1
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+ import * as path from "node:path";
3
+
4
+ import { PluginOptions } from "../types";
5
+
6
+ import { buildCustomTypeLibraryDirectoryPath } from "./buildCustomTypeLibraryDirectoryPath";
7
+
8
+ type BuildCustomTypeDirectoryPathArgs = {
9
+ customTypeID: string;
10
+ helpers: SliceMachineContext<PluginOptions>["helpers"];
11
+ };
12
+
13
+ export const buildCustomTypeDirectoryPath = (
14
+ args: BuildCustomTypeDirectoryPathArgs,
15
+ ): string => {
16
+ return path.join(
17
+ buildCustomTypeLibraryDirectoryPath({ helpers: args.helpers }),
18
+ args.customTypeID,
19
+ );
20
+ };
@@ -0,0 +1,13 @@
1
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+
3
+ import { PluginOptions } from "../types";
4
+
5
+ type BuildCustomTypeLibraryDirectoryPathArgs = {
6
+ helpers: SliceMachineContext<PluginOptions>["helpers"];
7
+ };
8
+
9
+ export const buildCustomTypeLibraryDirectoryPath = (
10
+ args: BuildCustomTypeLibraryDirectoryPathArgs,
11
+ ): string => {
12
+ return args.helpers.joinPathFromRoot("customtypes");
13
+ };
@@ -0,0 +1,32 @@
1
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+ import * as path from "node:path";
3
+
4
+ import { PluginOptions } from "../types";
5
+
6
+ import { buildSliceDirectoryPath } from "./buildSliceDirectoryPath";
7
+
8
+ type BuildSliceAssetPathArgs = {
9
+ libraryID: string;
10
+ sliceID: string;
11
+ assetID: string;
12
+ actions: SliceMachineContext<PluginOptions>["actions"];
13
+ helpers: SliceMachineContext<PluginOptions>["helpers"];
14
+ };
15
+
16
+ export const buildSliceAssetPath = async (
17
+ args: BuildSliceAssetPathArgs,
18
+ ): Promise<string> => {
19
+ const { model } = await args.actions.readSliceModel({
20
+ libraryID: args.libraryID,
21
+ sliceID: args.sliceID,
22
+ });
23
+
24
+ return path.join(
25
+ buildSliceDirectoryPath({
26
+ libraryID: args.libraryID,
27
+ model,
28
+ helpers: args.helpers,
29
+ }),
30
+ args.assetID,
31
+ );
32
+ };
@@ -0,0 +1,26 @@
1
+ import { SharedSliceModel } from "@prismicio/types";
2
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
3
+ import * as path from "node:path";
4
+
5
+ import { PluginOptions } from "../types";
6
+
7
+ import { buildSliceLibraryDirectoryPath } from "./buildSliceLibraryDirectoryPath";
8
+ import { pascalCase } from "./pascalCase";
9
+
10
+ type BuildSliceDirectoryPathArgs = {
11
+ libraryID: string;
12
+ model: SharedSliceModel;
13
+ helpers: SliceMachineContext<PluginOptions>["helpers"];
14
+ };
15
+
16
+ export const buildSliceDirectoryPath = (
17
+ args: BuildSliceDirectoryPathArgs,
18
+ ): string => {
19
+ return path.join(
20
+ buildSliceLibraryDirectoryPath({
21
+ libraryID: args.libraryID,
22
+ helpers: args.helpers,
23
+ }),
24
+ pascalCase(args.model.name),
25
+ );
26
+ };
@@ -0,0 +1,14 @@
1
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+
3
+ import { PluginOptions } from "../types";
4
+
5
+ type BuildSliceLibraryDirectoryPathArgs = {
6
+ libraryID: string;
7
+ helpers: SliceMachineContext<PluginOptions>["helpers"];
8
+ };
9
+
10
+ export const buildSliceLibraryDirectoryPath = (
11
+ args: BuildSliceLibraryDirectoryPathArgs,
12
+ ): string => {
13
+ return args.helpers.joinPathFromRoot(args.libraryID);
14
+ };
@@ -1,9 +1,11 @@
1
1
  import { SharedSliceModel } from "@prismicio/types";
2
2
  import { SliceMachineContext } from "@slicemachine/plugin-kit";
3
3
  import * as fs from "node:fs/promises";
4
+ import * as path from "node:path";
4
5
 
5
6
  import type { PluginOptions } from "../types";
6
- import { pascalCase } from "./pascalCase";
7
+
8
+ import { buildSliceDirectoryPath } from "./buildSliceDirectoryPath";
7
9
 
8
10
  type UpdateSliceModelFileArgs = {
9
11
  libraryID: string;
@@ -16,9 +18,8 @@ export const updateSliceModelFile = async ({
16
18
  helpers,
17
19
  options,
18
20
  }: UpdateSliceModelFileArgs): Promise<void> => {
19
- const filePath = helpers.joinPathFromRoot(
20
- libraryID,
21
- pascalCase(model.name),
21
+ const filePath = path.join(
22
+ buildSliceDirectoryPath({ libraryID, model, helpers }),
22
23
  "model.json",
23
24
  );
24
25