@slicemachine/adapter-next 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SliceSimulator.d.ts +2 -2
- package/dist/hooks/customType-rename.cjs +6 -0
- package/dist/hooks/customType-rename.cjs.map +1 -0
- package/dist/hooks/customType-rename.d.ts +1 -0
- package/dist/hooks/customType-rename.js +6 -0
- package/dist/hooks/customType-rename.js.map +1 -0
- package/dist/hooks/customTypeLibrary-read.cjs +12 -4
- package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
- package/dist/hooks/customTypeLibrary-read.js +12 -4
- package/dist/hooks/customTypeLibrary-read.js.map +1 -1
- package/dist/hooks/slice-create.cjs +14 -24
- package/dist/hooks/slice-create.cjs.map +1 -1
- package/dist/hooks/slice-create.js +14 -24
- package/dist/hooks/slice-create.js.map +1 -1
- package/dist/hooks/slice-delete.cjs +3 -13
- package/dist/hooks/slice-delete.cjs.map +1 -1
- package/dist/hooks/slice-delete.js +3 -13
- package/dist/hooks/slice-delete.js.map +1 -1
- package/dist/hooks/slice-read.cjs +42 -6
- package/dist/hooks/slice-read.cjs.map +1 -1
- package/dist/hooks/slice-read.js +22 -6
- package/dist/hooks/slice-read.js.map +1 -1
- package/dist/hooks/slice-rename.cjs +45 -0
- package/dist/hooks/slice-rename.cjs.map +1 -0
- package/dist/hooks/slice-rename.d.ts +3 -0
- package/dist/hooks/slice-rename.js +26 -0
- package/dist/hooks/slice-rename.js.map +1 -0
- package/dist/hooks/slice-update.cjs +6 -33
- package/dist/hooks/slice-update.cjs.map +1 -1
- package/dist/hooks/slice-update.js +6 -13
- package/dist/hooks/slice-update.js.map +1 -1
- package/dist/hooks/sliceLibrary-read.cjs +12 -14
- package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
- package/dist/hooks/sliceLibrary-read.js +12 -13
- package/dist/hooks/sliceLibrary-read.js.map +1 -1
- package/dist/lib/isSharedSliceModel.cjs +27 -0
- package/dist/lib/isSharedSliceModel.cjs.map +1 -0
- package/dist/lib/isSharedSliceModel.d.ts +2 -0
- package/dist/lib/isSharedSliceModel.js +8 -0
- package/dist/lib/isSharedSliceModel.js.map +1 -0
- package/dist/lib/updateSliceModelFile.cjs +33 -0
- package/dist/lib/updateSliceModelFile.cjs.map +1 -0
- package/dist/lib/updateSliceModelFile.d.ts +9 -0
- package/dist/lib/updateSliceModelFile.js +14 -0
- package/dist/lib/updateSliceModelFile.js.map +1 -0
- package/dist/lib/upsertGlobalContentTypes.d.ts +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +47 -0
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -0
- package/dist/lib/upsertSliceLibraryIndexFile.d.ts +7 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js +28 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -0
- package/dist/plugin.cjs +4 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +14 -12
- package/src/hooks/customType-rename.ts +3 -0
- package/src/hooks/customTypeLibrary-read.ts +13 -4
- package/src/hooks/slice-create.ts +14 -32
- package/src/hooks/slice-delete.ts +3 -21
- package/src/hooks/slice-read.ts +37 -11
- package/src/hooks/slice-rename.ts +44 -0
- package/src/hooks/slice-update.ts +7 -31
- package/src/hooks/sliceLibrary-read.ts +13 -23
- package/src/lib/isSharedSliceModel.ts +14 -0
- package/src/lib/updateSliceModelFile.ts +32 -0
- package/src/lib/{buildSliceLibraryIndexFileContents.ts → upsertSliceLibraryIndexFile.ts} +14 -9
- package/src/plugin.ts +4 -0
- package/dist/lib/buildSliceLibraryIndexFileContents.cjs +0 -23
- package/dist/lib/buildSliceLibraryIndexFileContents.cjs.map +0 -1
- package/dist/lib/buildSliceLibraryIndexFileContents.d.ts +0 -10
- package/dist/lib/buildSliceLibraryIndexFileContents.js +0 -23
- package/dist/lib/buildSliceLibraryIndexFileContents.js.map +0 -1
package/dist/SliceSimulator.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SliceSimulatorProps as BaseSliceSimulatorProps, SliceSimulatorState } from "@prismicio/slice-simulator-core";
|
|
2
|
-
export
|
|
2
|
+
export type SliceSimulatorSliceZoneProps = {
|
|
3
3
|
slices: SliceSimulatorState["slices"];
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type SliceSimulatorProps = {
|
|
6
6
|
/**
|
|
7
7
|
* React component to render simulated Slices.
|
|
8
8
|
*
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const customTypeCreate = require("./customType-create.cjs");
|
|
4
|
+
const customTypeRename = customTypeCreate.customTypeCreate;
|
|
5
|
+
exports.customTypeRename = customTypeRename;
|
|
6
|
+
//# sourceMappingURL=customType-rename.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-rename.cjs","sources":["../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const customTypeRename: import("@slicemachine/plugin-kit").CustomTypeCreateHook<import("..").PluginOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-rename.js","sources":["../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
|
|
@@ -32,10 +32,18 @@ const customTypeLibraryRead = async (_data, { helpers }) => {
|
|
|
32
32
|
const childDirs = await fs__namespace.readdir(dirPath);
|
|
33
33
|
const ids = [];
|
|
34
34
|
await Promise.all(childDirs.map(async (childDir) => {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const childDirContents = await fs__namespace.readdir(path__namespace.join(dirPath, childDir), {
|
|
36
|
+
withFileTypes: true
|
|
37
|
+
});
|
|
38
|
+
const isCustomTypeDir = childDirContents.some((entry) => {
|
|
39
|
+
return entry.isFile() && entry.name === "index.json";
|
|
40
|
+
});
|
|
41
|
+
if (isCustomTypeDir) {
|
|
42
|
+
const modelPath = path__namespace.join(dirPath, childDir, "index.json");
|
|
43
|
+
const modelContents = await readJSONFile.readJSONFile(modelPath);
|
|
44
|
+
if (isCustomTypeModel(modelContents)) {
|
|
45
|
+
ids.push(modelContents.id);
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
48
|
}));
|
|
41
49
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypeLibrary-read.cjs","sources":["../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = helpers.joinPathFromRoot(\"customtypes\");\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\tids.push(modelContents.id);\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":["fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAC1B,QAAA,UAAU,QAAQ,iBAAiB,aAAa;AAGtD,QAAMA,cAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAMA,cAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;
|
|
1
|
+
{"version":3,"file":"customTypeLibrary-read.cjs","sources":["../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = helpers.joinPathFromRoot(\"customtypes\");\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst childDirContents = await fs.readdir(path.join(dirPath, childDir), {\n\t\t\t\twithFileTypes: true,\n\t\t\t});\n\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t});\n\n\t\t\tif (isCustomTypeDir) {\n\t\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":["fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAC1B,QAAA,UAAU,QAAQ,iBAAiB,aAAa;AAGtD,QAAMA,cAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAMA,cAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC1B,UAAA,mBAAmB,MAAMA,cAAG,QAAQC,gBAAK,KAAK,SAAS,QAAQ,GAAG;AAAA,MACvE,eAAe;AAAA,IAAA,CACf;AACD,UAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,aAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,IAAA,CACxC;AAED,QAAI,iBAAiB;AACpB,YAAM,YAAYA,gBAAK,KAAK,SAAS,UAAU,YAAY;AAErD,YAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,UAAA,kBAAkB,aAAa,GAAG;AACjC,YAAA,KAAK,cAAc,EAAE;AAAA,MACzB;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;;"}
|
|
@@ -10,10 +10,18 @@ const customTypeLibraryRead = async (_data, { helpers }) => {
|
|
|
10
10
|
const childDirs = await fs.readdir(dirPath);
|
|
11
11
|
const ids = [];
|
|
12
12
|
await Promise.all(childDirs.map(async (childDir) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const childDirContents = await fs.readdir(path.join(dirPath, childDir), {
|
|
14
|
+
withFileTypes: true
|
|
15
|
+
});
|
|
16
|
+
const isCustomTypeDir = childDirContents.some((entry) => {
|
|
17
|
+
return entry.isFile() && entry.name === "index.json";
|
|
18
|
+
});
|
|
19
|
+
if (isCustomTypeDir) {
|
|
20
|
+
const modelPath = path.join(dirPath, childDir, "index.json");
|
|
21
|
+
const modelContents = await readJSONFile(modelPath);
|
|
22
|
+
if (isCustomTypeModel(modelContents)) {
|
|
23
|
+
ids.push(modelContents.id);
|
|
24
|
+
}
|
|
17
25
|
}
|
|
18
26
|
}));
|
|
19
27
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypeLibrary-read.js","sources":["../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = helpers.joinPathFromRoot(\"customtypes\");\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\tids.push(modelContents.id);\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;AASA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAC1B,QAAA,UAAU,QAAQ,iBAAiB,aAAa;AAGtD,QAAM,GAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAM,GAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;
|
|
1
|
+
{"version":3,"file":"customTypeLibrary-read.js","sources":["../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = helpers.joinPathFromRoot(\"customtypes\");\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst childDirContents = await fs.readdir(path.join(dirPath, childDir), {\n\t\t\t\twithFileTypes: true,\n\t\t\t});\n\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t});\n\n\t\t\tif (isCustomTypeDir) {\n\t\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;AASA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAC1B,QAAA,UAAU,QAAQ,iBAAiB,aAAa;AAGtD,QAAM,GAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAM,GAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC1B,UAAA,mBAAmB,MAAM,GAAG,QAAQ,KAAK,KAAK,SAAS,QAAQ,GAAG;AAAA,MACvE,eAAe;AAAA,IAAA,CACf;AACD,UAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,aAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,IAAA,CACxC;AAED,QAAI,iBAAiB;AACpB,YAAM,YAAY,KAAK,KAAK,SAAS,UAAU,YAAY;AAErD,YAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,UAAA,kBAAkB,aAAa,GAAG;AACjC,YAAA,KAAK,cAAc,EAAE;AAAA,MACzB;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const commonTags = require("common-tags");
|
|
4
4
|
const fs = require("node:fs/promises");
|
|
5
5
|
const path = require("node:path");
|
|
6
|
-
const
|
|
6
|
+
const upsertSliceLibraryIndexFile = require("../lib/upsertSliceLibraryIndexFile.cjs");
|
|
7
7
|
const getJSOrTSXFileExtension = require("../lib/getJSOrTSXFileExtension.cjs");
|
|
8
8
|
const pascalCase = require("../lib/pascalCase.cjs");
|
|
9
9
|
const rejectIfNecessary = require("../lib/rejectIfNecessary.cjs");
|
|
@@ -39,22 +39,22 @@ const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
|
39
39
|
const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
40
40
|
const filePath = path__namespace.join(dir, `index.${getJSOrTSXFileExtension.getJSOrTSXFileExtension(options)}`);
|
|
41
41
|
const model = data.model;
|
|
42
|
-
const
|
|
42
|
+
const pascalName = pascalCase.pascalCase(model.name);
|
|
43
43
|
let contents;
|
|
44
44
|
if (options.typescript) {
|
|
45
45
|
contents = commonTags.stripIndent`
|
|
46
46
|
import { SliceComponentProps } from "@prismicio/react";
|
|
47
|
-
import { ${
|
|
47
|
+
import { ${pascalName}Slice } from "./types";
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Props for \`${
|
|
50
|
+
* Props for \`${pascalName}\`.
|
|
51
51
|
*/
|
|
52
|
-
export type ${
|
|
52
|
+
export type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Component for "${model.name}" Slices.
|
|
56
56
|
*/
|
|
57
|
-
const ${
|
|
57
|
+
const ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {
|
|
58
58
|
return (
|
|
59
59
|
<section
|
|
60
60
|
data-slice-type={slice.slice_type}
|
|
@@ -65,16 +65,16 @@ const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
|
65
65
|
);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
export default ${
|
|
68
|
+
export default ${pascalName}
|
|
69
69
|
`;
|
|
70
70
|
} else {
|
|
71
71
|
contents = commonTags.stripIndent`
|
|
72
72
|
/**
|
|
73
|
-
* @typedef {import("./types").${
|
|
74
|
-
* @typedef {import("@prismicio/react").SliceComponentProps<${
|
|
75
|
-
* @param {${
|
|
73
|
+
* @typedef {import("./types").${pascalName}Slice} ${pascalName}Slice
|
|
74
|
+
* @typedef {import("@prismicio/react").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props
|
|
75
|
+
* @param {${pascalName}Props}
|
|
76
76
|
*/
|
|
77
|
-
const ${
|
|
77
|
+
const ${pascalName} = ({ slice }) => {
|
|
78
78
|
return (
|
|
79
79
|
<section
|
|
80
80
|
data-slice-type={slice.slice_type}
|
|
@@ -85,7 +85,7 @@ const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
|
85
85
|
);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
export default ${
|
|
88
|
+
export default ${pascalName};
|
|
89
89
|
`;
|
|
90
90
|
}
|
|
91
91
|
if (options.format) {
|
|
@@ -93,18 +93,8 @@ const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
|
93
93
|
}
|
|
94
94
|
await fs__namespace.writeFile(filePath, contents);
|
|
95
95
|
};
|
|
96
|
-
const upsertSliceLibraryIndexFile = async ({ data, actions, helpers, project, options }) => {
|
|
97
|
-
const { filePath, contents } = await buildSliceLibraryIndexFileContents.buildSliceLibraryIndexFileContents({
|
|
98
|
-
libraryID: data.libraryID,
|
|
99
|
-
actions,
|
|
100
|
-
helpers,
|
|
101
|
-
project,
|
|
102
|
-
options
|
|
103
|
-
});
|
|
104
|
-
await fs__namespace.writeFile(filePath, contents);
|
|
105
|
-
};
|
|
106
96
|
const sliceCreate = async (data, context) => {
|
|
107
|
-
const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.
|
|
97
|
+
const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.name));
|
|
108
98
|
await fs__namespace.mkdir(dir, { recursive: true });
|
|
109
99
|
rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
|
|
110
100
|
createModelFile({ dir, data, ...context }),
|
|
@@ -112,7 +102,7 @@ const sliceCreate = async (data, context) => {
|
|
|
112
102
|
]));
|
|
113
103
|
rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
|
|
114
104
|
upsertGlobalContentTypes.upsertGlobalContentTypes(context),
|
|
115
|
-
upsertSliceLibraryIndexFile({ data, ...context })
|
|
105
|
+
upsertSliceLibraryIndexFile.upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
|
|
116
106
|
]));
|
|
117
107
|
};
|
|
118
108
|
exports.sliceCreate = sliceCreate;
|
|
@@ -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 { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport {
|
|
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 { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"model.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nconst createComponentFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, `index.${getJSOrTSXFileExtension(options)}`);\n\tconst model = data.model;\n\tconst pascalName = pascalCase(model.name);\n\n\tlet contents: string;\n\n\tif (options.typescript) {\n\t\tcontents = stripIndent`\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\t\t\timport { ${pascalName}Slice } from \"./types\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t/**\n\t\t\t * @typedef {import(\"./types\").${pascalName}Slice} ${pascalName}Slice\n\t\t\t * @typedef {import(\"@prismicio/react\").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props\n\t\t\t * @param {${pascalName}Props}\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName};\n\t\t`;\n\t}\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tcreateModelFile({ dir, data, ...context }),\n\t\t\tcreateComponentFile({ dir, data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":["path","fs","getJSOrTSXFileExtension","pascalCase","stripIndent","rejectIfNecessary","upsertGlobalContentTypes","upsertSliceLibraryIndexFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAWA,gBAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEA,MAAM,sBAAsB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AAC3E,QAAM,WAAWD,gBAAK,KAAK,KAAK,SAASE,gDAAwB,OAAO,GAAG;AAC3E,QAAM,QAAQ,KAAK;AACb,QAAA,aAAaC,WAAAA,WAAW,MAAM,IAAI;AAEpC,MAAA;AAEJ,MAAI,QAAQ,YAAY;AACZ,eAAAC,WAAAA;AAAAA;AAAAA,cAEC;AAAA;AAAA;AAAA,oBAGM;AAAA;AAAA,iBAEH,yCAAyC;AAAA;AAAA;AAAA,uBAGnC,MAAM;AAAA;AAAA,WAElB,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAML,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAAA,OAEZ;AACK,eAAAA,WAAAA;AAAAA;AAAAA,oCAEuB,oBAAoB;AAAA,iEACS,qBAAqB;AAAA,gBACtE;AAAA;AAAA,WAEL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAElB;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAH,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACG,QAAA,MAAM,QAAQ,QAAQ,iBAC3B,KAAK,WACLE,WAAAA,WAAW,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAMF,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAGtCI,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,gBAAgB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,IACzC,oBAAoB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,EAC7C,CAAA,CAAC;AAIFA,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,yBAAAA,yBAAyB,OAAO;AAAA,IAChCC,wDAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { stripIndent } from "common-tags";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile.js";
|
|
5
5
|
import { getJSOrTSXFileExtension } from "../lib/getJSOrTSXFileExtension.js";
|
|
6
6
|
import { pascalCase } from "../lib/pascalCase.js";
|
|
7
7
|
import { rejectIfNecessary } from "../lib/rejectIfNecessary.js";
|
|
@@ -17,22 +17,22 @@ const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
|
17
17
|
const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
18
18
|
const filePath = path.join(dir, `index.${getJSOrTSXFileExtension(options)}`);
|
|
19
19
|
const model = data.model;
|
|
20
|
-
const
|
|
20
|
+
const pascalName = pascalCase(model.name);
|
|
21
21
|
let contents;
|
|
22
22
|
if (options.typescript) {
|
|
23
23
|
contents = stripIndent`
|
|
24
24
|
import { SliceComponentProps } from "@prismicio/react";
|
|
25
|
-
import { ${
|
|
25
|
+
import { ${pascalName}Slice } from "./types";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Props for \`${
|
|
28
|
+
* Props for \`${pascalName}\`.
|
|
29
29
|
*/
|
|
30
|
-
export type ${
|
|
30
|
+
export type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Component for "${model.name}" Slices.
|
|
34
34
|
*/
|
|
35
|
-
const ${
|
|
35
|
+
const ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {
|
|
36
36
|
return (
|
|
37
37
|
<section
|
|
38
38
|
data-slice-type={slice.slice_type}
|
|
@@ -43,16 +43,16 @@ const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
|
43
43
|
);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export default ${
|
|
46
|
+
export default ${pascalName}
|
|
47
47
|
`;
|
|
48
48
|
} else {
|
|
49
49
|
contents = stripIndent`
|
|
50
50
|
/**
|
|
51
|
-
* @typedef {import("./types").${
|
|
52
|
-
* @typedef {import("@prismicio/react").SliceComponentProps<${
|
|
53
|
-
* @param {${
|
|
51
|
+
* @typedef {import("./types").${pascalName}Slice} ${pascalName}Slice
|
|
52
|
+
* @typedef {import("@prismicio/react").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props
|
|
53
|
+
* @param {${pascalName}Props}
|
|
54
54
|
*/
|
|
55
|
-
const ${
|
|
55
|
+
const ${pascalName} = ({ slice }) => {
|
|
56
56
|
return (
|
|
57
57
|
<section
|
|
58
58
|
data-slice-type={slice.slice_type}
|
|
@@ -63,7 +63,7 @@ const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
|
63
63
|
);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export default ${
|
|
66
|
+
export default ${pascalName};
|
|
67
67
|
`;
|
|
68
68
|
}
|
|
69
69
|
if (options.format) {
|
|
@@ -71,18 +71,8 @@ const createComponentFile = async ({ dir, data, helpers, options }) => {
|
|
|
71
71
|
}
|
|
72
72
|
await fs.writeFile(filePath, contents);
|
|
73
73
|
};
|
|
74
|
-
const upsertSliceLibraryIndexFile = async ({ data, actions, helpers, project, options }) => {
|
|
75
|
-
const { filePath, contents } = await buildSliceLibraryIndexFileContents({
|
|
76
|
-
libraryID: data.libraryID,
|
|
77
|
-
actions,
|
|
78
|
-
helpers,
|
|
79
|
-
project,
|
|
80
|
-
options
|
|
81
|
-
});
|
|
82
|
-
await fs.writeFile(filePath, contents);
|
|
83
|
-
};
|
|
84
74
|
const sliceCreate = async (data, context) => {
|
|
85
|
-
const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.
|
|
75
|
+
const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.name));
|
|
86
76
|
await fs.mkdir(dir, { recursive: true });
|
|
87
77
|
rejectIfNecessary(await Promise.allSettled([
|
|
88
78
|
createModelFile({ dir, data, ...context }),
|
|
@@ -90,7 +80,7 @@ const sliceCreate = async (data, context) => {
|
|
|
90
80
|
]));
|
|
91
81
|
rejectIfNecessary(await Promise.allSettled([
|
|
92
82
|
upsertGlobalContentTypes(context),
|
|
93
|
-
upsertSliceLibraryIndexFile({ data, ...context })
|
|
83
|
+
upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
|
|
94
84
|
]));
|
|
95
85
|
};
|
|
96
86
|
export {
|
|
@@ -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 { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport {
|
|
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 { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"model.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nconst createComponentFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, `index.${getJSOrTSXFileExtension(options)}`);\n\tconst model = data.model;\n\tconst pascalName = pascalCase(model.name);\n\n\tlet contents: string;\n\n\tif (options.typescript) {\n\t\tcontents = stripIndent`\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\t\t\timport { ${pascalName}Slice } from \"./types\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }: ${pascalName}Props): React.Element => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t/**\n\t\t\t * @typedef {import(\"./types\").${pascalName}Slice} ${pascalName}Slice\n\t\t\t * @typedef {import(\"@prismicio/react\").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props\n\t\t\t * @param {${pascalName}Props}\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName};\n\t\t`;\n\t}\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tcreateModelFile({ dir, data, ...context }),\n\t\t\tcreateComponentFile({ dir, data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":[],"mappings":";;;;;;;;AAsBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAW,KAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEA,MAAM,sBAAsB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AAC3E,QAAM,WAAW,KAAK,KAAK,KAAK,SAAS,wBAAwB,OAAO,GAAG;AAC3E,QAAM,QAAQ,KAAK;AACb,QAAA,aAAa,WAAW,MAAM,IAAI;AAEpC,MAAA;AAEJ,MAAI,QAAQ,YAAY;AACZ,eAAA;AAAA;AAAA,cAEC;AAAA;AAAA;AAAA,oBAGM;AAAA;AAAA,iBAEH,yCAAyC;AAAA;AAAA;AAAA,uBAGnC,MAAM;AAAA;AAAA,WAElB,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAML,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAAA,OAEZ;AACK,eAAA;AAAA;AAAA,oCAEuB,oBAAoB;AAAA,iEACS,qBAAqB;AAAA,gBACtE;AAAA;AAAA,WAEL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpB;AAAA;AAAA,EAElB;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACG,QAAA,MAAM,QAAQ,QAAQ,iBAC3B,KAAK,WACL,WAAW,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAGtC,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,gBAAgB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,IACzC,oBAAoB,EAAE,KAAK,MAAM,GAAG,SAAS;AAAA,EAC7C,CAAA,CAAC;AAIF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,yBAAyB,OAAO;AAAA,IAChC,4BAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
-
const buildSliceLibraryIndexFileContents = require("../lib/buildSliceLibraryIndexFileContents.cjs");
|
|
5
4
|
const pascalCase = require("../lib/pascalCase.cjs");
|
|
6
5
|
const rejectIfNecessary = require("../lib/rejectIfNecessary.cjs");
|
|
7
6
|
const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
|
|
7
|
+
const upsertSliceLibraryIndexFile = require("../lib/upsertSliceLibraryIndexFile.cjs");
|
|
8
8
|
function _interopNamespace(e) {
|
|
9
9
|
if (e && e.__esModule)
|
|
10
10
|
return e;
|
|
@@ -25,24 +25,14 @@ function _interopNamespace(e) {
|
|
|
25
25
|
}
|
|
26
26
|
const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
|
|
27
27
|
const deleteSliceDir = async ({ data, helpers }) => {
|
|
28
|
-
const dir = helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.
|
|
28
|
+
const dir = helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.name));
|
|
29
29
|
await fs__namespace.rm(dir, { recursive: true });
|
|
30
30
|
};
|
|
31
|
-
const updateSliceLibraryIndexFile = async ({ data, actions, helpers, project, options }) => {
|
|
32
|
-
const { filePath, contents } = await buildSliceLibraryIndexFileContents.buildSliceLibraryIndexFileContents({
|
|
33
|
-
libraryID: data.libraryID,
|
|
34
|
-
actions,
|
|
35
|
-
helpers,
|
|
36
|
-
project,
|
|
37
|
-
options
|
|
38
|
-
});
|
|
39
|
-
await fs__namespace.writeFile(filePath, contents);
|
|
40
|
-
};
|
|
41
31
|
const sliceDelete = async (data, context) => {
|
|
42
32
|
await deleteSliceDir({ data, ...context });
|
|
43
33
|
rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
|
|
44
34
|
upsertGlobalContentTypes.upsertGlobalContentTypes(context),
|
|
45
|
-
|
|
35
|
+
upsertSliceLibraryIndexFile.upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
|
|
46
36
|
]));
|
|
47
37
|
};
|
|
48
38
|
exports.sliceDelete = sliceDelete;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-delete.cjs","sources":["../../src/hooks/slice-delete.ts"],"sourcesContent":["import type {\n\tSliceDeleteHook,\n\tSliceDeleteHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"slice-delete.cjs","sources":["../../src/hooks/slice-delete.ts"],"sourcesContent":["import type {\n\tSliceDeleteHook,\n\tSliceDeleteHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceDeleteHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst deleteSliceDir = async ({ data, helpers }: Args) => {\n\tconst dir = helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.rm(dir, { recursive: true });\n};\n\nexport const sliceDelete: SliceDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait deleteSliceDir({ data, ...context });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":["pascalCase","fs","rejectIfNecessary","upsertGlobalContentTypes","upsertSliceLibraryIndexFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,iBAAiB,OAAO,EAAE,MAAM,cAAmB;AAClD,QAAA,MAAM,QAAQ,iBACnB,KAAK,WACLA,WAAW,WAAA,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAMC,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AACrC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,eAAe,EAAE,MAAM,GAAG,QAAS,CAAA;AAGxCC,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,yBAAAA,yBAAyB,OAAO;AAAA,IAChCC,wDAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;;"}
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
-
import { buildSliceLibraryIndexFileContents } from "../lib/buildSliceLibraryIndexFileContents.js";
|
|
3
2
|
import { pascalCase } from "../lib/pascalCase.js";
|
|
4
3
|
import { rejectIfNecessary } from "../lib/rejectIfNecessary.js";
|
|
5
4
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
|
|
5
|
+
import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile.js";
|
|
6
6
|
const deleteSliceDir = async ({ data, helpers }) => {
|
|
7
|
-
const dir = helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.
|
|
7
|
+
const dir = helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.name));
|
|
8
8
|
await fs.rm(dir, { recursive: true });
|
|
9
9
|
};
|
|
10
|
-
const updateSliceLibraryIndexFile = async ({ data, actions, helpers, project, options }) => {
|
|
11
|
-
const { filePath, contents } = await buildSliceLibraryIndexFileContents({
|
|
12
|
-
libraryID: data.libraryID,
|
|
13
|
-
actions,
|
|
14
|
-
helpers,
|
|
15
|
-
project,
|
|
16
|
-
options
|
|
17
|
-
});
|
|
18
|
-
await fs.writeFile(filePath, contents);
|
|
19
|
-
};
|
|
20
10
|
const sliceDelete = async (data, context) => {
|
|
21
11
|
await deleteSliceDir({ data, ...context });
|
|
22
12
|
rejectIfNecessary(await Promise.allSettled([
|
|
23
13
|
upsertGlobalContentTypes(context),
|
|
24
|
-
|
|
14
|
+
upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
|
|
25
15
|
]));
|
|
26
16
|
};
|
|
27
17
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-delete.js","sources":["../../src/hooks/slice-delete.ts"],"sourcesContent":["import type {\n\tSliceDeleteHook,\n\tSliceDeleteHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"slice-delete.js","sources":["../../src/hooks/slice-delete.ts"],"sourcesContent":["import type {\n\tSliceDeleteHook,\n\tSliceDeleteHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceDeleteHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst deleteSliceDir = async ({ data, helpers }: Args) => {\n\tconst dir = helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.name),\n\t);\n\n\tawait fs.rm(dir, { recursive: true });\n};\n\nexport const sliceDelete: SliceDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait deleteSliceDir({ data, ...context });\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertGlobalContentTypes(context),\n\t\t\tupsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context }),\n\t\t]),\n\t);\n};\n"],"names":[],"mappings":";;;;;AAkBA,MAAM,iBAAiB,OAAO,EAAE,MAAM,cAAmB;AAClD,QAAA,MAAM,QAAQ,iBACnB,KAAK,WACL,WAAW,KAAK,MAAM,IAAI,CAAC;AAG5B,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AACrC;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,eAAe,EAAE,MAAM,GAAG,QAAS,CAAA;AAGxC,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,yBAAyB,OAAO;AAAA,IAChC,4BAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;"}
|
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const isSharedSliceModel = require("../lib/isSharedSliceModel.cjs");
|
|
3
6
|
const readJSONFile = require("../lib/readJSONFile.cjs");
|
|
4
|
-
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule)
|
|
9
|
+
return e;
|
|
10
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
+
if (e) {
|
|
12
|
+
for (const k in e) {
|
|
13
|
+
if (k !== "default") {
|
|
14
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: () => e[k]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
|
|
26
|
+
const path__namespace = /* @__PURE__ */ _interopNamespace(path);
|
|
5
27
|
const sliceRead = async (data, { helpers }) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
28
|
+
const libraryDir = helpers.joinPathFromRoot(data.libraryID);
|
|
29
|
+
await fs__namespace.mkdir(libraryDir, { recursive: true });
|
|
30
|
+
const childDirs = await fs__namespace.readdir(libraryDir, { withFileTypes: true });
|
|
31
|
+
const [model] = (await Promise.all(childDirs.map(async (childDir) => {
|
|
32
|
+
if (childDir.isDirectory()) {
|
|
33
|
+
const modelPath = path__namespace.join(libraryDir, childDir.name, "model.json");
|
|
34
|
+
const modelContents = await readJSONFile.readJSONFile(modelPath);
|
|
35
|
+
if (isSharedSliceModel.isSharedSliceModel(modelContents) && modelContents.id === data.sliceID) {
|
|
36
|
+
return modelContents;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}))).filter((model2) => Boolean(model2));
|
|
40
|
+
if (model) {
|
|
41
|
+
return {
|
|
42
|
+
model
|
|
43
|
+
};
|
|
44
|
+
} else {
|
|
45
|
+
throw new Error(`Did not find a Slice model with ID "${data.sliceID}" in the "${data.libraryID}" Slice Library.`);
|
|
46
|
+
}
|
|
11
47
|
};
|
|
12
48
|
exports.sliceRead = sliceRead;
|
|
13
49
|
//# sourceMappingURL=slice-read.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-read.cjs","sources":["../../src/hooks/slice-read.ts"],"sourcesContent":["import type { SliceReadHook } from \"@slicemachine/plugin-kit\";\nimport * as
|
|
1
|
+
{"version":3,"file":"slice-read.cjs","sources":["../../src/hooks/slice-read.ts"],"sourcesContent":["import type { SliceReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { isSharedSliceModel } from \"../lib/isSharedSliceModel\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRead: SliceReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst libraryDir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(libraryDir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t// Find the first matching model.\n\tconst [model] = (\n\t\tawait Promise.all(\n\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\tconst modelPath = path.join(libraryDir, childDir.name, \"model.json\");\n\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\tmodelContents.id === data.sliceID\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\tif (model) {\n\t\treturn {\n\t\t\tmodel,\n\t\t};\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Did not find a Slice model with ID \"${data.sliceID}\" in the \"${data.libraryID}\" Slice Library.`,\n\t\t);\n\t}\n};\n"],"names":["fs","path","readJSONFile","isSharedSliceModel","model"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,YAA0C,OACtD,MACA,EAAE,cACC;AACH,QAAM,aAAa,QAAQ,iBAAiB,KAAK,SAAS;AAG1D,QAAMA,cAAG,MAAM,YAAY,EAAE,WAAW,MAAM;AAExC,QAAA,YAAY,MAAMA,cAAG,QAAQ,YAAY,EAAE,eAAe,MAAM;AAGhE,QAAA,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAYC,gBAAK,KAAK,YAAY,SAAS,MAAM,YAAY;AAE7D,YAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAElD,UACCC,mBAAAA,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACM,eAAA;AAAA,MACP;AAAA,IACD;AAAA,EAAA,CACD,CAAC,GAEF,OAAO,CAACC,WAA8C,QAAQA,MAAK,CAAC;AAEtE,MAAI,OAAO;AACH,WAAA;AAAA,MACN;AAAA,IAAA;AAAA,SAEK;AACN,UAAM,IAAI,MACT,uCAAuC,KAAK,oBAAoB,KAAK,2BAA2B;AAAA,EAEjG;AACF;;"}
|
package/dist/hooks/slice-read.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { isSharedSliceModel } from "../lib/isSharedSliceModel.js";
|
|
1
4
|
import { readJSONFile } from "../lib/readJSONFile.js";
|
|
2
|
-
import { pascalCase } from "../lib/pascalCase.js";
|
|
3
5
|
const sliceRead = async (data, { helpers }) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const libraryDir = helpers.joinPathFromRoot(data.libraryID);
|
|
7
|
+
await fs.mkdir(libraryDir, { recursive: true });
|
|
8
|
+
const childDirs = await fs.readdir(libraryDir, { withFileTypes: true });
|
|
9
|
+
const [model] = (await Promise.all(childDirs.map(async (childDir) => {
|
|
10
|
+
if (childDir.isDirectory()) {
|
|
11
|
+
const modelPath = path.join(libraryDir, childDir.name, "model.json");
|
|
12
|
+
const modelContents = await readJSONFile(modelPath);
|
|
13
|
+
if (isSharedSliceModel(modelContents) && modelContents.id === data.sliceID) {
|
|
14
|
+
return modelContents;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}))).filter((model2) => Boolean(model2));
|
|
18
|
+
if (model) {
|
|
19
|
+
return {
|
|
20
|
+
model
|
|
21
|
+
};
|
|
22
|
+
} else {
|
|
23
|
+
throw new Error(`Did not find a Slice model with ID "${data.sliceID}" in the "${data.libraryID}" Slice Library.`);
|
|
24
|
+
}
|
|
9
25
|
};
|
|
10
26
|
export {
|
|
11
27
|
sliceRead
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-read.js","sources":["../../src/hooks/slice-read.ts"],"sourcesContent":["import type { SliceReadHook } from \"@slicemachine/plugin-kit\";\nimport * as
|
|
1
|
+
{"version":3,"file":"slice-read.js","sources":["../../src/hooks/slice-read.ts"],"sourcesContent":["import type { SliceReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { isSharedSliceModel } from \"../lib/isSharedSliceModel\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRead: SliceReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst libraryDir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(libraryDir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t// Find the first matching model.\n\tconst [model] = (\n\t\tawait Promise.all(\n\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\tconst modelPath = path.join(libraryDir, childDir.name, \"model.json\");\n\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\tmodelContents.id === data.sliceID\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\tif (model) {\n\t\treturn {\n\t\t\tmodel,\n\t\t};\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Did not find a Slice model with ID \"${data.sliceID}\" in the \"${data.libraryID}\" Slice Library.`,\n\t\t);\n\t}\n};\n"],"names":["model"],"mappings":";;;;AASO,MAAM,YAA0C,OACtD,MACA,EAAE,cACC;AACH,QAAM,aAAa,QAAQ,iBAAiB,KAAK,SAAS;AAG1D,QAAM,GAAG,MAAM,YAAY,EAAE,WAAW,MAAM;AAExC,QAAA,YAAY,MAAM,GAAG,QAAQ,YAAY,EAAE,eAAe,MAAM;AAGhE,QAAA,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAY,KAAK,KAAK,YAAY,SAAS,MAAM,YAAY;AAE7D,YAAA,gBAAgB,MAAM,aAAa,SAAS;AAElD,UACC,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACM,eAAA;AAAA,MACP;AAAA,IACD;AAAA,EAAA,CACD,CAAC,GAEF,OAAO,CAACA,WAA8C,QAAQA,MAAK,CAAC;AAEtE,MAAI,OAAO;AACH,WAAA;AAAA,MACN;AAAA,IAAA;AAAA,SAEK;AACN,UAAM,IAAI,MACT,uCAAuC,KAAK,oBAAoB,KAAK,2BAA2B;AAAA,EAEjG;AACF;"}
|