@slicemachine/adapter-next 0.0.1 → 0.0.3

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 (185) hide show
  1. package/dist/SliceSimulator.cjs +93 -0
  2. package/dist/SliceSimulator.cjs.map +1 -0
  3. package/dist/SliceSimulator.d.ts +29 -0
  4. package/dist/SliceSimulator.js +74 -0
  5. package/dist/SliceSimulator.js.map +1 -0
  6. package/dist/hooks/customType-asset-delete.cjs +28 -0
  7. package/dist/hooks/customType-asset-delete.cjs.map +1 -0
  8. package/dist/hooks/customType-asset-delete.d.ts +3 -0
  9. package/dist/hooks/customType-asset-delete.js +9 -0
  10. package/dist/hooks/customType-asset-delete.js.map +1 -0
  11. package/dist/hooks/customType-asset-read.cjs +31 -0
  12. package/dist/hooks/customType-asset-read.cjs.map +1 -0
  13. package/dist/hooks/customType-asset-read.d.ts +3 -0
  14. package/dist/hooks/customType-asset-read.js +12 -0
  15. package/dist/hooks/customType-asset-read.js.map +1 -0
  16. package/dist/hooks/customType-asset-update.cjs +31 -0
  17. package/dist/hooks/customType-asset-update.cjs.map +1 -0
  18. package/dist/hooks/customType-asset-update.d.ts +3 -0
  19. package/dist/hooks/customType-asset-update.js +11 -0
  20. package/dist/hooks/customType-asset-update.js.map +1 -0
  21. package/dist/hooks/customType-create.cjs +41 -0
  22. package/dist/hooks/customType-create.cjs.map +1 -0
  23. package/dist/hooks/customType-create.d.ts +3 -0
  24. package/dist/hooks/customType-create.js +21 -0
  25. package/dist/hooks/customType-create.js.map +1 -0
  26. package/dist/hooks/customType-delete.cjs +30 -0
  27. package/dist/hooks/customType-delete.cjs.map +1 -0
  28. package/dist/hooks/customType-delete.d.ts +3 -0
  29. package/dist/hooks/customType-delete.js +11 -0
  30. package/dist/hooks/customType-delete.js.map +1 -0
  31. package/dist/hooks/customType-read.cjs +12 -0
  32. package/dist/hooks/customType-read.cjs.map +1 -0
  33. package/dist/hooks/customType-read.d.ts +3 -0
  34. package/dist/hooks/customType-read.js +12 -0
  35. package/dist/hooks/customType-read.js.map +1 -0
  36. package/dist/hooks/customType-rename.cjs +6 -0
  37. package/dist/hooks/customType-rename.cjs.map +1 -0
  38. package/dist/hooks/customType-rename.d.ts +1 -0
  39. package/dist/hooks/customType-rename.js +6 -0
  40. package/dist/hooks/customType-rename.js.map +1 -0
  41. package/dist/hooks/customType-update.cjs +6 -0
  42. package/dist/hooks/customType-update.cjs.map +1 -0
  43. package/dist/hooks/customType-update.d.ts +1 -0
  44. package/dist/hooks/customType-update.js +6 -0
  45. package/dist/hooks/customType-update.js.map +1 -0
  46. package/dist/hooks/customTypeLibrary-read.cjs +54 -0
  47. package/dist/hooks/customTypeLibrary-read.cjs.map +1 -0
  48. package/dist/hooks/customTypeLibrary-read.d.ts +3 -0
  49. package/dist/hooks/customTypeLibrary-read.js +34 -0
  50. package/dist/hooks/customTypeLibrary-read.js.map +1 -0
  51. package/dist/hooks/slice-asset-delete.cjs +29 -0
  52. package/dist/hooks/slice-asset-delete.cjs.map +1 -0
  53. package/dist/hooks/slice-asset-delete.d.ts +3 -0
  54. package/dist/hooks/slice-asset-delete.js +10 -0
  55. package/dist/hooks/slice-asset-delete.js.map +1 -0
  56. package/dist/hooks/slice-asset-read.cjs +32 -0
  57. package/dist/hooks/slice-asset-read.cjs.map +1 -0
  58. package/dist/hooks/slice-asset-read.d.ts +3 -0
  59. package/dist/hooks/slice-asset-read.js +13 -0
  60. package/dist/hooks/slice-asset-read.js.map +1 -0
  61. package/dist/hooks/slice-asset-update.cjs +32 -0
  62. package/dist/hooks/slice-asset-update.cjs.map +1 -0
  63. package/dist/hooks/slice-asset-update.d.ts +3 -0
  64. package/dist/hooks/slice-asset-update.js +12 -0
  65. package/dist/hooks/slice-asset-update.js.map +1 -0
  66. package/dist/hooks/slice-create.cjs +109 -0
  67. package/dist/hooks/slice-create.cjs.map +1 -0
  68. package/dist/hooks/slice-create.d.ts +3 -0
  69. package/dist/hooks/slice-create.js +89 -0
  70. package/dist/hooks/slice-create.js.map +1 -0
  71. package/dist/hooks/slice-delete.cjs +39 -0
  72. package/dist/hooks/slice-delete.cjs.map +1 -0
  73. package/dist/hooks/slice-delete.d.ts +3 -0
  74. package/dist/hooks/slice-delete.js +20 -0
  75. package/dist/hooks/slice-delete.js.map +1 -0
  76. package/dist/hooks/slice-read.cjs +49 -0
  77. package/dist/hooks/slice-read.cjs.map +1 -0
  78. package/dist/hooks/slice-read.d.ts +3 -0
  79. package/dist/hooks/slice-read.js +29 -0
  80. package/dist/hooks/slice-read.js.map +1 -0
  81. package/dist/hooks/slice-rename.cjs +45 -0
  82. package/dist/hooks/slice-rename.cjs.map +1 -0
  83. package/dist/hooks/slice-rename.d.ts +3 -0
  84. package/dist/hooks/slice-rename.js +26 -0
  85. package/dist/hooks/slice-rename.js.map +1 -0
  86. package/dist/hooks/slice-update.cjs +14 -0
  87. package/dist/hooks/slice-update.cjs.map +1 -0
  88. package/dist/hooks/slice-update.d.ts +3 -0
  89. package/dist/hooks/slice-update.js +14 -0
  90. package/dist/hooks/slice-update.js.map +1 -0
  91. package/dist/hooks/sliceLibrary-read.cjs +50 -0
  92. package/dist/hooks/sliceLibrary-read.cjs.map +1 -0
  93. package/dist/hooks/sliceLibrary-read.d.ts +3 -0
  94. package/dist/hooks/sliceLibrary-read.js +30 -0
  95. package/dist/hooks/sliceLibrary-read.js.map +1 -0
  96. package/dist/hooks/sliceSimulator-setup-read.cjs +217 -0
  97. package/dist/hooks/sliceSimulator-setup-read.cjs.map +1 -0
  98. package/dist/hooks/sliceSimulator-setup-read.d.ts +3 -0
  99. package/dist/hooks/sliceSimulator-setup-read.js +198 -0
  100. package/dist/hooks/sliceSimulator-setup-read.js.map +1 -0
  101. package/dist/hooks/snippet-read.cjs +96 -0
  102. package/dist/hooks/snippet-read.cjs.map +1 -0
  103. package/dist/hooks/snippet-read.d.ts +3 -0
  104. package/dist/hooks/snippet-read.js +77 -0
  105. package/dist/hooks/snippet-read.js.map +1 -0
  106. package/dist/index.cjs +6 -698
  107. package/dist/index.cjs.map +1 -1
  108. package/dist/index.d.ts +5 -45
  109. package/dist/index.js +6 -669
  110. package/dist/index.js.map +1 -1
  111. package/dist/lib/getJSOrTSXFileExtension.cjs +13 -0
  112. package/dist/lib/getJSOrTSXFileExtension.cjs.map +1 -0
  113. package/dist/lib/getJSOrTSXFileExtension.d.ts +2 -0
  114. package/dist/lib/getJSOrTSXFileExtension.js +13 -0
  115. package/dist/lib/getJSOrTSXFileExtension.js.map +1 -0
  116. package/dist/lib/isSharedSliceModel.cjs +27 -0
  117. package/dist/lib/isSharedSliceModel.cjs.map +1 -0
  118. package/dist/lib/isSharedSliceModel.d.ts +2 -0
  119. package/dist/lib/isSharedSliceModel.js +8 -0
  120. package/dist/lib/isSharedSliceModel.js.map +1 -0
  121. package/dist/lib/pascalCase.cjs +8 -0
  122. package/dist/lib/pascalCase.cjs.map +1 -0
  123. package/dist/lib/pascalCase.d.ts +8 -0
  124. package/dist/lib/pascalCase.js +8 -0
  125. package/dist/lib/pascalCase.js.map +1 -0
  126. package/dist/lib/readJSONFile.cjs +28 -0
  127. package/dist/lib/readJSONFile.cjs.map +1 -0
  128. package/dist/lib/readJSONFile.d.ts +1 -0
  129. package/dist/lib/readJSONFile.js +9 -0
  130. package/dist/lib/readJSONFile.js.map +1 -0
  131. package/dist/lib/rejectIfNecessary.cjs +10 -0
  132. package/dist/lib/rejectIfNecessary.cjs.map +1 -0
  133. package/dist/lib/rejectIfNecessary.d.ts +1 -0
  134. package/dist/lib/rejectIfNecessary.js +10 -0
  135. package/dist/lib/rejectIfNecessary.js.map +1 -0
  136. package/dist/lib/updateSliceModelFile.cjs +33 -0
  137. package/dist/lib/updateSliceModelFile.cjs.map +1 -0
  138. package/dist/lib/updateSliceModelFile.d.ts +9 -0
  139. package/dist/lib/updateSliceModelFile.js +14 -0
  140. package/dist/lib/updateSliceModelFile.js.map +1 -0
  141. package/dist/lib/upsertGlobalContentTypes.cjs +53 -0
  142. package/dist/lib/upsertGlobalContentTypes.cjs.map +1 -0
  143. package/dist/lib/upsertGlobalContentTypes.d.ts +12 -0
  144. package/dist/lib/upsertGlobalContentTypes.js +33 -0
  145. package/dist/lib/upsertGlobalContentTypes.js.map +1 -0
  146. package/dist/lib/upsertSliceLibraryIndexFile.cjs +47 -0
  147. package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -0
  148. package/dist/lib/upsertSliceLibraryIndexFile.d.ts +7 -0
  149. package/dist/lib/upsertSliceLibraryIndexFile.js +28 -0
  150. package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -0
  151. package/dist/package.cjs +5 -0
  152. package/dist/package.cjs.map +1 -0
  153. package/dist/package.js +5 -0
  154. package/dist/package.js.map +1 -0
  155. package/dist/plugin.cjs +56 -0
  156. package/dist/plugin.cjs.map +1 -0
  157. package/dist/plugin.d.ts +2 -0
  158. package/dist/plugin.js +56 -0
  159. package/dist/plugin.js.map +1 -0
  160. package/dist/types.d.ts +9 -0
  161. package/package.json +28 -23
  162. package/src/hooks/customType-asset-delete.ts +16 -0
  163. package/src/hooks/customType-asset-read.ts +20 -0
  164. package/src/hooks/customType-asset-update.ts +18 -0
  165. package/src/hooks/customType-create.ts +5 -20
  166. package/src/hooks/customType-delete.ts +6 -2
  167. package/src/hooks/customType-read.ts +5 -1
  168. package/src/hooks/customType-rename.ts +3 -0
  169. package/src/hooks/{customType-library-read.ts → customTypeLibrary-read.ts} +16 -4
  170. package/src/hooks/slice-asset-delete.ts +19 -0
  171. package/src/hooks/slice-asset-read.ts +23 -0
  172. package/src/hooks/slice-asset-update.ts +21 -0
  173. package/src/hooks/slice-create.ts +27 -52
  174. package/src/hooks/slice-delete.ts +11 -21
  175. package/src/hooks/slice-read.ts +38 -8
  176. package/src/hooks/slice-rename.ts +44 -0
  177. package/src/hooks/slice-update.ts +9 -48
  178. package/src/hooks/sliceLibrary-read.ts +44 -0
  179. package/src/lib/isSharedSliceModel.ts +14 -0
  180. package/src/lib/rejectIfNecessary.ts +16 -0
  181. package/src/lib/updateSliceModelFile.ts +32 -0
  182. package/src/lib/upsertGlobalContentTypes.ts +59 -0
  183. package/src/lib/{buildSliceLibraryIndexFileContents.ts → upsertSliceLibraryIndexFile.ts} +14 -9
  184. package/src/plugin.ts +24 -8
  185. package/src/hooks/slice-library-read.ts +0 -51
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customType-update.cjs","sources":["../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
@@ -0,0 +1 @@
1
+ export declare const customTypeUpdate: import("@slicemachine/plugin-kit").CustomTypeCreateHook<import("..").PluginOptions>;
@@ -0,0 +1,6 @@
1
+ import { customTypeCreate } from "./customType-create.js";
2
+ const customTypeUpdate = customTypeCreate;
3
+ export {
4
+ customTypeUpdate
5
+ };
6
+ //# sourceMappingURL=customType-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customType-update.js","sources":["../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fs = require("node:fs/promises");
4
+ const path = require("node:path");
5
+ const readJSONFile = require("../lib/readJSONFile.cjs");
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule)
8
+ return e;
9
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
+ if (e) {
11
+ for (const k in e) {
12
+ if (k !== "default") {
13
+ const d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: () => e[k]
17
+ });
18
+ }
19
+ }
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
25
+ const path__namespace = /* @__PURE__ */ _interopNamespace(path);
26
+ const isCustomTypeModel = (input) => {
27
+ return typeof input === "object" && input !== null && "json" in input;
28
+ };
29
+ const customTypeLibraryRead = async (_data, { helpers }) => {
30
+ const dirPath = helpers.joinPathFromRoot("customtypes");
31
+ await fs__namespace.mkdir(dirPath, { recursive: true });
32
+ const childDirs = await fs__namespace.readdir(dirPath);
33
+ const ids = [];
34
+ await Promise.all(childDirs.map(async (childDir) => {
35
+ const childDirContents = await fs__namespace.readdir(path__namespace.join(dirPath, childDir), {
36
+ withFileTypes: true
37
+ });
38
+ const isCustomTypeDir = childDirContents.some((entry) => {
39
+ return entry.isFile() && entry.name === "index.json";
40
+ });
41
+ if (isCustomTypeDir) {
42
+ const modelPath = path__namespace.join(dirPath, childDir, "index.json");
43
+ const modelContents = await readJSONFile.readJSONFile(modelPath);
44
+ if (isCustomTypeModel(modelContents)) {
45
+ ids.push(modelContents.id);
46
+ }
47
+ }
48
+ }));
49
+ return {
50
+ ids: ids.sort()
51
+ };
52
+ };
53
+ exports.customTypeLibraryRead = customTypeLibraryRead;
54
+ //# sourceMappingURL=customTypeLibrary-read.cjs.map
@@ -0,0 +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;;"}
@@ -0,0 +1,3 @@
1
+ import type { CustomTypeLibraryReadHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const customTypeLibraryRead: CustomTypeLibraryReadHook<PluginOptions>;
@@ -0,0 +1,34 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
3
+ import { readJSONFile } from "../lib/readJSONFile.js";
4
+ const isCustomTypeModel = (input) => {
5
+ return typeof input === "object" && input !== null && "json" in input;
6
+ };
7
+ const customTypeLibraryRead = async (_data, { helpers }) => {
8
+ const dirPath = helpers.joinPathFromRoot("customtypes");
9
+ await fs.mkdir(dirPath, { recursive: true });
10
+ const childDirs = await fs.readdir(dirPath);
11
+ const ids = [];
12
+ await Promise.all(childDirs.map(async (childDir) => {
13
+ const childDirContents = await fs.readdir(path.join(dirPath, childDir), {
14
+ withFileTypes: true
15
+ });
16
+ const isCustomTypeDir = childDirContents.some((entry) => {
17
+ return entry.isFile() && entry.name === "index.json";
18
+ });
19
+ if (isCustomTypeDir) {
20
+ const modelPath = path.join(dirPath, childDir, "index.json");
21
+ const modelContents = await readJSONFile(modelPath);
22
+ if (isCustomTypeModel(modelContents)) {
23
+ ids.push(modelContents.id);
24
+ }
25
+ }
26
+ }));
27
+ return {
28
+ ids: ids.sort()
29
+ };
30
+ };
31
+ export {
32
+ customTypeLibraryRead
33
+ };
34
+ //# sourceMappingURL=customTypeLibrary-read.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fs = require("node:fs/promises");
4
+ const pascalCase = require("../lib/pascalCase.cjs");
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule)
7
+ return e;
8
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
+ if (e) {
10
+ for (const k in e) {
11
+ if (k !== "default") {
12
+ const d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: () => e[k]
16
+ });
17
+ }
18
+ }
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
24
+ const sliceAssetDelete = async (data, context) => {
25
+ const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.sliceID), data.assetID);
26
+ await fs__namespace.rm(filePath);
27
+ };
28
+ exports.sliceAssetDelete = sliceAssetDelete;
29
+ //# sourceMappingURL=slice-asset-delete.cjs.map
@@ -0,0 +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;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceAssetDeleteHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions>;
@@ -0,0 +1,10 @@
1
+ import * as fs from "node:fs/promises";
2
+ import { pascalCase } from "../lib/pascalCase.js";
3
+ const sliceAssetDelete = async (data, context) => {
4
+ const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.sliceID), data.assetID);
5
+ await fs.rm(filePath);
6
+ };
7
+ export {
8
+ sliceAssetDelete
9
+ };
10
+ //# sourceMappingURL=slice-asset-delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-asset-delete.js","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":[],"mappings":";;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,QAAQ,QAAQ,iBAChC,KAAK,WACL,WAAW,KAAK,OAAO,GACvB,KAAK,OAAO;AAGP,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fs = require("node:fs/promises");
4
+ const pascalCase = require("../lib/pascalCase.cjs");
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule)
7
+ return e;
8
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
+ if (e) {
10
+ for (const k in e) {
11
+ if (k !== "default") {
12
+ const d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: () => e[k]
16
+ });
17
+ }
18
+ }
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
24
+ const sliceAssetRead = async (data, context) => {
25
+ const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.sliceID), data.assetID);
26
+ const assetData = await fs__namespace.readFile(filePath);
27
+ return {
28
+ data: assetData
29
+ };
30
+ };
31
+ exports.sliceAssetRead = sliceAssetRead;
32
+ //# sourceMappingURL=slice-asset-read.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-asset-read.cjs","sources":["../../src/hooks/slice-asset-read.ts"],"sourcesContent":["import type { SliceAssetReadHook } 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 sliceAssetRead: SliceAssetReadHook<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\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":["pascalCase","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,iBAAoD,OAChE,MACA,YACG;AACG,QAAA,WAAW,QAAQ,QAAQ,iBAChC,KAAK,WACLA,WAAA,WAAW,KAAK,OAAO,GACvB,KAAK,OAAO;AAGb,QAAM,YAAY,MAAMC,cAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceAssetReadHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceAssetRead: SliceAssetReadHook<PluginOptions>;
@@ -0,0 +1,13 @@
1
+ import * as fs from "node:fs/promises";
2
+ import { pascalCase } from "../lib/pascalCase.js";
3
+ const sliceAssetRead = async (data, context) => {
4
+ const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.sliceID), data.assetID);
5
+ const assetData = await fs.readFile(filePath);
6
+ return {
7
+ data: assetData
8
+ };
9
+ };
10
+ export {
11
+ sliceAssetRead
12
+ };
13
+ //# sourceMappingURL=slice-asset-read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-asset-read.js","sources":["../../src/hooks/slice-asset-read.ts"],"sourcesContent":["import type { SliceAssetReadHook } 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 sliceAssetRead: SliceAssetReadHook<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\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":[],"mappings":";;AAOa,MAAA,iBAAoD,OAChE,MACA,YACG;AACG,QAAA,WAAW,QAAQ,QAAQ,iBAChC,KAAK,WACL,WAAW,KAAK,OAAO,GACvB,KAAK,OAAO;AAGb,QAAM,YAAY,MAAM,GAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fs = require("node:fs/promises");
4
+ const path = require("node:path");
5
+ const pascalCase = require("../lib/pascalCase.cjs");
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule)
8
+ return e;
9
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
+ if (e) {
11
+ for (const k in e) {
12
+ if (k !== "default") {
13
+ const d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: () => e[k]
17
+ });
18
+ }
19
+ }
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
25
+ const path__namespace = /* @__PURE__ */ _interopNamespace(path);
26
+ const sliceAssetUpdate = async (data, context) => {
27
+ const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.sliceID), data.asset.id);
28
+ await fs__namespace.mkdir(path__namespace.dirname(filePath), { recursive: true });
29
+ await fs__namespace.writeFile(filePath, data.asset.data);
30
+ };
31
+ exports.sliceAssetUpdate = sliceAssetUpdate;
32
+ //# sourceMappingURL=slice-asset-update.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-asset-update.cjs","sources":["../../src/hooks/slice-asset-update.ts"],"sourcesContent":["import type { SliceAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetUpdate: SliceAssetUpdateHook<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.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":["pascalCase","fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,WAAW,QAAQ,QAAQ,iBAChC,KAAK,WACLA,sBAAW,KAAK,OAAO,GACvB,KAAK,MAAM,EAAE;AAGR,QAAAC,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAMD,cAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceAssetUpdateHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceAssetUpdate: SliceAssetUpdateHook<PluginOptions>;
@@ -0,0 +1,12 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
3
+ import { pascalCase } from "../lib/pascalCase.js";
4
+ const sliceAssetUpdate = async (data, context) => {
5
+ const filePath = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.sliceID), data.asset.id);
6
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
7
+ await fs.writeFile(filePath, data.asset.data);
8
+ };
9
+ export {
10
+ sliceAssetUpdate
11
+ };
12
+ //# sourceMappingURL=slice-asset-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-asset-update.js","sources":["../../src/hooks/slice-asset-update.ts"],"sourcesContent":["import type { SliceAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetUpdate: SliceAssetUpdateHook<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.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":";;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,WAAW,QAAQ,QAAQ,iBAChC,KAAK,WACL,WAAW,KAAK,OAAO,GACvB,KAAK,MAAM,EAAE;AAGR,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const commonTags = require("common-tags");
4
+ const fs = require("node:fs/promises");
5
+ const path = require("node:path");
6
+ const upsertSliceLibraryIndexFile = require("../lib/upsertSliceLibraryIndexFile.cjs");
7
+ const getJSOrTSXFileExtension = require("../lib/getJSOrTSXFileExtension.cjs");
8
+ const pascalCase = require("../lib/pascalCase.cjs");
9
+ const rejectIfNecessary = require("../lib/rejectIfNecessary.cjs");
10
+ const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule)
13
+ return e;
14
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
15
+ if (e) {
16
+ for (const k in e) {
17
+ if (k !== "default") {
18
+ const d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: () => e[k]
22
+ });
23
+ }
24
+ }
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
30
+ const path__namespace = /* @__PURE__ */ _interopNamespace(path);
31
+ const createModelFile = async ({ dir, data, helpers, options }) => {
32
+ const filePath = path__namespace.join(dir, "model.json");
33
+ let contents = JSON.stringify(data.model);
34
+ if (options.format) {
35
+ contents = await helpers.format(contents, filePath);
36
+ }
37
+ await fs__namespace.writeFile(filePath, contents);
38
+ };
39
+ const createComponentFile = async ({ dir, data, helpers, options }) => {
40
+ const filePath = path__namespace.join(dir, `index.${getJSOrTSXFileExtension.getJSOrTSXFileExtension(options)}`);
41
+ const model = data.model;
42
+ const pascalName = pascalCase.pascalCase(model.name);
43
+ let contents;
44
+ if (options.typescript) {
45
+ contents = commonTags.stripIndent`
46
+ import { SliceComponentProps } from "@prismicio/react";
47
+ import { ${pascalName}Slice } from "./types";
48
+
49
+ /**
50
+ * Props for \`${pascalName}\`.
51
+ */
52
+ export type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;
53
+
54
+ /**
55
+ * Component for "${model.name}" Slices.
56
+ */
57
+ const ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {
58
+ return (
59
+ <section
60
+ data-slice-type={slice.slice_type}
61
+ data-slice-variation={slice.variation}
62
+ >
63
+ Placeholder component for ${model.id} (variation: {slice.variation}) Slices
64
+ </section>
65
+ );
66
+ };
67
+
68
+ export default ${pascalName}
69
+ `;
70
+ } else {
71
+ contents = commonTags.stripIndent`
72
+ /**
73
+ * @typedef {import("./types").${pascalName}Slice} ${pascalName}Slice
74
+ * @typedef {import("@prismicio/react").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props
75
+ * @param {${pascalName}Props}
76
+ */
77
+ const ${pascalName} = ({ slice }) => {
78
+ return (
79
+ <section
80
+ data-slice-type={slice.slice_type}
81
+ data-slice-variation={slice.variation}
82
+ >
83
+ Placeholder component for ${model.id} (variation: {slice.variation}) Slices
84
+ </section>
85
+ );
86
+ };
87
+
88
+ export default ${pascalName};
89
+ `;
90
+ }
91
+ if (options.format) {
92
+ contents = await helpers.format(contents, filePath);
93
+ }
94
+ await fs__namespace.writeFile(filePath, contents);
95
+ };
96
+ const sliceCreate = async (data, context) => {
97
+ const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.name));
98
+ await fs__namespace.mkdir(dir, { recursive: true });
99
+ rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
100
+ createModelFile({ dir, data, ...context }),
101
+ createComponentFile({ dir, data, ...context })
102
+ ]));
103
+ rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
104
+ upsertGlobalContentTypes.upsertGlobalContentTypes(context),
105
+ upsertSliceLibraryIndexFile.upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
106
+ ]));
107
+ };
108
+ exports.sliceCreate = sliceCreate;
109
+ //# sourceMappingURL=slice-create.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-create.cjs","sources":["../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"model.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\nconst createComponentFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, `index.${getJSOrTSXFileExtension(options)}`);\n\tconst model = data.model;\n\tconst pascalName = pascalCase(model.name);\n\n\tlet contents: string;\n\n\tif (options.typescript) {\n\t\tcontents = stripIndent`\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\t\t\timport { ${pascalName}Slice } from \"./types\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t/**\n\t\t\t * @typedef {import(\"./types\").${pascalName}Slice} ${pascalName}Slice\n\t\t\t * @typedef {import(\"@prismicio/react\").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props\n\t\t\t * @param {${pascalName}Props}\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName};\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\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tcreateModelFile({ dir, data, ...context }),\n\t\t\tcreateComponentFile({ dir, data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":["path","fs","getJSOrTSXFileExtension","pascalCase","stripIndent","rejectIfNecessary","upsertGlobalContentTypes","upsertSliceLibraryIndexFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,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,MAAM,sBAAsB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AAC3E,QAAM,WAAWD,gBAAK,KAAK,KAAK,SAASE,gDAAwB,OAAO,GAAG;AAC3E,QAAM,QAAQ,KAAK;AACb,QAAA,aAAaC,WAAAA,WAAW,MAAM,IAAI;AAEpC,MAAA;AAEJ,MAAI,QAAQ,YAAY;AACZ,eAAAC,WAAAA;AAAAA;AAAAA,cAEC;AAAA;AAAA;AAAA,oBAGM;AAAA;AAAA,iBAEH,yCAAyC;AAAA;AAAA;AAAA,uBAGnC,MAAM;AAAA;AAAA,WAElB,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAML,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAAA,OAEZ;AACK,eAAAA,WAAAA;AAAAA;AAAAA,oCAEuB,oBAAoB;AAAA,iEACS,qBAAqB;AAAA,gBACtE;AAAA;AAAA,WAEL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAElB;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAH,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACG,QAAA,MAAM,QAAQ,QAAQ,iBAC3B,KAAK,WACLE,WAAAA,WAAW,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAMF,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAGtCI,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,gBAAgB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,IACzC,oBAAoB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,EAC7C,CAAA,CAAC;AAIFA,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,yBAAAA,yBAAyB,OAAO;AAAA,IAChCC,wDAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceCreateHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceCreate: SliceCreateHook<PluginOptions>;
@@ -0,0 +1,89 @@
1
+ import { stripIndent } from "common-tags";
2
+ import * as fs from "node:fs/promises";
3
+ import * as path from "node:path";
4
+ import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile.js";
5
+ import { getJSOrTSXFileExtension } from "../lib/getJSOrTSXFileExtension.js";
6
+ import { pascalCase } from "../lib/pascalCase.js";
7
+ import { rejectIfNecessary } from "../lib/rejectIfNecessary.js";
8
+ import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
9
+ const createModelFile = async ({ dir, data, helpers, options }) => {
10
+ const filePath = path.join(dir, "model.json");
11
+ let contents = JSON.stringify(data.model);
12
+ if (options.format) {
13
+ contents = await helpers.format(contents, filePath);
14
+ }
15
+ await fs.writeFile(filePath, contents);
16
+ };
17
+ const createComponentFile = async ({ dir, data, helpers, options }) => {
18
+ const filePath = path.join(dir, `index.${getJSOrTSXFileExtension(options)}`);
19
+ const model = data.model;
20
+ const pascalName = pascalCase(model.name);
21
+ let contents;
22
+ if (options.typescript) {
23
+ contents = stripIndent`
24
+ import { SliceComponentProps } from "@prismicio/react";
25
+ import { ${pascalName}Slice } from "./types";
26
+
27
+ /**
28
+ * Props for \`${pascalName}\`.
29
+ */
30
+ export type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;
31
+
32
+ /**
33
+ * Component for "${model.name}" Slices.
34
+ */
35
+ const ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {
36
+ return (
37
+ <section
38
+ data-slice-type={slice.slice_type}
39
+ data-slice-variation={slice.variation}
40
+ >
41
+ Placeholder component for ${model.id} (variation: {slice.variation}) Slices
42
+ </section>
43
+ );
44
+ };
45
+
46
+ export default ${pascalName}
47
+ `;
48
+ } else {
49
+ contents = stripIndent`
50
+ /**
51
+ * @typedef {import("./types").${pascalName}Slice} ${pascalName}Slice
52
+ * @typedef {import("@prismicio/react").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props
53
+ * @param {${pascalName}Props}
54
+ */
55
+ const ${pascalName} = ({ slice }) => {
56
+ return (
57
+ <section
58
+ data-slice-type={slice.slice_type}
59
+ data-slice-variation={slice.variation}
60
+ >
61
+ Placeholder component for ${model.id} (variation: {slice.variation}) Slices
62
+ </section>
63
+ );
64
+ };
65
+
66
+ export default ${pascalName};
67
+ `;
68
+ }
69
+ if (options.format) {
70
+ contents = await helpers.format(contents, filePath);
71
+ }
72
+ await fs.writeFile(filePath, contents);
73
+ };
74
+ const sliceCreate = async (data, context) => {
75
+ const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.name));
76
+ await fs.mkdir(dir, { recursive: true });
77
+ rejectIfNecessary(await Promise.allSettled([
78
+ createModelFile({ dir, data, ...context }),
79
+ createComponentFile({ dir, data, ...context })
80
+ ]));
81
+ rejectIfNecessary(await Promise.allSettled([
82
+ upsertGlobalContentTypes(context),
83
+ upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
84
+ ]));
85
+ };
86
+ export {
87
+ sliceCreate
88
+ };
89
+ //# sourceMappingURL=slice-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-create.js","sources":["../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"model.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\nconst createComponentFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, `index.${getJSOrTSXFileExtension(options)}`);\n\tconst model = data.model;\n\tconst pascalName = pascalCase(model.name);\n\n\tlet contents: string;\n\n\tif (options.typescript) {\n\t\tcontents = stripIndent`\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\t\t\timport { ${pascalName}Slice } from \"./types\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t/**\n\t\t\t * @typedef {import(\"./types\").${pascalName}Slice} ${pascalName}Slice\n\t\t\t * @typedef {import(\"@prismicio/react\").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props\n\t\t\t * @param {${pascalName}Props}\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName};\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\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tcreateModelFile({ dir, data, ...context }),\n\t\t\tcreateComponentFile({ dir, data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":[],"mappings":";;;;;;;;AAsBA,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,MAAM,sBAAsB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AAC3E,QAAM,WAAW,KAAK,KAAK,KAAK,SAAS,wBAAwB,OAAO,GAAG;AAC3E,QAAM,QAAQ,KAAK;AACb,QAAA,aAAa,WAAW,MAAM,IAAI;AAEpC,MAAA;AAEJ,MAAI,QAAQ,YAAY;AACZ,eAAA;AAAA;AAAA,cAEC;AAAA;AAAA;AAAA,oBAGM;AAAA;AAAA,iBAEH,yCAAyC;AAAA;AAAA;AAAA,uBAGnC,MAAM;AAAA;AAAA,WAElB,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAML,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAAA,OAEZ;AACK,eAAA;AAAA;AAAA,oCAEuB,oBAAoB;AAAA,iEACS,qBAAqB;AAAA,gBACtE;AAAA;AAAA,WAEL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAElB;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACG,QAAA,MAAM,QAAQ,QAAQ,iBAC3B,KAAK,WACL,WAAW,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAGtC,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,gBAAgB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,IACzC,oBAAoB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,EAC7C,CAAA,CAAC;AAIF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,yBAAyB,OAAO;AAAA,IAChC,4BAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fs = require("node:fs/promises");
4
+ const pascalCase = require("../lib/pascalCase.cjs");
5
+ const rejectIfNecessary = require("../lib/rejectIfNecessary.cjs");
6
+ const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
7
+ const upsertSliceLibraryIndexFile = require("../lib/upsertSliceLibraryIndexFile.cjs");
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule)
10
+ return e;
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== "default") {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
27
+ const deleteSliceDir = async ({ data, helpers }) => {
28
+ const dir = helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.name));
29
+ await fs__namespace.rm(dir, { recursive: true });
30
+ };
31
+ const sliceDelete = async (data, context) => {
32
+ await deleteSliceDir({ data, ...context });
33
+ rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
34
+ upsertGlobalContentTypes.upsertGlobalContentTypes(context),
35
+ upsertSliceLibraryIndexFile.upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
36
+ ]));
37
+ };
38
+ exports.sliceDelete = sliceDelete;
39
+ //# sourceMappingURL=slice-delete.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-delete.cjs","sources":["../../src/hooks/slice-delete.ts"],"sourcesContent":["import type {\n\tSliceDeleteHook,\n\tSliceDeleteHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceDeleteHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst deleteSliceDir = async ({ data, helpers }: Args) => {\n\tconst dir = helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.rm(dir, { recursive: true });\n};\n\nexport const sliceDelete: SliceDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait deleteSliceDir({ data, ...context });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":["pascalCase","fs","rejectIfNecessary","upsertGlobalContentTypes","upsertSliceLibraryIndexFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,iBAAiB,OAAO,EAAE,MAAM,cAAmB;AAClD,QAAA,MAAM,QAAQ,iBACnB,KAAK,WACLA,WAAW,WAAA,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAMC,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AACrC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,eAAe,EAAE,MAAM,GAAG,QAAS,CAAA;AAGxCC,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,yBAAAA,yBAAyB,OAAO;AAAA,IAChCC,wDAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceDeleteHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceDelete: SliceDeleteHook<PluginOptions>;
@@ -0,0 +1,20 @@
1
+ import * as fs from "node:fs/promises";
2
+ import { pascalCase } from "../lib/pascalCase.js";
3
+ import { rejectIfNecessary } from "../lib/rejectIfNecessary.js";
4
+ import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
5
+ import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile.js";
6
+ const deleteSliceDir = async ({ data, helpers }) => {
7
+ const dir = helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.name));
8
+ await fs.rm(dir, { recursive: true });
9
+ };
10
+ const sliceDelete = async (data, context) => {
11
+ await deleteSliceDir({ data, ...context });
12
+ rejectIfNecessary(await Promise.allSettled([
13
+ upsertGlobalContentTypes(context),
14
+ upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
15
+ ]));
16
+ };
17
+ export {
18
+ sliceDelete
19
+ };
20
+ //# sourceMappingURL=slice-delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-delete.js","sources":["../../src/hooks/slice-delete.ts"],"sourcesContent":["import type {\n\tSliceDeleteHook,\n\tSliceDeleteHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceDeleteHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst deleteSliceDir = async ({ data, helpers }: Args) => {\n\tconst dir = helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.rm(dir, { recursive: true });\n};\n\nexport const sliceDelete: SliceDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait deleteSliceDir({ data, ...context });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":[],"mappings":";;;;;AAkBA,MAAM,iBAAiB,OAAO,EAAE,MAAM,cAAmB;AAClD,QAAA,MAAM,QAAQ,iBACnB,KAAK,WACL,WAAW,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AACrC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,eAAe,EAAE,MAAM,GAAG,QAAS,CAAA;AAGxC,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,yBAAyB,OAAO;AAAA,IAChC,4BAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;"}