@slicemachine/adapter-nuxt 0.1.3-dev-page-types.6 → 0.1.3-dev-page-types.8
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/dist/lib/isSharedSliceModel.d.ts +2 -2
- package/dist/lib/upsertGlobalContentTypes.cjs +3 -2
- package/dist/lib/upsertGlobalContentTypes.cjs.map +1 -1
- package/dist/lib/upsertGlobalContentTypes.d.ts +2 -2
- package/dist/lib/upsertGlobalContentTypes.js +4 -3
- package/dist/lib/upsertGlobalContentTypes.js.map +1 -1
- package/package.json +4 -4
- package/src/lib/upsertGlobalContentTypes.ts +4 -5
|
@@ -135,7 +135,7 @@ export declare const isSharedSliceModel: (input: any) => input is {
|
|
|
135
135
|
label?: string | null | undefined;
|
|
136
136
|
useAsTitle?: boolean | undefined;
|
|
137
137
|
placeholder?: string | undefined;
|
|
138
|
-
select?: "
|
|
138
|
+
select?: "media" | "document" | "web" | null | undefined;
|
|
139
139
|
customtypes?: readonly string[] | undefined;
|
|
140
140
|
masks?: readonly string[] | undefined;
|
|
141
141
|
tags?: readonly string[] | undefined;
|
|
@@ -294,7 +294,7 @@ export declare const isSharedSliceModel: (input: any) => input is {
|
|
|
294
294
|
label?: string | null | undefined;
|
|
295
295
|
useAsTitle?: boolean | undefined;
|
|
296
296
|
placeholder?: string | undefined;
|
|
297
|
-
select?: "
|
|
297
|
+
select?: "media" | "document" | "web" | null | undefined;
|
|
298
298
|
customtypes?: readonly string[] | undefined;
|
|
299
299
|
masks?: readonly string[] | undefined;
|
|
300
300
|
tags?: readonly string[] | undefined;
|
|
@@ -22,7 +22,7 @@ function _interopNamespaceDefault(e) {
|
|
|
22
22
|
}
|
|
23
23
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
24
24
|
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
25
|
-
const upsertGlobalContentTypes = async ({ actions, helpers, options }) => {
|
|
25
|
+
const upsertGlobalContentTypes = async ({ actions, helpers, options, project }) => {
|
|
26
26
|
const filePath = helpers.joinPathFromRoot("prismicio-types.d.ts");
|
|
27
27
|
const [customTypeModelDescriptors, sharedSliceModelDescriptors] = await Promise.all([
|
|
28
28
|
actions.readAllCustomTypeModels(),
|
|
@@ -40,7 +40,8 @@ const upsertGlobalContentTypes = async ({ actions, helpers, options }) => {
|
|
|
40
40
|
clientIntegration: {
|
|
41
41
|
includeCreateClientInterface: true,
|
|
42
42
|
includeContentNamespace: true
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
|
+
typesProvider: await prismicTsCodegen.detectTypesProvider({ cwd: project.root })
|
|
44
45
|
});
|
|
45
46
|
contents = `${constants.NON_EDITABLE_FILE_BANNER}
|
|
46
47
|
|
|
@@ -1 +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\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\ntype UpsertGlobalTypesArgs =
|
|
1
|
+
{"version":3,"file":"upsertGlobalContentTypes.cjs","sources":["../../../src/lib/upsertGlobalContentTypes.ts"],"sourcesContent":["import type { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { detectTypesProvider, generateTypes } from \"prismic-ts-codegen\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\ntype UpsertGlobalTypesArgs = SliceMachineContext<PluginOptions>;\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\tproject,\n}: UpsertGlobalTypesArgs): Promise<void> => {\n\tconst filePath = helpers.joinPathFromRoot(\"prismicio-types.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\ttypesProvider: await detectTypesProvider({ cwd: project.root }),\n\t});\n\n\tcontents = `${NON_EDITABLE_FILE_BANNER}\\n\\n${contents}`;\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","detectTypesProvider","NON_EDITABLE_FILE_BANNER","fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAM,2BAA2B,OAAO,EAC9C,SACA,SACA,SACA,cAC0C;AACpC,QAAA,WAAW,QAAQ,iBAAiB,sBAAsB;AAEhE,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,IACD,eAAe,MAAMC,iBAAAA,oBAAoB,EAAE,KAAK,QAAQ,MAAM;AAAA,EAAA,CAC9D;AAED,aAAW,GAAGC;;EAA+B;AAE7C,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;;"}
|
|
@@ -3,10 +3,10 @@ import type { PluginOptions } from "../types";
|
|
|
3
3
|
/**
|
|
4
4
|
* Arguments for `upsertGlobalContentTypes()`.
|
|
5
5
|
*/
|
|
6
|
-
type UpsertGlobalTypesArgs =
|
|
6
|
+
type UpsertGlobalTypesArgs = SliceMachineContext<PluginOptions>;
|
|
7
7
|
/**
|
|
8
8
|
* Creates a globally accessible TypeScript file containing types representing
|
|
9
9
|
* the Prismic repository's content.
|
|
10
10
|
*/
|
|
11
|
-
export declare const upsertGlobalContentTypes: ({ actions, helpers, options, }: UpsertGlobalTypesArgs) => Promise<void>;
|
|
11
|
+
export declare const upsertGlobalContentTypes: ({ actions, helpers, options, project, }: UpsertGlobalTypesArgs) => Promise<void>;
|
|
12
12
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { generateTypes } from "prismic-ts-codegen";
|
|
1
|
+
import { generateTypes, detectTypesProvider } from "prismic-ts-codegen";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { NON_EDITABLE_FILE_BANNER } from "../constants.js";
|
|
5
|
-
const upsertGlobalContentTypes = async ({ actions, helpers, options }) => {
|
|
5
|
+
const upsertGlobalContentTypes = async ({ actions, helpers, options, project }) => {
|
|
6
6
|
const filePath = helpers.joinPathFromRoot("prismicio-types.d.ts");
|
|
7
7
|
const [customTypeModelDescriptors, sharedSliceModelDescriptors] = await Promise.all([
|
|
8
8
|
actions.readAllCustomTypeModels(),
|
|
@@ -20,7 +20,8 @@ const upsertGlobalContentTypes = async ({ actions, helpers, options }) => {
|
|
|
20
20
|
clientIntegration: {
|
|
21
21
|
includeCreateClientInterface: true,
|
|
22
22
|
includeContentNamespace: true
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
typesProvider: await detectTypesProvider({ cwd: project.root })
|
|
24
25
|
});
|
|
25
26
|
contents = `${NON_EDITABLE_FILE_BANNER}
|
|
26
27
|
|
|
@@ -1 +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\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\ntype UpsertGlobalTypesArgs =
|
|
1
|
+
{"version":3,"file":"upsertGlobalContentTypes.js","sources":["../../../src/lib/upsertGlobalContentTypes.ts"],"sourcesContent":["import type { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { detectTypesProvider, generateTypes } from \"prismic-ts-codegen\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\nimport { NON_EDITABLE_FILE_BANNER } from \"../constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\ntype UpsertGlobalTypesArgs = SliceMachineContext<PluginOptions>;\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\tproject,\n}: UpsertGlobalTypesArgs): Promise<void> => {\n\tconst filePath = helpers.joinPathFromRoot(\"prismicio-types.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\ttypesProvider: await detectTypesProvider({ cwd: project.root }),\n\t});\n\n\tcontents = `${NON_EDITABLE_FILE_BANNER}\\n\\n${contents}`;\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":";;;;AAiBO,MAAM,2BAA2B,OAAO,EAC9C,SACA,SACA,SACA,cAC0C;AACpC,QAAA,WAAW,QAAQ,iBAAiB,sBAAsB;AAEhE,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,IACD,eAAe,MAAM,oBAAoB,EAAE,KAAK,QAAQ,MAAM;AAAA,EAAA,CAC9D;AAED,aAAW,GAAG;AAAA;AAAA,EAA+B;AAE7C,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;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/adapter-nuxt",
|
|
3
|
-
"version": "0.1.3-dev-page-types.
|
|
3
|
+
"version": "0.1.3-dev-page-types.8",
|
|
4
4
|
"description": "Slice Machine adapter for Nuxt 3.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@prismicio/slice-simulator-core": "^0.2.7",
|
|
61
61
|
"@prismicio/types-internal": "2.0.0-beta.1",
|
|
62
|
-
"@slicemachine/plugin-kit": "0.2.1-dev-page-types.
|
|
62
|
+
"@slicemachine/plugin-kit": "0.2.1-dev-page-types.8",
|
|
63
63
|
"common-tags": "^1.8.2",
|
|
64
64
|
"fs-extra": "^11.1.0",
|
|
65
65
|
"magicast": "^0.2.1",
|
|
66
66
|
"node-fetch": "^3.3.1",
|
|
67
67
|
"pascal-case": "^3.1.2",
|
|
68
|
-
"prismic-ts-codegen": "
|
|
68
|
+
"prismic-ts-codegen": "0.1.9"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@prismicio/mock": "^0.2.0",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "ca465dbd50d70234982250b443056c98b465ae51"
|
|
107
107
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
2
|
-
import { generateTypes } from "prismic-ts-codegen";
|
|
2
|
+
import { detectTypesProvider, generateTypes } from "prismic-ts-codegen";
|
|
3
3
|
import * as fs from "node:fs/promises";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
|
|
@@ -9,10 +9,7 @@ import { NON_EDITABLE_FILE_BANNER } from "../constants";
|
|
|
9
9
|
/**
|
|
10
10
|
* Arguments for `upsertGlobalContentTypes()`.
|
|
11
11
|
*/
|
|
12
|
-
type UpsertGlobalTypesArgs =
|
|
13
|
-
SliceMachineContext<PluginOptions>,
|
|
14
|
-
"actions" | "helpers" | "options"
|
|
15
|
-
>;
|
|
12
|
+
type UpsertGlobalTypesArgs = SliceMachineContext<PluginOptions>;
|
|
16
13
|
|
|
17
14
|
/**
|
|
18
15
|
* Creates a globally accessible TypeScript file containing types representing
|
|
@@ -22,6 +19,7 @@ export const upsertGlobalContentTypes = async ({
|
|
|
22
19
|
actions,
|
|
23
20
|
helpers,
|
|
24
21
|
options,
|
|
22
|
+
project,
|
|
25
23
|
}: UpsertGlobalTypesArgs): Promise<void> => {
|
|
26
24
|
const filePath = helpers.joinPathFromRoot("prismicio-types.d.ts");
|
|
27
25
|
|
|
@@ -49,6 +47,7 @@ export const upsertGlobalContentTypes = async ({
|
|
|
49
47
|
includeCreateClientInterface: true,
|
|
50
48
|
includeContentNamespace: true,
|
|
51
49
|
},
|
|
50
|
+
typesProvider: await detectTypesProvider({ cwd: project.root }),
|
|
52
51
|
});
|
|
53
52
|
|
|
54
53
|
contents = `${NON_EDITABLE_FILE_BANNER}\n\n${contents}`;
|