@slicemachine/adapter-next 0.0.1 → 0.0.2

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 (159) 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-update.cjs +6 -0
  37. package/dist/hooks/customType-update.cjs.map +1 -0
  38. package/dist/hooks/customType-update.d.ts +1 -0
  39. package/dist/hooks/customType-update.js +6 -0
  40. package/dist/hooks/customType-update.js.map +1 -0
  41. package/dist/hooks/customTypeLibrary-read.cjs +46 -0
  42. package/dist/hooks/customTypeLibrary-read.cjs.map +1 -0
  43. package/dist/hooks/customTypeLibrary-read.d.ts +3 -0
  44. package/dist/hooks/customTypeLibrary-read.js +26 -0
  45. package/dist/hooks/customTypeLibrary-read.js.map +1 -0
  46. package/dist/hooks/slice-asset-delete.cjs +29 -0
  47. package/dist/hooks/slice-asset-delete.cjs.map +1 -0
  48. package/dist/hooks/slice-asset-delete.d.ts +3 -0
  49. package/dist/hooks/slice-asset-delete.js +10 -0
  50. package/dist/hooks/slice-asset-delete.js.map +1 -0
  51. package/dist/hooks/slice-asset-read.cjs +32 -0
  52. package/dist/hooks/slice-asset-read.cjs.map +1 -0
  53. package/dist/hooks/slice-asset-read.d.ts +3 -0
  54. package/dist/hooks/slice-asset-read.js +13 -0
  55. package/dist/hooks/slice-asset-read.js.map +1 -0
  56. package/dist/hooks/slice-asset-update.cjs +32 -0
  57. package/dist/hooks/slice-asset-update.cjs.map +1 -0
  58. package/dist/hooks/slice-asset-update.d.ts +3 -0
  59. package/dist/hooks/slice-asset-update.js +12 -0
  60. package/dist/hooks/slice-asset-update.js.map +1 -0
  61. package/dist/hooks/slice-create.cjs +119 -0
  62. package/dist/hooks/slice-create.cjs.map +1 -0
  63. package/dist/hooks/slice-create.d.ts +3 -0
  64. package/dist/hooks/slice-create.js +99 -0
  65. package/dist/hooks/slice-create.js.map +1 -0
  66. package/dist/hooks/slice-delete.cjs +49 -0
  67. package/dist/hooks/slice-delete.cjs.map +1 -0
  68. package/dist/hooks/slice-delete.d.ts +3 -0
  69. package/dist/hooks/slice-delete.js +30 -0
  70. package/dist/hooks/slice-delete.js.map +1 -0
  71. package/dist/hooks/slice-read.cjs +13 -0
  72. package/dist/hooks/slice-read.cjs.map +1 -0
  73. package/dist/hooks/slice-read.d.ts +3 -0
  74. package/dist/hooks/slice-read.js +13 -0
  75. package/dist/hooks/slice-read.js.map +1 -0
  76. package/dist/hooks/slice-update.cjs +41 -0
  77. package/dist/hooks/slice-update.cjs.map +1 -0
  78. package/dist/hooks/slice-update.d.ts +3 -0
  79. package/dist/hooks/slice-update.js +21 -0
  80. package/dist/hooks/slice-update.js.map +1 -0
  81. package/dist/hooks/sliceLibrary-read.cjs +52 -0
  82. package/dist/hooks/sliceLibrary-read.cjs.map +1 -0
  83. package/dist/hooks/sliceLibrary-read.d.ts +3 -0
  84. package/dist/hooks/sliceLibrary-read.js +31 -0
  85. package/dist/hooks/sliceLibrary-read.js.map +1 -0
  86. package/dist/hooks/sliceSimulator-setup-read.cjs +217 -0
  87. package/dist/hooks/sliceSimulator-setup-read.cjs.map +1 -0
  88. package/dist/hooks/sliceSimulator-setup-read.d.ts +3 -0
  89. package/dist/hooks/sliceSimulator-setup-read.js +198 -0
  90. package/dist/hooks/sliceSimulator-setup-read.js.map +1 -0
  91. package/dist/hooks/snippet-read.cjs +96 -0
  92. package/dist/hooks/snippet-read.cjs.map +1 -0
  93. package/dist/hooks/snippet-read.d.ts +3 -0
  94. package/dist/hooks/snippet-read.js +77 -0
  95. package/dist/hooks/snippet-read.js.map +1 -0
  96. package/dist/index.cjs +6 -698
  97. package/dist/index.cjs.map +1 -1
  98. package/dist/index.d.ts +5 -45
  99. package/dist/index.js +6 -669
  100. package/dist/index.js.map +1 -1
  101. package/dist/lib/buildSliceLibraryIndexFileContents.cjs +23 -0
  102. package/dist/lib/buildSliceLibraryIndexFileContents.cjs.map +1 -0
  103. package/dist/lib/buildSliceLibraryIndexFileContents.d.ts +10 -0
  104. package/dist/lib/buildSliceLibraryIndexFileContents.js +23 -0
  105. package/dist/lib/buildSliceLibraryIndexFileContents.js.map +1 -0
  106. package/dist/lib/getJSOrTSXFileExtension.cjs +13 -0
  107. package/dist/lib/getJSOrTSXFileExtension.cjs.map +1 -0
  108. package/dist/lib/getJSOrTSXFileExtension.d.ts +2 -0
  109. package/dist/lib/getJSOrTSXFileExtension.js +13 -0
  110. package/dist/lib/getJSOrTSXFileExtension.js.map +1 -0
  111. package/dist/lib/pascalCase.cjs +8 -0
  112. package/dist/lib/pascalCase.cjs.map +1 -0
  113. package/dist/lib/pascalCase.d.ts +8 -0
  114. package/dist/lib/pascalCase.js +8 -0
  115. package/dist/lib/pascalCase.js.map +1 -0
  116. package/dist/lib/readJSONFile.cjs +28 -0
  117. package/dist/lib/readJSONFile.cjs.map +1 -0
  118. package/dist/lib/readJSONFile.d.ts +1 -0
  119. package/dist/lib/readJSONFile.js +9 -0
  120. package/dist/lib/readJSONFile.js.map +1 -0
  121. package/dist/lib/rejectIfNecessary.cjs +10 -0
  122. package/dist/lib/rejectIfNecessary.cjs.map +1 -0
  123. package/dist/lib/rejectIfNecessary.d.ts +1 -0
  124. package/dist/lib/rejectIfNecessary.js +10 -0
  125. package/dist/lib/rejectIfNecessary.js.map +1 -0
  126. package/dist/lib/upsertGlobalContentTypes.cjs +53 -0
  127. package/dist/lib/upsertGlobalContentTypes.cjs.map +1 -0
  128. package/dist/lib/upsertGlobalContentTypes.d.ts +12 -0
  129. package/dist/lib/upsertGlobalContentTypes.js +33 -0
  130. package/dist/lib/upsertGlobalContentTypes.js.map +1 -0
  131. package/dist/package.cjs +5 -0
  132. package/dist/package.cjs.map +1 -0
  133. package/dist/package.js +5 -0
  134. package/dist/package.js.map +1 -0
  135. package/dist/plugin.cjs +52 -0
  136. package/dist/plugin.cjs.map +1 -0
  137. package/dist/plugin.d.ts +2 -0
  138. package/dist/plugin.js +52 -0
  139. package/dist/plugin.js.map +1 -0
  140. package/dist/types.d.ts +9 -0
  141. package/package.json +26 -23
  142. package/src/hooks/customType-asset-delete.ts +16 -0
  143. package/src/hooks/customType-asset-read.ts +20 -0
  144. package/src/hooks/customType-asset-update.ts +18 -0
  145. package/src/hooks/customType-create.ts +5 -20
  146. package/src/hooks/customType-delete.ts +6 -2
  147. package/src/hooks/customType-read.ts +5 -1
  148. package/src/hooks/{customType-library-read.ts → customTypeLibrary-read.ts} +3 -0
  149. package/src/hooks/slice-asset-delete.ts +19 -0
  150. package/src/hooks/slice-asset-read.ts +23 -0
  151. package/src/hooks/slice-asset-update.ts +21 -0
  152. package/src/hooks/slice-create.ts +14 -21
  153. package/src/hooks/slice-delete.ts +9 -1
  154. package/src/hooks/slice-read.ts +5 -1
  155. package/src/hooks/slice-update.ts +4 -19
  156. package/src/hooks/{slice-library-read.ts → sliceLibrary-read.ts} +3 -0
  157. package/src/lib/rejectIfNecessary.ts +16 -0
  158. package/src/lib/upsertGlobalContentTypes.ts +59 -0
  159. package/src/plugin.ts +20 -8
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/lib/pascalCase.ts","../src/lib/buildSliceLibraryIndexFileContents.ts","../src/lib/getJSOrTSXFileExtension.ts","../src/hooks/slice-create.ts","../src/hooks/slice-update.ts","../src/hooks/slice-delete.ts","../src/lib/readJSONFile.ts","../src/hooks/slice-read.ts","../node_modules/@prismicio/types/dist/index.js","../src/hooks/slice-library-read.ts","../src/hooks/customType-create.ts","../src/hooks/customType-update.ts","../src/hooks/customType-delete.ts","../src/hooks/customType-read.ts","../src/hooks/customType-library-read.ts","../src/hooks/snippet-read.ts","../src/hooks/sliceSimulator-setup-read.ts","../src/plugin.ts","../src/SliceSimulator.tsx"],"sourcesContent":["import { pascalCase as basePascalCase } from \"pascal-case\";\n\n/**\n * Converts a string to a Pascal cased string.\n *\n * @param input - String to convert into a Pascal cased string.\n *\n * @returns Pascal cased string version of `input`.\n */\nexport const pascalCase = (...input: (string | undefined)[]): string => {\n\treturn basePascalCase(input.filter(Boolean).join(\" \"));\n};\n","import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype BuildSliceLibraryIndexFileContentsArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const buildSliceLibraryIndexFileContents = async (\n\targs: BuildSliceLibraryIndexFileContentsArgs,\n): Promise<{ filePath: string; contents: string }> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\tconst sliceLibrary = await args.actions.readSliceLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${sliceLibrary.sliceIDs.map(\n\t\t\t\t(id) => `${id}: dynamic(() => import('./${pascalCase(id)}')),`,\n\t\t\t)}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\treturn { filePath, contents };\n};\n","import type { PluginOptions } from \"../types\";\n\nexport const getJSOrTSXFileExtension = (\n\tpluginOptions: PluginOptions,\n): string => {\n\tif (pluginOptions.typescript) {\n\t\treturn \"tsx\";\n\t} else if (pluginOptions.jsxExtension) {\n\t\treturn \"jsx\";\n\t} else {\n\t\treturn \"js\";\n\t}\n};\n","import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { generateTypes } from \"prismic-ts-codegen\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildSliceLibraryIndexFileContents } from \"../lib/buildSliceLibraryIndexFileContents\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\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 pascalID = pascalCase(model.id);\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 { ${pascalID}Slice } from \"./types\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalID}\\`.\n\t\t\t */\n\t\t\texport type ${pascalID}Props = SliceComponentProps<${pascalID}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalID} = ({ slice }: ${pascalID}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 ${pascalID}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t/**\n\t\t\t * @typedef {import(\"./types\").${pascalID}Slice} ${pascalID}Slice\n\t\t\t * @typedef {import(\"@prismicio/react\").SliceComponentProps<${pascalID}Slice>} ${pascalID}Props\n\t\t\t * @param {${pascalID}Props}\n\t\t\t */\n\t\t\tconst ${pascalID} = ({ 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 ${pascalID};\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\nconst createTypesFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"types.ts\");\n\n\tlet contents = generateTypes({\n\t\tsharedSliceModels: [data.model],\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\nconst upsertSliceLibraryIndexFile = async ({\n\tdata,\n\tactions,\n\thelpers,\n\tproject,\n\toptions,\n}: Omit<Args, \"dir\">) => {\n\tconst { filePath, contents } = await buildSliceLibraryIndexFileContents({\n\t\tlibraryID: data.libraryID,\n\t\tactions,\n\t\thelpers,\n\t\tproject,\n\t\toptions,\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.id),\n\t);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait Promise.allSettled([\n\t\tcreateModelFile({ dir, data, ...context }),\n\t\tcreateComponentFile({ dir, data, ...context }),\n\t\tcreateTypesFile({ dir, data, ...context }),\n\t]);\n\n\tawait upsertSliceLibraryIndexFile({ data, ...context });\n};\n","import type {\n\tSliceMachineContext,\n\tSliceUpdateHook,\n\tSliceUpdateHookData,\n} from \"@slicemachine/plugin-kit\";\nimport { generateTypes } from \"prismic-ts-codegen\";\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\ntype Args = {\n\tdir: string;\n\tdata: SliceUpdateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst updateModelFile = 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 updateTypesFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"types.ts\");\n\n\tlet contents = generateTypes({\n\t\tsharedSliceModels: [data.model],\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 sliceUpdate: SliceUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.id),\n\t);\n\n\tawait Promise.allSettled([\n\t\tupdateModelFile({ dir, data, ...context }),\n\t\tupdateTypesFile({ dir, data, ...context }),\n\t]);\n};\n","import type {\n\tSliceDeleteHook,\n\tSliceDeleteHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceLibraryIndexFileContents } from \"../lib/buildSliceLibraryIndexFileContents\";\nimport { pascalCase } from \"../lib/pascalCase\";\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.id),\n\t);\n\n\tawait fs.rm(dir, { recursive: true });\n};\n\nconst updateSliceLibraryIndexFile = async ({\n\tdata,\n\tactions,\n\thelpers,\n\tproject,\n\toptions,\n}: Args) => {\n\tconst { filePath, contents } = await buildSliceLibraryIndexFileContents({\n\t\tlibraryID: data.libraryID,\n\t\tactions,\n\t\thelpers,\n\t\tproject,\n\t\toptions,\n\t});\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const sliceDelete: SliceDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait deleteSliceDir({ data, ...context });\n\tawait updateSliceLibraryIndexFile({ data, ...context });\n};\n","import * as fs from \"node:fs/promises\";\n\nexport const readJSONFile = async <T = unknown>(path: string): Promise<T> => {\n\tconst contents = await fs.readFile(path, \"utf8\");\n\n\treturn JSON.parse(contents);\n};\n","import type { SliceReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\nimport { pascalCase } from \"../lib/pascalCase\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRead: SliceReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.sliceID),\n\t\t\"model.json\",\n\t);\n\n\treturn await readJSONFile<prismicT.SharedSliceModel>(filePath);\n};\n","const RichTextNodeType = {\n heading1: \"heading1\",\n heading2: \"heading2\",\n heading3: \"heading3\",\n heading4: \"heading4\",\n heading5: \"heading5\",\n heading6: \"heading6\",\n paragraph: \"paragraph\",\n preformatted: \"preformatted\",\n strong: \"strong\",\n em: \"em\",\n listItem: \"list-item\",\n oListItem: \"o-list-item\",\n list: \"group-list-item\",\n oList: \"group-o-list-item\",\n image: \"image\",\n embed: \"embed\",\n hyperlink: \"hyperlink\",\n label: \"label\",\n span: \"span\"\n};\nconst LinkType = {\n Any: \"Any\",\n Document: \"Document\",\n Media: \"Media\",\n Web: \"Web\"\n};\nconst OEmbedType = {\n Photo: \"photo\",\n Video: \"video\",\n Link: \"link\",\n Rich: \"rich\"\n};\n\nconst CustomTypeModelFieldType = {\n Boolean: \"Boolean\",\n Color: \"Color\",\n Date: \"Date\",\n Embed: \"Embed\",\n GeoPoint: \"GeoPoint\",\n Group: \"Group\",\n Image: \"Image\",\n IntegrationFields: \"IntegrationFields\",\n Link: \"Link\",\n Number: \"Number\",\n Select: \"Select\",\n Slices: \"Slices\",\n StructuredText: \"StructuredText\",\n Text: \"Text\",\n Timestamp: \"Timestamp\",\n UID: \"UID\",\n Range: \"Range\",\n Separator: \"Separator\",\n LegacySlices: \"Choice\"\n};\nconst CustomTypeModelLinkSelectType = {\n Document: \"document\",\n Media: \"media\",\n Web: \"web\"\n};\nconst CustomTypeModelSliceDisplay = {\n List: \"list\",\n Grid: \"grid\"\n};\nconst CustomTypeModelSliceType = {\n Slice: \"Slice\",\n SharedSlice: \"SharedSlice\"\n};\n\nconst WebhookType = {\n APIUpdate: \"api-update\",\n TestTrigger: \"test-trigger\"\n};\n\nconst EmbedType = OEmbedType;\n\nexport { CustomTypeModelFieldType, CustomTypeModelLinkSelectType, CustomTypeModelSliceDisplay, CustomTypeModelSliceType, EmbedType, LinkType, OEmbedType, RichTextNodeType, WebhookType };\n//# sourceMappingURL=index.js.map\n","import type { SliceLibraryReadHook } 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 isSharedSliceModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.SharedSliceModel => {\n\treturn (\n\t\ttypeof input === \"object\" &&\n\t\tinput !== null &&\n\t\t\"type\" in input &&\n\t\tinput.type === prismicT.CustomTypeModelSliceType.SharedSlice\n\t);\n};\n\nexport const sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dirPath = helpers.joinPathFromRoot(data.libraryID);\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst sliceIDs: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst modelPath = path.join(dirPath, childDir, \"model.json\");\n\n\t\t\ttry {\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// noop\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","import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { generateTypes } from \"prismic-ts-codegen\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nconst createTypesFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"types.ts\");\n\n\t// TODO: Figure out how to import Shared Slice types\n\tlet contents = generateTypes({\n\t\tcustomTypeModels: [data.model],\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 customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait Promise.allSettled([\n\t\tcreateModelFile({ dir, data, ...context }),\n\t\tcreateTypesFile({ dir, data, ...context }),\n\t]);\n};\n","import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n","import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dir = helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.rm(dir, { recursive: true });\n};\n","import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.id,\n\t\t\"index.json\",\n\t);\n\n\treturn await readJSONFile<prismicT.CustomTypeModel>(filePath);\n};\n","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\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 modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\tids.push(modelContents.id);\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n","import type { SnippetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport { stripIndent } from \"common-tags\";\nimport type { Config as PrettierConfig } from \"prettier\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst prettierOptions: PrettierConfig = { parser: \"typescript\" };\n\nconst dotPath = (segments: string[]): string => {\n\treturn segments.join(\".\");\n};\n\nexport const snippetRead: SnippetReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst { fieldPath } = data;\n\n\tconst label = \"React\";\n\n\tswitch (data.model.type) {\n\t\tcase prismicT.CustomTypeModelFieldType.Link: {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"tsx\",\n\t\t\t\tcode: await helpers.format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<PrismicLink field={${dotPath(fieldPath)}}>Link</PrismicLink>\n\t\t\t\t\t`,\n\t\t\t\t\tundefined,\n\t\t\t\t\t{ prettier: prettierOptions },\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tcase prismicT.CustomTypeModelFieldType.Image: {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: `${label} (next/image)`,\n\t\t\t\t\tlanguage: \"tsx\",\n\t\t\t\t\tcode: await helpers.format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicNextImage field={${dotPath(fieldPath)}} />\n\t\t\t\t\t\t`,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{ prettier: prettierOptions },\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel,\n\t\t\t\t\tlanguage: \"tsx\",\n\t\t\t\t\tcode: await helpers.format(\n\t\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t\t<PrismicImage field={${dotPath(fieldPath)}} />\n\t\t\t\t\t\t`,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{ prettier: prettierOptions },\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tcase prismicT.CustomTypeModelFieldType.Group: {\n\t\t\tconst code = await helpers.format(\n\t\t\t\tstripIndent`\n\t\t\t\t\t<>{${dotPath(fieldPath)}.map(item => (\n\t\t\t\t\t <>{/* Render content for item */}</>\n\t\t\t\t\t))}</>\n\t\t\t\t`,\n\t\t\t\tundefined,\n\t\t\t\t{ prettier: prettierOptions },\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"tsx\",\n\t\t\t\tcode,\n\t\t\t};\n\t\t}\n\n\t\tcase prismicT.CustomTypeModelFieldType.Slices: {\n\t\t\tconst code = await helpers.format(\n\t\t\t\tstripIndent`\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t slices={${dotPath(fieldPath)}}\n\t\t\t\t\t components={components}\n\t\t\t\t\t/>\n\t\t\t\t`,\n\t\t\t\tundefined,\n\t\t\t\t{ prettier: prettierOptions },\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"tsx\",\n\t\t\t\tcode,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tlanguage: \"tsx\",\n\t\t\t\tcode: await helpers.format(\n\t\t\t\t\tstripIndent`\n\t\t\t\t\t\t<>{${dotPath(fieldPath)}}</>\n\t\t\t\t\t`,\n\t\t\t\t\tundefined,\n\t\t\t\t\t{ prettier: prettierOptions },\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n};\n","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","import { defineSliceMachinePlugin } from \"@slicemachine/plugin-kit\";\n\nimport { name as pkgName } from \"../package.json\";\nimport { PluginOptions } from \"./types\";\n\nimport { sliceCreate } from \"./hooks/slice-create\";\nimport { sliceUpdate } from \"./hooks/slice-update\";\nimport { sliceDelete } from \"./hooks/slice-delete\";\nimport { sliceRead } from \"./hooks/slice-read\";\nimport { sliceLibraryRead } from \"./hooks/slice-library-read\";\nimport { customTypeCreate } from \"./hooks/customType-create\";\nimport { customTypeUpdate } from \"./hooks/customType-update\";\nimport { customTypeDelete } from \"./hooks/customType-delete\";\nimport { customTypeRead } from \"./hooks/customType-read\";\nimport { customTypeLibraryRead } from \"./hooks/customType-library-read\";\nimport { snippetRead } from \"./hooks/snippet-read\";\nimport { sliceSimulatorSetupRead } from \"./hooks/sliceSimulator-setup-read\";\n\nexport const plugin = defineSliceMachinePlugin<PluginOptions>({\n\tmeta: {\n\t\tname: pkgName,\n\t},\n\tdefaultOptions: {\n\t\tformat: true,\n\t},\n\tsetup({ hook }) {\n\t\thook(\"slice:create\", sliceCreate);\n\t\thook(\"slice:update\", sliceUpdate);\n\t\thook(\"slice:delete\", sliceDelete);\n\t\thook(\"slice:read\", sliceRead);\n\t\thook(\"slice-library:read\", sliceLibraryRead);\n\n\t\thook(\"custom-type:create\", customTypeCreate);\n\t\thook(\"custom-type:update\", customTypeUpdate);\n\t\thook(\"custom-type:delete\", customTypeDelete);\n\t\thook(\"custom-type:read\", customTypeRead);\n\t\thook(\"custom-type-library:read\", customTypeLibraryRead);\n\n\t\thook(\"snippet:read\", snippetRead);\n\n\t\thook(\"slice-simulator:setup:read\", sliceSimulatorSetupRead);\n\t},\n});\n","import * as React from \"react\";\nimport {\n\tCoreManager,\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n\tStateManagerEventType,\n\tStateManagerStatus,\n\tdisableEventHandler,\n\tgetDefaultManagedState,\n\tgetDefaultMessage,\n\tgetDefaultProps,\n\tgetDefaultSlices,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/slice-simulator-core\";\n\nconst coreManager = new CoreManager();\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"];\n};\n\nexport type SliceSimulatorProps = {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t *\n\t * ```tsx\n\t * import { SliceSimulator } from \"@slicemachine/adapter-next\";\n\t * import { SliceZone } from \"@prismicio/react\";\n\t *\n\t * import { components } from \"../slices\";\n\t * import state from \"../.slicemachine/libraries-state.json\";\n\t *\n\t * <SliceSimulator\n\t * \tsliceZone={({ slices }) => (\n\t * \t\t<SliceZone slices={slices} components={components} />\n\t * \t)}\n\t * \tstate={state}\n\t * />;\n\t * ```\n\t */\n\tsliceZone: (props: SliceSimulatorSliceZoneProps) => JSX.Element;\n\tclassName?: string;\n} & BaseSliceSimulatorProps;\n\nexport const SliceSimulator = ({\n\tsliceZone: SliceZoneComp,\n\tstate,\n\tbackground,\n\tzIndex,\n\tclassName,\n}: SliceSimulatorProps): JSX.Element => {\n\tconst defaultProps = getDefaultProps();\n\n\tconst [managedState, setManagedState] = React.useState(() =>\n\t\tgetDefaultManagedState(),\n\t);\n\tconst [slices, setSlices] = React.useState(() => getDefaultSlices());\n\tconst [message, setMessage] = React.useState(() => getDefaultMessage());\n\n\tReact.useEffect(() => {\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.ManagedState,\n\t\t\t(_managedState) => {\n\t\t\t\tsetManagedState(_managedState);\n\t\t\t},\n\t\t\t\"simulator-managed-state\",\n\t\t);\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message);\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tcoreManager.init(state);\n\n\t\treturn () => {\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.ManagedState,\n\t\t\t\t\"simulator-managed-state\",\n\t\t\t);\n\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.Slices,\n\t\t\t\t\"simulator-slices\",\n\t\t\t);\n\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.Message,\n\t\t\t\t\"simulator-message\",\n\t\t\t);\n\t\t};\n\t}, []);\n\n\t// Update state on HMR\n\tconst didMount = React.useRef(false);\n\tReact.useEffect(() => {\n\t\tif (didMount.current) {\n\t\t\tcoreManager.stateManager.reload(state);\n\t\t} else {\n\t\t\tdidMount.current = true;\n\t\t}\n\t}, [state]);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[simulatorClass, className].filter(Boolean).join(\" \")}\n\t\t\tstyle={{\n\t\t\t\tzIndex:\n\t\t\t\t\ttypeof zIndex === \"undefined\"\n\t\t\t\t\t\t? defaultProps.zIndex\n\t\t\t\t\t\t: zIndex ?? undefined,\n\t\t\t\tposition: \"fixed\",\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: \"100%\",\n\t\t\t\theight: \"100vh\",\n\t\t\t\toverflow: \"auto\",\n\t\t\t\tbackground:\n\t\t\t\t\ttypeof background === \"undefined\"\n\t\t\t\t\t\t? defaultProps.background\n\t\t\t\t\t\t: background ?? undefined,\n\t\t\t}}\n\t\t>\n\t\t\t{message ? (\n\t\t\t\t<article dangerouslySetInnerHTML={{ __html: message }} />\n\t\t\t) : slices.length ? (\n\t\t\t\t<div\n\t\t\t\t\tid=\"root\"\n\t\t\t\t\tclassName={simulatorRootClass}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tmanagedState.status !== StateManagerStatus.Loaded\n\t\t\t\t\t\t\t? { display: \"none\" }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tonClickCapture={onClickHandler as unknown as React.MouseEventHandler}\n\t\t\t\t\tonSubmitCapture={\n\t\t\t\t\t\tdisableEventHandler as unknown as React.FormEventHandler\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<SliceZoneComp slices={slices} />\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n};\n"],"names":["basePascalCase","createModelFile","createTypesFile","prismicT.CustomTypeModelSliceType","prismicT.CustomTypeModelFieldType","pkgName"],"mappings":";;;;;;;;;;;;;AASa,MAAA,UAAA,GAAa,IAAI,KAA0C,KAAA;AACvE,EAAA,OAAOA,YAAe,CAAA,KAAA,CAAM,MAAO,CAAA,OAAA,CAAA,CAAS,IAAK,CAAA,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA;;ACCrC,MAAA,kCAAA,GAAqC,OACjD,IACqD,KAAA;AACrD,EAAM,MAAA,QAAA,GAAW,KAAK,OAAQ,CAAA,gBAAA,CAC7B,KAAK,SACL,EAAA,IAAA,CAAK,OAAQ,CAAA,UAAA,GAAa,UAAa,GAAA,UAAA,CAAA,CAAA;AAExC,EAAA,MAAM,YAAe,GAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,gBAAiB,CAAA;AAAA,IACxD,WAAW,IAAK,CAAA,SAAA;AAAA,GAAA,CAAA,CAAA;AAGjB,EAAA,IAAI,QAAW,GAAA,WAAA,CAAA;AAAA;AAAA;AAAA;AAAA,GAAA,EAIX,aAAa,QAAS,CAAA,GAAA,CACvB,CAAC,EAAO,KAAA,CAAA,EAAG,+BAA+B,UAAW,CAAA,EAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AAAA;AAAA,CAAA,CAAA,CAAA;AAKxD,EAAI,IAAA,IAAA,CAAK,QAAQ,MAAQ,EAAA;AACxB,IAAA,QAAA,GAAW,MAAM,IAAA,CAAK,OAAQ,CAAA,MAAA,CAAO,QA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MACX,EAAA,GAAA,KAAA,CAAA;AAAA,IAEJ,cAAgB,EAAA,cAAA;AAAA,IAChB,eACC,EAAA,mBAAA;AAAA,GAAA,sCAGA,aAAD,EAAA;AAAA,IAAe,MAAA;AAAA,GAEb,CAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const commonTags = require("common-tags");
4
+ const pascalCase = require("./pascalCase.cjs");
5
+ const buildSliceLibraryIndexFileContents = async (args) => {
6
+ const filePath = args.helpers.joinPathFromRoot(args.libraryID, args.options.typescript ? "index.ts" : "index.js");
7
+ const sliceLibrary = await args.actions.readSliceLibrary({
8
+ libraryID: args.libraryID
9
+ });
10
+ let contents = commonTags.stripIndent`
11
+ import dynamic from 'next/dynamic'
12
+
13
+ export const components = {
14
+ ${sliceLibrary.sliceIDs.map((id) => `${id}: dynamic(() => import('./${pascalCase.pascalCase(id)}')),`)}
15
+ }
16
+ `;
17
+ if (args.options.format) {
18
+ contents = await args.helpers.format(contents, filePath);
19
+ }
20
+ return { filePath, contents };
21
+ };
22
+ exports.buildSliceLibraryIndexFileContents = buildSliceLibraryIndexFileContents;
23
+ //# sourceMappingURL=buildSliceLibraryIndexFileContents.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSliceLibraryIndexFileContents.cjs","sources":["../../src/lib/buildSliceLibraryIndexFileContents.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype BuildSliceLibraryIndexFileContentsArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const buildSliceLibraryIndexFileContents = async (\n\targs: BuildSliceLibraryIndexFileContentsArgs,\n): Promise<{ filePath: string; contents: string }> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\tconst sliceLibrary = await args.actions.readSliceLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${sliceLibrary.sliceIDs.map(\n\t\t\t\t(id) => `${id}: dynamic(() => import('./${pascalCase(id)}')),`,\n\t\t\t)}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\treturn { filePath, contents };\n};\n"],"names":["stripIndent","pascalCase"],"mappings":";;;;AAWa,MAAA,qCAAqC,OACjD,SACoD;AAC9C,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAElD,QAAM,eAAe,MAAM,KAAK,QAAQ,iBAAiB;AAAA,IACxD,WAAW,KAAK;AAAA,EAAA,CAChB;AAED,MAAI,WAAWA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA,KAIX,aAAa,SAAS,IACvB,CAAC,OAAO,GAAG,+BAA+BC,WAAAA,WAAW,EAAE,OAAO;AAAA;AAAA;AAK7D,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEM,SAAA,EAAE,UAAU;AACpB;;"}
@@ -0,0 +1,10 @@
1
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+ import { PluginOptions } from "../types";
3
+ declare type BuildSliceLibraryIndexFileContentsArgs = {
4
+ libraryID: string;
5
+ } & SliceMachineContext<PluginOptions>;
6
+ export declare const buildSliceLibraryIndexFileContents: (args: BuildSliceLibraryIndexFileContentsArgs) => Promise<{
7
+ filePath: string;
8
+ contents: string;
9
+ }>;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import { stripIndent } from "common-tags";
2
+ import { pascalCase } from "./pascalCase.js";
3
+ const buildSliceLibraryIndexFileContents = async (args) => {
4
+ const filePath = args.helpers.joinPathFromRoot(args.libraryID, args.options.typescript ? "index.ts" : "index.js");
5
+ const sliceLibrary = await args.actions.readSliceLibrary({
6
+ libraryID: args.libraryID
7
+ });
8
+ let contents = stripIndent`
9
+ import dynamic from 'next/dynamic'
10
+
11
+ export const components = {
12
+ ${sliceLibrary.sliceIDs.map((id) => `${id}: dynamic(() => import('./${pascalCase(id)}')),`)}
13
+ }
14
+ `;
15
+ if (args.options.format) {
16
+ contents = await args.helpers.format(contents, filePath);
17
+ }
18
+ return { filePath, contents };
19
+ };
20
+ export {
21
+ buildSliceLibraryIndexFileContents
22
+ };
23
+ //# sourceMappingURL=buildSliceLibraryIndexFileContents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSliceLibraryIndexFileContents.js","sources":["../../src/lib/buildSliceLibraryIndexFileContents.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype BuildSliceLibraryIndexFileContentsArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const buildSliceLibraryIndexFileContents = async (\n\targs: BuildSliceLibraryIndexFileContentsArgs,\n): Promise<{ filePath: string; contents: string }> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\tconst sliceLibrary = await args.actions.readSliceLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${sliceLibrary.sliceIDs.map(\n\t\t\t\t(id) => `${id}: dynamic(() => import('./${pascalCase(id)}')),`,\n\t\t\t)}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\treturn { filePath, contents };\n};\n"],"names":[],"mappings":";;AAWa,MAAA,qCAAqC,OACjD,SACoD;AAC9C,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAElD,QAAM,eAAe,MAAM,KAAK,QAAQ,iBAAiB;AAAA,IACxD,WAAW,KAAK;AAAA,EAAA,CAChB;AAED,MAAI,WAAW;AAAA;AAAA;AAAA;AAAA,KAIX,aAAa,SAAS,IACvB,CAAC,OAAO,GAAG,+BAA+B,WAAW,EAAE,OAAO;AAAA;AAAA;AAK7D,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEM,SAAA,EAAE,UAAU;AACpB;"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const getJSOrTSXFileExtension = (pluginOptions) => {
4
+ if (pluginOptions.typescript) {
5
+ return "tsx";
6
+ } else if (pluginOptions.jsxExtension) {
7
+ return "jsx";
8
+ } else {
9
+ return "js";
10
+ }
11
+ };
12
+ exports.getJSOrTSXFileExtension = getJSOrTSXFileExtension;
13
+ //# sourceMappingURL=getJSOrTSXFileExtension.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getJSOrTSXFileExtension.cjs","sources":["../../src/lib/getJSOrTSXFileExtension.ts"],"sourcesContent":["import type { PluginOptions } from \"../types\";\n\nexport const getJSOrTSXFileExtension = (\n\tpluginOptions: PluginOptions,\n): string => {\n\tif (pluginOptions.typescript) {\n\t\treturn \"tsx\";\n\t} else if (pluginOptions.jsxExtension) {\n\t\treturn \"jsx\";\n\t} else {\n\t\treturn \"js\";\n\t}\n};\n"],"names":[],"mappings":";;AAEa,MAAA,0BAA0B,CACtC,kBACW;AACX,MAAI,cAAc,YAAY;AACtB,WAAA;AAAA,EAAA,WACG,cAAc,cAAc;AAC/B,WAAA;AAAA,EAAA,OACD;AACC,WAAA;AAAA,EACP;AACF;;"}
@@ -0,0 +1,2 @@
1
+ import type { PluginOptions } from "../types";
2
+ export declare const getJSOrTSXFileExtension: (pluginOptions: PluginOptions) => string;
@@ -0,0 +1,13 @@
1
+ const getJSOrTSXFileExtension = (pluginOptions) => {
2
+ if (pluginOptions.typescript) {
3
+ return "tsx";
4
+ } else if (pluginOptions.jsxExtension) {
5
+ return "jsx";
6
+ } else {
7
+ return "js";
8
+ }
9
+ };
10
+ export {
11
+ getJSOrTSXFileExtension
12
+ };
13
+ //# sourceMappingURL=getJSOrTSXFileExtension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getJSOrTSXFileExtension.js","sources":["../../src/lib/getJSOrTSXFileExtension.ts"],"sourcesContent":["import type { PluginOptions } from \"../types\";\n\nexport const getJSOrTSXFileExtension = (\n\tpluginOptions: PluginOptions,\n): string => {\n\tif (pluginOptions.typescript) {\n\t\treturn \"tsx\";\n\t} else if (pluginOptions.jsxExtension) {\n\t\treturn \"jsx\";\n\t} else {\n\t\treturn \"js\";\n\t}\n};\n"],"names":[],"mappings":"AAEa,MAAA,0BAA0B,CACtC,kBACW;AACX,MAAI,cAAc,YAAY;AACtB,WAAA;AAAA,EAAA,WACG,cAAc,cAAc;AAC/B,WAAA;AAAA,EAAA,OACD;AACC,WAAA;AAAA,EACP;AACF;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const pascalCase$1 = require("pascal-case");
4
+ const pascalCase = (...input) => {
5
+ return pascalCase$1.pascalCase(input.filter(Boolean).join(" "));
6
+ };
7
+ exports.pascalCase = pascalCase;
8
+ //# sourceMappingURL=pascalCase.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pascalCase.cjs","sources":["../../src/lib/pascalCase.ts"],"sourcesContent":["import { pascalCase as basePascalCase } from \"pascal-case\";\n\n/**\n * Converts a string to a Pascal cased string.\n *\n * @param input - String to convert into a Pascal cased string.\n *\n * @returns Pascal cased string version of `input`.\n */\nexport const pascalCase = (...input: (string | undefined)[]): string => {\n\treturn basePascalCase(input.filter(Boolean).join(\" \"));\n};\n"],"names":["basePascalCase"],"mappings":";;;AASa,MAAA,aAAa,IAAI,UAAyC;AACtE,SAAOA,aAAAA,WAAe,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC;AACtD;;"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts a string to a Pascal cased string.
3
+ *
4
+ * @param input - String to convert into a Pascal cased string.
5
+ *
6
+ * @returns Pascal cased string version of `input`.
7
+ */
8
+ export declare const pascalCase: (...input: (string | undefined)[]) => string;
@@ -0,0 +1,8 @@
1
+ import { pascalCase as pascalCase$1 } from "pascal-case";
2
+ const pascalCase = (...input) => {
3
+ return pascalCase$1(input.filter(Boolean).join(" "));
4
+ };
5
+ export {
6
+ pascalCase
7
+ };
8
+ //# sourceMappingURL=pascalCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pascalCase.js","sources":["../../src/lib/pascalCase.ts"],"sourcesContent":["import { pascalCase as basePascalCase } from \"pascal-case\";\n\n/**\n * Converts a string to a Pascal cased string.\n *\n * @param input - String to convert into a Pascal cased string.\n *\n * @returns Pascal cased string version of `input`.\n */\nexport const pascalCase = (...input: (string | undefined)[]): string => {\n\treturn basePascalCase(input.filter(Boolean).join(\" \"));\n};\n"],"names":["basePascalCase"],"mappings":";AASa,MAAA,aAAa,IAAI,UAAyC;AACtE,SAAOA,aAAe,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC;AACtD;"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fs = require("node:fs/promises");
4
+ function _interopNamespace(e) {
5
+ if (e && e.__esModule)
6
+ return e;
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
23
+ const readJSONFile = async (path) => {
24
+ const contents = await fs__namespace.readFile(path, "utf8");
25
+ return JSON.parse(contents);
26
+ };
27
+ exports.readJSONFile = readJSONFile;
28
+ //# sourceMappingURL=readJSONFile.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readJSONFile.cjs","sources":["../../src/lib/readJSONFile.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nexport const readJSONFile = async <T = unknown>(path: string): Promise<T> => {\n\tconst contents = await fs.readFile(path, \"utf8\");\n\n\treturn JSON.parse(contents);\n};\n"],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEa,MAAA,eAAe,OAAoB,SAA4B;AAC3E,QAAM,WAAW,MAAMA,cAAG,SAAS,MAAM,MAAM;AAExC,SAAA,KAAK,MAAM,QAAQ;AAC3B;;"}
@@ -0,0 +1 @@
1
+ export declare const readJSONFile: <T = unknown>(path: string) => Promise<T>;
@@ -0,0 +1,9 @@
1
+ import * as fs from "node:fs/promises";
2
+ const readJSONFile = async (path) => {
3
+ const contents = await fs.readFile(path, "utf8");
4
+ return JSON.parse(contents);
5
+ };
6
+ export {
7
+ readJSONFile
8
+ };
9
+ //# sourceMappingURL=readJSONFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readJSONFile.js","sources":["../../src/lib/readJSONFile.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nexport const readJSONFile = async <T = unknown>(path: string): Promise<T> => {\n\tconst contents = await fs.readFile(path, \"utf8\");\n\n\treturn JSON.parse(contents);\n};\n"],"names":[],"mappings":";AAEa,MAAA,eAAe,OAAoB,SAA4B;AAC3E,QAAM,WAAW,MAAM,GAAG,SAAS,MAAM,MAAM;AAExC,SAAA,KAAK,MAAM,QAAQ;AAC3B;"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const rejectIfNecessary = (promiseSettledResults) => {
4
+ const rejectedReasons = promiseSettledResults.filter((result) => result.status === "rejected").map((result) => result.reason);
5
+ if (rejectedReasons.length > 0) {
6
+ throw rejectedReasons[0];
7
+ }
8
+ };
9
+ exports.rejectIfNecessary = rejectIfNecessary;
10
+ //# sourceMappingURL=rejectIfNecessary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejectIfNecessary.cjs","sources":["../../src/lib/rejectIfNecessary.ts"],"sourcesContent":["export const rejectIfNecessary = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTPromiseSettledResults extends readonly PromiseSettledResult<any>[],\n>(\n\tpromiseSettledResults: TPromiseSettledResults,\n): void => {\n\tconst rejectedReasons = promiseSettledResults\n\t\t.filter(\n\t\t\t(result): result is PromiseRejectedResult => result.status === \"rejected\",\n\t\t)\n\t\t.map((result) => result.reason);\n\n\tif (rejectedReasons.length > 0) {\n\t\tthrow rejectedReasons[0];\n\t}\n};\n"],"names":[],"mappings":";;AAAa,MAAA,oBAAoB,CAIhC,0BACS;AACT,QAAM,kBAAkB,sBACtB,OACA,CAAC,WAA4C,OAAO,WAAW,UAAU,EAEzE,IAAI,CAAC,WAAW,OAAO,MAAM;AAE3B,MAAA,gBAAgB,SAAS,GAAG;AAC/B,UAAM,gBAAgB;AAAA,EACtB;AACF;;"}
@@ -0,0 +1 @@
1
+ export declare const rejectIfNecessary: <TPromiseSettledResults extends readonly PromiseSettledResult<any>[]>(promiseSettledResults: TPromiseSettledResults) => void;
@@ -0,0 +1,10 @@
1
+ const rejectIfNecessary = (promiseSettledResults) => {
2
+ const rejectedReasons = promiseSettledResults.filter((result) => result.status === "rejected").map((result) => result.reason);
3
+ if (rejectedReasons.length > 0) {
4
+ throw rejectedReasons[0];
5
+ }
6
+ };
7
+ export {
8
+ rejectIfNecessary
9
+ };
10
+ //# sourceMappingURL=rejectIfNecessary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejectIfNecessary.js","sources":["../../src/lib/rejectIfNecessary.ts"],"sourcesContent":["export const rejectIfNecessary = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTPromiseSettledResults extends readonly PromiseSettledResult<any>[],\n>(\n\tpromiseSettledResults: TPromiseSettledResults,\n): void => {\n\tconst rejectedReasons = promiseSettledResults\n\t\t.filter(\n\t\t\t(result): result is PromiseRejectedResult => result.status === \"rejected\",\n\t\t)\n\t\t.map((result) => result.reason);\n\n\tif (rejectedReasons.length > 0) {\n\t\tthrow rejectedReasons[0];\n\t}\n};\n"],"names":[],"mappings":"AAAa,MAAA,oBAAoB,CAIhC,0BACS;AACT,QAAM,kBAAkB,sBACtB,OACA,CAAC,WAA4C,OAAO,WAAW,UAAU,EAEzE,IAAI,CAAC,WAAW,OAAO,MAAM;AAE3B,MAAA,gBAAgB,SAAS,GAAG;AAC/B,UAAM,gBAAgB;AAAA,EACtB;AACF;"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const prismicTsCodegen = require("prismic-ts-codegen");
4
+ const fs = require("node:fs/promises");
5
+ const path = require("node:path");
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 upsertGlobalContentTypes = async ({ actions, helpers, options }) => {
27
+ const filePath = helpers.joinPathFromRoot(".slicemachine", "prismicio.d.ts");
28
+ const [customTypeModelDescriptors, sharedSliceModelDescriptors] = await Promise.all([
29
+ actions.readAllCustomTypeModels(),
30
+ actions.readAllSliceModels()
31
+ ]);
32
+ const customTypeModels = customTypeModelDescriptors.map((customTypeModelDescriptors2) => {
33
+ return customTypeModelDescriptors2.model;
34
+ });
35
+ const sharedSliceModels = sharedSliceModelDescriptors.map((sharedSliceModelDescriptors2) => {
36
+ return sharedSliceModelDescriptors2.model;
37
+ });
38
+ let contents = prismicTsCodegen.generateTypes({
39
+ customTypeModels,
40
+ sharedSliceModels,
41
+ clientIntegration: {
42
+ includeCreateClientInterface: true,
43
+ includeContentNamespace: true
44
+ }
45
+ });
46
+ if (options.format) {
47
+ contents = await helpers.format(contents, filePath);
48
+ }
49
+ await fs__namespace.mkdir(path__namespace.dirname(filePath), { recursive: true });
50
+ await fs__namespace.writeFile(filePath, contents);
51
+ };
52
+ exports.upsertGlobalContentTypes = upsertGlobalContentTypes;
53
+ //# sourceMappingURL=upsertGlobalContentTypes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsertGlobalContentTypes.cjs","sources":["../../src/lib/upsertGlobalContentTypes.ts"],"sourcesContent":["import type { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { generateTypes } from \"prismic-ts-codegen\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\ntype UpsertGlobalTypesArgs = Pick<\n\tSliceMachineContext<PluginOptions>,\n\t\"actions\" | \"helpers\" | \"options\"\n>;\n\n/**\n * Creates a globally accessible TypeScript file containing types representing\n * the Prismic repository's content.\n */\nexport const upsertGlobalContentTypes = async ({\n\tactions,\n\thelpers,\n\toptions,\n}: UpsertGlobalTypesArgs): Promise<void> => {\n\tconst filePath = helpers.joinPathFromRoot(\".slicemachine\", \"prismicio.d.ts\");\n\n\tconst [customTypeModelDescriptors, sharedSliceModelDescriptors] =\n\t\tawait Promise.all([\n\t\t\tactions.readAllCustomTypeModels(),\n\t\t\tactions.readAllSliceModels(),\n\t\t]);\n\n\tconst customTypeModels = customTypeModelDescriptors.map(\n\t\t(customTypeModelDescriptors) => {\n\t\t\treturn customTypeModelDescriptors.model;\n\t\t},\n\t);\n\tconst sharedSliceModels = sharedSliceModelDescriptors.map(\n\t\t(sharedSliceModelDescriptors) => {\n\t\t\treturn sharedSliceModelDescriptors.model;\n\t\t},\n\t);\n\n\tlet contents = generateTypes({\n\t\tcustomTypeModels,\n\t\tsharedSliceModels,\n\t\tclientIntegration: {\n\t\t\tincludeCreateClientInterface: true,\n\t\t\tincludeContentNamespace: true,\n\t\t},\n\t});\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":["customTypeModelDescriptors","sharedSliceModelDescriptors","generateTypes","fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,2BAA2B,OAAO,EAC9C,SACA,SACA,cAC0C;AAC1C,QAAM,WAAW,QAAQ,iBAAiB,iBAAiB,gBAAgB;AAE3E,QAAM,CAAC,4BAA4B,2BAA2B,IAC7D,MAAM,QAAQ,IAAI;AAAA,IACjB,QAAQ,wBAAyB;AAAA,IACjC,QAAQ,mBAAoB;AAAA,EAAA,CAC5B;AAEF,QAAM,mBAAmB,2BAA2B,IACnD,CAACA,gCAA8B;AAC9B,WAAOA,4BAA2B;AAAA,EAAA,CAClC;AAEF,QAAM,oBAAoB,4BAA4B,IACrD,CAACC,iCAA+B;AAC/B,WAAOA,6BAA4B;AAAA,EAAA,CACnC;AAGF,MAAI,WAAWC,iBAAAA,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,MAClB,8BAA8B;AAAA,MAC9B,yBAAyB;AAAA,IACzB;AAAA,EAAA,CACD;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AACpD,QAAAD,cAAG,UAAU,UAAU,QAAQ;AACtC;;"}
@@ -0,0 +1,12 @@
1
+ import type { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ /**
4
+ * Arguments for `upsertGlobalContentTypes()`.
5
+ */
6
+ declare type UpsertGlobalTypesArgs = Pick<SliceMachineContext<PluginOptions>, "actions" | "helpers" | "options">;
7
+ /**
8
+ * Creates a globally accessible TypeScript file containing types representing
9
+ * the Prismic repository's content.
10
+ */
11
+ export declare const upsertGlobalContentTypes: ({ actions, helpers, options, }: UpsertGlobalTypesArgs) => Promise<void>;
12
+ export {};
@@ -0,0 +1,33 @@
1
+ import { generateTypes } from "prismic-ts-codegen";
2
+ import * as fs from "node:fs/promises";
3
+ import * as path from "node:path";
4
+ const upsertGlobalContentTypes = async ({ actions, helpers, options }) => {
5
+ const filePath = helpers.joinPathFromRoot(".slicemachine", "prismicio.d.ts");
6
+ const [customTypeModelDescriptors, sharedSliceModelDescriptors] = await Promise.all([
7
+ actions.readAllCustomTypeModels(),
8
+ actions.readAllSliceModels()
9
+ ]);
10
+ const customTypeModels = customTypeModelDescriptors.map((customTypeModelDescriptors2) => {
11
+ return customTypeModelDescriptors2.model;
12
+ });
13
+ const sharedSliceModels = sharedSliceModelDescriptors.map((sharedSliceModelDescriptors2) => {
14
+ return sharedSliceModelDescriptors2.model;
15
+ });
16
+ let contents = generateTypes({
17
+ customTypeModels,
18
+ sharedSliceModels,
19
+ clientIntegration: {
20
+ includeCreateClientInterface: true,
21
+ includeContentNamespace: true
22
+ }
23
+ });
24
+ if (options.format) {
25
+ contents = await helpers.format(contents, filePath);
26
+ }
27
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
28
+ await fs.writeFile(filePath, contents);
29
+ };
30
+ export {
31
+ upsertGlobalContentTypes
32
+ };
33
+ //# sourceMappingURL=upsertGlobalContentTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsertGlobalContentTypes.js","sources":["../../src/lib/upsertGlobalContentTypes.ts"],"sourcesContent":["import type { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { generateTypes } from \"prismic-ts-codegen\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\ntype UpsertGlobalTypesArgs = Pick<\n\tSliceMachineContext<PluginOptions>,\n\t\"actions\" | \"helpers\" | \"options\"\n>;\n\n/**\n * Creates a globally accessible TypeScript file containing types representing\n * the Prismic repository's content.\n */\nexport const upsertGlobalContentTypes = async ({\n\tactions,\n\thelpers,\n\toptions,\n}: UpsertGlobalTypesArgs): Promise<void> => {\n\tconst filePath = helpers.joinPathFromRoot(\".slicemachine\", \"prismicio.d.ts\");\n\n\tconst [customTypeModelDescriptors, sharedSliceModelDescriptors] =\n\t\tawait Promise.all([\n\t\t\tactions.readAllCustomTypeModels(),\n\t\t\tactions.readAllSliceModels(),\n\t\t]);\n\n\tconst customTypeModels = customTypeModelDescriptors.map(\n\t\t(customTypeModelDescriptors) => {\n\t\t\treturn customTypeModelDescriptors.model;\n\t\t},\n\t);\n\tconst sharedSliceModels = sharedSliceModelDescriptors.map(\n\t\t(sharedSliceModelDescriptors) => {\n\t\t\treturn sharedSliceModelDescriptors.model;\n\t\t},\n\t);\n\n\tlet contents = generateTypes({\n\t\tcustomTypeModels,\n\t\tsharedSliceModels,\n\t\tclientIntegration: {\n\t\t\tincludeCreateClientInterface: true,\n\t\t\tincludeContentNamespace: true,\n\t\t},\n\t});\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":["customTypeModelDescriptors","sharedSliceModelDescriptors"],"mappings":";;;AAmBO,MAAM,2BAA2B,OAAO,EAC9C,SACA,SACA,cAC0C;AAC1C,QAAM,WAAW,QAAQ,iBAAiB,iBAAiB,gBAAgB;AAE3E,QAAM,CAAC,4BAA4B,2BAA2B,IAC7D,MAAM,QAAQ,IAAI;AAAA,IACjB,QAAQ,wBAAyB;AAAA,IACjC,QAAQ,mBAAoB;AAAA,EAAA,CAC5B;AAEF,QAAM,mBAAmB,2BAA2B,IACnD,CAACA,gCAA8B;AAC9B,WAAOA,4BAA2B;AAAA,EAAA,CAClC;AAEF,QAAM,oBAAoB,4BAA4B,IACrD,CAACC,iCAA+B;AAC/B,WAAOA,6BAA4B;AAAA,EAAA,CACnC;AAGF,MAAI,WAAW,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,MAClB,8BAA8B;AAAA,MAC9B,yBAAyB;AAAA,IACzB;AAAA,EAAA,CACD;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AACpD,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const name = "@slicemachine/adapter-next";
4
+ exports.name = name;
5
+ //# sourceMappingURL=package.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,5 @@
1
+ const name = "@slicemachine/adapter-next";
2
+ export {
3
+ name
4
+ };
5
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const pluginKit = require("@slicemachine/plugin-kit");
4
+ const _package = require("./package.cjs");
5
+ const customTypeAssetDelete = require("./hooks/customType-asset-delete.cjs");
6
+ const customTypeAssetRead = require("./hooks/customType-asset-read.cjs");
7
+ const customTypeAssetUpdate = require("./hooks/customType-asset-update.cjs");
8
+ const customTypeCreate = require("./hooks/customType-create.cjs");
9
+ const customTypeDelete = require("./hooks/customType-delete.cjs");
10
+ const customTypeLibraryRead = require("./hooks/customTypeLibrary-read.cjs");
11
+ const customTypeRead = require("./hooks/customType-read.cjs");
12
+ const customTypeUpdate = require("./hooks/customType-update.cjs");
13
+ const sliceAssetDelete = require("./hooks/slice-asset-delete.cjs");
14
+ const sliceAssetRead = require("./hooks/slice-asset-read.cjs");
15
+ const sliceAssetUpdate = require("./hooks/slice-asset-update.cjs");
16
+ const sliceCreate = require("./hooks/slice-create.cjs");
17
+ const sliceDelete = require("./hooks/slice-delete.cjs");
18
+ const sliceLibraryRead = require("./hooks/sliceLibrary-read.cjs");
19
+ const sliceRead = require("./hooks/slice-read.cjs");
20
+ const sliceSimulatorSetupRead = require("./hooks/sliceSimulator-setup-read.cjs");
21
+ const sliceUpdate = require("./hooks/slice-update.cjs");
22
+ const snippetRead = require("./hooks/snippet-read.cjs");
23
+ const plugin = pluginKit.defineSliceMachinePlugin({
24
+ meta: {
25
+ name: _package.name
26
+ },
27
+ defaultOptions: {
28
+ format: true
29
+ },
30
+ setup({ hook }) {
31
+ hook("slice:create", sliceCreate.sliceCreate);
32
+ hook("slice:update", sliceUpdate.sliceUpdate);
33
+ hook("slice:delete", sliceDelete.sliceDelete);
34
+ hook("slice:read", sliceRead.sliceRead);
35
+ hook("slice:asset:update", sliceAssetUpdate.sliceAssetUpdate);
36
+ hook("slice:asset:delete", sliceAssetDelete.sliceAssetDelete);
37
+ hook("slice:asset:read", sliceAssetRead.sliceAssetRead);
38
+ hook("slice-library:read", sliceLibraryRead.sliceLibraryRead);
39
+ hook("custom-type:create", customTypeCreate.customTypeCreate);
40
+ hook("custom-type:update", customTypeUpdate.customTypeUpdate);
41
+ hook("custom-type:delete", customTypeDelete.customTypeDelete);
42
+ hook("custom-type:read", customTypeRead.customTypeRead);
43
+ hook("custom-type:asset:update", customTypeAssetUpdate.customTypeAssetUpdate);
44
+ hook("custom-type:asset:delete", customTypeAssetDelete.customTypeAssetDelete);
45
+ hook("custom-type:asset:read", customTypeAssetRead.customTypeAssetRead);
46
+ hook("custom-type-library:read", customTypeLibraryRead.customTypeLibraryRead);
47
+ hook("snippet:read", snippetRead.snippetRead);
48
+ hook("slice-simulator:setup:read", sliceSimulatorSetupRead.sliceSimulatorSetupRead);
49
+ }
50
+ });
51
+ exports.plugin = plugin;
52
+ //# sourceMappingURL=plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs","sources":["../src/plugin.ts"],"sourcesContent":["import { defineSliceMachinePlugin } from \"@slicemachine/plugin-kit\";\n\nimport { name as pkgName } from \"../package.json\";\nimport { PluginOptions } from \"./types\";\n\nimport { customTypeAssetDelete } from \"./hooks/customType-asset-delete\";\nimport { customTypeAssetRead } from \"./hooks/customType-asset-read\";\nimport { customTypeAssetUpdate } from \"./hooks/customType-asset-update\";\nimport { customTypeCreate } from \"./hooks/customType-create\";\nimport { customTypeDelete } from \"./hooks/customType-delete\";\nimport { customTypeLibraryRead } from \"./hooks/customTypeLibrary-read\";\nimport { customTypeRead } from \"./hooks/customType-read\";\nimport { customTypeUpdate } from \"./hooks/customType-update\";\nimport { sliceAssetDelete } from \"./hooks/slice-asset-delete\";\nimport { sliceAssetRead } from \"./hooks/slice-asset-read\";\nimport { sliceAssetUpdate } from \"./hooks/slice-asset-update\";\nimport { sliceCreate } from \"./hooks/slice-create\";\nimport { sliceDelete } from \"./hooks/slice-delete\";\nimport { sliceLibraryRead } from \"./hooks/sliceLibrary-read\";\nimport { sliceRead } from \"./hooks/slice-read\";\nimport { sliceSimulatorSetupRead } from \"./hooks/sliceSimulator-setup-read\";\nimport { sliceUpdate } from \"./hooks/slice-update\";\nimport { snippetRead } from \"./hooks/snippet-read\";\n\nexport const plugin = defineSliceMachinePlugin<PluginOptions>({\n\tmeta: {\n\t\tname: pkgName,\n\t},\n\tdefaultOptions: {\n\t\tformat: true,\n\t},\n\tsetup({ hook }) {\n\t\thook(\"slice:create\", sliceCreate);\n\t\thook(\"slice:update\", sliceUpdate);\n\t\thook(\"slice:delete\", sliceDelete);\n\t\thook(\"slice:read\", sliceRead);\n\t\thook(\"slice:asset:update\", sliceAssetUpdate);\n\t\thook(\"slice:asset:delete\", sliceAssetDelete);\n\t\thook(\"slice:asset:read\", sliceAssetRead);\n\t\thook(\"slice-library:read\", sliceLibraryRead);\n\n\t\thook(\"custom-type:create\", customTypeCreate);\n\t\thook(\"custom-type:update\", customTypeUpdate);\n\t\thook(\"custom-type:delete\", customTypeDelete);\n\t\thook(\"custom-type:read\", customTypeRead);\n\t\thook(\"custom-type:asset:update\", customTypeAssetUpdate);\n\t\thook(\"custom-type:asset:delete\", customTypeAssetDelete);\n\t\thook(\"custom-type:asset:read\", customTypeAssetRead);\n\t\thook(\"custom-type-library:read\", customTypeLibraryRead);\n\n\t\thook(\"snippet:read\", snippetRead);\n\n\t\thook(\"slice-simulator:setup:read\", sliceSimulatorSetupRead);\n\t},\n});\n"],"names":["defineSliceMachinePlugin","pkgName","sliceCreate","sliceUpdate","sliceDelete","sliceRead","sliceAssetUpdate","sliceAssetDelete","sliceAssetRead","sliceLibraryRead","customTypeCreate","customTypeUpdate","customTypeDelete","customTypeRead","customTypeAssetUpdate","customTypeAssetDelete","customTypeAssetRead","customTypeLibraryRead","snippetRead","sliceSimulatorSetupRead"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,SAASA,UAAAA,yBAAwC;AAAA,EAC7D,MAAM;AAAA,IACL,MAAMC,SAAA;AAAA,EACN;AAAA,EACD,gBAAgB;AAAA,IACf,QAAQ;AAAA,EACR;AAAA,EACD,MAAM,EAAE,QAAM;AACb,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,cAAcC,UAAAA,SAAS;AAC5B,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,oBAAoBC,eAAAA,cAAc;AACvC,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAE3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,oBAAoBC,eAAAA,cAAc;AACvC,SAAK,4BAA4BC,sBAAAA,qBAAqB;AACtD,SAAK,4BAA4BC,sBAAAA,qBAAqB;AACtD,SAAK,0BAA0BC,oBAAAA,mBAAmB;AAClD,SAAK,4BAA4BC,sBAAAA,qBAAqB;AAEtD,SAAK,gBAAgBC,YAAAA,WAAW;AAEhC,SAAK,8BAA8BC,wBAAAA,uBAAuB;AAAA,EAC3D;AACA,CAAA;;"}
@@ -0,0 +1,2 @@
1
+ import { PluginOptions } from "./types";
2
+ export declare const plugin: import("@slicemachine/plugin-kit").SliceMachinePlugin<PluginOptions>;