@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,49 @@
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 isSharedSliceModel = require("../lib/isSharedSliceModel.cjs");
6
+ const readJSONFile = require("../lib/readJSONFile.cjs");
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule)
9
+ return e;
10
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
+ if (e) {
12
+ for (const k in e) {
13
+ if (k !== "default") {
14
+ const d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: () => e[k]
18
+ });
19
+ }
20
+ }
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
26
+ const path__namespace = /* @__PURE__ */ _interopNamespace(path);
27
+ const sliceRead = async (data, { helpers }) => {
28
+ const libraryDir = helpers.joinPathFromRoot(data.libraryID);
29
+ await fs__namespace.mkdir(libraryDir, { recursive: true });
30
+ const childDirs = await fs__namespace.readdir(libraryDir, { withFileTypes: true });
31
+ const [model] = (await Promise.all(childDirs.map(async (childDir) => {
32
+ if (childDir.isDirectory()) {
33
+ const modelPath = path__namespace.join(libraryDir, childDir.name, "model.json");
34
+ const modelContents = await readJSONFile.readJSONFile(modelPath);
35
+ if (isSharedSliceModel.isSharedSliceModel(modelContents) && modelContents.id === data.sliceID) {
36
+ return modelContents;
37
+ }
38
+ }
39
+ }))).filter((model2) => Boolean(model2));
40
+ if (model) {
41
+ return {
42
+ model
43
+ };
44
+ } else {
45
+ throw new Error(`Did not find a Slice model with ID "${data.sliceID}" in the "${data.libraryID}" Slice Library.`);
46
+ }
47
+ };
48
+ exports.sliceRead = sliceRead;
49
+ //# sourceMappingURL=slice-read.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-read.cjs","sources":["../../src/hooks/slice-read.ts"],"sourcesContent":["import type { SliceReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { isSharedSliceModel } from \"../lib/isSharedSliceModel\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRead: SliceReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst libraryDir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(libraryDir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t// Find the first matching model.\n\tconst [model] = (\n\t\tawait Promise.all(\n\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\tconst modelPath = path.join(libraryDir, childDir.name, \"model.json\");\n\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\tmodelContents.id === data.sliceID\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\tif (model) {\n\t\treturn {\n\t\t\tmodel,\n\t\t};\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Did not find a Slice model with ID \"${data.sliceID}\" in the \"${data.libraryID}\" Slice Library.`,\n\t\t);\n\t}\n};\n"],"names":["fs","path","readJSONFile","isSharedSliceModel","model"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,YAA0C,OACtD,MACA,EAAE,cACC;AACH,QAAM,aAAa,QAAQ,iBAAiB,KAAK,SAAS;AAG1D,QAAMA,cAAG,MAAM,YAAY,EAAE,WAAW,MAAM;AAExC,QAAA,YAAY,MAAMA,cAAG,QAAQ,YAAY,EAAE,eAAe,MAAM;AAGhE,QAAA,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAYC,gBAAK,KAAK,YAAY,SAAS,MAAM,YAAY;AAE7D,YAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAElD,UACCC,mBAAAA,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACM,eAAA;AAAA,MACP;AAAA,IACD;AAAA,EAAA,CACD,CAAC,GAEF,OAAO,CAACC,WAA8C,QAAQA,MAAK,CAAC;AAEtE,MAAI,OAAO;AACH,WAAA;AAAA,MACN;AAAA,IAAA;AAAA,SAEK;AACN,UAAM,IAAI,MACT,uCAAuC,KAAK,oBAAoB,KAAK,2BAA2B;AAAA,EAEjG;AACF;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceReadHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceRead: SliceReadHook<PluginOptions>;
@@ -0,0 +1,29 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
3
+ import { isSharedSliceModel } from "../lib/isSharedSliceModel.js";
4
+ import { readJSONFile } from "../lib/readJSONFile.js";
5
+ const sliceRead = async (data, { helpers }) => {
6
+ const libraryDir = helpers.joinPathFromRoot(data.libraryID);
7
+ await fs.mkdir(libraryDir, { recursive: true });
8
+ const childDirs = await fs.readdir(libraryDir, { withFileTypes: true });
9
+ const [model] = (await Promise.all(childDirs.map(async (childDir) => {
10
+ if (childDir.isDirectory()) {
11
+ const modelPath = path.join(libraryDir, childDir.name, "model.json");
12
+ const modelContents = await readJSONFile(modelPath);
13
+ if (isSharedSliceModel(modelContents) && modelContents.id === data.sliceID) {
14
+ return modelContents;
15
+ }
16
+ }
17
+ }))).filter((model2) => Boolean(model2));
18
+ if (model) {
19
+ return {
20
+ model
21
+ };
22
+ } else {
23
+ throw new Error(`Did not find a Slice model with ID "${data.sliceID}" in the "${data.libraryID}" Slice Library.`);
24
+ }
25
+ };
26
+ export {
27
+ sliceRead
28
+ };
29
+ //# sourceMappingURL=slice-read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-read.js","sources":["../../src/hooks/slice-read.ts"],"sourcesContent":["import type { SliceReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { isSharedSliceModel } from \"../lib/isSharedSliceModel\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRead: SliceReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst libraryDir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(libraryDir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t// Find the first matching model.\n\tconst [model] = (\n\t\tawait Promise.all(\n\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\tconst modelPath = path.join(libraryDir, childDir.name, \"model.json\");\n\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\tmodelContents.id === data.sliceID\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\tif (model) {\n\t\treturn {\n\t\t\tmodel,\n\t\t};\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Did not find a Slice model with ID \"${data.sliceID}\" in the \"${data.libraryID}\" Slice Library.`,\n\t\t);\n\t}\n};\n"],"names":["model"],"mappings":";;;;AASO,MAAM,YAA0C,OACtD,MACA,EAAE,cACC;AACH,QAAM,aAAa,QAAQ,iBAAiB,KAAK,SAAS;AAG1D,QAAM,GAAG,MAAM,YAAY,EAAE,WAAW,MAAM;AAExC,QAAA,YAAY,MAAM,GAAG,QAAQ,YAAY,EAAE,eAAe,MAAM;AAGhE,QAAA,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAY,KAAK,KAAK,YAAY,SAAS,MAAM,YAAY;AAE7D,YAAA,gBAAgB,MAAM,aAAa,SAAS;AAElD,UACC,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACM,eAAA;AAAA,MACP;AAAA,IACD;AAAA,EAAA,CACD,CAAC,GAEF,OAAO,CAACA,WAA8C,QAAQA,MAAK,CAAC;AAEtE,MAAI,OAAO;AACH,WAAA;AAAA,MACN;AAAA,IAAA;AAAA,SAEK;AACN,UAAM,IAAI,MACT,uCAAuC,KAAK,oBAAoB,KAAK,2BAA2B;AAAA,EAEjG;AACF;"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fse = require("fs-extra");
4
+ const pascalCase = require("../lib/pascalCase.cjs");
5
+ const rejectIfNecessary = require("../lib/rejectIfNecessary.cjs");
6
+ const updateSliceModelFile = require("../lib/updateSliceModelFile.cjs");
7
+ const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
8
+ const upsertSliceLibraryIndexFile = require("../lib/upsertSliceLibraryIndexFile.cjs");
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule)
11
+ return e;
12
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
+ if (e) {
14
+ for (const k in e) {
15
+ if (k !== "default") {
16
+ const d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: () => e[k]
20
+ });
21
+ }
22
+ }
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+ const fse__namespace = /* @__PURE__ */ _interopNamespace(fse);
28
+ const sliceRename = async (data, context) => {
29
+ const { model: currentModel } = await context.actions.readSliceModel({
30
+ libraryID: data.libraryID,
31
+ sliceID: data.model.id
32
+ });
33
+ await fse__namespace.move(context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(currentModel.name)), context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.name)));
34
+ await updateSliceModelFile.updateSliceModelFile({
35
+ libraryID: data.libraryID,
36
+ model: data.model,
37
+ ...context
38
+ });
39
+ rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
40
+ upsertGlobalContentTypes.upsertGlobalContentTypes(context),
41
+ upsertSliceLibraryIndexFile.upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
42
+ ]));
43
+ };
44
+ exports.sliceRename = sliceRename;
45
+ //# sourceMappingURL=slice-rename.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-rename.cjs","sources":["../../src/hooks/slice-rename.ts"],"sourcesContent":["import type { SliceRenameHook } from \"@slicemachine/plugin-kit\";\nimport * as fse from \"fs-extra\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRename: SliceRenameHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst { model: currentModel } = await context.actions.readSliceModel({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.model.id,\n\t});\n\n\tawait fse.move(\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(currentModel.name),\n\t\t),\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(data.model.name),\n\t\t),\n\t);\n\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\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":["fse","pascalCase","updateSliceModelFile","rejectIfNecessary","upsertGlobalContentTypes","upsertSliceLibraryIndexFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,EAAE,OAAO,aAAA,IAAiB,MAAM,QAAQ,QAAQ,eAAe;AAAA,IACpE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAEK,QAAAA,eAAI,KACT,QAAQ,QAAQ,iBACf,KAAK,WACLC,sBAAW,aAAa,IAAI,CAAC,GAE9B,QAAQ,QAAQ,iBACf,KAAK,WACLA,sBAAW,KAAK,MAAM,IAAI,CAAC,CAC3B;AAGF,QAAMC,0CAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAGAC,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 { SliceRenameHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceRename: SliceRenameHook<PluginOptions>;
@@ -0,0 +1,26 @@
1
+ import * as fse from "fs-extra";
2
+ import { pascalCase } from "../lib/pascalCase.js";
3
+ import { rejectIfNecessary } from "../lib/rejectIfNecessary.js";
4
+ import { updateSliceModelFile } from "../lib/updateSliceModelFile.js";
5
+ import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
6
+ import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile.js";
7
+ const sliceRename = async (data, context) => {
8
+ const { model: currentModel } = await context.actions.readSliceModel({
9
+ libraryID: data.libraryID,
10
+ sliceID: data.model.id
11
+ });
12
+ await fse.move(context.helpers.joinPathFromRoot(data.libraryID, pascalCase(currentModel.name)), context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.name)));
13
+ await updateSliceModelFile({
14
+ libraryID: data.libraryID,
15
+ model: data.model,
16
+ ...context
17
+ });
18
+ rejectIfNecessary(await Promise.allSettled([
19
+ upsertGlobalContentTypes(context),
20
+ upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
21
+ ]));
22
+ };
23
+ export {
24
+ sliceRename
25
+ };
26
+ //# sourceMappingURL=slice-rename.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-rename.js","sources":["../../src/hooks/slice-rename.ts"],"sourcesContent":["import type { SliceRenameHook } from \"@slicemachine/plugin-kit\";\nimport * as fse from \"fs-extra\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRename: SliceRenameHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst { model: currentModel } = await context.actions.readSliceModel({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.model.id,\n\t});\n\n\tawait fse.move(\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(currentModel.name),\n\t\t),\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(data.model.name),\n\t\t),\n\t);\n\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\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":";;;;;;AAWa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,EAAE,OAAO,aAAA,IAAiB,MAAM,QAAQ,QAAQ,eAAe;AAAA,IACpE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAEK,QAAA,IAAI,KACT,QAAQ,QAAQ,iBACf,KAAK,WACL,WAAW,aAAa,IAAI,CAAC,GAE9B,QAAQ,QAAQ,iBACf,KAAK,WACL,WAAW,KAAK,MAAM,IAAI,CAAC,CAC3B;AAGF,QAAM,qBAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAGA,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,14 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const updateSliceModelFile = require("../lib/updateSliceModelFile.cjs");
4
+ const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
5
+ const sliceUpdate = async (data, context) => {
6
+ await updateSliceModelFile.updateSliceModelFile({
7
+ libraryID: data.libraryID,
8
+ model: data.model,
9
+ ...context
10
+ });
11
+ await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
12
+ };
13
+ exports.sliceUpdate = sliceUpdate;
14
+ //# sourceMappingURL=slice-update.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-update.cjs","sources":["../../src/hooks/slice-update.ts"],"sourcesContent":["import type { SliceUpdateHook } from \"@slicemachine/plugin-kit\";\n\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceUpdate: SliceUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\n\t});\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["updateSliceModelFile","upsertGlobalContentTypes"],"mappings":";;;;AAOa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAMA,0CAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAED,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceUpdateHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceUpdate: SliceUpdateHook<PluginOptions>;
@@ -0,0 +1,14 @@
1
+ import { updateSliceModelFile } from "../lib/updateSliceModelFile.js";
2
+ import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
3
+ const sliceUpdate = async (data, context) => {
4
+ await updateSliceModelFile({
5
+ libraryID: data.libraryID,
6
+ model: data.model,
7
+ ...context
8
+ });
9
+ await upsertGlobalContentTypes(context);
10
+ };
11
+ export {
12
+ sliceUpdate
13
+ };
14
+ //# sourceMappingURL=slice-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-update.js","sources":["../../src/hooks/slice-update.ts"],"sourcesContent":["import type { SliceUpdateHook } from \"@slicemachine/plugin-kit\";\n\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceUpdate: SliceUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\n\t});\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,qBAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAED,QAAM,yBAAyB,OAAO;AACvC;"}
@@ -0,0 +1,50 @@
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 isSharedSliceModel = require("../lib/isSharedSliceModel.cjs");
6
+ const readJSONFile = require("../lib/readJSONFile.cjs");
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule)
9
+ return e;
10
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
+ if (e) {
12
+ for (const k in e) {
13
+ if (k !== "default") {
14
+ const d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: () => e[k]
18
+ });
19
+ }
20
+ }
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
26
+ const path__namespace = /* @__PURE__ */ _interopNamespace(path);
27
+ const sliceLibraryRead = async (data, { helpers }) => {
28
+ const dir = helpers.joinPathFromRoot(data.libraryID);
29
+ await fs__namespace.mkdir(dir, { recursive: true });
30
+ const childDirs = await fs__namespace.readdir(dir, { withFileTypes: true });
31
+ const sliceIDs = [];
32
+ await Promise.all(childDirs.map(async (childDir) => {
33
+ if (childDir.isDirectory()) {
34
+ const modelPath = path__namespace.join(dir, childDir.name, "model.json");
35
+ try {
36
+ const modelContents = await readJSONFile.readJSONFile(modelPath);
37
+ if (isSharedSliceModel.isSharedSliceModel(modelContents)) {
38
+ sliceIDs.push(modelContents.id);
39
+ }
40
+ } catch {
41
+ }
42
+ }
43
+ }));
44
+ return {
45
+ id: data.libraryID,
46
+ sliceIDs: sliceIDs.sort()
47
+ };
48
+ };
49
+ exports.sliceLibraryRead = sliceLibraryRead;
50
+ //# sourceMappingURL=sliceLibrary-read.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sliceLibrary-read.cjs","sources":["../../src/hooks/sliceLibrary-read.ts"],"sourcesContent":["import type { SliceLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { isSharedSliceModel } from \"../lib/isSharedSliceModel\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dir, { withFileTypes: true });\n\n\tconst sliceIDs: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tif (childDir.isDirectory()) {\n\t\t\t\tconst modelPath = path.join(dir, childDir.name, \"model.json\");\n\n\t\t\t\ttry {\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tid: data.libraryID,\n\t\tsliceIDs: sliceIDs.sort(),\n\t};\n};\n"],"names":["fs","path","readJSONFile","isSharedSliceModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,mBAAwD,OACpE,MACA,EAAE,cACC;AACH,QAAM,MAAM,QAAQ,iBAAiB,KAAK,SAAS;AAGnD,QAAMA,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEjC,QAAA,YAAY,MAAMA,cAAG,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE/D,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAYC,gBAAK,KAAK,KAAK,SAAS,MAAM,YAAY;AAExD,UAAA;AACG,cAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,YAAAC,mBAAAA,mBAAmB,aAAa,GAAG;AAC7B,mBAAA,KAAK,cAAc,EAAE;AAAA,QAC9B;AAAA,MAAA,QACA;AAAA,MAED;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceLibraryReadHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceLibraryRead: SliceLibraryReadHook<PluginOptions>;
@@ -0,0 +1,30 @@
1
+ import * as fs from "node:fs/promises";
2
+ import * as path from "node:path";
3
+ import { isSharedSliceModel } from "../lib/isSharedSliceModel.js";
4
+ import { readJSONFile } from "../lib/readJSONFile.js";
5
+ const sliceLibraryRead = async (data, { helpers }) => {
6
+ const dir = helpers.joinPathFromRoot(data.libraryID);
7
+ await fs.mkdir(dir, { recursive: true });
8
+ const childDirs = await fs.readdir(dir, { withFileTypes: true });
9
+ const sliceIDs = [];
10
+ await Promise.all(childDirs.map(async (childDir) => {
11
+ if (childDir.isDirectory()) {
12
+ const modelPath = path.join(dir, childDir.name, "model.json");
13
+ try {
14
+ const modelContents = await readJSONFile(modelPath);
15
+ if (isSharedSliceModel(modelContents)) {
16
+ sliceIDs.push(modelContents.id);
17
+ }
18
+ } catch {
19
+ }
20
+ }
21
+ }));
22
+ return {
23
+ id: data.libraryID,
24
+ sliceIDs: sliceIDs.sort()
25
+ };
26
+ };
27
+ export {
28
+ sliceLibraryRead
29
+ };
30
+ //# sourceMappingURL=sliceLibrary-read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sliceLibrary-read.js","sources":["../../src/hooks/sliceLibrary-read.ts"],"sourcesContent":["import type { SliceLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { isSharedSliceModel } from \"../lib/isSharedSliceModel\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dir, { withFileTypes: true });\n\n\tconst sliceIDs: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tif (childDir.isDirectory()) {\n\t\t\t\tconst modelPath = path.join(dir, childDir.name, \"model.json\");\n\n\t\t\t\ttry {\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tid: data.libraryID,\n\t\tsliceIDs: sliceIDs.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;;AASO,MAAM,mBAAwD,OACpE,MACA,EAAE,cACC;AACH,QAAM,MAAM,QAAQ,iBAAiB,KAAK,SAAS;AAGnD,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEjC,QAAA,YAAY,MAAM,GAAG,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE/D,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAY,KAAK,KAAK,KAAK,SAAS,MAAM,YAAY;AAExD,UAAA;AACG,cAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,YAAA,mBAAmB,aAAa,GAAG;AAC7B,mBAAA,KAAK,cAAc,EAAE;AAAA,QAC9B;AAAA,MAAA,QACA;AAAA,MAED;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;"}
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const pluginKit = require("@slicemachine/plugin-kit");
4
+ const commonTags = require("common-tags");
5
+ const node_module = require("node:module");
6
+ const http = require("node:http");
7
+ const getJSOrTSXFileExtension = require("../lib/getJSOrTSXFileExtension.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 http__namespace = /* @__PURE__ */ _interopNamespace(http);
27
+ const REQUIRED_DEPENDENCIES = [
28
+ "@prismicio/react",
29
+ "@prismicio/slice-simulator-react",
30
+ "@prismicio/client@latest",
31
+ "@prismicio/helpers"
32
+ ];
33
+ const createStep1 = async ({ project }) => {
34
+ const require2 = node_module.createRequire(project.root);
35
+ return {
36
+ title: "Install packages",
37
+ body: commonTags.stripIndent`
38
+ The simulator requires extra dependencies. Run the following command to install them.
39
+
40
+ ~~~sh
41
+ npm install --save @prismicio/react @prismicio/slice-simulator-react @prismicio/client@latest @prismicio/helpers
42
+ ~~~
43
+ `,
44
+ validate: async () => {
45
+ const missingDependencies = [];
46
+ for (const dependency of REQUIRED_DEPENDENCIES) {
47
+ try {
48
+ require2.resolve(dependency);
49
+ } catch {
50
+ missingDependencies.push(dependency);
51
+ }
52
+ }
53
+ if (missingDependencies.length >= REQUIRED_DEPENDENCIES.length) {
54
+ return {
55
+ type: pluginKit.SliceSimulatorSetupStepValidationMessageType.Error,
56
+ title: "Missing all dependencies",
57
+ message: commonTags.stripIndent`
58
+ Install the required dependencies to continue.
59
+ `
60
+ };
61
+ }
62
+ if (missingDependencies.length > 0) {
63
+ const formattedMissingDependencies = missingDependencies.map((missingDependency) => `\`${missingDependency}\``).join(", ");
64
+ return {
65
+ type: pluginKit.SliceSimulatorSetupStepValidationMessageType.Warning,
66
+ title: "Missing some dependencies",
67
+ message: commonTags.stripIndent`
68
+ The following dependencies are missing: ${formattedMissingDependencies}
69
+ `
70
+ };
71
+ }
72
+ }
73
+ };
74
+ };
75
+ const createStep2 = async ({ helpers, options }) => {
76
+ const fileName = `slice-simulator.${getJSOrTSXFileExtension.getJSOrTSXFileExtension}`;
77
+ const filePath = helpers.joinPathFromRoot("pages", fileName);
78
+ let fileContents;
79
+ if (options.typescript) {
80
+ fileContents = commonTags.stripIndent`
81
+ import { GetStaticProps } from "next/types";
82
+ import { SliceSimulator } from "@prismicio/slice-simulator-react";
83
+ import { SliceZone } from "@prismicio/react";
84
+
85
+ import state from "../.slicemachine/libraries-state.json";
86
+ import { components } from "../slices";
87
+
88
+ const SliceSimulatorPage = () => {
89
+ return (
90
+ <SliceSimulator
91
+ sliceZone={(props) => <SliceZone {...props} components={components} />}
92
+ state={state}
93
+ />
94
+ );
95
+ };
96
+
97
+ export default SliceSimulatorPage;
98
+
99
+ export const getStaticProps: GetStaticProps = () => {
100
+ return {
101
+ // Exclude this page from production builds.
102
+ notFound: process.env.NODE_ENV === "production",
103
+ };
104
+ };
105
+ `;
106
+ } else {
107
+ fileContents = commonTags.stripIndent`
108
+ import { SliceSimulator } from "@prismicio/slice-simulator-react";
109
+ import { SliceZone } from "@prismicio/react";
110
+
111
+ import state from "../.slicemachine/libraries-state.json";
112
+ import { components } from "../slices";
113
+
114
+ const SliceSimulatorPage = () => {
115
+ return (
116
+ <SliceSimulator
117
+ sliceZone={(props) => <SliceZone {...props} components={components} />}
118
+ state={state}
119
+ />
120
+ );
121
+ };
122
+
123
+ export default SliceSimulatorPage;
124
+
125
+ export const getStaticProps= () => {
126
+ return {
127
+ // Exclude this page from production builds.
128
+ notFound: process.env.NODE_ENV === "production",
129
+ };
130
+ };
131
+ `;
132
+ }
133
+ fileContents = await helpers.format(fileContents, filePath);
134
+ return {
135
+ title: "Create a page for the simulator",
136
+ body: commonTags.stripIndent`
137
+ In your \`pages\` directory, create a file called \`${fileName}\` and add the following code. This route will be used to simulate and develop your components.
138
+
139
+ ~~~tsx
140
+ ${fileContents}
141
+ ~~~
142
+ `
143
+ };
144
+ };
145
+ const createStep3 = async ({ helpers }) => {
146
+ const filePath = helpers.joinPathFromRoot("sm.json");
147
+ const fileContents = await helpers.format(`
148
+ {
149
+ "localSliceSimulatorURL": "http://localhost:3000/slice-simulator"
150
+ }
151
+ `, filePath);
152
+ return {
153
+ title: "Update `sm.json`",
154
+ body: commonTags.stripIndent`
155
+ Update your \`sm.json\` file with a \`localSliceSimulatorURL\` property pointing to your \`slice-simulator\` page.
156
+
157
+ ~~~json
158
+ ${fileContents}
159
+ ~~~
160
+ `,
161
+ validate: async () => {
162
+ const project = await helpers.getProject();
163
+ if (!("localSliceSimulatorURL" in project.config)) {
164
+ return {
165
+ type: pluginKit.SliceSimulatorSetupStepValidationMessageType.Error,
166
+ title: "Missing `localSliceSimulatorURL` property",
167
+ message: commonTags.stripIndent`
168
+ A \`localSliceSimulatorURL\` property was not found in your \`sm.json\` file.
169
+ `
170
+ };
171
+ }
172
+ try {
173
+ if (project.config.localSliceSimulatorURL) {
174
+ new URL(project.config.localSliceSimulatorURL);
175
+ } else {
176
+ throw new Error("Undefined Slice Simulator URL");
177
+ }
178
+ } catch {
179
+ return {
180
+ type: pluginKit.SliceSimulatorSetupStepValidationMessageType.Warning,
181
+ title: "An invalid URL was provided",
182
+ message: commonTags.stripIndent`
183
+ The \`localSliceSimulatorURL\` property should be of the shape \`http://localhost:PORT/PATH\`. See the codeblock for an example.
184
+ `
185
+ };
186
+ }
187
+ const ok = await new Promise((resolve) => {
188
+ if (project.config.localSliceSimulatorURL) {
189
+ http__namespace.get(project.config.localSliceSimulatorURL, (res) => {
190
+ if (res.statusCode) {
191
+ resolve(res.statusCode >= 200 && res.statusCode < 300);
192
+ }
193
+ });
194
+ }
195
+ resolve(false);
196
+ });
197
+ if (!ok) {
198
+ return {
199
+ type: pluginKit.SliceSimulatorSetupStepValidationMessageType.Warning,
200
+ title: "Unable to connect to simulator page",
201
+ message: commonTags.stripIndent`
202
+ Check that the \`localSliceSimulatorURL\` property in \`sm.json\` is correct and try again. See the [troubleshooting page](https://prismic.io/docs/technologies/setup-slice-simulator-nextjs) for more details.
203
+ `
204
+ };
205
+ }
206
+ }
207
+ };
208
+ };
209
+ const sliceSimulatorSetupRead = async (_data, context) => {
210
+ return Promise.all([
211
+ createStep1(context),
212
+ createStep2(context),
213
+ createStep3(context)
214
+ ]);
215
+ };
216
+ exports.sliceSimulatorSetupRead = sliceSimulatorSetupRead;
217
+ //# sourceMappingURL=sliceSimulator-setup-read.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sliceSimulator-setup-read.cjs","sources":["../../src/hooks/sliceSimulator-setup-read.ts"],"sourcesContent":["import type {\n\tSliceMachineContext,\n\tSliceSimulatorSetupReadHook,\n\tSliceSimulatorSetupStep,\n} from \"@slicemachine/plugin-kit\";\nimport { SliceSimulatorSetupStepValidationMessageType } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport { createRequire } from \"node:module\";\nimport * as http from \"node:http\";\n\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst REQUIRED_DEPENDENCIES = [\n\t\"@prismicio/react\",\n\t\"@prismicio/slice-simulator-react\",\n\t\"@prismicio/client@latest\",\n\t\"@prismicio/helpers\",\n];\n\ntype Args = SliceMachineContext<PluginOptions>;\n\nconst createStep1 = async ({\n\tproject,\n}: Args): Promise<SliceSimulatorSetupStep> => {\n\tconst require = createRequire(project.root);\n\n\treturn {\n\t\ttitle: \"Install packages\",\n\t\tbody: stripIndent`\n\t\t\tThe simulator requires extra dependencies. Run the following command to install them.\n\n\t\t\t~~~sh\n\t\t\tnpm install --save @prismicio/react @prismicio/slice-simulator-react @prismicio/client@latest @prismicio/helpers\n\t\t\t~~~\n\t\t`,\n\t\tvalidate: async () => {\n\t\t\tconst missingDependencies: string[] = [];\n\n\t\t\tfor (const dependency of REQUIRED_DEPENDENCIES) {\n\t\t\t\ttry {\n\t\t\t\t\t// `require.resolve()` is preferred\n\t\t\t\t\t// over `import()` because we don't\n\t\t\t\t\t// want to load the module. Loading a\n\t\t\t\t\t// module could introduce side-effects.\n\t\t\t\t\trequire.resolve(dependency);\n\t\t\t\t} catch {\n\t\t\t\t\tmissingDependencies.push(dependency);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (missingDependencies.length >= REQUIRED_DEPENDENCIES.length) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: SliceSimulatorSetupStepValidationMessageType.Error,\n\t\t\t\t\ttitle: \"Missing all dependencies\",\n\t\t\t\t\tmessage: stripIndent`\n\t\t\t\t\t\tInstall the required dependencies to continue.\n\t\t\t\t\t`,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (missingDependencies.length > 0) {\n\t\t\t\tconst formattedMissingDependencies = missingDependencies\n\t\t\t\t\t.map((missingDependency) => `\\`${missingDependency}\\``)\n\t\t\t\t\t.join(\", \");\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: SliceSimulatorSetupStepValidationMessageType.Warning,\n\t\t\t\t\ttitle: \"Missing some dependencies\",\n\t\t\t\t\tmessage: stripIndent`\n\t\t\t\t\t\tThe following dependencies are missing: ${formattedMissingDependencies}\n\t\t\t\t\t`,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t};\n};\n\nconst createStep2 = async ({\n\thelpers,\n\toptions,\n}: Args): Promise<SliceSimulatorSetupStep> => {\n\tconst fileName = `slice-simulator.${getJSOrTSXFileExtension}`;\n\tconst filePath = helpers.joinPathFromRoot(\"pages\", fileName);\n\n\tlet fileContents: string;\n\n\tif (options.typescript) {\n\t\tfileContents = stripIndent`\n\t\t\timport { GetStaticProps } from \"next/types\";\n\t\t\timport { SliceSimulator } from \"@prismicio/slice-simulator-react\";\n\t\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\t\timport state from \"../.slicemachine/libraries-state.json\";\n\t\t\timport { components } from \"../slices\";\n\n\t\t\tconst SliceSimulatorPage = () => {\n\t\t\t\treturn (\n\t\t\t\t\t<SliceSimulator\n\t\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t\t\tstate={state}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default SliceSimulatorPage;\n\n\t\t\texport const getStaticProps: GetStaticProps = () => {\n\t\t\t\treturn {\n\t\t\t\t\t// Exclude this page from production builds.\n\t\t\t\t\tnotFound: process.env.NODE_ENV === \"production\",\n\t\t\t\t};\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tfileContents = stripIndent`\n\t\t\timport { SliceSimulator } from \"@prismicio/slice-simulator-react\";\n\t\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\t\timport state from \"../.slicemachine/libraries-state.json\";\n\t\t\timport { components } from \"../slices\";\n\n\t\t\tconst SliceSimulatorPage = () => {\n\t\t\t\treturn (\n\t\t\t\t\t<SliceSimulator\n\t\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t\t\tstate={state}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default SliceSimulatorPage;\n\n\t\t\texport const getStaticProps= () => {\n\t\t\t\treturn {\n\t\t\t\t\t// Exclude this page from production builds.\n\t\t\t\t\tnotFound: process.env.NODE_ENV === \"production\",\n\t\t\t\t};\n\t\t\t};\n\t\t`;\n\t}\n\n\tfileContents = await helpers.format(fileContents, filePath);\n\n\treturn {\n\t\ttitle: \"Create a page for the simulator\",\n\t\tbody: stripIndent`\n\t\t\tIn your \\`pages\\` directory, create a file called \\`${fileName}\\` and add the following code. This route will be used to simulate and develop your components.\n\n\t\t\t~~~tsx\n\t\t\t${fileContents}\n\t\t\t~~~\n\t\t`,\n\t};\n};\n\nconst createStep3 = async ({\n\thelpers,\n}: Args): Promise<SliceSimulatorSetupStep> => {\n\tconst filePath = helpers.joinPathFromRoot(\"sm.json\");\n\tconst fileContents = await helpers.format(\n\t\t`\n\t\t\t{\n\t\t\t\t\"localSliceSimulatorURL\": \"http://localhost:3000/slice-simulator\"\n\t\t\t}\n\t\t`,\n\t\tfilePath,\n\t);\n\n\treturn {\n\t\ttitle: \"Update `sm.json`\",\n\t\tbody: stripIndent`\n\t\t\tUpdate your \\`sm.json\\` file with a \\`localSliceSimulatorURL\\` property pointing to your \\`slice-simulator\\` page.\n\n\t\t\t~~~json\n\t\t\t${fileContents}\n\t\t\t~~~\n\t\t`,\n\t\tvalidate: async () => {\n\t\t\tconst project = await helpers.getProject();\n\n\t\t\tif (!(\"localSliceSimulatorURL\" in project.config)) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: SliceSimulatorSetupStepValidationMessageType.Error,\n\t\t\t\t\ttitle: \"Missing `localSliceSimulatorURL` property\",\n\t\t\t\t\tmessage: stripIndent`\n\t\t\t\t\t\tA \\`localSliceSimulatorURL\\` property was not found in your \\`sm.json\\` file.\n\t\t\t\t\t`,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Test if the URL is valid.\n\t\t\ttry {\n\t\t\t\tif (project.config.localSliceSimulatorURL) {\n\t\t\t\t\tnew URL(project.config.localSliceSimulatorURL);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Undefined Slice Simulator URL\");\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\treturn {\n\t\t\t\t\ttype: SliceSimulatorSetupStepValidationMessageType.Warning,\n\t\t\t\t\ttitle: \"An invalid URL was provided\",\n\t\t\t\t\tmessage: stripIndent`\n\t\t\t\t\t\tThe \\`localSliceSimulatorURL\\` property should be of the shape \\`http://localhost:PORT/PATH\\`. See the codeblock for an example.\n\t\t\t\t\t`,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Check if the URL is accessible.\n\t\t\tconst ok = await new Promise<boolean>((resolve) => {\n\t\t\t\tif (project.config.localSliceSimulatorURL) {\n\t\t\t\t\thttp.get(project.config.localSliceSimulatorURL, (res) => {\n\t\t\t\t\t\tif (res.statusCode) {\n\t\t\t\t\t\t\tresolve(res.statusCode >= 200 && res.statusCode < 300);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tresolve(false);\n\t\t\t});\n\n\t\t\tif (!ok) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: SliceSimulatorSetupStepValidationMessageType.Warning,\n\t\t\t\t\ttitle: \"Unable to connect to simulator page\",\n\t\t\t\t\tmessage: stripIndent`\n\t\t\t\t\t\tCheck that the \\`localSliceSimulatorURL\\` property in \\`sm.json\\` is correct and try again. See the [troubleshooting page](https://prismic.io/docs/technologies/setup-slice-simulator-nextjs) for more details.\n\t\t\t\t\t`,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t};\n};\n\nexport const sliceSimulatorSetupRead: SliceSimulatorSetupReadHook<\n\tPluginOptions\n> = async (_data, context) => {\n\treturn Promise.all([\n\t\tcreateStep1(context),\n\t\tcreateStep2(context),\n\t\tcreateStep3(context),\n\t]);\n};\n"],"names":["require","createRequire","stripIndent","SliceSimulatorSetupStepValidationMessageType","getJSOrTSXFileExtension","http"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import type { SliceSimulatorSetupReadHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceSimulatorSetupRead: SliceSimulatorSetupReadHook<PluginOptions>;