@slicemachine/adapter-next 0.0.11 → 0.0.13-dev-plugins-validation.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/{node_modules → _node_modules}/data-uri-to-buffer/dist/index.cjs +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -0
- package/dist/{node_modules → _node_modules}/data-uri-to-buffer/dist/index.js +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/file.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/file.js.map +1 -0
- package/dist/_node_modules/fetch-blob/index.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
- package/dist/_node_modules/node-domexception/index.cjs.map +1 -0
- package/dist/_node_modules/node-domexception/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/base.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
- package/dist/hooks/customType-asset-delete.cjs +6 -1
- package/dist/hooks/customType-asset-delete.cjs.map +1 -1
- package/dist/hooks/customType-asset-delete.js +6 -1
- package/dist/hooks/customType-asset-delete.js.map +1 -1
- package/dist/hooks/customType-asset-read.cjs +6 -1
- package/dist/hooks/customType-asset-read.cjs.map +1 -1
- package/dist/hooks/customType-asset-read.js +6 -1
- package/dist/hooks/customType-asset-read.js.map +1 -1
- package/dist/hooks/customType-asset-update.cjs +6 -1
- package/dist/hooks/customType-asset-update.cjs.map +1 -1
- package/dist/hooks/customType-asset-update.js +6 -1
- package/dist/hooks/customType-asset-update.js.map +1 -1
- package/dist/hooks/customType-create.cjs +5 -1
- package/dist/hooks/customType-create.cjs.map +1 -1
- package/dist/hooks/customType-create.js +5 -1
- package/dist/hooks/customType-create.js.map +1 -1
- package/dist/hooks/customType-delete.cjs +5 -1
- package/dist/hooks/customType-delete.cjs.map +1 -1
- package/dist/hooks/customType-delete.js +5 -1
- package/dist/hooks/customType-delete.js.map +1 -1
- package/dist/hooks/customType-read.cjs +20 -1
- package/dist/hooks/customType-read.cjs.map +1 -1
- package/dist/hooks/customType-read.js +3 -1
- package/dist/hooks/customType-read.js.map +1 -1
- package/dist/hooks/customTypeLibrary-read.cjs +2 -1
- package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
- package/dist/hooks/customTypeLibrary-read.js +2 -1
- package/dist/hooks/customTypeLibrary-read.js.map +1 -1
- package/dist/hooks/{command-init.cjs → project-init.cjs} +5 -3
- package/dist/hooks/project-init.cjs.map +1 -0
- package/dist/hooks/project-init.d.ts +3 -0
- package/dist/hooks/{command-init.js → project-init.js} +5 -3
- package/dist/hooks/project-init.js.map +1 -0
- package/dist/hooks/slice-asset-delete.cjs +8 -2
- package/dist/hooks/slice-asset-delete.cjs.map +1 -1
- package/dist/hooks/slice-asset-delete.js +8 -2
- package/dist/hooks/slice-asset-delete.js.map +1 -1
- package/dist/hooks/slice-asset-read.cjs +8 -2
- package/dist/hooks/slice-asset-read.cjs.map +1 -1
- package/dist/hooks/slice-asset-read.js +8 -2
- package/dist/hooks/slice-asset-read.js.map +1 -1
- package/dist/hooks/slice-asset-update.cjs +8 -2
- package/dist/hooks/slice-asset-update.cjs.map +1 -1
- package/dist/hooks/slice-asset-update.js +8 -2
- package/dist/hooks/slice-asset-update.js.map +1 -1
- package/dist/hooks/slice-create.cjs +12 -10
- package/dist/hooks/slice-create.cjs.map +1 -1
- package/dist/hooks/slice-create.js +12 -10
- package/dist/hooks/slice-create.js.map +1 -1
- package/dist/hooks/slice-delete.cjs +6 -2
- package/dist/hooks/slice-delete.cjs.map +1 -1
- package/dist/hooks/slice-delete.js +6 -2
- package/dist/hooks/slice-delete.js.map +1 -1
- package/dist/hooks/slice-read.cjs +5 -1
- package/dist/hooks/slice-read.cjs.map +1 -1
- package/dist/hooks/slice-read.js +5 -1
- package/dist/hooks/slice-read.js.map +1 -1
- package/dist/hooks/slice-rename.cjs +10 -2
- package/dist/hooks/slice-rename.cjs.map +1 -1
- package/dist/hooks/slice-rename.js +10 -2
- package/dist/hooks/slice-rename.js.map +1 -1
- package/dist/hooks/sliceLibrary-read.cjs +5 -1
- package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
- package/dist/hooks/sliceLibrary-read.js +5 -1
- package/dist/hooks/sliceLibrary-read.js.map +1 -1
- package/dist/hooks/sliceSimulator-setup-read.cjs +1 -1
- package/dist/hooks/sliceSimulator-setup-read.js +1 -1
- package/dist/lib/buildCustomTypeAssetPath.cjs +29 -0
- package/dist/lib/buildCustomTypeAssetPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeAssetPath.d.ts +9 -0
- package/dist/lib/buildCustomTypeAssetPath.js +12 -0
- package/dist/lib/buildCustomTypeAssetPath.js.map +1 -0
- package/dist/lib/buildCustomTypeDirectoryPath.cjs +26 -0
- package/dist/lib/buildCustomTypeDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeDirectoryPath.d.ts +8 -0
- package/dist/lib/buildCustomTypeDirectoryPath.js +9 -0
- package/dist/lib/buildCustomTypeDirectoryPath.js.map +1 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.d.ts +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.js +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.js.map +1 -0
- package/dist/lib/buildSliceAssetPath.cjs +34 -0
- package/dist/lib/buildSliceAssetPath.cjs.map +1 -0
- package/dist/lib/buildSliceAssetPath.d.ts +11 -0
- package/dist/lib/buildSliceAssetPath.js +17 -0
- package/dist/lib/buildSliceAssetPath.js.map +1 -0
- package/dist/lib/buildSliceDirectoryPath.cjs +30 -0
- package/dist/lib/buildSliceDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildSliceDirectoryPath.d.ts +10 -0
- package/dist/lib/buildSliceDirectoryPath.js +13 -0
- package/dist/lib/buildSliceDirectoryPath.js.map +1 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.cjs +7 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.d.ts +8 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.js +7 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.js.map +1 -0
- package/dist/lib/updateSliceModelFile.cjs +4 -2
- package/dist/lib/updateSliceModelFile.cjs.map +1 -1
- package/dist/lib/updateSliceModelFile.js +3 -2
- package/dist/lib/updateSliceModelFile.js.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +7 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.js +6 -1
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
- package/dist/plugin.cjs +3 -3
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +3 -3
- package/dist/plugin.js.map +1 -1
- package/package.json +18 -14
- package/src/hooks/customType-asset-delete.ts +7 -5
- package/src/hooks/customType-asset-read.ts +7 -5
- package/src/hooks/customType-asset-update.ts +7 -5
- package/src/hooks/customType-create.ts +5 -1
- package/src/hooks/customType-delete.ts +5 -1
- package/src/hooks/customType-read.ts +4 -3
- package/src/hooks/customTypeLibrary-read.ts +2 -1
- package/src/hooks/{command-init.ts → project-init.ts} +6 -4
- package/src/hooks/slice-asset-delete.ts +8 -6
- package/src/hooks/slice-asset-read.ts +8 -6
- package/src/hooks/slice-asset-update.ts +8 -6
- package/src/hooks/slice-create.ts +12 -17
- package/src/hooks/slice-delete.ts +6 -5
- package/src/hooks/slice-read.ts +5 -1
- package/src/hooks/slice-rename.ts +11 -9
- package/src/hooks/sliceLibrary-read.ts +5 -1
- package/src/lib/buildCustomTypeAssetPath.ts +24 -0
- package/src/lib/buildCustomTypeDirectoryPath.ts +20 -0
- package/src/lib/buildCustomTypeLibraryDirectoryPath.ts +13 -0
- package/src/lib/buildSliceAssetPath.ts +32 -0
- package/src/lib/buildSliceDirectoryPath.ts +26 -0
- package/src/lib/buildSliceLibraryDirectoryPath.ts +14 -0
- package/src/lib/updateSliceModelFile.ts +5 -4
- package/src/lib/upsertSliceLibraryIndexFile.ts +7 -2
- package/src/plugin.ts +2 -2
- package/dist/hooks/command-init.cjs.map +0 -1
- package/dist/hooks/command-init.d.ts +0 -3
- package/dist/hooks/command-init.js.map +0 -1
- package/dist/node_modules/data-uri-to-buffer/dist/index.cjs.map +0 -1
- package/dist/node_modules/data-uri-to-buffer/dist/index.js.map +0 -1
- package/dist/node_modules/fetch-blob/file.cjs.map +0 -1
- package/dist/node_modules/fetch-blob/file.js.map +0 -1
- package/dist/node_modules/fetch-blob/index.cjs.map +0 -1
- package/dist/node_modules/fetch-blob/index.js.map +0 -1
- package/dist/node_modules/fetch-blob/streams.cjs.map +0 -1
- package/dist/node_modules/fetch-blob/streams.js.map +0 -1
- package/dist/node_modules/formdata-polyfill/esm.min.cjs.map +0 -1
- package/dist/node_modules/formdata-polyfill/esm.min.js.map +0 -1
- package/dist/node_modules/node-domexception/index.cjs.map +0 -1
- package/dist/node_modules/node-domexception/index.js.map +0 -1
- package/dist/node_modules/node-fetch/src/body.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/body.js.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/abort-error.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/abort-error.js.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/base.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/base.js.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js.map +0 -1
- package/dist/node_modules/node-fetch/src/headers.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/headers.js.map +0 -1
- package/dist/node_modules/node-fetch/src/index.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/index.js.map +0 -1
- package/dist/node_modules/node-fetch/src/request.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/request.js.map +0 -1
- package/dist/node_modules/node-fetch/src/response.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/response.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is-redirect.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is-redirect.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/referrer.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/referrer.js.map +0 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +0 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +0 -1
- /package/dist/{node_modules → _node_modules}/fetch-blob/file.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/file.js +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/index.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/index.js +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/streams.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/streams.js +0 -0
- /package/dist/{node_modules → _node_modules}/formdata-polyfill/esm.min.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/formdata-polyfill/esm.min.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-domexception/index.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-domexception/index.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/body.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/body.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/abort-error.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/abort-error.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/base.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/base.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/fetch-error.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/fetch-error.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/headers.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/headers.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/index.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/index.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/request.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/request.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/response.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/response.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/get-search.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/get-search.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is-redirect.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is-redirect.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/multipart-parser.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/multipart-parser.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/referrer.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/referrer.js +0 -0
- /package/dist/{node_modules → _node_modules}/web-streams-polyfill/dist/ponyfill.es2018.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/web-streams-polyfill/dist/ponyfill.es2018.js +0 -0
- /package/dist/{package.json.cjs → packages/adapter-next/package.json.cjs} +0 -0
- /package/dist/{package.json.cjs.map → packages/adapter-next/package.json.cjs.map} +0 -0
- /package/dist/{package.json.js → packages/adapter-next/package.json.js} +0 -0
- /package/dist/{package.json.js.map → packages/adapter-next/package.json.js.map} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
+
const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
|
|
4
5
|
function _interopNamespaceDefault(e) {
|
|
5
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
7
|
if (e) {
|
|
@@ -19,7 +20,11 @@ function _interopNamespaceDefault(e) {
|
|
|
19
20
|
}
|
|
20
21
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
21
22
|
const customTypeAssetDelete = async (data, context) => {
|
|
22
|
-
const filePath =
|
|
23
|
+
const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
|
|
24
|
+
customTypeID: data.customTypeID,
|
|
25
|
+
assetID: data.assetID,
|
|
26
|
+
helpers: context.helpers
|
|
27
|
+
});
|
|
23
28
|
await fs__namespace.rm(filePath);
|
|
24
29
|
};
|
|
25
30
|
exports.customTypeAssetDelete = customTypeAssetDelete;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-delete.cjs","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-asset-delete.cjs","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":["buildCustomTypeAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,GAAG,QAAQ;AACrB;;"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
|
|
2
3
|
const customTypeAssetDelete = async (data, context) => {
|
|
3
|
-
const filePath =
|
|
4
|
+
const filePath = buildCustomTypeAssetPath({
|
|
5
|
+
customTypeID: data.customTypeID,
|
|
6
|
+
assetID: data.assetID,
|
|
7
|
+
helpers: context.helpers
|
|
8
|
+
});
|
|
4
9
|
await fs.rm(filePath);
|
|
5
10
|
};
|
|
6
11
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-delete.js","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-asset-delete.js","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
+
const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
|
|
4
5
|
function _interopNamespaceDefault(e) {
|
|
5
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
7
|
if (e) {
|
|
@@ -19,7 +20,11 @@ function _interopNamespaceDefault(e) {
|
|
|
19
20
|
}
|
|
20
21
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
21
22
|
const customTypeAssetRead = async (data, context) => {
|
|
22
|
-
const filePath =
|
|
23
|
+
const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
|
|
24
|
+
customTypeID: data.customTypeID,
|
|
25
|
+
assetID: data.assetID,
|
|
26
|
+
helpers: context.helpers
|
|
27
|
+
});
|
|
23
28
|
const assetData = await fs__namespace.readFile(filePath);
|
|
24
29
|
return {
|
|
25
30
|
data: assetData
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-read.cjs","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-asset-read.cjs","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":["buildCustomTypeAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,sBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAMC,cAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;;"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
|
|
2
3
|
const customTypeAssetRead = async (data, context) => {
|
|
3
|
-
const filePath =
|
|
4
|
+
const filePath = buildCustomTypeAssetPath({
|
|
5
|
+
customTypeID: data.customTypeID,
|
|
6
|
+
assetID: data.assetID,
|
|
7
|
+
helpers: context.helpers
|
|
8
|
+
});
|
|
4
9
|
const assetData = await fs.readFile(filePath);
|
|
5
10
|
return {
|
|
6
11
|
data: assetData
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-read.js","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-asset-read.js","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":[],"mappings":";;AAOa,MAAA,sBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAM,GAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
4
|
const path = require("node:path");
|
|
5
|
+
const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
|
|
5
6
|
function _interopNamespaceDefault(e) {
|
|
6
7
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
8
|
if (e) {
|
|
@@ -21,7 +22,11 @@ function _interopNamespaceDefault(e) {
|
|
|
21
22
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
22
23
|
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
23
24
|
const customTypeAssetUpdate = async (data, context) => {
|
|
24
|
-
const filePath =
|
|
25
|
+
const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
|
|
26
|
+
customTypeID: data.customTypeID,
|
|
27
|
+
assetID: data.asset.id,
|
|
28
|
+
helpers: context.helpers
|
|
29
|
+
});
|
|
25
30
|
await fs__namespace.mkdir(path__namespace.dirname(filePath), { recursive: true });
|
|
26
31
|
await fs__namespace.writeFile(filePath, data.asset.data);
|
|
27
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-update.cjs","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-asset-update.cjs","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":["buildCustomTypeAssetPath","fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAMD,cAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;;"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
|
|
3
4
|
const customTypeAssetUpdate = async (data, context) => {
|
|
4
|
-
const filePath =
|
|
5
|
+
const filePath = buildCustomTypeAssetPath({
|
|
6
|
+
customTypeID: data.customTypeID,
|
|
7
|
+
assetID: data.asset.id,
|
|
8
|
+
helpers: context.helpers
|
|
9
|
+
});
|
|
5
10
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
6
11
|
await fs.writeFile(filePath, data.asset.data);
|
|
7
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-update.js","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-asset-update.js","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
4
|
const path = require("node:path");
|
|
5
|
+
const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
|
|
5
6
|
const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -30,7 +31,10 @@ const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
|
30
31
|
await fs__namespace.writeFile(filePath, contents);
|
|
31
32
|
};
|
|
32
33
|
const customTypeCreate = async (data, context) => {
|
|
33
|
-
const dir =
|
|
34
|
+
const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
|
|
35
|
+
customTypeID: data.model.id,
|
|
36
|
+
helpers: context.helpers
|
|
37
|
+
});
|
|
34
38
|
await fs__namespace.mkdir(dir, { recursive: true });
|
|
35
39
|
await createModelFile({ dir, data, ...context });
|
|
36
40
|
await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-create.cjs","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.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 customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir =
|
|
1
|
+
{"version":3,"file":"customType-create.cjs","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.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 customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["path","fs","buildCustomTypeDirectoryPath","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,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMC,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMD,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAME,yBAAAA,yBAAyB,OAAO;AACvC;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
|
|
3
4
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
|
|
4
5
|
const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
5
6
|
const filePath = path.join(dir, "index.json");
|
|
@@ -10,7 +11,10 @@ const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
|
10
11
|
await fs.writeFile(filePath, contents);
|
|
11
12
|
};
|
|
12
13
|
const customTypeCreate = async (data, context) => {
|
|
13
|
-
const dir =
|
|
14
|
+
const dir = buildCustomTypeDirectoryPath({
|
|
15
|
+
customTypeID: data.model.id,
|
|
16
|
+
helpers: context.helpers
|
|
17
|
+
});
|
|
14
18
|
await fs.mkdir(dir, { recursive: true });
|
|
15
19
|
await createModelFile({ dir, data, ...context });
|
|
16
20
|
await upsertGlobalContentTypes(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-create.js","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.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 customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir =
|
|
1
|
+
{"version":3,"file":"customType-create.js","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.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 customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ 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,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAM,yBAAyB,OAAO;AACvC;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
+
const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
|
|
4
5
|
const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
|
|
5
6
|
function _interopNamespaceDefault(e) {
|
|
6
7
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -20,7 +21,10 @@ function _interopNamespaceDefault(e) {
|
|
|
20
21
|
}
|
|
21
22
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
22
23
|
const customTypeDelete = async (data, context) => {
|
|
23
|
-
const dir =
|
|
24
|
+
const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
|
|
25
|
+
customTypeID: data.model.id,
|
|
26
|
+
helpers: context.helpers
|
|
27
|
+
});
|
|
24
28
|
await fs__namespace.rm(dir, { recursive: true });
|
|
25
29
|
await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
|
|
26
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-delete.cjs","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir =
|
|
1
|
+
{"version":3,"file":"customType-delete.cjs","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["buildCustomTypeDirectoryPath","fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMA,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMC,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
|
|
2
3
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
|
|
3
4
|
const customTypeDelete = async (data, context) => {
|
|
4
|
-
const dir =
|
|
5
|
+
const dir = buildCustomTypeDirectoryPath({
|
|
6
|
+
customTypeID: data.model.id,
|
|
7
|
+
helpers: context.helpers
|
|
8
|
+
});
|
|
5
9
|
await fs.rm(dir, { recursive: true });
|
|
6
10
|
await upsertGlobalContentTypes(context);
|
|
7
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-delete.js","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir =
|
|
1
|
+
{"version":3,"file":"customType-delete.js","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAM,yBAAyB,OAAO;AACvC;"}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
|
|
3
5
|
const readJSONFile = require("../lib/readJSONFile.cjs");
|
|
6
|
+
function _interopNamespaceDefault(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 path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
4
23
|
const customTypeRead = async (data, { helpers }) => {
|
|
5
|
-
const filePath =
|
|
24
|
+
const filePath = path__namespace.join(buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
|
|
6
25
|
const model = await readJSONFile.readJSONFile(filePath);
|
|
7
26
|
return {
|
|
8
27
|
model
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-read.cjs","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-read.cjs","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":["path","buildCustomTypeDirectoryPath","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAWA,gBAAK,KACrBC,6BAA6B,6BAAA,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAMC,0BAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
|
|
1
3
|
import { readJSONFile } from "../lib/readJSONFile.js";
|
|
2
4
|
const customTypeRead = async (data, { helpers }) => {
|
|
3
|
-
const filePath =
|
|
5
|
+
const filePath = path.join(buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
|
|
4
6
|
const model = await readJSONFile(filePath);
|
|
5
7
|
return {
|
|
6
8
|
model
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-read.js","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath =
|
|
1
|
+
{"version":3,"file":"customType-read.js","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":[],"mappings":";;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAW,KAAK,KACrB,6BAA6B,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAM,aAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
4
|
const path = require("node:path");
|
|
5
|
+
const buildCustomTypeLibraryDirectoryPath = require("../lib/buildCustomTypeLibraryDirectoryPath.cjs");
|
|
5
6
|
const readJSONFile = require("../lib/readJSONFile.cjs");
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -25,7 +26,7 @@ const isCustomTypeModel = (input) => {
|
|
|
25
26
|
return typeof input === "object" && input !== null && "json" in input;
|
|
26
27
|
};
|
|
27
28
|
const customTypeLibraryRead = async (_data, { helpers }) => {
|
|
28
|
-
const dirPath =
|
|
29
|
+
const dirPath = buildCustomTypeLibraryDirectoryPath.buildCustomTypeLibraryDirectoryPath({ helpers });
|
|
29
30
|
await fs__namespace.mkdir(dirPath, { recursive: true });
|
|
30
31
|
const childDirs = await fs__namespace.readdir(dirPath);
|
|
31
32
|
const ids = [];
|
|
@@ -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
|
|
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 { buildCustomTypeLibraryDirectoryPath } from \"../lib/buildCustomTypeLibraryDirectoryPath\";\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 = buildCustomTypeLibraryDirectoryPath({ helpers });\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":["buildCustomTypeLibraryDirectoryPath","fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAChC,QAAM,UAAUA,oCAAAA,oCAAoC,EAAE,QAAS,CAAA;AAG/D,QAAMC,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;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
+
import { buildCustomTypeLibraryDirectoryPath } from "../lib/buildCustomTypeLibraryDirectoryPath.js";
|
|
3
4
|
import { readJSONFile } from "../lib/readJSONFile.js";
|
|
4
5
|
const isCustomTypeModel = (input) => {
|
|
5
6
|
return typeof input === "object" && input !== null && "json" in input;
|
|
6
7
|
};
|
|
7
8
|
const customTypeLibraryRead = async (_data, { helpers }) => {
|
|
8
|
-
const dirPath = helpers
|
|
9
|
+
const dirPath = buildCustomTypeLibraryDirectoryPath({ helpers });
|
|
9
10
|
await fs.mkdir(dirPath, { recursive: true });
|
|
10
11
|
const childDirs = await fs.readdir(dirPath);
|
|
11
12
|
const ids = [];
|
|
@@ -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
|
|
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 { buildCustomTypeLibraryDirectoryPath } from \"../lib/buildCustomTypeLibraryDirectoryPath\";\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 = buildCustomTypeLibraryDirectoryPath({ helpers });\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":";;;;AAUA,MAAM,oBAAoB,CAEzB,UACsC;AACtC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAChC,QAAM,UAAU,oCAAoC,EAAE,QAAS,CAAA;AAG/D,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;"}
|
|
@@ -29,6 +29,8 @@ const installDependencies = async ({ installDependencies: installDependencies2 }
|
|
|
29
29
|
await installDependencies2({
|
|
30
30
|
dependencies: {
|
|
31
31
|
"@prismicio/client": "latest",
|
|
32
|
+
"@prismicio/helpers": "latest",
|
|
33
|
+
"@prismicio/react": "latest",
|
|
32
34
|
"@prismicio/next": "latest"
|
|
33
35
|
}
|
|
34
36
|
});
|
|
@@ -185,12 +187,12 @@ const createSliceSimulatorPage = async ({ helpers, options }) => {
|
|
|
185
187
|
}
|
|
186
188
|
await fs__namespace.writeFile(filePath, contents);
|
|
187
189
|
};
|
|
188
|
-
const
|
|
190
|
+
const projectInit = async ({ installDependencies: _installDependencies }, context) => {
|
|
189
191
|
rejectIfNecessary.rejectIfNecessary(await Promise.allSettled([
|
|
190
192
|
await installDependencies({ installDependencies: _installDependencies }),
|
|
191
193
|
await createPrismicIOFile(context),
|
|
192
194
|
await createSliceSimulatorPage(context)
|
|
193
195
|
]));
|
|
194
196
|
};
|
|
195
|
-
exports.
|
|
196
|
-
//# sourceMappingURL=
|
|
197
|
+
exports.projectInit = projectInit;
|
|
198
|
+
//# sourceMappingURL=project-init.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-init.cjs","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkPathExists } from \"../lib/checkPathExists\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/client\": \"latest\",\n\t\t\t\"@prismicio/helpers\": \"latest\",\n\t\t\t\"@prismicio/react\": \"latest\",\n\t\t\t\"@prismicio/next\": \"latest\",\n\t\t},\n\t});\n\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/types\": \"latest\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype CreatePrismicIOFileArgs = SliceMachineContext<PluginOptions>;\n\nconst createPrismicIOFile = async ({\n\thelpers,\n\toptions,\n}: CreatePrismicIOFileArgs) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tisTypeScriptProject ? \"prismicio.ts\" : \"prismicio.js\",\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tlet contents: string;\n\n\tif (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes: prismic.ClientConfig[\"routes\"] = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config: prismicNext.CreateClientConfig = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t *\n\t\t\t * @type {prismic.ClientConfig[\"routes\"]}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\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\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst srcDirectoryExists = await checkPathExists(\n\t\thelpers.joinPathFromRoot(\"src\"),\n\t);\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tsrcDirectoryExists ? \"src/pages\" : \"pages\",\n\t\t`slice-simulator.${await getJSOrTSXFileExtension({ helpers, options })}`,\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\n\tlet contents = stripIndent`\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\timport { components } from \"../slices\";\n\n\t\tconst SliceSimulatorPage = () => {\n\t\t\treturn (\n\t\t\t\t<SliceSimulator\n\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\texport default SliceSimulatorPage;\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 projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tawait installDependencies({ installDependencies: _installDependencies }),\n\t\t\tawait createPrismicIOFile(context),\n\t\t\tawait createSliceSimulatorPage(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies","checkIsTypeScriptProject","checkPathExists","stripIndent","fs","getJSOrTSXFileExtension","path","rejectIfNecessary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACnB;AAAA,EAAA,CACD;AAED,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,oBAAoB;AAAA,IACpB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,sBAAsB,OAAO,EAClC,SACA,cAC6B;AACvB,QAAA,sBAAsB,MAAMC,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,QAAM,WAAW,QAAQ,iBACxB,sBAAsB,iBAAiB,cAAc;AAGlD,MAAA,MAAMC,gBAAAA,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEG,MAAA;AAEJ,MAAI,qBAAqB;AACb,eAAAC,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAAA,OAiDL;AACK,eAAAA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAmDX;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAIA,MAAM,2BAA2B,OAAO,EACvC,SACA,cACkC;AAClC,QAAM,qBAAqB,MAAMF,gBAAA,gBAChC,QAAQ,iBAAiB,KAAK,CAAC;AAGhC,QAAM,WAAW,QAAQ,iBACxB,qBAAqB,cAAc,SACnC,mBAAmB,MAAMG,wBAAAA,wBAAwB,EAAE,SAAS,QAAA,CAAS,GAAG;AAGrE,MAAA,MAAMH,gBAAAA,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEK,QAAAE,cAAG,MAAME,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAE1D,MAAI,WAAWH,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAiBf,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEO,MAAM,cAA8C,OAC1D,EAAE,qBAAqB,qBAAA,GACvB,YACG;AAEFG,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,MAAM,oBAAoB,EAAE,qBAAqB,sBAAsB;AAAA,IACvE,MAAM,oBAAoB,OAAO;AAAA,IACjC,MAAM,yBAAyB,OAAO;AAAA,EACtC,CAAA,CAAC;AAEJ;;"}
|
|
@@ -9,6 +9,8 @@ const installDependencies = async ({ installDependencies: installDependencies2 }
|
|
|
9
9
|
await installDependencies2({
|
|
10
10
|
dependencies: {
|
|
11
11
|
"@prismicio/client": "latest",
|
|
12
|
+
"@prismicio/helpers": "latest",
|
|
13
|
+
"@prismicio/react": "latest",
|
|
12
14
|
"@prismicio/next": "latest"
|
|
13
15
|
}
|
|
14
16
|
});
|
|
@@ -165,7 +167,7 @@ const createSliceSimulatorPage = async ({ helpers, options }) => {
|
|
|
165
167
|
}
|
|
166
168
|
await fs.writeFile(filePath, contents);
|
|
167
169
|
};
|
|
168
|
-
const
|
|
170
|
+
const projectInit = async ({ installDependencies: _installDependencies }, context) => {
|
|
169
171
|
rejectIfNecessary(await Promise.allSettled([
|
|
170
172
|
await installDependencies({ installDependencies: _installDependencies }),
|
|
171
173
|
await createPrismicIOFile(context),
|
|
@@ -173,6 +175,6 @@ const commandInit = async ({ installDependencies: _installDependencies }, contex
|
|
|
173
175
|
]));
|
|
174
176
|
};
|
|
175
177
|
export {
|
|
176
|
-
|
|
178
|
+
projectInit
|
|
177
179
|
};
|
|
178
|
-
//# sourceMappingURL=
|
|
180
|
+
//# sourceMappingURL=project-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-init.js","sources":["../../../src/hooks/project-init.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type {\n\tProjectInitHook,\n\tProjectInitHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkPathExists } from \"../lib/checkPathExists\";\nimport { getJSOrTSXFileExtension } from \"../lib/getJSOrTSXFileExtension\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\n\nimport type { PluginOptions } from \"../types\";\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\n\ntype InstallDependenciesArgs = {\n\tinstallDependencies: ProjectInitHookData[\"installDependencies\"];\n};\n\nconst installDependencies = async ({\n\tinstallDependencies,\n}: InstallDependenciesArgs) => {\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/client\": \"latest\",\n\t\t\t\"@prismicio/helpers\": \"latest\",\n\t\t\t\"@prismicio/react\": \"latest\",\n\t\t\t\"@prismicio/next\": \"latest\",\n\t\t},\n\t});\n\n\tawait installDependencies({\n\t\tdependencies: {\n\t\t\t\"@prismicio/types\": \"latest\",\n\t\t},\n\t\tdev: true,\n\t});\n};\n\ntype CreatePrismicIOFileArgs = SliceMachineContext<PluginOptions>;\n\nconst createPrismicIOFile = async ({\n\thelpers,\n\toptions,\n}: CreatePrismicIOFileArgs) => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tisTypeScriptProject ? \"prismicio.ts\" : \"prismicio.js\",\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tlet contents: string;\n\n\tif (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes: prismic.ClientConfig[\"routes\"] = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config: prismicNext.CreateClientConfig = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\timport * as prismic from \"@prismicio/client\";\n\t\t\timport * as prismicNext from \"@prismicio/next\";\n\t\t\timport config from \"./slicemachine.config.json\";\n\n\t\t\t/**\n\t\t\t * The project's Prismic repository name.\n\t\t\t */\n\t\t\texport const repositoryName = config.repositoryName;\n\n\t\t\t/**\n\t\t\t * A list of Route Resolver objects that define how a document's \\`url\\` field\n\t\t\t * is resolved.\n\t\t\t *\n\t\t\t * {@link https://prismic.io/docs/route-resolver#route-resolver}\n\t\t\t *\n\t\t\t * @type {prismic.ClientConfig[\"routes\"]}\n\t\t\t */\n\t\t\t// TODO: Update the routes array to match your project's route structure.\n\t\t\tconst routes = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"homepage\",\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tpath: \"/:uid\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Creates a Prismic client for the project's repository. The client is used to\n\t\t\t * query content from the Prismic API.\n\t\t\t *\n\t\t\t * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client.\n\t\t\t */\n\t\t\texport const createClient = (config = {}) => {\n\t\t\t\tconst client = prismic.createClient(repositoryName, {\n\t\t\t\t\troutes,\n\t\t\t\t\t...config,\n\t\t\t\t});\n\n\t\t\t\tprismicNext.enableAutoPreviews({\n\t\t\t\t\tclient,\n\t\t\t\t\tpreviewData: config.previewData,\n\t\t\t\t\treq: config.req,\n\t\t\t\t});\n\n\t\t\t\treturn client;\n\t\t\t};\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\ntype CreateSliceSimulatorPageArgs = SliceMachineContext<PluginOptions>;\n\nconst createSliceSimulatorPage = async ({\n\thelpers,\n\toptions,\n}: CreateSliceSimulatorPageArgs) => {\n\tconst srcDirectoryExists = await checkPathExists(\n\t\thelpers.joinPathFromRoot(\"src\"),\n\t);\n\n\tconst filePath = helpers.joinPathFromRoot(\n\t\tsrcDirectoryExists ? \"src/pages\" : \"pages\",\n\t\t`slice-simulator.${await getJSOrTSXFileExtension({ helpers, options })}`,\n\t);\n\n\tif (await checkPathExists(filePath)) {\n\t\treturn;\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\n\tlet contents = stripIndent`\n\t\timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\timport { SliceZone } from \"@prismicio/react\";\n\n\t\timport { components } from \"../slices\";\n\n\t\tconst SliceSimulatorPage = () => {\n\t\t\treturn (\n\t\t\t\t<SliceSimulator\n\t\t\t\t\tsliceZone={(props) => <SliceZone {...props} components={components} />}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\texport default SliceSimulatorPage;\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 projectInit: ProjectInitHook<PluginOptions> = async (\n\t{ installDependencies: _installDependencies },\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tawait installDependencies({ installDependencies: _installDependencies }),\n\t\t\tawait createPrismicIOFile(context),\n\t\t\tawait createSliceSimulatorPage(context),\n\t\t]),\n\t);\n};\n"],"names":["installDependencies"],"mappings":";;;;;;;AAoBA,MAAM,sBAAsB,OAAO,EAClC,qBAAAA,2BAC6B;AAC7B,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACnB;AAAA,EAAA,CACD;AAED,QAAMA,qBAAoB;AAAA,IACzB,cAAc;AAAA,MACb,oBAAoB;AAAA,IACpB;AAAA,IACD,KAAK;AAAA,EAAA,CACL;AACF;AAIA,MAAM,sBAAsB,OAAO,EAClC,SACA,cAC6B;AACvB,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,QAAM,WAAW,QAAQ,iBACxB,sBAAsB,iBAAiB,cAAc;AAGlD,MAAA,MAAM,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEG,MAAA;AAEJ,MAAI,qBAAqB;AACb,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA,OAiDL;AACK,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmDX;AAED,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAIA,MAAM,2BAA2B,OAAO,EACvC,SACA,cACkC;AAClC,QAAM,qBAAqB,MAAM,gBAChC,QAAQ,iBAAiB,KAAK,CAAC;AAGhC,QAAM,WAAW,QAAQ,iBACxB,qBAAqB,cAAc,SACnC,mBAAmB,MAAM,wBAAwB,EAAE,SAAS,QAAA,CAAS,GAAG;AAGrE,MAAA,MAAM,gBAAgB,QAAQ,GAAG;AACpC;AAAA,EACA;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAE1D,MAAI,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBf,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEO,MAAM,cAA8C,OAC1D,EAAE,qBAAqB,qBAAA,GACvB,YACG;AAEF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,MAAM,oBAAoB,EAAE,qBAAqB,sBAAsB;AAAA,IACvE,MAAM,oBAAoB,OAAO;AAAA,IACjC,MAAM,yBAAyB,OAAO;AAAA,EACtC,CAAA,CAAC;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
-
const
|
|
4
|
+
const buildSliceAssetPath = require("../lib/buildSliceAssetPath.cjs");
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
7
|
if (e) {
|
|
@@ -20,7 +20,13 @@ function _interopNamespaceDefault(e) {
|
|
|
20
20
|
}
|
|
21
21
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
22
22
|
const sliceAssetDelete = async (data, context) => {
|
|
23
|
-
const filePath =
|
|
23
|
+
const filePath = await buildSliceAssetPath.buildSliceAssetPath({
|
|
24
|
+
libraryID: data.libraryID,
|
|
25
|
+
sliceID: data.sliceID,
|
|
26
|
+
assetID: data.assetID,
|
|
27
|
+
helpers: context.helpers,
|
|
28
|
+
actions: context.actions
|
|
29
|
+
});
|
|
24
30
|
await fs__namespace.rm(filePath);
|
|
25
31
|
};
|
|
26
32
|
exports.sliceAssetDelete = sliceAssetDelete;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-asset-delete.cjs","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"slice-asset-delete.cjs","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":["buildSliceAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,MAAMA,wCAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,GAAG,QAAQ;AACrB;;"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { buildSliceAssetPath } from "../lib/buildSliceAssetPath.js";
|
|
3
3
|
const sliceAssetDelete = async (data, context) => {
|
|
4
|
-
const filePath =
|
|
4
|
+
const filePath = await buildSliceAssetPath({
|
|
5
|
+
libraryID: data.libraryID,
|
|
6
|
+
sliceID: data.sliceID,
|
|
7
|
+
assetID: data.assetID,
|
|
8
|
+
helpers: context.helpers,
|
|
9
|
+
actions: context.actions
|
|
10
|
+
});
|
|
5
11
|
await fs.rm(filePath);
|
|
6
12
|
};
|
|
7
13
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-asset-delete.js","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"slice-asset-delete.js","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,MAAM,oBAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
-
const
|
|
4
|
+
const buildSliceAssetPath = require("../lib/buildSliceAssetPath.cjs");
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
7
|
if (e) {
|
|
@@ -20,7 +20,13 @@ function _interopNamespaceDefault(e) {
|
|
|
20
20
|
}
|
|
21
21
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
22
22
|
const sliceAssetRead = async (data, context) => {
|
|
23
|
-
const filePath =
|
|
23
|
+
const filePath = await buildSliceAssetPath.buildSliceAssetPath({
|
|
24
|
+
libraryID: data.libraryID,
|
|
25
|
+
sliceID: data.sliceID,
|
|
26
|
+
assetID: data.assetID,
|
|
27
|
+
helpers: context.helpers,
|
|
28
|
+
actions: context.actions
|
|
29
|
+
});
|
|
24
30
|
const assetData = await fs__namespace.readFile(filePath);
|
|
25
31
|
return {
|
|
26
32
|
data: assetData
|