@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.
Files changed (74) hide show
  1. package/dist/SliceSimulator.d.ts +2 -2
  2. package/dist/hooks/customType-rename.cjs +6 -0
  3. package/dist/hooks/customType-rename.cjs.map +1 -0
  4. package/dist/hooks/customType-rename.d.ts +1 -0
  5. package/dist/hooks/customType-rename.js +6 -0
  6. package/dist/hooks/customType-rename.js.map +1 -0
  7. package/dist/hooks/customTypeLibrary-read.cjs +12 -4
  8. package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
  9. package/dist/hooks/customTypeLibrary-read.js +12 -4
  10. package/dist/hooks/customTypeLibrary-read.js.map +1 -1
  11. package/dist/hooks/slice-create.cjs +14 -24
  12. package/dist/hooks/slice-create.cjs.map +1 -1
  13. package/dist/hooks/slice-create.js +14 -24
  14. package/dist/hooks/slice-create.js.map +1 -1
  15. package/dist/hooks/slice-delete.cjs +3 -13
  16. package/dist/hooks/slice-delete.cjs.map +1 -1
  17. package/dist/hooks/slice-delete.js +3 -13
  18. package/dist/hooks/slice-delete.js.map +1 -1
  19. package/dist/hooks/slice-read.cjs +42 -6
  20. package/dist/hooks/slice-read.cjs.map +1 -1
  21. package/dist/hooks/slice-read.js +22 -6
  22. package/dist/hooks/slice-read.js.map +1 -1
  23. package/dist/hooks/slice-rename.cjs +45 -0
  24. package/dist/hooks/slice-rename.cjs.map +1 -0
  25. package/dist/hooks/slice-rename.d.ts +3 -0
  26. package/dist/hooks/slice-rename.js +26 -0
  27. package/dist/hooks/slice-rename.js.map +1 -0
  28. package/dist/hooks/slice-update.cjs +6 -33
  29. package/dist/hooks/slice-update.cjs.map +1 -1
  30. package/dist/hooks/slice-update.js +6 -13
  31. package/dist/hooks/slice-update.js.map +1 -1
  32. package/dist/hooks/sliceLibrary-read.cjs +12 -14
  33. package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
  34. package/dist/hooks/sliceLibrary-read.js +12 -13
  35. package/dist/hooks/sliceLibrary-read.js.map +1 -1
  36. package/dist/lib/isSharedSliceModel.cjs +27 -0
  37. package/dist/lib/isSharedSliceModel.cjs.map +1 -0
  38. package/dist/lib/isSharedSliceModel.d.ts +2 -0
  39. package/dist/lib/isSharedSliceModel.js +8 -0
  40. package/dist/lib/isSharedSliceModel.js.map +1 -0
  41. package/dist/lib/updateSliceModelFile.cjs +33 -0
  42. package/dist/lib/updateSliceModelFile.cjs.map +1 -0
  43. package/dist/lib/updateSliceModelFile.d.ts +9 -0
  44. package/dist/lib/updateSliceModelFile.js +14 -0
  45. package/dist/lib/updateSliceModelFile.js.map +1 -0
  46. package/dist/lib/upsertGlobalContentTypes.d.ts +1 -1
  47. package/dist/lib/upsertSliceLibraryIndexFile.cjs +47 -0
  48. package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -0
  49. package/dist/lib/upsertSliceLibraryIndexFile.d.ts +7 -0
  50. package/dist/lib/upsertSliceLibraryIndexFile.js +28 -0
  51. package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -0
  52. package/dist/plugin.cjs +4 -0
  53. package/dist/plugin.cjs.map +1 -1
  54. package/dist/plugin.js +4 -0
  55. package/dist/plugin.js.map +1 -1
  56. package/dist/types.d.ts +1 -1
  57. package/package.json +14 -12
  58. package/src/hooks/customType-rename.ts +3 -0
  59. package/src/hooks/customTypeLibrary-read.ts +13 -4
  60. package/src/hooks/slice-create.ts +14 -32
  61. package/src/hooks/slice-delete.ts +3 -21
  62. package/src/hooks/slice-read.ts +37 -11
  63. package/src/hooks/slice-rename.ts +44 -0
  64. package/src/hooks/slice-update.ts +7 -31
  65. package/src/hooks/sliceLibrary-read.ts +13 -23
  66. package/src/lib/isSharedSliceModel.ts +14 -0
  67. package/src/lib/updateSliceModelFile.ts +32 -0
  68. package/src/lib/{buildSliceLibraryIndexFileContents.ts → upsertSliceLibraryIndexFile.ts} +14 -9
  69. package/src/plugin.ts +4 -0
  70. package/dist/lib/buildSliceLibraryIndexFileContents.cjs +0 -23
  71. package/dist/lib/buildSliceLibraryIndexFileContents.cjs.map +0 -1
  72. package/dist/lib/buildSliceLibraryIndexFileContents.d.ts +0 -10
  73. package/dist/lib/buildSliceLibraryIndexFileContents.js +0 -23
  74. package/dist/lib/buildSliceLibraryIndexFileContents.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fse = require("fs-extra");
4
+ const pascalCase = require("../lib/pascalCase.cjs");
5
+ const rejectIfNecessary = require("../lib/rejectIfNecessary.cjs");
6
+ const updateSliceModelFile = require("../lib/updateSliceModelFile.cjs");
7
+ const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
8
+ const upsertSliceLibraryIndexFile = require("../lib/upsertSliceLibraryIndexFile.cjs");
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule)
11
+ return e;
12
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
+ if (e) {
14
+ for (const k in e) {
15
+ if (k !== "default") {
16
+ const d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: () => e[k]
20
+ });
21
+ }
22
+ }
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+ const fse__namespace = /* @__PURE__ */ _interopNamespace(fse);
28
+ const sliceRename = async (data, context) => {
29
+ const { model: currentModel } = await context.actions.readSliceModel({
30
+ libraryID: data.libraryID,
31
+ sliceID: data.model.id
32
+ });
33
+ await fse__namespace.move(context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(currentModel.name)), context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.name)));
34
+ await updateSliceModelFile.updateSliceModelFile({
35
+ libraryID: data.libraryID,
36
+ model: data.model,
37
+ ...context
38
+ });
39
+ rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
40
+ upsertGlobalContentTypes.upsertGlobalContentTypes(context),
41
+ upsertSliceLibraryIndexFile.upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
42
+ ]));
43
+ };
44
+ exports.sliceRename = sliceRename;
45
+ //# sourceMappingURL=slice-rename.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-rename.cjs","sources":["../../src/hooks/slice-rename.ts"],"sourcesContent":["import type { SliceRenameHook } from \"@slicemachine/plugin-kit\";\nimport * as fse from \"fs-extra\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRename: SliceRenameHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst { model: currentModel } = await context.actions.readSliceModel({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.model.id,\n\t});\n\n\tawait fse.move(\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(currentModel.name),\n\t\t),\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(data.model.name),\n\t\t),\n\t);\n\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\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":["fse","pascalCase","updateSliceModelFile","rejectIfNecessary","upsertGlobalContentTypes","upsertSliceLibraryIndexFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,EAAE,OAAO,aAAA,IAAiB,MAAM,QAAQ,QAAQ,eAAe;AAAA,IACpE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAEK,QAAAA,eAAI,KACT,QAAQ,QAAQ,iBACf,KAAK,WACLC,sBAAW,aAAa,IAAI,CAAC,GAE9B,QAAQ,QAAQ,iBACf,KAAK,WACLA,sBAAW,KAAK,MAAM,IAAI,CAAC,CAC3B;AAGF,QAAMC,0CAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAGAC,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,yBAAAA,yBAAyB,OAAO;AAAA,IAChCC,wDAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;;"}
@@ -0,0 +1,3 @@
1
+ import type { SliceRenameHook } from "@slicemachine/plugin-kit";
2
+ import type { PluginOptions } from "../types";
3
+ export declare const sliceRename: SliceRenameHook<PluginOptions>;
@@ -0,0 +1,26 @@
1
+ import * as fse from "fs-extra";
2
+ import { pascalCase } from "../lib/pascalCase.js";
3
+ import { rejectIfNecessary } from "../lib/rejectIfNecessary.js";
4
+ import { updateSliceModelFile } from "../lib/updateSliceModelFile.js";
5
+ import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
6
+ import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile.js";
7
+ const sliceRename = async (data, context) => {
8
+ const { model: currentModel } = await context.actions.readSliceModel({
9
+ libraryID: data.libraryID,
10
+ sliceID: data.model.id
11
+ });
12
+ await fse.move(context.helpers.joinPathFromRoot(data.libraryID, pascalCase(currentModel.name)), context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.name)));
13
+ await updateSliceModelFile({
14
+ libraryID: data.libraryID,
15
+ model: data.model,
16
+ ...context
17
+ });
18
+ rejectIfNecessary(await Promise.allSettled([
19
+ upsertGlobalContentTypes(context),
20
+ upsertSliceLibraryIndexFile({ libraryID: data.libraryID, ...context })
21
+ ]));
22
+ };
23
+ export {
24
+ sliceRename
25
+ };
26
+ //# sourceMappingURL=slice-rename.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice-rename.js","sources":["../../src/hooks/slice-rename.ts"],"sourcesContent":["import type { SliceRenameHook } from \"@slicemachine/plugin-kit\";\nimport * as fse from \"fs-extra\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceRename: SliceRenameHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst { model: currentModel } = await context.actions.readSliceModel({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.model.id,\n\t});\n\n\tawait fse.move(\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(currentModel.name),\n\t\t),\n\t\tcontext.helpers.joinPathFromRoot(\n\t\t\tdata.libraryID,\n\t\t\tpascalCase(data.model.name),\n\t\t),\n\t);\n\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\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":";;;;;;AAWa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,EAAE,OAAO,aAAA,IAAiB,MAAM,QAAQ,QAAQ,eAAe;AAAA,IACpE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAEK,QAAA,IAAI,KACT,QAAQ,QAAQ,iBACf,KAAK,WACL,WAAW,aAAa,IAAI,CAAC,GAE9B,QAAQ,QAAQ,iBACf,KAAK,WACL,WAAW,KAAK,MAAM,IAAI,CAAC,CAC3B;AAGF,QAAM,qBAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAGA,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,yBAAyB,OAAO;AAAA,IAChC,4BAA4B,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS;AAAA,EACrE,CAAA,CAAC;AAEJ;"}
@@ -1,40 +1,13 @@
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 pascalCase = require("../lib/pascalCase.cjs");
3
+ const updateSliceModelFile = require("../lib/updateSliceModelFile.cjs");
6
4
  const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
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);
27
- const updateModelFile = async ({ dir, data, helpers, options }) => {
28
- const filePath = path__namespace.join(dir, "model.json");
29
- let contents = JSON.stringify(data.model);
30
- if (options.format) {
31
- contents = await helpers.format(contents, filePath);
32
- }
33
- await fs__namespace.writeFile(filePath, contents);
34
- };
35
5
  const sliceUpdate = async (data, context) => {
36
- const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase.pascalCase(data.model.id));
37
- await updateModelFile({ dir, data, ...context });
6
+ await updateSliceModelFile.updateSliceModelFile({
7
+ libraryID: data.libraryID,
8
+ model: data.model,
9
+ ...context
10
+ });
38
11
  await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
39
12
  };
40
13
  exports.sliceUpdate = sliceUpdate;
@@ -1 +1 @@
1
- {"version":3,"file":"slice-update.cjs","sources":["../../src/hooks/slice-update.ts"],"sourcesContent":["import type {\n\tSliceMachineContext,\n\tSliceUpdateHook,\n\tSliceUpdateHookData,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: SliceUpdateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst updateModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"model.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const sliceUpdate: SliceUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.id),\n\t);\n\n\tawait updateModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["path","fs","pascalCase","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,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,MAAA,cAA8C,OAC1D,MACA,YACG;AACG,QAAA,MAAM,QAAQ,QAAQ,iBAC3B,KAAK,WACLC,WAAAA,WAAW,KAAK,MAAM,EAAE,CAAC;AAG1B,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
1
+ {"version":3,"file":"slice-update.cjs","sources":["../../src/hooks/slice-update.ts"],"sourcesContent":["import type { SliceUpdateHook } from \"@slicemachine/plugin-kit\";\n\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceUpdate: SliceUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\n\t});\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["updateSliceModelFile","upsertGlobalContentTypes"],"mappings":";;;;AAOa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAMA,0CAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAED,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
@@ -1,18 +1,11 @@
1
- import * as fs from "node:fs/promises";
2
- import * as path from "node:path";
3
- import { pascalCase } from "../lib/pascalCase.js";
1
+ import { updateSliceModelFile } from "../lib/updateSliceModelFile.js";
4
2
  import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
5
- const updateModelFile = async ({ dir, data, helpers, options }) => {
6
- const filePath = path.join(dir, "model.json");
7
- let contents = JSON.stringify(data.model);
8
- if (options.format) {
9
- contents = await helpers.format(contents, filePath);
10
- }
11
- await fs.writeFile(filePath, contents);
12
- };
13
3
  const sliceUpdate = async (data, context) => {
14
- const dir = context.helpers.joinPathFromRoot(data.libraryID, pascalCase(data.model.id));
15
- await updateModelFile({ dir, data, ...context });
4
+ await updateSliceModelFile({
5
+ libraryID: data.libraryID,
6
+ model: data.model,
7
+ ...context
8
+ });
16
9
  await upsertGlobalContentTypes(context);
17
10
  };
18
11
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"slice-update.js","sources":["../../src/hooks/slice-update.ts"],"sourcesContent":["import type {\n\tSliceMachineContext,\n\tSliceUpdateHook,\n\tSliceUpdateHookData,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: SliceUpdateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst updateModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"model.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const sliceUpdate: SliceUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\n\t\tdata.libraryID,\n\t\tpascalCase(data.model.id),\n\t);\n\n\tawait updateModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;;AAkBA,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,MAAA,cAA8C,OAC1D,MACA,YACG;AACG,QAAA,MAAM,QAAQ,QAAQ,iBAC3B,KAAK,WACL,WAAW,KAAK,MAAM,EAAE,CAAC;AAG1B,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAM,yBAAyB,OAAO;AACvC;"}
1
+ {"version":3,"file":"slice-update.js","sources":["../../src/hooks/slice-update.ts"],"sourcesContent":["import type { SliceUpdateHook } from \"@slicemachine/plugin-kit\";\n\nimport { updateSliceModelFile } from \"../lib/updateSliceModelFile\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceUpdate: SliceUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tawait updateSliceModelFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\t...context,\n\t});\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,cAA8C,OAC1D,MACA,YACG;AACH,QAAM,qBAAqB;AAAA,IAC1B,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ,GAAG;AAAA,EAAA,CACH;AAED,QAAM,yBAAyB,OAAO;AACvC;"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const prismicT = require("@prismicio/types");
4
3
  const fs = require("node:fs/promises");
5
4
  const path = require("node:path");
5
+ const isSharedSliceModel = require("../lib/isSharedSliceModel.cjs");
6
6
  const readJSONFile = require("../lib/readJSONFile.cjs");
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule)
@@ -22,25 +22,23 @@ function _interopNamespace(e) {
22
22
  n.default = e;
23
23
  return Object.freeze(n);
24
24
  }
25
- const prismicT__namespace = /* @__PURE__ */ _interopNamespace(prismicT);
26
25
  const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
27
26
  const path__namespace = /* @__PURE__ */ _interopNamespace(path);
28
- const isSharedSliceModel = (input) => {
29
- return typeof input === "object" && input !== null && "type" in input && input.type === prismicT__namespace.CustomTypeModelSliceType.SharedSlice;
30
- };
31
27
  const sliceLibraryRead = async (data, { helpers }) => {
32
- const dirPath = helpers.joinPathFromRoot(data.libraryID);
33
- await fs__namespace.mkdir(dirPath, { recursive: true });
34
- const childDirs = await fs__namespace.readdir(dirPath);
28
+ const dir = helpers.joinPathFromRoot(data.libraryID);
29
+ await fs__namespace.mkdir(dir, { recursive: true });
30
+ const childDirs = await fs__namespace.readdir(dir, { withFileTypes: true });
35
31
  const sliceIDs = [];
36
32
  await Promise.all(childDirs.map(async (childDir) => {
37
- const modelPath = path__namespace.join(dirPath, childDir, "model.json");
38
- try {
39
- const modelContents = await readJSONFile.readJSONFile(modelPath);
40
- if (isSharedSliceModel(modelContents)) {
41
- sliceIDs.push(modelContents.id);
33
+ if (childDir.isDirectory()) {
34
+ const modelPath = path__namespace.join(dir, childDir.name, "model.json");
35
+ try {
36
+ const modelContents = await readJSONFile.readJSONFile(modelPath);
37
+ if (isSharedSliceModel.isSharedSliceModel(modelContents)) {
38
+ sliceIDs.push(modelContents.id);
39
+ }
40
+ } catch {
42
41
  }
43
- } catch {
44
42
  }
45
43
  }));
46
44
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"sliceLibrary-read.cjs","sources":["../../src/hooks/sliceLibrary-read.ts"],"sourcesContent":["import type { SliceLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isSharedSliceModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.SharedSliceModel => {\n\treturn (\n\t\ttypeof input === \"object\" &&\n\t\tinput !== null &&\n\t\t\"type\" in input &&\n\t\tinput.type === prismicT.CustomTypeModelSliceType.SharedSlice\n\t);\n};\n\nexport const sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dirPath = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst sliceIDs: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst modelPath = path.join(dirPath, childDir, \"model.json\");\n\n\t\t\ttry {\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// noop\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tid: data.libraryID,\n\t\tsliceIDs: sliceIDs.sort(),\n\t};\n};\n"],"names":["prismicT","fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,qBAAqB,CAE1B,UACuC;AAEtC,SAAA,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,MAAM,SAASA,oBAAS,yBAAyB;AAEnD;AAEO,MAAM,mBAAwD,OACpE,MACA,EAAE,cACC;AACH,QAAM,UAAU,QAAQ,iBAAiB,KAAK,SAAS;AAGvD,QAAMC,cAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAMA,cAAG,QAAQ,OAAO;AAE1C,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAChC,UAAM,YAAYC,gBAAK,KAAK,SAAS,UAAU,YAAY;AAEvD,QAAA;AACG,YAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,UAAA,mBAAmB,aAAa,GAAG;AAC7B,iBAAA,KAAK,cAAc,EAAE;AAAA,MAC9B;AAAA,IAAA,QACA;AAAA,IAED;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;;"}
1
+ {"version":3,"file":"sliceLibrary-read.cjs","sources":["../../src/hooks/sliceLibrary-read.ts"],"sourcesContent":["import type { SliceLibraryReadHook } 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 sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dir, { withFileTypes: true });\n\n\tconst sliceIDs: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tif (childDir.isDirectory()) {\n\t\t\t\tconst modelPath = path.join(dir, childDir.name, \"model.json\");\n\n\t\t\t\ttry {\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tid: data.libraryID,\n\t\tsliceIDs: sliceIDs.sort(),\n\t};\n};\n"],"names":["fs","path","readJSONFile","isSharedSliceModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,mBAAwD,OACpE,MACA,EAAE,cACC;AACH,QAAM,MAAM,QAAQ,iBAAiB,KAAK,SAAS;AAGnD,QAAMA,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEjC,QAAA,YAAY,MAAMA,cAAG,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE/D,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAYC,gBAAK,KAAK,KAAK,SAAS,MAAM,YAAY;AAExD,UAAA;AACG,cAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,YAAAC,mBAAAA,mBAAmB,aAAa,GAAG;AAC7B,mBAAA,KAAK,cAAc,EAAE;AAAA,QAC9B;AAAA,MAAA,QACA;AAAA,MAED;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;;"}
@@ -1,23 +1,22 @@
1
- import * as prismicT from "@prismicio/types";
2
1
  import * as fs from "node:fs/promises";
3
2
  import * as path from "node:path";
3
+ import { isSharedSliceModel } from "../lib/isSharedSliceModel.js";
4
4
  import { readJSONFile } from "../lib/readJSONFile.js";
5
- const isSharedSliceModel = (input) => {
6
- return typeof input === "object" && input !== null && "type" in input && input.type === prismicT.CustomTypeModelSliceType.SharedSlice;
7
- };
8
5
  const sliceLibraryRead = async (data, { helpers }) => {
9
- const dirPath = helpers.joinPathFromRoot(data.libraryID);
10
- await fs.mkdir(dirPath, { recursive: true });
11
- const childDirs = await fs.readdir(dirPath);
6
+ const dir = helpers.joinPathFromRoot(data.libraryID);
7
+ await fs.mkdir(dir, { recursive: true });
8
+ const childDirs = await fs.readdir(dir, { withFileTypes: true });
12
9
  const sliceIDs = [];
13
10
  await Promise.all(childDirs.map(async (childDir) => {
14
- const modelPath = path.join(dirPath, childDir, "model.json");
15
- try {
16
- const modelContents = await readJSONFile(modelPath);
17
- if (isSharedSliceModel(modelContents)) {
18
- sliceIDs.push(modelContents.id);
11
+ if (childDir.isDirectory()) {
12
+ const modelPath = path.join(dir, childDir.name, "model.json");
13
+ try {
14
+ const modelContents = await readJSONFile(modelPath);
15
+ if (isSharedSliceModel(modelContents)) {
16
+ sliceIDs.push(modelContents.id);
17
+ }
18
+ } catch {
19
19
  }
20
- } catch {
21
20
  }
22
21
  }));
23
22
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"sliceLibrary-read.js","sources":["../../src/hooks/sliceLibrary-read.ts"],"sourcesContent":["import type { SliceLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isSharedSliceModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is prismicT.SharedSliceModel => {\n\treturn (\n\t\ttypeof input === \"object\" &&\n\t\tinput !== null &&\n\t\t\"type\" in input &&\n\t\tinput.type === prismicT.CustomTypeModelSliceType.SharedSlice\n\t);\n};\n\nexport const sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dirPath = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst sliceIDs: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst modelPath = path.join(dirPath, childDir, \"model.json\");\n\n\t\t\ttry {\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// noop\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tid: data.libraryID,\n\t\tsliceIDs: sliceIDs.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;;AASA,MAAM,qBAAqB,CAE1B,UACuC;AAEtC,SAAA,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,MAAM,SAAS,SAAS,yBAAyB;AAEnD;AAEO,MAAM,mBAAwD,OACpE,MACA,EAAE,cACC;AACH,QAAM,UAAU,QAAQ,iBAAiB,KAAK,SAAS;AAGvD,QAAM,GAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAM,GAAG,QAAQ,OAAO;AAE1C,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAChC,UAAM,YAAY,KAAK,KAAK,SAAS,UAAU,YAAY;AAEvD,QAAA;AACG,YAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,UAAA,mBAAmB,aAAa,GAAG;AAC7B,iBAAA,KAAK,cAAc,EAAE;AAAA,MAC9B;AAAA,IAAA,QACA;AAAA,IAED;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;"}
1
+ {"version":3,"file":"sliceLibrary-read.js","sources":["../../src/hooks/sliceLibrary-read.ts"],"sourcesContent":["import type { SliceLibraryReadHook } 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 sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst dir = helpers.joinPathFromRoot(data.libraryID);\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dir, { withFileTypes: true });\n\n\tconst sliceIDs: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tif (childDir.isDirectory()) {\n\t\t\t\tconst modelPath = path.join(dir, childDir.name, \"model.json\");\n\n\t\t\t\ttry {\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tid: data.libraryID,\n\t\tsliceIDs: sliceIDs.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;;AASO,MAAM,mBAAwD,OACpE,MACA,EAAE,cACC;AACH,QAAM,MAAM,QAAQ,iBAAiB,KAAK,SAAS;AAGnD,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEjC,QAAA,YAAY,MAAM,GAAG,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE/D,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AAC3B,YAAM,YAAY,KAAK,KAAK,KAAK,SAAS,MAAM,YAAY;AAExD,UAAA;AACG,cAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,YAAA,mBAAmB,aAAa,GAAG;AAC7B,mBAAA,KAAK,cAAc,EAAE;AAAA,QAC9B;AAAA,MAAA,QACA;AAAA,MAED;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const prismicT = require("@prismicio/types");
4
+ function _interopNamespace(e) {
5
+ if (e && e.__esModule)
6
+ return e;
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const prismicT__namespace = /* @__PURE__ */ _interopNamespace(prismicT);
23
+ const isSharedSliceModel = (input) => {
24
+ return typeof input === "object" && input !== null && "type" in input && input.type === prismicT__namespace.CustomTypeModelSliceType.SharedSlice && typeof input.id === "string";
25
+ };
26
+ exports.isSharedSliceModel = isSharedSliceModel;
27
+ //# sourceMappingURL=isSharedSliceModel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSharedSliceModel.cjs","sources":["../../src/lib/isSharedSliceModel.ts"],"sourcesContent":["import * as prismicT from \"@prismicio/types\";\n\nexport const isSharedSliceModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\tinput: any,\n): input is prismicT.SharedSliceModel => {\n\treturn (\n\t\ttypeof input === \"object\" &&\n\t\tinput !== null &&\n\t\t\"type\" in input &&\n\t\tinput.type === prismicT.CustomTypeModelSliceType.SharedSlice &&\n\t\ttypeof input.id === \"string\"\n\t);\n};\n"],"names":["prismicT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEa,MAAA,qBAAqB,CAEjC,UACuC;AACvC,SACC,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,MAAM,SAASA,oBAAS,yBAAyB,eACjD,OAAO,MAAM,OAAO;AAEtB;;"}
@@ -0,0 +1,2 @@
1
+ import * as prismicT from "@prismicio/types";
2
+ export declare const isSharedSliceModel: (input: any) => input is prismicT.SharedSliceModel<string, prismicT.SharedSliceModelVariation<string, Record<string, prismicT.CustomTypeModelFieldForGroup>, Record<string, prismicT.CustomTypeModelFieldForGroup>>>;
@@ -0,0 +1,8 @@
1
+ import * as prismicT from "@prismicio/types";
2
+ const isSharedSliceModel = (input) => {
3
+ return typeof input === "object" && input !== null && "type" in input && input.type === prismicT.CustomTypeModelSliceType.SharedSlice && typeof input.id === "string";
4
+ };
5
+ export {
6
+ isSharedSliceModel
7
+ };
8
+ //# sourceMappingURL=isSharedSliceModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSharedSliceModel.js","sources":["../../src/lib/isSharedSliceModel.ts"],"sourcesContent":["import * as prismicT from \"@prismicio/types\";\n\nexport const isSharedSliceModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\tinput: any,\n): input is prismicT.SharedSliceModel => {\n\treturn (\n\t\ttypeof input === \"object\" &&\n\t\tinput !== null &&\n\t\t\"type\" in input &&\n\t\tinput.type === prismicT.CustomTypeModelSliceType.SharedSlice &&\n\t\ttypeof input.id === \"string\"\n\t);\n};\n"],"names":[],"mappings":";AAEa,MAAA,qBAAqB,CAEjC,UACuC;AACvC,SACC,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,MAAM,SAAS,SAAS,yBAAyB,eACjD,OAAO,MAAM,OAAO;AAEtB;"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const fs = require("node:fs/promises");
4
+ const pascalCase = require("./pascalCase.cjs");
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule)
7
+ return e;
8
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
+ if (e) {
10
+ for (const k in e) {
11
+ if (k !== "default") {
12
+ const d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: () => e[k]
16
+ });
17
+ }
18
+ }
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
24
+ const updateSliceModelFile = async ({ libraryID, model, helpers, options }) => {
25
+ const filePath = helpers.joinPathFromRoot(libraryID, pascalCase.pascalCase(model.name), "model.json");
26
+ let contents = JSON.stringify(model);
27
+ if (options.format) {
28
+ contents = await helpers.format(contents, filePath);
29
+ }
30
+ await fs__namespace.writeFile(filePath, contents);
31
+ };
32
+ exports.updateSliceModelFile = updateSliceModelFile;
33
+ //# sourceMappingURL=updateSliceModelFile.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSliceModelFile.cjs","sources":["../../src/lib/updateSliceModelFile.ts"],"sourcesContent":["import { SharedSliceModel } from \"@prismicio/types\";\nimport { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpdateSliceModelFileArgs = {\n\tlibraryID: string;\n\tmodel: SharedSliceModel;\n} & SliceMachineContext<PluginOptions>;\n\nexport const updateSliceModelFile = async ({\n\tlibraryID,\n\tmodel,\n\thelpers,\n\toptions,\n}: UpdateSliceModelFileArgs): Promise<void> => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tlibraryID,\n\t\tpascalCase(model.name),\n\t\t\"model.json\",\n\t);\n\n\tlet contents = JSON.stringify(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"],"names":["pascalCase","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAYO,MAAM,uBAAuB,OAAO,EAC1C,WACA,OACA,SACA,cAC6C;AACvC,QAAA,WAAW,QAAQ,iBACxB,WACAA,sBAAW,MAAM,IAAI,GACrB,YAAY;AAGT,MAAA,WAAW,KAAK,UAAU,KAAK;AAEnC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;;"}
@@ -0,0 +1,9 @@
1
+ import { SharedSliceModel } from "@prismicio/types";
2
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
3
+ import type { PluginOptions } from "../types";
4
+ type UpdateSliceModelFileArgs = {
5
+ libraryID: string;
6
+ model: SharedSliceModel;
7
+ } & SliceMachineContext<PluginOptions>;
8
+ export declare const updateSliceModelFile: ({ libraryID, model, helpers, options, }: UpdateSliceModelFileArgs) => Promise<void>;
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import * as fs from "node:fs/promises";
2
+ import { pascalCase } from "./pascalCase.js";
3
+ const updateSliceModelFile = async ({ libraryID, model, helpers, options }) => {
4
+ const filePath = helpers.joinPathFromRoot(libraryID, pascalCase(model.name), "model.json");
5
+ let contents = JSON.stringify(model);
6
+ if (options.format) {
7
+ contents = await helpers.format(contents, filePath);
8
+ }
9
+ await fs.writeFile(filePath, contents);
10
+ };
11
+ export {
12
+ updateSliceModelFile
13
+ };
14
+ //# sourceMappingURL=updateSliceModelFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSliceModelFile.js","sources":["../../src/lib/updateSliceModelFile.ts"],"sourcesContent":["import { SharedSliceModel } from \"@prismicio/types\";\nimport { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpdateSliceModelFileArgs = {\n\tlibraryID: string;\n\tmodel: SharedSliceModel;\n} & SliceMachineContext<PluginOptions>;\n\nexport const updateSliceModelFile = async ({\n\tlibraryID,\n\tmodel,\n\thelpers,\n\toptions,\n}: UpdateSliceModelFileArgs): Promise<void> => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tlibraryID,\n\t\tpascalCase(model.name),\n\t\t\"model.json\",\n\t);\n\n\tlet contents = JSON.stringify(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"],"names":[],"mappings":";;AAYO,MAAM,uBAAuB,OAAO,EAC1C,WACA,OACA,SACA,cAC6C;AACvC,QAAA,WAAW,QAAQ,iBACxB,WACA,WAAW,MAAM,IAAI,GACrB,YAAY;AAGT,MAAA,WAAW,KAAK,UAAU,KAAK;AAEnC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;"}
@@ -3,7 +3,7 @@ import type { PluginOptions } from "../types";
3
3
  /**
4
4
  * Arguments for `upsertGlobalContentTypes()`.
5
5
  */
6
- declare type UpsertGlobalTypesArgs = Pick<SliceMachineContext<PluginOptions>, "actions" | "helpers" | "options">;
6
+ type UpsertGlobalTypesArgs = Pick<SliceMachineContext<PluginOptions>, "actions" | "helpers" | "options">;
7
7
  /**
8
8
  * Creates a globally accessible TypeScript file containing types representing
9
9
  * the Prismic repository's content.
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const commonTags = require("common-tags");
4
+ const fs = require("node:fs/promises");
5
+ const pascalCase = require("./pascalCase.cjs");
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule)
8
+ return e;
9
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
+ if (e) {
11
+ for (const k in e) {
12
+ if (k !== "default") {
13
+ const d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: () => e[k]
17
+ });
18
+ }
19
+ }
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs);
25
+ const upsertSliceLibraryIndexFile = async (args) => {
26
+ const filePath = args.helpers.joinPathFromRoot(args.libraryID, args.options.typescript ? "index.ts" : "index.js");
27
+ const slices = await args.actions.readAllSliceModelsForLibrary({
28
+ libraryID: args.libraryID
29
+ });
30
+ let contents = commonTags.stripIndent`
31
+ import dynamic from 'next/dynamic'
32
+
33
+ export const components = {
34
+ ${slices.map((slice) => {
35
+ const id = slice.model.id;
36
+ const fileName = pascalCase.pascalCase(slice.model.name);
37
+ return `${id}: dynamic(() => import('./${fileName}')),`;
38
+ })}
39
+ }
40
+ `;
41
+ if (args.options.format) {
42
+ contents = await args.helpers.format(contents, filePath);
43
+ }
44
+ await fs__namespace.writeFile(filePath, contents);
45
+ };
46
+ exports.upsertSliceLibraryIndexFile = upsertSliceLibraryIndexFile;
47
+ //# sourceMappingURL=upsertSliceLibraryIndexFile.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsertSliceLibraryIndexFile.cjs","sources":["../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${slices.map((slice) => {\n\t\t\t\tconst id = slice.model.id;\n\t\t\t\tconst fileName = pascalCase(slice.model.name);\n\n\t\t\t\treturn `${id}: dynamic(() => import('./${fileName}')),`;\n\t\t\t})}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":["stripIndent","pascalCase","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAYa,MAAA,8BAA8B,OAC1C,SACkB;AACZ,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAGlD,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;AAED,MAAI,WAAWA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA,KAIX,OAAO,IAAI,CAAC,UAAS;AAChB,UAAA,KAAK,MAAM,MAAM;AACvB,UAAM,WAAWC,WAAA,WAAW,MAAM,MAAM,IAAI;AAE5C,WAAO,GAAG,+BAA+B;AAAA,EAAA,CACzC;AAAA;AAAA;AAIC,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;;"}
@@ -0,0 +1,7 @@
1
+ import { SliceMachineContext } from "@slicemachine/plugin-kit";
2
+ import { PluginOptions } from "../types";
3
+ type UpsertSliceLibraryIndexFileArgs = {
4
+ libraryID: string;
5
+ } & SliceMachineContext<PluginOptions>;
6
+ export declare const upsertSliceLibraryIndexFile: (args: UpsertSliceLibraryIndexFileArgs) => Promise<void>;
7
+ export {};
@@ -0,0 +1,28 @@
1
+ import { stripIndent } from "common-tags";
2
+ import * as fs from "node:fs/promises";
3
+ import { pascalCase } from "./pascalCase.js";
4
+ const upsertSliceLibraryIndexFile = async (args) => {
5
+ const filePath = args.helpers.joinPathFromRoot(args.libraryID, args.options.typescript ? "index.ts" : "index.js");
6
+ const slices = await args.actions.readAllSliceModelsForLibrary({
7
+ libraryID: args.libraryID
8
+ });
9
+ let contents = stripIndent`
10
+ import dynamic from 'next/dynamic'
11
+
12
+ export const components = {
13
+ ${slices.map((slice) => {
14
+ const id = slice.model.id;
15
+ const fileName = pascalCase(slice.model.name);
16
+ return `${id}: dynamic(() => import('./${fileName}')),`;
17
+ })}
18
+ }
19
+ `;
20
+ if (args.options.format) {
21
+ contents = await args.helpers.format(contents, filePath);
22
+ }
23
+ await fs.writeFile(filePath, contents);
24
+ };
25
+ export {
26
+ upsertSliceLibraryIndexFile
27
+ };
28
+ //# sourceMappingURL=upsertSliceLibraryIndexFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsertSliceLibraryIndexFile.js","sources":["../../src/lib/upsertSliceLibraryIndexFile.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\nimport * as fs from \"node:fs/promises\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype UpsertSliceLibraryIndexFileArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const upsertSliceLibraryIndexFile = async (\n\targs: UpsertSliceLibraryIndexFileArgs,\n): Promise<void> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\n\tconst slices = await args.actions.readAllSliceModelsForLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${slices.map((slice) => {\n\t\t\t\tconst id = slice.model.id;\n\t\t\t\tconst fileName = pascalCase(slice.model.name);\n\n\t\t\t\treturn `${id}: dynamic(() => import('./${fileName}')),`;\n\t\t\t})}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n"],"names":[],"mappings":";;;AAYa,MAAA,8BAA8B,OAC1C,SACkB;AACZ,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAGlD,QAAM,SAAS,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IAC9D,WAAW,KAAK;AAAA,EAAA,CAChB;AAED,MAAI,WAAW;AAAA;AAAA;AAAA;AAAA,KAIX,OAAO,IAAI,CAAC,UAAS;AAChB,UAAA,KAAK,MAAM,MAAM;AACvB,UAAM,WAAW,WAAW,MAAM,MAAM,IAAI;AAE5C,WAAO,GAAG,+BAA+B;AAAA,EAAA,CACzC;AAAA;AAAA;AAIC,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;"}
package/dist/plugin.cjs CHANGED
@@ -9,6 +9,7 @@ const customTypeCreate = require("./hooks/customType-create.cjs");
9
9
  const customTypeDelete = require("./hooks/customType-delete.cjs");
10
10
  const customTypeLibraryRead = require("./hooks/customTypeLibrary-read.cjs");
11
11
  const customTypeRead = require("./hooks/customType-read.cjs");
12
+ const customTypeRename = require("./hooks/customType-rename.cjs");
12
13
  const customTypeUpdate = require("./hooks/customType-update.cjs");
13
14
  const sliceAssetDelete = require("./hooks/slice-asset-delete.cjs");
14
15
  const sliceAssetRead = require("./hooks/slice-asset-read.cjs");
@@ -17,6 +18,7 @@ const sliceCreate = require("./hooks/slice-create.cjs");
17
18
  const sliceDelete = require("./hooks/slice-delete.cjs");
18
19
  const sliceLibraryRead = require("./hooks/sliceLibrary-read.cjs");
19
20
  const sliceRead = require("./hooks/slice-read.cjs");
21
+ const sliceRename = require("./hooks/slice-rename.cjs");
20
22
  const sliceSimulatorSetupRead = require("./hooks/sliceSimulator-setup-read.cjs");
21
23
  const sliceUpdate = require("./hooks/slice-update.cjs");
22
24
  const snippetRead = require("./hooks/snippet-read.cjs");
@@ -30,6 +32,7 @@ const plugin = pluginKit.defineSliceMachinePlugin({
30
32
  setup({ hook }) {
31
33
  hook("slice:create", sliceCreate.sliceCreate);
32
34
  hook("slice:update", sliceUpdate.sliceUpdate);
35
+ hook("slice:rename", sliceRename.sliceRename);
33
36
  hook("slice:delete", sliceDelete.sliceDelete);
34
37
  hook("slice:read", sliceRead.sliceRead);
35
38
  hook("slice:asset:update", sliceAssetUpdate.sliceAssetUpdate);
@@ -38,6 +41,7 @@ const plugin = pluginKit.defineSliceMachinePlugin({
38
41
  hook("slice-library:read", sliceLibraryRead.sliceLibraryRead);
39
42
  hook("custom-type:create", customTypeCreate.customTypeCreate);
40
43
  hook("custom-type:update", customTypeUpdate.customTypeUpdate);
44
+ hook("custom-type:rename", customTypeRename.customTypeRename);
41
45
  hook("custom-type:delete", customTypeDelete.customTypeDelete);
42
46
  hook("custom-type:read", customTypeRead.customTypeRead);
43
47
  hook("custom-type:asset:update", customTypeAssetUpdate.customTypeAssetUpdate);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs","sources":["../src/plugin.ts"],"sourcesContent":["import { defineSliceMachinePlugin } from \"@slicemachine/plugin-kit\";\n\nimport { name as pkgName } from \"../package.json\";\nimport { PluginOptions } from \"./types\";\n\nimport { customTypeAssetDelete } from \"./hooks/customType-asset-delete\";\nimport { customTypeAssetRead } from \"./hooks/customType-asset-read\";\nimport { customTypeAssetUpdate } from \"./hooks/customType-asset-update\";\nimport { customTypeCreate } from \"./hooks/customType-create\";\nimport { customTypeDelete } from \"./hooks/customType-delete\";\nimport { customTypeLibraryRead } from \"./hooks/customTypeLibrary-read\";\nimport { customTypeRead } from \"./hooks/customType-read\";\nimport { customTypeUpdate } from \"./hooks/customType-update\";\nimport { sliceAssetDelete } from \"./hooks/slice-asset-delete\";\nimport { sliceAssetRead } from \"./hooks/slice-asset-read\";\nimport { sliceAssetUpdate } from \"./hooks/slice-asset-update\";\nimport { sliceCreate } from \"./hooks/slice-create\";\nimport { sliceDelete } from \"./hooks/slice-delete\";\nimport { sliceLibraryRead } from \"./hooks/sliceLibrary-read\";\nimport { sliceRead } from \"./hooks/slice-read\";\nimport { sliceSimulatorSetupRead } from \"./hooks/sliceSimulator-setup-read\";\nimport { sliceUpdate } from \"./hooks/slice-update\";\nimport { snippetRead } from \"./hooks/snippet-read\";\n\nexport const plugin = defineSliceMachinePlugin<PluginOptions>({\n\tmeta: {\n\t\tname: pkgName,\n\t},\n\tdefaultOptions: {\n\t\tformat: true,\n\t},\n\tsetup({ hook }) {\n\t\thook(\"slice:create\", sliceCreate);\n\t\thook(\"slice:update\", sliceUpdate);\n\t\thook(\"slice:delete\", sliceDelete);\n\t\thook(\"slice:read\", sliceRead);\n\t\thook(\"slice:asset:update\", sliceAssetUpdate);\n\t\thook(\"slice:asset:delete\", sliceAssetDelete);\n\t\thook(\"slice:asset:read\", sliceAssetRead);\n\t\thook(\"slice-library:read\", sliceLibraryRead);\n\n\t\thook(\"custom-type:create\", customTypeCreate);\n\t\thook(\"custom-type:update\", customTypeUpdate);\n\t\thook(\"custom-type:delete\", customTypeDelete);\n\t\thook(\"custom-type:read\", customTypeRead);\n\t\thook(\"custom-type:asset:update\", customTypeAssetUpdate);\n\t\thook(\"custom-type:asset:delete\", customTypeAssetDelete);\n\t\thook(\"custom-type:asset:read\", customTypeAssetRead);\n\t\thook(\"custom-type-library:read\", customTypeLibraryRead);\n\n\t\thook(\"snippet:read\", snippetRead);\n\n\t\thook(\"slice-simulator:setup:read\", sliceSimulatorSetupRead);\n\t},\n});\n"],"names":["defineSliceMachinePlugin","pkgName","sliceCreate","sliceUpdate","sliceDelete","sliceRead","sliceAssetUpdate","sliceAssetDelete","sliceAssetRead","sliceLibraryRead","customTypeCreate","customTypeUpdate","customTypeDelete","customTypeRead","customTypeAssetUpdate","customTypeAssetDelete","customTypeAssetRead","customTypeLibraryRead","snippetRead","sliceSimulatorSetupRead"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,SAASA,UAAAA,yBAAwC;AAAA,EAC7D,MAAM;AAAA,IACL,MAAMC,SAAA;AAAA,EACN;AAAA,EACD,gBAAgB;AAAA,IACf,QAAQ;AAAA,EACR;AAAA,EACD,MAAM,EAAE,QAAM;AACb,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,cAAcC,UAAAA,SAAS;AAC5B,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,oBAAoBC,eAAAA,cAAc;AACvC,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAE3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,oBAAoBC,eAAAA,cAAc;AACvC,SAAK,4BAA4BC,sBAAAA,qBAAqB;AACtD,SAAK,4BAA4BC,sBAAAA,qBAAqB;AACtD,SAAK,0BAA0BC,oBAAAA,mBAAmB;AAClD,SAAK,4BAA4BC,sBAAAA,qBAAqB;AAEtD,SAAK,gBAAgBC,YAAAA,WAAW;AAEhC,SAAK,8BAA8BC,wBAAAA,uBAAuB;AAAA,EAC3D;AACA,CAAA;;"}
1
+ {"version":3,"file":"plugin.cjs","sources":["../src/plugin.ts"],"sourcesContent":["import { defineSliceMachinePlugin } from \"@slicemachine/plugin-kit\";\n\nimport { name as pkgName } from \"../package.json\";\nimport { PluginOptions } from \"./types\";\n\nimport { customTypeAssetDelete } from \"./hooks/customType-asset-delete\";\nimport { customTypeAssetRead } from \"./hooks/customType-asset-read\";\nimport { customTypeAssetUpdate } from \"./hooks/customType-asset-update\";\nimport { customTypeCreate } from \"./hooks/customType-create\";\nimport { customTypeDelete } from \"./hooks/customType-delete\";\nimport { customTypeLibraryRead } from \"./hooks/customTypeLibrary-read\";\nimport { customTypeRead } from \"./hooks/customType-read\";\nimport { customTypeRename } from \"./hooks/customType-rename\";\nimport { customTypeUpdate } from \"./hooks/customType-update\";\nimport { sliceAssetDelete } from \"./hooks/slice-asset-delete\";\nimport { sliceAssetRead } from \"./hooks/slice-asset-read\";\nimport { sliceAssetUpdate } from \"./hooks/slice-asset-update\";\nimport { sliceCreate } from \"./hooks/slice-create\";\nimport { sliceDelete } from \"./hooks/slice-delete\";\nimport { sliceLibraryRead } from \"./hooks/sliceLibrary-read\";\nimport { sliceRead } from \"./hooks/slice-read\";\nimport { sliceRename } from \"./hooks/slice-rename\";\nimport { sliceSimulatorSetupRead } from \"./hooks/sliceSimulator-setup-read\";\nimport { sliceUpdate } from \"./hooks/slice-update\";\nimport { snippetRead } from \"./hooks/snippet-read\";\n\nexport const plugin = defineSliceMachinePlugin<PluginOptions>({\n\tmeta: {\n\t\tname: pkgName,\n\t},\n\tdefaultOptions: {\n\t\tformat: true,\n\t},\n\tsetup({ hook }) {\n\t\thook(\"slice:create\", sliceCreate);\n\t\thook(\"slice:update\", sliceUpdate);\n\t\thook(\"slice:rename\", sliceRename);\n\t\thook(\"slice:delete\", sliceDelete);\n\t\thook(\"slice:read\", sliceRead);\n\t\thook(\"slice:asset:update\", sliceAssetUpdate);\n\t\thook(\"slice:asset:delete\", sliceAssetDelete);\n\t\thook(\"slice:asset:read\", sliceAssetRead);\n\t\thook(\"slice-library:read\", sliceLibraryRead);\n\n\t\thook(\"custom-type:create\", customTypeCreate);\n\t\thook(\"custom-type:update\", customTypeUpdate);\n\t\thook(\"custom-type:rename\", customTypeRename);\n\t\thook(\"custom-type:delete\", customTypeDelete);\n\t\thook(\"custom-type:read\", customTypeRead);\n\t\thook(\"custom-type:asset:update\", customTypeAssetUpdate);\n\t\thook(\"custom-type:asset:delete\", customTypeAssetDelete);\n\t\thook(\"custom-type:asset:read\", customTypeAssetRead);\n\t\thook(\"custom-type-library:read\", customTypeLibraryRead);\n\n\t\thook(\"snippet:read\", snippetRead);\n\n\t\thook(\"slice-simulator:setup:read\", sliceSimulatorSetupRead);\n\t},\n});\n"],"names":["defineSliceMachinePlugin","pkgName","sliceCreate","sliceUpdate","sliceRename","sliceDelete","sliceRead","sliceAssetUpdate","sliceAssetDelete","sliceAssetRead","sliceLibraryRead","customTypeCreate","customTypeUpdate","customTypeRename","customTypeDelete","customTypeRead","customTypeAssetUpdate","customTypeAssetDelete","customTypeAssetRead","customTypeLibraryRead","snippetRead","sliceSimulatorSetupRead"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BO,MAAM,SAASA,UAAAA,yBAAwC;AAAA,EAC7D,MAAM;AAAA,IACL,MAAMC,SAAA;AAAA,EACN;AAAA,EACD,gBAAgB;AAAA,IACf,QAAQ;AAAA,EACR;AAAA,EACD,MAAM,EAAE,QAAM;AACb,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,gBAAgBC,YAAAA,WAAW;AAChC,SAAK,cAAcC,UAAAA,SAAS;AAC5B,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,oBAAoBC,eAAAA,cAAc;AACvC,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAE3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,sBAAsBC,iBAAAA,gBAAgB;AAC3C,SAAK,oBAAoBC,eAAAA,cAAc;AACvC,SAAK,4BAA4BC,sBAAAA,qBAAqB;AACtD,SAAK,4BAA4BC,sBAAAA,qBAAqB;AACtD,SAAK,0BAA0BC,oBAAAA,mBAAmB;AAClD,SAAK,4BAA4BC,sBAAAA,qBAAqB;AAEtD,SAAK,gBAAgBC,YAAAA,WAAW;AAEhC,SAAK,8BAA8BC,wBAAAA,uBAAuB;AAAA,EAC3D;AACA,CAAA;;"}