@slicemachine/adapter-nuxt 0.0.2-dev-plugins-m3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +98 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs +41 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js +41 -0
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/file.cjs +61 -0
- package/dist/_node_modules/fetch-blob/file.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/file.js +61 -0
- package/dist/_node_modules/fetch-blob/file.js.map +1 -0
- package/dist/_node_modules/fetch-blob/index.cjs +223 -0
- package/dist/_node_modules/fetch-blob/index.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/index.js +223 -0
- package/dist/_node_modules/fetch-blob/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.cjs +43 -0
- package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.js +42 -0
- package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs +116 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js +116 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
- package/dist/_node_modules/node-domexception/index.cjs +11 -0
- package/dist/_node_modules/node-domexception/index.cjs.map +1 -0
- package/dist/_node_modules/node-domexception/index.js +10 -0
- package/dist/_node_modules/node-domexception/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.cjs +262 -0
- package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.js +262 -0
- package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs +10 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js +10 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/base.cjs +17 -0
- package/dist/_node_modules/node-fetch/src/errors/base.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/base.js +17 -0
- package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs +19 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js +19 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.cjs +190 -0
- package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.js +190 -0
- package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.cjs +292 -0
- package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.js +292 -0
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.cjs +206 -0
- package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.js +206 -0
- package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.cjs +122 -0
- package/dist/_node_modules/node-fetch/src/response.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.js +123 -0
- package/dist/_node_modules/node-fetch/src/response.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs +12 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.js +12 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs +8 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js +8 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is.cjs +28 -0
- package/dist/_node_modules/node-fetch/src/utils/is.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is.js +28 -0
- package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs +356 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js +356 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs +149 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.js +149 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +3822 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +3822 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.cjs +5 -0
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +5 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/ponyfill.es2018.cjs +13 -0
- package/dist/_virtual/ponyfill.es2018.cjs.map +1 -0
- package/dist/_virtual/ponyfill.es2018.js +14 -0
- package/dist/_virtual/ponyfill.es2018.js.map +1 -0
- package/dist/constants.cjs +5 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/hooks/customType-asset-delete.cjs +31 -0
- package/dist/hooks/customType-asset-delete.cjs.map +1 -0
- package/dist/hooks/customType-asset-delete.d.ts +3 -0
- package/dist/hooks/customType-asset-delete.js +14 -0
- package/dist/hooks/customType-asset-delete.js.map +1 -0
- package/dist/hooks/customType-asset-read.cjs +34 -0
- package/dist/hooks/customType-asset-read.cjs.map +1 -0
- package/dist/hooks/customType-asset-read.d.ts +3 -0
- package/dist/hooks/customType-asset-read.js +17 -0
- package/dist/hooks/customType-asset-read.js.map +1 -0
- package/dist/hooks/customType-asset-update.cjs +34 -0
- package/dist/hooks/customType-asset-update.cjs.map +1 -0
- package/dist/hooks/customType-asset-update.d.ts +3 -0
- package/dist/hooks/customType-asset-update.js +16 -0
- package/dist/hooks/customType-asset-update.js.map +1 -0
- package/dist/hooks/customType-create.cjs +43 -0
- package/dist/hooks/customType-create.cjs.map +1 -0
- package/dist/hooks/customType-create.d.ts +3 -0
- package/dist/hooks/customType-create.js +25 -0
- package/dist/hooks/customType-create.js.map +1 -0
- package/dist/hooks/customType-delete.cjs +32 -0
- package/dist/hooks/customType-delete.cjs.map +1 -0
- package/dist/hooks/customType-delete.d.ts +3 -0
- package/dist/hooks/customType-delete.js +15 -0
- package/dist/hooks/customType-delete.js.map +1 -0
- package/dist/hooks/customType-read.cjs +31 -0
- package/dist/hooks/customType-read.cjs.map +1 -0
- package/dist/hooks/customType-read.d.ts +3 -0
- package/dist/hooks/customType-read.js +14 -0
- package/dist/hooks/customType-read.js.map +1 -0
- package/dist/hooks/customType-rename.cjs +6 -0
- package/dist/hooks/customType-rename.cjs.map +1 -0
- package/dist/hooks/customType-rename.d.ts +1 -0
- package/dist/hooks/customType-rename.js +6 -0
- package/dist/hooks/customType-rename.js.map +1 -0
- package/dist/hooks/customType-update.cjs +6 -0
- package/dist/hooks/customType-update.cjs.map +1 -0
- package/dist/hooks/customType-update.d.ts +1 -0
- package/dist/hooks/customType-update.js +6 -0
- package/dist/hooks/customType-update.js.map +1 -0
- package/dist/hooks/customTypeLibrary-read.cjs +53 -0
- package/dist/hooks/customTypeLibrary-read.cjs.map +1 -0
- package/dist/hooks/customTypeLibrary-read.d.ts +3 -0
- package/dist/hooks/customTypeLibrary-read.js +35 -0
- package/dist/hooks/customTypeLibrary-read.js.map +1 -0
- package/dist/hooks/project-init.cjs +112 -0
- package/dist/hooks/project-init.cjs.map +1 -0
- package/dist/hooks/project-init.d.ts +3 -0
- package/dist/hooks/project-init.js +94 -0
- package/dist/hooks/project-init.js.map +1 -0
- package/dist/hooks/slice-asset-delete.cjs +33 -0
- package/dist/hooks/slice-asset-delete.cjs.map +1 -0
- package/dist/hooks/slice-asset-delete.d.ts +3 -0
- package/dist/hooks/slice-asset-delete.js +16 -0
- package/dist/hooks/slice-asset-delete.js.map +1 -0
- package/dist/hooks/slice-asset-read.cjs +36 -0
- package/dist/hooks/slice-asset-read.cjs.map +1 -0
- package/dist/hooks/slice-asset-read.d.ts +3 -0
- package/dist/hooks/slice-asset-read.js +19 -0
- package/dist/hooks/slice-asset-read.js.map +1 -0
- package/dist/hooks/slice-asset-update.cjs +36 -0
- package/dist/hooks/slice-asset-update.cjs.map +1 -0
- package/dist/hooks/slice-asset-update.d.ts +3 -0
- package/dist/hooks/slice-asset-update.js +18 -0
- package/dist/hooks/slice-asset-update.js.map +1 -0
- package/dist/hooks/slice-create.cjs +77 -0
- package/dist/hooks/slice-create.cjs.map +1 -0
- package/dist/hooks/slice-create.d.ts +3 -0
- package/dist/hooks/slice-create.js +59 -0
- package/dist/hooks/slice-create.js.map +1 -0
- package/dist/hooks/slice-delete.cjs +41 -0
- package/dist/hooks/slice-delete.cjs.map +1 -0
- package/dist/hooks/slice-delete.d.ts +3 -0
- package/dist/hooks/slice-delete.js +24 -0
- package/dist/hooks/slice-delete.js.map +1 -0
- package/dist/hooks/slice-read.cjs +62 -0
- package/dist/hooks/slice-read.cjs.map +1 -0
- package/dist/hooks/slice-read.d.ts +3 -0
- package/dist/hooks/slice-read.js +44 -0
- package/dist/hooks/slice-read.js.map +1 -0
- package/dist/hooks/slice-rename.cjs +51 -0
- package/dist/hooks/slice-rename.cjs.map +1 -0
- package/dist/hooks/slice-rename.d.ts +3 -0
- package/dist/hooks/slice-rename.js +34 -0
- package/dist/hooks/slice-rename.js.map +1 -0
- package/dist/hooks/slice-update.cjs +14 -0
- package/dist/hooks/slice-update.cjs.map +1 -0
- package/dist/hooks/slice-update.d.ts +3 -0
- package/dist/hooks/slice-update.js +14 -0
- package/dist/hooks/slice-update.js.map +1 -0
- package/dist/hooks/sliceLibrary-read.cjs +52 -0
- package/dist/hooks/sliceLibrary-read.cjs.map +1 -0
- package/dist/hooks/sliceLibrary-read.d.ts +3 -0
- package/dist/hooks/sliceLibrary-read.js +34 -0
- package/dist/hooks/sliceLibrary-read.js.map +1 -0
- package/dist/hooks/sliceSimulator-setup-read.cjs +150 -0
- package/dist/hooks/sliceSimulator-setup-read.cjs.map +1 -0
- package/dist/hooks/sliceSimulator-setup-read.d.ts +3 -0
- package/dist/hooks/sliceSimulator-setup-read.js +150 -0
- package/dist/hooks/sliceSimulator-setup-read.js.map +1 -0
- package/dist/hooks/snippet-read.cjs +101 -0
- package/dist/hooks/snippet-read.cjs.map +1 -0
- package/dist/hooks/snippet-read.d.ts +3 -0
- package/dist/hooks/snippet-read.js +101 -0
- package/dist/hooks/snippet-read.js.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/buildCustomTypeAssetPath.cjs +29 -0
- package/dist/lib/buildCustomTypeAssetPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeAssetPath.d.ts +9 -0
- package/dist/lib/buildCustomTypeAssetPath.js +12 -0
- package/dist/lib/buildCustomTypeAssetPath.js.map +1 -0
- package/dist/lib/buildCustomTypeDirectoryPath.cjs +26 -0
- package/dist/lib/buildCustomTypeDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeDirectoryPath.d.ts +8 -0
- package/dist/lib/buildCustomTypeDirectoryPath.js +9 -0
- package/dist/lib/buildCustomTypeDirectoryPath.js.map +1 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.d.ts +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.js +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.js.map +1 -0
- package/dist/lib/buildSliceAssetPath.cjs +34 -0
- package/dist/lib/buildSliceAssetPath.cjs.map +1 -0
- package/dist/lib/buildSliceAssetPath.d.ts +11 -0
- package/dist/lib/buildSliceAssetPath.js +17 -0
- package/dist/lib/buildSliceAssetPath.js.map +1 -0
- package/dist/lib/buildSliceDirectoryPath.cjs +30 -0
- package/dist/lib/buildSliceDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildSliceDirectoryPath.d.ts +10 -0
- package/dist/lib/buildSliceDirectoryPath.js +13 -0
- package/dist/lib/buildSliceDirectoryPath.js.map +1 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.cjs +7 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.d.ts +8 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.js +7 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.js.map +1 -0
- package/dist/lib/checkIsTypeScriptProject.cjs +9 -0
- package/dist/lib/checkIsTypeScriptProject.cjs.map +1 -0
- package/dist/lib/checkIsTypeScriptProject.d.ts +8 -0
- package/dist/lib/checkIsTypeScriptProject.js +9 -0
- package/dist/lib/checkIsTypeScriptProject.js.map +1 -0
- package/dist/lib/checkPathExists.cjs +30 -0
- package/dist/lib/checkPathExists.cjs.map +1 -0
- package/dist/lib/checkPathExists.d.ts +2 -0
- package/dist/lib/checkPathExists.js +13 -0
- package/dist/lib/checkPathExists.js.map +1 -0
- package/dist/lib/isSharedSliceModel.cjs +7 -0
- package/dist/lib/isSharedSliceModel.cjs.map +1 -0
- package/dist/lib/isSharedSliceModel.d.ts +335 -0
- package/dist/lib/isSharedSliceModel.js +7 -0
- package/dist/lib/isSharedSliceModel.js.map +1 -0
- package/dist/lib/pascalCase.cjs +8 -0
- package/dist/lib/pascalCase.cjs.map +1 -0
- package/dist/lib/pascalCase.d.ts +8 -0
- package/dist/lib/pascalCase.js +8 -0
- package/dist/lib/pascalCase.js.map +1 -0
- package/dist/lib/readJSONFile.cjs +26 -0
- package/dist/lib/readJSONFile.cjs.map +1 -0
- package/dist/lib/readJSONFile.d.ts +1 -0
- package/dist/lib/readJSONFile.js +9 -0
- package/dist/lib/readJSONFile.js.map +1 -0
- package/dist/lib/rejectIfNecessary.cjs +10 -0
- package/dist/lib/rejectIfNecessary.cjs.map +1 -0
- package/dist/lib/rejectIfNecessary.d.ts +1 -0
- package/dist/lib/rejectIfNecessary.js +10 -0
- package/dist/lib/rejectIfNecessary.js.map +1 -0
- package/dist/lib/updateSliceModelFile.cjs +33 -0
- package/dist/lib/updateSliceModelFile.cjs.map +1 -0
- package/dist/lib/updateSliceModelFile.d.ts +9 -0
- package/dist/lib/updateSliceModelFile.js +15 -0
- package/dist/lib/updateSliceModelFile.js.map +1 -0
- package/dist/lib/upsertGlobalContentTypes.cjs +55 -0
- package/dist/lib/upsertGlobalContentTypes.cjs.map +1 -0
- package/dist/lib/upsertGlobalContentTypes.d.ts +12 -0
- package/dist/lib/upsertGlobalContentTypes.js +37 -0
- package/dist/lib/upsertGlobalContentTypes.js.map +1 -0
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +83 -0
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -0
- package/dist/lib/upsertSliceLibraryIndexFile.d.ts +7 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js +65 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -0
- package/dist/packages/adapter-nuxt/package.json.cjs +5 -0
- package/dist/packages/adapter-nuxt/package.json.cjs.map +1 -0
- package/dist/packages/adapter-nuxt/package.json.js +5 -0
- package/dist/packages/adapter-nuxt/package.json.js.map +1 -0
- package/dist/plugin.cjs +59 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +59 -0
- package/dist/plugin.js.map +1 -0
- package/dist/simulator/SliceSimulator.cjs +79 -0
- package/dist/simulator/SliceSimulator.cjs.map +1 -0
- package/dist/simulator/SliceSimulator.d.ts +34 -0
- package/dist/simulator/SliceSimulator.js +79 -0
- package/dist/simulator/SliceSimulator.js.map +1 -0
- package/dist/simulator/index.d.ts +2 -0
- package/dist/simulator.cjs +5 -0
- package/dist/simulator.cjs.map +1 -0
- package/dist/simulator.js +5 -0
- package/dist/simulator.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/package.json +107 -0
- package/src/constants.ts +5 -0
- package/src/hooks/customType-asset-delete.ts +18 -0
- package/src/hooks/customType-asset-read.ts +22 -0
- package/src/hooks/customType-asset-update.ts +20 -0
- package/src/hooks/customType-create.ts +45 -0
- package/src/hooks/customType-delete.ts +21 -0
- package/src/hooks/customType-read.ts +24 -0
- package/src/hooks/customType-rename.ts +3 -0
- package/src/hooks/customType-update.ts +3 -0
- package/src/hooks/customTypeLibrary-read.ts +53 -0
- package/src/hooks/project-init.ts +163 -0
- package/src/hooks/slice-asset-delete.ts +21 -0
- package/src/hooks/slice-asset-read.ts +25 -0
- package/src/hooks/slice-asset-update.ts +23 -0
- package/src/hooks/slice-create.ts +115 -0
- package/src/hooks/slice-delete.ts +41 -0
- package/src/hooks/slice-read.ts +69 -0
- package/src/hooks/slice-rename.ts +46 -0
- package/src/hooks/slice-update.ts +19 -0
- package/src/hooks/sliceLibrary-read.ts +48 -0
- package/src/hooks/sliceSimulator-setup-read.ts +209 -0
- package/src/hooks/snippet-read.ts +145 -0
- package/src/index.ts +4 -0
- package/src/lib/buildCustomTypeAssetPath.ts +24 -0
- package/src/lib/buildCustomTypeDirectoryPath.ts +20 -0
- package/src/lib/buildCustomTypeLibraryDirectoryPath.ts +13 -0
- package/src/lib/buildSliceAssetPath.ts +32 -0
- package/src/lib/buildSliceDirectoryPath.ts +26 -0
- package/src/lib/buildSliceLibraryDirectoryPath.ts +14 -0
- package/src/lib/checkIsTypeScriptProject.ts +17 -0
- package/src/lib/checkPathExists.ts +12 -0
- package/src/lib/isSharedSliceModel.ts +14 -0
- package/src/lib/pascalCase.ts +12 -0
- package/src/lib/readJSONFile.ts +7 -0
- package/src/lib/rejectIfNecessary.ts +16 -0
- package/src/lib/updateSliceModelFile.ts +33 -0
- package/src/lib/upsertGlobalContentTypes.ts +62 -0
- package/src/lib/upsertSliceLibraryIndexFile.ts +90 -0
- package/src/plugin.ts +63 -0
- package/src/simulator/SliceSimulator.ts +157 -0
- package/src/simulator/index.ts +2 -0
- package/src/types.ts +5 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
4
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
5
|
+
//# sourceMappingURL=_commonjsHelpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2
|
+
export {
|
|
3
|
+
commonjsGlobal
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=_commonjsHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
exports.exports = {};
|
|
4
|
+
var ponyfill_es2018 = {
|
|
5
|
+
get exports() {
|
|
6
|
+
return exports.exports;
|
|
7
|
+
},
|
|
8
|
+
set exports(v) {
|
|
9
|
+
exports.exports = v;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
exports.__module = ponyfill_es2018;
|
|
13
|
+
//# sourceMappingURL=ponyfill.es2018.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ponyfill.es2018.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var ponyfill_es2018Exports = {};
|
|
2
|
+
var ponyfill_es2018 = {
|
|
3
|
+
get exports() {
|
|
4
|
+
return ponyfill_es2018Exports;
|
|
5
|
+
},
|
|
6
|
+
set exports(v) {
|
|
7
|
+
ponyfill_es2018Exports = v;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
ponyfill_es2018 as __module,
|
|
12
|
+
ponyfill_es2018Exports as exports
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=ponyfill.es2018.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ponyfill.es2018.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const NON_EDITABLE_FILE_BANNER = "// Code generated by Slice Machine. DO NOT EDIT.";
|
|
4
|
+
exports.NON_EDITABLE_FILE_BANNER = NON_EDITABLE_FILE_BANNER;
|
|
5
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../src/constants.ts"],"sourcesContent":["/**\n * Banner text added to files that should not be edited by users.\n */\nexport const NON_EDITABLE_FILE_BANNER =\n\t\"// Code generated by Slice Machine. DO NOT EDIT.\";\n"],"names":[],"mappings":";;AAGO,MAAM,2BACZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["/**\n * Banner text added to files that should not be edited by users.\n */\nexport const NON_EDITABLE_FILE_BANNER =\n\t\"// Code generated by Slice Machine. DO NOT EDIT.\";\n"],"names":[],"mappings":"AAGO,MAAM,2BACZ;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
22
|
+
const customTypeAssetDelete = async (data, context) => {
|
|
23
|
+
const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
|
|
24
|
+
customTypeID: data.customTypeID,
|
|
25
|
+
assetID: data.assetID,
|
|
26
|
+
helpers: context.helpers
|
|
27
|
+
});
|
|
28
|
+
await fs__namespace.rm(filePath);
|
|
29
|
+
};
|
|
30
|
+
exports.customTypeAssetDelete = customTypeAssetDelete;
|
|
31
|
+
//# sourceMappingURL=customType-asset-delete.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-asset-delete.cjs","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":["buildCustomTypeAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,GAAG,QAAQ;AACrB;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
|
|
3
|
+
const customTypeAssetDelete = async (data, context) => {
|
|
4
|
+
const filePath = buildCustomTypeAssetPath({
|
|
5
|
+
customTypeID: data.customTypeID,
|
|
6
|
+
assetID: data.assetID,
|
|
7
|
+
helpers: context.helpers
|
|
8
|
+
});
|
|
9
|
+
await fs.rm(filePath);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
customTypeAssetDelete
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=customType-asset-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-asset-delete.js","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
22
|
+
const customTypeAssetRead = async (data, context) => {
|
|
23
|
+
const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
|
|
24
|
+
customTypeID: data.customTypeID,
|
|
25
|
+
assetID: data.assetID,
|
|
26
|
+
helpers: context.helpers
|
|
27
|
+
});
|
|
28
|
+
const assetData = await fs__namespace.readFile(filePath);
|
|
29
|
+
return {
|
|
30
|
+
data: assetData
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.customTypeAssetRead = customTypeAssetRead;
|
|
34
|
+
//# sourceMappingURL=customType-asset-read.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-asset-read.cjs","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":["buildCustomTypeAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,sBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAMC,cAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
|
|
3
|
+
const customTypeAssetRead = async (data, context) => {
|
|
4
|
+
const filePath = buildCustomTypeAssetPath({
|
|
5
|
+
customTypeID: data.customTypeID,
|
|
6
|
+
assetID: data.assetID,
|
|
7
|
+
helpers: context.helpers
|
|
8
|
+
});
|
|
9
|
+
const assetData = await fs.readFile(filePath);
|
|
10
|
+
return {
|
|
11
|
+
data: assetData
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
customTypeAssetRead
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=customType-asset-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-asset-read.js","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":[],"mappings":";;AAOa,MAAA,sBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAM,GAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const buildCustomTypeAssetPath = require("../lib/buildCustomTypeAssetPath.cjs");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
23
|
+
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
24
|
+
const customTypeAssetUpdate = async (data, context) => {
|
|
25
|
+
const filePath = buildCustomTypeAssetPath.buildCustomTypeAssetPath({
|
|
26
|
+
customTypeID: data.customTypeID,
|
|
27
|
+
assetID: data.asset.id,
|
|
28
|
+
helpers: context.helpers
|
|
29
|
+
});
|
|
30
|
+
await fs__namespace.mkdir(path__namespace.dirname(filePath), { recursive: true });
|
|
31
|
+
await fs__namespace.writeFile(filePath, data.asset.data);
|
|
32
|
+
};
|
|
33
|
+
exports.customTypeAssetUpdate = customTypeAssetUpdate;
|
|
34
|
+
//# sourceMappingURL=customType-asset-update.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-asset-update.cjs","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":["buildCustomTypeAssetPath","fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAWA,yBAAAA,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAMD,cAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath.js";
|
|
4
|
+
const customTypeAssetUpdate = async (data, context) => {
|
|
5
|
+
const filePath = buildCustomTypeAssetPath({
|
|
6
|
+
customTypeID: data.customTypeID,
|
|
7
|
+
assetID: data.asset.id,
|
|
8
|
+
helpers: context.helpers
|
|
9
|
+
});
|
|
10
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
11
|
+
await fs.writeFile(filePath, data.asset.data);
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
customTypeAssetUpdate
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=customType-asset-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-asset-update.js","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
|
|
6
|
+
const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
+
if (e) {
|
|
10
|
+
for (const k in e) {
|
|
11
|
+
if (k !== "default") {
|
|
12
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: () => e[k]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
24
|
+
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
25
|
+
const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
26
|
+
const filePath = path__namespace.join(dir, "index.json");
|
|
27
|
+
let contents = JSON.stringify(data.model);
|
|
28
|
+
if (options.format) {
|
|
29
|
+
contents = await helpers.format(contents, filePath);
|
|
30
|
+
}
|
|
31
|
+
await fs__namespace.writeFile(filePath, contents);
|
|
32
|
+
};
|
|
33
|
+
const customTypeCreate = async (data, context) => {
|
|
34
|
+
const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
|
|
35
|
+
customTypeID: data.model.id,
|
|
36
|
+
helpers: context.helpers
|
|
37
|
+
});
|
|
38
|
+
await fs__namespace.mkdir(dir, { recursive: true });
|
|
39
|
+
await createModelFile({ dir, data, ...context });
|
|
40
|
+
await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
|
|
41
|
+
};
|
|
42
|
+
exports.customTypeCreate = customTypeCreate;
|
|
43
|
+
//# sourceMappingURL=customType-create.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-create.cjs","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["path","fs","buildCustomTypeDirectoryPath","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAWA,gBAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMC,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMD,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAME,yBAAAA,yBAAyB,OAAO;AACvC;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
|
|
4
|
+
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
|
|
5
|
+
const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
6
|
+
const filePath = path.join(dir, "index.json");
|
|
7
|
+
let contents = JSON.stringify(data.model);
|
|
8
|
+
if (options.format) {
|
|
9
|
+
contents = await helpers.format(contents, filePath);
|
|
10
|
+
}
|
|
11
|
+
await fs.writeFile(filePath, contents);
|
|
12
|
+
};
|
|
13
|
+
const customTypeCreate = async (data, context) => {
|
|
14
|
+
const dir = buildCustomTypeDirectoryPath({
|
|
15
|
+
customTypeID: data.model.id,
|
|
16
|
+
helpers: context.helpers
|
|
17
|
+
});
|
|
18
|
+
await fs.mkdir(dir, { recursive: true });
|
|
19
|
+
await createModelFile({ dir, data, ...context });
|
|
20
|
+
await upsertGlobalContentTypes(context);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
customTypeCreate
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=customType-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-create.js","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;;AAkBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAW,KAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAM,yBAAyB,OAAO;AACvC;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
|
|
5
|
+
const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
23
|
+
const customTypeDelete = async (data, context) => {
|
|
24
|
+
const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
|
|
25
|
+
customTypeID: data.model.id,
|
|
26
|
+
helpers: context.helpers
|
|
27
|
+
});
|
|
28
|
+
await fs__namespace.rm(dir, { recursive: true });
|
|
29
|
+
await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
|
|
30
|
+
};
|
|
31
|
+
exports.customTypeDelete = customTypeDelete;
|
|
32
|
+
//# sourceMappingURL=customType-delete.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-delete.cjs","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["buildCustomTypeDirectoryPath","fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMA,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMC,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
|
|
3
|
+
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
|
|
4
|
+
const customTypeDelete = async (data, context) => {
|
|
5
|
+
const dir = buildCustomTypeDirectoryPath({
|
|
6
|
+
customTypeID: data.model.id,
|
|
7
|
+
helpers: context.helpers
|
|
8
|
+
});
|
|
9
|
+
await fs.rm(dir, { recursive: true });
|
|
10
|
+
await upsertGlobalContentTypes(context);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
customTypeDelete
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=customType-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-delete.js","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAM,yBAAyB,OAAO;AACvC;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
|
|
5
|
+
const readJSONFile = require("../lib/readJSONFile.cjs");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
23
|
+
const customTypeRead = async (data, { helpers }) => {
|
|
24
|
+
const filePath = path__namespace.join(buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
|
|
25
|
+
const model = await readJSONFile.readJSONFile(filePath);
|
|
26
|
+
return {
|
|
27
|
+
model
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.customTypeRead = customTypeRead;
|
|
31
|
+
//# sourceMappingURL=customType-read.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-read.cjs","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<CustomType>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":["path","buildCustomTypeDirectoryPath","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAWA,gBAAK,KACrBC,6BAA6B,6BAAA,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAMC,0BAAyB,QAAQ;AAE9C,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
|
|
3
|
+
import { readJSONFile } from "../lib/readJSONFile.js";
|
|
4
|
+
const customTypeRead = async (data, { helpers }) => {
|
|
5
|
+
const filePath = path.join(buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
|
|
6
|
+
const model = await readJSONFile(filePath);
|
|
7
|
+
return {
|
|
8
|
+
model
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
customTypeRead
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=customType-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-read.js","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<CustomType>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":[],"mappings":";;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAW,KAAK,KACrB,6BAA6B,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAM,aAAyB,QAAQ;AAE9C,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const customTypeCreate = require("./customType-create.cjs");
|
|
4
|
+
const customTypeRename = customTypeCreate.customTypeCreate;
|
|
5
|
+
exports.customTypeRename = customTypeRename;
|
|
6
|
+
//# sourceMappingURL=customType-rename.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-rename.cjs","sources":["../../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const customTypeRename: import("@slicemachine/plugin-kit").CustomTypeCreateHook<import("..").PluginOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-rename.js","sources":["../../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const customTypeCreate = require("./customType-create.cjs");
|
|
4
|
+
const customTypeUpdate = customTypeCreate.customTypeCreate;
|
|
5
|
+
exports.customTypeUpdate = customTypeUpdate;
|
|
6
|
+
//# sourceMappingURL=customType-update.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-update.cjs","sources":["../../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const customTypeUpdate: import("@slicemachine/plugin-kit").CustomTypeCreateHook<import("..").PluginOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-update.js","sources":["../../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const buildCustomTypeLibraryDirectoryPath = require("../lib/buildCustomTypeLibraryDirectoryPath.cjs");
|
|
6
|
+
const readJSONFile = require("../lib/readJSONFile.cjs");
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
+
if (e) {
|
|
10
|
+
for (const k in e) {
|
|
11
|
+
if (k !== "default") {
|
|
12
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: () => e[k]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
24
|
+
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
25
|
+
const isCustomTypeModel = (input) => {
|
|
26
|
+
return typeof input === "object" && input !== null && "json" in input;
|
|
27
|
+
};
|
|
28
|
+
const customTypeLibraryRead = async (_data, { helpers }) => {
|
|
29
|
+
const dirPath = buildCustomTypeLibraryDirectoryPath.buildCustomTypeLibraryDirectoryPath({ helpers });
|
|
30
|
+
await fs__namespace.mkdir(dirPath, { recursive: true });
|
|
31
|
+
const childDirs = await fs__namespace.readdir(dirPath);
|
|
32
|
+
const ids = [];
|
|
33
|
+
await Promise.all(childDirs.map(async (childDir) => {
|
|
34
|
+
const childDirContents = await fs__namespace.readdir(path__namespace.join(dirPath, childDir), {
|
|
35
|
+
withFileTypes: true
|
|
36
|
+
});
|
|
37
|
+
const isCustomTypeDir = childDirContents.some((entry) => {
|
|
38
|
+
return entry.isFile() && entry.name === "index.json";
|
|
39
|
+
});
|
|
40
|
+
if (isCustomTypeDir) {
|
|
41
|
+
const modelPath = path__namespace.join(dirPath, childDir, "index.json");
|
|
42
|
+
const modelContents = await readJSONFile.readJSONFile(modelPath);
|
|
43
|
+
if (isCustomTypeModel(modelContents)) {
|
|
44
|
+
ids.push(modelContents.id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
48
|
+
return {
|
|
49
|
+
ids: ids.sort()
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.customTypeLibraryRead = customTypeLibraryRead;
|
|
53
|
+
//# sourceMappingURL=customTypeLibrary-read.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customTypeLibrary-read.cjs","sources":["../../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeLibraryDirectoryPath } from \"../lib/buildCustomTypeLibraryDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is CustomType => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dirPath = buildCustomTypeLibraryDirectoryPath({ helpers });\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dirPath, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dirPath);\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tconst childDirContents = await fs.readdir(path.join(dirPath, childDir), {\n\t\t\t\twithFileTypes: true,\n\t\t\t});\n\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t});\n\n\t\t\tif (isCustomTypeDir) {\n\t\t\t\tconst modelPath = path.join(dirPath, childDir, \"index.json\");\n\n\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":["buildCustomTypeLibraryDirectoryPath","fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB,CAEzB,UACwB;AACxB,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAChC,QAAM,UAAUA,oCAAAA,oCAAoC,EAAE,QAAS,CAAA;AAG/D,QAAMC,cAAG,MAAM,SAAS,EAAE,WAAW,MAAM;AAE3C,QAAM,YAAY,MAAMA,cAAG,QAAQ,OAAO;AAE1C,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC1B,UAAA,mBAAmB,MAAMA,cAAG,QAAQC,gBAAK,KAAK,SAAS,QAAQ,GAAG;AAAA,MACvE,eAAe;AAAA,IAAA,CACf;AACD,UAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,aAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,IAAA,CACxC;AAED,QAAI,iBAAiB;AACpB,YAAM,YAAYA,gBAAK,KAAK,SAAS,UAAU,YAAY;AAErD,YAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,UAAA,kBAAkB,aAAa,GAAG;AACjC,YAAA,KAAK,cAAc,EAAE;AAAA,MACzB;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;;"}
|