@slicemachine/adapter-nuxt 0.3.62-beta.2 → 0.3.62-beta.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.
@@ -20,9 +20,9 @@ const documentationRead = async (data, { options, helpers }) => {
20
20
  }
21
21
  let fileContent;
22
22
  if (model.repeatable) {
23
- fileContent = commonTags.stripIndent(_a || (_a = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(`[', '-uid-${route.params.uid}]`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useHead({\n title: page.value?.data.meta_title,\n meta: [{\n name: "description",\n content: page.value?.data.meta_description,\n }],\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '], ["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(\\`[', '-uid-\\${route.params.uid}]\\`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useHead({\n title: page.value?.data.meta_title,\n meta: [{\n name: "description",\n content: page.value?.data.meta_description,\n }],\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id, isTypeScriptProject ? " as string" : "");
23
+ fileContent = commonTags.stripIndent(_a || (_a = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(`[', '-uid-${route.params.uid}]`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useSeoMeta({\n title: page.value?.data.meta_title,\n ogTitle: page.value?.data.meta_title,\n description: page.value?.data.meta_description,\n ogDescription: page.value?.data.meta_description,\n ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '], ["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(\\`[', '-uid-\\${route.params.uid}]\\`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useSeoMeta({\n title: page.value?.data.meta_title,\n ogTitle: page.value?.data.meta_title,\n description: page.value?.data.meta_description,\n ogDescription: page.value?.data.meta_description,\n ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id, isTypeScriptProject ? " as string" : "");
24
24
  } else {
25
- fileContent = commonTags.stripIndent(_b || (_b = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const { data: page } = useAsyncData("[', ']", () =>\n prismic.client.getSingle("', '")\n );\n\n useHead({\n title: page.value?.data.meta_title,\n meta: [{\n name: "description",\n content: page.value?.data.meta_description,\n }],\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id);
25
+ fileContent = commonTags.stripIndent(_b || (_b = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const { data: page } = useAsyncData("[', ']", () =>\n prismic.client.getSingle("', '")\n );\n\n useSeoMeta({\n title: page.value?.data.meta_title,\n ogTitle: page.value?.data.meta_title,\n description: page.value?.data.meta_description,\n ogDescription: page.value?.data.meta_description,\n ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id);
26
26
  }
27
27
  if (options.format) {
28
28
  fileContent = await helpers.format(fileContent, helpers.joinPathFromRoot("index.vue"), {
@@ -1 +1 @@
1
- {"version":3,"file":"documentation-read.cjs","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"[uid]\" : model.id}.vue`;\n\t\tconst scriptAttributes = [\"setup\"];\n\t\tif (isTypeScriptProject) {\n\t\t\tscriptAttributes.push('lang=\"ts\"');\n\t\t}\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\tconst prismic = usePrismic();\n\t\t\t\tconst route = useRoute();\n\t\t\t\tconst { data: page } = useAsyncData(\\`[${\n\t\t\t\t\tmodel.id\n\t\t\t\t}-uid-\\${route.params.uid}]\\`, () =>\n\t\t\t\t\tprismic.client.getByUID(\"${model.id}\", route.params.uid${\n\t\t\t\t\t\tisTypeScriptProject ? \" as string\" : \"\"\n\t\t\t\t\t})\n\t\t\t\t);\n\n\t\t\t\tuseHead({\n\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\tmeta: [{\n\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\tcontent: page.value?.data.meta_description,\n\t\t\t\t\t}],\n\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\t\tconst prismic = usePrismic();\n\t\t\t\t\tconst { data: page } = useAsyncData(\"[${model.id}]\", () =>\n\t\t\t\t\t\tprismic.client.getSingle(\"${model.id}\")\n\t\t\t\t\t);\n\n\t\t\t\t\tuseHead({\n\t\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\tcontent: page.value?.data.meta_description,\n\t\t\t\t\t\t}],\n\t\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Composition API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-3-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":["checkIsTypeScriptProject","stripIndent","source"],"mappings":";;;;;;;AAAA,IAAA,IAAA;AAOO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACG,QAAA,sBAAsB,MAAMA,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAEG,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,UAAU,MAAM;AACjD,UAAA,mBAAmB,CAAC,OAAO;AACjC,QAAI,qBAAqB;AACxB,uBAAiB,KAAK,WAAW;AAAA,IAClC;AAEI,QAAA;AAEJ,QAAI,MAAM,YAAY;AACP,oBAAAC,WAAAA,YAAA,OAAA,KAAW,8BACY,iKAOpC,qEACoC,uBAEnC,wWAXuB,GAAA,CAAA,kBACY,mKAOpC,yEACoC,uBAEnC,6WAVS,iBAAiB,KAAK,GAAG,GAMlC,MAAM,IAEqB,MAAM,IAChC,sBAAsB,eAAe,EAAA;AAAA,IAAA,OAqBlC;AACQ,oBAAAA,WAAAA,YAAA,OAAA,KAAW,WACY,CAAA,kBAAA,qIAIa,+CACX,iXAAA,CAAA,IAL5B,iBAAiB,KAAK,GAAG,GAIM,MAAM,IACjB,MAAM,EAAA;AAAA,IAoBtC;AAEA,QAAI,QAAQ,QAAQ;AACnB,oBAAc,MAAM,QAAQ,OAC3B,aACA,QAAQ,iBAAiB,WAAW,GACpC;AAAA,QACC,UAAU,EAAE,QAAQ,MAAO;AAAA,QAC3B,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEO,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAASC,WAAAA;AAAAA,sBACS,MAAM;AAAA;AAAA,gDAEoB,0IAA0I;AAAA;AAAA;AAAA;AAAA,OAInL,mBAAmB;AAAA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA,MAIpC;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;;"}
1
+ {"version":3,"file":"documentation-read.cjs","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"[uid]\" : model.id}.vue`;\n\t\tconst scriptAttributes = [\"setup\"];\n\t\tif (isTypeScriptProject) {\n\t\t\tscriptAttributes.push('lang=\"ts\"');\n\t\t}\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\tconst prismic = usePrismic();\n\t\t\t\tconst route = useRoute();\n\t\t\t\tconst { data: page } = useAsyncData(\\`[${\n\t\t\t\t\tmodel.id\n\t\t\t\t}-uid-\\${route.params.uid}]\\`, () =>\n\t\t\t\t\tprismic.client.getByUID(\"${model.id}\", route.params.uid${\n\t\t\t\t\t\tisTypeScriptProject ? \" as string\" : \"\"\n\t\t\t\t\t})\n\t\t\t\t);\n\n\t\t\t\tuseSeoMeta({\n\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\togTitle: page.value?.data.meta_title,\n\t\t\t\t\tdescription: page.value?.data.meta_description,\n\t\t\t\t\togDescription: page.value?.data.meta_description,\n\t\t\t\t\togImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\tconst prismic = usePrismic();\n\t\t\t\tconst { data: page } = useAsyncData(\"[${model.id}]\", () =>\n\t\t\t\t\tprismic.client.getSingle(\"${model.id}\")\n\t\t\t\t);\n\n\t\t\t\tuseSeoMeta({\n\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\togTitle: page.value?.data.meta_title,\n\t\t\t\t\tdescription: page.value?.data.meta_description,\n\t\t\t\t\togDescription: page.value?.data.meta_description,\n\t\t\t\t\togImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Composition API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-3-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":["checkIsTypeScriptProject","stripIndent","source"],"mappings":";;;;;;;AAAA,IAAA,IAAA;AAOO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACG,QAAA,sBAAsB,MAAMA,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAEG,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,UAAU,MAAM;AACjD,UAAA,mBAAmB,CAAC,OAAO;AACjC,QAAI,qBAAqB;AACxB,uBAAiB,KAAK,WAAW;AAAA,IAClC;AAEI,QAAA;AAEJ,QAAI,MAAM,YAAY;AACP,oBAAAC,WAAAA,YAAA,OAAA,KAAW,8BACY,iKAOpC,qEACoC,uBAEnC,6eAXuB,GAAA,CAAA,kBACY,mKAOpC,yEACoC,uBAEnC,kfAVS,iBAAiB,KAAK,GAAG,GAMlC,MAAM,IAEqB,MAAM,IAChC,sBAAsB,eAAe,EAAA;AAAA,IAAA,OAqBlC;AACQ,oBAAAA,WAAAA,YAAA,OAAA,KAAW,WACY,CAAA,kBAAA,kIAIY,8CACX,8eAAA,CAAA,IAL3B,iBAAiB,KAAK,GAAG,GAIK,MAAM,IACjB,MAAM,EAAA;AAAA,IAoBrC;AAEA,QAAI,QAAQ,QAAQ;AACnB,oBAAc,MAAM,QAAQ,OAC3B,aACA,QAAQ,iBAAiB,WAAW,GACpC;AAAA,QACC,UAAU,EAAE,QAAQ,MAAO;AAAA,QAC3B,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEO,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAASC,WAAAA;AAAAA,sBACS,MAAM;AAAA;AAAA,gDAEoB,0IAA0I;AAAA;AAAA;AAAA;AAAA,OAInL,mBAAmB;AAAA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA,MAIpC;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;;"}
@@ -18,9 +18,9 @@ const documentationRead = async (data, { options, helpers }) => {
18
18
  }
19
19
  let fileContent;
20
20
  if (model.repeatable) {
21
- fileContent = stripIndent(_a || (_a = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(`[', '-uid-${route.params.uid}]`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useHead({\n title: page.value?.data.meta_title,\n meta: [{\n name: "description",\n content: page.value?.data.meta_description,\n }],\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '], ["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(\\`[', '-uid-\\${route.params.uid}]\\`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useHead({\n title: page.value?.data.meta_title,\n meta: [{\n name: "description",\n content: page.value?.data.meta_description,\n }],\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id, isTypeScriptProject ? " as string" : "");
21
+ fileContent = stripIndent(_a || (_a = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(`[', '-uid-${route.params.uid}]`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useSeoMeta({\n title: page.value?.data.meta_title,\n ogTitle: page.value?.data.meta_title,\n description: page.value?.data.meta_description,\n ogDescription: page.value?.data.meta_description,\n ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '], ["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const route = useRoute();\n const { data: page } = useAsyncData(\\`[', '-uid-\\${route.params.uid}]\\`, () =>\n prismic.client.getByUID("', '", route.params.uid', ')\n );\n\n useSeoMeta({\n title: page.value?.data.meta_title,\n ogTitle: page.value?.data.meta_title,\n description: page.value?.data.meta_description,\n ogDescription: page.value?.data.meta_description,\n ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id, isTypeScriptProject ? " as string" : "");
22
22
  } else {
23
- fileContent = stripIndent(_b || (_b = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const { data: page } = useAsyncData("[', ']", () =>\n prismic.client.getSingle("', '")\n );\n\n useHead({\n title: page.value?.data.meta_title,\n meta: [{\n name: "description",\n content: page.value?.data.meta_description,\n }],\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id);
23
+ fileContent = stripIndent(_b || (_b = __template(["\n <script ", '>\n import { components } from "~/slices";\n\n const prismic = usePrismic();\n const { data: page } = useAsyncData("[', ']", () =>\n prismic.client.getSingle("', '")\n );\n\n useSeoMeta({\n title: page.value?.data.meta_title,\n ogTitle: page.value?.data.meta_title,\n description: page.value?.data.meta_description,\n ogDescription: page.value?.data.meta_description,\n ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n });\n <\/script>\n\n <template>\n <SliceZone\n wrapper="main"\n :slices="page?.data.slices ?? []"\n :components="components"\n />\n </template>\n '])), scriptAttributes.join(" "), model.id, model.id);
24
24
  }
25
25
  if (options.format) {
26
26
  fileContent = await helpers.format(fileContent, helpers.joinPathFromRoot("index.vue"), {
@@ -1 +1 @@
1
- {"version":3,"file":"documentation-read.js","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"[uid]\" : model.id}.vue`;\n\t\tconst scriptAttributes = [\"setup\"];\n\t\tif (isTypeScriptProject) {\n\t\t\tscriptAttributes.push('lang=\"ts\"');\n\t\t}\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\tconst prismic = usePrismic();\n\t\t\t\tconst route = useRoute();\n\t\t\t\tconst { data: page } = useAsyncData(\\`[${\n\t\t\t\t\tmodel.id\n\t\t\t\t}-uid-\\${route.params.uid}]\\`, () =>\n\t\t\t\t\tprismic.client.getByUID(\"${model.id}\", route.params.uid${\n\t\t\t\t\t\tisTypeScriptProject ? \" as string\" : \"\"\n\t\t\t\t\t})\n\t\t\t\t);\n\n\t\t\t\tuseHead({\n\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\tmeta: [{\n\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\tcontent: page.value?.data.meta_description,\n\t\t\t\t\t}],\n\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\t\tconst prismic = usePrismic();\n\t\t\t\t\tconst { data: page } = useAsyncData(\"[${model.id}]\", () =>\n\t\t\t\t\t\tprismic.client.getSingle(\"${model.id}\")\n\t\t\t\t\t);\n\n\t\t\t\t\tuseHead({\n\t\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\t\tmeta: [{\n\t\t\t\t\t\t\tname: \"description\",\n\t\t\t\t\t\t\tcontent: page.value?.data.meta_description,\n\t\t\t\t\t\t}],\n\t\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Composition API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-3-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":[],"mappings":";;;;;AAAA,IAAA,IAAA;AAOO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACG,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAEG,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,UAAU,MAAM;AACjD,UAAA,mBAAmB,CAAC,OAAO;AACjC,QAAI,qBAAqB;AACxB,uBAAiB,KAAK,WAAW;AAAA,IAClC;AAEI,QAAA;AAEJ,QAAI,MAAM,YAAY;AACP,oBAAA,YAAA,OAAA,KAAW,8BACY,iKAOpC,qEACoC,uBAEnC,wWAXuB,GAAA,CAAA,kBACY,mKAOpC,yEACoC,uBAEnC,6WAVS,iBAAiB,KAAK,GAAG,GAMlC,MAAM,IAEqB,MAAM,IAChC,sBAAsB,eAAe,EAAA;AAAA,IAAA,OAqBlC;AACQ,oBAAA,YAAA,OAAA,KAAW,WACY,CAAA,kBAAA,qIAIa,+CACX,iXAAA,CAAA,IAL5B,iBAAiB,KAAK,GAAG,GAIM,MAAM,IACjB,MAAM,EAAA;AAAA,IAoBtC;AAEA,QAAI,QAAQ,QAAQ;AACnB,oBAAc,MAAM,QAAQ,OAC3B,aACA,QAAQ,iBAAiB,WAAW,GACpC;AAAA,QACC,UAAU,EAAE,QAAQ,MAAO;AAAA,QAC3B,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEO,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAAS;AAAA,sBACS,MAAM;AAAA;AAAA,gDAEoB,0IAA0I;AAAA;AAAA;AAAA;AAAA,OAInL,mBAAmB;AAAA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA,MAIpC;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;"}
1
+ {"version":3,"file":"documentation-read.js","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source, stripIndent } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\t\tconst filePath = `${model.repeatable ? \"[uid]\" : model.id}.vue`;\n\t\tconst scriptAttributes = [\"setup\"];\n\t\tif (isTypeScriptProject) {\n\t\t\tscriptAttributes.push('lang=\"ts\"');\n\t\t}\n\n\t\tlet fileContent: string;\n\n\t\tif (model.repeatable) {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\tconst prismic = usePrismic();\n\t\t\t\tconst route = useRoute();\n\t\t\t\tconst { data: page } = useAsyncData(\\`[${\n\t\t\t\t\tmodel.id\n\t\t\t\t}-uid-\\${route.params.uid}]\\`, () =>\n\t\t\t\t\tprismic.client.getByUID(\"${model.id}\", route.params.uid${\n\t\t\t\t\t\tisTypeScriptProject ? \" as string\" : \"\"\n\t\t\t\t\t})\n\t\t\t\t);\n\n\t\t\t\tuseSeoMeta({\n\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\togTitle: page.value?.data.meta_title,\n\t\t\t\t\tdescription: page.value?.data.meta_description,\n\t\t\t\t\togDescription: page.value?.data.meta_description,\n\t\t\t\t\togImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t} else {\n\t\t\tfileContent = stripIndent`\n\t\t\t\t<script ${scriptAttributes.join(\" \")}>\n\t\t\t\timport { components } from \"~/slices\";\n\n\t\t\t\tconst prismic = usePrismic();\n\t\t\t\tconst { data: page } = useAsyncData(\"[${model.id}]\", () =>\n\t\t\t\t\tprismic.client.getSingle(\"${model.id}\")\n\t\t\t\t);\n\n\t\t\t\tuseSeoMeta({\n\t\t\t\t\ttitle: page.value?.data.meta_title,\n\t\t\t\t\togTitle: page.value?.data.meta_title,\n\t\t\t\t\tdescription: page.value?.data.meta_description,\n\t\t\t\t\togDescription: page.value?.data.meta_description,\n\t\t\t\t\togImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),\n\t\t\t\t});\n\t\t\t\t</script>\n\n\t\t\t\t<template>\n\t\t\t\t\t<SliceZone\n\t\t\t\t\t\twrapper=\"main\"\n\t\t\t\t\t\t:slices=\"page?.data.slices ?? []\"\n\t\t\t\t\t\t:components=\"components\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tfileContent = await helpers.format(\n\t\t\t\tfileContent,\n\t\t\t\thelpers.joinPathFromRoot(\"index.vue\"),\n\t\t\t\t{\n\t\t\t\t\tprettier: { parser: \"vue\" },\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Composition API\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tAdd a new route by creating an \\`~/pages/${filePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`~/pages/marketing/${filePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~vue [~/pages/${filePath}]\\n${fileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/nuxt-3-setup) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":[],"mappings":";;;;;AAAA,IAAA,IAAA;AAOO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACG,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAEG,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AACvB,UAAM,WAAW,GAAG,MAAM,aAAa,UAAU,MAAM;AACjD,UAAA,mBAAmB,CAAC,OAAO;AACjC,QAAI,qBAAqB;AACxB,uBAAiB,KAAK,WAAW;AAAA,IAClC;AAEI,QAAA;AAEJ,QAAI,MAAM,YAAY;AACP,oBAAA,YAAA,OAAA,KAAW,8BACY,iKAOpC,qEACoC,uBAEnC,6eAXuB,GAAA,CAAA,kBACY,mKAOpC,yEACoC,uBAEnC,kfAVS,iBAAiB,KAAK,GAAG,GAMlC,MAAM,IAEqB,MAAM,IAChC,sBAAsB,eAAe,EAAA;AAAA,IAAA,OAqBlC;AACQ,oBAAA,YAAA,OAAA,KAAW,WACY,CAAA,kBAAA,kIAIY,8CACX,8eAAA,CAAA,IAL3B,iBAAiB,KAAK,GAAG,GAIK,MAAM,IACjB,MAAM,EAAA;AAAA,IAoBrC;AAEA,QAAI,QAAQ,QAAQ;AACnB,oBAAc,MAAM,QAAQ,OAC3B,aACA,QAAQ,iBAAiB,WAAW,GACpC;AAAA,QACC,UAAU,EAAE,QAAQ,MAAO;AAAA,QAC3B,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEO,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAAS;AAAA,sBACS,MAAM;AAAA;AAAA,gDAEoB,0IAA0I;AAAA;AAAA;AAAA;AAAA,OAInL,mBAAmB;AAAA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA,MAIpC;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;"}
@@ -20,7 +20,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
20
20
  if (data.componentContents) {
21
21
  contents = data.componentContents;
22
22
  } else if (isTypeScriptProject) {
23
- contents = commonTags.stripIndent(_a || (_a = __template(['\n <script setup lang="ts">\n import { type Content } from "@prismicio/client";\n\n // The array passed to `getSliceComponentProps` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "], ['\n <script setup lang="ts">\n import { type Content } from "@prismicio/client";\n\n // The array passed to \\`getSliceComponentProps\\` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "])), pascalName, data.model.id);
23
+ contents = commonTags.stripIndent(_a || (_a = __template(['\n <script setup lang="ts">\n import type { Content } from "@prismicio/client";\n\n // The array passed to `getSliceComponentProps` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "], ['\n <script setup lang="ts">\n import type { Content } from "@prismicio/client";\n\n // The array passed to \\`getSliceComponentProps\\` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "])), pascalName, data.model.id);
24
24
  } else {
25
25
  contents = commonTags.stripIndent(_b || (_b = __template(['\n <script setup>\n // The array passed to `getSliceComponentProps` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps(["slice", "index", "slices", "context"]));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n '], ['\n <script setup>\n // The array passed to \\`getSliceComponentProps\\` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps(["slice", "index", "slices", "context"]));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n '])));
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"slice-create.cjs","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype CreateComponentFileArgs = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: CreateComponentFileArgs) => {\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\t<script setup lang=\"ts\">\n\t\t\timport { type Content } from \"@prismicio/client\";\n\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps<Content.${pascalName}Slice>(\n\t\t\t\t[\"slice\", \"index\", \"slices\", \"context\"]\n\t\t\t));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t<script setup>\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t}\n\n\tawait writeSliceFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\tfilename: \"index.vue\",\n\t\tcontents,\n\t\tformat: options.format,\n\t\tactions,\n\t\thelpers,\n\t});\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\twriteSliceModel({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\tmodel: data.model,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t}),\n\t\t\tcreateComponentFile({ data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertSliceLibraryIndexFile({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\t...context,\n\t\t\t}),\n\t\t\tupsertGlobalTypeScriptTypes({\n\t\t\t\tfilename: context.options.generatedTypesFilePath,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t\tactions: context.actions,\n\t\t\t}),\n\t\t]),\n\t);\n};\n"],"names":["pascalCase","checkIsTypeScriptProject","stripIndent","writeSliceFile","rejectIfNecessary","writeSliceModel","upsertSliceLibraryIndexFile","upsertGlobalTypeScriptTypes"],"mappings":";;;;;;;;;;;AAKA,IAAA,IAAA;AAkBA,MAAM,sBAAsB,OAAO,EAClC,MACA,SACA,SACA,cAC6B;AAC7B,QAAM,aAAaA,WAAA,WAAW,KAAK,MAAM,IAAI;AAEzC,MAAA;AAEE,QAAA,sBAAsB,MAAMC,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,MAAI,KAAK,mBAAmB;AAC3B,eAAW,KAAK;AAAA,aACN,qBAAqB;AACpB,eAAAC,WAAAA,YAAA,OAAA,KAAW,qSAMkC,8OAUZ,gFAAA,GAhBtB,8RAMkC,8OAUZ,gFAAA,CAAA,IAVE,YAUf,KAAK,MAAM,EAAA;AAAA,EAAA,OAIpC;AACN,eAAWA,WAAW,YAAA,OAAA,KAAA,WAAA,CAAA,igBAAA,GAAA,CAAA,qgBAAA,CAAA,EAAA;AAAA,EAgBvB;AAEA,QAAMC,kBAAe;AAAA,IACpB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA,QAAQ,QAAQ;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AACF;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AAEFC,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,mBAAgB;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,OAAO,KAAK;AAAA,MACZ,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,IACD,oBAAoB,EAAE,MAAM,GAAG,SAAS;AAAA,EACxC,CAAA,CAAC;AAIFD,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBE,wDAA4B;AAAA,MAC3B,WAAW,KAAK;AAAA,MAChB,GAAG;AAAA,IAAA,CACH;AAAA,IACDC,+BAA4B;AAAA,MAC3B,UAAU,QAAQ,QAAQ;AAAA,MAC1B,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,EACD,CAAA,CAAC;AAEJ;;"}
1
+ {"version":3,"file":"slice-create.cjs","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype CreateComponentFileArgs = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: CreateComponentFileArgs) => {\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\t<script setup lang=\"ts\">\n\t\t\timport type { Content } from \"@prismicio/client\";\n\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps<Content.${pascalName}Slice>(\n\t\t\t\t[\"slice\", \"index\", \"slices\", \"context\"]\n\t\t\t));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t<script setup>\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t}\n\n\tawait writeSliceFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\tfilename: \"index.vue\",\n\t\tcontents,\n\t\tformat: options.format,\n\t\tactions,\n\t\thelpers,\n\t});\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\twriteSliceModel({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\tmodel: data.model,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t}),\n\t\t\tcreateComponentFile({ data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertSliceLibraryIndexFile({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\t...context,\n\t\t\t}),\n\t\t\tupsertGlobalTypeScriptTypes({\n\t\t\t\tfilename: context.options.generatedTypesFilePath,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t\tactions: context.actions,\n\t\t\t}),\n\t\t]),\n\t);\n};\n"],"names":["pascalCase","checkIsTypeScriptProject","stripIndent","writeSliceFile","rejectIfNecessary","writeSliceModel","upsertSliceLibraryIndexFile","upsertGlobalTypeScriptTypes"],"mappings":";;;;;;;;;;;AAKA,IAAA,IAAA;AAkBA,MAAM,sBAAsB,OAAO,EAClC,MACA,SACA,SACA,cAC6B;AAC7B,QAAM,aAAaA,WAAA,WAAW,KAAK,MAAM,IAAI;AAEzC,MAAA;AAEE,QAAA,sBAAsB,MAAMC,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,MAAI,KAAK,mBAAmB;AAC3B,eAAW,KAAK;AAAA,aACN,qBAAqB;AACpB,eAAAC,WAAAA,YAAA,OAAA,KAAW,qSAMkC,8OAUZ,gFAAA,GAhBtB,8RAMkC,8OAUZ,gFAAA,CAAA,IAVE,YAUf,KAAK,MAAM,EAAA;AAAA,EAAA,OAIpC;AACN,eAAWA,WAAW,YAAA,OAAA,KAAA,WAAA,CAAA,igBAAA,GAAA,CAAA,qgBAAA,CAAA,EAAA;AAAA,EAgBvB;AAEA,QAAMC,kBAAe;AAAA,IACpB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA,QAAQ,QAAQ;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AACF;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AAEFC,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,mBAAgB;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,OAAO,KAAK;AAAA,MACZ,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,IACD,oBAAoB,EAAE,MAAM,GAAG,SAAS;AAAA,EACxC,CAAA,CAAC;AAIFD,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBE,wDAA4B;AAAA,MAC3B,WAAW,KAAK;AAAA,MAChB,GAAG;AAAA,IAAA,CACH;AAAA,IACDC,+BAA4B;AAAA,MAC3B,UAAU,QAAQ,QAAQ;AAAA,MAC1B,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,EACD,CAAA,CAAC;AAEJ;;"}
@@ -18,7 +18,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
18
18
  if (data.componentContents) {
19
19
  contents = data.componentContents;
20
20
  } else if (isTypeScriptProject) {
21
- contents = stripIndent(_a || (_a = __template(['\n <script setup lang="ts">\n import { type Content } from "@prismicio/client";\n\n // The array passed to `getSliceComponentProps` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "], ['\n <script setup lang="ts">\n import { type Content } from "@prismicio/client";\n\n // The array passed to \\`getSliceComponentProps\\` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "])), pascalName, data.model.id);
21
+ contents = stripIndent(_a || (_a = __template(['\n <script setup lang="ts">\n import type { Content } from "@prismicio/client";\n\n // The array passed to `getSliceComponentProps` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "], ['\n <script setup lang="ts">\n import type { Content } from "@prismicio/client";\n\n // The array passed to \\`getSliceComponentProps\\` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps<Content.', 'Slice>(\n ["slice", "index", "slices", "context"]\n ));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for ', " (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n "])), pascalName, data.model.id);
22
22
  } else {
23
23
  contents = stripIndent(_b || (_b = __template(['\n <script setup>\n // The array passed to `getSliceComponentProps` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps(["slice", "index", "slices", "context"]));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n '], ['\n <script setup>\n // The array passed to \\`getSliceComponentProps\\` is purely optional.\n // Consider it as a visual hint for you when templating your slice.\n defineProps(getSliceComponentProps(["slice", "index", "slices", "context"]));\n <\/script>\n\n <template>\n <section\n :data-slice-type="slice.slice_type"\n :data-slice-variation="slice.variation"\n >\n Placeholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n </section>\n </template>\n '])));
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"slice-create.js","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype CreateComponentFileArgs = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: CreateComponentFileArgs) => {\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\t<script setup lang=\"ts\">\n\t\t\timport { type Content } from \"@prismicio/client\";\n\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps<Content.${pascalName}Slice>(\n\t\t\t\t[\"slice\", \"index\", \"slices\", \"context\"]\n\t\t\t));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t<script setup>\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t}\n\n\tawait writeSliceFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\tfilename: \"index.vue\",\n\t\tcontents,\n\t\tformat: options.format,\n\t\tactions,\n\t\thelpers,\n\t});\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\twriteSliceModel({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\tmodel: data.model,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t}),\n\t\t\tcreateComponentFile({ data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertSliceLibraryIndexFile({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\t...context,\n\t\t\t}),\n\t\t\tupsertGlobalTypeScriptTypes({\n\t\t\t\tfilename: context.options.generatedTypesFilePath,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t\tactions: context.actions,\n\t\t\t}),\n\t\t]),\n\t);\n};\n"],"names":[],"mappings":";;;;;;;;;AAKA,IAAA,IAAA;AAkBA,MAAM,sBAAsB,OAAO,EAClC,MACA,SACA,SACA,cAC6B;AAC7B,QAAM,aAAa,WAAW,KAAK,MAAM,IAAI;AAEzC,MAAA;AAEE,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,MAAI,KAAK,mBAAmB;AAC3B,eAAW,KAAK;AAAA,aACN,qBAAqB;AACpB,eAAA,YAAA,OAAA,KAAW,qSAMkC,8OAUZ,gFAAA,GAhBtB,8RAMkC,8OAUZ,gFAAA,CAAA,IAVE,YAUf,KAAK,MAAM,EAAA;AAAA,EAAA,OAIpC;AACN,eAAW,YAAW,OAAA,KAAA,WAAA,CAAA,igBAAA,GAAA,CAAA,qgBAAA,CAAA,EAAA;AAAA,EAgBvB;AAEA,QAAM,eAAe;AAAA,IACpB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA,QAAQ,QAAQ;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AACF;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AAEF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,gBAAgB;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,OAAO,KAAK;AAAA,MACZ,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,IACD,oBAAoB,EAAE,MAAM,GAAG,SAAS;AAAA,EACxC,CAAA,CAAC;AAIF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,4BAA4B;AAAA,MAC3B,WAAW,KAAK;AAAA,MAChB,GAAG;AAAA,IAAA,CACH;AAAA,IACD,4BAA4B;AAAA,MAC3B,UAAU,QAAQ,QAAQ;AAAA,MAC1B,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,EACD,CAAA,CAAC;AAEJ;"}
1
+ {"version":3,"file":"slice-create.js","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype CreateComponentFileArgs = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: CreateComponentFileArgs) => {\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\t<script setup lang=\"ts\">\n\t\t\timport type { Content } from \"@prismicio/client\";\n\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps<Content.${pascalName}Slice>(\n\t\t\t\t[\"slice\", \"index\", \"slices\", \"context\"]\n\t\t\t));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t<script setup>\n\t\t\t// The array passed to \\`getSliceComponentProps\\` is purely optional.\n\t\t\t// Consider it as a visual hint for you when templating your slice.\n\t\t\tdefineProps(getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]));\n\t\t\t</script>\n\n\t\t\t<template>\n\t\t\t\t<section\n\t\t\t\t\t:data-slice-type=\"slice.slice_type\"\n\t\t\t\t\t:data-slice-variation=\"slice.variation\"\n\t\t\t\t>\n\t\t\t\t\tPlaceholder component for {{ model.id }} (variation: {{ slice.variation }}) Slices\n\t\t\t\t</section>\n\t\t\t</template>\n\t\t`;\n\t}\n\n\tawait writeSliceFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\tfilename: \"index.vue\",\n\t\tcontents,\n\t\tformat: options.format,\n\t\tactions,\n\t\thelpers,\n\t});\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\twriteSliceModel({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\tmodel: data.model,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t}),\n\t\t\tcreateComponentFile({ data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertSliceLibraryIndexFile({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\t...context,\n\t\t\t}),\n\t\t\tupsertGlobalTypeScriptTypes({\n\t\t\t\tfilename: context.options.generatedTypesFilePath,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t\tactions: context.actions,\n\t\t\t}),\n\t\t]),\n\t);\n};\n"],"names":[],"mappings":";;;;;;;;;AAKA,IAAA,IAAA;AAkBA,MAAM,sBAAsB,OAAO,EAClC,MACA,SACA,SACA,cAC6B;AAC7B,QAAM,aAAa,WAAW,KAAK,MAAM,IAAI;AAEzC,MAAA;AAEE,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,MAAI,KAAK,mBAAmB;AAC3B,eAAW,KAAK;AAAA,aACN,qBAAqB;AACpB,eAAA,YAAA,OAAA,KAAW,qSAMkC,8OAUZ,gFAAA,GAhBtB,8RAMkC,8OAUZ,gFAAA,CAAA,IAVE,YAUf,KAAK,MAAM,EAAA;AAAA,EAAA,OAIpC;AACN,eAAW,YAAW,OAAA,KAAA,WAAA,CAAA,igBAAA,GAAA,CAAA,qgBAAA,CAAA,EAAA;AAAA,EAgBvB;AAEA,QAAM,eAAe;AAAA,IACpB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA,QAAQ,QAAQ;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AACF;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AAEF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,gBAAgB;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,OAAO,KAAK;AAAA,MACZ,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,IACD,oBAAoB,EAAE,MAAM,GAAG,SAAS;AAAA,EACxC,CAAA,CAAC;AAIF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,4BAA4B;AAAA,MAC3B,WAAW,KAAK;AAAA,MAChB,GAAG;AAAA,IAAA,CACH;AAAA,IACD,4BAA4B;AAAA,MAC3B,UAAU,QAAQ,QAAQ;AAAA,MAC1B,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,EACD,CAAA,CAAC;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slicemachine/adapter-nuxt",
3
- "version": "0.3.62-beta.2",
3
+ "version": "0.3.62-beta.3",
4
4
  "description": "Slice Machine adapter for Nuxt 3.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "@prismicio/simulator": "^0.1.4",
63
63
  "@prismicio/types-internal": "3.2.0",
64
- "@slicemachine/plugin-kit": "0.4.62-beta.2",
64
+ "@slicemachine/plugin-kit": "0.4.62-beta.3",
65
65
  "common-tags": "^1.8.2",
66
66
  "fp-ts": "^2.13.1",
67
67
  "io-ts": "^2.2.20",
@@ -39,12 +39,12 @@ export const documentationRead: DocumentationReadHook<PluginOptions> = async (
39
39
  })
40
40
  );
41
41
 
42
- useHead({
42
+ useSeoMeta({
43
43
  title: page.value?.data.meta_title,
44
- meta: [{
45
- name: "description",
46
- content: page.value?.data.meta_description,
47
- }],
44
+ ogTitle: page.value?.data.meta_title,
45
+ description: page.value?.data.meta_description,
46
+ ogDescription: page.value?.data.meta_description,
47
+ ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),
48
48
  });
49
49
  </script>
50
50
 
@@ -59,20 +59,20 @@ export const documentationRead: DocumentationReadHook<PluginOptions> = async (
59
59
  } else {
60
60
  fileContent = stripIndent`
61
61
  <script ${scriptAttributes.join(" ")}>
62
- import { components } from "~/slices";
63
-
64
- const prismic = usePrismic();
65
- const { data: page } = useAsyncData("[${model.id}]", () =>
66
- prismic.client.getSingle("${model.id}")
67
- );
68
-
69
- useHead({
70
- title: page.value?.data.meta_title,
71
- meta: [{
72
- name: "description",
73
- content: page.value?.data.meta_description,
74
- }],
75
- });
62
+ import { components } from "~/slices";
63
+
64
+ const prismic = usePrismic();
65
+ const { data: page } = useAsyncData("[${model.id}]", () =>
66
+ prismic.client.getSingle("${model.id}")
67
+ );
68
+
69
+ useSeoMeta({
70
+ title: page.value?.data.meta_title,
71
+ ogTitle: page.value?.data.meta_title,
72
+ description: page.value?.data.meta_description,
73
+ ogDescription: page.value?.data.meta_description,
74
+ ogImage: computed(() => prismic.asImageSrc(page.value?.data.meta_image)),
75
+ });
76
76
  </script>
77
77
 
78
78
  <template>
@@ -41,7 +41,7 @@ const createComponentFile = async ({
41
41
  } else if (isTypeScriptProject) {
42
42
  contents = stripIndent`
43
43
  <script setup lang="ts">
44
- import { type Content } from "@prismicio/client";
44
+ import type { Content } from "@prismicio/client";
45
45
 
46
46
  // The array passed to \`getSliceComponentProps\` is purely optional.
47
47
  // Consider it as a visual hint for you when templating your slice.