@nuxtjs/prismic 4.0.0 → 4.1.0-pr.235.94cfeb5
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.
- package/LICENSE +1 -1
- package/README.md +18 -32
- package/dist/module.d.mts +48 -75
- package/dist/module.json +3 -3
- package/dist/module.mjs +193 -242
- package/dist/runtime/PrismicPreview.d.vue.ts +3 -0
- package/dist/runtime/PrismicPreview.vue +8 -14
- package/dist/runtime/PrismicPreview.vue.d.ts +3 -0
- package/dist/runtime/plugin.client.js +13 -7
- package/dist/runtime/plugin.js +89 -72
- package/dist/runtime/usePrismicPreview.d.ts +1 -5
- package/dist/runtime/usePrismicPreview.js +3 -3
- package/dist/types.d.mts +3 -1
- package/package.json +38 -45
- package/src/module.ts +352 -185
- package/src/runtime/PrismicPreview.vue +12 -16
- package/src/runtime/plugin.client.ts +16 -12
- package/src/runtime/plugin.ts +114 -103
- package/src/runtime/usePrismicPreview.ts +7 -11
- package/dist/client/200.html +0 -1
- package/dist/client/404.html +0 -1
- package/dist/client/_nuxt/BMD6bpEv.js +0 -1
- package/dist/client/_nuxt/BQB6UGbx.js +0 -25
- package/dist/client/_nuxt/CkG7IjgS.js +0 -1
- package/dist/client/_nuxt/DlAUqK2U.js +0 -1
- package/dist/client/_nuxt/H1okkFcd.js +0 -1
- package/dist/client/_nuxt/RYS3n4u0.js +0 -1
- package/dist/client/_nuxt/V_weDLQm.js +0 -1
- package/dist/client/_nuxt/builds/latest.json +0 -1
- package/dist/client/_nuxt/builds/meta/ef21bbff-0463-480b-852c-adffad3f33b7.json +0 -1
- package/dist/client/_nuxt/entry.BC9BDAld.css +0 -1
- package/dist/client/_nuxt/error-404.smTsHvdw.css +0 -1
- package/dist/client/_nuxt/error-500.Bo-s0s94.css +0 -1
- package/dist/client/_nuxt/index.C4BggqQh.css +0 -1
- package/dist/client/index.html +0 -1
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -136
- package/dist/types.d.ts +0 -1
- package/src/devtools/index.ts +0 -127
- package/src/devtools/types.ts +0 -22
- package/src/lib/fileExists.ts +0 -15
- package/src/lib/index.ts +0 -2
- package/src/lib/logger.ts +0 -3
- package/src/types.ts +0 -137
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-3ed4f09e]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-3ed4f09e]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-3ed4f09e]{background-color:#ffffff4d}.gradient-border[data-v-3ed4f09e]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-3ed4f09e]{background-color:#1414144d}.gradient-border[data-v-3ed4f09e]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-3ed4f09e]:before{background-size:400% auto;border-radius:.5rem;bottom:0;content:"";left:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;right:0;top:0;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-3ed4f09e]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-3ed4f09e]{position:fixed}.left-0[data-v-3ed4f09e]{left:0}.right-0[data-v-3ed4f09e]{right:0}.z-10[data-v-3ed4f09e]{z-index:10}.z-20[data-v-3ed4f09e]{z-index:20}.grid[data-v-3ed4f09e]{display:grid}.mb-16[data-v-3ed4f09e]{margin-bottom:4rem}.mb-8[data-v-3ed4f09e]{margin-bottom:2rem}.max-w-520px[data-v-3ed4f09e]{max-width:520px}.min-h-screen[data-v-3ed4f09e]{min-height:100vh}.w-full[data-v-3ed4f09e]{width:100%}.flex[data-v-3ed4f09e]{display:flex}.cursor-pointer[data-v-3ed4f09e]{cursor:pointer}.place-content-center[data-v-3ed4f09e]{place-content:center}.items-center[data-v-3ed4f09e]{align-items:center}.justify-center[data-v-3ed4f09e]{justify-content:center}.overflow-hidden[data-v-3ed4f09e]{overflow:hidden}.bg-white[data-v-3ed4f09e]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-3ed4f09e]{padding-left:1rem;padding-right:1rem}.px-8[data-v-3ed4f09e]{padding-left:2rem;padding-right:2rem}.py-2[data-v-3ed4f09e]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-3ed4f09e]{text-align:center}.text-8xl[data-v-3ed4f09e]{font-size:6rem;line-height:1}.text-xl[data-v-3ed4f09e]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-3ed4f09e]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-3ed4f09e]{font-weight:300}.font-medium[data-v-3ed4f09e]{font-weight:500}.leading-tight[data-v-3ed4f09e]{line-height:1.25}.font-sans[data-v-3ed4f09e]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-3ed4f09e]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-3ed4f09e]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-3ed4f09e]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-3ed4f09e]{padding-left:0;padding-right:0}.sm\:px-6[data-v-3ed4f09e]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-3ed4f09e]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-3ed4f09e]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-3ed4f09e]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-23c92f8d]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-23c92f8d]{position:fixed}.-bottom-1\/2[data-v-23c92f8d]{bottom:-50%}.left-0[data-v-23c92f8d]{left:0}.right-0[data-v-23c92f8d]{right:0}.grid[data-v-23c92f8d]{display:grid}.mb-16[data-v-23c92f8d]{margin-bottom:4rem}.mb-8[data-v-23c92f8d]{margin-bottom:2rem}.h-1\/2[data-v-23c92f8d]{height:50%}.max-w-520px[data-v-23c92f8d]{max-width:520px}.min-h-screen[data-v-23c92f8d]{min-height:100vh}.place-content-center[data-v-23c92f8d]{place-content:center}.overflow-hidden[data-v-23c92f8d]{overflow:hidden}.bg-white[data-v-23c92f8d]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-23c92f8d]{padding-left:2rem;padding-right:2rem}.text-center[data-v-23c92f8d]{text-align:center}.text-8xl[data-v-23c92f8d]{font-size:6rem;line-height:1}.text-xl[data-v-23c92f8d]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-23c92f8d]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-23c92f8d]{font-weight:300}.font-medium[data-v-23c92f8d]{font-weight:500}.leading-tight[data-v-23c92f8d]{line-height:1.25}.font-sans[data-v-23c92f8d]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-23c92f8d]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-23c92f8d]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-23c92f8d]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-23c92f8d]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-23c92f8d]{font-size:2.25rem;line-height:2.5rem}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.heading[data-v-469b968a]{font-weight:700;letter-spacing:.05em;font-family:DM Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;text-transform:uppercase}
|
package/dist/client/index.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html data-capo=""><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__prismic-client/_nuxt/entry.BC9BDAld.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__prismic-client/_nuxt/BQB6UGbx.js"><link rel="prefetch" as="style" crossorigin href="/__prismic-client/_nuxt/error-404.smTsHvdw.css"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/V_weDLQm.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/BMD6bpEv.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/DlAUqK2U.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/CkG7IjgS.js"><link rel="prefetch" as="style" crossorigin href="/__prismic-client/_nuxt/error-500.Bo-s0s94.css"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/H1okkFcd.js"><script type="module" src="/__prismic-client/_nuxt/BQB6UGbx.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1737402154203,false]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__prismic-client",buildId:"ef21bbff-0463-480b-852c-adffad3f33b7",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { PrismicPluginOptions } from '@prismicio/vue';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `@nuxtjs/prismic` module options.
|
|
6
|
-
*
|
|
7
|
-
* @see Module documentation: {@link https://prismic.nuxtjs.org}
|
|
8
|
-
* @see Prismic documentation: {@link https://prismic.io/docs/nuxt-3-setup}
|
|
9
|
-
*/
|
|
10
|
-
type PrismicModuleOptions = Omit<PrismicPluginOptions, 'endpoint' | 'client' | 'linkResolver' | 'richTextSerializer' | 'components'> & {
|
|
11
|
-
/**
|
|
12
|
-
* A Prismic repository endpoint to init the module's `@prismicio/client`
|
|
13
|
-
* instance used to fetch content from a Prismic repository with.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* Said client will be used exposed through `this.$prismic.client` and
|
|
17
|
-
* `usePrismic().client`.
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* ```javascript
|
|
21
|
-
* // A repository ID
|
|
22
|
-
* "my-repo";
|
|
23
|
-
*
|
|
24
|
-
* //A full repository endpoint
|
|
25
|
-
* "https://my-repo.cdn.prismic.io/api/v2";
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @see Prismic client documentation {@link https://prismic.io/docs/technical-reference/prismicio-client}
|
|
29
|
-
*/
|
|
30
|
-
endpoint?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The Prismic environment in use by Slice Machine configured through
|
|
33
|
-
* environment variables.
|
|
34
|
-
*
|
|
35
|
-
* @defaultValue `endpoint` value.
|
|
36
|
-
*
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
environment?: string;
|
|
40
|
-
/**
|
|
41
|
-
* An optional path to a file exporting a `@prismicio/client` instance used
|
|
42
|
-
* to fetch content from a Prismic repository to configure the module with.
|
|
43
|
-
*
|
|
44
|
-
* @remarks
|
|
45
|
-
* Said client will be used exposed through `this.$prismic.client` and
|
|
46
|
-
* `usePrismic().client`.
|
|
47
|
-
* @see Prismic client documentation {@link https://prismic.io/docs/technical-reference/prismicio-client}
|
|
48
|
-
*/
|
|
49
|
-
client?: string;
|
|
50
|
-
/**
|
|
51
|
-
* An optional path to a file exporting a link resolver function used to
|
|
52
|
-
* resolve links to Prismic documents when not using the route resolver
|
|
53
|
-
* parameter with `@prismicio/client`.
|
|
54
|
-
*
|
|
55
|
-
* @see Link resolver documentation {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
56
|
-
*/
|
|
57
|
-
linkResolver?: string;
|
|
58
|
-
/**
|
|
59
|
-
* An optional path to a file exporting an HTML serializer to customize
|
|
60
|
-
* the way rich text fields are rendered.
|
|
61
|
-
*
|
|
62
|
-
* @deprecated Use `components.richTextComponents` instead.
|
|
63
|
-
*
|
|
64
|
-
* @see HTML serializer documentation {@link https://prismic.io/docs/rich-text}
|
|
65
|
-
*/
|
|
66
|
-
richTextSerializer?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Desired path of the preview page used by Prismic to enter preview
|
|
69
|
-
* session.
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* `false` can be used to disable the preview page.
|
|
73
|
-
*
|
|
74
|
-
* @defaultValue `"/preview"`
|
|
75
|
-
*/
|
|
76
|
-
preview?: string | false;
|
|
77
|
-
/**
|
|
78
|
-
* Whether to inject Prismic toolbar script.
|
|
79
|
-
*
|
|
80
|
-
* @remarks
|
|
81
|
-
* The toolbar script is required for previews to work.
|
|
82
|
-
*
|
|
83
|
-
* @defaultValue `true`
|
|
84
|
-
*/
|
|
85
|
-
toolbar?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Whether to enable Prismic Nuxt DevTools integration.
|
|
88
|
-
*
|
|
89
|
-
* @defaultValue `true`
|
|
90
|
-
*/
|
|
91
|
-
devtools?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Options used by Prismic Vue components.
|
|
94
|
-
*/
|
|
95
|
-
components?: Omit<Required<PrismicPluginOptions>['components'], 'richTextComponents' | 'linkRel' | 'sliceZoneDefaultComponent' | 'linkInternalComponent' | 'linkExternalComponent'> & {
|
|
96
|
-
/**
|
|
97
|
-
* An optional path to a file exporting the `rel` attribute to apply on links.
|
|
98
|
-
* It can export a function to use the link's metadata to determine the `rel` value.
|
|
99
|
-
*
|
|
100
|
-
* @defaultValue `"noreferrer"` for external links.
|
|
101
|
-
*/
|
|
102
|
-
linkRel?: string;
|
|
103
|
-
/**
|
|
104
|
-
* An optional path to a file exporting a map of Rich Text block types to Vue Components.
|
|
105
|
-
* It is used to render Rich Text or title fields.
|
|
106
|
-
*
|
|
107
|
-
* @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
|
|
108
|
-
*/
|
|
109
|
-
richTextComponents?: string;
|
|
110
|
-
/**
|
|
111
|
-
* An optional path to a file exporting a component or a functional component rendered
|
|
112
|
-
* if a component mapping from the `components` prop cannot be found.
|
|
113
|
-
*
|
|
114
|
-
* @remarks
|
|
115
|
-
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
116
|
-
*
|
|
117
|
-
* @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
|
|
118
|
-
*/
|
|
119
|
-
sliceZoneDefaultComponent?: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
declare module '@nuxt/schema' {
|
|
124
|
-
interface PublicRuntimeConfig {
|
|
125
|
-
/**
|
|
126
|
-
* `@nuxtjs/prismic` module options.
|
|
127
|
-
*
|
|
128
|
-
* @see Module documentation: {@link https://prismic.nuxtjs.org}
|
|
129
|
-
* @see Prismic documentation: {@link https://prismic.io/docs/nuxt-3-setup}
|
|
130
|
-
*/
|
|
131
|
-
prismic: PrismicModuleOptions;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
declare const _default: _nuxt_schema.NuxtModule<PrismicModuleOptions, PrismicModuleOptions, false>;
|
|
135
|
-
|
|
136
|
-
export { type PrismicModuleOptions as ModuleOptions, type PrismicModuleOptions, _default as default };
|
package/dist/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { type ModuleOptions, type PrismicModuleOptions, default } from './module'
|
package/src/devtools/index.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
import { readFile } from 'node:fs/promises'
|
|
3
|
-
|
|
4
|
-
import { extendServerRpc, onDevToolsInitialized, startSubprocess } from '@nuxt/devtools-kit'
|
|
5
|
-
import type { Resolver } from '@nuxt/kit'
|
|
6
|
-
import type { Nuxt } from 'nuxt/schema'
|
|
7
|
-
import { resolve } from 'pathe'
|
|
8
|
-
import terminate from 'terminate'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
RPC_NAMESPACE,
|
|
12
|
-
SliceMachineStatus,
|
|
13
|
-
type ISlicemachineServerFunctions,
|
|
14
|
-
type ISlicemachineClientFunctions,
|
|
15
|
-
} from './types'
|
|
16
|
-
|
|
17
|
-
const DEVTOOLS_UI_ROUTE = '/__prismic-client'
|
|
18
|
-
const DEVTOOLS_UI_LOCAL_PORT = 5173
|
|
19
|
-
|
|
20
|
-
let subProcess: null | ReturnType<typeof startSubprocess> = null
|
|
21
|
-
|
|
22
|
-
const stopSubprocess = () => {
|
|
23
|
-
if (subProcess) {
|
|
24
|
-
const pid = subProcess.getProcess().pid
|
|
25
|
-
if (pid) {
|
|
26
|
-
terminate(pid)
|
|
27
|
-
}
|
|
28
|
-
subProcess.terminate()
|
|
29
|
-
subProcess = null
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const setupDevToolsUI = (nuxt: Nuxt, resolver: Resolver) => {
|
|
34
|
-
const clientPath = resolver.resolve('./client')
|
|
35
|
-
const isProductionBuild = existsSync(clientPath)
|
|
36
|
-
|
|
37
|
-
if (isProductionBuild) {
|
|
38
|
-
// Serve production-built client (used when package is published)
|
|
39
|
-
nuxt.hook('vite:serverCreated', async (server) => {
|
|
40
|
-
const sirv = await import('sirv').then(r => r.default || r)
|
|
41
|
-
server.middlewares.use(
|
|
42
|
-
DEVTOOLS_UI_ROUTE,
|
|
43
|
-
sirv(clientPath, { dev: true, single: true }),
|
|
44
|
-
)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// In local development, start a separate Nuxt Server and proxy to serve the client
|
|
49
|
-
nuxt.hook('vite:extendConfig', (config) => {
|
|
50
|
-
config.server = config.server || {}
|
|
51
|
-
config.server.proxy = config.server.proxy || {}
|
|
52
|
-
config.server.proxy[DEVTOOLS_UI_ROUTE] = {
|
|
53
|
-
target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
|
|
54
|
-
changeOrigin: true,
|
|
55
|
-
followRedirects: true,
|
|
56
|
-
ws: true,
|
|
57
|
-
rewrite: path => path.replace(DEVTOOLS_UI_ROUTE, ''),
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
nuxt.hooks.hook('close', () => {
|
|
63
|
-
stopSubprocess()
|
|
64
|
-
})
|
|
65
|
-
process.on('exit', () => {
|
|
66
|
-
stopSubprocess()
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
onDevToolsInitialized(() => {
|
|
70
|
-
const rpc = extendServerRpc<ISlicemachineClientFunctions, ISlicemachineServerFunctions>(
|
|
71
|
-
RPC_NAMESPACE,
|
|
72
|
-
{
|
|
73
|
-
async getSlicemachineConfig() {
|
|
74
|
-
const configPath = resolve(nuxt.options.rootDir, 'slicemachine.config.json')
|
|
75
|
-
|
|
76
|
-
if (existsSync(configPath)) {
|
|
77
|
-
return JSON.parse(await readFile(configPath, 'utf-8'))
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return null
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
isSliceMachineStarted() {
|
|
84
|
-
return subProcess !== null
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
startSliceMachine() {
|
|
88
|
-
stopSubprocess()
|
|
89
|
-
|
|
90
|
-
subProcess = startSubprocess({
|
|
91
|
-
command: 'npx',
|
|
92
|
-
args: ['start-slicemachine'],
|
|
93
|
-
cwd: nuxt.options.rootDir,
|
|
94
|
-
}, {
|
|
95
|
-
id: 'slicemachine',
|
|
96
|
-
name: 'SliceMachine',
|
|
97
|
-
icon: 'i-simple-icons-prismic',
|
|
98
|
-
}, nuxt)
|
|
99
|
-
|
|
100
|
-
rpc.broadcast.updateStatus(SliceMachineStatus.STARTED)
|
|
101
|
-
return SliceMachineStatus.STARTED
|
|
102
|
-
},
|
|
103
|
-
stopSliceMachine() {
|
|
104
|
-
stopSubprocess()
|
|
105
|
-
|
|
106
|
-
rpc.broadcast.updateStatus(SliceMachineStatus.STOPPED)
|
|
107
|
-
return SliceMachineStatus.STOPPED
|
|
108
|
-
},
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
nuxt.hook('devtools:customTabs', (tabs) => {
|
|
113
|
-
tabs.push({
|
|
114
|
-
// unique identifier
|
|
115
|
-
name: 'prismic',
|
|
116
|
-
// title to display in the tab
|
|
117
|
-
title: 'Prismic',
|
|
118
|
-
// any icon from Iconify, or a URL to an image
|
|
119
|
-
icon: 'i-simple-icons-prismic',
|
|
120
|
-
// iframe view
|
|
121
|
-
view: {
|
|
122
|
-
type: 'iframe',
|
|
123
|
-
src: DEVTOOLS_UI_ROUTE,
|
|
124
|
-
},
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
}
|
package/src/devtools/types.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { BirpcReturn } from 'birpc'
|
|
2
|
-
|
|
3
|
-
export const RPC_NAMESPACE = 'prismic-slicemachine-rpc'
|
|
4
|
-
|
|
5
|
-
export enum SliceMachineStatus {
|
|
6
|
-
STARTED,
|
|
7
|
-
STOPPED,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ISlicemachineClientFunctions {
|
|
11
|
-
updateStatus(status: SliceMachineStatus): void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ISlicemachineServerFunctions {
|
|
15
|
-
getSlicemachineConfig(): Promise<object | null>
|
|
16
|
-
isSliceMachineStarted(): boolean
|
|
17
|
-
startSliceMachine(): SliceMachineStatus
|
|
18
|
-
stopSliceMachine(): SliceMachineStatus
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type RPCServerType = BirpcReturn<ISlicemachineClientFunctions, ISlicemachineServerFunctions>
|
|
22
|
-
export type RPCClientType = BirpcReturn<ISlicemachineServerFunctions, ISlicemachineClientFunctions>
|
package/src/lib/fileExists.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
|
|
3
|
-
export const fileExists = (path?: string, extensions = ['js', 'ts']): string | null => {
|
|
4
|
-
if (!path) {
|
|
5
|
-
return null
|
|
6
|
-
}
|
|
7
|
-
else if (existsSync(path)) {
|
|
8
|
-
// If path already contains/forces the extension
|
|
9
|
-
return path
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const extension = extensions.find(extension => existsSync(`${path}.${extension}`))
|
|
13
|
-
|
|
14
|
-
return extension ? `${path}.${extension}` : null
|
|
15
|
-
}
|
package/src/lib/index.ts
DELETED
package/src/lib/logger.ts
DELETED
package/src/types.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import type { PrismicPluginOptions, SliceComponentProps, TODOSliceComponent } from '@prismicio/vue'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `@nuxtjs/prismic` module options.
|
|
6
|
-
*
|
|
7
|
-
* @see Module documentation: {@link https://prismic.nuxtjs.org}
|
|
8
|
-
* @see Prismic documentation: {@link https://prismic.io/docs/nuxt-3-setup}
|
|
9
|
-
*/
|
|
10
|
-
export type PrismicModuleOptions = Omit<
|
|
11
|
-
PrismicPluginOptions,
|
|
12
|
-
'endpoint' | 'client' | 'linkResolver' | 'richTextSerializer' | 'components'
|
|
13
|
-
> & {
|
|
14
|
-
/**
|
|
15
|
-
* A Prismic repository endpoint to init the module's `@prismicio/client`
|
|
16
|
-
* instance used to fetch content from a Prismic repository with.
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Said client will be used exposed through `this.$prismic.client` and
|
|
20
|
-
* `usePrismic().client`.
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* ```javascript
|
|
24
|
-
* // A repository ID
|
|
25
|
-
* "my-repo";
|
|
26
|
-
*
|
|
27
|
-
* //A full repository endpoint
|
|
28
|
-
* "https://my-repo.cdn.prismic.io/api/v2";
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @see Prismic client documentation {@link https://prismic.io/docs/technical-reference/prismicio-client}
|
|
32
|
-
*/
|
|
33
|
-
endpoint?: string
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The Prismic environment in use by Slice Machine configured through
|
|
37
|
-
* environment variables.
|
|
38
|
-
*
|
|
39
|
-
* @defaultValue `endpoint` value.
|
|
40
|
-
*
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
environment?: string
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* An optional path to a file exporting a `@prismicio/client` instance used
|
|
47
|
-
* to fetch content from a Prismic repository to configure the module with.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* Said client will be used exposed through `this.$prismic.client` and
|
|
51
|
-
* `usePrismic().client`.
|
|
52
|
-
* @see Prismic client documentation {@link https://prismic.io/docs/technical-reference/prismicio-client}
|
|
53
|
-
*/
|
|
54
|
-
client?: string
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* An optional path to a file exporting a link resolver function used to
|
|
58
|
-
* resolve links to Prismic documents when not using the route resolver
|
|
59
|
-
* parameter with `@prismicio/client`.
|
|
60
|
-
*
|
|
61
|
-
* @see Link resolver documentation {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
62
|
-
*/
|
|
63
|
-
linkResolver?: string
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* An optional path to a file exporting an HTML serializer to customize
|
|
67
|
-
* the way rich text fields are rendered.
|
|
68
|
-
*
|
|
69
|
-
* @deprecated Use `components.richTextComponents` instead.
|
|
70
|
-
*
|
|
71
|
-
* @see HTML serializer documentation {@link https://prismic.io/docs/rich-text}
|
|
72
|
-
*/
|
|
73
|
-
richTextSerializer?: string
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Desired path of the preview page used by Prismic to enter preview
|
|
77
|
-
* session.
|
|
78
|
-
*
|
|
79
|
-
* @remarks
|
|
80
|
-
* `false` can be used to disable the preview page.
|
|
81
|
-
*
|
|
82
|
-
* @defaultValue `"/preview"`
|
|
83
|
-
*/
|
|
84
|
-
preview?: string | false
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Whether to inject Prismic toolbar script.
|
|
88
|
-
*
|
|
89
|
-
* @remarks
|
|
90
|
-
* The toolbar script is required for previews to work.
|
|
91
|
-
*
|
|
92
|
-
* @defaultValue `true`
|
|
93
|
-
*/
|
|
94
|
-
toolbar?: boolean
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Whether to enable Prismic Nuxt DevTools integration.
|
|
98
|
-
*
|
|
99
|
-
* @defaultValue `true`
|
|
100
|
-
*/
|
|
101
|
-
devtools?: boolean
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Options used by Prismic Vue components.
|
|
105
|
-
*/
|
|
106
|
-
components?: Omit<
|
|
107
|
-
Required<PrismicPluginOptions>['components'],
|
|
108
|
-
'richTextComponents' | 'linkRel' | 'sliceZoneDefaultComponent' | 'linkInternalComponent' | 'linkExternalComponent'
|
|
109
|
-
> & {
|
|
110
|
-
/**
|
|
111
|
-
* An optional path to a file exporting the `rel` attribute to apply on links.
|
|
112
|
-
* It can export a function to use the link's metadata to determine the `rel` value.
|
|
113
|
-
*
|
|
114
|
-
* @defaultValue `"noreferrer"` for external links.
|
|
115
|
-
*/
|
|
116
|
-
linkRel?: string
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* An optional path to a file exporting a map of Rich Text block types to Vue Components.
|
|
120
|
-
* It is used to render Rich Text or title fields.
|
|
121
|
-
*
|
|
122
|
-
* @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
|
|
123
|
-
*/
|
|
124
|
-
richTextComponents?: string
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* An optional path to a file exporting a component or a functional component rendered
|
|
128
|
-
* if a component mapping from the `components` prop cannot be found.
|
|
129
|
-
*
|
|
130
|
-
* @remarks
|
|
131
|
-
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
132
|
-
*
|
|
133
|
-
* @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
|
|
134
|
-
*/
|
|
135
|
-
sliceZoneDefaultComponent?: string
|
|
136
|
-
}
|
|
137
|
-
}
|