@prismicio/plugin-kit 0.0.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/dist/_node_modules/lower-case/dist.es2015/index.js +7 -0
- package/dist/_node_modules/lower-case/dist.es2015/index.js.map +1 -0
- package/dist/_node_modules/no-case/dist.es2015/index.js +28 -0
- package/dist/_node_modules/no-case/dist.es2015/index.js.map +1 -0
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js +68 -0
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js.map +1 -0
- package/dist/_node_modules/p-limit/index.js +77 -0
- package/dist/_node_modules/p-limit/index.js.map +1 -0
- package/dist/_node_modules/pascal-case/dist.es2015/index.js +25 -0
- package/dist/_node_modules/pascal-case/dist.es2015/index.js.map +1 -0
- package/dist/_node_modules/tslib/tslib.es6.js +14 -0
- package/dist/_node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/createPluginHookSystem.d.ts +6 -0
- package/dist/createPluginHookSystem.js +8 -0
- package/dist/createPluginHookSystem.js.map +1 -0
- package/dist/createPluginSystemActions.d.ts +46 -0
- package/dist/createPluginSystemActions.js +96 -0
- package/dist/createPluginSystemActions.js.map +1 -0
- package/dist/createPluginSystemContext.d.ts +31 -0
- package/dist/createPluginSystemContext.js +12 -0
- package/dist/createPluginSystemContext.js.map +1 -0
- package/dist/createPluginSystemHelpers.d.ts +37 -0
- package/dist/createPluginSystemHelpers.js +72 -0
- package/dist/createPluginSystemHelpers.js.map +1 -0
- package/dist/createPluginSystemRunner.d.ts +58 -0
- package/dist/createPluginSystemRunner.js +128 -0
- package/dist/createPluginSystemRunner.js.map +1 -0
- package/dist/definePlugin.d.ts +30 -0
- package/dist/definePlugin.js +5 -0
- package/dist/definePlugin.js.map +1 -0
- package/dist/fs/buildCustomTypeDirectoryPath.d.ts +5 -0
- package/dist/fs/buildCustomTypeDirectoryPath.js +9 -0
- package/dist/fs/buildCustomTypeDirectoryPath.js.map +1 -0
- package/dist/fs/buildCustomTypeFilePath.d.ts +5 -0
- package/dist/fs/buildCustomTypeFilePath.js +9 -0
- package/dist/fs/buildCustomTypeFilePath.js.map +1 -0
- package/dist/fs/buildCustomTypeLibraryDirectoryPath.d.ts +6 -0
- package/dist/fs/buildCustomTypeLibraryDirectoryPath.js +8 -0
- package/dist/fs/buildCustomTypeLibraryDirectoryPath.js.map +1 -0
- package/dist/fs/buildSliceDirectoryPath.d.ts +4 -0
- package/dist/fs/buildSliceDirectoryPath.js +12 -0
- package/dist/fs/buildSliceDirectoryPath.js.map +1 -0
- package/dist/fs/buildSliceFilePath.d.ts +5 -0
- package/dist/fs/buildSliceFilePath.js +9 -0
- package/dist/fs/buildSliceFilePath.js.map +1 -0
- package/dist/fs/buildSliceLibraryDirectoryPath.d.ts +7 -0
- package/dist/fs/buildSliceLibraryDirectoryPath.js +8 -0
- package/dist/fs/buildSliceLibraryDirectoryPath.js.map +1 -0
- package/dist/fs/checkHasProjectFile.d.ts +6 -0
- package/dist/fs/checkHasProjectFile.js +9 -0
- package/dist/fs/checkHasProjectFile.js.map +1 -0
- package/dist/fs/checkIsTypeScriptProject.d.ts +4 -0
- package/dist/fs/checkIsTypeScriptProject.js +12 -0
- package/dist/fs/checkIsTypeScriptProject.js.map +1 -0
- package/dist/fs/constants.d.ts +9 -0
- package/dist/fs/constants.js +15 -0
- package/dist/fs/constants.js.map +1 -0
- package/dist/fs/deleteCustomTypeDirectory.d.ts +3 -0
- package/dist/fs/deleteCustomTypeDirectory.js +18 -0
- package/dist/fs/deleteCustomTypeDirectory.js.map +1 -0
- package/dist/fs/deleteProjectFile.d.ts +6 -0
- package/dist/fs/deleteProjectFile.js +10 -0
- package/dist/fs/deleteProjectFile.js.map +1 -0
- package/dist/fs/deleteSliceDirectory.d.ts +3 -0
- package/dist/fs/deleteSliceDirectory.js +18 -0
- package/dist/fs/deleteSliceDirectory.js.map +1 -0
- package/dist/fs/deleteSliceFile.d.ts +3 -0
- package/dist/fs/deleteSliceFile.js +18 -0
- package/dist/fs/deleteSliceFile.js.map +1 -0
- package/dist/fs/index.d.ts +49 -0
- package/dist/fs/index.js +53 -0
- package/dist/fs/index.js.map +1 -0
- package/dist/fs/lib/checkPathExists.d.ts +2 -0
- package/dist/fs/lib/checkPathExists.js +13 -0
- package/dist/fs/lib/checkPathExists.js.map +1 -0
- package/dist/fs/lib/fsLimit.d.ts +31 -0
- package/dist/fs/lib/fsLimit.js +23 -0
- package/dist/fs/lib/fsLimit.js.map +1 -0
- package/dist/fs/lib/isCustomTypeModel.d.ts +2 -0
- package/dist/fs/lib/isCustomTypeModel.js +7 -0
- package/dist/fs/lib/isCustomTypeModel.js.map +1 -0
- package/dist/fs/lib/isSharedSliceModel.d.ts +2 -0
- package/dist/fs/lib/isSharedSliceModel.js +7 -0
- package/dist/fs/lib/isSharedSliceModel.js.map +1 -0
- package/dist/fs/lib/pascalCase.d.ts +8 -0
- package/dist/fs/lib/pascalCase.js +10 -0
- package/dist/fs/lib/pascalCase.js.map +1 -0
- package/dist/fs/lib/readJSONFile.d.ts +1 -0
- package/dist/fs/lib/readJSONFile.js +9 -0
- package/dist/fs/lib/readJSONFile.js.map +1 -0
- package/dist/fs/lib/resolveSliceModel.d.ts +10 -0
- package/dist/fs/lib/resolveSliceModel.js +14 -0
- package/dist/fs/lib/resolveSliceModel.js.map +1 -0
- package/dist/fs/readCustomTypeFile.d.ts +8 -0
- package/dist/fs/readCustomTypeFile.js +14 -0
- package/dist/fs/readCustomTypeFile.js.map +1 -0
- package/dist/fs/readCustomTypeLibrary.d.ts +6 -0
- package/dist/fs/readCustomTypeLibrary.js +53 -0
- package/dist/fs/readCustomTypeLibrary.js.map +1 -0
- package/dist/fs/readCustomTypeModel.d.ts +7 -0
- package/dist/fs/readCustomTypeModel.js +16 -0
- package/dist/fs/readCustomTypeModel.js.map +1 -0
- package/dist/fs/readProjectFile.d.ts +12 -0
- package/dist/fs/readProjectFile.js +9 -0
- package/dist/fs/readProjectFile.js.map +1 -0
- package/dist/fs/readSliceFile.d.ts +8 -0
- package/dist/fs/readSliceFile.js +17 -0
- package/dist/fs/readSliceFile.js.map +1 -0
- package/dist/fs/readSliceLibrary.d.ts +7 -0
- package/dist/fs/readSliceLibrary.js +56 -0
- package/dist/fs/readSliceLibrary.js.map +1 -0
- package/dist/fs/readSliceModel.d.ts +11 -0
- package/dist/fs/readSliceModel.js +46 -0
- package/dist/fs/readSliceModel.js.map +1 -0
- package/dist/fs/renameCustomType.d.ts +3 -0
- package/dist/fs/renameCustomType.js +8 -0
- package/dist/fs/renameCustomType.js.map +1 -0
- package/dist/fs/renameSlice.d.ts +7 -0
- package/dist/fs/renameSlice.js +22 -0
- package/dist/fs/renameSlice.js.map +1 -0
- package/dist/fs/types.d.ts +3 -0
- package/dist/fs/upsertGlobalTypeScriptTypes.d.ts +16 -0
- package/dist/fs/upsertGlobalTypeScriptTypes.js +37 -0
- package/dist/fs/upsertGlobalTypeScriptTypes.js.map +1 -0
- package/dist/fs/writeCustomTypeFile.d.ts +9 -0
- package/dist/fs/writeCustomTypeFile.js +18 -0
- package/dist/fs/writeCustomTypeFile.js.map +1 -0
- package/dist/fs/writeCustomTypeModel.d.ts +12 -0
- package/dist/fs/writeCustomTypeModel.js +14 -0
- package/dist/fs/writeCustomTypeModel.js.map +1 -0
- package/dist/fs/writeProjectFile.d.ts +15 -0
- package/dist/fs/writeProjectFile.js +16 -0
- package/dist/fs/writeProjectFile.js.map +1 -0
- package/dist/fs/writeSliceFile.d.ts +9 -0
- package/dist/fs/writeSliceFile.js +18 -0
- package/dist/fs/writeSliceFile.js.map +1 -0
- package/dist/fs/writeSliceModel.d.ts +11 -0
- package/dist/fs/writeSliceModel.js +13 -0
- package/dist/fs/writeSliceModel.js.map +1 -0
- package/dist/hooks/customType-create.d.ts +28 -0
- package/dist/hooks/customType-delete.d.ts +26 -0
- package/dist/hooks/customType-read.d.ts +32 -0
- package/dist/hooks/customType-rename.d.ts +29 -0
- package/dist/hooks/customType-update.d.ts +29 -0
- package/dist/hooks/customTypeLibrary-read.d.ts +25 -0
- package/dist/hooks/debug.d.ts +22 -0
- package/dist/hooks/project-init.d.ts +35 -0
- package/dist/hooks/slice-create.d.ts +30 -0
- package/dist/hooks/slice-delete.d.ts +26 -0
- package/dist/hooks/slice-read.d.ts +32 -0
- package/dist/hooks/slice-rename.d.ts +26 -0
- package/dist/hooks/slice-update.d.ts +29 -0
- package/dist/hooks/sliceLibrary-read.d.ts +27 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/DecodeError.d.ts +13 -0
- package/dist/lib/DecodeError.js +21 -0
- package/dist/lib/DecodeError.js.map +1 -0
- package/dist/lib/HookSystem.d.ts +93 -0
- package/dist/lib/HookSystem.js +121 -0
- package/dist/lib/HookSystem.js.map +1 -0
- package/dist/lib/decode.d.ts +10 -0
- package/dist/lib/decode.js +16 -0
- package/dist/lib/decode.js.map +1 -0
- package/dist/lib/decodePrismicConfig.d.ts +3 -0
- package/dist/lib/decodePrismicConfig.js +22 -0
- package/dist/lib/decodePrismicConfig.js.map +1 -0
- package/dist/types.d.ts +129 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/package.json +90 -0
- package/src/createPluginHookSystem.ts +9 -0
- package/src/createPluginSystemActions.ts +188 -0
- package/src/createPluginSystemContext.ts +51 -0
- package/src/createPluginSystemHelpers.ts +129 -0
- package/src/createPluginSystemRunner.ts +216 -0
- package/src/definePlugin.ts +48 -0
- package/src/fs/buildCustomTypeDirectoryPath.ts +19 -0
- package/src/fs/buildCustomTypeFilePath.ts +16 -0
- package/src/fs/buildCustomTypeLibraryDirectoryPath.ts +16 -0
- package/src/fs/buildSliceDirectoryPath.ts +25 -0
- package/src/fs/buildSliceFilePath.ts +16 -0
- package/src/fs/buildSliceLibraryDirectoryPath.ts +17 -0
- package/src/fs/checkHasProjectFile.ts +16 -0
- package/src/fs/checkIsTypeScriptProject.ts +16 -0
- package/src/fs/constants.ts +15 -0
- package/src/fs/deleteCustomTypeDirectory.ts +24 -0
- package/src/fs/deleteProjectFile.ts +18 -0
- package/src/fs/deleteSliceDirectory.ts +24 -0
- package/src/fs/deleteSliceFile.ts +24 -0
- package/src/fs/index.ts +103 -0
- package/src/fs/lib/checkPathExists.ts +13 -0
- package/src/fs/lib/fsLimit.ts +72 -0
- package/src/fs/lib/isCustomTypeModel.ts +7 -0
- package/src/fs/lib/isSharedSliceModel.ts +14 -0
- package/src/fs/lib/pascalCase.ts +17 -0
- package/src/fs/lib/readJSONFile.ts +7 -0
- package/src/fs/lib/resolveSliceModel.ts +28 -0
- package/src/fs/readCustomTypeFile.ts +27 -0
- package/src/fs/readCustomTypeLibrary.ts +86 -0
- package/src/fs/readCustomTypeModel.ts +27 -0
- package/src/fs/readProjectFile.ts +24 -0
- package/src/fs/readSliceFile.ts +27 -0
- package/src/fs/readSliceLibrary.ts +91 -0
- package/src/fs/readSliceModel.ts +90 -0
- package/src/fs/renameCustomType.ts +12 -0
- package/src/fs/renameSlice.ts +35 -0
- package/src/fs/types.ts +5 -0
- package/src/fs/upsertGlobalTypeScriptTypes.ts +64 -0
- package/src/fs/writeCustomTypeFile.ts +30 -0
- package/src/fs/writeCustomTypeModel.ts +31 -0
- package/src/fs/writeProjectFile.ts +39 -0
- package/src/fs/writeSliceFile.ts +30 -0
- package/src/fs/writeSliceModel.ts +26 -0
- package/src/hooks/customType-create.ts +42 -0
- package/src/hooks/customType-delete.ts +40 -0
- package/src/hooks/customType-read.ts +46 -0
- package/src/hooks/customType-rename.ts +43 -0
- package/src/hooks/customType-update.ts +43 -0
- package/src/hooks/customTypeLibrary-read.ts +38 -0
- package/src/hooks/debug.ts +31 -0
- package/src/hooks/project-init.ts +48 -0
- package/src/hooks/slice-create.ts +44 -0
- package/src/hooks/slice-delete.ts +40 -0
- package/src/hooks/slice-read.ts +44 -0
- package/src/hooks/slice-rename.ts +40 -0
- package/src/hooks/slice-update.ts +43 -0
- package/src/hooks/sliceLibrary-read.ts +41 -0
- package/src/index.ts +141 -0
- package/src/lib/DecodeError.ts +31 -0
- package/src/lib/HookSystem.ts +277 -0
- package/src/lib/decode.ts +30 -0
- package/src/lib/decodePrismicConfig.ts +26 -0
- package/src/types.ts +175 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export { checkIsTypeScriptProject } from "./checkIsTypeScriptProject.js";
|
|
2
|
+
export { upsertGlobalTypeScriptTypes } from "./upsertGlobalTypeScriptTypes.js";
|
|
3
|
+
export type { UpsertGlobalTypeScriptTypesArgs } from "./upsertGlobalTypeScriptTypes.js";
|
|
4
|
+
export { checkHasProjectFile } from "./checkHasProjectFile.js";
|
|
5
|
+
export type { CheckHasProjectFileArgs } from "./checkHasProjectFile.js";
|
|
6
|
+
export { writeProjectFile } from "./writeProjectFile.js";
|
|
7
|
+
export type { WriteProjectFileArgs } from "./writeProjectFile.js";
|
|
8
|
+
export { readProjectFile } from "./readProjectFile.js";
|
|
9
|
+
export type { ReadProjectFileArgs } from "./readProjectFile.js";
|
|
10
|
+
export { deleteProjectFile } from "./deleteProjectFile.js";
|
|
11
|
+
export type { DeleteProjectFileArgs } from "./deleteProjectFile.js";
|
|
12
|
+
export { buildSliceDirectoryPath } from "./buildSliceDirectoryPath.js";
|
|
13
|
+
export type { BuildSliceDirectoryPathArgs } from "./buildSliceDirectoryPath.js";
|
|
14
|
+
export { buildSliceFilePath } from "./buildSliceFilePath.js";
|
|
15
|
+
export type { BuildSliceFilePathArgs } from "./buildSliceFilePath.js";
|
|
16
|
+
export { buildSliceLibraryDirectoryPath } from "./buildSliceLibraryDirectoryPath.js";
|
|
17
|
+
export type { BuildSliceLibraryDirectoryPathArgs } from "./buildSliceLibraryDirectoryPath.js";
|
|
18
|
+
export { readSliceLibrary } from "./readSliceLibrary.js";
|
|
19
|
+
export type { ReadSliceLibraryArgs, ReadSliceLibraryReturnType, } from "./readSliceLibrary.js";
|
|
20
|
+
export { writeSliceFile } from "./writeSliceFile.js";
|
|
21
|
+
export type { WriteSliceFileArgs } from "./writeSliceFile.js";
|
|
22
|
+
export { writeSliceModel } from "./writeSliceModel.js";
|
|
23
|
+
export type { WriteSliceModelArgs } from "./writeSliceModel.js";
|
|
24
|
+
export { readSliceFile } from "./readSliceFile.js";
|
|
25
|
+
export type { ReadSliceFileArgs } from "./readSliceFile.js";
|
|
26
|
+
export { readSliceModel } from "./readSliceModel.js";
|
|
27
|
+
export type { ReadSliceModelArgs, ReadSliceModelReturnType, } from "./readSliceModel.js";
|
|
28
|
+
export { renameSlice } from "./renameSlice.js";
|
|
29
|
+
export type { RenameSliceArgs } from "./renameSlice.js";
|
|
30
|
+
export { deleteSliceFile } from "./deleteSliceFile.js";
|
|
31
|
+
export type { DeleteSliceFileArgs } from "./deleteSliceFile.js";
|
|
32
|
+
export { deleteSliceDirectory } from "./deleteSliceDirectory.js";
|
|
33
|
+
export type { DeleteSliceDirectoryArgs } from "./deleteSliceDirectory.js";
|
|
34
|
+
export { buildCustomTypeDirectoryPath } from "./buildCustomTypeDirectoryPath.js";
|
|
35
|
+
export type { BuildCustomTypeDirectoryPathArgs } from "./buildCustomTypeDirectoryPath.js";
|
|
36
|
+
export { buildCustomTypeFilePath } from "./buildCustomTypeFilePath.js";
|
|
37
|
+
export type { BuildCustomTypeFilePathArgs } from "./buildCustomTypeFilePath.js";
|
|
38
|
+
export { buildCustomTypeLibraryDirectoryPath } from "./buildCustomTypeLibraryDirectoryPath.js";
|
|
39
|
+
export type { BuildCustomTypeLibraryDirectoryPathArgs } from "./buildCustomTypeLibraryDirectoryPath.js";
|
|
40
|
+
export { readCustomTypeLibrary } from "./readCustomTypeLibrary.js";
|
|
41
|
+
export type { ReadCustomTypeLibraryArgs, ReadCustomTypeLibraryReturnType, } from "./readCustomTypeLibrary.js";
|
|
42
|
+
export { writeCustomTypeModel } from "./writeCustomTypeModel.js";
|
|
43
|
+
export type { WriteCustomTypeModelArgs } from "./writeCustomTypeModel.js";
|
|
44
|
+
export { readCustomTypeModel } from "./readCustomTypeModel.js";
|
|
45
|
+
export type { ReadCustomTypeModelArgs, ReadCustomTypeModelReturnType, } from "./readCustomTypeModel.js";
|
|
46
|
+
export { renameCustomType } from "./renameCustomType.js";
|
|
47
|
+
export type { RenameCustomTypeArgs } from "./renameCustomType.js";
|
|
48
|
+
export { deleteCustomTypeDirectory } from "./deleteCustomTypeDirectory.js";
|
|
49
|
+
export type { DeleteCustomTypeDirectoryArgs } from "./deleteCustomTypeDirectory.js";
|
package/dist/fs/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { checkIsTypeScriptProject } from "./checkIsTypeScriptProject.js";
|
|
2
|
+
import { upsertGlobalTypeScriptTypes } from "./upsertGlobalTypeScriptTypes.js";
|
|
3
|
+
import { checkHasProjectFile } from "./checkHasProjectFile.js";
|
|
4
|
+
import { writeProjectFile } from "./writeProjectFile.js";
|
|
5
|
+
import { readProjectFile } from "./readProjectFile.js";
|
|
6
|
+
import { deleteProjectFile } from "./deleteProjectFile.js";
|
|
7
|
+
import { buildSliceDirectoryPath } from "./buildSliceDirectoryPath.js";
|
|
8
|
+
import { buildSliceFilePath } from "./buildSliceFilePath.js";
|
|
9
|
+
import { buildSliceLibraryDirectoryPath } from "./buildSliceLibraryDirectoryPath.js";
|
|
10
|
+
import { readSliceLibrary } from "./readSliceLibrary.js";
|
|
11
|
+
import { writeSliceFile } from "./writeSliceFile.js";
|
|
12
|
+
import { writeSliceModel } from "./writeSliceModel.js";
|
|
13
|
+
import { readSliceFile } from "./readSliceFile.js";
|
|
14
|
+
import { readSliceModel } from "./readSliceModel.js";
|
|
15
|
+
import { renameSlice } from "./renameSlice.js";
|
|
16
|
+
import { deleteSliceFile } from "./deleteSliceFile.js";
|
|
17
|
+
import { deleteSliceDirectory } from "./deleteSliceDirectory.js";
|
|
18
|
+
import { buildCustomTypeDirectoryPath } from "./buildCustomTypeDirectoryPath.js";
|
|
19
|
+
import { buildCustomTypeFilePath } from "./buildCustomTypeFilePath.js";
|
|
20
|
+
import { buildCustomTypeLibraryDirectoryPath } from "./buildCustomTypeLibraryDirectoryPath.js";
|
|
21
|
+
import { readCustomTypeLibrary } from "./readCustomTypeLibrary.js";
|
|
22
|
+
import { writeCustomTypeModel } from "./writeCustomTypeModel.js";
|
|
23
|
+
import { readCustomTypeModel } from "./readCustomTypeModel.js";
|
|
24
|
+
import { renameCustomType } from "./renameCustomType.js";
|
|
25
|
+
import { deleteCustomTypeDirectory } from "./deleteCustomTypeDirectory.js";
|
|
26
|
+
export {
|
|
27
|
+
buildCustomTypeDirectoryPath,
|
|
28
|
+
buildCustomTypeFilePath,
|
|
29
|
+
buildCustomTypeLibraryDirectoryPath,
|
|
30
|
+
buildSliceDirectoryPath,
|
|
31
|
+
buildSliceFilePath,
|
|
32
|
+
buildSliceLibraryDirectoryPath,
|
|
33
|
+
checkHasProjectFile,
|
|
34
|
+
checkIsTypeScriptProject,
|
|
35
|
+
deleteCustomTypeDirectory,
|
|
36
|
+
deleteProjectFile,
|
|
37
|
+
deleteSliceDirectory,
|
|
38
|
+
deleteSliceFile,
|
|
39
|
+
readCustomTypeLibrary,
|
|
40
|
+
readCustomTypeModel,
|
|
41
|
+
readProjectFile,
|
|
42
|
+
readSliceFile,
|
|
43
|
+
readSliceLibrary,
|
|
44
|
+
readSliceModel,
|
|
45
|
+
renameCustomType,
|
|
46
|
+
renameSlice,
|
|
47
|
+
upsertGlobalTypeScriptTypes,
|
|
48
|
+
writeCustomTypeModel,
|
|
49
|
+
writeProjectFile,
|
|
50
|
+
writeSliceFile,
|
|
51
|
+
writeSliceModel
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkPathExists.js","sources":["../../../../src/fs/lib/checkPathExists.ts"],"sourcesContent":["import { PathLike } from \"node:fs\";\n\nimport * as fs from \"./fsLimit\";\n\nexport async function checkPathExists(path: PathLike): Promise<boolean> {\n\ttry {\n\t\tawait fs.access(path);\n\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],"names":["fs.access"],"mappings":";AAIA,eAAsB,gBAAgB,MAAc;AACnD,MAAI;AACH,UAAMA,OAAU,IAAI;AAEpB,WAAO;AAAA,EACR,QAAQ;AACP,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
export declare const access: typeof fs.access;
|
|
3
|
+
export declare const appendFile: typeof fs.appendFile;
|
|
4
|
+
export declare const chmod: typeof fs.chmod;
|
|
5
|
+
export declare const chown: typeof fs.chown;
|
|
6
|
+
export declare const copyFile: typeof fs.copyFile;
|
|
7
|
+
export declare const cp: typeof fs.cp;
|
|
8
|
+
export declare const lchmod: typeof fs.lchmod;
|
|
9
|
+
export declare const lchown: typeof fs.lchown;
|
|
10
|
+
export declare const link: typeof fs.link;
|
|
11
|
+
export declare const lstat: typeof fs.lstat;
|
|
12
|
+
export declare const lutimes: typeof fs.lutimes;
|
|
13
|
+
export declare const mkdir: typeof fs.mkdir;
|
|
14
|
+
export declare const mkdtemp: typeof fs.mkdtemp;
|
|
15
|
+
export declare const open: typeof fs.open;
|
|
16
|
+
export declare const opendir: typeof fs.opendir;
|
|
17
|
+
export declare const readFile: typeof fs.readFile;
|
|
18
|
+
export declare const readdir: typeof fs.readdir;
|
|
19
|
+
export declare const readlink: typeof fs.readlink;
|
|
20
|
+
export declare const realpath: typeof fs.realpath;
|
|
21
|
+
export declare const rename: typeof fs.rename;
|
|
22
|
+
export declare const rm: typeof fs.rm;
|
|
23
|
+
export declare const rmdir: typeof fs.rmdir;
|
|
24
|
+
export declare const stat: typeof fs.stat;
|
|
25
|
+
export declare const statfs: typeof fs.statfs;
|
|
26
|
+
export declare const symlink: typeof fs.symlink;
|
|
27
|
+
export declare const truncate: typeof fs.truncate;
|
|
28
|
+
export declare const unlink: typeof fs.unlink;
|
|
29
|
+
export declare const utimes: typeof fs.utimes;
|
|
30
|
+
export declare const watch: typeof fs.watch;
|
|
31
|
+
export declare const writeFile: typeof fs.writeFile;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import pLimit from './../../_node_modules/p-limit/index.js';
|
|
3
|
+
const SM_FS_LIMIT = Number.isNaN(Number(process.env.SM_FS_LIMIT)) ? void 0 : Number(process.env.SM_FS_LIMIT);
|
|
4
|
+
const CONCURRENT_FILE_DESCRIPTORS_LIMIT = SM_FS_LIMIT ?? 1024;
|
|
5
|
+
const fsLimit = pLimit(CONCURRENT_FILE_DESCRIPTORS_LIMIT);
|
|
6
|
+
const wrapWithFSLimit = (fn) => {
|
|
7
|
+
return (...args) => fsLimit(() => fn(...args));
|
|
8
|
+
};
|
|
9
|
+
const access = wrapWithFSLimit(fs.access);
|
|
10
|
+
const mkdir = wrapWithFSLimit(fs.mkdir);
|
|
11
|
+
const readFile = wrapWithFSLimit(fs.readFile);
|
|
12
|
+
const readdir = wrapWithFSLimit(fs.readdir);
|
|
13
|
+
const rm = wrapWithFSLimit(fs.rm);
|
|
14
|
+
const writeFile = wrapWithFSLimit(fs.writeFile);
|
|
15
|
+
export {
|
|
16
|
+
access,
|
|
17
|
+
mkdir,
|
|
18
|
+
readFile,
|
|
19
|
+
readdir,
|
|
20
|
+
rm,
|
|
21
|
+
writeFile
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=fsLimit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fsLimit.js","sources":["../../../../src/fs/lib/fsLimit.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nimport pLimit from \"p-limit\";\n\n/**\n * The parsed number value of the SM_FS_LIMIT environment variable.\n */\nconst SM_FS_LIMIT = Number.isNaN(Number(process.env.SM_FS_LIMIT))\n\t? undefined\n\t: Number(process.env.SM_FS_LIMIT);\n\n/**\n * The maximum number of concurrent file descriptors allowed to adapters to\n * minimize issues like `EMFILE: too many open files`.\n *\n * - MacOS default limit: 2560 (recent), 256 (old)\n * - Windows limit (per process): 2048\n */\nconst CONCURRENT_FILE_DESCRIPTORS_LIMIT = SM_FS_LIMIT ?? 1024;\n\n/**\n * Limit concurrent file descriptors for adapters.\n */\nconst fsLimit = pLimit(CONCURRENT_FILE_DESCRIPTORS_LIMIT);\n\n/**\n * Wrap a function with `fsLimit()` to limit concurrent calls. All functions\n * called with `wrapWithFSLimit()` share the same queue.\n *\n * @param fn - The function to wrap.\n *\n * @returns The wrapped function.\n */\nconst wrapWithFSLimit = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTFn extends (...args: any[]) => any,\n>(\n\tfn: TFn,\n): TFn => {\n\treturn ((...args) => fsLimit(() => fn(...args))) as TFn;\n};\n\nexport const access = wrapWithFSLimit(fs.access);\nexport const appendFile = wrapWithFSLimit(fs.appendFile);\nexport const chmod = wrapWithFSLimit(fs.chmod);\nexport const chown = wrapWithFSLimit(fs.chown);\nexport const copyFile = wrapWithFSLimit(fs.copyFile);\nexport const cp = wrapWithFSLimit(fs.cp);\nexport const lchmod = wrapWithFSLimit(fs.lchmod);\nexport const lchown = wrapWithFSLimit(fs.lchown);\nexport const link = wrapWithFSLimit(fs.link);\nexport const lstat = wrapWithFSLimit(fs.lstat);\nexport const lutimes = wrapWithFSLimit(fs.lutimes);\nexport const mkdir = wrapWithFSLimit(fs.mkdir);\nexport const mkdtemp = wrapWithFSLimit(fs.mkdtemp);\nexport const open = wrapWithFSLimit(fs.open);\nexport const opendir = wrapWithFSLimit(fs.opendir);\nexport const readFile = wrapWithFSLimit(fs.readFile);\nexport const readdir = wrapWithFSLimit(fs.readdir);\nexport const readlink = wrapWithFSLimit(fs.readlink);\nexport const realpath = wrapWithFSLimit(fs.realpath);\nexport const rename = wrapWithFSLimit(fs.rename);\nexport const rm = wrapWithFSLimit(fs.rm);\nexport const rmdir = wrapWithFSLimit(fs.rmdir);\nexport const stat = wrapWithFSLimit(fs.stat);\nexport const statfs = wrapWithFSLimit(fs.statfs);\nexport const symlink = wrapWithFSLimit(fs.symlink);\nexport const truncate = wrapWithFSLimit(fs.truncate);\nexport const unlink = wrapWithFSLimit(fs.unlink);\nexport const utimes = wrapWithFSLimit(fs.utimes);\nexport const watch = wrapWithFSLimit(fs.watch);\nexport const writeFile = wrapWithFSLimit(fs.writeFile);\n"],"names":[],"mappings":";;AAOA,MAAM,cAAc,OAAO,MAAM,OAAO,QAAQ,IAAI,WAAW,CAAC,IAC7D,SACA,OAAO,QAAQ,IAAI,WAAW;AASjC,MAAM,oCAAoC,eAAe;AAKzD,MAAM,UAAU,OAAO,iCAAiC;AAUxD,MAAM,kBAAkB,CAIvB,OACQ;AACR,SAAQ,IAAI,SAAS,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC;AAC/C;AAEO,MAAM,SAAS,gBAAgB,GAAG,MAAM;AAWxC,MAAM,QAAQ,gBAAgB,GAAG,KAAK;AAItC,MAAM,WAAW,gBAAgB,GAAG,QAAQ;AAC5C,MAAM,UAAU,gBAAgB,GAAG,OAAO;AAI1C,MAAM,KAAK,gBAAgB,GAAG,EAAE;AAShC,MAAM,YAAY,gBAAgB,GAAG,SAAS;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCustomTypeModel.js","sources":["../../../../src/fs/lib/isCustomTypeModel.ts"],"sourcesContent":["import TypesInternal from \"@prismicio/types-internal/lib/customtypes/index.js\";\n\nexport function isCustomTypeModel(\n\tinput: unknown,\n): input is TypesInternal.CustomType {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n}\n"],"names":[],"mappings":"AAEM,SAAU,kBACf,OAAc;AAEd,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function isSharedSliceModel(input) {
|
|
2
|
+
return typeof input === "object" && input !== null && "type" in input && input.type === "SharedSlice" && "id" in input && typeof input.id === "string";
|
|
3
|
+
}
|
|
4
|
+
export {
|
|
5
|
+
isSharedSliceModel
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=isSharedSliceModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSharedSliceModel.js","sources":["../../../../src/fs/lib/isSharedSliceModel.ts"],"sourcesContent":["import TypesInternal from \"@prismicio/types-internal/lib/customtypes/index.js\";\n\nexport function isSharedSliceModel(\n\tinput: unknown,\n): input is TypesInternal.SharedSlice {\n\treturn (\n\t\ttypeof input === \"object\" &&\n\t\tinput !== null &&\n\t\t\"type\" in input &&\n\t\tinput.type === \"SharedSlice\" &&\n\t\t\"id\" in input &&\n\t\ttypeof input.id === \"string\"\n\t);\n}\n"],"names":[],"mappings":"AAEM,SAAU,mBACf,OAAc;AAEd,SACC,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,MAAM,SAAS,iBACf,QAAQ,SACR,OAAO,MAAM,OAAO;AAEtB;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { pascalCase as pascalCase$1, pascalCaseTransformMerge } from './../../_node_modules/pascal-case/dist.es2015/index.js';
|
|
2
|
+
const pascalCase = (...input) => {
|
|
3
|
+
return pascalCase$1(input.filter(Boolean).join(" "), {
|
|
4
|
+
transform: pascalCaseTransformMerge
|
|
5
|
+
});
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
pascalCase
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=pascalCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pascalCase.js","sources":["../../../../src/fs/lib/pascalCase.ts"],"sourcesContent":["import {\n\tpascalCase as basePascalCase,\n\tpascalCaseTransformMerge,\n} from \"pascal-case\";\n\n/**\n * Converts a string to a Pascal cased string.\n *\n * @param input - String to convert into a Pascal cased string.\n *\n * @returns Pascal cased string version of `input`.\n */\nexport const pascalCase = (...input: (string | undefined)[]): string => {\n\treturn basePascalCase(input.filter(Boolean).join(\" \"), {\n\t\ttransform: pascalCaseTransformMerge,\n\t});\n};\n"],"names":["basePascalCase"],"mappings":";AAYO,MAAM,aAAa,IAAI,UAAyC;AACtE,SAAOA,aAAe,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG;AAAA,IACtD,WAAW;AAAA,EAAA,CACX;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readJSONFile<T = unknown>(path: string): Promise<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readJSONFile.js","sources":["../../../../src/fs/lib/readJSONFile.ts"],"sourcesContent":["import * as fs from \"./fsLimit\";\n\nexport async function readJSONFile<T = unknown>(path: string): Promise<T> {\n\tconst contents = await fs.readFile(path, \"utf8\");\n\n\treturn JSON.parse(contents);\n}\n"],"names":["fs.readFile"],"mappings":";AAEA,eAAsB,aAA0B,MAAY;AAC3D,QAAM,WAAW,MAAMA,SAAY,MAAM,MAAM;AAE/C,SAAO,KAAK,MAAM,QAAQ;AAC3B;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import TypesInternal from "@prismicio/types-internal/lib/customtypes/index.js";
|
|
2
|
+
import { PluginSystemActions } from "../../createPluginSystemActions.js";
|
|
3
|
+
export type ResolveSliceModelArgs = {
|
|
4
|
+
sliceID: string;
|
|
5
|
+
libraryID: string;
|
|
6
|
+
actions: PluginSystemActions;
|
|
7
|
+
} | {
|
|
8
|
+
model: TypesInternal.SharedSlice;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveSliceModel(args: ResolveSliceModelArgs): Promise<TypesInternal.SharedSlice>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
async function resolveSliceModel(args) {
|
|
2
|
+
if ("model" in args) {
|
|
3
|
+
return args.model;
|
|
4
|
+
}
|
|
5
|
+
const { model } = await args.actions.readSliceModel({
|
|
6
|
+
libraryID: args.libraryID,
|
|
7
|
+
sliceID: args.sliceID
|
|
8
|
+
});
|
|
9
|
+
return model;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
resolveSliceModel
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=resolveSliceModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSliceModel.js","sources":["../../../../src/fs/lib/resolveSliceModel.ts"],"sourcesContent":["import TypesInternal from \"@prismicio/types-internal/lib/customtypes/index.js\";\n\nimport { PluginSystemActions } from \"../../createPluginSystemActions\";\n\nexport type ResolveSliceModelArgs =\n\t| {\n\t\t\tsliceID: string;\n\t\t\tlibraryID: string;\n\t\t\tactions: PluginSystemActions;\n\t }\n\t| {\n\t\t\tmodel: TypesInternal.SharedSlice;\n\t };\n\nexport async function resolveSliceModel(\n\targs: ResolveSliceModelArgs,\n): Promise<TypesInternal.SharedSlice> {\n\tif (\"model\" in args) {\n\t\treturn args.model;\n\t}\n\n\tconst { model } = await args.actions.readSliceModel({\n\t\tlibraryID: args.libraryID,\n\t\tsliceID: args.sliceID,\n\t});\n\n\treturn model;\n}\n"],"names":[],"mappings":"AAcA,eAAsB,kBACrB,MAA2B;AAE3B,MAAI,WAAW,MAAM;AACpB,WAAO,KAAK;AAAA,EACb;AAEA,QAAM,EAAE,MAAA,IAAU,MAAM,KAAK,QAAQ,eAAe;AAAA,IACnD,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BuildCustomTypeFilePathArgs } from "./buildCustomTypeFilePath.js";
|
|
2
|
+
import { ReadProjectFileArgs } from "./readProjectFile.js";
|
|
3
|
+
import { BufferEncoding } from "./types.js";
|
|
4
|
+
export type ReadCustomTypeFileArgs = BuildCustomTypeFilePathArgs & ReadProjectFileArgs;
|
|
5
|
+
export declare function readCustomTypeFile(args: ReadCustomTypeFileArgs): Promise<Buffer>;
|
|
6
|
+
export declare function readCustomTypeFile(args: ReadCustomTypeFileArgs & {
|
|
7
|
+
encoding: BufferEncoding;
|
|
8
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buildCustomTypeFilePath } from "./buildCustomTypeFilePath.js";
|
|
2
|
+
import { readProjectFile } from "./readProjectFile.js";
|
|
3
|
+
async function readCustomTypeFile(args) {
|
|
4
|
+
const filePath = buildCustomTypeFilePath(args);
|
|
5
|
+
return await readProjectFile({
|
|
6
|
+
filename: filePath,
|
|
7
|
+
encoding: args.encoding,
|
|
8
|
+
helpers: args.helpers
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
readCustomTypeFile
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=readCustomTypeFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readCustomTypeFile.js","sources":["../../../src/fs/readCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\nimport { BufferEncoding } from \"./types\";\n\nexport type ReadCustomTypeFileArgs = BuildCustomTypeFilePathArgs &\n\tReadProjectFileArgs;\n\nexport async function readCustomTypeFile(\n\targs: ReadCustomTypeFileArgs,\n): Promise<Buffer>;\nexport async function readCustomTypeFile(\n\targs: ReadCustomTypeFileArgs & { encoding: BufferEncoding },\n): Promise<string>;\nexport async function readCustomTypeFile(\n\targs: ReadCustomTypeFileArgs & { encoding?: BufferEncoding },\n): Promise<Buffer | string> {\n\tconst filePath = buildCustomTypeFilePath(args);\n\n\treturn await readProjectFile({\n\t\tfilename: filePath,\n\t\tencoding: args.encoding as BufferEncoding,\n\t\thelpers: args.helpers,\n\t});\n}\n"],"names":[],"mappings":";;AAgBA,eAAsB,mBACrB,MAA4D;AAE5D,QAAM,WAAW,wBAAwB,IAAI;AAE7C,SAAO,MAAM,gBAAgB;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AACF;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BuildCustomTypeLibraryDirectoryPathArgs } from "./buildCustomTypeLibraryDirectoryPath.js";
|
|
2
|
+
export type ReadCustomTypeLibraryArgs = BuildCustomTypeLibraryDirectoryPathArgs;
|
|
3
|
+
export type ReadCustomTypeLibraryReturnType = {
|
|
4
|
+
ids: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare const readCustomTypeLibrary: (args: ReadCustomTypeLibraryArgs) => Promise<ReadCustomTypeLibraryReturnType>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { buildCustomTypeLibraryDirectoryPath } from "./buildCustomTypeLibraryDirectoryPath.js";
|
|
3
|
+
import { CUSTOM_TYPE_MODEL_FILENAME } from "./constants.js";
|
|
4
|
+
import { checkPathExists } from "./lib/checkPathExists.js";
|
|
5
|
+
import { readdir } from "./lib/fsLimit.js";
|
|
6
|
+
import { isCustomTypeModel } from "./lib/isCustomTypeModel.js";
|
|
7
|
+
import { readJSONFile } from "./lib/readJSONFile.js";
|
|
8
|
+
const readCustomTypeLibrary = async (args) => {
|
|
9
|
+
const libraryDir = buildCustomTypeLibraryDirectoryPath({
|
|
10
|
+
absolute: true,
|
|
11
|
+
helpers: args.helpers
|
|
12
|
+
});
|
|
13
|
+
if (!await checkPathExists(libraryDir)) {
|
|
14
|
+
return {
|
|
15
|
+
ids: []
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const childDirs = await readdir(libraryDir, { withFileTypes: true });
|
|
19
|
+
const unreadableModelPaths = [];
|
|
20
|
+
const ids = [];
|
|
21
|
+
await Promise.all(childDirs.map(async (childDir) => {
|
|
22
|
+
if (childDir.isDirectory()) {
|
|
23
|
+
const childDirContents = await readdir(path.join(libraryDir, childDir.name), {
|
|
24
|
+
withFileTypes: true
|
|
25
|
+
});
|
|
26
|
+
const isCustomTypeDir = childDirContents.some((entry) => {
|
|
27
|
+
return entry.isFile() && entry.name === CUSTOM_TYPE_MODEL_FILENAME;
|
|
28
|
+
});
|
|
29
|
+
if (isCustomTypeDir) {
|
|
30
|
+
const modelPath = path.join(libraryDir, childDir.name, CUSTOM_TYPE_MODEL_FILENAME);
|
|
31
|
+
try {
|
|
32
|
+
const modelContents = await readJSONFile(modelPath);
|
|
33
|
+
if (isCustomTypeModel(modelContents)) {
|
|
34
|
+
ids.push(modelContents.id);
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
unreadableModelPaths.push(modelPath);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
if (unreadableModelPaths.length > 0) {
|
|
43
|
+
const formattedPaths = unreadableModelPaths.join(", ");
|
|
44
|
+
throw new Error(`The following custom type models could not be read: [${formattedPaths}]`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
ids: ids.sort()
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
readCustomTypeLibrary
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=readCustomTypeLibrary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readCustomTypeLibrary.js","sources":["../../../src/fs/readCustomTypeLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport * as fs from \"./lib/fsLimit\";\nimport { isCustomTypeModel } from \"./lib/isCustomTypeModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\n\nexport type ReadCustomTypeLibraryArgs = BuildCustomTypeLibraryDirectoryPathArgs;\n\nexport type ReadCustomTypeLibraryReturnType = {\n\tids: string[];\n};\n\nexport const readCustomTypeLibrary = async (\n\targs: ReadCustomTypeLibraryArgs,\n): Promise<ReadCustomTypeLibraryReturnType> => {\n\tconst libraryDir = buildCustomTypeLibraryDirectoryPath({\n\t\tabsolute: true,\n\t\thelpers: args.helpers,\n\t});\n\n\tif (!(await checkPathExists(libraryDir))) {\n\t\treturn {\n\t\t\tids: [],\n\t\t};\n\t}\n\n\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t/**\n\t * Paths to models that could not be read due to invalid JSON.\n\t */\n\tconst unreadableModelPaths: string[] = [];\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tif (childDir.isDirectory()) {\n\t\t\t\tconst childDirContents = await fs.readdir(\n\t\t\t\t\tpath.join(libraryDir, childDir.name),\n\t\t\t\t\t{\n\t\t\t\t\t\twithFileTypes: true,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\t\treturn entry.isFile() && entry.name === CUSTOM_TYPE_MODEL_FILENAME;\n\t\t\t\t});\n\n\t\t\t\tif (isCustomTypeDir) {\n\t\t\t\t\tconst modelPath = path.join(\n\t\t\t\t\t\tlibraryDir,\n\t\t\t\t\t\tchildDir.name,\n\t\t\t\t\t\tCUSTOM_TYPE_MODEL_FILENAME,\n\t\t\t\t\t);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tunreadableModelPaths.push(modelPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\tif (unreadableModelPaths.length > 0) {\n\t\tconst formattedPaths = unreadableModelPaths.join(\", \");\n\n\t\tthrow new Error(\n\t\t\t`The following custom type models could not be read: [${formattedPaths}]`,\n\t\t);\n\t}\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":["fs.readdir"],"mappings":";;;;;;;AAkBO,MAAM,wBAAwB,OACpC,SAC6C;AAC7C,QAAM,aAAa,oCAAoC;AAAA,IACtD,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAE,MAAM,gBAAgB,UAAU,GAAI;AACzC,WAAO;AAAA,MACN,KAAK,CAAA;AAAA,IAAA;AAAA,EAEP;AAEA,QAAM,YAAY,MAAMA,QAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,QAAM,uBAAiC,CAAA;AAEvC,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAChC,QAAI,SAAS,eAAe;AAC3B,YAAM,mBAAmB,MAAMA,QAC9B,KAAK,KAAK,YAAY,SAAS,IAAI,GACnC;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,eAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,MACzC,CAAC;AAED,UAAI,iBAAiB;AACpB,cAAM,YAAY,KAAK,KACtB,YACA,SAAS,MACT,0BAA0B;AAG3B,YAAI;AACH,gBAAM,gBAAgB,MAAM,aAAa,SAAS;AAElD,cAAI,kBAAkB,aAAa,GAAG;AACrC,gBAAI,KAAK,cAAc,EAAE;AAAA,UAC1B;AAAA,QACD,QAAQ;AACP,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAC,CAAC;AAGH,MAAI,qBAAqB,SAAS,GAAG;AACpC,UAAM,iBAAiB,qBAAqB,KAAK,IAAI;AAErD,UAAM,IAAI,MACT,wDAAwD,cAAc,GAAG;AAAA,EAE3E;AAEA,SAAO;AAAA,IACN,KAAK,IAAI,KAAA;AAAA,EAAI;AAEf;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import TypesInternal from "@prismicio/types-internal/lib/customtypes/index.js";
|
|
2
|
+
import { ReadCustomTypeFileArgs } from "./readCustomTypeFile.js";
|
|
3
|
+
export type ReadCustomTypeModelArgs = Omit<ReadCustomTypeFileArgs, "filename">;
|
|
4
|
+
export type ReadCustomTypeModelReturnType = {
|
|
5
|
+
model: TypesInternal.CustomType;
|
|
6
|
+
};
|
|
7
|
+
export declare const readCustomTypeModel: (args: ReadCustomTypeModelArgs) => Promise<ReadCustomTypeModelReturnType>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CUSTOM_TYPE_MODEL_FILENAME } from "./constants.js";
|
|
2
|
+
import { readCustomTypeFile } from "./readCustomTypeFile.js";
|
|
3
|
+
const readCustomTypeModel = async (args) => {
|
|
4
|
+
const model = await readCustomTypeFile({
|
|
5
|
+
...args,
|
|
6
|
+
filename: CUSTOM_TYPE_MODEL_FILENAME,
|
|
7
|
+
encoding: "utf8"
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
model: JSON.parse(model)
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
readCustomTypeModel
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=readCustomTypeModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readCustomTypeModel.js","sources":["../../../src/fs/readCustomTypeModel.ts"],"sourcesContent":["import TypesInternal from \"@prismicio/types-internal/lib/customtypes/index.js\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\treadCustomTypeFile,\n\tReadCustomTypeFileArgs,\n} from \"./readCustomTypeFile\";\n\nexport type ReadCustomTypeModelArgs = Omit<ReadCustomTypeFileArgs, \"filename\">;\n\nexport type ReadCustomTypeModelReturnType = {\n\tmodel: TypesInternal.CustomType;\n};\n\nexport const readCustomTypeModel = async (\n\targs: ReadCustomTypeModelArgs,\n): Promise<ReadCustomTypeModelReturnType> => {\n\tconst model = await readCustomTypeFile({\n\t\t...args,\n\t\tfilename: CUSTOM_TYPE_MODEL_FILENAME,\n\t\tencoding: \"utf8\",\n\t});\n\n\treturn {\n\t\tmodel: JSON.parse(model),\n\t};\n};\n"],"names":[],"mappings":";;AAcO,MAAM,sBAAsB,OAClC,SAC2C;AAC3C,QAAM,QAAQ,MAAM,mBAAmB;AAAA,IACtC,GAAG;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA,CACV;AAED,SAAO;AAAA,IACN,OAAO,KAAK,MAAM,KAAK;AAAA,EAAA;AAEzB;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PluginSystemHelpers } from "../createPluginSystemHelpers.js";
|
|
2
|
+
import * as fs from "./lib/fsLimit.js";
|
|
3
|
+
type BufferEncoding = Extract<Parameters<typeof fs.readFile>[1], string>;
|
|
4
|
+
export type ReadProjectFileArgs = {
|
|
5
|
+
filename: string;
|
|
6
|
+
helpers: PluginSystemHelpers;
|
|
7
|
+
};
|
|
8
|
+
export declare function readProjectFile(args: ReadProjectFileArgs): Promise<Buffer>;
|
|
9
|
+
export declare function readProjectFile(args: ReadProjectFileArgs & {
|
|
10
|
+
encoding: BufferEncoding;
|
|
11
|
+
}): Promise<string>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readFile } from "./lib/fsLimit.js";
|
|
2
|
+
async function readProjectFile(args) {
|
|
3
|
+
const filePath = args.helpers.joinPathFromRoot(args.filename);
|
|
4
|
+
return await readFile(filePath, args.encoding);
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
readProjectFile
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=readProjectFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readProjectFile.js","sources":["../../../src/fs/readProjectFile.ts"],"sourcesContent":["import { PluginSystemHelpers } from \"../createPluginSystemHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\ntype BufferEncoding = Extract<Parameters<typeof fs.readFile>[1], string>;\n\nexport type ReadProjectFileArgs = {\n\tfilename: string;\n\thelpers: PluginSystemHelpers;\n};\n\nexport async function readProjectFile(\n\targs: ReadProjectFileArgs,\n): Promise<Buffer>;\nexport async function readProjectFile(\n\targs: ReadProjectFileArgs & { encoding: BufferEncoding },\n): Promise<string>;\nexport async function readProjectFile(\n\targs: ReadProjectFileArgs & { encoding?: BufferEncoding },\n): Promise<Buffer | string> {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\treturn await fs.readFile(filePath, args.encoding);\n}\n"],"names":["fs.readFile"],"mappings":";AAiBA,eAAsB,gBACrB,MAAyD;AAEzD,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,SAAO,MAAMA,SAAY,UAAU,KAAK,QAAQ;AACjD;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BuildSliceFilePathArgs } from "./buildSliceFilePath.js";
|
|
2
|
+
import { ReadProjectFileArgs } from "./readProjectFile.js";
|
|
3
|
+
import { BufferEncoding } from "./types.js";
|
|
4
|
+
export type ReadSliceFileArgs = BuildSliceFilePathArgs & ReadProjectFileArgs;
|
|
5
|
+
export declare function readSliceFile(args: ReadSliceFileArgs): Promise<Buffer>;
|
|
6
|
+
export declare function readSliceFile(args: ReadSliceFileArgs & {
|
|
7
|
+
encoding: BufferEncoding;
|
|
8
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { buildSliceFilePath } from "./buildSliceFilePath.js";
|
|
2
|
+
import { readProjectFile } from "./readProjectFile.js";
|
|
3
|
+
async function readSliceFile(args) {
|
|
4
|
+
const filePath = await buildSliceFilePath({
|
|
5
|
+
...args,
|
|
6
|
+
absolute: false
|
|
7
|
+
});
|
|
8
|
+
return await readProjectFile({
|
|
9
|
+
filename: filePath,
|
|
10
|
+
encoding: args.encoding,
|
|
11
|
+
helpers: args.helpers
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
readSliceFile
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=readSliceFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readSliceFile.js","sources":["../../../src/fs/readSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\nimport { BufferEncoding } from \"./types\";\n\nexport type ReadSliceFileArgs = BuildSliceFilePathArgs & ReadProjectFileArgs;\n\nexport async function readSliceFile(args: ReadSliceFileArgs): Promise<Buffer>;\nexport async function readSliceFile(\n\targs: ReadSliceFileArgs & { encoding: BufferEncoding },\n): Promise<string>;\nexport async function readSliceFile(\n\targs: ReadSliceFileArgs & { encoding?: BufferEncoding },\n): Promise<Buffer | string> {\n\tconst filePath = await buildSliceFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\treturn await readProjectFile({\n\t\tfilename: filePath,\n\t\tencoding: args.encoding as BufferEncoding,\n\t\thelpers: args.helpers,\n\t});\n}\n"],"names":[],"mappings":";;AAaA,eAAsB,cACrB,MAAuD;AAEvD,QAAM,WAAW,MAAM,mBAAmB;AAAA,IACzC,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,SAAO,MAAM,gBAAgB;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AACF;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BuildSliceLibraryDirectoryPathArgs } from "./buildSliceLibraryDirectoryPath.js";
|
|
2
|
+
export type ReadSliceLibraryArgs = BuildSliceLibraryDirectoryPathArgs;
|
|
3
|
+
export type ReadSliceLibraryReturnType = {
|
|
4
|
+
id: string;
|
|
5
|
+
sliceIDs: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const readSliceLibrary: (args: ReadSliceLibraryArgs) => Promise<ReadSliceLibraryReturnType>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { buildSliceLibraryDirectoryPath } from "./buildSliceLibraryDirectoryPath.js";
|
|
3
|
+
import { SHARED_SLICE_MODEL_FILENAME } from "./constants.js";
|
|
4
|
+
import { checkPathExists } from "./lib/checkPathExists.js";
|
|
5
|
+
import { readdir } from "./lib/fsLimit.js";
|
|
6
|
+
import { isSharedSliceModel } from "./lib/isSharedSliceModel.js";
|
|
7
|
+
import { readJSONFile } from "./lib/readJSONFile.js";
|
|
8
|
+
const readSliceLibrary = async (args) => {
|
|
9
|
+
const libraryDir = buildSliceLibraryDirectoryPath({
|
|
10
|
+
libraryID: args.libraryID,
|
|
11
|
+
absolute: true,
|
|
12
|
+
helpers: args.helpers
|
|
13
|
+
});
|
|
14
|
+
if (!await checkPathExists(libraryDir)) {
|
|
15
|
+
return {
|
|
16
|
+
id: args.libraryID,
|
|
17
|
+
sliceIDs: []
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const childDirs = await readdir(libraryDir, { withFileTypes: true });
|
|
21
|
+
const unreadableModelPaths = [];
|
|
22
|
+
const sliceIDs = [];
|
|
23
|
+
await Promise.all(childDirs.map(async (childDir) => {
|
|
24
|
+
if (childDir.isDirectory()) {
|
|
25
|
+
const childDirContents = await readdir(path.join(libraryDir, childDir.name), {
|
|
26
|
+
withFileTypes: true
|
|
27
|
+
});
|
|
28
|
+
const isSliceDir = childDirContents.some((entry) => {
|
|
29
|
+
return entry.isFile() && entry.name === SHARED_SLICE_MODEL_FILENAME;
|
|
30
|
+
});
|
|
31
|
+
if (isSliceDir) {
|
|
32
|
+
const modelPath = path.join(libraryDir, childDir.name, SHARED_SLICE_MODEL_FILENAME);
|
|
33
|
+
try {
|
|
34
|
+
const modelContents = await readJSONFile(modelPath);
|
|
35
|
+
if (isSharedSliceModel(modelContents)) {
|
|
36
|
+
sliceIDs.push(modelContents.id);
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
unreadableModelPaths.push(modelPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
if (unreadableModelPaths.length > 0) {
|
|
45
|
+
const formattedPaths = unreadableModelPaths.join(", ");
|
|
46
|
+
throw new Error(`The following Slice models could not be read: [${formattedPaths}]`);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
id: args.libraryID,
|
|
50
|
+
sliceIDs: sliceIDs.sort()
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
readSliceLibrary
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=readSliceLibrary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readSliceLibrary.js","sources":["../../../src/fs/readSliceLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport * as fs from \"./lib/fsLimit\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\n\nexport type ReadSliceLibraryArgs = BuildSliceLibraryDirectoryPathArgs;\n\nexport type ReadSliceLibraryReturnType = {\n\tid: string;\n\tsliceIDs: string[];\n};\n\nexport const readSliceLibrary = async (\n\targs: ReadSliceLibraryArgs,\n): Promise<ReadSliceLibraryReturnType> => {\n\tconst libraryDir = buildSliceLibraryDirectoryPath({\n\t\tlibraryID: args.libraryID,\n\t\tabsolute: true,\n\t\thelpers: args.helpers,\n\t});\n\n\tif (!(await checkPathExists(libraryDir))) {\n\t\treturn {\n\t\t\tid: args.libraryID,\n\t\t\tsliceIDs: [],\n\t\t};\n\t}\n\n\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t/**\n\t * Paths to models that could not be read due to invalid JSON.\n\t */\n\tconst unreadableModelPaths: string[] = [];\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 childDirContents = await fs.readdir(\n\t\t\t\t\tpath.join(libraryDir, childDir.name),\n\t\t\t\t\t{\n\t\t\t\t\t\twithFileTypes: true,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst isSliceDir = childDirContents.some((entry) => {\n\t\t\t\t\treturn entry.isFile() && entry.name === SHARED_SLICE_MODEL_FILENAME;\n\t\t\t\t});\n\n\t\t\t\tif (isSliceDir) {\n\t\t\t\t\tconst modelPath = path.join(\n\t\t\t\t\t\tlibraryDir,\n\t\t\t\t\t\tchildDir.name,\n\t\t\t\t\t\tSHARED_SLICE_MODEL_FILENAME,\n\t\t\t\t\t);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\t\tif (isSharedSliceModel(modelContents)) {\n\t\t\t\t\t\t\tsliceIDs.push(modelContents.id);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// JSON could not be read or parsed\n\t\t\t\t\t\tunreadableModelPaths.push(modelPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\tif (unreadableModelPaths.length > 0) {\n\t\tconst formattedPaths = unreadableModelPaths.join(\", \");\n\n\t\tthrow new Error(\n\t\t\t`The following Slice models could not be read: [${formattedPaths}]`,\n\t\t);\n\t}\n\n\treturn {\n\t\tid: args.libraryID,\n\t\tsliceIDs: sliceIDs.sort(),\n\t};\n};\n"],"names":["fs.readdir"],"mappings":";;;;;;;AAmBO,MAAM,mBAAmB,OAC/B,SACwC;AACxC,QAAM,aAAa,+BAA+B;AAAA,IACjD,WAAW,KAAK;AAAA,IAChB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAE,MAAM,gBAAgB,UAAU,GAAI;AACzC,WAAO;AAAA,MACN,IAAI,KAAK;AAAA,MACT,UAAU,CAAA;AAAA,IAAA;AAAA,EAEZ;AAEA,QAAM,YAAY,MAAMA,QAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,QAAM,uBAAiC,CAAA;AAEvC,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAChC,QAAI,SAAS,eAAe;AAC3B,YAAM,mBAAmB,MAAMA,QAC9B,KAAK,KAAK,YAAY,SAAS,IAAI,GACnC;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,aAAa,iBAAiB,KAAK,CAAC,UAAS;AAClD,eAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,MACzC,CAAC;AAED,UAAI,YAAY;AACf,cAAM,YAAY,KAAK,KACtB,YACA,SAAS,MACT,2BAA2B;AAG5B,YAAI;AACH,gBAAM,gBAAgB,MAAM,aAAa,SAAS;AAElD,cAAI,mBAAmB,aAAa,GAAG;AACtC,qBAAS,KAAK,cAAc,EAAE;AAAA,UAC/B;AAAA,QACD,QAAQ;AAEP,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAC,CAAC;AAGH,MAAI,qBAAqB,SAAS,GAAG;AACpC,UAAM,iBAAiB,qBAAqB,KAAK,IAAI;AAErD,UAAM,IAAI,MACT,kDAAkD,cAAc,GAAG;AAAA,EAErE;AAEA,SAAO;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAA;AAAA,EAAI;AAEzB;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import TypesInternal from "@prismicio/types-internal/lib/customtypes/index.js";
|
|
2
|
+
import { PluginSystemHelpers } from "../createPluginSystemHelpers.js";
|
|
3
|
+
export type ReadSliceModelArgs = {
|
|
4
|
+
libraryID: string;
|
|
5
|
+
sliceID: string;
|
|
6
|
+
helpers: PluginSystemHelpers;
|
|
7
|
+
};
|
|
8
|
+
export type ReadSliceModelReturnType = {
|
|
9
|
+
model: TypesInternal.SharedSlice;
|
|
10
|
+
};
|
|
11
|
+
export declare const readSliceModel: (args: ReadSliceModelArgs) => Promise<ReadSliceModelReturnType>;
|