@slicemachine/plugin-kit 0.4.82-beta.6 → 0.4.82-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/_node_modules/fp-ts/es6/Either.cjs.map +1 -1
  2. package/dist/_node_modules/fp-ts/es6/Either.js.map +1 -1
  3. package/dist/_node_modules/fp-ts/es6/function.cjs +7 -9
  4. package/dist/_node_modules/fp-ts/es6/function.cjs.map +1 -1
  5. package/dist/_node_modules/fp-ts/es6/function.js +7 -9
  6. package/dist/_node_modules/fp-ts/es6/function.js.map +1 -1
  7. package/dist/_node_modules/fp-ts/es6/internal.cjs +7 -9
  8. package/dist/_node_modules/fp-ts/es6/internal.cjs.map +1 -1
  9. package/dist/_node_modules/fp-ts/es6/internal.js +7 -9
  10. package/dist/_node_modules/fp-ts/es6/internal.js.map +1 -1
  11. package/dist/_node_modules/lower-case/dist.es2015/index.cjs.map +1 -1
  12. package/dist/_node_modules/lower-case/dist.es2015/index.js.map +1 -1
  13. package/dist/_node_modules/no-case/dist.es2015/index.cjs.map +1 -1
  14. package/dist/_node_modules/no-case/dist.es2015/index.js.map +1 -1
  15. package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.cjs +11 -25
  16. package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.cjs.map +1 -1
  17. package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js +11 -25
  18. package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js.map +1 -1
  19. package/dist/_node_modules/p-limit/index.cjs.map +1 -1
  20. package/dist/_node_modules/p-limit/index.js.map +1 -1
  21. package/dist/_node_modules/pascal-case/dist.es2015/index.cjs.map +1 -1
  22. package/dist/_node_modules/pascal-case/dist.es2015/index.js.map +1 -1
  23. package/dist/_node_modules/tslib/tslib.es6.cjs +1 -3
  24. package/dist/_node_modules/tslib/tslib.es6.cjs.map +1 -1
  25. package/dist/_node_modules/tslib/tslib.es6.js +1 -3
  26. package/dist/_node_modules/tslib/tslib.es6.js.map +1 -1
  27. package/dist/createSliceMachineActions.cjs +1 -4
  28. package/dist/createSliceMachineActions.cjs.map +1 -1
  29. package/dist/createSliceMachineActions.js +1 -4
  30. package/dist/createSliceMachineActions.js.map +1 -1
  31. package/dist/createSliceMachineContext.cjs.map +1 -1
  32. package/dist/createSliceMachineContext.js.map +1 -1
  33. package/dist/createSliceMachineHelpers.cjs +1 -4
  34. package/dist/createSliceMachineHelpers.cjs.map +1 -1
  35. package/dist/createSliceMachineHelpers.js +1 -4
  36. package/dist/createSliceMachineHelpers.js.map +1 -1
  37. package/dist/createSliceMachineHookSystem.cjs.map +1 -1
  38. package/dist/createSliceMachineHookSystem.js.map +1 -1
  39. package/dist/createSliceMachinePluginRunner.cjs +1 -4
  40. package/dist/createSliceMachinePluginRunner.cjs.map +1 -1
  41. package/dist/createSliceMachinePluginRunner.js +1 -4
  42. package/dist/createSliceMachinePluginRunner.js.map +1 -1
  43. package/dist/defineSliceMachinePlugin.cjs.map +1 -1
  44. package/dist/defineSliceMachinePlugin.js.map +1 -1
  45. package/dist/fs/buildCustomTypeDirectoryPath.cjs.map +1 -1
  46. package/dist/fs/buildCustomTypeDirectoryPath.js.map +1 -1
  47. package/dist/fs/buildCustomTypeFilePath.cjs.map +1 -1
  48. package/dist/fs/buildCustomTypeFilePath.js.map +1 -1
  49. package/dist/fs/buildCustomTypeLibraryDirectoryPath.cjs.map +1 -1
  50. package/dist/fs/buildCustomTypeLibraryDirectoryPath.js.map +1 -1
  51. package/dist/fs/buildSliceDirectoryPath.cjs.map +1 -1
  52. package/dist/fs/buildSliceDirectoryPath.js.map +1 -1
  53. package/dist/fs/buildSliceFilePath.cjs.map +1 -1
  54. package/dist/fs/buildSliceFilePath.js.map +1 -1
  55. package/dist/fs/buildSliceLibraryDirectoryPath.cjs.map +1 -1
  56. package/dist/fs/buildSliceLibraryDirectoryPath.js.map +1 -1
  57. package/dist/fs/checkHasProjectFile.cjs.map +1 -1
  58. package/dist/fs/checkHasProjectFile.js.map +1 -1
  59. package/dist/fs/checkIsTypeScriptProject.cjs.map +1 -1
  60. package/dist/fs/checkIsTypeScriptProject.js.map +1 -1
  61. package/dist/fs/deleteCustomTypeDirectory.cjs.map +1 -1
  62. package/dist/fs/deleteCustomTypeDirectory.js.map +1 -1
  63. package/dist/fs/deleteCustomTypeFile.cjs.map +1 -1
  64. package/dist/fs/deleteCustomTypeFile.js.map +1 -1
  65. package/dist/fs/deleteProjectFile.cjs.map +1 -1
  66. package/dist/fs/deleteProjectFile.js.map +1 -1
  67. package/dist/fs/deleteSliceDirectory.cjs.map +1 -1
  68. package/dist/fs/deleteSliceDirectory.js.map +1 -1
  69. package/dist/fs/deleteSliceFile.cjs.map +1 -1
  70. package/dist/fs/deleteSliceFile.js.map +1 -1
  71. package/dist/fs/lib/checkPathExists.cjs.map +1 -1
  72. package/dist/fs/lib/checkPathExists.js.map +1 -1
  73. package/dist/fs/lib/fsLimit.cjs.map +1 -1
  74. package/dist/fs/lib/fsLimit.js.map +1 -1
  75. package/dist/fs/lib/pascalCase.cjs.map +1 -1
  76. package/dist/fs/lib/pascalCase.js.map +1 -1
  77. package/dist/fs/lib/readJSONFile.cjs.map +1 -1
  78. package/dist/fs/lib/readJSONFile.js.map +1 -1
  79. package/dist/fs/lib/resolveSliceModel.cjs.map +1 -1
  80. package/dist/fs/lib/resolveSliceModel.js.map +1 -1
  81. package/dist/fs/readCustomTypeFile.cjs.map +1 -1
  82. package/dist/fs/readCustomTypeFile.js.map +1 -1
  83. package/dist/fs/readCustomTypeLibrary.cjs.map +1 -1
  84. package/dist/fs/readCustomTypeLibrary.js.map +1 -1
  85. package/dist/fs/readCustomTypeModel.cjs.map +1 -1
  86. package/dist/fs/readCustomTypeModel.js.map +1 -1
  87. package/dist/fs/readProjectEnvironment.cjs.map +1 -1
  88. package/dist/fs/readProjectEnvironment.js.map +1 -1
  89. package/dist/fs/readSliceFile.cjs.map +1 -1
  90. package/dist/fs/readSliceFile.js.map +1 -1
  91. package/dist/fs/readSliceLibrary.cjs.map +1 -1
  92. package/dist/fs/readSliceLibrary.js.map +1 -1
  93. package/dist/fs/readSliceModel.cjs.map +1 -1
  94. package/dist/fs/readSliceModel.js.map +1 -1
  95. package/dist/fs/readSliceTemplateLibrary.cjs.map +1 -1
  96. package/dist/fs/readSliceTemplateLibrary.js.map +1 -1
  97. package/dist/fs/renameCustomType.cjs.map +1 -1
  98. package/dist/fs/renameCustomType.js.map +1 -1
  99. package/dist/fs/renameSlice.cjs.map +1 -1
  100. package/dist/fs/renameSlice.js.map +1 -1
  101. package/dist/fs/upsertGlobalTypeScriptTypes.cjs.map +1 -1
  102. package/dist/fs/upsertGlobalTypeScriptTypes.js.map +1 -1
  103. package/dist/fs/writeCustomTypeFile.cjs.map +1 -1
  104. package/dist/fs/writeCustomTypeFile.js.map +1 -1
  105. package/dist/fs/writeCustomTypeModel.cjs.map +1 -1
  106. package/dist/fs/writeCustomTypeModel.js.map +1 -1
  107. package/dist/fs/writeProjectEnvironment.cjs.map +1 -1
  108. package/dist/fs/writeProjectEnvironment.js.map +1 -1
  109. package/dist/fs/writeProjectFile.cjs.map +1 -1
  110. package/dist/fs/writeProjectFile.js.map +1 -1
  111. package/dist/fs/writeSliceFile.cjs.map +1 -1
  112. package/dist/fs/writeSliceFile.js.map +1 -1
  113. package/dist/fs/writeSliceModel.cjs.map +1 -1
  114. package/dist/fs/writeSliceModel.js.map +1 -1
  115. package/dist/lib/DecodeError.cjs +1 -4
  116. package/dist/lib/DecodeError.cjs.map +1 -1
  117. package/dist/lib/DecodeError.js +1 -4
  118. package/dist/lib/DecodeError.js.map +1 -1
  119. package/dist/lib/HookSystem.cjs +1 -4
  120. package/dist/lib/HookSystem.cjs.map +1 -1
  121. package/dist/lib/HookSystem.js +1 -4
  122. package/dist/lib/HookSystem.js.map +1 -1
  123. package/dist/lib/decode.cjs.map +1 -1
  124. package/dist/lib/decode.js.map +1 -1
  125. package/dist/lib/decodeSliceMachineConfig.cjs.map +1 -1
  126. package/dist/lib/decodeSliceMachineConfig.js.map +1 -1
  127. package/package.json +2 -2
@@ -1 +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;AAC/C,MAAA;AACG,UAAAA,OAAU,IAAI;AAEb,WAAA;AAAA,EAAA,QACA;AACA,WAAA;AAAA,EACR;AACD;"}
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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"fsLimit.cjs","sources":["../../../../src/fs/lib/fsLimit.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\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":["pLimit","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,cAAc,OAAO,MAAM,OAAO,QAAQ,IAAI,WAAW,CAAC,IAC7D,SACA,OAAO,QAAQ,IAAI,WAAW;AASjC,MAAM,oCAAoC,eAAe;AAKzD,MAAM,UAAUA,MAAO,iCAAiC;AAUxD,MAAM,kBAAkB,CAIvB,OACQ;AACR,SAAQ,IAAI,SAAS,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC;AAC/C;AAEa,MAAA,SAAS,gBAAgBC,cAAG,MAAM;AAWlC,MAAA,QAAQ,gBAAgBA,cAAG,KAAK;AAIhC,MAAA,WAAW,gBAAgBA,cAAG,QAAQ;AACtC,MAAA,UAAU,gBAAgBA,cAAG,OAAO;AAIpC,MAAA,KAAK,gBAAgBA,cAAG,EAAE;AAS1B,MAAA,YAAY,gBAAgBA,cAAG,SAAS;;;;;;;"}
1
+ {"version":3,"file":"fsLimit.cjs","sources":["../../../../src/fs/lib/fsLimit.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\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":["pLimit","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,cAAc,OAAO,MAAM,OAAO,QAAQ,IAAI,WAAW,CAAC,IAC7D,SACA,OAAO,QAAQ,IAAI,WAAW;AASjC,MAAM,oCAAoC,eAAe;AAKzD,MAAM,UAAUA,MAAO,iCAAiC;AAUxD,MAAM,kBAAkB,CAIvB,OACQ;AACR,SAAQ,IAAI,SAAS,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC;AAC/C;AAEO,MAAM,SAAS,gBAAgBC,cAAG,MAAM;AAWxC,MAAM,QAAQ,gBAAgBA,cAAG,KAAK;AAItC,MAAM,WAAW,gBAAgBA,cAAG,QAAQ;AAC5C,MAAM,UAAU,gBAAgBA,cAAG,OAAO;AAI1C,MAAM,KAAK,gBAAgBA,cAAG,EAAE;AAShC,MAAM,YAAY,gBAAgBA,cAAG,SAAS;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"fsLimit.js","sources":["../../../../src/fs/lib/fsLimit.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\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":";;AAMA,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;AAEa,MAAA,SAAS,gBAAgB,GAAG,MAAM;AAWlC,MAAA,QAAQ,gBAAgB,GAAG,KAAK;AAIhC,MAAA,WAAW,gBAAgB,GAAG,QAAQ;AACtC,MAAA,UAAU,gBAAgB,GAAG,OAAO;AAIpC,MAAA,KAAK,gBAAgB,GAAG,EAAE;AAS1B,MAAA,YAAY,gBAAgB,GAAG,SAAS;"}
1
+ {"version":3,"file":"fsLimit.js","sources":["../../../../src/fs/lib/fsLimit.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\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":";;AAMA,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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"pascalCase.cjs","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","pascalCaseTransformMerge"],"mappings":";;;AAYa,MAAA,aAAa,IAAI,UAAyC;AACtE,SAAOA,MAAAA,WAAe,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG;AAAA,IACtD,WAAWC,MAAA;AAAA,EAAA,CACX;AACF;;"}
1
+ {"version":3,"file":"pascalCase.cjs","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","pascalCaseTransformMerge"],"mappings":";;;AAYO,MAAM,aAAa,IAAI,UAAyC;AACtE,SAAOA,MAAAA,WAAe,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG;AAAA,IACtD,WAAWC,MAAAA;AAAAA,EAAA,CACX;AACF;;"}
@@ -1 +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":";AAYa,MAAA,aAAa,IAAI,UAAyC;AACtE,SAAOA,aAAe,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG;AAAA,IACtD,WAAW;AAAA,EAAA,CACX;AACF;"}
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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readJSONFile.cjs","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,QAAAA,SAAY,MAAM,MAAM;AAExC,SAAA,KAAK,MAAM,QAAQ;AAC3B;;"}
1
+ {"version":3,"file":"readJSONFile.cjs","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,iBAAY,MAAM,MAAM;AAE/C,SAAO,KAAK,MAAM,QAAQ;AAC3B;;"}
@@ -1 +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;AAExC,SAAA,KAAK,MAAM,QAAQ;AAC3B;"}
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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveSliceModel.cjs","sources":["../../../../src/fs/lib/resolveSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { SliceMachineActions } from \"../../createSliceMachineActions\";\n\nexport type ResolveSliceModelArgs =\n\t| {\n\t\t\tsliceID: string;\n\t\t\tlibraryID: string;\n\t\t\tactions: SliceMachineActions;\n\t }\n\t| {\n\t\t\tmodel: SharedSlice;\n\t };\n\nexport async function resolveSliceModel(\n\targs: ResolveSliceModelArgs,\n): Promise<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,MAAK,IAAK,MAAM,KAAK,QAAQ,eAAe;AAAA,IACnD,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,EAAA,CACd;AAEM,SAAA;AACR;;"}
1
+ {"version":3,"file":"resolveSliceModel.cjs","sources":["../../../../src/fs/lib/resolveSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { SliceMachineActions } from \"../../createSliceMachineActions\";\n\nexport type ResolveSliceModelArgs =\n\t| {\n\t\t\tsliceID: string;\n\t\t\tlibraryID: string;\n\t\t\tactions: SliceMachineActions;\n\t }\n\t| {\n\t\t\tmodel: SharedSlice;\n\t };\n\nexport async function resolveSliceModel(\n\targs: ResolveSliceModelArgs,\n): Promise<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;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveSliceModel.js","sources":["../../../../src/fs/lib/resolveSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { SliceMachineActions } from \"../../createSliceMachineActions\";\n\nexport type ResolveSliceModelArgs =\n\t| {\n\t\t\tsliceID: string;\n\t\t\tlibraryID: string;\n\t\t\tactions: SliceMachineActions;\n\t }\n\t| {\n\t\t\tmodel: SharedSlice;\n\t };\n\nexport async function resolveSliceModel(\n\targs: ResolveSliceModelArgs,\n): Promise<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,MAAK,IAAK,MAAM,KAAK,QAAQ,eAAe;AAAA,IACnD,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,EAAA,CACd;AAEM,SAAA;AACR;"}
1
+ {"version":3,"file":"resolveSliceModel.js","sources":["../../../../src/fs/lib/resolveSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { SliceMachineActions } from \"../../createSliceMachineActions\";\n\nexport type ResolveSliceModelArgs =\n\t| {\n\t\t\tsliceID: string;\n\t\t\tlibraryID: string;\n\t\t\tactions: SliceMachineActions;\n\t }\n\t| {\n\t\t\tmodel: SharedSlice;\n\t };\n\nexport async function resolveSliceModel(\n\targs: ResolveSliceModelArgs,\n): Promise<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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readCustomTypeFile.cjs","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":["buildCustomTypeFilePath","readProjectFile"],"mappings":";;;;AAgBA,eAAsB,mBACrB,MAA4D;AAEtD,QAAA,WAAWA,gDAAwB,IAAI;AAE7C,SAAO,MAAMC,gBAAAA,gBAAgB;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AACF;;"}
1
+ {"version":3,"file":"readCustomTypeFile.cjs","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":["buildCustomTypeFilePath","readProjectFile"],"mappings":";;;;AAgBA,eAAsB,mBACrB,MAA4D;AAE5D,QAAM,WAAWA,wBAAAA,wBAAwB,IAAI;AAE7C,SAAO,MAAMC,gBAAAA,gBAAgB;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AACF;;"}
@@ -1 +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;AAEtD,QAAA,WAAW,wBAAwB,IAAI;AAE7C,SAAO,MAAM,gBAAgB;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AACF;"}
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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readCustomTypeLibrary.cjs","sources":["../../../src/fs/readCustomTypeLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isCustomTypeModel } from \"./lib/isCustomTypeModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\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":["buildCustomTypeLibraryDirectoryPath","checkPathExists","fs.readdir","path","CUSTOM_TYPE_MODEL_FILENAME","readJSONFile","isCustomTypeModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBa,MAAA,wBAAwB,OACpC,SAC6C;AAC7C,QAAM,aAAaA,oCAAAA,oCAAoC;AAAA,IACtD,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAE,MAAMC,gCAAgB,UAAU,GAAI;AAClC,WAAA;AAAA,MACN,KAAK,CAAE;AAAA,IAAA;AAAA,EAET;AAEM,QAAA,YAAY,MAAMC,gBAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,QAAM,uBAAiC,CAAA;AAEvC,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AACrB,YAAA,mBAAmB,MAAMA,QAAAA,QAC9BC,gBAAK,KAAK,YAAY,SAAS,IAAI,GACnC;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,eAAO,MAAM,OAAA,KAAY,MAAM,SAASC,UAAAA;AAAAA,MAAA,CACxC;AAED,UAAI,iBAAiB;AACpB,cAAM,YAAYD,gBAAK,KACtB,YACA,SAAS,MACTC,UAAAA,0BAA0B;AAGvB,YAAA;AACG,gBAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,cAAAC,kBAAAA,kBAAkB,aAAa,GAAG;AACjC,gBAAA,KAAK,cAAc,EAAE;AAAA,UAC1B;AAAA,QAAA,QACO;AACP,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,EACA,CAAA,CAAC;AAGC,MAAA,qBAAqB,SAAS,GAAG;AAC9B,UAAA,iBAAiB,qBAAqB,KAAK,IAAI;AAErD,UAAM,IAAI,MACT,wDAAwD,cAAc,GAAG;AAAA,EAE3E;AAEO,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;;"}
1
+ {"version":3,"file":"readCustomTypeLibrary.cjs","sources":["../../../src/fs/readCustomTypeLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isCustomTypeModel } from \"./lib/isCustomTypeModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\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":["buildCustomTypeLibraryDirectoryPath","checkPathExists","fs.readdir","path","CUSTOM_TYPE_MODEL_FILENAME","readJSONFile","isCustomTypeModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,wBAAwB,OACpC,SAC6C;AAC7C,QAAM,aAAaA,oCAAAA,oCAAoC;AAAA,IACtD,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAE,MAAMC,gCAAgB,UAAU,GAAI;AACzC,WAAO;AAAA,MACN,KAAK,CAAA;AAAA,IAAA;AAAA,EAEP;AAEA,QAAM,YAAY,MAAMC,QAAAA,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,QAAAA,QAC9BC,gBAAK,KAAK,YAAY,SAAS,IAAI,GACnC;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,eAAO,MAAM,OAAA,KAAY,MAAM,SAASC,UAAAA;AAAAA,MACzC,CAAC;AAED,UAAI,iBAAiB;AACpB,cAAM,YAAYD,gBAAK,KACtB,YACA,SAAS,MACTC,oCAA0B;AAG3B,YAAI;AACH,gBAAM,gBAAgB,MAAMC,aAAAA,aAAa,SAAS;AAElD,cAAIC,kBAAAA,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;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readCustomTypeLibrary.js","sources":["../../../src/fs/readCustomTypeLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isCustomTypeModel } from \"./lib/isCustomTypeModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\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":";;;;;;;AAmBa,MAAA,wBAAwB,OACpC,SAC6C;AAC7C,QAAM,aAAa,oCAAoC;AAAA,IACtD,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAE,MAAM,gBAAgB,UAAU,GAAI;AAClC,WAAA;AAAA,MACN,KAAK,CAAE;AAAA,IAAA;AAAA,EAET;AAEM,QAAA,YAAY,MAAMA,QAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,QAAM,uBAAiC,CAAA;AAEvC,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AACrB,YAAA,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,MAAA,CACxC;AAED,UAAI,iBAAiB;AACpB,cAAM,YAAY,KAAK,KACtB,YACA,SAAS,MACT,0BAA0B;AAGvB,YAAA;AACG,gBAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,cAAA,kBAAkB,aAAa,GAAG;AACjC,gBAAA,KAAK,cAAc,EAAE;AAAA,UAC1B;AAAA,QAAA,QACO;AACP,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,EACA,CAAA,CAAC;AAGC,MAAA,qBAAqB,SAAS,GAAG;AAC9B,UAAA,iBAAiB,qBAAqB,KAAK,IAAI;AAErD,UAAM,IAAI,MACT,wDAAwD,cAAc,GAAG;AAAA,EAE3E;AAEO,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;"}
1
+ {"version":3,"file":"readCustomTypeLibrary.js","sources":["../../../src/fs/readCustomTypeLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isCustomTypeModel } from \"./lib/isCustomTypeModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\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":";;;;;;;AAmBO,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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readCustomTypeModel.cjs","sources":["../../../src/fs/readCustomTypeModel.ts"],"sourcesContent":["import { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\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: 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":["readCustomTypeFile","CUSTOM_TYPE_MODEL_FILENAME"],"mappings":";;;;AAca,MAAA,sBAAsB,OAClC,SAC2C;AACrC,QAAA,QAAQ,MAAMA,sCAAmB;AAAA,IACtC,GAAG;AAAA,IACH,UAAUC,UAAA;AAAA,IACV,UAAU;AAAA,EAAA,CACV;AAEM,SAAA;AAAA,IACN,OAAO,KAAK,MAAM,KAAK;AAAA,EAAA;AAEzB;;"}
1
+ {"version":3,"file":"readCustomTypeModel.cjs","sources":["../../../src/fs/readCustomTypeModel.ts"],"sourcesContent":["import { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\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: 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":["readCustomTypeFile","CUSTOM_TYPE_MODEL_FILENAME"],"mappings":";;;;AAcO,MAAM,sBAAsB,OAClC,SAC2C;AAC3C,QAAM,QAAQ,MAAMA,sCAAmB;AAAA,IACtC,GAAG;AAAA,IACH,UAAUC,UAAAA;AAAAA,IACV,UAAU;AAAA,EAAA,CACV;AAED,SAAO;AAAA,IACN,OAAO,KAAK,MAAM,KAAK;AAAA,EAAA;AAEzB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readCustomTypeModel.js","sources":["../../../src/fs/readCustomTypeModel.ts"],"sourcesContent":["import { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\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: 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":";;AAca,MAAA,sBAAsB,OAClC,SAC2C;AACrC,QAAA,QAAQ,MAAM,mBAAmB;AAAA,IACtC,GAAG;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA,CACV;AAEM,SAAA;AAAA,IACN,OAAO,KAAK,MAAM,KAAK;AAAA,EAAA;AAEzB;"}
1
+ {"version":3,"file":"readCustomTypeModel.js","sources":["../../../src/fs/readCustomTypeModel.ts"],"sourcesContent":["import { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\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: 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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readProjectEnvironment.cjs","sources":["../../../src/fs/readProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\n\nexport type ReadProjectEnvironmentArgs = {\n\tfilenames: string[];\n\tvariableName: string;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\">;\n\nexport type ReadEnvironmentReturnType = {\n\tenvironment: string | undefined;\n};\n\nexport const readProjectEnvironment = async (\n\targs: ReadProjectEnvironmentArgs,\n): Promise<ReadEnvironmentReturnType> => {\n\tlet vars: Partial<Record<string, string>> = {};\n\n\tfor (const filename of args.filenames) {\n\t\tconst hasProjectFile = await checkHasProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tif (!hasProjectFile) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst contents = await readProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tvars = {\n\t\t\t...vars,\n\t\t\t...dotenv.parse(contents),\n\t\t};\n\t}\n\n\treturn {\n\t\tenvironment: vars[args.variableName],\n\t};\n};\n"],"names":["checkHasProjectFile","readProjectFile","dotenv"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBa,MAAA,yBAAyB,OACrC,SACuC;AACvC,MAAI,OAAwC,CAAA;AAEjC,aAAA,YAAY,KAAK,WAAW;AAChC,UAAA,iBAAiB,MAAMA,wCAAoB;AAAA,MAChD;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAED,QAAI,CAAC,gBAAgB;AACpB;AAAA,IACD;AAEM,UAAA,WAAW,MAAMC,gCAAgB;AAAA,MACtC;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAEM,WAAA;AAAA,MACN,GAAG;AAAA,MACH,GAAGC,kBAAO,MAAM,QAAQ;AAAA,IAAA;AAAA,EAE1B;AAEO,SAAA;AAAA,IACN,aAAa,KAAK,KAAK,YAAY;AAAA,EAAA;AAErC;;"}
1
+ {"version":3,"file":"readProjectEnvironment.cjs","sources":["../../../src/fs/readProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\n\nexport type ReadProjectEnvironmentArgs = {\n\tfilenames: string[];\n\tvariableName: string;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\">;\n\nexport type ReadEnvironmentReturnType = {\n\tenvironment: string | undefined;\n};\n\nexport const readProjectEnvironment = async (\n\targs: ReadProjectEnvironmentArgs,\n): Promise<ReadEnvironmentReturnType> => {\n\tlet vars: Partial<Record<string, string>> = {};\n\n\tfor (const filename of args.filenames) {\n\t\tconst hasProjectFile = await checkHasProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tif (!hasProjectFile) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst contents = await readProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tvars = {\n\t\t\t...vars,\n\t\t\t...dotenv.parse(contents),\n\t\t};\n\t}\n\n\treturn {\n\t\tenvironment: vars[args.variableName],\n\t};\n};\n"],"names":["checkHasProjectFile","readProjectFile","dotenv"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,yBAAyB,OACrC,SACuC;AACvC,MAAI,OAAwC,CAAA;AAE5C,aAAW,YAAY,KAAK,WAAW;AACtC,UAAM,iBAAiB,MAAMA,wCAAoB;AAAA,MAChD;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAED,QAAI,CAAC,gBAAgB;AACpB;AAAA,IACD;AAEA,UAAM,WAAW,MAAMC,gCAAgB;AAAA,MACtC;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAED,WAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAGC,kBAAO,MAAM,QAAQ;AAAA,IAAA;AAAA,EAE1B;AAEA,SAAO;AAAA,IACN,aAAa,KAAK,KAAK,YAAY;AAAA,EAAA;AAErC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readProjectEnvironment.js","sources":["../../../src/fs/readProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\n\nexport type ReadProjectEnvironmentArgs = {\n\tfilenames: string[];\n\tvariableName: string;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\">;\n\nexport type ReadEnvironmentReturnType = {\n\tenvironment: string | undefined;\n};\n\nexport const readProjectEnvironment = async (\n\targs: ReadProjectEnvironmentArgs,\n): Promise<ReadEnvironmentReturnType> => {\n\tlet vars: Partial<Record<string, string>> = {};\n\n\tfor (const filename of args.filenames) {\n\t\tconst hasProjectFile = await checkHasProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tif (!hasProjectFile) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst contents = await readProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tvars = {\n\t\t\t...vars,\n\t\t\t...dotenv.parse(contents),\n\t\t};\n\t}\n\n\treturn {\n\t\tenvironment: vars[args.variableName],\n\t};\n};\n"],"names":[],"mappings":";;;AAmBa,MAAA,yBAAyB,OACrC,SACuC;AACvC,MAAI,OAAwC,CAAA;AAEjC,aAAA,YAAY,KAAK,WAAW;AAChC,UAAA,iBAAiB,MAAM,oBAAoB;AAAA,MAChD;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAED,QAAI,CAAC,gBAAgB;AACpB;AAAA,IACD;AAEM,UAAA,WAAW,MAAM,gBAAgB;AAAA,MACtC;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAEM,WAAA;AAAA,MACN,GAAG;AAAA,MACH,GAAG,OAAO,MAAM,QAAQ;AAAA,IAAA;AAAA,EAE1B;AAEO,SAAA;AAAA,IACN,aAAa,KAAK,KAAK,YAAY;AAAA,EAAA;AAErC;"}
1
+ {"version":3,"file":"readProjectEnvironment.js","sources":["../../../src/fs/readProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\n\nexport type ReadProjectEnvironmentArgs = {\n\tfilenames: string[];\n\tvariableName: string;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\">;\n\nexport type ReadEnvironmentReturnType = {\n\tenvironment: string | undefined;\n};\n\nexport const readProjectEnvironment = async (\n\targs: ReadProjectEnvironmentArgs,\n): Promise<ReadEnvironmentReturnType> => {\n\tlet vars: Partial<Record<string, string>> = {};\n\n\tfor (const filename of args.filenames) {\n\t\tconst hasProjectFile = await checkHasProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tif (!hasProjectFile) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst contents = await readProjectFile({\n\t\t\tfilename,\n\t\t\thelpers: args.helpers,\n\t\t});\n\n\t\tvars = {\n\t\t\t...vars,\n\t\t\t...dotenv.parse(contents),\n\t\t};\n\t}\n\n\treturn {\n\t\tenvironment: vars[args.variableName],\n\t};\n};\n"],"names":[],"mappings":";;;AAmBO,MAAM,yBAAyB,OACrC,SACuC;AACvC,MAAI,OAAwC,CAAA;AAE5C,aAAW,YAAY,KAAK,WAAW;AACtC,UAAM,iBAAiB,MAAM,oBAAoB;AAAA,MAChD;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAED,QAAI,CAAC,gBAAgB;AACpB;AAAA,IACD;AAEA,UAAM,WAAW,MAAM,gBAAgB;AAAA,MACtC;AAAA,MACA,SAAS,KAAK;AAAA,IAAA,CACd;AAED,WAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAG,OAAO,MAAM,QAAQ;AAAA,IAAA;AAAA,EAE1B;AAEA,SAAO;AAAA,IACN,aAAa,KAAK,KAAK,YAAY;AAAA,EAAA;AAErC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readSliceFile.cjs","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":["buildSliceFilePath","readProjectFile"],"mappings":";;;;AAaA,eAAsB,cACrB,MAAuD;AAEjD,QAAA,WAAW,MAAMA,sCAAmB;AAAA,IACzC,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,SAAO,MAAMC,gBAAAA,gBAAgB;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AACF;;"}
1
+ {"version":3,"file":"readSliceFile.cjs","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":["buildSliceFilePath","readProjectFile"],"mappings":";;;;AAaA,eAAsB,cACrB,MAAuD;AAEvD,QAAM,WAAW,MAAMA,sCAAmB;AAAA,IACzC,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,SAAO,MAAMC,gBAAAA,gBAAgB;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AACF;;"}
@@ -1 +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;AAEjD,QAAA,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;"}
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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readSliceLibrary.cjs","sources":["../../../src/fs/readSliceLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\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":["buildSliceLibraryDirectoryPath","checkPathExists","fs.readdir","path","SHARED_SLICE_MODEL_FILENAME","readJSONFile","isSharedSliceModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoBa,MAAA,mBAAmB,OAC/B,SACwC;AACxC,QAAM,aAAaA,+BAAAA,+BAA+B;AAAA,IACjD,WAAW,KAAK;AAAA,IAChB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAE,MAAMC,gCAAgB,UAAU,GAAI;AAClC,WAAA;AAAA,MACN,IAAI,KAAK;AAAA,MACT,UAAU,CAAE;AAAA,IAAA;AAAA,EAEd;AAEM,QAAA,YAAY,MAAMC,gBAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,QAAM,uBAAiC,CAAA;AAEvC,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AACrB,YAAA,mBAAmB,MAAMA,QAAAA,QAC9BC,gBAAK,KAAK,YAAY,SAAS,IAAI,GACnC;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,aAAa,iBAAiB,KAAK,CAAC,UAAS;AAClD,eAAO,MAAM,OAAA,KAAY,MAAM,SAASC,UAAAA;AAAAA,MAAA,CACxC;AAED,UAAI,YAAY;AACf,cAAM,YAAYD,gBAAK,KACtB,YACA,SAAS,MACTC,UAAAA,2BAA2B;AAGxB,YAAA;AACG,gBAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,cAAAC,mBAAAA,mBAAmB,aAAa,GAAG;AAC7B,qBAAA,KAAK,cAAc,EAAE;AAAA,UAC/B;AAAA,QAAA,QACO;AAEP,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,EACA,CAAA,CAAC;AAGC,MAAA,qBAAqB,SAAS,GAAG;AAC9B,UAAA,iBAAiB,qBAAqB,KAAK,IAAI;AAErD,UAAM,IAAI,MACT,kDAAkD,cAAc,GAAG;AAAA,EAErE;AAEO,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;;"}
1
+ {"version":3,"file":"readSliceLibrary.cjs","sources":["../../../src/fs/readSliceLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\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":["buildSliceLibraryDirectoryPath","checkPathExists","fs.readdir","path","SHARED_SLICE_MODEL_FILENAME","readJSONFile","isSharedSliceModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,MAAM,mBAAmB,OAC/B,SACwC;AACxC,QAAM,aAAaA,+BAAAA,+BAA+B;AAAA,IACjD,WAAW,KAAK;AAAA,IAChB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAE,MAAMC,gCAAgB,UAAU,GAAI;AACzC,WAAO;AAAA,MACN,IAAI,KAAK;AAAA,MACT,UAAU,CAAA;AAAA,IAAA;AAAA,EAEZ;AAEA,QAAM,YAAY,MAAMC,QAAAA,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,QAAAA,QAC9BC,gBAAK,KAAK,YAAY,SAAS,IAAI,GACnC;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,aAAa,iBAAiB,KAAK,CAAC,UAAS;AAClD,eAAO,MAAM,OAAA,KAAY,MAAM,SAASC,UAAAA;AAAAA,MACzC,CAAC;AAED,UAAI,YAAY;AACf,cAAM,YAAYD,gBAAK,KACtB,YACA,SAAS,MACTC,qCAA2B;AAG5B,YAAI;AACH,gBAAM,gBAAgB,MAAMC,aAAAA,aAAa,SAAS;AAElD,cAAIC,mBAAAA,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;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readSliceLibrary.js","sources":["../../../src/fs/readSliceLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\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":";;;;;;;AAoBa,MAAA,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;AAClC,WAAA;AAAA,MACN,IAAI,KAAK;AAAA,MACT,UAAU,CAAE;AAAA,IAAA;AAAA,EAEd;AAEM,QAAA,YAAY,MAAMA,QAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,QAAM,uBAAiC,CAAA;AAEvC,QAAM,WAAqB,CAAA;AAC3B,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AACrB,YAAA,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,MAAA,CACxC;AAED,UAAI,YAAY;AACf,cAAM,YAAY,KAAK,KACtB,YACA,SAAS,MACT,2BAA2B;AAGxB,YAAA;AACG,gBAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,cAAA,mBAAmB,aAAa,GAAG;AAC7B,qBAAA,KAAK,cAAc,EAAE;AAAA,UAC/B;AAAA,QAAA,QACO;AAEP,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,EACA,CAAA,CAAC;AAGC,MAAA,qBAAqB,SAAS,GAAG;AAC9B,UAAA,iBAAiB,qBAAqB,KAAK,IAAI;AAErD,UAAM,IAAI,MACT,kDAAkD,cAAc,GAAG;AAAA,EAErE;AAEO,SAAA;AAAA,IACN,IAAI,KAAK;AAAA,IACT,UAAU,SAAS,KAAM;AAAA,EAAA;AAE3B;"}
1
+ {"version":3,"file":"readSliceLibrary.js","sources":["../../../src/fs/readSliceLibrary.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\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":";;;;;;;AAoBO,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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readSliceModel.cjs","sources":["../../../src/fs/readSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { buildSliceLibraryDirectoryPath } from \"./buildSliceLibraryDirectoryPath\";\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\n\nexport type ReadSliceModelArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport type ReadSliceModelReturnType = {\n\tmodel: SharedSlice;\n};\n\nexport const readSliceModel = async (\n\targs: ReadSliceModelArgs,\n): Promise<ReadSliceModelReturnType> => {\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\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t\t/**\n\t\t * Paths to models that could not be read due to invalid JSON.\n\t\t */\n\t\tconst unreadableModelPaths: string[] = [];\n\n\t\t// Find the first matching model.\n\t\tconst [model] = (\n\t\t\tawait Promise.all(\n\t\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\t\tconst modelPath = path.join(\n\t\t\t\t\t\t\tlibraryDir,\n\t\t\t\t\t\t\tchildDir.name,\n\t\t\t\t\t\t\tSHARED_SLICE_MODEL_FILENAME,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\t\t\tmodelContents.id === args.sliceID\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tunreadableModelPaths.push(modelPath);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\t\tif (model) {\n\t\t\treturn {\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\tif (unreadableModelPaths.length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${\n\t\t\t\t\t\targs.libraryID\n\t\t\t\t\t}\" Slice Library. The following Slice models could not be read: [${unreadableModelPaths.join(\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t)}]`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error(\n\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${args.libraryID}\" Slice Library.`,\n\t);\n};\n"],"names":["buildSliceLibraryDirectoryPath","checkPathExists","fs.readdir","path","SHARED_SLICE_MODEL_FILENAME","readJSONFile","isSharedSliceModel","model"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,iBAAiB,OAC7B,SACsC;AACtC,QAAM,aAAaA,+BAAAA,+BAA+B;AAAA,IACjD,WAAW,KAAK;AAAA,IAChB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAEG,MAAA,MAAMC,gBAAAA,gBAAgB,UAAU,GAAG;AAChC,UAAA,YAAY,MAAMC,gBAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,UAAM,uBAAiC,CAAA;AAGjC,UAAA,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,UAAA,SAAS,eAAe;AAC3B,cAAM,YAAYC,gBAAK,KACtB,YACA,SAAS,MACTC,UAAAA,2BAA2B;AAGxB,YAAA;AACG,gBAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAElD,cACCC,mBAAAA,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACM,mBAAA;AAAA,UACR;AAAA,iBACQ,OAAO;AACf,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IAAA,CACA,CAAC,GAEF,OAAO,CAACC,WAA8C,QAAQA,MAAK,CAAC;AAEtE,QAAI,OAAO;AACH,aAAA;AAAA,QACN;AAAA,MAAA;AAAA,WAEK;AACF,UAAA,qBAAqB,SAAS,GAAG;AACpC,cAAM,IAAI,MACT,uCAAuC,KAAK,OAAO,aAClD,KAAK,SACN,mEAAmE,qBAAqB,KACvF,IAAI,CACJ,GAAG;AAAA,MAEN;AAAA,IACD;AAAA,EACD;AAEM,QAAA,IAAI,MACT,uCAAuC,KAAK,OAAO,aAAa,KAAK,SAAS,kBAAkB;AAElG;;"}
1
+ {"version":3,"file":"readSliceModel.cjs","sources":["../../../src/fs/readSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { buildSliceLibraryDirectoryPath } from \"./buildSliceLibraryDirectoryPath\";\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\n\nexport type ReadSliceModelArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport type ReadSliceModelReturnType = {\n\tmodel: SharedSlice;\n};\n\nexport const readSliceModel = async (\n\targs: ReadSliceModelArgs,\n): Promise<ReadSliceModelReturnType> => {\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\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t\t/**\n\t\t * Paths to models that could not be read due to invalid JSON.\n\t\t */\n\t\tconst unreadableModelPaths: string[] = [];\n\n\t\t// Find the first matching model.\n\t\tconst [model] = (\n\t\t\tawait Promise.all(\n\t\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\t\tconst modelPath = path.join(\n\t\t\t\t\t\t\tlibraryDir,\n\t\t\t\t\t\t\tchildDir.name,\n\t\t\t\t\t\t\tSHARED_SLICE_MODEL_FILENAME,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\t\t\tmodelContents.id === args.sliceID\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tunreadableModelPaths.push(modelPath);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\t\tif (model) {\n\t\t\treturn {\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\tif (unreadableModelPaths.length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${\n\t\t\t\t\t\targs.libraryID\n\t\t\t\t\t}\" Slice Library. The following Slice models could not be read: [${unreadableModelPaths.join(\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t)}]`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error(\n\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${args.libraryID}\" Slice Library.`,\n\t);\n};\n"],"names":["buildSliceLibraryDirectoryPath","checkPathExists","fs.readdir","path","SHARED_SLICE_MODEL_FILENAME","readJSONFile","isSharedSliceModel","model"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,iBAAiB,OAC7B,SACsC;AACtC,QAAM,aAAaA,+BAAAA,+BAA+B;AAAA,IACjD,WAAW,KAAK;AAAA,IAChB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,MAAMC,gBAAAA,gBAAgB,UAAU,GAAG;AACtC,UAAM,YAAY,MAAMC,QAAAA,QAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,UAAM,uBAAiC,CAAA;AAGvC,UAAM,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAChC,UAAI,SAAS,eAAe;AAC3B,cAAM,YAAYC,gBAAK,KACtB,YACA,SAAS,MACTC,qCAA2B;AAG5B,YAAI;AACH,gBAAM,gBAAgB,MAAMC,aAAAA,aAAa,SAAS;AAElD,cACCC,mBAAAA,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACD,mBAAO;AAAA,UACR;AAAA,QACD,SAAS,OAAO;AACf,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD,CAAC,CAAC,GAEF,OAAO,CAACC,WAA8C,QAAQA,MAAK,CAAC;AAEtE,QAAI,OAAO;AACV,aAAO;AAAA,QACN;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,UAAI,qBAAqB,SAAS,GAAG;AACpC,cAAM,IAAI,MACT,uCAAuC,KAAK,OAAO,aAClD,KAAK,SACN,mEAAmE,qBAAqB,KACvF,IAAI,CACJ,GAAG;AAAA,MAEN;AAAA,IACD;AAAA,EACD;AAEA,QAAM,IAAI,MACT,uCAAuC,KAAK,OAAO,aAAa,KAAK,SAAS,kBAAkB;AAElG;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readSliceModel.js","sources":["../../../src/fs/readSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { buildSliceLibraryDirectoryPath } from \"./buildSliceLibraryDirectoryPath\";\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\n\nexport type ReadSliceModelArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport type ReadSliceModelReturnType = {\n\tmodel: SharedSlice;\n};\n\nexport const readSliceModel = async (\n\targs: ReadSliceModelArgs,\n): Promise<ReadSliceModelReturnType> => {\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\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t\t/**\n\t\t * Paths to models that could not be read due to invalid JSON.\n\t\t */\n\t\tconst unreadableModelPaths: string[] = [];\n\n\t\t// Find the first matching model.\n\t\tconst [model] = (\n\t\t\tawait Promise.all(\n\t\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\t\tconst modelPath = path.join(\n\t\t\t\t\t\t\tlibraryDir,\n\t\t\t\t\t\t\tchildDir.name,\n\t\t\t\t\t\t\tSHARED_SLICE_MODEL_FILENAME,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\t\t\tmodelContents.id === args.sliceID\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tunreadableModelPaths.push(modelPath);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\t\tif (model) {\n\t\t\treturn {\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\tif (unreadableModelPaths.length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${\n\t\t\t\t\t\targs.libraryID\n\t\t\t\t\t}\" Slice Library. The following Slice models could not be read: [${unreadableModelPaths.join(\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t)}]`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error(\n\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${args.libraryID}\" Slice Library.`,\n\t);\n};\n"],"names":["fs.readdir","model"],"mappings":";;;;;;;AAuBa,MAAA,iBAAiB,OAC7B,SACsC;AACtC,QAAM,aAAa,+BAA+B;AAAA,IACjD,WAAW,KAAK;AAAA,IAChB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAEG,MAAA,MAAM,gBAAgB,UAAU,GAAG;AAChC,UAAA,YAAY,MAAMA,QAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,UAAM,uBAAiC,CAAA;AAGjC,UAAA,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,UAAA,SAAS,eAAe;AAC3B,cAAM,YAAY,KAAK,KACtB,YACA,SAAS,MACT,2BAA2B;AAGxB,YAAA;AACG,gBAAA,gBAAgB,MAAM,aAAa,SAAS;AAElD,cACC,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACM,mBAAA;AAAA,UACR;AAAA,iBACQ,OAAO;AACf,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IAAA,CACA,CAAC,GAEF,OAAO,CAACC,WAA8C,QAAQA,MAAK,CAAC;AAEtE,QAAI,OAAO;AACH,aAAA;AAAA,QACN;AAAA,MAAA;AAAA,WAEK;AACF,UAAA,qBAAqB,SAAS,GAAG;AACpC,cAAM,IAAI,MACT,uCAAuC,KAAK,OAAO,aAClD,KAAK,SACN,mEAAmE,qBAAqB,KACvF,IAAI,CACJ,GAAG;AAAA,MAEN;AAAA,IACD;AAAA,EACD;AAEM,QAAA,IAAI,MACT,uCAAuC,KAAK,OAAO,aAAa,KAAK,SAAS,kBAAkB;AAElG;"}
1
+ {"version":3,"file":"readSliceModel.js","sources":["../../../src/fs/readSliceModel.ts"],"sourcesContent":["import { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { checkPathExists } from \"./lib/checkPathExists\";\nimport { isSharedSliceModel } from \"./lib/isSharedSliceModel\";\nimport { readJSONFile } from \"./lib/readJSONFile\";\nimport * as fs from \"./lib/fsLimit\";\n\nimport { buildSliceLibraryDirectoryPath } from \"./buildSliceLibraryDirectoryPath\";\nimport { SHARED_SLICE_MODEL_FILENAME } from \"./constants\";\n\nexport type ReadSliceModelArgs = {\n\tlibraryID: string;\n\tsliceID: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport type ReadSliceModelReturnType = {\n\tmodel: SharedSlice;\n};\n\nexport const readSliceModel = async (\n\targs: ReadSliceModelArgs,\n): Promise<ReadSliceModelReturnType> => {\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\tconst childDirs = await fs.readdir(libraryDir, { withFileTypes: true });\n\n\t\t/**\n\t\t * Paths to models that could not be read due to invalid JSON.\n\t\t */\n\t\tconst unreadableModelPaths: string[] = [];\n\n\t\t// Find the first matching model.\n\t\tconst [model] = (\n\t\t\tawait Promise.all(\n\t\t\t\tchildDirs.map(async (childDir) => {\n\t\t\t\t\tif (childDir.isDirectory()) {\n\t\t\t\t\t\tconst modelPath = path.join(\n\t\t\t\t\t\t\tlibraryDir,\n\t\t\t\t\t\t\tchildDir.name,\n\t\t\t\t\t\t\tSHARED_SLICE_MODEL_FILENAME,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisSharedSliceModel(modelContents) &&\n\t\t\t\t\t\t\t\tmodelContents.id === args.sliceID\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn modelContents;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tunreadableModelPaths.push(modelPath);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t).filter((model): model is NonNullable<typeof model> => Boolean(model));\n\n\t\tif (model) {\n\t\t\treturn {\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\tif (unreadableModelPaths.length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${\n\t\t\t\t\t\targs.libraryID\n\t\t\t\t\t}\" Slice Library. The following Slice models could not be read: [${unreadableModelPaths.join(\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t)}]`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error(\n\t\t`Did not find a Slice model with ID \"${args.sliceID}\" in the \"${args.libraryID}\" Slice Library.`,\n\t);\n};\n"],"names":["fs.readdir","model"],"mappings":";;;;;;;AAuBO,MAAM,iBAAiB,OAC7B,SACsC;AACtC,QAAM,aAAa,+BAA+B;AAAA,IACjD,WAAW,KAAK;AAAA,IAChB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,MAAM,gBAAgB,UAAU,GAAG;AACtC,UAAM,YAAY,MAAMA,QAAW,YAAY,EAAE,eAAe,MAAM;AAKtE,UAAM,uBAAiC,CAAA;AAGvC,UAAM,CAAC,KAAK,KACX,MAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAChC,UAAI,SAAS,eAAe;AAC3B,cAAM,YAAY,KAAK,KACtB,YACA,SAAS,MACT,2BAA2B;AAG5B,YAAI;AACH,gBAAM,gBAAgB,MAAM,aAAa,SAAS;AAElD,cACC,mBAAmB,aAAa,KAChC,cAAc,OAAO,KAAK,SACzB;AACD,mBAAO;AAAA,UACR;AAAA,QACD,SAAS,OAAO;AACf,+BAAqB,KAAK,SAAS;AAAA,QACpC;AAAA,MACD;AAAA,IACD,CAAC,CAAC,GAEF,OAAO,CAACC,WAA8C,QAAQA,MAAK,CAAC;AAEtE,QAAI,OAAO;AACV,aAAO;AAAA,QACN;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,UAAI,qBAAqB,SAAS,GAAG;AACpC,cAAM,IAAI,MACT,uCAAuC,KAAK,OAAO,aAClD,KAAK,SACN,mEAAmE,qBAAqB,KACvF,IAAI,CACJ,GAAG;AAAA,MAEN;AAAA,IACD;AAAA,EACD;AAEA,QAAM,IAAI,MACT,uCAAuC,KAAK,OAAO,aAAa,KAAK,SAAS,kBAAkB;AAElG;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readSliceTemplateLibrary.cjs","sources":["../../../src/fs/readSliceTemplateLibrary.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\nimport { SliceTemplateLibraryReadHookReturnType } from \"../hooks/sliceTemplateLibrary-read\";\n\nimport { checkIsTypeScriptProject } from \"./checkIsTypeScriptProject\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type ReadSliceTemplateLibraryArgs = {\n\thelpers: SliceMachineHelpers;\n\tdirName: string;\n\ttemplateIDs?: string[];\n\ttemplates: {\n\t\tmocks: SharedSliceContent[];\n\t\tscreenshotPaths: Record<string, string>;\n\t\tmodel: SharedSlice;\n\t}[];\n\tcomponentFileNames: {\n\t\tjs: string;\n\t\tts: string;\n\t};\n};\n\nexport const readSliceTemplateLibrary = async (\n\targs: ReadSliceTemplateLibraryArgs,\n): Promise<SliceTemplateLibraryReadHookReturnType> => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject(args);\n\n\tconst {\n\t\ttemplateIDs,\n\t\ttemplates: initialTemplates,\n\t\tdirName,\n\t\tcomponentFileNames,\n\t} = args;\n\n\tconst templates =\n\t\ttemplateIDs && templateIDs.length\n\t\t\t? initialTemplates.filter((t) => templateIDs?.includes(t.model.id))\n\t\t\t: initialTemplates;\n\n\tconst templatesPromises = templates.map(async (t) => {\n\t\tconst { mocks, model, screenshotPaths } = t;\n\n\t\tconst screenshotEntries = Object.entries(screenshotPaths);\n\t\tconst screenshotPromises = screenshotEntries.map(([key, filePath]) => {\n\t\t\treturn fs\n\t\t\t\t.readFile(path.join(dirName, filePath))\n\t\t\t\t.then((data) => [key, data]);\n\t\t});\n\t\tconst readScreenshots = await Promise.all(screenshotPromises);\n\t\tconst screenshots = Object.fromEntries(readScreenshots);\n\n\t\tconst fileName = isTypeScriptProject\n\t\t\t? componentFileNames.ts\n\t\t\t: componentFileNames.js;\n\n\t\tconst componentContentsTemplate = await fs.readFile(\n\t\t\tpath.join(dirName, model.name, fileName),\n\t\t\t\"utf-8\",\n\t\t);\n\n\t\treturn {\n\t\t\tmocks,\n\t\t\tmodel,\n\t\t\tcomponentContentsTemplate,\n\t\t\tscreenshots,\n\t\t};\n\t});\n\n\tconst resolvedTemplates = await Promise.all(templatesPromises);\n\n\treturn {\n\t\ttemplates: resolvedTemplates,\n\t};\n};\n"],"names":["checkIsTypeScriptProject","fs.readFile"],"mappings":";;;;;AA2Ba,MAAA,2BAA2B,OACvC,SACoD;AAC9C,QAAA,sBAAsB,MAAMA,kDAAyB,IAAI;AAE/D,QAAM,EACL,aACA,WAAW,kBACX,SACA,mBACG,IAAA;AAEJ,QAAM,YACL,eAAe,YAAY,SACxB,iBAAiB,OAAO,CAAC,MAAM,2CAAa,SAAS,EAAE,MAAM,GAAG,IAChE;AAEJ,QAAM,oBAAoB,UAAU,IAAI,OAAO,MAAK;AACnD,UAAM,EAAE,OAAO,OAAO,gBAAA,IAAoB;AAEpC,UAAA,oBAAoB,OAAO,QAAQ,eAAe;AACxD,UAAM,qBAAqB,kBAAkB,IAAI,CAAC,CAAC,KAAK,QAAQ,MAAK;AACpE,aAAOC,QACL,SAAS,KAAK,KAAK,SAAS,QAAQ,CAAC,EACrC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAAA,IAAA,CAC5B;AACD,UAAM,kBAAkB,MAAM,QAAQ,IAAI,kBAAkB;AACtD,UAAA,cAAc,OAAO,YAAY,eAAe;AAEtD,UAAM,WAAW,sBACd,mBAAmB,KACnB,mBAAmB;AAEhB,UAAA,4BAA4B,MAAMA,iBACvC,KAAK,KAAK,SAAS,MAAM,MAAM,QAAQ,GACvC,OAAO;AAGD,WAAA;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,GAED;AAED,QAAM,oBAAoB,MAAM,QAAQ,IAAI,iBAAiB;AAEtD,SAAA;AAAA,IACN,WAAW;AAAA,EAAA;AAEb;;"}
1
+ {"version":3,"file":"readSliceTemplateLibrary.cjs","sources":["../../../src/fs/readSliceTemplateLibrary.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\nimport { SliceTemplateLibraryReadHookReturnType } from \"../hooks/sliceTemplateLibrary-read\";\n\nimport { checkIsTypeScriptProject } from \"./checkIsTypeScriptProject\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type ReadSliceTemplateLibraryArgs = {\n\thelpers: SliceMachineHelpers;\n\tdirName: string;\n\ttemplateIDs?: string[];\n\ttemplates: {\n\t\tmocks: SharedSliceContent[];\n\t\tscreenshotPaths: Record<string, string>;\n\t\tmodel: SharedSlice;\n\t}[];\n\tcomponentFileNames: {\n\t\tjs: string;\n\t\tts: string;\n\t};\n};\n\nexport const readSliceTemplateLibrary = async (\n\targs: ReadSliceTemplateLibraryArgs,\n): Promise<SliceTemplateLibraryReadHookReturnType> => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject(args);\n\n\tconst {\n\t\ttemplateIDs,\n\t\ttemplates: initialTemplates,\n\t\tdirName,\n\t\tcomponentFileNames,\n\t} = args;\n\n\tconst templates =\n\t\ttemplateIDs && templateIDs.length\n\t\t\t? initialTemplates.filter((t) => templateIDs?.includes(t.model.id))\n\t\t\t: initialTemplates;\n\n\tconst templatesPromises = templates.map(async (t) => {\n\t\tconst { mocks, model, screenshotPaths } = t;\n\n\t\tconst screenshotEntries = Object.entries(screenshotPaths);\n\t\tconst screenshotPromises = screenshotEntries.map(([key, filePath]) => {\n\t\t\treturn fs\n\t\t\t\t.readFile(path.join(dirName, filePath))\n\t\t\t\t.then((data) => [key, data]);\n\t\t});\n\t\tconst readScreenshots = await Promise.all(screenshotPromises);\n\t\tconst screenshots = Object.fromEntries(readScreenshots);\n\n\t\tconst fileName = isTypeScriptProject\n\t\t\t? componentFileNames.ts\n\t\t\t: componentFileNames.js;\n\n\t\tconst componentContentsTemplate = await fs.readFile(\n\t\t\tpath.join(dirName, model.name, fileName),\n\t\t\t\"utf-8\",\n\t\t);\n\n\t\treturn {\n\t\t\tmocks,\n\t\t\tmodel,\n\t\t\tcomponentContentsTemplate,\n\t\t\tscreenshots,\n\t\t};\n\t});\n\n\tconst resolvedTemplates = await Promise.all(templatesPromises);\n\n\treturn {\n\t\ttemplates: resolvedTemplates,\n\t};\n};\n"],"names":["checkIsTypeScriptProject","fs.readFile"],"mappings":";;;;;AA2BO,MAAM,2BAA2B,OACvC,SACoD;AACpD,QAAM,sBAAsB,MAAMA,yBAAAA,yBAAyB,IAAI;AAE/D,QAAM,EACL,aACA,WAAW,kBACX,SACA,uBACG;AAEJ,QAAM,YACL,eAAe,YAAY,SACxB,iBAAiB,OAAO,CAAC,MAAM,2CAAa,SAAS,EAAE,MAAM,GAAG,IAChE;AAEJ,QAAM,oBAAoB,UAAU,IAAI,OAAO,MAAK;AACnD,UAAM,EAAE,OAAO,OAAO,gBAAA,IAAoB;AAE1C,UAAM,oBAAoB,OAAO,QAAQ,eAAe;AACxD,UAAM,qBAAqB,kBAAkB,IAAI,CAAC,CAAC,KAAK,QAAQ,MAAK;AACpE,aAAOC,iBACI,KAAK,KAAK,SAAS,QAAQ,CAAC,EACrC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAAA,IAC7B,CAAC;AACD,UAAM,kBAAkB,MAAM,QAAQ,IAAI,kBAAkB;AAC5D,UAAM,cAAc,OAAO,YAAY,eAAe;AAEtD,UAAM,WAAW,sBACd,mBAAmB,KACnB,mBAAmB;AAEtB,UAAM,4BAA4B,MAAMA,iBACvC,KAAK,KAAK,SAAS,MAAM,MAAM,QAAQ,GACvC,OAAO;AAGR,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEF,CAAC;AAED,QAAM,oBAAoB,MAAM,QAAQ,IAAI,iBAAiB;AAE7D,SAAO;AAAA,IACN,WAAW;AAAA,EAAA;AAEb;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"readSliceTemplateLibrary.js","sources":["../../../src/fs/readSliceTemplateLibrary.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\nimport { SliceTemplateLibraryReadHookReturnType } from \"../hooks/sliceTemplateLibrary-read\";\n\nimport { checkIsTypeScriptProject } from \"./checkIsTypeScriptProject\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type ReadSliceTemplateLibraryArgs = {\n\thelpers: SliceMachineHelpers;\n\tdirName: string;\n\ttemplateIDs?: string[];\n\ttemplates: {\n\t\tmocks: SharedSliceContent[];\n\t\tscreenshotPaths: Record<string, string>;\n\t\tmodel: SharedSlice;\n\t}[];\n\tcomponentFileNames: {\n\t\tjs: string;\n\t\tts: string;\n\t};\n};\n\nexport const readSliceTemplateLibrary = async (\n\targs: ReadSliceTemplateLibraryArgs,\n): Promise<SliceTemplateLibraryReadHookReturnType> => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject(args);\n\n\tconst {\n\t\ttemplateIDs,\n\t\ttemplates: initialTemplates,\n\t\tdirName,\n\t\tcomponentFileNames,\n\t} = args;\n\n\tconst templates =\n\t\ttemplateIDs && templateIDs.length\n\t\t\t? initialTemplates.filter((t) => templateIDs?.includes(t.model.id))\n\t\t\t: initialTemplates;\n\n\tconst templatesPromises = templates.map(async (t) => {\n\t\tconst { mocks, model, screenshotPaths } = t;\n\n\t\tconst screenshotEntries = Object.entries(screenshotPaths);\n\t\tconst screenshotPromises = screenshotEntries.map(([key, filePath]) => {\n\t\t\treturn fs\n\t\t\t\t.readFile(path.join(dirName, filePath))\n\t\t\t\t.then((data) => [key, data]);\n\t\t});\n\t\tconst readScreenshots = await Promise.all(screenshotPromises);\n\t\tconst screenshots = Object.fromEntries(readScreenshots);\n\n\t\tconst fileName = isTypeScriptProject\n\t\t\t? componentFileNames.ts\n\t\t\t: componentFileNames.js;\n\n\t\tconst componentContentsTemplate = await fs.readFile(\n\t\t\tpath.join(dirName, model.name, fileName),\n\t\t\t\"utf-8\",\n\t\t);\n\n\t\treturn {\n\t\t\tmocks,\n\t\t\tmodel,\n\t\t\tcomponentContentsTemplate,\n\t\t\tscreenshots,\n\t\t};\n\t});\n\n\tconst resolvedTemplates = await Promise.all(templatesPromises);\n\n\treturn {\n\t\ttemplates: resolvedTemplates,\n\t};\n};\n"],"names":["fs.readFile","path"],"mappings":";;;AA2Ba,MAAA,2BAA2B,OACvC,SACoD;AAC9C,QAAA,sBAAsB,MAAM,yBAAyB,IAAI;AAE/D,QAAM,EACL,aACA,WAAW,kBACX,SACA,mBACG,IAAA;AAEJ,QAAM,YACL,eAAe,YAAY,SACxB,iBAAiB,OAAO,CAAC,MAAM,2CAAa,SAAS,EAAE,MAAM,GAAG,IAChE;AAEJ,QAAM,oBAAoB,UAAU,IAAI,OAAO,MAAK;AACnD,UAAM,EAAE,OAAO,OAAO,gBAAA,IAAoB;AAEpC,UAAA,oBAAoB,OAAO,QAAQ,eAAe;AACxD,UAAM,qBAAqB,kBAAkB,IAAI,CAAC,CAAC,KAAK,QAAQ,MAAK;AACpE,aAAOA,SACIC,cAAK,KAAK,SAAS,QAAQ,CAAC,EACrC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAAA,IAAA,CAC5B;AACD,UAAM,kBAAkB,MAAM,QAAQ,IAAI,kBAAkB;AACtD,UAAA,cAAc,OAAO,YAAY,eAAe;AAEtD,UAAM,WAAW,sBACd,mBAAmB,KACnB,mBAAmB;AAEhB,UAAA,4BAA4B,MAAMD,SACvCC,cAAK,KAAK,SAAS,MAAM,MAAM,QAAQ,GACvC,OAAO;AAGD,WAAA;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,GAED;AAED,QAAM,oBAAoB,MAAM,QAAQ,IAAI,iBAAiB;AAEtD,SAAA;AAAA,IACN,WAAW;AAAA,EAAA;AAEb;"}
1
+ {"version":3,"file":"readSliceTemplateLibrary.js","sources":["../../../src/fs/readSliceTemplateLibrary.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\nimport { SliceTemplateLibraryReadHookReturnType } from \"../hooks/sliceTemplateLibrary-read\";\n\nimport { checkIsTypeScriptProject } from \"./checkIsTypeScriptProject\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type ReadSliceTemplateLibraryArgs = {\n\thelpers: SliceMachineHelpers;\n\tdirName: string;\n\ttemplateIDs?: string[];\n\ttemplates: {\n\t\tmocks: SharedSliceContent[];\n\t\tscreenshotPaths: Record<string, string>;\n\t\tmodel: SharedSlice;\n\t}[];\n\tcomponentFileNames: {\n\t\tjs: string;\n\t\tts: string;\n\t};\n};\n\nexport const readSliceTemplateLibrary = async (\n\targs: ReadSliceTemplateLibraryArgs,\n): Promise<SliceTemplateLibraryReadHookReturnType> => {\n\tconst isTypeScriptProject = await checkIsTypeScriptProject(args);\n\n\tconst {\n\t\ttemplateIDs,\n\t\ttemplates: initialTemplates,\n\t\tdirName,\n\t\tcomponentFileNames,\n\t} = args;\n\n\tconst templates =\n\t\ttemplateIDs && templateIDs.length\n\t\t\t? initialTemplates.filter((t) => templateIDs?.includes(t.model.id))\n\t\t\t: initialTemplates;\n\n\tconst templatesPromises = templates.map(async (t) => {\n\t\tconst { mocks, model, screenshotPaths } = t;\n\n\t\tconst screenshotEntries = Object.entries(screenshotPaths);\n\t\tconst screenshotPromises = screenshotEntries.map(([key, filePath]) => {\n\t\t\treturn fs\n\t\t\t\t.readFile(path.join(dirName, filePath))\n\t\t\t\t.then((data) => [key, data]);\n\t\t});\n\t\tconst readScreenshots = await Promise.all(screenshotPromises);\n\t\tconst screenshots = Object.fromEntries(readScreenshots);\n\n\t\tconst fileName = isTypeScriptProject\n\t\t\t? componentFileNames.ts\n\t\t\t: componentFileNames.js;\n\n\t\tconst componentContentsTemplate = await fs.readFile(\n\t\t\tpath.join(dirName, model.name, fileName),\n\t\t\t\"utf-8\",\n\t\t);\n\n\t\treturn {\n\t\t\tmocks,\n\t\t\tmodel,\n\t\t\tcomponentContentsTemplate,\n\t\t\tscreenshots,\n\t\t};\n\t});\n\n\tconst resolvedTemplates = await Promise.all(templatesPromises);\n\n\treturn {\n\t\ttemplates: resolvedTemplates,\n\t};\n};\n"],"names":["fs.readFile","path"],"mappings":";;;AA2BO,MAAM,2BAA2B,OACvC,SACoD;AACpD,QAAM,sBAAsB,MAAM,yBAAyB,IAAI;AAE/D,QAAM,EACL,aACA,WAAW,kBACX,SACA,uBACG;AAEJ,QAAM,YACL,eAAe,YAAY,SACxB,iBAAiB,OAAO,CAAC,MAAM,2CAAa,SAAS,EAAE,MAAM,GAAG,IAChE;AAEJ,QAAM,oBAAoB,UAAU,IAAI,OAAO,MAAK;AACnD,UAAM,EAAE,OAAO,OAAO,gBAAA,IAAoB;AAE1C,UAAM,oBAAoB,OAAO,QAAQ,eAAe;AACxD,UAAM,qBAAqB,kBAAkB,IAAI,CAAC,CAAC,KAAK,QAAQ,MAAK;AACpE,aAAOA,SACIC,cAAK,KAAK,SAAS,QAAQ,CAAC,EACrC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAAA,IAC7B,CAAC;AACD,UAAM,kBAAkB,MAAM,QAAQ,IAAI,kBAAkB;AAC5D,UAAM,cAAc,OAAO,YAAY,eAAe;AAEtD,UAAM,WAAW,sBACd,mBAAmB,KACnB,mBAAmB;AAEtB,UAAM,4BAA4B,MAAMD,SACvCC,cAAK,KAAK,SAAS,MAAM,MAAM,QAAQ,GACvC,OAAO;AAGR,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEF,CAAC;AAED,QAAM,oBAAoB,MAAM,QAAQ,IAAI,iBAAiB;AAE7D,SAAO;AAAA,IACN,WAAW;AAAA,EAAA;AAEb;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renameCustomType.cjs","sources":["../../../src/fs/renameCustomType.ts"],"sourcesContent":["import {\n\twriteCustomTypeModel,\n\tWriteCustomTypeModelArgs,\n} from \"./writeCustomTypeModel\";\n\nexport type RenameCustomTypeArgs = WriteCustomTypeModelArgs;\n\nexport const renameCustomType = async (\n\targs: RenameCustomTypeArgs,\n): Promise<void> => {\n\tawait writeCustomTypeModel(args);\n};\n"],"names":["writeCustomTypeModel"],"mappings":";;;AAOa,MAAA,mBAAmB,OAC/B,SACkB;AAClB,QAAMA,qBAAAA,qBAAqB,IAAI;AAChC;;"}
1
+ {"version":3,"file":"renameCustomType.cjs","sources":["../../../src/fs/renameCustomType.ts"],"sourcesContent":["import {\n\twriteCustomTypeModel,\n\tWriteCustomTypeModelArgs,\n} from \"./writeCustomTypeModel\";\n\nexport type RenameCustomTypeArgs = WriteCustomTypeModelArgs;\n\nexport const renameCustomType = async (\n\targs: RenameCustomTypeArgs,\n): Promise<void> => {\n\tawait writeCustomTypeModel(args);\n};\n"],"names":["writeCustomTypeModel"],"mappings":";;;AAOO,MAAM,mBAAmB,OAC/B,SACkB;AAClB,QAAMA,qBAAAA,qBAAqB,IAAI;AAChC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renameCustomType.js","sources":["../../../src/fs/renameCustomType.ts"],"sourcesContent":["import {\n\twriteCustomTypeModel,\n\tWriteCustomTypeModelArgs,\n} from \"./writeCustomTypeModel\";\n\nexport type RenameCustomTypeArgs = WriteCustomTypeModelArgs;\n\nexport const renameCustomType = async (\n\targs: RenameCustomTypeArgs,\n): Promise<void> => {\n\tawait writeCustomTypeModel(args);\n};\n"],"names":[],"mappings":";AAOa,MAAA,mBAAmB,OAC/B,SACkB;AAClB,QAAM,qBAAqB,IAAI;AAChC;"}
1
+ {"version":3,"file":"renameCustomType.js","sources":["../../../src/fs/renameCustomType.ts"],"sourcesContent":["import {\n\twriteCustomTypeModel,\n\tWriteCustomTypeModelArgs,\n} from \"./writeCustomTypeModel\";\n\nexport type RenameCustomTypeArgs = WriteCustomTypeModelArgs;\n\nexport const renameCustomType = async (\n\targs: RenameCustomTypeArgs,\n): Promise<void> => {\n\tawait writeCustomTypeModel(args);\n};\n"],"names":[],"mappings":";AAOO,MAAM,mBAAmB,OAC/B,SACkB;AAClB,QAAM,qBAAqB,IAAI;AAChC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renameSlice.cjs","sources":["../../../src/fs/renameSlice.ts"],"sourcesContent":["import * as fse from \"fs-extra\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { writeSliceModel, WriteSliceModelArgs } from \"./writeSliceModel\";\n\nexport type RenameSliceArgs = {\n\tactions: SliceMachineActions;\n} & Omit<BuildSliceDirectoryPathArgs, \"sliceID\"> &\n\tWriteSliceModelArgs;\n\nexport const renameSlice = async (args: RenameSliceArgs): Promise<void> => {\n\tconst { model: existingModel } = await args.actions.readSliceModel({\n\t\tlibraryID: args.libraryID,\n\t\tsliceID: args.model.id,\n\t});\n\n\tawait fse.move(\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tmodel: existingModel,\n\t\t\tabsolute: true,\n\t\t}),\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tabsolute: true,\n\t\t}),\n\t);\n\n\tawait writeSliceModel(args);\n};\n"],"names":["fse","buildSliceDirectoryPath","writeSliceModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAea,MAAA,cAAc,OAAO,SAAwC;AACzE,QAAM,EAAE,OAAO,cAAA,IAAkB,MAAM,KAAK,QAAQ,eAAe;AAAA,IAClE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAEK,QAAAA,eAAI,KACT,MAAMC,gDAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,OAAO;AAAA,IACP,UAAU;AAAA,EAAA,CACV,GACD,MAAMA,wBAAAA,wBAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU;AAAA,EACV,CAAA,CAAC;AAGH,QAAMC,gBAAAA,gBAAgB,IAAI;AAC3B;;"}
1
+ {"version":3,"file":"renameSlice.cjs","sources":["../../../src/fs/renameSlice.ts"],"sourcesContent":["import * as fse from \"fs-extra\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { writeSliceModel, WriteSliceModelArgs } from \"./writeSliceModel\";\n\nexport type RenameSliceArgs = {\n\tactions: SliceMachineActions;\n} & Omit<BuildSliceDirectoryPathArgs, \"sliceID\"> &\n\tWriteSliceModelArgs;\n\nexport const renameSlice = async (args: RenameSliceArgs): Promise<void> => {\n\tconst { model: existingModel } = await args.actions.readSliceModel({\n\t\tlibraryID: args.libraryID,\n\t\tsliceID: args.model.id,\n\t});\n\n\tawait fse.move(\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tmodel: existingModel,\n\t\t\tabsolute: true,\n\t\t}),\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tabsolute: true,\n\t\t}),\n\t);\n\n\tawait writeSliceModel(args);\n};\n"],"names":["fse","buildSliceDirectoryPath","writeSliceModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAeO,MAAM,cAAc,OAAO,SAAwC;AACzE,QAAM,EAAE,OAAO,cAAA,IAAkB,MAAM,KAAK,QAAQ,eAAe;AAAA,IAClE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAED,QAAMA,eAAI,KACT,MAAMC,gDAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,OAAO;AAAA,IACP,UAAU;AAAA,EAAA,CACV,GACD,MAAMA,wBAAAA,wBAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV,CAAC;AAGH,QAAMC,gBAAAA,gBAAgB,IAAI;AAC3B;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renameSlice.js","sources":["../../../src/fs/renameSlice.ts"],"sourcesContent":["import * as fse from \"fs-extra\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { writeSliceModel, WriteSliceModelArgs } from \"./writeSliceModel\";\n\nexport type RenameSliceArgs = {\n\tactions: SliceMachineActions;\n} & Omit<BuildSliceDirectoryPathArgs, \"sliceID\"> &\n\tWriteSliceModelArgs;\n\nexport const renameSlice = async (args: RenameSliceArgs): Promise<void> => {\n\tconst { model: existingModel } = await args.actions.readSliceModel({\n\t\tlibraryID: args.libraryID,\n\t\tsliceID: args.model.id,\n\t});\n\n\tawait fse.move(\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tmodel: existingModel,\n\t\t\tabsolute: true,\n\t\t}),\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tabsolute: true,\n\t\t}),\n\t);\n\n\tawait writeSliceModel(args);\n};\n"],"names":[],"mappings":";;;AAea,MAAA,cAAc,OAAO,SAAwC;AACzE,QAAM,EAAE,OAAO,cAAA,IAAkB,MAAM,KAAK,QAAQ,eAAe;AAAA,IAClE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAEK,QAAA,IAAI,KACT,MAAM,wBAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,OAAO;AAAA,IACP,UAAU;AAAA,EAAA,CACV,GACD,MAAM,wBAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU;AAAA,EACV,CAAA,CAAC;AAGH,QAAM,gBAAgB,IAAI;AAC3B;"}
1
+ {"version":3,"file":"renameSlice.js","sources":["../../../src/fs/renameSlice.ts"],"sourcesContent":["import * as fse from \"fs-extra\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { writeSliceModel, WriteSliceModelArgs } from \"./writeSliceModel\";\n\nexport type RenameSliceArgs = {\n\tactions: SliceMachineActions;\n} & Omit<BuildSliceDirectoryPathArgs, \"sliceID\"> &\n\tWriteSliceModelArgs;\n\nexport const renameSlice = async (args: RenameSliceArgs): Promise<void> => {\n\tconst { model: existingModel } = await args.actions.readSliceModel({\n\t\tlibraryID: args.libraryID,\n\t\tsliceID: args.model.id,\n\t});\n\n\tawait fse.move(\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tmodel: existingModel,\n\t\t\tabsolute: true,\n\t\t}),\n\t\tawait buildSliceDirectoryPath({\n\t\t\t...args,\n\t\t\tabsolute: true,\n\t\t}),\n\t);\n\n\tawait writeSliceModel(args);\n};\n"],"names":[],"mappings":";;;AAeO,MAAM,cAAc,OAAO,SAAwC;AACzE,QAAM,EAAE,OAAO,cAAA,IAAkB,MAAM,KAAK,QAAQ,eAAe;AAAA,IAClE,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK,MAAM;AAAA,EAAA,CACpB;AAED,QAAM,IAAI,KACT,MAAM,wBAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,OAAO;AAAA,IACP,UAAU;AAAA,EAAA,CACV,GACD,MAAM,wBAAwB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV,CAAC;AAGH,QAAM,gBAAgB,IAAI;AAC3B;"}
@@ -1 +1 @@
1
- {"version":3,"file":"upsertGlobalTypeScriptTypes.cjs","sources":["../../../src/fs/upsertGlobalTypeScriptTypes.ts"],"sourcesContent":["import { detectTypesProvider, generateTypes } from \"prismic-ts-codegen\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\nimport {\n\tGLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\tNON_EDITABLE_FILE_BANNER,\n} from \"./constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\nexport type UpsertGlobalTypeScriptTypesArgs = {\n\tfilename?: string;\n\tactions: SliceMachineActions;\n} & Omit<WriteProjectFileArgs, \"filename\" | \"contents\">;\n\n/**\n * Creates a globally accessible TypeScript file containing types representing\n * the Prismic repository's content.\n *\n * @returns The file path to the written file.\n */\nexport const upsertGlobalTypeScriptTypes = async (\n\targs: UpsertGlobalTypeScriptTypesArgs,\n): Promise<string> => {\n\tconst project = await args.helpers.getProject();\n\n\tconst [customTypeModelDescriptors, sharedSliceModelDescriptors] =\n\t\tawait Promise.all([\n\t\t\targs.actions.readAllCustomTypeModels(),\n\t\t\targs.actions.readAllSliceModels(),\n\t\t]);\n\n\tconst customTypeModels = customTypeModelDescriptors.map(\n\t\t(customTypeModelDescriptors) => {\n\t\t\treturn customTypeModelDescriptors.model;\n\t\t},\n\t);\n\tconst sharedSliceModels = sharedSliceModelDescriptors.map(\n\t\t(sharedSliceModelDescriptors) => {\n\t\t\treturn sharedSliceModelDescriptors.model;\n\t\t},\n\t);\n\n\tlet contents = generateTypes({\n\t\tcustomTypeModels,\n\t\tsharedSliceModels,\n\t\tclientIntegration: {\n\t\t\tincludeCreateClientInterface: true,\n\t\t\tincludeContentNamespace: true,\n\t\t},\n\t\ttypesProvider: await detectTypesProvider({ cwd: project.root }),\n\t});\n\n\tcontents = `${NON_EDITABLE_FILE_BANNER}\\n\\n${contents}`;\n\n\treturn await writeProjectFile({\n\t\t...args,\n\t\tfilename: args.filename || GLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\t\tcontents,\n\t});\n};\n"],"names":["customTypeModelDescriptors","sharedSliceModelDescriptors","generateTypes","detectTypesProvider","NON_EDITABLE_FILE_BANNER","writeProjectFile","GLOBAL_TYPESCRIPT_TYPES_FILENAME"],"mappings":";;;;;AAwBa,MAAA,8BAA8B,OAC1C,SACoB;AACpB,QAAM,UAAU,MAAM,KAAK,QAAQ,WAAU;AAE7C,QAAM,CAAC,4BAA4B,2BAA2B,IAC7D,MAAM,QAAQ,IAAI;AAAA,IACjB,KAAK,QAAQ,wBAAyB;AAAA,IACtC,KAAK,QAAQ,mBAAoB;AAAA,EAAA,CACjC;AAEF,QAAM,mBAAmB,2BAA2B,IACnD,CAACA,gCAA8B;AAC9B,WAAOA,4BAA2B;AAAA,EAAA,CAClC;AAEF,QAAM,oBAAoB,4BAA4B,IACrD,CAACC,iCAA+B;AAC/B,WAAOA,6BAA4B;AAAA,EAAA,CACnC;AAGF,MAAI,WAAWC,iBAAAA,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,MAClB,8BAA8B;AAAA,MAC9B,yBAAyB;AAAA,IACzB;AAAA,IACD,eAAe,MAAMC,iBAAAA,oBAAoB,EAAE,KAAK,QAAQ,MAAM;AAAA,EAAA,CAC9D;AAED,aAAW,GAAGC,kCAAwB;AAAA;AAAA,EAAO,QAAQ;AAErD,SAAO,MAAMC,iBAAAA,iBAAiB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU,KAAK,YAAYC,UAAA;AAAA,IAC3B;AAAA,EAAA,CACA;AACF;;"}
1
+ {"version":3,"file":"upsertGlobalTypeScriptTypes.cjs","sources":["../../../src/fs/upsertGlobalTypeScriptTypes.ts"],"sourcesContent":["import { detectTypesProvider, generateTypes } from \"prismic-ts-codegen\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\nimport {\n\tGLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\tNON_EDITABLE_FILE_BANNER,\n} from \"./constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\nexport type UpsertGlobalTypeScriptTypesArgs = {\n\tfilename?: string;\n\tactions: SliceMachineActions;\n} & Omit<WriteProjectFileArgs, \"filename\" | \"contents\">;\n\n/**\n * Creates a globally accessible TypeScript file containing types representing\n * the Prismic repository's content.\n *\n * @returns The file path to the written file.\n */\nexport const upsertGlobalTypeScriptTypes = async (\n\targs: UpsertGlobalTypeScriptTypesArgs,\n): Promise<string> => {\n\tconst project = await args.helpers.getProject();\n\n\tconst [customTypeModelDescriptors, sharedSliceModelDescriptors] =\n\t\tawait Promise.all([\n\t\t\targs.actions.readAllCustomTypeModels(),\n\t\t\targs.actions.readAllSliceModels(),\n\t\t]);\n\n\tconst customTypeModels = customTypeModelDescriptors.map(\n\t\t(customTypeModelDescriptors) => {\n\t\t\treturn customTypeModelDescriptors.model;\n\t\t},\n\t);\n\tconst sharedSliceModels = sharedSliceModelDescriptors.map(\n\t\t(sharedSliceModelDescriptors) => {\n\t\t\treturn sharedSliceModelDescriptors.model;\n\t\t},\n\t);\n\n\tlet contents = generateTypes({\n\t\tcustomTypeModels,\n\t\tsharedSliceModels,\n\t\tclientIntegration: {\n\t\t\tincludeCreateClientInterface: true,\n\t\t\tincludeContentNamespace: true,\n\t\t},\n\t\ttypesProvider: await detectTypesProvider({ cwd: project.root }),\n\t});\n\n\tcontents = `${NON_EDITABLE_FILE_BANNER}\\n\\n${contents}`;\n\n\treturn await writeProjectFile({\n\t\t...args,\n\t\tfilename: args.filename || GLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\t\tcontents,\n\t});\n};\n"],"names":["customTypeModelDescriptors","sharedSliceModelDescriptors","generateTypes","detectTypesProvider","NON_EDITABLE_FILE_BANNER","writeProjectFile","GLOBAL_TYPESCRIPT_TYPES_FILENAME"],"mappings":";;;;;AAwBO,MAAM,8BAA8B,OAC1C,SACoB;AACpB,QAAM,UAAU,MAAM,KAAK,QAAQ,WAAA;AAEnC,QAAM,CAAC,4BAA4B,2BAA2B,IAC7D,MAAM,QAAQ,IAAI;AAAA,IACjB,KAAK,QAAQ,wBAAA;AAAA,IACb,KAAK,QAAQ,mBAAA;AAAA,EAAkB,CAC/B;AAEF,QAAM,mBAAmB,2BAA2B,IACnD,CAACA,gCAA8B;AAC9B,WAAOA,4BAA2B;AAAA,EACnC,CAAC;AAEF,QAAM,oBAAoB,4BAA4B,IACrD,CAACC,iCAA+B;AAC/B,WAAOA,6BAA4B;AAAA,EACpC,CAAC;AAGF,MAAI,WAAWC,iBAAAA,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,MAClB,8BAA8B;AAAA,MAC9B,yBAAyB;AAAA,IAAA;AAAA,IAE1B,eAAe,MAAMC,iBAAAA,oBAAoB,EAAE,KAAK,QAAQ,MAAM;AAAA,EAAA,CAC9D;AAED,aAAW,GAAGC,UAAAA,wBAAwB;AAAA;AAAA,EAAO,QAAQ;AAErD,SAAO,MAAMC,iBAAAA,iBAAiB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU,KAAK,YAAYC,UAAAA;AAAAA,IAC3B;AAAA,EAAA,CACA;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"upsertGlobalTypeScriptTypes.js","sources":["../../../src/fs/upsertGlobalTypeScriptTypes.ts"],"sourcesContent":["import { detectTypesProvider, generateTypes } from \"prismic-ts-codegen\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\nimport {\n\tGLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\tNON_EDITABLE_FILE_BANNER,\n} from \"./constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\nexport type UpsertGlobalTypeScriptTypesArgs = {\n\tfilename?: string;\n\tactions: SliceMachineActions;\n} & Omit<WriteProjectFileArgs, \"filename\" | \"contents\">;\n\n/**\n * Creates a globally accessible TypeScript file containing types representing\n * the Prismic repository's content.\n *\n * @returns The file path to the written file.\n */\nexport const upsertGlobalTypeScriptTypes = async (\n\targs: UpsertGlobalTypeScriptTypesArgs,\n): Promise<string> => {\n\tconst project = await args.helpers.getProject();\n\n\tconst [customTypeModelDescriptors, sharedSliceModelDescriptors] =\n\t\tawait Promise.all([\n\t\t\targs.actions.readAllCustomTypeModels(),\n\t\t\targs.actions.readAllSliceModels(),\n\t\t]);\n\n\tconst customTypeModels = customTypeModelDescriptors.map(\n\t\t(customTypeModelDescriptors) => {\n\t\t\treturn customTypeModelDescriptors.model;\n\t\t},\n\t);\n\tconst sharedSliceModels = sharedSliceModelDescriptors.map(\n\t\t(sharedSliceModelDescriptors) => {\n\t\t\treturn sharedSliceModelDescriptors.model;\n\t\t},\n\t);\n\n\tlet contents = generateTypes({\n\t\tcustomTypeModels,\n\t\tsharedSliceModels,\n\t\tclientIntegration: {\n\t\t\tincludeCreateClientInterface: true,\n\t\t\tincludeContentNamespace: true,\n\t\t},\n\t\ttypesProvider: await detectTypesProvider({ cwd: project.root }),\n\t});\n\n\tcontents = `${NON_EDITABLE_FILE_BANNER}\\n\\n${contents}`;\n\n\treturn await writeProjectFile({\n\t\t...args,\n\t\tfilename: args.filename || GLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\t\tcontents,\n\t});\n};\n"],"names":["customTypeModelDescriptors","sharedSliceModelDescriptors"],"mappings":";;;AAwBa,MAAA,8BAA8B,OAC1C,SACoB;AACpB,QAAM,UAAU,MAAM,KAAK,QAAQ,WAAU;AAE7C,QAAM,CAAC,4BAA4B,2BAA2B,IAC7D,MAAM,QAAQ,IAAI;AAAA,IACjB,KAAK,QAAQ,wBAAyB;AAAA,IACtC,KAAK,QAAQ,mBAAoB;AAAA,EAAA,CACjC;AAEF,QAAM,mBAAmB,2BAA2B,IACnD,CAACA,gCAA8B;AAC9B,WAAOA,4BAA2B;AAAA,EAAA,CAClC;AAEF,QAAM,oBAAoB,4BAA4B,IACrD,CAACC,iCAA+B;AAC/B,WAAOA,6BAA4B;AAAA,EAAA,CACnC;AAGF,MAAI,WAAW,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,MAClB,8BAA8B;AAAA,MAC9B,yBAAyB;AAAA,IACzB;AAAA,IACD,eAAe,MAAM,oBAAoB,EAAE,KAAK,QAAQ,MAAM;AAAA,EAAA,CAC9D;AAED,aAAW,GAAG,wBAAwB;AAAA;AAAA,EAAO,QAAQ;AAErD,SAAO,MAAM,iBAAiB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU,KAAK,YAAY;AAAA,IAC3B;AAAA,EAAA,CACA;AACF;"}
1
+ {"version":3,"file":"upsertGlobalTypeScriptTypes.js","sources":["../../../src/fs/upsertGlobalTypeScriptTypes.ts"],"sourcesContent":["import { detectTypesProvider, generateTypes } from \"prismic-ts-codegen\";\n\nimport { SliceMachineActions } from \"../createSliceMachineActions\";\n\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\nimport {\n\tGLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\tNON_EDITABLE_FILE_BANNER,\n} from \"./constants\";\n\n/**\n * Arguments for `upsertGlobalContentTypes()`.\n */\nexport type UpsertGlobalTypeScriptTypesArgs = {\n\tfilename?: string;\n\tactions: SliceMachineActions;\n} & Omit<WriteProjectFileArgs, \"filename\" | \"contents\">;\n\n/**\n * Creates a globally accessible TypeScript file containing types representing\n * the Prismic repository's content.\n *\n * @returns The file path to the written file.\n */\nexport const upsertGlobalTypeScriptTypes = async (\n\targs: UpsertGlobalTypeScriptTypesArgs,\n): Promise<string> => {\n\tconst project = await args.helpers.getProject();\n\n\tconst [customTypeModelDescriptors, sharedSliceModelDescriptors] =\n\t\tawait Promise.all([\n\t\t\targs.actions.readAllCustomTypeModels(),\n\t\t\targs.actions.readAllSliceModels(),\n\t\t]);\n\n\tconst customTypeModels = customTypeModelDescriptors.map(\n\t\t(customTypeModelDescriptors) => {\n\t\t\treturn customTypeModelDescriptors.model;\n\t\t},\n\t);\n\tconst sharedSliceModels = sharedSliceModelDescriptors.map(\n\t\t(sharedSliceModelDescriptors) => {\n\t\t\treturn sharedSliceModelDescriptors.model;\n\t\t},\n\t);\n\n\tlet contents = generateTypes({\n\t\tcustomTypeModels,\n\t\tsharedSliceModels,\n\t\tclientIntegration: {\n\t\t\tincludeCreateClientInterface: true,\n\t\t\tincludeContentNamespace: true,\n\t\t},\n\t\ttypesProvider: await detectTypesProvider({ cwd: project.root }),\n\t});\n\n\tcontents = `${NON_EDITABLE_FILE_BANNER}\\n\\n${contents}`;\n\n\treturn await writeProjectFile({\n\t\t...args,\n\t\tfilename: args.filename || GLOBAL_TYPESCRIPT_TYPES_FILENAME,\n\t\tcontents,\n\t});\n};\n"],"names":["customTypeModelDescriptors","sharedSliceModelDescriptors"],"mappings":";;;AAwBO,MAAM,8BAA8B,OAC1C,SACoB;AACpB,QAAM,UAAU,MAAM,KAAK,QAAQ,WAAA;AAEnC,QAAM,CAAC,4BAA4B,2BAA2B,IAC7D,MAAM,QAAQ,IAAI;AAAA,IACjB,KAAK,QAAQ,wBAAA;AAAA,IACb,KAAK,QAAQ,mBAAA;AAAA,EAAkB,CAC/B;AAEF,QAAM,mBAAmB,2BAA2B,IACnD,CAACA,gCAA8B;AAC9B,WAAOA,4BAA2B;AAAA,EACnC,CAAC;AAEF,QAAM,oBAAoB,4BAA4B,IACrD,CAACC,iCAA+B;AAC/B,WAAOA,6BAA4B;AAAA,EACpC,CAAC;AAGF,MAAI,WAAW,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,MAClB,8BAA8B;AAAA,MAC9B,yBAAyB;AAAA,IAAA;AAAA,IAE1B,eAAe,MAAM,oBAAoB,EAAE,KAAK,QAAQ,MAAM;AAAA,EAAA,CAC9D;AAED,aAAW,GAAG,wBAAwB;AAAA;AAAA,EAAO,QAAQ;AAErD,SAAO,MAAM,iBAAiB;AAAA,IAC7B,GAAG;AAAA,IACH,UAAU,KAAK,YAAY;AAAA,IAC3B;AAAA,EAAA,CACA;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeCustomTypeFile.cjs","sources":["../../../src/fs/writeCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteCustomTypeFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildCustomTypeFilePathArgs;\n\n/**\n * Writes a custom type model to the file system.\n *\n * @returns The file path to the written file.\n */\nexport const writeCustomTypeFile = async (\n\targs: WriteCustomTypeFileArgs,\n): Promise<string> => {\n\tconst filePath = buildCustomTypeFilePath(args);\n\tconst relativeFilePath = buildCustomTypeFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildCustomTypeFilePath","writeProjectFile"],"mappings":";;;;AAca,MAAA,sBAAsB,OAClC,SACoB;AACd,QAAA,WAAWA,gDAAwB,IAAI;AAC7C,QAAM,mBAAmBA,wBAAAA,wBAAwB;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,kCAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAEM,SAAA;AACR;;"}
1
+ {"version":3,"file":"writeCustomTypeFile.cjs","sources":["../../../src/fs/writeCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteCustomTypeFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildCustomTypeFilePathArgs;\n\n/**\n * Writes a custom type model to the file system.\n *\n * @returns The file path to the written file.\n */\nexport const writeCustomTypeFile = async (\n\targs: WriteCustomTypeFileArgs,\n): Promise<string> => {\n\tconst filePath = buildCustomTypeFilePath(args);\n\tconst relativeFilePath = buildCustomTypeFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildCustomTypeFilePath","writeProjectFile"],"mappings":";;;;AAcO,MAAM,sBAAsB,OAClC,SACoB;AACpB,QAAM,WAAWA,wBAAAA,wBAAwB,IAAI;AAC7C,QAAM,mBAAmBA,wBAAAA,wBAAwB;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,kCAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,SAAO;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeCustomTypeFile.js","sources":["../../../src/fs/writeCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteCustomTypeFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildCustomTypeFilePathArgs;\n\n/**\n * Writes a custom type model to the file system.\n *\n * @returns The file path to the written file.\n */\nexport const writeCustomTypeFile = async (\n\targs: WriteCustomTypeFileArgs,\n): Promise<string> => {\n\tconst filePath = buildCustomTypeFilePath(args);\n\tconst relativeFilePath = buildCustomTypeFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;AAca,MAAA,sBAAsB,OAClC,SACoB;AACd,QAAA,WAAW,wBAAwB,IAAI;AAC7C,QAAM,mBAAmB,wBAAwB;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,iBAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAEM,SAAA;AACR;"}
1
+ {"version":3,"file":"writeCustomTypeFile.js","sources":["../../../src/fs/writeCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteCustomTypeFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildCustomTypeFilePathArgs;\n\n/**\n * Writes a custom type model to the file system.\n *\n * @returns The file path to the written file.\n */\nexport const writeCustomTypeFile = async (\n\targs: WriteCustomTypeFileArgs,\n): Promise<string> => {\n\tconst filePath = buildCustomTypeFilePath(args);\n\tconst relativeFilePath = buildCustomTypeFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;AAcO,MAAM,sBAAsB,OAClC,SACoB;AACpB,QAAM,WAAW,wBAAwB,IAAI;AAC7C,QAAM,mBAAmB,wBAAwB;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,iBAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeCustomTypeModel.cjs","sources":["../../../src/fs/writeCustomTypeModel.ts"],"sourcesContent":["import type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\twriteCustomTypeFile,\n\tWriteCustomTypeFileArgs,\n} from \"./writeCustomTypeFile\";\n\nexport type WriteCustomTypeModelArgs = Omit<\n\tWriteCustomTypeFileArgs,\n\t\"customTypeID\" | \"filename\" | \"contents\"\n> & {\n\tmodel: CustomType;\n};\n\n/**\n * Writes a CustomType model to the file system in the CustomType's CustomType\n * library.\n *\n * @returns The file path to the written model.\n */\nexport const writeCustomTypeModel = async (\n\targs: WriteCustomTypeModelArgs,\n): Promise<string> => {\n\treturn await writeCustomTypeFile({\n\t\t...args,\n\t\tcustomTypeID: args.model.id,\n\t\tfilename: CUSTOM_TYPE_MODEL_FILENAME,\n\t\tcontents: JSON.stringify(args.model, null, 2),\n\t});\n};\n"],"names":["writeCustomTypeFile","CUSTOM_TYPE_MODEL_FILENAME"],"mappings":";;;;AAqBa,MAAA,uBAAuB,OACnC,SACoB;AACpB,SAAO,MAAMA,oBAAAA,oBAAoB;AAAA,IAChC,GAAG;AAAA,IACH,cAAc,KAAK,MAAM;AAAA,IACzB,UAAUC,UAAA;AAAA,IACV,UAAU,KAAK,UAAU,KAAK,OAAO,MAAM,CAAC;AAAA,EAAA,CAC5C;AACF;;"}
1
+ {"version":3,"file":"writeCustomTypeModel.cjs","sources":["../../../src/fs/writeCustomTypeModel.ts"],"sourcesContent":["import type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\twriteCustomTypeFile,\n\tWriteCustomTypeFileArgs,\n} from \"./writeCustomTypeFile\";\n\nexport type WriteCustomTypeModelArgs = Omit<\n\tWriteCustomTypeFileArgs,\n\t\"customTypeID\" | \"filename\" | \"contents\"\n> & {\n\tmodel: CustomType;\n};\n\n/**\n * Writes a CustomType model to the file system in the CustomType's CustomType\n * library.\n *\n * @returns The file path to the written model.\n */\nexport const writeCustomTypeModel = async (\n\targs: WriteCustomTypeModelArgs,\n): Promise<string> => {\n\treturn await writeCustomTypeFile({\n\t\t...args,\n\t\tcustomTypeID: args.model.id,\n\t\tfilename: CUSTOM_TYPE_MODEL_FILENAME,\n\t\tcontents: JSON.stringify(args.model, null, 2),\n\t});\n};\n"],"names":["writeCustomTypeFile","CUSTOM_TYPE_MODEL_FILENAME"],"mappings":";;;;AAqBO,MAAM,uBAAuB,OACnC,SACoB;AACpB,SAAO,MAAMA,oBAAAA,oBAAoB;AAAA,IAChC,GAAG;AAAA,IACH,cAAc,KAAK,MAAM;AAAA,IACzB,UAAUC,UAAAA;AAAAA,IACV,UAAU,KAAK,UAAU,KAAK,OAAO,MAAM,CAAC;AAAA,EAAA,CAC5C;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeCustomTypeModel.js","sources":["../../../src/fs/writeCustomTypeModel.ts"],"sourcesContent":["import type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\twriteCustomTypeFile,\n\tWriteCustomTypeFileArgs,\n} from \"./writeCustomTypeFile\";\n\nexport type WriteCustomTypeModelArgs = Omit<\n\tWriteCustomTypeFileArgs,\n\t\"customTypeID\" | \"filename\" | \"contents\"\n> & {\n\tmodel: CustomType;\n};\n\n/**\n * Writes a CustomType model to the file system in the CustomType's CustomType\n * library.\n *\n * @returns The file path to the written model.\n */\nexport const writeCustomTypeModel = async (\n\targs: WriteCustomTypeModelArgs,\n): Promise<string> => {\n\treturn await writeCustomTypeFile({\n\t\t...args,\n\t\tcustomTypeID: args.model.id,\n\t\tfilename: CUSTOM_TYPE_MODEL_FILENAME,\n\t\tcontents: JSON.stringify(args.model, null, 2),\n\t});\n};\n"],"names":[],"mappings":";;AAqBa,MAAA,uBAAuB,OACnC,SACoB;AACpB,SAAO,MAAM,oBAAoB;AAAA,IAChC,GAAG;AAAA,IACH,cAAc,KAAK,MAAM;AAAA,IACzB,UAAU;AAAA,IACV,UAAU,KAAK,UAAU,KAAK,OAAO,MAAM,CAAC;AAAA,EAAA,CAC5C;AACF;"}
1
+ {"version":3,"file":"writeCustomTypeModel.js","sources":["../../../src/fs/writeCustomTypeModel.ts"],"sourcesContent":["import type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\n\nimport { CUSTOM_TYPE_MODEL_FILENAME } from \"./constants\";\nimport {\n\twriteCustomTypeFile,\n\tWriteCustomTypeFileArgs,\n} from \"./writeCustomTypeFile\";\n\nexport type WriteCustomTypeModelArgs = Omit<\n\tWriteCustomTypeFileArgs,\n\t\"customTypeID\" | \"filename\" | \"contents\"\n> & {\n\tmodel: CustomType;\n};\n\n/**\n * Writes a CustomType model to the file system in the CustomType's CustomType\n * library.\n *\n * @returns The file path to the written model.\n */\nexport const writeCustomTypeModel = async (\n\targs: WriteCustomTypeModelArgs,\n): Promise<string> => {\n\treturn await writeCustomTypeFile({\n\t\t...args,\n\t\tcustomTypeID: args.model.id,\n\t\tfilename: CUSTOM_TYPE_MODEL_FILENAME,\n\t\tcontents: JSON.stringify(args.model, null, 2),\n\t});\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,uBAAuB,OACnC,SACoB;AACpB,SAAO,MAAM,oBAAoB;AAAA,IAChC,GAAG;AAAA,IACH,cAAc,KAAK,MAAM;AAAA,IACzB,UAAU;AAAA,IACV,UAAU,KAAK,UAAU,KAAK,OAAO,MAAM,CAAC;AAAA,EAAA,CAC5C;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeProjectEnvironment.cjs","sources":["../../../src/fs/writeProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteProjectEnvironmentArgs = {\n\tvariableName: string;\n\tenvironment: string | undefined;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\"> &\n\tOmit<WriteProjectFileArgs, \"contents\" | \"format\" | \"formatOptions\">;\n\nexport const writeProjectEnvironment = async (\n\targs: WriteProjectEnvironmentArgs,\n): Promise<string | undefined> => {\n\tconst hasEnvironmentVariableFile = await checkHasProjectFile({\n\t\tfilename: args.filename,\n\t\thelpers: args.helpers,\n\t});\n\n\tif (!hasEnvironmentVariableFile && args.environment === undefined) {\n\t\treturn;\n\t}\n\n\tlet contents = hasEnvironmentVariableFile\n\t\t? await readProjectFile({\n\t\t\t\tfilename: args.filename,\n\t\t\t\thelpers: args.helpers,\n\t\t\t\tencoding: \"utf8\",\n\t\t })\n\t\t: \"\";\n\n\tconst variableLine = `${args.variableName}=${args.environment}\\n`;\n\n\tconst hasExistingVariable = args.variableName in dotenv.parse(contents);\n\n\tif (hasExistingVariable) {\n\t\t// TODO: This regexp/replace is not working.\n\t\tcontents = contents.replace(\n\t\t\tnew RegExp(`^${args.variableName}=.*\\n?$`, \"m\"),\n\t\t\targs.environment === undefined ? \"\" : variableLine,\n\t\t);\n\t} else {\n\t\tif (!contents.endsWith(\"\\n\")) {\n\t\t\tcontents += \"\\n\";\n\t\t}\n\n\t\tcontents += variableLine;\n\t}\n\n\tawait writeProjectFile({\n\t\tfilename: args.filename,\n\t\tcontents,\n\t\tformat: false,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn args.filename;\n};\n"],"names":["checkHasProjectFile","readProjectFile","dotenv","writeProjectFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBa,MAAA,0BAA0B,OACtC,SACgC;AAC1B,QAAA,6BAA6B,MAAMA,wCAAoB;AAAA,IAC5D,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAC,8BAA8B,KAAK,gBAAgB,QAAW;AAClE;AAAA,EACD;AAEI,MAAA,WAAW,6BACZ,MAAMC,gCAAgB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,IACd,UAAU;AAAA,EACT,CAAA,IACD;AAEH,QAAM,eAAe,GAAG,KAAK,YAAY,IAAI,KAAK,WAAW;AAAA;AAE7D,QAAM,sBAAsB,KAAK,gBAAgBC,kBAAO,MAAM,QAAQ;AAEtE,MAAI,qBAAqB;AAExB,eAAW,SAAS,QACnB,IAAI,OAAO,IAAI,KAAK,YAAY;AAAA,KAAW,GAAG,GAC9C,KAAK,gBAAgB,SAAY,KAAK,YAAY;AAAA,EAAA,OAE7C;AACN,QAAI,CAAC,SAAS,SAAS,IAAI,GAAG;AACjB,kBAAA;AAAA,IACb;AAEY,gBAAA;AAAA,EACb;AAEA,QAAMC,kCAAiB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf;AAAA,IACA,QAAQ;AAAA,IACR,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO,KAAK;AACb;;"}
1
+ {"version":3,"file":"writeProjectEnvironment.cjs","sources":["../../../src/fs/writeProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteProjectEnvironmentArgs = {\n\tvariableName: string;\n\tenvironment: string | undefined;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\"> &\n\tOmit<WriteProjectFileArgs, \"contents\" | \"format\" | \"formatOptions\">;\n\nexport const writeProjectEnvironment = async (\n\targs: WriteProjectEnvironmentArgs,\n): Promise<string | undefined> => {\n\tconst hasEnvironmentVariableFile = await checkHasProjectFile({\n\t\tfilename: args.filename,\n\t\thelpers: args.helpers,\n\t});\n\n\tif (!hasEnvironmentVariableFile && args.environment === undefined) {\n\t\treturn;\n\t}\n\n\tlet contents = hasEnvironmentVariableFile\n\t\t? await readProjectFile({\n\t\t\t\tfilename: args.filename,\n\t\t\t\thelpers: args.helpers,\n\t\t\t\tencoding: \"utf8\",\n\t\t })\n\t\t: \"\";\n\n\tconst variableLine = `${args.variableName}=${args.environment}\\n`;\n\n\tconst hasExistingVariable = args.variableName in dotenv.parse(contents);\n\n\tif (hasExistingVariable) {\n\t\t// TODO: This regexp/replace is not working.\n\t\tcontents = contents.replace(\n\t\t\tnew RegExp(`^${args.variableName}=.*\\n?$`, \"m\"),\n\t\t\targs.environment === undefined ? \"\" : variableLine,\n\t\t);\n\t} else {\n\t\tif (!contents.endsWith(\"\\n\")) {\n\t\t\tcontents += \"\\n\";\n\t\t}\n\n\t\tcontents += variableLine;\n\t}\n\n\tawait writeProjectFile({\n\t\tfilename: args.filename,\n\t\tcontents,\n\t\tformat: false,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn args.filename;\n};\n"],"names":["checkHasProjectFile","readProjectFile","dotenv","writeProjectFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAM,0BAA0B,OACtC,SACgC;AAChC,QAAM,6BAA6B,MAAMA,wCAAoB;AAAA,IAC5D,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAC,8BAA8B,KAAK,gBAAgB,QAAW;AAClE;AAAA,EACD;AAEA,MAAI,WAAW,6BACZ,MAAMC,gCAAgB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,IACd,UAAU;AAAA,EAAA,CACT,IACD;AAEH,QAAM,eAAe,GAAG,KAAK,YAAY,IAAI,KAAK,WAAW;AAAA;AAE7D,QAAM,sBAAsB,KAAK,gBAAgBC,kBAAO,MAAM,QAAQ;AAEtE,MAAI,qBAAqB;AAExB,eAAW,SAAS,QACnB,IAAI,OAAO,IAAI,KAAK,YAAY;AAAA,KAAW,GAAG,GAC9C,KAAK,gBAAgB,SAAY,KAAK,YAAY;AAAA,EAEpD,OAAO;AACN,QAAI,CAAC,SAAS,SAAS,IAAI,GAAG;AAC7B,kBAAY;AAAA,IACb;AAEA,gBAAY;AAAA,EACb;AAEA,QAAMC,kCAAiB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf;AAAA,IACA,QAAQ;AAAA,IACR,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO,KAAK;AACb;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeProjectEnvironment.js","sources":["../../../src/fs/writeProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteProjectEnvironmentArgs = {\n\tvariableName: string;\n\tenvironment: string | undefined;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\"> &\n\tOmit<WriteProjectFileArgs, \"contents\" | \"format\" | \"formatOptions\">;\n\nexport const writeProjectEnvironment = async (\n\targs: WriteProjectEnvironmentArgs,\n): Promise<string | undefined> => {\n\tconst hasEnvironmentVariableFile = await checkHasProjectFile({\n\t\tfilename: args.filename,\n\t\thelpers: args.helpers,\n\t});\n\n\tif (!hasEnvironmentVariableFile && args.environment === undefined) {\n\t\treturn;\n\t}\n\n\tlet contents = hasEnvironmentVariableFile\n\t\t? await readProjectFile({\n\t\t\t\tfilename: args.filename,\n\t\t\t\thelpers: args.helpers,\n\t\t\t\tencoding: \"utf8\",\n\t\t })\n\t\t: \"\";\n\n\tconst variableLine = `${args.variableName}=${args.environment}\\n`;\n\n\tconst hasExistingVariable = args.variableName in dotenv.parse(contents);\n\n\tif (hasExistingVariable) {\n\t\t// TODO: This regexp/replace is not working.\n\t\tcontents = contents.replace(\n\t\t\tnew RegExp(`^${args.variableName}=.*\\n?$`, \"m\"),\n\t\t\targs.environment === undefined ? \"\" : variableLine,\n\t\t);\n\t} else {\n\t\tif (!contents.endsWith(\"\\n\")) {\n\t\t\tcontents += \"\\n\";\n\t\t}\n\n\t\tcontents += variableLine;\n\t}\n\n\tawait writeProjectFile({\n\t\tfilename: args.filename,\n\t\tcontents,\n\t\tformat: false,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn args.filename;\n};\n"],"names":[],"mappings":";;;;AAgBa,MAAA,0BAA0B,OACtC,SACgC;AAC1B,QAAA,6BAA6B,MAAM,oBAAoB;AAAA,IAC5D,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAC,8BAA8B,KAAK,gBAAgB,QAAW;AAClE;AAAA,EACD;AAEI,MAAA,WAAW,6BACZ,MAAM,gBAAgB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,IACd,UAAU;AAAA,EACT,CAAA,IACD;AAEH,QAAM,eAAe,GAAG,KAAK,YAAY,IAAI,KAAK,WAAW;AAAA;AAE7D,QAAM,sBAAsB,KAAK,gBAAgB,OAAO,MAAM,QAAQ;AAEtE,MAAI,qBAAqB;AAExB,eAAW,SAAS,QACnB,IAAI,OAAO,IAAI,KAAK,YAAY;AAAA,KAAW,GAAG,GAC9C,KAAK,gBAAgB,SAAY,KAAK,YAAY;AAAA,EAAA,OAE7C;AACN,QAAI,CAAC,SAAS,SAAS,IAAI,GAAG;AACjB,kBAAA;AAAA,IACb;AAEY,gBAAA;AAAA,EACb;AAEA,QAAM,iBAAiB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf;AAAA,IACA,QAAQ;AAAA,IACR,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO,KAAK;AACb;"}
1
+ {"version":3,"file":"writeProjectEnvironment.js","sources":["../../../src/fs/writeProjectEnvironment.ts"],"sourcesContent":["import * as dotenv from \"dotenv\";\n\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\nimport { readProjectFile, ReadProjectFileArgs } from \"./readProjectFile\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteProjectEnvironmentArgs = {\n\tvariableName: string;\n\tenvironment: string | undefined;\n} & Omit<CheckHasProjectFileArgs, \"filename\"> &\n\tOmit<ReadProjectFileArgs, \"filename\"> &\n\tOmit<WriteProjectFileArgs, \"contents\" | \"format\" | \"formatOptions\">;\n\nexport const writeProjectEnvironment = async (\n\targs: WriteProjectEnvironmentArgs,\n): Promise<string | undefined> => {\n\tconst hasEnvironmentVariableFile = await checkHasProjectFile({\n\t\tfilename: args.filename,\n\t\thelpers: args.helpers,\n\t});\n\n\tif (!hasEnvironmentVariableFile && args.environment === undefined) {\n\t\treturn;\n\t}\n\n\tlet contents = hasEnvironmentVariableFile\n\t\t? await readProjectFile({\n\t\t\t\tfilename: args.filename,\n\t\t\t\thelpers: args.helpers,\n\t\t\t\tencoding: \"utf8\",\n\t\t })\n\t\t: \"\";\n\n\tconst variableLine = `${args.variableName}=${args.environment}\\n`;\n\n\tconst hasExistingVariable = args.variableName in dotenv.parse(contents);\n\n\tif (hasExistingVariable) {\n\t\t// TODO: This regexp/replace is not working.\n\t\tcontents = contents.replace(\n\t\t\tnew RegExp(`^${args.variableName}=.*\\n?$`, \"m\"),\n\t\t\targs.environment === undefined ? \"\" : variableLine,\n\t\t);\n\t} else {\n\t\tif (!contents.endsWith(\"\\n\")) {\n\t\t\tcontents += \"\\n\";\n\t\t}\n\n\t\tcontents += variableLine;\n\t}\n\n\tawait writeProjectFile({\n\t\tfilename: args.filename,\n\t\tcontents,\n\t\tformat: false,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn args.filename;\n};\n"],"names":[],"mappings":";;;;AAgBO,MAAM,0BAA0B,OACtC,SACgC;AAChC,QAAM,6BAA6B,MAAM,oBAAoB;AAAA,IAC5D,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAAA,CACd;AAED,MAAI,CAAC,8BAA8B,KAAK,gBAAgB,QAAW;AAClE;AAAA,EACD;AAEA,MAAI,WAAW,6BACZ,MAAM,gBAAgB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,IACd,UAAU;AAAA,EAAA,CACT,IACD;AAEH,QAAM,eAAe,GAAG,KAAK,YAAY,IAAI,KAAK,WAAW;AAAA;AAE7D,QAAM,sBAAsB,KAAK,gBAAgB,OAAO,MAAM,QAAQ;AAEtE,MAAI,qBAAqB;AAExB,eAAW,SAAS,QACnB,IAAI,OAAO,IAAI,KAAK,YAAY;AAAA,KAAW,GAAG,GAC9C,KAAK,gBAAgB,SAAY,KAAK,YAAY;AAAA,EAEpD,OAAO;AACN,QAAI,CAAC,SAAS,SAAS,IAAI,GAAG;AAC7B,kBAAY;AAAA,IACb;AAEA,gBAAY;AAAA,EACb;AAEA,QAAM,iBAAiB;AAAA,IACtB,UAAU,KAAK;AAAA,IACf;AAAA,IACA,QAAQ;AAAA,IACR,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO,KAAK;AACb;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeProjectFile.cjs","sources":["../../../src/fs/writeProjectFile.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type WriteProjectFileArgs = {\n\tfilename: string;\n\tcontents: Parameters<typeof fs.writeFile>[1];\n\tformat?: boolean;\n\tformatOptions?: Parameters<SliceMachineHelpers[\"format\"]>[2];\n\thelpers: SliceMachineHelpers;\n};\n\n/**\n * Writes a file to the project with optional formatting.\n *\n * @returns The file path to the written file.\n */\nexport const writeProjectFile = async (\n\targs: WriteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tlet contents = args.contents;\n\n\tif (args.format) {\n\t\tcontents = await args.helpers.format(\n\t\t\tcontents.toString(),\n\t\t\tfilePath,\n\t\t\targs.formatOptions,\n\t\t);\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, contents);\n\n\treturn filePath;\n};\n"],"names":["fs.mkdir","path","fs.writeFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBa,MAAA,mBAAmB,OAC/B,SACoB;AACpB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,MAAI,WAAW,KAAK;AAEpB,MAAI,KAAK,QAAQ;AACL,eAAA,MAAM,KAAK,QAAQ,OAC7B,SAAS,SAAQ,GACjB,UACA,KAAK,aAAa;AAAA,EAEpB;AAEM,QAAAA,cAASC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AACpD,QAAAC,QAAa,UAAA,UAAU,QAAQ;AAE9B,SAAA;AACR;;"}
1
+ {"version":3,"file":"writeProjectFile.cjs","sources":["../../../src/fs/writeProjectFile.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type WriteProjectFileArgs = {\n\tfilename: string;\n\tcontents: Parameters<typeof fs.writeFile>[1];\n\tformat?: boolean;\n\tformatOptions?: Parameters<SliceMachineHelpers[\"format\"]>[2];\n\thelpers: SliceMachineHelpers;\n};\n\n/**\n * Writes a file to the project with optional formatting.\n *\n * @returns The file path to the written file.\n */\nexport const writeProjectFile = async (\n\targs: WriteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tlet contents = args.contents;\n\n\tif (args.format) {\n\t\tcontents = await args.helpers.format(\n\t\t\tcontents.toString(),\n\t\t\tfilePath,\n\t\t\targs.formatOptions,\n\t\t);\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, contents);\n\n\treturn filePath;\n};\n"],"names":["fs.mkdir","path","fs.writeFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,mBAAmB,OAC/B,SACoB;AACpB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,MAAI,WAAW,KAAK;AAEpB,MAAI,KAAK,QAAQ;AAChB,eAAW,MAAM,KAAK,QAAQ,OAC7B,SAAS,YACT,UACA,KAAK,aAAa;AAAA,EAEpB;AAEA,QAAMA,QAAAA,MAASC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,MAAM;AAC1D,QAAMC,QAAAA,UAAa,UAAU,QAAQ;AAErC,SAAO;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeProjectFile.js","sources":["../../../src/fs/writeProjectFile.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type WriteProjectFileArgs = {\n\tfilename: string;\n\tcontents: Parameters<typeof fs.writeFile>[1];\n\tformat?: boolean;\n\tformatOptions?: Parameters<SliceMachineHelpers[\"format\"]>[2];\n\thelpers: SliceMachineHelpers;\n};\n\n/**\n * Writes a file to the project with optional formatting.\n *\n * @returns The file path to the written file.\n */\nexport const writeProjectFile = async (\n\targs: WriteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tlet contents = args.contents;\n\n\tif (args.format) {\n\t\tcontents = await args.helpers.format(\n\t\t\tcontents.toString(),\n\t\t\tfilePath,\n\t\t\targs.formatOptions,\n\t\t);\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, contents);\n\n\treturn filePath;\n};\n"],"names":["fs.mkdir","fs.writeFile"],"mappings":";;AAmBa,MAAA,mBAAmB,OAC/B,SACoB;AACpB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,MAAI,WAAW,KAAK;AAEpB,MAAI,KAAK,QAAQ;AACL,eAAA,MAAM,KAAK,QAAQ,OAC7B,SAAS,SAAQ,GACjB,UACA,KAAK,aAAa;AAAA,EAEpB;AAEM,QAAAA,MAAS,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AACpD,QAAAC,UAAa,UAAU,QAAQ;AAE9B,SAAA;AACR;"}
1
+ {"version":3,"file":"writeProjectFile.js","sources":["../../../src/fs/writeProjectFile.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type WriteProjectFileArgs = {\n\tfilename: string;\n\tcontents: Parameters<typeof fs.writeFile>[1];\n\tformat?: boolean;\n\tformatOptions?: Parameters<SliceMachineHelpers[\"format\"]>[2];\n\thelpers: SliceMachineHelpers;\n};\n\n/**\n * Writes a file to the project with optional formatting.\n *\n * @returns The file path to the written file.\n */\nexport const writeProjectFile = async (\n\targs: WriteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tlet contents = args.contents;\n\n\tif (args.format) {\n\t\tcontents = await args.helpers.format(\n\t\t\tcontents.toString(),\n\t\t\tfilePath,\n\t\t\targs.formatOptions,\n\t\t);\n\t}\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, contents);\n\n\treturn filePath;\n};\n"],"names":["fs.mkdir","fs.writeFile"],"mappings":";;AAmBO,MAAM,mBAAmB,OAC/B,SACoB;AACpB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,MAAI,WAAW,KAAK;AAEpB,MAAI,KAAK,QAAQ;AAChB,eAAW,MAAM,KAAK,QAAQ,OAC7B,SAAS,YACT,UACA,KAAK,aAAa;AAAA,EAEpB;AAEA,QAAMA,MAAS,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,MAAM;AAC1D,QAAMC,UAAa,UAAU,QAAQ;AAErC,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeSliceFile.cjs","sources":["../../../src/fs/writeSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteSliceFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildSliceFilePathArgs;\n\n/**\n * Writes a Slice model to the file system in the Slice's Slice library.\n *\n * @returns The file path to the written file.\n */\nexport const writeSliceFile = async (\n\targs: WriteSliceFileArgs,\n): Promise<string> => {\n\tconst filePath = await buildSliceFilePath(args);\n\tconst relativeFilePath = await buildSliceFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildSliceFilePath","writeProjectFile"],"mappings":";;;;AAca,MAAA,iBAAiB,OAC7B,SACoB;AACd,QAAA,WAAW,MAAMA,sCAAmB,IAAI;AACxC,QAAA,mBAAmB,MAAMA,sCAAmB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,kCAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAEM,SAAA;AACR;;"}
1
+ {"version":3,"file":"writeSliceFile.cjs","sources":["../../../src/fs/writeSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteSliceFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildSliceFilePathArgs;\n\n/**\n * Writes a Slice model to the file system in the Slice's Slice library.\n *\n * @returns The file path to the written file.\n */\nexport const writeSliceFile = async (\n\targs: WriteSliceFileArgs,\n): Promise<string> => {\n\tconst filePath = await buildSliceFilePath(args);\n\tconst relativeFilePath = await buildSliceFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildSliceFilePath","writeProjectFile"],"mappings":";;;;AAcO,MAAM,iBAAiB,OAC7B,SACoB;AACpB,QAAM,WAAW,MAAMA,mBAAAA,mBAAmB,IAAI;AAC9C,QAAM,mBAAmB,MAAMA,sCAAmB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,kCAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,SAAO;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeSliceFile.js","sources":["../../../src/fs/writeSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteSliceFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildSliceFilePathArgs;\n\n/**\n * Writes a Slice model to the file system in the Slice's Slice library.\n *\n * @returns The file path to the written file.\n */\nexport const writeSliceFile = async (\n\targs: WriteSliceFileArgs,\n): Promise<string> => {\n\tconst filePath = await buildSliceFilePath(args);\n\tconst relativeFilePath = await buildSliceFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;AAca,MAAA,iBAAiB,OAC7B,SACoB;AACd,QAAA,WAAW,MAAM,mBAAmB,IAAI;AACxC,QAAA,mBAAmB,MAAM,mBAAmB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,iBAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAEM,SAAA;AACR;"}
1
+ {"version":3,"file":"writeSliceFile.js","sources":["../../../src/fs/writeSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { writeProjectFile, WriteProjectFileArgs } from \"./writeProjectFile\";\n\nexport type WriteSliceFileArgs = Omit<WriteProjectFileArgs, \"filePath\"> &\n\tBuildSliceFilePathArgs;\n\n/**\n * Writes a Slice model to the file system in the Slice's Slice library.\n *\n * @returns The file path to the written file.\n */\nexport const writeSliceFile = async (\n\targs: WriteSliceFileArgs,\n): Promise<string> => {\n\tconst filePath = await buildSliceFilePath(args);\n\tconst relativeFilePath = await buildSliceFilePath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait writeProjectFile({\n\t\t...args,\n\t\tfilename: relativeFilePath,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;AAcO,MAAM,iBAAiB,OAC7B,SACoB;AACpB,QAAM,WAAW,MAAM,mBAAmB,IAAI;AAC9C,QAAM,mBAAmB,MAAM,mBAAmB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,iBAAiB;AAAA,IACtB,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,SAAO;AACR;"}