@slicemachine/plugin-kit 0.4.82-beta.5 → 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.
- package/dist/_node_modules/fp-ts/es6/Either.cjs.map +1 -1
- package/dist/_node_modules/fp-ts/es6/Either.js.map +1 -1
- package/dist/_node_modules/fp-ts/es6/function.cjs +7 -9
- package/dist/_node_modules/fp-ts/es6/function.cjs.map +1 -1
- package/dist/_node_modules/fp-ts/es6/function.js +7 -9
- package/dist/_node_modules/fp-ts/es6/function.js.map +1 -1
- package/dist/_node_modules/fp-ts/es6/internal.cjs +7 -9
- package/dist/_node_modules/fp-ts/es6/internal.cjs.map +1 -1
- package/dist/_node_modules/fp-ts/es6/internal.js +7 -9
- package/dist/_node_modules/fp-ts/es6/internal.js.map +1 -1
- package/dist/_node_modules/lower-case/dist.es2015/index.cjs.map +1 -1
- package/dist/_node_modules/lower-case/dist.es2015/index.js.map +1 -1
- package/dist/_node_modules/no-case/dist.es2015/index.cjs.map +1 -1
- package/dist/_node_modules/no-case/dist.es2015/index.js.map +1 -1
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.cjs +11 -25
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.cjs.map +1 -1
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js +11 -25
- package/dist/_node_modules/p-limit/_node_modules/yocto-queue/index.js.map +1 -1
- package/dist/_node_modules/p-limit/index.cjs.map +1 -1
- package/dist/_node_modules/p-limit/index.js.map +1 -1
- package/dist/_node_modules/pascal-case/dist.es2015/index.cjs.map +1 -1
- package/dist/_node_modules/pascal-case/dist.es2015/index.js.map +1 -1
- package/dist/_node_modules/tslib/tslib.es6.cjs +1 -3
- package/dist/_node_modules/tslib/tslib.es6.cjs.map +1 -1
- package/dist/_node_modules/tslib/tslib.es6.js +1 -3
- package/dist/_node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/createSliceMachineActions.cjs +1 -4
- package/dist/createSliceMachineActions.cjs.map +1 -1
- package/dist/createSliceMachineActions.js +1 -4
- package/dist/createSliceMachineActions.js.map +1 -1
- package/dist/createSliceMachineContext.cjs.map +1 -1
- package/dist/createSliceMachineContext.js.map +1 -1
- package/dist/createSliceMachineHelpers.cjs +1 -4
- package/dist/createSliceMachineHelpers.cjs.map +1 -1
- package/dist/createSliceMachineHelpers.js +1 -4
- package/dist/createSliceMachineHelpers.js.map +1 -1
- package/dist/createSliceMachineHookSystem.cjs.map +1 -1
- package/dist/createSliceMachineHookSystem.js.map +1 -1
- package/dist/createSliceMachinePluginRunner.cjs +1 -4
- package/dist/createSliceMachinePluginRunner.cjs.map +1 -1
- package/dist/createSliceMachinePluginRunner.js +1 -4
- package/dist/createSliceMachinePluginRunner.js.map +1 -1
- package/dist/defineSliceMachinePlugin.cjs.map +1 -1
- package/dist/defineSliceMachinePlugin.js.map +1 -1
- package/dist/fs/buildCustomTypeDirectoryPath.cjs.map +1 -1
- package/dist/fs/buildCustomTypeDirectoryPath.js.map +1 -1
- package/dist/fs/buildCustomTypeFilePath.cjs.map +1 -1
- package/dist/fs/buildCustomTypeFilePath.js.map +1 -1
- package/dist/fs/buildCustomTypeLibraryDirectoryPath.cjs.map +1 -1
- package/dist/fs/buildCustomTypeLibraryDirectoryPath.js.map +1 -1
- package/dist/fs/buildSliceDirectoryPath.cjs.map +1 -1
- package/dist/fs/buildSliceDirectoryPath.js.map +1 -1
- package/dist/fs/buildSliceFilePath.cjs.map +1 -1
- package/dist/fs/buildSliceFilePath.js.map +1 -1
- package/dist/fs/buildSliceLibraryDirectoryPath.cjs.map +1 -1
- package/dist/fs/buildSliceLibraryDirectoryPath.js.map +1 -1
- package/dist/fs/checkHasProjectFile.cjs.map +1 -1
- package/dist/fs/checkHasProjectFile.js.map +1 -1
- package/dist/fs/checkIsTypeScriptProject.cjs.map +1 -1
- package/dist/fs/checkIsTypeScriptProject.js.map +1 -1
- package/dist/fs/deleteCustomTypeDirectory.cjs.map +1 -1
- package/dist/fs/deleteCustomTypeDirectory.js.map +1 -1
- package/dist/fs/deleteCustomTypeFile.cjs.map +1 -1
- package/dist/fs/deleteCustomTypeFile.js.map +1 -1
- package/dist/fs/deleteProjectFile.cjs.map +1 -1
- package/dist/fs/deleteProjectFile.js.map +1 -1
- package/dist/fs/deleteSliceDirectory.cjs.map +1 -1
- package/dist/fs/deleteSliceDirectory.js.map +1 -1
- package/dist/fs/deleteSliceFile.cjs.map +1 -1
- package/dist/fs/deleteSliceFile.js.map +1 -1
- package/dist/fs/lib/checkPathExists.cjs.map +1 -1
- package/dist/fs/lib/checkPathExists.js.map +1 -1
- package/dist/fs/lib/fsLimit.cjs.map +1 -1
- package/dist/fs/lib/fsLimit.js.map +1 -1
- package/dist/fs/lib/pascalCase.cjs.map +1 -1
- package/dist/fs/lib/pascalCase.js.map +1 -1
- package/dist/fs/lib/readJSONFile.cjs.map +1 -1
- package/dist/fs/lib/readJSONFile.js.map +1 -1
- package/dist/fs/lib/resolveSliceModel.cjs.map +1 -1
- package/dist/fs/lib/resolveSliceModel.js.map +1 -1
- package/dist/fs/readCustomTypeFile.cjs.map +1 -1
- package/dist/fs/readCustomTypeFile.js.map +1 -1
- package/dist/fs/readCustomTypeLibrary.cjs.map +1 -1
- package/dist/fs/readCustomTypeLibrary.js.map +1 -1
- package/dist/fs/readCustomTypeModel.cjs.map +1 -1
- package/dist/fs/readCustomTypeModel.js.map +1 -1
- package/dist/fs/readProjectEnvironment.cjs.map +1 -1
- package/dist/fs/readProjectEnvironment.js.map +1 -1
- package/dist/fs/readSliceFile.cjs.map +1 -1
- package/dist/fs/readSliceFile.js.map +1 -1
- package/dist/fs/readSliceLibrary.cjs.map +1 -1
- package/dist/fs/readSliceLibrary.js.map +1 -1
- package/dist/fs/readSliceModel.cjs.map +1 -1
- package/dist/fs/readSliceModel.js.map +1 -1
- package/dist/fs/readSliceTemplateLibrary.cjs.map +1 -1
- package/dist/fs/readSliceTemplateLibrary.js.map +1 -1
- package/dist/fs/renameCustomType.cjs.map +1 -1
- package/dist/fs/renameCustomType.js.map +1 -1
- package/dist/fs/renameSlice.cjs.map +1 -1
- package/dist/fs/renameSlice.js.map +1 -1
- package/dist/fs/upsertGlobalTypeScriptTypes.cjs.map +1 -1
- package/dist/fs/upsertGlobalTypeScriptTypes.js.map +1 -1
- package/dist/fs/writeCustomTypeFile.cjs.map +1 -1
- package/dist/fs/writeCustomTypeFile.js.map +1 -1
- package/dist/fs/writeCustomTypeModel.cjs.map +1 -1
- package/dist/fs/writeCustomTypeModel.js.map +1 -1
- package/dist/fs/writeProjectEnvironment.cjs.map +1 -1
- package/dist/fs/writeProjectEnvironment.js.map +1 -1
- package/dist/fs/writeProjectFile.cjs.map +1 -1
- package/dist/fs/writeProjectFile.js.map +1 -1
- package/dist/fs/writeSliceFile.cjs.map +1 -1
- package/dist/fs/writeSliceFile.js.map +1 -1
- package/dist/fs/writeSliceModel.cjs.map +1 -1
- package/dist/fs/writeSliceModel.js.map +1 -1
- package/dist/lib/DecodeError.cjs +1 -4
- package/dist/lib/DecodeError.cjs.map +1 -1
- package/dist/lib/DecodeError.js +1 -4
- package/dist/lib/DecodeError.js.map +1 -1
- package/dist/lib/HookSystem.cjs +1 -4
- package/dist/lib/HookSystem.cjs.map +1 -1
- package/dist/lib/HookSystem.js +1 -4
- package/dist/lib/HookSystem.js.map +1 -1
- package/dist/lib/decode.cjs.map +1 -1
- package/dist/lib/decode.js.map +1 -1
- package/dist/lib/decodeSliceMachineConfig.cjs.map +1 -1
- package/dist/lib/decodeSliceMachineConfig.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachineActions.js","sources":["../../src/createSliceMachineActions.ts"],"sourcesContent":["import { HookSystem } from \"./lib/HookSystem\";\nimport { SliceMachineHooks, SliceMachineProject } from \"./types\";\n\nimport { CustomTypeLibraryReadHookReturnType } from \"./hooks/customTypeLibrary-read\";\nimport {\n\tCustomTypeReadHookData,\n\tCustomTypeReadHookReturnType,\n} from \"./hooks/customType-read\";\nimport {\n\tSliceLibraryReadHookData,\n\tSliceLibraryReadHookReturnType,\n} from \"./hooks/sliceLibrary-read\";\nimport { SliceReadHookData, SliceReadHookReturnType } from \"./hooks/slice-read\";\n\nexport type ReadAllSliceModelsActionArgs<\n\tTWithMetadata extends boolean = false,\n> = {\n\twithMetadata?: TWithMetadata;\n};\n\nexport type ReadAllSliceModelsActionReturnType = (SliceReadHookReturnType & {\n\tlibraryID: string;\n})[];\n\nexport type ReadAllSliceModelsForLibraryActionArgs = {\n\tlibraryID: string;\n};\n\n/**\n * Creates Slice Machine actions.\n *\n * @internal\n */\nexport const createSliceMachineActions = (\n\tproject: SliceMachineProject,\n\thookSystem: HookSystem<SliceMachineHooks>,\n): SliceMachineActions => {\n\treturn new SliceMachineActions(project, hookSystem);\n};\n\n/**\n * Slice Machine actions shared to plugins and hooks.\n */\nexport class SliceMachineActions {\n\t/**\n\t * The Slice Machine project's metadata.\n\t *\n\t * @internal\n\t */\n\tprivate _project: SliceMachineProject;\n\t/**\n\t * The actions' hook system used to internally trigger hook calls.\n\t *\n\t * @internal\n\t */\n\tprivate _hookSystem: HookSystem<SliceMachineHooks>;\n\n\tconstructor(\n\t\tproject: SliceMachineProject,\n\t\thookSystem: HookSystem<SliceMachineHooks>,\n\t) {\n\t\tthis._project = project;\n\t\tthis._hookSystem = hookSystem;\n\t}\n\n\treadAllSliceModels =\n\t\tasync (): Promise<ReadAllSliceModelsActionReturnType> => {\n\t\t\tconst libraryIDs = this._project.config.libraries || [];\n\n\t\t\treturn (\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tlibraryIDs.map(async (libraryID) => {\n\t\t\t\t\t\tconst models = await this.readAllSliceModelsForLibrary({\n\t\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn models.map((model) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t\t\t\t...model,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t).flat();\n\t\t};\n\n\treadAllSliceModelsForLibrary = async (\n\t\targs: ReadAllSliceModelsForLibraryActionArgs,\n\t): Promise<SliceReadHookReturnType[]> => {\n\t\tconst { sliceIDs } = await this.readSliceLibrary({\n\t\t\tlibraryID: args.libraryID,\n\t\t});\n\n\t\treturn await Promise.all(\n\t\t\tsliceIDs.map(async (sliceID) => {\n\t\t\t\treturn await this.readSliceModel({\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID,\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t};\n\n\treadSliceModel = async (\n\t\targs: SliceReadHookData,\n\t): Promise<SliceReadHookReturnType> => {\n\t\tconst {\n\t\t\tdata: [model],\n\t\t\terrors: [cause],\n\t\t} = await this._hookSystem.callHook(\"slice:read\", {\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (!model) {\n\t\t\tthrow new Error(\n\t\t\t\t`Slice \\`${args.sliceID}\\` not found in the \\`${args.libraryID}\\` library.`,\n\t\t\t\t{ cause },\n\t\t\t);\n\t\t}\n\n\t\treturn model;\n\t};\n\n\treadSliceLibrary = async (\n\t\targs: SliceLibraryReadHookData,\n\t): Promise<SliceLibraryReadHookReturnType> => {\n\t\tconst {\n\t\t\tdata: [library],\n\t\t\terrors: [cause],\n\t\t} = await this._hookSystem.callHook(\"slice-library:read\", {\n\t\t\tlibraryID: args.libraryID,\n\t\t});\n\n\t\tif (!library) {\n\t\t\tthrow new Error(`Slice library \\`${args.libraryID}\\` not found.`, {\n\t\t\t\tcause,\n\t\t\t});\n\t\t}\n\n\t\treturn library;\n\t};\n\n\treadAllCustomTypeModels = async (): Promise<\n\t\tCustomTypeReadHookReturnType[]\n\t> => {\n\t\tconst { ids } = await this.readCustomTypeLibrary();\n\n\t\treturn await Promise.all(\n\t\t\tids.map(async (id) => {\n\t\t\t\treturn this.readCustomTypeModel({ id });\n\t\t\t}),\n\t\t);\n\t};\n\n\treadCustomTypeModel = async (\n\t\targs: CustomTypeReadHookData,\n\t): Promise<CustomTypeReadHookReturnType> => {\n\t\tconst {\n\t\t\tdata: [model],\n\t\t\terrors: [cause],\n\t\t} = await this._hookSystem.callHook(\"custom-type:read\", {\n\t\t\tid: args.id,\n\t\t});\n\n\t\tif (!model) {\n\t\t\tthrow new Error(`Custom type \\`${args.id}\\` not found.`, { cause });\n\t\t}\n\n\t\treturn model;\n\t};\n\n\treadCustomTypeLibrary =\n\t\tasync (): Promise<CustomTypeLibraryReadHookReturnType> => {\n\t\t\tconst {\n\t\t\t\tdata: [library],\n\t\t\t\terrors: [cause],\n\t\t\t} = await this._hookSystem.callHook(\n\t\t\t\t\"custom-type-library:read\",\n\t\t\t\tundefined,\n\t\t\t);\n\n\t\t\tif (!library) {\n\t\t\t\tthrow new Error(`Couldn't read custom type library.`, {\n\t\t\t\t\tcause,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn library;\n\t\t};\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createSliceMachineActions.js","sources":["../../src/createSliceMachineActions.ts"],"sourcesContent":["import { HookSystem } from \"./lib/HookSystem\";\nimport { SliceMachineHooks, SliceMachineProject } from \"./types\";\n\nimport { CustomTypeLibraryReadHookReturnType } from \"./hooks/customTypeLibrary-read\";\nimport {\n\tCustomTypeReadHookData,\n\tCustomTypeReadHookReturnType,\n} from \"./hooks/customType-read\";\nimport {\n\tSliceLibraryReadHookData,\n\tSliceLibraryReadHookReturnType,\n} from \"./hooks/sliceLibrary-read\";\nimport { SliceReadHookData, SliceReadHookReturnType } from \"./hooks/slice-read\";\n\nexport type ReadAllSliceModelsActionArgs<\n\tTWithMetadata extends boolean = false,\n> = {\n\twithMetadata?: TWithMetadata;\n};\n\nexport type ReadAllSliceModelsActionReturnType = (SliceReadHookReturnType & {\n\tlibraryID: string;\n})[];\n\nexport type ReadAllSliceModelsForLibraryActionArgs = {\n\tlibraryID: string;\n};\n\n/**\n * Creates Slice Machine actions.\n *\n * @internal\n */\nexport const createSliceMachineActions = (\n\tproject: SliceMachineProject,\n\thookSystem: HookSystem<SliceMachineHooks>,\n): SliceMachineActions => {\n\treturn new SliceMachineActions(project, hookSystem);\n};\n\n/**\n * Slice Machine actions shared to plugins and hooks.\n */\nexport class SliceMachineActions {\n\t/**\n\t * The Slice Machine project's metadata.\n\t *\n\t * @internal\n\t */\n\tprivate _project: SliceMachineProject;\n\t/**\n\t * The actions' hook system used to internally trigger hook calls.\n\t *\n\t * @internal\n\t */\n\tprivate _hookSystem: HookSystem<SliceMachineHooks>;\n\n\tconstructor(\n\t\tproject: SliceMachineProject,\n\t\thookSystem: HookSystem<SliceMachineHooks>,\n\t) {\n\t\tthis._project = project;\n\t\tthis._hookSystem = hookSystem;\n\t}\n\n\treadAllSliceModels =\n\t\tasync (): Promise<ReadAllSliceModelsActionReturnType> => {\n\t\t\tconst libraryIDs = this._project.config.libraries || [];\n\n\t\t\treturn (\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tlibraryIDs.map(async (libraryID) => {\n\t\t\t\t\t\tconst models = await this.readAllSliceModelsForLibrary({\n\t\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn models.map((model) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tlibraryID,\n\t\t\t\t\t\t\t\t...model,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t).flat();\n\t\t};\n\n\treadAllSliceModelsForLibrary = async (\n\t\targs: ReadAllSliceModelsForLibraryActionArgs,\n\t): Promise<SliceReadHookReturnType[]> => {\n\t\tconst { sliceIDs } = await this.readSliceLibrary({\n\t\t\tlibraryID: args.libraryID,\n\t\t});\n\n\t\treturn await Promise.all(\n\t\t\tsliceIDs.map(async (sliceID) => {\n\t\t\t\treturn await this.readSliceModel({\n\t\t\t\t\tlibraryID: args.libraryID,\n\t\t\t\t\tsliceID,\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t};\n\n\treadSliceModel = async (\n\t\targs: SliceReadHookData,\n\t): Promise<SliceReadHookReturnType> => {\n\t\tconst {\n\t\t\tdata: [model],\n\t\t\terrors: [cause],\n\t\t} = await this._hookSystem.callHook(\"slice:read\", {\n\t\t\tlibraryID: args.libraryID,\n\t\t\tsliceID: args.sliceID,\n\t\t});\n\n\t\tif (!model) {\n\t\t\tthrow new Error(\n\t\t\t\t`Slice \\`${args.sliceID}\\` not found in the \\`${args.libraryID}\\` library.`,\n\t\t\t\t{ cause },\n\t\t\t);\n\t\t}\n\n\t\treturn model;\n\t};\n\n\treadSliceLibrary = async (\n\t\targs: SliceLibraryReadHookData,\n\t): Promise<SliceLibraryReadHookReturnType> => {\n\t\tconst {\n\t\t\tdata: [library],\n\t\t\terrors: [cause],\n\t\t} = await this._hookSystem.callHook(\"slice-library:read\", {\n\t\t\tlibraryID: args.libraryID,\n\t\t});\n\n\t\tif (!library) {\n\t\t\tthrow new Error(`Slice library \\`${args.libraryID}\\` not found.`, {\n\t\t\t\tcause,\n\t\t\t});\n\t\t}\n\n\t\treturn library;\n\t};\n\n\treadAllCustomTypeModels = async (): Promise<\n\t\tCustomTypeReadHookReturnType[]\n\t> => {\n\t\tconst { ids } = await this.readCustomTypeLibrary();\n\n\t\treturn await Promise.all(\n\t\t\tids.map(async (id) => {\n\t\t\t\treturn this.readCustomTypeModel({ id });\n\t\t\t}),\n\t\t);\n\t};\n\n\treadCustomTypeModel = async (\n\t\targs: CustomTypeReadHookData,\n\t): Promise<CustomTypeReadHookReturnType> => {\n\t\tconst {\n\t\t\tdata: [model],\n\t\t\terrors: [cause],\n\t\t} = await this._hookSystem.callHook(\"custom-type:read\", {\n\t\t\tid: args.id,\n\t\t});\n\n\t\tif (!model) {\n\t\t\tthrow new Error(`Custom type \\`${args.id}\\` not found.`, { cause });\n\t\t}\n\n\t\treturn model;\n\t};\n\n\treadCustomTypeLibrary =\n\t\tasync (): Promise<CustomTypeLibraryReadHookReturnType> => {\n\t\t\tconst {\n\t\t\t\tdata: [library],\n\t\t\t\terrors: [cause],\n\t\t\t} = await this._hookSystem.callHook(\n\t\t\t\t\"custom-type-library:read\",\n\t\t\t\tundefined,\n\t\t\t);\n\n\t\t\tif (!library) {\n\t\t\t\tthrow new Error(`Couldn't read custom type library.`, {\n\t\t\t\t\tcause,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn library;\n\t\t};\n}\n"],"names":[],"mappings":";;;AAiCO,MAAM,4BAA4B,CACxC,SACA,eACwB;AACxB,SAAO,IAAI,oBAAoB,SAAS,UAAU;AACnD;MAKa,oBAAmB;AAAA,EAc/B,YACC,SACA,YAAyC;AAVlC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUR,8CACC,YAAwD;AACvD,YAAM,aAAa,KAAK,SAAS,OAAO,aAAa,CAAA;AAErD,cACC,MAAM,QAAQ,IACb,WAAW,IAAI,OAAO,cAAa;AAClC,cAAM,SAAS,MAAM,KAAK,6BAA6B;AAAA,UACtD;AAAA,QAAA,CACA;AAED,eAAO,OAAO,IAAI,CAAC,UAAS;AAC3B,iBAAO;AAAA,YACN;AAAA,YACA,GAAG;AAAA,UAAA;AAAA,QAEL,CAAC;AAAA,MACF,CAAC,CAAC,GAEF,KAAA;AAAA,IACH;AAED,wDAA+B,OAC9B,SACuC;AACvC,YAAM,EAAE,SAAA,IAAa,MAAM,KAAK,iBAAiB;AAAA,QAChD,WAAW,KAAK;AAAA,MAAA,CAChB;AAED,aAAO,MAAM,QAAQ,IACpB,SAAS,IAAI,OAAO,YAAW;AAC9B,eAAO,MAAM,KAAK,eAAe;AAAA,UAChC,WAAW,KAAK;AAAA,UAChB;AAAA,QAAA,CACA;AAAA,MACF,CAAC,CAAC;AAAA,IAEJ;AA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AAM,KAAK,YAAY,SAC1B,4BACA,MAAS;AAGV,UAAI,CAAC,SAAS;AACb,cAAM,IAAI,MAAM,sCAAsC;AAAA,UACrD;AAAA,QAAA,CACA;AAAA,MACF;AAEA,aAAO;AAAA,IACR;AAjIA,SAAK,WAAW;AAChB,SAAK,cAAc;AAAA,EACpB;AAgIA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachineContext.cjs","sources":["../../src/createSliceMachineContext.ts"],"sourcesContent":["import { SliceMachineActions } from \"./createSliceMachineActions\";\nimport { SliceMachineHelpers } from \"./createSliceMachineHelpers\";\nimport { LoadedSliceMachinePlugin } from \"./defineSliceMachinePlugin\";\nimport { SliceMachineProject } from \"./types\";\n\n/**\n * Slice Machine context shared to plugins and hooks.\n */\nexport type SliceMachineContext<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\toptions: TPluginOptions;\n};\n\n/**\n * Arguments for `createSliceMachineContext()`.\n *\n * @typeParam TPluginOptions - Options for the plugin's context.\n */\ntype CreateSliceMachineContextArgs<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\tplugin: LoadedSliceMachinePlugin<TPluginOptions>;\n};\n\n/**\n * Creates Slice Machine context.\n *\n * @internal\n */\nexport const createSliceMachineContext = <\n\tTPluginOptions extends Record<string, unknown>,\n>({\n\tactions,\n\thelpers,\n\tproject,\n\tplugin,\n}: CreateSliceMachineContextArgs<TPluginOptions>): SliceMachineContext<TPluginOptions> => {\n\treturn {\n\t\tactions,\n\t\thelpers,\n\t\tproject,\n\t\toptions: plugin.options,\n\t};\n};\n"],"names":[],"mappings":";;AAoCO,MAAM,4BAA4B,CAEvC,EACD,SACA,SACA,SACA,aACwF;
|
|
1
|
+
{"version":3,"file":"createSliceMachineContext.cjs","sources":["../../src/createSliceMachineContext.ts"],"sourcesContent":["import { SliceMachineActions } from \"./createSliceMachineActions\";\nimport { SliceMachineHelpers } from \"./createSliceMachineHelpers\";\nimport { LoadedSliceMachinePlugin } from \"./defineSliceMachinePlugin\";\nimport { SliceMachineProject } from \"./types\";\n\n/**\n * Slice Machine context shared to plugins and hooks.\n */\nexport type SliceMachineContext<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\toptions: TPluginOptions;\n};\n\n/**\n * Arguments for `createSliceMachineContext()`.\n *\n * @typeParam TPluginOptions - Options for the plugin's context.\n */\ntype CreateSliceMachineContextArgs<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\tplugin: LoadedSliceMachinePlugin<TPluginOptions>;\n};\n\n/**\n * Creates Slice Machine context.\n *\n * @internal\n */\nexport const createSliceMachineContext = <\n\tTPluginOptions extends Record<string, unknown>,\n>({\n\tactions,\n\thelpers,\n\tproject,\n\tplugin,\n}: CreateSliceMachineContextArgs<TPluginOptions>): SliceMachineContext<TPluginOptions> => {\n\treturn {\n\t\tactions,\n\t\thelpers,\n\t\tproject,\n\t\toptions: plugin.options,\n\t};\n};\n"],"names":[],"mappings":";;AAoCO,MAAM,4BAA4B,CAEvC,EACD,SACA,SACA,SACA,aACwF;AACxF,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,OAAO;AAAA,EAAA;AAElB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachineContext.js","sources":["../../src/createSliceMachineContext.ts"],"sourcesContent":["import { SliceMachineActions } from \"./createSliceMachineActions\";\nimport { SliceMachineHelpers } from \"./createSliceMachineHelpers\";\nimport { LoadedSliceMachinePlugin } from \"./defineSliceMachinePlugin\";\nimport { SliceMachineProject } from \"./types\";\n\n/**\n * Slice Machine context shared to plugins and hooks.\n */\nexport type SliceMachineContext<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\toptions: TPluginOptions;\n};\n\n/**\n * Arguments for `createSliceMachineContext()`.\n *\n * @typeParam TPluginOptions - Options for the plugin's context.\n */\ntype CreateSliceMachineContextArgs<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\tplugin: LoadedSliceMachinePlugin<TPluginOptions>;\n};\n\n/**\n * Creates Slice Machine context.\n *\n * @internal\n */\nexport const createSliceMachineContext = <\n\tTPluginOptions extends Record<string, unknown>,\n>({\n\tactions,\n\thelpers,\n\tproject,\n\tplugin,\n}: CreateSliceMachineContextArgs<TPluginOptions>): SliceMachineContext<TPluginOptions> => {\n\treturn {\n\t\tactions,\n\t\thelpers,\n\t\tproject,\n\t\toptions: plugin.options,\n\t};\n};\n"],"names":[],"mappings":"AAoCO,MAAM,4BAA4B,CAEvC,EACD,SACA,SACA,SACA,aACwF;
|
|
1
|
+
{"version":3,"file":"createSliceMachineContext.js","sources":["../../src/createSliceMachineContext.ts"],"sourcesContent":["import { SliceMachineActions } from \"./createSliceMachineActions\";\nimport { SliceMachineHelpers } from \"./createSliceMachineHelpers\";\nimport { LoadedSliceMachinePlugin } from \"./defineSliceMachinePlugin\";\nimport { SliceMachineProject } from \"./types\";\n\n/**\n * Slice Machine context shared to plugins and hooks.\n */\nexport type SliceMachineContext<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\toptions: TPluginOptions;\n};\n\n/**\n * Arguments for `createSliceMachineContext()`.\n *\n * @typeParam TPluginOptions - Options for the plugin's context.\n */\ntype CreateSliceMachineContextArgs<\n\tTPluginOptions extends Record<string, unknown>,\n> = {\n\tactions: SliceMachineActions;\n\thelpers: SliceMachineHelpers;\n\tproject: SliceMachineProject;\n\tplugin: LoadedSliceMachinePlugin<TPluginOptions>;\n};\n\n/**\n * Creates Slice Machine context.\n *\n * @internal\n */\nexport const createSliceMachineContext = <\n\tTPluginOptions extends Record<string, unknown>,\n>({\n\tactions,\n\thelpers,\n\tproject,\n\tplugin,\n}: CreateSliceMachineContextArgs<TPluginOptions>): SliceMachineContext<TPluginOptions> => {\n\treturn {\n\t\tactions,\n\t\thelpers,\n\t\tproject,\n\t\toptions: plugin.options,\n\t};\n};\n"],"names":[],"mappings":"AAoCO,MAAM,4BAA4B,CAEvC,EACD,SACA,SACA,SACA,aACwF;AACxF,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,OAAO;AAAA,EAAA;AAElB;"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) =>
|
|
5
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
6
|
const path = require("node:path");
|
|
10
7
|
const fs = require("node:fs/promises");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachineHelpers.cjs","sources":["../../src/createSliceMachineHelpers.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\n\nimport * as prettier from \"prettier\";\nimport { stripIndent } from \"common-tags\";\n\nimport { decodeSliceMachineConfig } from \"./lib/decodeSliceMachineConfig\";\n\nimport { SliceMachineConfig, SliceMachineProject } from \"./types\";\n\ntype UpdateSliceMachineConfigOptions = {\n\tformat?: boolean;\n};\n\ntype FormatOptions = {\n\tprettier?: prettier.Options;\n\t/**\n\t * Determines if a newline is included at the end of the formatted result.\n\t *\n\t * @defaultValue `true`\n\t */\n\tincludeNewlineAtEnd?: boolean;\n};\n\n/**\n * Creates Slice Machine helpers.\n *\n * @internal\n */\nexport const createSliceMachineHelpers = (\n\tproject: SliceMachineProject,\n): SliceMachineHelpers => {\n\treturn new SliceMachineHelpers(project);\n};\n\n/**\n * Slice Machine helpers shared to plugins and hooks.\n */\nexport class SliceMachineHelpers {\n\t/**\n\t * The Slice Machine project's metadata.\n\t *\n\t * @internal\n\t */\n\tprivate _project: SliceMachineProject;\n\n\tconstructor(project: SliceMachineProject) {\n\t\tthis._project = project;\n\t}\n\n\tgetProject = async (): Promise<SliceMachineProject> => {\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\n\t\tlet rawConfig: unknown | undefined;\n\t\ttry {\n\t\t\tconst contents = await fs.readFile(configFilePath, \"utf8\");\n\t\t\trawConfig = JSON.parse(contents);\n\t\t} catch {\n\t\t\t// noop\n\t\t}\n\n\t\tif (!rawConfig) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(\"No config found.\");\n\t\t}\n\n\t\tconst { value: sliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(rawConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\treturn {\n\t\t\t...this._project,\n\t\t\tconfig: sliceMachineConfig,\n\t\t};\n\t};\n\n\tupdateSliceMachineConfig = async (\n\t\tsliceMachineConfig: SliceMachineConfig,\n\t\toptions?: UpdateSliceMachineConfigOptions,\n\t): Promise<void> => {\n\t\tconst { value: decodedSliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(sliceMachineConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config provided. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\t\tlet content = JSON.stringify(decodedSliceMachineConfig, null, 2);\n\n\t\tif (options?.format) {\n\t\t\tcontent = await this.format(content, configFilePath);\n\t\t}\n\n\t\tawait fs.writeFile(configFilePath, content);\n\t};\n\n\tformat = async (\n\t\tsource: string,\n\t\tfilePath?: string,\n\t\toptions?: FormatOptions,\n\t): Promise<string> => {\n\t\tlet formatted = stripIndent(source);\n\n\t\tconst prettierOptions = await prettier.resolveConfig(\n\t\t\tfilePath || this._project.root,\n\t\t);\n\n\t\tformatted = await prettier.format(formatted, {\n\t\t\t...prettierOptions,\n\t\t\tfilepath: filePath,\n\t\t\t...(options?.prettier ?? {}),\n\t\t});\n\n\t\tif (options?.includeNewlineAtEnd === false) {\n\t\t\tformatted = formatted.replace(/[\\r\\n]+$/, \"\");\n\t\t}\n\n\t\treturn formatted;\n\t};\n\n\tjoinPathFromRoot = (...paths: string[]): string => {\n\t\treturn path.join(this._project.root, ...paths);\n\t};\n}\n"],"names":["fs","decodeSliceMachineConfig","stripIndent","prettier","path"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createSliceMachineHelpers.cjs","sources":["../../src/createSliceMachineHelpers.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\n\nimport * as prettier from \"prettier\";\nimport { stripIndent } from \"common-tags\";\n\nimport { decodeSliceMachineConfig } from \"./lib/decodeSliceMachineConfig\";\n\nimport { SliceMachineConfig, SliceMachineProject } from \"./types\";\n\ntype UpdateSliceMachineConfigOptions = {\n\tformat?: boolean;\n};\n\ntype FormatOptions = {\n\tprettier?: prettier.Options;\n\t/**\n\t * Determines if a newline is included at the end of the formatted result.\n\t *\n\t * @defaultValue `true`\n\t */\n\tincludeNewlineAtEnd?: boolean;\n};\n\n/**\n * Creates Slice Machine helpers.\n *\n * @internal\n */\nexport const createSliceMachineHelpers = (\n\tproject: SliceMachineProject,\n): SliceMachineHelpers => {\n\treturn new SliceMachineHelpers(project);\n};\n\n/**\n * Slice Machine helpers shared to plugins and hooks.\n */\nexport class SliceMachineHelpers {\n\t/**\n\t * The Slice Machine project's metadata.\n\t *\n\t * @internal\n\t */\n\tprivate _project: SliceMachineProject;\n\n\tconstructor(project: SliceMachineProject) {\n\t\tthis._project = project;\n\t}\n\n\tgetProject = async (): Promise<SliceMachineProject> => {\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\n\t\tlet rawConfig: unknown | undefined;\n\t\ttry {\n\t\t\tconst contents = await fs.readFile(configFilePath, \"utf8\");\n\t\t\trawConfig = JSON.parse(contents);\n\t\t} catch {\n\t\t\t// noop\n\t\t}\n\n\t\tif (!rawConfig) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(\"No config found.\");\n\t\t}\n\n\t\tconst { value: sliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(rawConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\treturn {\n\t\t\t...this._project,\n\t\t\tconfig: sliceMachineConfig,\n\t\t};\n\t};\n\n\tupdateSliceMachineConfig = async (\n\t\tsliceMachineConfig: SliceMachineConfig,\n\t\toptions?: UpdateSliceMachineConfigOptions,\n\t): Promise<void> => {\n\t\tconst { value: decodedSliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(sliceMachineConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config provided. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\t\tlet content = JSON.stringify(decodedSliceMachineConfig, null, 2);\n\n\t\tif (options?.format) {\n\t\t\tcontent = await this.format(content, configFilePath);\n\t\t}\n\n\t\tawait fs.writeFile(configFilePath, content);\n\t};\n\n\tformat = async (\n\t\tsource: string,\n\t\tfilePath?: string,\n\t\toptions?: FormatOptions,\n\t): Promise<string> => {\n\t\tlet formatted = stripIndent(source);\n\n\t\tconst prettierOptions = await prettier.resolveConfig(\n\t\t\tfilePath || this._project.root,\n\t\t);\n\n\t\tformatted = await prettier.format(formatted, {\n\t\t\t...prettierOptions,\n\t\t\tfilepath: filePath,\n\t\t\t...(options?.prettier ?? {}),\n\t\t});\n\n\t\tif (options?.includeNewlineAtEnd === false) {\n\t\t\tformatted = formatted.replace(/[\\r\\n]+$/, \"\");\n\t\t}\n\n\t\treturn formatted;\n\t};\n\n\tjoinPathFromRoot = (...paths: string[]): string => {\n\t\treturn path.join(this._project.root, ...paths);\n\t};\n}\n"],"names":["fs","decodeSliceMachineConfig","stripIndent","prettier","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,4BAA4B,CACxC,YACwB;AACxB,SAAO,IAAI,oBAAoB,OAAO;AACvC;MAKa,oBAAmB;AAAA,EAQ/B,YAAY,SAA4B;AAFhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMR,sCAAa,YAAyC;AACrD,YAAM,iBAAiB,KAAK,iBAAiB,0BAA0B;AAEvE,UAAI;AACJ,UAAI;AACH,cAAM,WAAW,MAAMA,cAAG,SAAS,gBAAgB,MAAM;AACzD,oBAAY,KAAK,MAAM,QAAQ;AAAA,MAChC,QAAQ;AAAA,MAER;AAEA,UAAI,CAAC,WAAW;AAEf,cAAM,IAAI,MAAM,kBAAkB;AAAA,MACnC;AAEA,YAAM,EAAE,OAAO,oBAAoB,MAAA,IAClCC,yBAAAA,yBAAyB,SAAS;AAEnC,UAAI,OAAO;AAEV,cAAM,IAAI,MAAM,mBAAmB,MAAM,OAAO,KAAK,IAAI,CAAC,EAAE;AAAA,MAC7D;AAEA,aAAO;AAAA,QACN,GAAG,KAAK;AAAA,QACR,QAAQ;AAAA,MAAA;AAAA,IAEV;AAEA,oDAA2B,OAC1B,oBACA,YACkB;AAClB,YAAM,EAAE,OAAO,2BAA2B,MAAA,IACzCA,yBAAAA,yBAAyB,kBAAkB;AAE5C,UAAI,OAAO;AAEV,cAAM,IAAI,MAAM,4BAA4B,MAAM,OAAO,KAAK,IAAI,CAAC,EAAE;AAAA,MACtE;AAEA,YAAM,iBAAiB,KAAK,iBAAiB,0BAA0B;AACvE,UAAI,UAAU,KAAK,UAAU,2BAA2B,MAAM,CAAC;AAE/D,UAAI,mCAAS,QAAQ;AACpB,kBAAU,MAAM,KAAK,OAAO,SAAS,cAAc;AAAA,MACpD;AAEA,YAAMD,cAAG,UAAU,gBAAgB,OAAO;AAAA,IAC3C;AAEA,kCAAS,OACR,QACA,UACA,YACoB;AACpB,UAAI,YAAYE,WAAAA,YAAY,MAAM;AAElC,YAAM,kBAAkB,MAAMC,oBAAS,cACtC,YAAY,KAAK,SAAS,IAAI;AAG/B,kBAAY,MAAMA,oBAAS,OAAO,WAAW;AAAA,QAC5C,GAAG;AAAA,QACH,UAAU;AAAA,QACV,IAAI,mCAAS,aAAY,CAAA;AAAA,OACzB;AAED,WAAI,mCAAS,yBAAwB,OAAO;AAC3C,oBAAY,UAAU,QAAQ,YAAY,EAAE;AAAA,MAC7C;AAEA,aAAO;AAAA,IACR;AAEA,4CAAmB,IAAI,UAA2B;AACjD,aAAOC,gBAAK,KAAK,KAAK,SAAS,MAAM,GAAG,KAAK;AAAA,IAC9C;AAjFC,SAAK,WAAW;AAAA,EACjB;AAiFA;;;"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import * as path from "node:path";
|
|
8
5
|
import * as fs from "node:fs/promises";
|
|
9
6
|
import * as prettier from "prettier";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachineHelpers.js","sources":["../../src/createSliceMachineHelpers.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\n\nimport * as prettier from \"prettier\";\nimport { stripIndent } from \"common-tags\";\n\nimport { decodeSliceMachineConfig } from \"./lib/decodeSliceMachineConfig\";\n\nimport { SliceMachineConfig, SliceMachineProject } from \"./types\";\n\ntype UpdateSliceMachineConfigOptions = {\n\tformat?: boolean;\n};\n\ntype FormatOptions = {\n\tprettier?: prettier.Options;\n\t/**\n\t * Determines if a newline is included at the end of the formatted result.\n\t *\n\t * @defaultValue `true`\n\t */\n\tincludeNewlineAtEnd?: boolean;\n};\n\n/**\n * Creates Slice Machine helpers.\n *\n * @internal\n */\nexport const createSliceMachineHelpers = (\n\tproject: SliceMachineProject,\n): SliceMachineHelpers => {\n\treturn new SliceMachineHelpers(project);\n};\n\n/**\n * Slice Machine helpers shared to plugins and hooks.\n */\nexport class SliceMachineHelpers {\n\t/**\n\t * The Slice Machine project's metadata.\n\t *\n\t * @internal\n\t */\n\tprivate _project: SliceMachineProject;\n\n\tconstructor(project: SliceMachineProject) {\n\t\tthis._project = project;\n\t}\n\n\tgetProject = async (): Promise<SliceMachineProject> => {\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\n\t\tlet rawConfig: unknown | undefined;\n\t\ttry {\n\t\t\tconst contents = await fs.readFile(configFilePath, \"utf8\");\n\t\t\trawConfig = JSON.parse(contents);\n\t\t} catch {\n\t\t\t// noop\n\t\t}\n\n\t\tif (!rawConfig) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(\"No config found.\");\n\t\t}\n\n\t\tconst { value: sliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(rawConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\treturn {\n\t\t\t...this._project,\n\t\t\tconfig: sliceMachineConfig,\n\t\t};\n\t};\n\n\tupdateSliceMachineConfig = async (\n\t\tsliceMachineConfig: SliceMachineConfig,\n\t\toptions?: UpdateSliceMachineConfigOptions,\n\t): Promise<void> => {\n\t\tconst { value: decodedSliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(sliceMachineConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config provided. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\t\tlet content = JSON.stringify(decodedSliceMachineConfig, null, 2);\n\n\t\tif (options?.format) {\n\t\t\tcontent = await this.format(content, configFilePath);\n\t\t}\n\n\t\tawait fs.writeFile(configFilePath, content);\n\t};\n\n\tformat = async (\n\t\tsource: string,\n\t\tfilePath?: string,\n\t\toptions?: FormatOptions,\n\t): Promise<string> => {\n\t\tlet formatted = stripIndent(source);\n\n\t\tconst prettierOptions = await prettier.resolveConfig(\n\t\t\tfilePath || this._project.root,\n\t\t);\n\n\t\tformatted = await prettier.format(formatted, {\n\t\t\t...prettierOptions,\n\t\t\tfilepath: filePath,\n\t\t\t...(options?.prettier ?? {}),\n\t\t});\n\n\t\tif (options?.includeNewlineAtEnd === false) {\n\t\t\tformatted = formatted.replace(/[\\r\\n]+$/, \"\");\n\t\t}\n\n\t\treturn formatted;\n\t};\n\n\tjoinPathFromRoot = (...paths: string[]): string => {\n\t\treturn path.join(this._project.root, ...paths);\n\t};\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createSliceMachineHelpers.js","sources":["../../src/createSliceMachineHelpers.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\n\nimport * as prettier from \"prettier\";\nimport { stripIndent } from \"common-tags\";\n\nimport { decodeSliceMachineConfig } from \"./lib/decodeSliceMachineConfig\";\n\nimport { SliceMachineConfig, SliceMachineProject } from \"./types\";\n\ntype UpdateSliceMachineConfigOptions = {\n\tformat?: boolean;\n};\n\ntype FormatOptions = {\n\tprettier?: prettier.Options;\n\t/**\n\t * Determines if a newline is included at the end of the formatted result.\n\t *\n\t * @defaultValue `true`\n\t */\n\tincludeNewlineAtEnd?: boolean;\n};\n\n/**\n * Creates Slice Machine helpers.\n *\n * @internal\n */\nexport const createSliceMachineHelpers = (\n\tproject: SliceMachineProject,\n): SliceMachineHelpers => {\n\treturn new SliceMachineHelpers(project);\n};\n\n/**\n * Slice Machine helpers shared to plugins and hooks.\n */\nexport class SliceMachineHelpers {\n\t/**\n\t * The Slice Machine project's metadata.\n\t *\n\t * @internal\n\t */\n\tprivate _project: SliceMachineProject;\n\n\tconstructor(project: SliceMachineProject) {\n\t\tthis._project = project;\n\t}\n\n\tgetProject = async (): Promise<SliceMachineProject> => {\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\n\t\tlet rawConfig: unknown | undefined;\n\t\ttry {\n\t\t\tconst contents = await fs.readFile(configFilePath, \"utf8\");\n\t\t\trawConfig = JSON.parse(contents);\n\t\t} catch {\n\t\t\t// noop\n\t\t}\n\n\t\tif (!rawConfig) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(\"No config found.\");\n\t\t}\n\n\t\tconst { value: sliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(rawConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\treturn {\n\t\t\t...this._project,\n\t\t\tconfig: sliceMachineConfig,\n\t\t};\n\t};\n\n\tupdateSliceMachineConfig = async (\n\t\tsliceMachineConfig: SliceMachineConfig,\n\t\toptions?: UpdateSliceMachineConfigOptions,\n\t): Promise<void> => {\n\t\tconst { value: decodedSliceMachineConfig, error } =\n\t\t\tdecodeSliceMachineConfig(sliceMachineConfig);\n\n\t\tif (error) {\n\t\t\t// TODO: Write a more friendly and useful message.\n\t\t\tthrow new Error(`Invalid config provided. ${error.errors.join(\", \")}`);\n\t\t}\n\n\t\tconst configFilePath = this.joinPathFromRoot(\"slicemachine.config.json\");\n\t\tlet content = JSON.stringify(decodedSliceMachineConfig, null, 2);\n\n\t\tif (options?.format) {\n\t\t\tcontent = await this.format(content, configFilePath);\n\t\t}\n\n\t\tawait fs.writeFile(configFilePath, content);\n\t};\n\n\tformat = async (\n\t\tsource: string,\n\t\tfilePath?: string,\n\t\toptions?: FormatOptions,\n\t): Promise<string> => {\n\t\tlet formatted = stripIndent(source);\n\n\t\tconst prettierOptions = await prettier.resolveConfig(\n\t\t\tfilePath || this._project.root,\n\t\t);\n\n\t\tformatted = await prettier.format(formatted, {\n\t\t\t...prettierOptions,\n\t\t\tfilepath: filePath,\n\t\t\t...(options?.prettier ?? {}),\n\t\t});\n\n\t\tif (options?.includeNewlineAtEnd === false) {\n\t\t\tformatted = formatted.replace(/[\\r\\n]+$/, \"\");\n\t\t}\n\n\t\treturn formatted;\n\t};\n\n\tjoinPathFromRoot = (...paths: string[]): string => {\n\t\treturn path.join(this._project.root, ...paths);\n\t};\n}\n"],"names":[],"mappings":";;;;;;;;AA6BO,MAAM,4BAA4B,CACxC,YACwB;AACxB,SAAO,IAAI,oBAAoB,OAAO;AACvC;MAKa,oBAAmB;AAAA,EAQ/B,YAAY,SAA4B;AAFhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMR,sCAAa,YAAyC;AACrD,YAAM,iBAAiB,KAAK,iBAAiB,0BAA0B;AAEvE,UAAI;AACJ,UAAI;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aAAO,KAAK,KAAK,KAAK,SAAS,MAAM,GAAG,KAAK;AAAA,IAC9C;AAjFC,SAAK,WAAW;AAAA,EACjB;AAiFA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachineHookSystem.cjs","sources":["../../src/createSliceMachineHookSystem.ts"],"sourcesContent":["import { HookSystem } from \"./lib/HookSystem\";\nimport type { SliceMachineHooks } from \"./types\";\n\n/**\n * @internal\n */\nexport const createSliceMachineHookSystem =\n\t(): HookSystem<SliceMachineHooks> => {\n\t\treturn new HookSystem<SliceMachineHooks>();\n\t};\n"],"names":["HookSystem"],"mappings":";;;AAMO,MAAM,+BACZ,MAAoC;AACnC,SAAO,IAAIA,
|
|
1
|
+
{"version":3,"file":"createSliceMachineHookSystem.cjs","sources":["../../src/createSliceMachineHookSystem.ts"],"sourcesContent":["import { HookSystem } from \"./lib/HookSystem\";\nimport type { SliceMachineHooks } from \"./types\";\n\n/**\n * @internal\n */\nexport const createSliceMachineHookSystem =\n\t(): HookSystem<SliceMachineHooks> => {\n\t\treturn new HookSystem<SliceMachineHooks>();\n\t};\n"],"names":["HookSystem"],"mappings":";;;AAMO,MAAM,+BACZ,MAAoC;AACnC,SAAO,IAAIA,WAAAA,WAAA;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachineHookSystem.js","sources":["../../src/createSliceMachineHookSystem.ts"],"sourcesContent":["import { HookSystem } from \"./lib/HookSystem\";\nimport type { SliceMachineHooks } from \"./types\";\n\n/**\n * @internal\n */\nexport const createSliceMachineHookSystem =\n\t(): HookSystem<SliceMachineHooks> => {\n\t\treturn new HookSystem<SliceMachineHooks>();\n\t};\n"],"names":[],"mappings":";AAMO,MAAM,+BACZ,MAAoC;AACnC,SAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"createSliceMachineHookSystem.js","sources":["../../src/createSliceMachineHookSystem.ts"],"sourcesContent":["import { HookSystem } from \"./lib/HookSystem\";\nimport type { SliceMachineHooks } from \"./types\";\n\n/**\n * @internal\n */\nexport const createSliceMachineHookSystem =\n\t(): HookSystem<SliceMachineHooks> => {\n\t\treturn new HookSystem<SliceMachineHooks>();\n\t};\n"],"names":[],"mappings":";AAMO,MAAM,+BACZ,MAAoC;AACnC,SAAO,IAAI,WAAA;AACZ;"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) =>
|
|
5
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
6
|
const path = require("node:path");
|
|
10
7
|
const _module = require("node:module");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachinePluginRunner.cjs","sources":["../../src/createSliceMachinePluginRunner.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport _module, { createRequire } from \"node:module\";\n\nimport { defu } from \"defu\";\n\nimport { HookSystem } from \"./lib/HookSystem\";\nimport { createSliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tLoadedSliceMachinePlugin,\n\tSliceMachinePlugin,\n} from \"./defineSliceMachinePlugin\";\nimport {\n\tSliceMachineConfigPluginRegistration,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHookTypes,\n\tSliceMachineHooks,\n\tSliceMachineProject,\n} from \"./types\";\nimport { createSliceMachineHookSystem } from \"./createSliceMachineHookSystem\";\nimport {\n\tcreateSliceMachineActions,\n\tSliceMachineActions,\n} from \"./createSliceMachineActions\";\nimport {\n\tcreateSliceMachineHelpers,\n\tSliceMachineHelpers,\n} from \"./createSliceMachineHelpers\";\n\n/**\n * @internal\n */\nexport const REQUIRED_ADAPTER_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:create\",\n\t\"slice:read\",\n\t\"slice:rename\",\n\t\"slice:delete\",\n\t\"slice:update\",\n\t\"slice:asset:update\",\n\t\"slice:asset:read\",\n\t\"slice:asset:delete\",\n\t\"slice-library:read\",\n\t\"custom-type:create\",\n\t\"custom-type:read\",\n\t\"custom-type:rename\",\n\t\"custom-type:delete\",\n\t\"custom-type:update\",\n\t\"custom-type:asset:update\",\n\t\"custom-type:asset:read\",\n\t\"custom-type:asset:delete\",\n\t\"custom-type-library:read\",\n];\n/**\n * @internal\n */\nexport const ADAPTER_ONLY_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:read\",\n\t\"slice:asset:read\",\n\t\"slice-library:read\",\n\t\"custom-type:read\",\n\t\"custom-type:asset:read\",\n\t\"custom-type-library:read\",\n\t\"project:environment:read\",\n];\n\ntype SliceMachinePluginRunnerConstructorArgs = {\n\tproject: SliceMachineProject;\n\thookSystem: HookSystem<SliceMachineHooks>;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport class SliceMachinePluginRunner {\n\tprivate _project: SliceMachineProject;\n\tprivate _hookSystem: HookSystem<SliceMachineHooks>;\n\tprivate _nativePlugins: Record<string, SliceMachinePlugin>;\n\n\t/**\n\t * Slice Machine actions provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawActions`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawActions: SliceMachineActions;\n\n\t/**\n\t * Slice Machine helpers provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawHelpers`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawHelpers: SliceMachineHelpers;\n\n\t// Methods forwarded to the plugin runner's hook system.\n\tcallHook: HookSystem<SliceMachineHooks>[\"callHook\"];\n\thooksForOwner: HookSystem<SliceMachineHooks>[\"hooksForOwner\"];\n\thooksForType: HookSystem<SliceMachineHooks>[\"hooksForType\"];\n\tcreateScope: HookSystem<SliceMachineHooks>[\"createScope\"];\n\n\tconstructor({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins = {},\n\t}: SliceMachinePluginRunnerConstructorArgs) {\n\t\tthis._project = project;\n\t\tthis._hookSystem = hookSystem;\n\t\tthis._nativePlugins = nativePlugins;\n\n\t\tthis.rawActions = createSliceMachineActions(\n\t\t\tthis._project,\n\t\t\tthis._hookSystem,\n\t\t);\n\t\tthis.rawHelpers = createSliceMachineHelpers(this._project);\n\n\t\tthis.callHook = this._hookSystem.callHook.bind(this._hookSystem);\n\t\tthis.hooksForOwner = this._hookSystem.hooksForOwner.bind(this._hookSystem);\n\t\tthis.hooksForType = this._hookSystem.hooksForType.bind(this._hookSystem);\n\t\tthis.createScope = this._hookSystem.createScope.bind(this._hookSystem);\n\t}\n\n\tprivate async _loadPlugin(\n\t\tpluginRegistration: SliceMachineConfigPluginRegistration,\n\t): Promise<LoadedSliceMachinePlugin> {\n\t\t// Sanitize registration\n\t\tconst { resolve, options = {} } =\n\t\t\ttypeof pluginRegistration === \"object\" && \"resolve\" in pluginRegistration\n\t\t\t\t? pluginRegistration\n\t\t\t\t: { resolve: pluginRegistration };\n\n\t\tlet plugin: SliceMachinePlugin | undefined = undefined;\n\n\t\tif (typeof resolve === \"string\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\ttry {\n\t\t\t\tconst noop = path.resolve(this._project.root, \"noop.js\");\n\n\t\t\t\tlet resolvedID = resolve;\n\n\t\t\t\t// Support Yarn PnP\n\t\t\t\tif (\n\t\t\t\t\tprocess.versions.pnp &&\n\t\t\t\t\t\"findPnpApi\" in _module &&\n\t\t\t\t\ttypeof _module.findPnpApi === \"function\"\n\t\t\t\t) {\n\t\t\t\t\tconst pnpApi = _module.findPnpApi(noop);\n\t\t\t\t\tif (pnpApi) {\n\t\t\t\t\t\tresolvedID = pnpApi.resolveRequest(resolve, noop);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst raw = await createRequire(noop)(resolvedID);\n\t\t\t\tplugin = raw.default || raw;\n\t\t\t} catch (error) {\n\t\t\t\t// Only log in development, but not during tests when a native plugin matches.\n\t\t\t\tif (\n\t\t\t\t\timport.meta.env.DEV &&\n\t\t\t\t\t!(import.meta.env.TEST && resolve in this._nativePlugins)\n\t\t\t\t) {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\t// If an installed plugin cannot be resolved, try loading a native plugin.\n\t\t\t\tplugin = this._nativePlugins[resolve];\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Could not resolve plugin \\`${resolve}\\`. Check that it has been installed.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tplugin = resolve;\n\t\t}\n\n\t\tif (!plugin) {\n\t\t\tthrow new Error(`Could not load plugin: \\`${resolve}\\``);\n\t\t}\n\n\t\tconst mergedOptions = defu(options, plugin.defaultOptions || {});\n\n\t\treturn {\n\t\t\t...plugin,\n\t\t\tresolve,\n\t\t\toptions: mergedOptions,\n\t\t};\n\t}\n\n\tprivate async _setupPlugin(\n\t\tplugin: LoadedSliceMachinePlugin,\n\t\tas: \"adapter\" | \"plugin\",\n\t): Promise<void> {\n\t\tconst context = createSliceMachineContext({\n\t\t\tactions: this.rawActions,\n\t\t\thelpers: this.rawHelpers,\n\t\t\tproject: this._project,\n\t\t\tplugin,\n\t\t});\n\t\tconst hookSystemScope =\n\t\t\tthis._hookSystem.createScope<SliceMachineHookExtraArgs>(\n\t\t\t\tplugin.meta.name,\n\t\t\t\t[context],\n\t\t\t);\n\n\t\t// Prevent plugins from hooking to adapter only hooks\n\t\tconst hook: typeof hookSystemScope.hook =\n\t\t\tas === \"adapter\"\n\t\t\t\t? hookSystemScope.hook\n\t\t\t\t: (type, hook, ...args) => {\n\t\t\t\t\t\tif (ADAPTER_ONLY_HOOKS.includes(type)) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn hookSystemScope.hook(type, hook, ...args);\n\t\t\t\t };\n\n\t\t// Run plugin setup with actions and context\n\t\ttry {\n\t\t\tawait plugin.setup({\n\t\t\t\t...context,\n\t\t\t\thook,\n\t\t\t\tunhook: hookSystemScope.unhook,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error.message}`,\n\t\t\t\t\t{ cause: error },\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _validateAdapter(adapter: LoadedSliceMachinePlugin): void {\n\t\tconst hooks = this._hookSystem.hooksForOwner(adapter.meta.name);\n\t\tconst hookTypes = hooks.map((hook) => hook.meta.type);\n\n\t\tconst missingHooks = REQUIRED_ADAPTER_HOOKS.filter(\n\t\t\t(requiredHookType) => !hookTypes.includes(requiredHookType),\n\t\t);\n\n\t\tif (missingHooks.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Adapter \\`${\n\t\t\t\t\tadapter.meta.name\n\t\t\t\t}\\` is missing hooks: \\`${missingHooks.join(\"`, `\")}\\``,\n\t\t\t);\n\t\t}\n\t}\n\n\tasync init(): Promise<void> {\n\t\tconst [adapter, ...plugins] = await Promise.all(\n\t\t\t[\n\t\t\t\tthis._project.config.adapter,\n\t\t\t\t...(this._project.config.plugins ?? []),\n\t\t\t].map((pluginRegistration) => this._loadPlugin(pluginRegistration)),\n\t\t);\n\n\t\tawait Promise.all([\n\t\t\tthis._setupPlugin(adapter, \"adapter\"),\n\t\t\t...plugins.map((plugin) => this._setupPlugin(plugin, \"plugin\")),\n\t\t]);\n\n\t\tthis._validateAdapter(adapter);\n\t}\n}\n\ntype CreateSliceMachinePluginRunnerArgs = {\n\tproject: SliceMachineProject;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport const createSliceMachinePluginRunner = ({\n\tproject,\n\tnativePlugins,\n}: CreateSliceMachinePluginRunnerArgs): SliceMachinePluginRunner => {\n\tconst hookSystem = createSliceMachineHookSystem();\n\n\treturn new SliceMachinePluginRunner({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins,\n\t});\n};\n"],"names":["createSliceMachineActions","createSliceMachineHelpers","path","createRequire","defu","createSliceMachineContext","hook","createSliceMachineHookSystem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,yBAAkD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;AAKM,MAAM,qBAA8C;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;MAYY,yBAAwB;AAAA,EA+BpC,YAAY,EACX,SACA,YACA,gBAAgB,MACyB;AAlClC;AACA;AACA;AAUR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AACA;AACA;AACA;AAOC,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,iBAAiB;AAEtB,SAAK,aAAaA,oDACjB,KAAK,UACL,KAAK,WAAW;AAEZ,SAAA,aAAaC,0BAAAA,0BAA0B,KAAK,QAAQ;AAEzD,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,MACC,KAAK,SAAS,OAAO;AAAA,MACrB,GAAI,KAAK,SAAS,OAAO,WAAW,CAAA;AAAA,IAAA,EACnC,IAAI,CAAC,uBAAuB,KAAK,YAAY,kBAAkB,CAAC,CAAC;AAGpE,UAAM,QAAQ,IAAI;AAAA,MACjB,KAAK,aAAa,SAAS,SAAS;AAAA,MACpC,GAAG,QAAQ,IAAI,CAAC,WAAW,KAAK,aAAa,QAAQ,QAAQ,CAAC;AAAA,IAAA,CAC9D;AAED,SAAK,iBAAiB,OAAO;AAAA,EAC9B;AACA;AAUM,MAAM,iCAAiC,CAAC,EAC9C,SACA,oBACkE;AAClE,QAAM,aAAaC,6BAAAA;AAEnB,SAAO,IAAI,yBAAyB;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACA;AACF;;;;;"}
|
|
1
|
+
{"version":3,"file":"createSliceMachinePluginRunner.cjs","sources":["../../src/createSliceMachinePluginRunner.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport _module, { createRequire } from \"node:module\";\n\nimport { defu } from \"defu\";\n\nimport { HookSystem } from \"./lib/HookSystem\";\nimport { createSliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tLoadedSliceMachinePlugin,\n\tSliceMachinePlugin,\n} from \"./defineSliceMachinePlugin\";\nimport {\n\tSliceMachineConfigPluginRegistration,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHookTypes,\n\tSliceMachineHooks,\n\tSliceMachineProject,\n} from \"./types\";\nimport { createSliceMachineHookSystem } from \"./createSliceMachineHookSystem\";\nimport {\n\tcreateSliceMachineActions,\n\tSliceMachineActions,\n} from \"./createSliceMachineActions\";\nimport {\n\tcreateSliceMachineHelpers,\n\tSliceMachineHelpers,\n} from \"./createSliceMachineHelpers\";\n\n/**\n * @internal\n */\nexport const REQUIRED_ADAPTER_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:create\",\n\t\"slice:read\",\n\t\"slice:rename\",\n\t\"slice:delete\",\n\t\"slice:update\",\n\t\"slice:asset:update\",\n\t\"slice:asset:read\",\n\t\"slice:asset:delete\",\n\t\"slice-library:read\",\n\t\"custom-type:create\",\n\t\"custom-type:read\",\n\t\"custom-type:rename\",\n\t\"custom-type:delete\",\n\t\"custom-type:update\",\n\t\"custom-type:asset:update\",\n\t\"custom-type:asset:read\",\n\t\"custom-type:asset:delete\",\n\t\"custom-type-library:read\",\n];\n/**\n * @internal\n */\nexport const ADAPTER_ONLY_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:read\",\n\t\"slice:asset:read\",\n\t\"slice-library:read\",\n\t\"custom-type:read\",\n\t\"custom-type:asset:read\",\n\t\"custom-type-library:read\",\n\t\"project:environment:read\",\n];\n\ntype SliceMachinePluginRunnerConstructorArgs = {\n\tproject: SliceMachineProject;\n\thookSystem: HookSystem<SliceMachineHooks>;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport class SliceMachinePluginRunner {\n\tprivate _project: SliceMachineProject;\n\tprivate _hookSystem: HookSystem<SliceMachineHooks>;\n\tprivate _nativePlugins: Record<string, SliceMachinePlugin>;\n\n\t/**\n\t * Slice Machine actions provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawActions`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawActions: SliceMachineActions;\n\n\t/**\n\t * Slice Machine helpers provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawHelpers`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawHelpers: SliceMachineHelpers;\n\n\t// Methods forwarded to the plugin runner's hook system.\n\tcallHook: HookSystem<SliceMachineHooks>[\"callHook\"];\n\thooksForOwner: HookSystem<SliceMachineHooks>[\"hooksForOwner\"];\n\thooksForType: HookSystem<SliceMachineHooks>[\"hooksForType\"];\n\tcreateScope: HookSystem<SliceMachineHooks>[\"createScope\"];\n\n\tconstructor({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins = {},\n\t}: SliceMachinePluginRunnerConstructorArgs) {\n\t\tthis._project = project;\n\t\tthis._hookSystem = hookSystem;\n\t\tthis._nativePlugins = nativePlugins;\n\n\t\tthis.rawActions = createSliceMachineActions(\n\t\t\tthis._project,\n\t\t\tthis._hookSystem,\n\t\t);\n\t\tthis.rawHelpers = createSliceMachineHelpers(this._project);\n\n\t\tthis.callHook = this._hookSystem.callHook.bind(this._hookSystem);\n\t\tthis.hooksForOwner = this._hookSystem.hooksForOwner.bind(this._hookSystem);\n\t\tthis.hooksForType = this._hookSystem.hooksForType.bind(this._hookSystem);\n\t\tthis.createScope = this._hookSystem.createScope.bind(this._hookSystem);\n\t}\n\n\tprivate async _loadPlugin(\n\t\tpluginRegistration: SliceMachineConfigPluginRegistration,\n\t): Promise<LoadedSliceMachinePlugin> {\n\t\t// Sanitize registration\n\t\tconst { resolve, options = {} } =\n\t\t\ttypeof pluginRegistration === \"object\" && \"resolve\" in pluginRegistration\n\t\t\t\t? pluginRegistration\n\t\t\t\t: { resolve: pluginRegistration };\n\n\t\tlet plugin: SliceMachinePlugin | undefined = undefined;\n\n\t\tif (typeof resolve === \"string\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\ttry {\n\t\t\t\tconst noop = path.resolve(this._project.root, \"noop.js\");\n\n\t\t\t\tlet resolvedID = resolve;\n\n\t\t\t\t// Support Yarn PnP\n\t\t\t\tif (\n\t\t\t\t\tprocess.versions.pnp &&\n\t\t\t\t\t\"findPnpApi\" in _module &&\n\t\t\t\t\ttypeof _module.findPnpApi === \"function\"\n\t\t\t\t) {\n\t\t\t\t\tconst pnpApi = _module.findPnpApi(noop);\n\t\t\t\t\tif (pnpApi) {\n\t\t\t\t\t\tresolvedID = pnpApi.resolveRequest(resolve, noop);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst raw = await createRequire(noop)(resolvedID);\n\t\t\t\tplugin = raw.default || raw;\n\t\t\t} catch (error) {\n\t\t\t\t// Only log in development, but not during tests when a native plugin matches.\n\t\t\t\tif (\n\t\t\t\t\timport.meta.env.DEV &&\n\t\t\t\t\t!(import.meta.env.TEST && resolve in this._nativePlugins)\n\t\t\t\t) {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\t// If an installed plugin cannot be resolved, try loading a native plugin.\n\t\t\t\tplugin = this._nativePlugins[resolve];\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Could not resolve plugin \\`${resolve}\\`. Check that it has been installed.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tplugin = resolve;\n\t\t}\n\n\t\tif (!plugin) {\n\t\t\tthrow new Error(`Could not load plugin: \\`${resolve}\\``);\n\t\t}\n\n\t\tconst mergedOptions = defu(options, plugin.defaultOptions || {});\n\n\t\treturn {\n\t\t\t...plugin,\n\t\t\tresolve,\n\t\t\toptions: mergedOptions,\n\t\t};\n\t}\n\n\tprivate async _setupPlugin(\n\t\tplugin: LoadedSliceMachinePlugin,\n\t\tas: \"adapter\" | \"plugin\",\n\t): Promise<void> {\n\t\tconst context = createSliceMachineContext({\n\t\t\tactions: this.rawActions,\n\t\t\thelpers: this.rawHelpers,\n\t\t\tproject: this._project,\n\t\t\tplugin,\n\t\t});\n\t\tconst hookSystemScope =\n\t\t\tthis._hookSystem.createScope<SliceMachineHookExtraArgs>(\n\t\t\t\tplugin.meta.name,\n\t\t\t\t[context],\n\t\t\t);\n\n\t\t// Prevent plugins from hooking to adapter only hooks\n\t\tconst hook: typeof hookSystemScope.hook =\n\t\t\tas === \"adapter\"\n\t\t\t\t? hookSystemScope.hook\n\t\t\t\t: (type, hook, ...args) => {\n\t\t\t\t\t\tif (ADAPTER_ONLY_HOOKS.includes(type)) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn hookSystemScope.hook(type, hook, ...args);\n\t\t\t\t };\n\n\t\t// Run plugin setup with actions and context\n\t\ttry {\n\t\t\tawait plugin.setup({\n\t\t\t\t...context,\n\t\t\t\thook,\n\t\t\t\tunhook: hookSystemScope.unhook,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error.message}`,\n\t\t\t\t\t{ cause: error },\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _validateAdapter(adapter: LoadedSliceMachinePlugin): void {\n\t\tconst hooks = this._hookSystem.hooksForOwner(adapter.meta.name);\n\t\tconst hookTypes = hooks.map((hook) => hook.meta.type);\n\n\t\tconst missingHooks = REQUIRED_ADAPTER_HOOKS.filter(\n\t\t\t(requiredHookType) => !hookTypes.includes(requiredHookType),\n\t\t);\n\n\t\tif (missingHooks.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Adapter \\`${\n\t\t\t\t\tadapter.meta.name\n\t\t\t\t}\\` is missing hooks: \\`${missingHooks.join(\"`, `\")}\\``,\n\t\t\t);\n\t\t}\n\t}\n\n\tasync init(): Promise<void> {\n\t\tconst [adapter, ...plugins] = await Promise.all(\n\t\t\t[\n\t\t\t\tthis._project.config.adapter,\n\t\t\t\t...(this._project.config.plugins ?? []),\n\t\t\t].map((pluginRegistration) => this._loadPlugin(pluginRegistration)),\n\t\t);\n\n\t\tawait Promise.all([\n\t\t\tthis._setupPlugin(adapter, \"adapter\"),\n\t\t\t...plugins.map((plugin) => this._setupPlugin(plugin, \"plugin\")),\n\t\t]);\n\n\t\tthis._validateAdapter(adapter);\n\t}\n}\n\ntype CreateSliceMachinePluginRunnerArgs = {\n\tproject: SliceMachineProject;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport const createSliceMachinePluginRunner = ({\n\tproject,\n\tnativePlugins,\n}: CreateSliceMachinePluginRunnerArgs): SliceMachinePluginRunner => {\n\tconst hookSystem = createSliceMachineHookSystem();\n\n\treturn new SliceMachinePluginRunner({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins,\n\t});\n};\n"],"names":["createSliceMachineActions","createSliceMachineHelpers","path","createRequire","defu","createSliceMachineContext","hook","createSliceMachineHookSystem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,yBAAkD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;AAKM,MAAM,qBAA8C;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;MAYY,yBAAwB;AAAA,EA+BpC,YAAY,EACX,SACA,YACA,gBAAgB,CAAA,KACyB;AAlClC;AACA;AACA;AAUR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AACA;AACA;AACA;AAOC,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,iBAAiB;AAEtB,SAAK,aAAaA,0BAAAA,0BACjB,KAAK,UACL,KAAK,WAAW;AAEjB,SAAK,aAAaC,oDAA0B,KAAK,QAAQ;AAEzD,SAAK,WAAW,KAAK,YAAY,SAAS,KAAK,KAAK,WAAW;AAC/D,SAAK,gBAAgB,KAAK,YAAY,cAAc,KAAK,KAAK,WAAW;AACzE,SAAK,eAAe,KAAK,YAAY,aAAa,KAAK,KAAK,WAAW;AACvE,SAAK,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UAAM,QAAQ,IAAI;AAAA,MACjB,KAAK,aAAa,SAAS,SAAS;AAAA,MACpC,GAAG,QAAQ,IAAI,CAAC,WAAW,KAAK,aAAa,QAAQ,QAAQ,CAAC;AAAA,IAAA,CAC9D;AAED,SAAK,iBAAiB,OAAO;AAAA,EAC9B;AACA;AAUM,MAAM,iCAAiC,CAAC,EAC9C,SACA,oBACkE;AAClE,QAAM,aAAaC,6BAAAA,6BAAA;AAEnB,SAAO,IAAI,yBAAyB;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACA;AACF;;;;;"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import * as path from "node:path";
|
|
8
5
|
import _module, { createRequire } from "node:module";
|
|
9
6
|
import { defu } from "defu";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSliceMachinePluginRunner.js","sources":["../../src/createSliceMachinePluginRunner.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport _module, { createRequire } from \"node:module\";\n\nimport { defu } from \"defu\";\n\nimport { HookSystem } from \"./lib/HookSystem\";\nimport { createSliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tLoadedSliceMachinePlugin,\n\tSliceMachinePlugin,\n} from \"./defineSliceMachinePlugin\";\nimport {\n\tSliceMachineConfigPluginRegistration,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHookTypes,\n\tSliceMachineHooks,\n\tSliceMachineProject,\n} from \"./types\";\nimport { createSliceMachineHookSystem } from \"./createSliceMachineHookSystem\";\nimport {\n\tcreateSliceMachineActions,\n\tSliceMachineActions,\n} from \"./createSliceMachineActions\";\nimport {\n\tcreateSliceMachineHelpers,\n\tSliceMachineHelpers,\n} from \"./createSliceMachineHelpers\";\n\n/**\n * @internal\n */\nexport const REQUIRED_ADAPTER_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:create\",\n\t\"slice:read\",\n\t\"slice:rename\",\n\t\"slice:delete\",\n\t\"slice:update\",\n\t\"slice:asset:update\",\n\t\"slice:asset:read\",\n\t\"slice:asset:delete\",\n\t\"slice-library:read\",\n\t\"custom-type:create\",\n\t\"custom-type:read\",\n\t\"custom-type:rename\",\n\t\"custom-type:delete\",\n\t\"custom-type:update\",\n\t\"custom-type:asset:update\",\n\t\"custom-type:asset:read\",\n\t\"custom-type:asset:delete\",\n\t\"custom-type-library:read\",\n];\n/**\n * @internal\n */\nexport const ADAPTER_ONLY_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:read\",\n\t\"slice:asset:read\",\n\t\"slice-library:read\",\n\t\"custom-type:read\",\n\t\"custom-type:asset:read\",\n\t\"custom-type-library:read\",\n\t\"project:environment:read\",\n];\n\ntype SliceMachinePluginRunnerConstructorArgs = {\n\tproject: SliceMachineProject;\n\thookSystem: HookSystem<SliceMachineHooks>;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport class SliceMachinePluginRunner {\n\tprivate _project: SliceMachineProject;\n\tprivate _hookSystem: HookSystem<SliceMachineHooks>;\n\tprivate _nativePlugins: Record<string, SliceMachinePlugin>;\n\n\t/**\n\t * Slice Machine actions provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawActions`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawActions: SliceMachineActions;\n\n\t/**\n\t * Slice Machine helpers provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawHelpers`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawHelpers: SliceMachineHelpers;\n\n\t// Methods forwarded to the plugin runner's hook system.\n\tcallHook: HookSystem<SliceMachineHooks>[\"callHook\"];\n\thooksForOwner: HookSystem<SliceMachineHooks>[\"hooksForOwner\"];\n\thooksForType: HookSystem<SliceMachineHooks>[\"hooksForType\"];\n\tcreateScope: HookSystem<SliceMachineHooks>[\"createScope\"];\n\n\tconstructor({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins = {},\n\t}: SliceMachinePluginRunnerConstructorArgs) {\n\t\tthis._project = project;\n\t\tthis._hookSystem = hookSystem;\n\t\tthis._nativePlugins = nativePlugins;\n\n\t\tthis.rawActions = createSliceMachineActions(\n\t\t\tthis._project,\n\t\t\tthis._hookSystem,\n\t\t);\n\t\tthis.rawHelpers = createSliceMachineHelpers(this._project);\n\n\t\tthis.callHook = this._hookSystem.callHook.bind(this._hookSystem);\n\t\tthis.hooksForOwner = this._hookSystem.hooksForOwner.bind(this._hookSystem);\n\t\tthis.hooksForType = this._hookSystem.hooksForType.bind(this._hookSystem);\n\t\tthis.createScope = this._hookSystem.createScope.bind(this._hookSystem);\n\t}\n\n\tprivate async _loadPlugin(\n\t\tpluginRegistration: SliceMachineConfigPluginRegistration,\n\t): Promise<LoadedSliceMachinePlugin> {\n\t\t// Sanitize registration\n\t\tconst { resolve, options = {} } =\n\t\t\ttypeof pluginRegistration === \"object\" && \"resolve\" in pluginRegistration\n\t\t\t\t? pluginRegistration\n\t\t\t\t: { resolve: pluginRegistration };\n\n\t\tlet plugin: SliceMachinePlugin | undefined = undefined;\n\n\t\tif (typeof resolve === \"string\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\ttry {\n\t\t\t\tconst noop = path.resolve(this._project.root, \"noop.js\");\n\n\t\t\t\tlet resolvedID = resolve;\n\n\t\t\t\t// Support Yarn PnP\n\t\t\t\tif (\n\t\t\t\t\tprocess.versions.pnp &&\n\t\t\t\t\t\"findPnpApi\" in _module &&\n\t\t\t\t\ttypeof _module.findPnpApi === \"function\"\n\t\t\t\t) {\n\t\t\t\t\tconst pnpApi = _module.findPnpApi(noop);\n\t\t\t\t\tif (pnpApi) {\n\t\t\t\t\t\tresolvedID = pnpApi.resolveRequest(resolve, noop);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst raw = await createRequire(noop)(resolvedID);\n\t\t\t\tplugin = raw.default || raw;\n\t\t\t} catch (error) {\n\t\t\t\t// Only log in development, but not during tests when a native plugin matches.\n\t\t\t\tif (\n\t\t\t\t\timport.meta.env.DEV &&\n\t\t\t\t\t!(import.meta.env.TEST && resolve in this._nativePlugins)\n\t\t\t\t) {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\t// If an installed plugin cannot be resolved, try loading a native plugin.\n\t\t\t\tplugin = this._nativePlugins[resolve];\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Could not resolve plugin \\`${resolve}\\`. Check that it has been installed.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tplugin = resolve;\n\t\t}\n\n\t\tif (!plugin) {\n\t\t\tthrow new Error(`Could not load plugin: \\`${resolve}\\``);\n\t\t}\n\n\t\tconst mergedOptions = defu(options, plugin.defaultOptions || {});\n\n\t\treturn {\n\t\t\t...plugin,\n\t\t\tresolve,\n\t\t\toptions: mergedOptions,\n\t\t};\n\t}\n\n\tprivate async _setupPlugin(\n\t\tplugin: LoadedSliceMachinePlugin,\n\t\tas: \"adapter\" | \"plugin\",\n\t): Promise<void> {\n\t\tconst context = createSliceMachineContext({\n\t\t\tactions: this.rawActions,\n\t\t\thelpers: this.rawHelpers,\n\t\t\tproject: this._project,\n\t\t\tplugin,\n\t\t});\n\t\tconst hookSystemScope =\n\t\t\tthis._hookSystem.createScope<SliceMachineHookExtraArgs>(\n\t\t\t\tplugin.meta.name,\n\t\t\t\t[context],\n\t\t\t);\n\n\t\t// Prevent plugins from hooking to adapter only hooks\n\t\tconst hook: typeof hookSystemScope.hook =\n\t\t\tas === \"adapter\"\n\t\t\t\t? hookSystemScope.hook\n\t\t\t\t: (type, hook, ...args) => {\n\t\t\t\t\t\tif (ADAPTER_ONLY_HOOKS.includes(type)) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn hookSystemScope.hook(type, hook, ...args);\n\t\t\t\t };\n\n\t\t// Run plugin setup with actions and context\n\t\ttry {\n\t\t\tawait plugin.setup({\n\t\t\t\t...context,\n\t\t\t\thook,\n\t\t\t\tunhook: hookSystemScope.unhook,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error.message}`,\n\t\t\t\t\t{ cause: error },\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _validateAdapter(adapter: LoadedSliceMachinePlugin): void {\n\t\tconst hooks = this._hookSystem.hooksForOwner(adapter.meta.name);\n\t\tconst hookTypes = hooks.map((hook) => hook.meta.type);\n\n\t\tconst missingHooks = REQUIRED_ADAPTER_HOOKS.filter(\n\t\t\t(requiredHookType) => !hookTypes.includes(requiredHookType),\n\t\t);\n\n\t\tif (missingHooks.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Adapter \\`${\n\t\t\t\t\tadapter.meta.name\n\t\t\t\t}\\` is missing hooks: \\`${missingHooks.join(\"`, `\")}\\``,\n\t\t\t);\n\t\t}\n\t}\n\n\tasync init(): Promise<void> {\n\t\tconst [adapter, ...plugins] = await Promise.all(\n\t\t\t[\n\t\t\t\tthis._project.config.adapter,\n\t\t\t\t...(this._project.config.plugins ?? []),\n\t\t\t].map((pluginRegistration) => this._loadPlugin(pluginRegistration)),\n\t\t);\n\n\t\tawait Promise.all([\n\t\t\tthis._setupPlugin(adapter, \"adapter\"),\n\t\t\t...plugins.map((plugin) => this._setupPlugin(plugin, \"plugin\")),\n\t\t]);\n\n\t\tthis._validateAdapter(adapter);\n\t}\n}\n\ntype CreateSliceMachinePluginRunnerArgs = {\n\tproject: SliceMachineProject;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport const createSliceMachinePluginRunner = ({\n\tproject,\n\tnativePlugins,\n}: CreateSliceMachinePluginRunnerArgs): SliceMachinePluginRunner => {\n\tconst hookSystem = createSliceMachineHookSystem();\n\n\treturn new SliceMachinePluginRunner({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins,\n\t});\n};\n"],"names":["hook"],"mappings":";;;;;;;;;;;;;AA+BO,MAAM,yBAAkD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;AAKM,MAAM,qBAA8C;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;MAYY,yBAAwB;AAAA,EA+BpC,YAAY,EACX,SACA,YACA,gBAAgB,MACyB;AAlClC;AACA;AACA;AAUR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AACA;AACA;AACA;AAOC,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,iBAAiB;AAEtB,SAAK,aAAa,0BACjB,KAAK,UACL,KAAK,WAAW;AAEZ,SAAA,aAAa,0BAA0B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AAK,SAAS,OAAO;AAAA,MACrB,GAAI,KAAK,SAAS,OAAO,WAAW,CAAA;AAAA,IAAA,EACnC,IAAI,CAAC,uBAAuB,KAAK,YAAY,kBAAkB,CAAC,CAAC;AAGpE,UAAM,QAAQ,IAAI;AAAA,MACjB,KAAK,aAAa,SAAS,SAAS;AAAA,MACpC,GAAG,QAAQ,IAAI,CAAC,WAAW,KAAK,aAAa,QAAQ,QAAQ,CAAC;AAAA,IAAA,CAC9D;AAED,SAAK,iBAAiB,OAAO;AAAA,EAC9B;AACA;AAUM,MAAM,iCAAiC,CAAC,EAC9C,SACA,oBACkE;AAClE,QAAM,aAAa;AAEnB,SAAO,IAAI,yBAAyB;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACA;AACF;"}
|
|
1
|
+
{"version":3,"file":"createSliceMachinePluginRunner.js","sources":["../../src/createSliceMachinePluginRunner.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport _module, { createRequire } from \"node:module\";\n\nimport { defu } from \"defu\";\n\nimport { HookSystem } from \"./lib/HookSystem\";\nimport { createSliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tLoadedSliceMachinePlugin,\n\tSliceMachinePlugin,\n} from \"./defineSliceMachinePlugin\";\nimport {\n\tSliceMachineConfigPluginRegistration,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHookTypes,\n\tSliceMachineHooks,\n\tSliceMachineProject,\n} from \"./types\";\nimport { createSliceMachineHookSystem } from \"./createSliceMachineHookSystem\";\nimport {\n\tcreateSliceMachineActions,\n\tSliceMachineActions,\n} from \"./createSliceMachineActions\";\nimport {\n\tcreateSliceMachineHelpers,\n\tSliceMachineHelpers,\n} from \"./createSliceMachineHelpers\";\n\n/**\n * @internal\n */\nexport const REQUIRED_ADAPTER_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:create\",\n\t\"slice:read\",\n\t\"slice:rename\",\n\t\"slice:delete\",\n\t\"slice:update\",\n\t\"slice:asset:update\",\n\t\"slice:asset:read\",\n\t\"slice:asset:delete\",\n\t\"slice-library:read\",\n\t\"custom-type:create\",\n\t\"custom-type:read\",\n\t\"custom-type:rename\",\n\t\"custom-type:delete\",\n\t\"custom-type:update\",\n\t\"custom-type:asset:update\",\n\t\"custom-type:asset:read\",\n\t\"custom-type:asset:delete\",\n\t\"custom-type-library:read\",\n];\n/**\n * @internal\n */\nexport const ADAPTER_ONLY_HOOKS: SliceMachineHookTypes[] = [\n\t\"slice:read\",\n\t\"slice:asset:read\",\n\t\"slice-library:read\",\n\t\"custom-type:read\",\n\t\"custom-type:asset:read\",\n\t\"custom-type-library:read\",\n\t\"project:environment:read\",\n];\n\ntype SliceMachinePluginRunnerConstructorArgs = {\n\tproject: SliceMachineProject;\n\thookSystem: HookSystem<SliceMachineHooks>;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport class SliceMachinePluginRunner {\n\tprivate _project: SliceMachineProject;\n\tprivate _hookSystem: HookSystem<SliceMachineHooks>;\n\tprivate _nativePlugins: Record<string, SliceMachinePlugin>;\n\n\t/**\n\t * Slice Machine actions provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawActions`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawActions: SliceMachineActions;\n\n\t/**\n\t * Slice Machine helpers provided to hooks.\n\t *\n\t * IMPORTANT: Prefer creating your own abstraction over using `rawHelpers`\n\t * directly to prevent code breakage if this internal API changes.\n\t *\n\t * @internal\n\t */\n\trawHelpers: SliceMachineHelpers;\n\n\t// Methods forwarded to the plugin runner's hook system.\n\tcallHook: HookSystem<SliceMachineHooks>[\"callHook\"];\n\thooksForOwner: HookSystem<SliceMachineHooks>[\"hooksForOwner\"];\n\thooksForType: HookSystem<SliceMachineHooks>[\"hooksForType\"];\n\tcreateScope: HookSystem<SliceMachineHooks>[\"createScope\"];\n\n\tconstructor({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins = {},\n\t}: SliceMachinePluginRunnerConstructorArgs) {\n\t\tthis._project = project;\n\t\tthis._hookSystem = hookSystem;\n\t\tthis._nativePlugins = nativePlugins;\n\n\t\tthis.rawActions = createSliceMachineActions(\n\t\t\tthis._project,\n\t\t\tthis._hookSystem,\n\t\t);\n\t\tthis.rawHelpers = createSliceMachineHelpers(this._project);\n\n\t\tthis.callHook = this._hookSystem.callHook.bind(this._hookSystem);\n\t\tthis.hooksForOwner = this._hookSystem.hooksForOwner.bind(this._hookSystem);\n\t\tthis.hooksForType = this._hookSystem.hooksForType.bind(this._hookSystem);\n\t\tthis.createScope = this._hookSystem.createScope.bind(this._hookSystem);\n\t}\n\n\tprivate async _loadPlugin(\n\t\tpluginRegistration: SliceMachineConfigPluginRegistration,\n\t): Promise<LoadedSliceMachinePlugin> {\n\t\t// Sanitize registration\n\t\tconst { resolve, options = {} } =\n\t\t\ttypeof pluginRegistration === \"object\" && \"resolve\" in pluginRegistration\n\t\t\t\t? pluginRegistration\n\t\t\t\t: { resolve: pluginRegistration };\n\n\t\tlet plugin: SliceMachinePlugin | undefined = undefined;\n\n\t\tif (typeof resolve === \"string\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\ttry {\n\t\t\t\tconst noop = path.resolve(this._project.root, \"noop.js\");\n\n\t\t\t\tlet resolvedID = resolve;\n\n\t\t\t\t// Support Yarn PnP\n\t\t\t\tif (\n\t\t\t\t\tprocess.versions.pnp &&\n\t\t\t\t\t\"findPnpApi\" in _module &&\n\t\t\t\t\ttypeof _module.findPnpApi === \"function\"\n\t\t\t\t) {\n\t\t\t\t\tconst pnpApi = _module.findPnpApi(noop);\n\t\t\t\t\tif (pnpApi) {\n\t\t\t\t\t\tresolvedID = pnpApi.resolveRequest(resolve, noop);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst raw = await createRequire(noop)(resolvedID);\n\t\t\t\tplugin = raw.default || raw;\n\t\t\t} catch (error) {\n\t\t\t\t// Only log in development, but not during tests when a native plugin matches.\n\t\t\t\tif (\n\t\t\t\t\timport.meta.env.DEV &&\n\t\t\t\t\t!(import.meta.env.TEST && resolve in this._nativePlugins)\n\t\t\t\t) {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\t// If an installed plugin cannot be resolved, try loading a native plugin.\n\t\t\t\tplugin = this._nativePlugins[resolve];\n\t\t\t}\n\n\t\t\tif (!plugin) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Could not resolve plugin \\`${resolve}\\`. Check that it has been installed.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tplugin = resolve;\n\t\t}\n\n\t\tif (!plugin) {\n\t\t\tthrow new Error(`Could not load plugin: \\`${resolve}\\``);\n\t\t}\n\n\t\tconst mergedOptions = defu(options, plugin.defaultOptions || {});\n\n\t\treturn {\n\t\t\t...plugin,\n\t\t\tresolve,\n\t\t\toptions: mergedOptions,\n\t\t};\n\t}\n\n\tprivate async _setupPlugin(\n\t\tplugin: LoadedSliceMachinePlugin,\n\t\tas: \"adapter\" | \"plugin\",\n\t): Promise<void> {\n\t\tconst context = createSliceMachineContext({\n\t\t\tactions: this.rawActions,\n\t\t\thelpers: this.rawHelpers,\n\t\t\tproject: this._project,\n\t\t\tplugin,\n\t\t});\n\t\tconst hookSystemScope =\n\t\t\tthis._hookSystem.createScope<SliceMachineHookExtraArgs>(\n\t\t\t\tplugin.meta.name,\n\t\t\t\t[context],\n\t\t\t);\n\n\t\t// Prevent plugins from hooking to adapter only hooks\n\t\tconst hook: typeof hookSystemScope.hook =\n\t\t\tas === \"adapter\"\n\t\t\t\t? hookSystemScope.hook\n\t\t\t\t: (type, hook, ...args) => {\n\t\t\t\t\t\tif (ADAPTER_ONLY_HOOKS.includes(type)) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn hookSystemScope.hook(type, hook, ...args);\n\t\t\t\t };\n\n\t\t// Run plugin setup with actions and context\n\t\ttry {\n\t\t\tawait plugin.setup({\n\t\t\t\t...context,\n\t\t\t\thook,\n\t\t\t\tunhook: hookSystemScope.unhook,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error.message}`,\n\t\t\t\t\t{ cause: error },\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin \\`${plugin.meta.name}\\` errored during setup: ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _validateAdapter(adapter: LoadedSliceMachinePlugin): void {\n\t\tconst hooks = this._hookSystem.hooksForOwner(adapter.meta.name);\n\t\tconst hookTypes = hooks.map((hook) => hook.meta.type);\n\n\t\tconst missingHooks = REQUIRED_ADAPTER_HOOKS.filter(\n\t\t\t(requiredHookType) => !hookTypes.includes(requiredHookType),\n\t\t);\n\n\t\tif (missingHooks.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Adapter \\`${\n\t\t\t\t\tadapter.meta.name\n\t\t\t\t}\\` is missing hooks: \\`${missingHooks.join(\"`, `\")}\\``,\n\t\t\t);\n\t\t}\n\t}\n\n\tasync init(): Promise<void> {\n\t\tconst [adapter, ...plugins] = await Promise.all(\n\t\t\t[\n\t\t\t\tthis._project.config.adapter,\n\t\t\t\t...(this._project.config.plugins ?? []),\n\t\t\t].map((pluginRegistration) => this._loadPlugin(pluginRegistration)),\n\t\t);\n\n\t\tawait Promise.all([\n\t\t\tthis._setupPlugin(adapter, \"adapter\"),\n\t\t\t...plugins.map((plugin) => this._setupPlugin(plugin, \"plugin\")),\n\t\t]);\n\n\t\tthis._validateAdapter(adapter);\n\t}\n}\n\ntype CreateSliceMachinePluginRunnerArgs = {\n\tproject: SliceMachineProject;\n\tnativePlugins?: Record<string, SliceMachinePlugin>;\n};\n\n/**\n * @internal\n */\nexport const createSliceMachinePluginRunner = ({\n\tproject,\n\tnativePlugins,\n}: CreateSliceMachinePluginRunnerArgs): SliceMachinePluginRunner => {\n\tconst hookSystem = createSliceMachineHookSystem();\n\n\treturn new SliceMachinePluginRunner({\n\t\tproject,\n\t\thookSystem,\n\t\tnativePlugins,\n\t});\n};\n"],"names":["hook"],"mappings":";;;;;;;;;;AA+BO,MAAM,yBAAkD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;AAKM,MAAM,qBAA8C;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;MAYY,yBAAwB;AAAA,EA+BpC,YAAY,EACX,SACA,YACA,gBAAgB,CAAA,KACyB;AAlClC;AACA;AACA;AAUR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AACA;AACA;AACA;AAOC,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,iBAAiB;AAEtB,SAAK,aAAa,0BACjB,KAAK,UACL,KAAK,WAAW;AAEjB,SAAK,aAAa,0BAA0B,KAAK,QAAQ;AAEzD,SAAK,WAAW,KAAK,YAAY,SAAS,KAAK,KAAK,WAAW;AAC/D,SAAK,gBAAgB,KAAK,YAAY,cAAc,KAAK,KAAK,WAAW;AACzE,SAAK,eAAe,KAAK,YAAY,aAAa,KAAK,KAAK,WAAW;AACvE,SAAK,cAAc,KAAK,YAAY,YAAY,KAAK,KAAK,WAAW;AAAA,EACtE;AAAA,EAEQ,MAAM,YACb,oBAAwD;AAGxD,UAAM,EAAE,SAAS,UAAU,CAAA,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ED,SAAK,iBAAiB,OAAO;AAAA,EAC9B;AACA;AAUM,MAAM,iCAAiC,CAAC,EAC9C,SACA,oBACkE;AAClE,QAAM,aAAa,6BAAA;AAEnB,SAAO,IAAI,yBAAyB;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACA;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSliceMachinePlugin.cjs","sources":["../../src/defineSliceMachinePlugin.ts"],"sourcesContent":["import { CreateScopeReturnType } from \"./lib/HookSystem\";\nimport { SliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tSliceMachinePluginOptions,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHooks,\n} from \"./types\";\n\n/**\n * Slice Machine plugin definition.\n */\nexport type SliceMachinePlugin<\n\tTPluginOptions extends Record<string, unknown> = Record<string, unknown>,\n> = {\n\t/**\n\t * Information about the plugin.\n\t */\n\tmeta: {\n\t\tname: string;\n\t};\n\n\t/**\n\t * Default options.\n\t */\n\tdefaultOptions?: TPluginOptions;\n\n\t/**\n\t * Plugin setup.\n\t */\n\tsetup: (\n\t\tcontext: Omit<SliceMachineContext<TPluginOptions>, \"actions\"> &\n\t\t\tPick<\n\t\t\t\tCreateScopeReturnType<\n\t\t\t\t\tSliceMachineHooks,\n\t\t\t\t\tSliceMachineHookExtraArgs<TPluginOptions>\n\t\t\t\t>,\n\t\t\t\t\"hook\" | \"unhook\"\n\t\t\t>,\n\t) => void | Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type LoadedSliceMachinePlugin<\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n> = SliceMachinePlugin<TPluginOptions> & {\n\tresolve: string | SliceMachinePlugin;\n\toptions: TPluginOptions;\n};\n\nexport const defineSliceMachinePlugin = <\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n>(\n\tplugin: SliceMachinePlugin<TPluginOptions>,\n): SliceMachinePlugin<TPluginOptions> => plugin;\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"defineSliceMachinePlugin.cjs","sources":["../../src/defineSliceMachinePlugin.ts"],"sourcesContent":["import { CreateScopeReturnType } from \"./lib/HookSystem\";\nimport { SliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tSliceMachinePluginOptions,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHooks,\n} from \"./types\";\n\n/**\n * Slice Machine plugin definition.\n */\nexport type SliceMachinePlugin<\n\tTPluginOptions extends Record<string, unknown> = Record<string, unknown>,\n> = {\n\t/**\n\t * Information about the plugin.\n\t */\n\tmeta: {\n\t\tname: string;\n\t};\n\n\t/**\n\t * Default options.\n\t */\n\tdefaultOptions?: TPluginOptions;\n\n\t/**\n\t * Plugin setup.\n\t */\n\tsetup: (\n\t\tcontext: Omit<SliceMachineContext<TPluginOptions>, \"actions\"> &\n\t\t\tPick<\n\t\t\t\tCreateScopeReturnType<\n\t\t\t\t\tSliceMachineHooks,\n\t\t\t\t\tSliceMachineHookExtraArgs<TPluginOptions>\n\t\t\t\t>,\n\t\t\t\t\"hook\" | \"unhook\"\n\t\t\t>,\n\t) => void | Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type LoadedSliceMachinePlugin<\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n> = SliceMachinePlugin<TPluginOptions> & {\n\tresolve: string | SliceMachinePlugin;\n\toptions: TPluginOptions;\n};\n\nexport const defineSliceMachinePlugin = <\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n>(\n\tplugin: SliceMachinePlugin<TPluginOptions>,\n): SliceMachinePlugin<TPluginOptions> => plugin;\n"],"names":[],"mappings":";;AAmDO,MAAM,2BAA2B,CAGvC,WACwC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSliceMachinePlugin.js","sources":["../../src/defineSliceMachinePlugin.ts"],"sourcesContent":["import { CreateScopeReturnType } from \"./lib/HookSystem\";\nimport { SliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tSliceMachinePluginOptions,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHooks,\n} from \"./types\";\n\n/**\n * Slice Machine plugin definition.\n */\nexport type SliceMachinePlugin<\n\tTPluginOptions extends Record<string, unknown> = Record<string, unknown>,\n> = {\n\t/**\n\t * Information about the plugin.\n\t */\n\tmeta: {\n\t\tname: string;\n\t};\n\n\t/**\n\t * Default options.\n\t */\n\tdefaultOptions?: TPluginOptions;\n\n\t/**\n\t * Plugin setup.\n\t */\n\tsetup: (\n\t\tcontext: Omit<SliceMachineContext<TPluginOptions>, \"actions\"> &\n\t\t\tPick<\n\t\t\t\tCreateScopeReturnType<\n\t\t\t\t\tSliceMachineHooks,\n\t\t\t\t\tSliceMachineHookExtraArgs<TPluginOptions>\n\t\t\t\t>,\n\t\t\t\t\"hook\" | \"unhook\"\n\t\t\t>,\n\t) => void | Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type LoadedSliceMachinePlugin<\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n> = SliceMachinePlugin<TPluginOptions> & {\n\tresolve: string | SliceMachinePlugin;\n\toptions: TPluginOptions;\n};\n\nexport const defineSliceMachinePlugin = <\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n>(\n\tplugin: SliceMachinePlugin<TPluginOptions>,\n): SliceMachinePlugin<TPluginOptions> => plugin;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defineSliceMachinePlugin.js","sources":["../../src/defineSliceMachinePlugin.ts"],"sourcesContent":["import { CreateScopeReturnType } from \"./lib/HookSystem\";\nimport { SliceMachineContext } from \"./createSliceMachineContext\";\nimport {\n\tSliceMachinePluginOptions,\n\tSliceMachineHookExtraArgs,\n\tSliceMachineHooks,\n} from \"./types\";\n\n/**\n * Slice Machine plugin definition.\n */\nexport type SliceMachinePlugin<\n\tTPluginOptions extends Record<string, unknown> = Record<string, unknown>,\n> = {\n\t/**\n\t * Information about the plugin.\n\t */\n\tmeta: {\n\t\tname: string;\n\t};\n\n\t/**\n\t * Default options.\n\t */\n\tdefaultOptions?: TPluginOptions;\n\n\t/**\n\t * Plugin setup.\n\t */\n\tsetup: (\n\t\tcontext: Omit<SliceMachineContext<TPluginOptions>, \"actions\"> &\n\t\t\tPick<\n\t\t\t\tCreateScopeReturnType<\n\t\t\t\t\tSliceMachineHooks,\n\t\t\t\t\tSliceMachineHookExtraArgs<TPluginOptions>\n\t\t\t\t>,\n\t\t\t\t\"hook\" | \"unhook\"\n\t\t\t>,\n\t) => void | Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type LoadedSliceMachinePlugin<\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n> = SliceMachinePlugin<TPluginOptions> & {\n\tresolve: string | SliceMachinePlugin;\n\toptions: TPluginOptions;\n};\n\nexport const defineSliceMachinePlugin = <\n\tTPluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions,\n>(\n\tplugin: SliceMachinePlugin<TPluginOptions>,\n): SliceMachinePlugin<TPluginOptions> => plugin;\n"],"names":[],"mappings":"AAmDO,MAAM,2BAA2B,CAGvC,WACwC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCustomTypeDirectoryPath.cjs","sources":["../../../src/fs/buildCustomTypeDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\n\nexport type BuildCustomTypeDirectoryPathArgs = {\n\tcustomTypeID: string;\n} & BuildCustomTypeLibraryDirectoryPathArgs;\n\nexport const buildCustomTypeDirectoryPath = (\n\targs: BuildCustomTypeDirectoryPathArgs,\n): string => {\n\treturn path.join(\n\t\tbuildCustomTypeLibraryDirectoryPath(args),\n\t\targs.customTypeID,\n\t);\n};\n"],"names":["path","buildCustomTypeLibraryDirectoryPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"buildCustomTypeDirectoryPath.cjs","sources":["../../../src/fs/buildCustomTypeDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\n\nexport type BuildCustomTypeDirectoryPathArgs = {\n\tcustomTypeID: string;\n} & BuildCustomTypeLibraryDirectoryPathArgs;\n\nexport const buildCustomTypeDirectoryPath = (\n\targs: BuildCustomTypeDirectoryPathArgs,\n): string => {\n\treturn path.join(\n\t\tbuildCustomTypeLibraryDirectoryPath(args),\n\t\targs.customTypeID,\n\t);\n};\n"],"names":["path","buildCustomTypeLibraryDirectoryPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,+BAA+B,CAC3C,SACW;AACX,SAAOA,gBAAK,KACXC,oCAAAA,oCAAoC,IAAI,GACxC,KAAK,YAAY;AAEnB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCustomTypeDirectoryPath.js","sources":["../../../src/fs/buildCustomTypeDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\n\nexport type BuildCustomTypeDirectoryPathArgs = {\n\tcustomTypeID: string;\n} & BuildCustomTypeLibraryDirectoryPathArgs;\n\nexport const buildCustomTypeDirectoryPath = (\n\targs: BuildCustomTypeDirectoryPathArgs,\n): string => {\n\treturn path.join(\n\t\tbuildCustomTypeLibraryDirectoryPath(args),\n\t\targs.customTypeID,\n\t);\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildCustomTypeDirectoryPath.js","sources":["../../../src/fs/buildCustomTypeDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeLibraryDirectoryPath,\n\tBuildCustomTypeLibraryDirectoryPathArgs,\n} from \"./buildCustomTypeLibraryDirectoryPath\";\n\nexport type BuildCustomTypeDirectoryPathArgs = {\n\tcustomTypeID: string;\n} & BuildCustomTypeLibraryDirectoryPathArgs;\n\nexport const buildCustomTypeDirectoryPath = (\n\targs: BuildCustomTypeDirectoryPathArgs,\n): string => {\n\treturn path.join(\n\t\tbuildCustomTypeLibraryDirectoryPath(args),\n\t\targs.customTypeID,\n\t);\n};\n"],"names":[],"mappings":";;AAWO,MAAM,+BAA+B,CAC3C,SACW;AACX,SAAO,KAAK,KACX,oCAAoC,IAAI,GACxC,KAAK,YAAY;AAEnB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCustomTypeFilePath.cjs","sources":["../../../src/fs/buildCustomTypeFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\n\nexport type BuildCustomTypeFilePathArgs = {\n\tfilename: string;\n} & BuildCustomTypeDirectoryPathArgs;\n\nexport const buildCustomTypeFilePath = (\n\targs: BuildCustomTypeFilePathArgs,\n): string => {\n\treturn path.join(buildCustomTypeDirectoryPath(args), args.filename);\n};\n"],"names":["path","buildCustomTypeDirectoryPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"buildCustomTypeFilePath.cjs","sources":["../../../src/fs/buildCustomTypeFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\n\nexport type BuildCustomTypeFilePathArgs = {\n\tfilename: string;\n} & BuildCustomTypeDirectoryPathArgs;\n\nexport const buildCustomTypeFilePath = (\n\targs: BuildCustomTypeFilePathArgs,\n): string => {\n\treturn path.join(buildCustomTypeDirectoryPath(args), args.filename);\n};\n"],"names":["path","buildCustomTypeDirectoryPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,0BAA0B,CACtC,SACW;AACX,SAAOA,gBAAK,KAAKC,6BAAAA,6BAA6B,IAAI,GAAG,KAAK,QAAQ;AACnE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCustomTypeFilePath.js","sources":["../../../src/fs/buildCustomTypeFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\n\nexport type BuildCustomTypeFilePathArgs = {\n\tfilename: string;\n} & BuildCustomTypeDirectoryPathArgs;\n\nexport const buildCustomTypeFilePath = (\n\targs: BuildCustomTypeFilePathArgs,\n): string => {\n\treturn path.join(buildCustomTypeDirectoryPath(args), args.filename);\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildCustomTypeFilePath.js","sources":["../../../src/fs/buildCustomTypeFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\n\nexport type BuildCustomTypeFilePathArgs = {\n\tfilename: string;\n} & BuildCustomTypeDirectoryPathArgs;\n\nexport const buildCustomTypeFilePath = (\n\targs: BuildCustomTypeFilePathArgs,\n): string => {\n\treturn path.join(buildCustomTypeDirectoryPath(args), args.filename);\n};\n"],"names":[],"mappings":";;AAWO,MAAM,0BAA0B,CACtC,SACW;AACX,SAAO,KAAK,KAAK,6BAA6B,IAAI,GAAG,KAAK,QAAQ;AACnE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCustomTypeLibraryDirectoryPath.cjs","sources":["../../../src/fs/buildCustomTypeLibraryDirectoryPath.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { CUSTOM_TYPES_LIBRARY_DIRNAME } from \"./constants\";\n\nexport type BuildCustomTypeLibraryDirectoryPathArgs = {\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildCustomTypeLibraryDirectoryPath = (\n\targs: BuildCustomTypeLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(CUSTOM_TYPES_LIBRARY_DIRNAME)\n\t\t: CUSTOM_TYPES_LIBRARY_DIRNAME;\n};\n"],"names":["CUSTOM_TYPES_LIBRARY_DIRNAME"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"buildCustomTypeLibraryDirectoryPath.cjs","sources":["../../../src/fs/buildCustomTypeLibraryDirectoryPath.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { CUSTOM_TYPES_LIBRARY_DIRNAME } from \"./constants\";\n\nexport type BuildCustomTypeLibraryDirectoryPathArgs = {\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildCustomTypeLibraryDirectoryPath = (\n\targs: BuildCustomTypeLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(CUSTOM_TYPES_LIBRARY_DIRNAME)\n\t\t: CUSTOM_TYPES_LIBRARY_DIRNAME;\n};\n"],"names":["CUSTOM_TYPES_LIBRARY_DIRNAME"],"mappings":";;;AASO,MAAM,sCAAsC,CAClD,SACW;AACX,SAAO,KAAK,WACT,KAAK,QAAQ,iBAAiBA,UAAAA,4BAA4B,IAC1DA,UAAAA;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCustomTypeLibraryDirectoryPath.js","sources":["../../../src/fs/buildCustomTypeLibraryDirectoryPath.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { CUSTOM_TYPES_LIBRARY_DIRNAME } from \"./constants\";\n\nexport type BuildCustomTypeLibraryDirectoryPathArgs = {\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildCustomTypeLibraryDirectoryPath = (\n\targs: BuildCustomTypeLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(CUSTOM_TYPES_LIBRARY_DIRNAME)\n\t\t: CUSTOM_TYPES_LIBRARY_DIRNAME;\n};\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"buildCustomTypeLibraryDirectoryPath.js","sources":["../../../src/fs/buildCustomTypeLibraryDirectoryPath.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport { CUSTOM_TYPES_LIBRARY_DIRNAME } from \"./constants\";\n\nexport type BuildCustomTypeLibraryDirectoryPathArgs = {\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildCustomTypeLibraryDirectoryPath = (\n\targs: BuildCustomTypeLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(CUSTOM_TYPES_LIBRARY_DIRNAME)\n\t\t: CUSTOM_TYPES_LIBRARY_DIRNAME;\n};\n"],"names":[],"mappings":";AASO,MAAM,sCAAsC,CAClD,SACW;AACX,SAAO,KAAK,WACT,KAAK,QAAQ,iBAAiB,4BAA4B,IAC1D;AACJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceDirectoryPath.cjs","sources":["../../../src/fs/buildSliceDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { pascalCase } from \"./lib/pascalCase\";\nimport {\n\tresolveSliceModel,\n\tResolveSliceModelArgs,\n} from \"./lib/resolveSliceModel\";\n\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\n\nexport type BuildSliceDirectoryPathArgs = BuildSliceLibraryDirectoryPathArgs &\n\tResolveSliceModelArgs;\n\nexport const buildSliceDirectoryPath = async (\n\targs: BuildSliceDirectoryPathArgs,\n): Promise<string> => {\n\tconst model = await resolveSliceModel(args);\n\n\treturn path.join(\n\t\tbuildSliceLibraryDirectoryPath(args),\n\t\tpascalCase(model.name),\n\t);\n};\n"],"names":["resolveSliceModel","path","buildSliceLibraryDirectoryPath","pascalCase"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"buildSliceDirectoryPath.cjs","sources":["../../../src/fs/buildSliceDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { pascalCase } from \"./lib/pascalCase\";\nimport {\n\tresolveSliceModel,\n\tResolveSliceModelArgs,\n} from \"./lib/resolveSliceModel\";\n\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\n\nexport type BuildSliceDirectoryPathArgs = BuildSliceLibraryDirectoryPathArgs &\n\tResolveSliceModelArgs;\n\nexport const buildSliceDirectoryPath = async (\n\targs: BuildSliceDirectoryPathArgs,\n): Promise<string> => {\n\tconst model = await resolveSliceModel(args);\n\n\treturn path.join(\n\t\tbuildSliceLibraryDirectoryPath(args),\n\t\tpascalCase(model.name),\n\t);\n};\n"],"names":["resolveSliceModel","path","buildSliceLibraryDirectoryPath","pascalCase"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAM,0BAA0B,OACtC,SACoB;AACpB,QAAM,QAAQ,MAAMA,kBAAAA,kBAAkB,IAAI;AAE1C,SAAOC,gBAAK,KACXC,8DAA+B,IAAI,GACnCC,sBAAW,MAAM,IAAI,CAAC;AAExB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceDirectoryPath.js","sources":["../../../src/fs/buildSliceDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { pascalCase } from \"./lib/pascalCase\";\nimport {\n\tresolveSliceModel,\n\tResolveSliceModelArgs,\n} from \"./lib/resolveSliceModel\";\n\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\n\nexport type BuildSliceDirectoryPathArgs = BuildSliceLibraryDirectoryPathArgs &\n\tResolveSliceModelArgs;\n\nexport const buildSliceDirectoryPath = async (\n\targs: BuildSliceDirectoryPathArgs,\n): Promise<string> => {\n\tconst model = await resolveSliceModel(args);\n\n\treturn path.join(\n\t\tbuildSliceLibraryDirectoryPath(args),\n\t\tpascalCase(model.name),\n\t);\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"buildSliceDirectoryPath.js","sources":["../../../src/fs/buildSliceDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { pascalCase } from \"./lib/pascalCase\";\nimport {\n\tresolveSliceModel,\n\tResolveSliceModelArgs,\n} from \"./lib/resolveSliceModel\";\n\nimport {\n\tbuildSliceLibraryDirectoryPath,\n\tBuildSliceLibraryDirectoryPathArgs,\n} from \"./buildSliceLibraryDirectoryPath\";\n\nexport type BuildSliceDirectoryPathArgs = BuildSliceLibraryDirectoryPathArgs &\n\tResolveSliceModelArgs;\n\nexport const buildSliceDirectoryPath = async (\n\targs: BuildSliceDirectoryPathArgs,\n): Promise<string> => {\n\tconst model = await resolveSliceModel(args);\n\n\treturn path.join(\n\t\tbuildSliceLibraryDirectoryPath(args),\n\t\tpascalCase(model.name),\n\t);\n};\n"],"names":[],"mappings":";;;;AAgBO,MAAM,0BAA0B,OACtC,SACoB;AACpB,QAAM,QAAQ,MAAM,kBAAkB,IAAI;AAE1C,SAAO,KAAK,KACX,+BAA+B,IAAI,GACnC,WAAW,MAAM,IAAI,CAAC;AAExB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceFilePath.cjs","sources":["../../../src/fs/buildSliceFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\n\nexport type BuildSliceFilePathArgs = {\n\tfilename: string;\n} & BuildSliceDirectoryPathArgs;\n\nexport const buildSliceFilePath = async (\n\targs: BuildSliceFilePathArgs,\n): Promise<string> => {\n\treturn path.join(await buildSliceDirectoryPath(args), args.filename);\n};\n"],"names":["path","buildSliceDirectoryPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"buildSliceFilePath.cjs","sources":["../../../src/fs/buildSliceFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\n\nexport type BuildSliceFilePathArgs = {\n\tfilename: string;\n} & BuildSliceDirectoryPathArgs;\n\nexport const buildSliceFilePath = async (\n\targs: BuildSliceFilePathArgs,\n): Promise<string> => {\n\treturn path.join(await buildSliceDirectoryPath(args), args.filename);\n};\n"],"names":["path","buildSliceDirectoryPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,qBAAqB,OACjC,SACoB;AACpB,SAAOA,gBAAK,KAAK,MAAMC,wBAAAA,wBAAwB,IAAI,GAAG,KAAK,QAAQ;AACpE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceFilePath.js","sources":["../../../src/fs/buildSliceFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\n\nexport type BuildSliceFilePathArgs = {\n\tfilename: string;\n} & BuildSliceDirectoryPathArgs;\n\nexport const buildSliceFilePath = async (\n\targs: BuildSliceFilePathArgs,\n): Promise<string> => {\n\treturn path.join(await buildSliceDirectoryPath(args), args.filename);\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildSliceFilePath.js","sources":["../../../src/fs/buildSliceFilePath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\n\nexport type BuildSliceFilePathArgs = {\n\tfilename: string;\n} & BuildSliceDirectoryPathArgs;\n\nexport const buildSliceFilePath = async (\n\targs: BuildSliceFilePathArgs,\n): Promise<string> => {\n\treturn path.join(await buildSliceDirectoryPath(args), args.filename);\n};\n"],"names":[],"mappings":";;AAWO,MAAM,qBAAqB,OACjC,SACoB;AACpB,SAAO,KAAK,KAAK,MAAM,wBAAwB,IAAI,GAAG,KAAK,QAAQ;AACpE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceLibraryDirectoryPath.cjs","sources":["../../../src/fs/buildSliceLibraryDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type BuildSliceLibraryDirectoryPathArgs = {\n\tlibraryID: string;\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildSliceLibraryDirectoryPath = (\n\targs: BuildSliceLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(args.libraryID)\n\t\t: path.join(args.libraryID);\n};\n"],"names":["path"],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"buildSliceLibraryDirectoryPath.cjs","sources":["../../../src/fs/buildSliceLibraryDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type BuildSliceLibraryDirectoryPathArgs = {\n\tlibraryID: string;\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildSliceLibraryDirectoryPath = (\n\targs: BuildSliceLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(args.libraryID)\n\t\t: path.join(args.libraryID);\n};\n"],"names":["path"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUO,MAAM,iCAAiC,CAC7C,SACW;AACX,SAAO,KAAK,WACT,KAAK,QAAQ,iBAAiB,KAAK,SAAS,IAC5CA,gBAAK,KAAK,KAAK,SAAS;AAC5B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceLibraryDirectoryPath.js","sources":["../../../src/fs/buildSliceLibraryDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type BuildSliceLibraryDirectoryPathArgs = {\n\tlibraryID: string;\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildSliceLibraryDirectoryPath = (\n\targs: BuildSliceLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(args.libraryID)\n\t\t: path.join(args.libraryID);\n};\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"buildSliceLibraryDirectoryPath.js","sources":["../../../src/fs/buildSliceLibraryDirectoryPath.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type BuildSliceLibraryDirectoryPathArgs = {\n\tlibraryID: string;\n\tabsolute?: boolean;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const buildSliceLibraryDirectoryPath = (\n\targs: BuildSliceLibraryDirectoryPathArgs,\n): string => {\n\treturn args.absolute\n\t\t? args.helpers.joinPathFromRoot(args.libraryID)\n\t\t: path.join(args.libraryID);\n};\n"],"names":[],"mappings":";AAUO,MAAM,iCAAiC,CAC7C,SACW;AACX,SAAO,KAAK,WACT,KAAK,QAAQ,iBAAiB,KAAK,SAAS,IAC5C,KAAK,KAAK,KAAK,SAAS;AAC5B;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkHasProjectFile.cjs","sources":["../../../src/fs/checkHasProjectFile.ts"],"sourcesContent":["import { checkPathExists } from \"./lib/checkPathExists\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type CheckHasProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const checkHasProjectFile = async (\n\targs: CheckHasProjectFileArgs,\n): Promise<boolean> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\treturn checkPathExists(filePath);\n};\n"],"names":["checkPathExists"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"checkHasProjectFile.cjs","sources":["../../../src/fs/checkHasProjectFile.ts"],"sourcesContent":["import { checkPathExists } from \"./lib/checkPathExists\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type CheckHasProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const checkHasProjectFile = async (\n\targs: CheckHasProjectFileArgs,\n): Promise<boolean> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\treturn checkPathExists(filePath);\n};\n"],"names":["checkPathExists"],"mappings":";;;AASO,MAAM,sBAAsB,OAClC,SACqB;AACrB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,SAAOA,gBAAAA,gBAAgB,QAAQ;AAChC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkHasProjectFile.js","sources":["../../../src/fs/checkHasProjectFile.ts"],"sourcesContent":["import { checkPathExists } from \"./lib/checkPathExists\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type CheckHasProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const checkHasProjectFile = async (\n\targs: CheckHasProjectFileArgs,\n): Promise<boolean> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\treturn checkPathExists(filePath);\n};\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"checkHasProjectFile.js","sources":["../../../src/fs/checkHasProjectFile.ts"],"sourcesContent":["import { checkPathExists } from \"./lib/checkPathExists\";\n\nimport { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nexport type CheckHasProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const checkHasProjectFile = async (\n\targs: CheckHasProjectFileArgs,\n): Promise<boolean> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\treturn checkPathExists(filePath);\n};\n"],"names":[],"mappings":";AASO,MAAM,sBAAsB,OAClC,SACqB;AACrB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,SAAO,gBAAgB,QAAQ;AAChC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkIsTypeScriptProject.cjs","sources":["../../../src/fs/checkIsTypeScriptProject.ts"],"sourcesContent":["import { TSCONFIG_FILENAME } from \"./constants\";\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\ntype CheckIsTypeScriptProjectArgs = Omit<CheckHasProjectFileArgs, \"filename\">;\n\nexport const checkIsTypeScriptProject = async (\n\targs: CheckIsTypeScriptProjectArgs,\n): Promise<boolean> => {\n\treturn checkHasProjectFile({\n\t\t...args,\n\t\tfilename: TSCONFIG_FILENAME,\n\t});\n};\n"],"names":["checkHasProjectFile","TSCONFIG_FILENAME"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"checkIsTypeScriptProject.cjs","sources":["../../../src/fs/checkIsTypeScriptProject.ts"],"sourcesContent":["import { TSCONFIG_FILENAME } from \"./constants\";\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\ntype CheckIsTypeScriptProjectArgs = Omit<CheckHasProjectFileArgs, \"filename\">;\n\nexport const checkIsTypeScriptProject = async (\n\targs: CheckIsTypeScriptProjectArgs,\n): Promise<boolean> => {\n\treturn checkHasProjectFile({\n\t\t...args,\n\t\tfilename: TSCONFIG_FILENAME,\n\t});\n};\n"],"names":["checkHasProjectFile","TSCONFIG_FILENAME"],"mappings":";;;;AAQO,MAAM,2BAA2B,OACvC,SACqB;AACrB,SAAOA,wCAAoB;AAAA,IAC1B,GAAG;AAAA,IACH,UAAUC,UAAAA;AAAAA,EAAA,CACV;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkIsTypeScriptProject.js","sources":["../../../src/fs/checkIsTypeScriptProject.ts"],"sourcesContent":["import { TSCONFIG_FILENAME } from \"./constants\";\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\ntype CheckIsTypeScriptProjectArgs = Omit<CheckHasProjectFileArgs, \"filename\">;\n\nexport const checkIsTypeScriptProject = async (\n\targs: CheckIsTypeScriptProjectArgs,\n): Promise<boolean> => {\n\treturn checkHasProjectFile({\n\t\t...args,\n\t\tfilename: TSCONFIG_FILENAME,\n\t});\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"checkIsTypeScriptProject.js","sources":["../../../src/fs/checkIsTypeScriptProject.ts"],"sourcesContent":["import { TSCONFIG_FILENAME } from \"./constants\";\nimport {\n\tcheckHasProjectFile,\n\tCheckHasProjectFileArgs,\n} from \"./checkHasProjectFile\";\n\ntype CheckIsTypeScriptProjectArgs = Omit<CheckHasProjectFileArgs, \"filename\">;\n\nexport const checkIsTypeScriptProject = async (\n\targs: CheckIsTypeScriptProjectArgs,\n): Promise<boolean> => {\n\treturn checkHasProjectFile({\n\t\t...args,\n\t\tfilename: TSCONFIG_FILENAME,\n\t});\n};\n"],"names":[],"mappings":";;AAQO,MAAM,2BAA2B,OACvC,SACqB;AACrB,SAAO,oBAAoB;AAAA,IAC1B,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteCustomTypeDirectory.cjs","sources":["../../../src/fs/deleteCustomTypeDirectory.ts"],"sourcesContent":["import {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeDirectoryArgs = BuildCustomTypeDirectoryPathArgs;\n\nexport const deleteCustomTypeDirectory = async (\n\targs: DeleteCustomTypeDirectoryArgs,\n): Promise<string> => {\n\tconst dir = buildCustomTypeDirectoryPath(args);\n\tconst relativeDir = buildCustomTypeDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":["buildCustomTypeDirectoryPath","deleteProjectFile"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"deleteCustomTypeDirectory.cjs","sources":["../../../src/fs/deleteCustomTypeDirectory.ts"],"sourcesContent":["import {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeDirectoryArgs = BuildCustomTypeDirectoryPathArgs;\n\nexport const deleteCustomTypeDirectory = async (\n\targs: DeleteCustomTypeDirectoryArgs,\n): Promise<string> => {\n\tconst dir = buildCustomTypeDirectoryPath(args);\n\tconst relativeDir = buildCustomTypeDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":["buildCustomTypeDirectoryPath","deleteProjectFile"],"mappings":";;;;AAQO,MAAM,4BAA4B,OACxC,SACoB;AACpB,QAAM,MAAMA,6BAAAA,6BAA6B,IAAI;AAC7C,QAAM,cAAcA,6BAAAA,6BAA6B;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,oCAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteCustomTypeDirectory.js","sources":["../../../src/fs/deleteCustomTypeDirectory.ts"],"sourcesContent":["import {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeDirectoryArgs = BuildCustomTypeDirectoryPathArgs;\n\nexport const deleteCustomTypeDirectory = async (\n\targs: DeleteCustomTypeDirectoryArgs,\n): Promise<string> => {\n\tconst dir = buildCustomTypeDirectoryPath(args);\n\tconst relativeDir = buildCustomTypeDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"deleteCustomTypeDirectory.js","sources":["../../../src/fs/deleteCustomTypeDirectory.ts"],"sourcesContent":["import {\n\tbuildCustomTypeDirectoryPath,\n\tBuildCustomTypeDirectoryPathArgs,\n} from \"./buildCustomTypeDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeDirectoryArgs = BuildCustomTypeDirectoryPathArgs;\n\nexport const deleteCustomTypeDirectory = async (\n\targs: DeleteCustomTypeDirectoryArgs,\n): Promise<string> => {\n\tconst dir = buildCustomTypeDirectoryPath(args);\n\tconst relativeDir = buildCustomTypeDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":[],"mappings":";;AAQO,MAAM,4BAA4B,OACxC,SACoB;AACpB,QAAM,MAAM,6BAA6B,IAAI;AAC7C,QAAM,cAAc,6BAA6B;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,kBAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteCustomTypeFile.cjs","sources":["../../../src/fs/deleteCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeFileArgs = BuildCustomTypeFilePathArgs;\n\nexport const deleteCustomTypeFile = async (\n\targs: DeleteCustomTypeFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildCustomTypeFilePath","deleteProjectFile"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"deleteCustomTypeFile.cjs","sources":["../../../src/fs/deleteCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeFileArgs = BuildCustomTypeFilePathArgs;\n\nexport const deleteCustomTypeFile = async (\n\targs: DeleteCustomTypeFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildCustomTypeFilePath","deleteProjectFile"],"mappings":";;;;AAQO,MAAM,uBAAuB,OACnC,SACoB;AACpB,QAAM,WAAWA,wBAAAA,wBAAwB,IAAI;AAC7C,QAAM,mBAAmBA,wBAAAA,wBAAwB;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,oCAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteCustomTypeFile.js","sources":["../../../src/fs/deleteCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeFileArgs = BuildCustomTypeFilePathArgs;\n\nexport const deleteCustomTypeFile = async (\n\targs: DeleteCustomTypeFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"deleteCustomTypeFile.js","sources":["../../../src/fs/deleteCustomTypeFile.ts"],"sourcesContent":["import {\n\tbuildCustomTypeFilePath,\n\tBuildCustomTypeFilePathArgs,\n} from \"./buildCustomTypeFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteCustomTypeFileArgs = BuildCustomTypeFilePathArgs;\n\nexport const deleteCustomTypeFile = async (\n\targs: DeleteCustomTypeFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;AAQO,MAAM,uBAAuB,OACnC,SACoB;AACpB,QAAM,WAAW,wBAAwB,IAAI;AAC7C,QAAM,mBAAmB,wBAAwB;AAAA,IAChD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,kBAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteProjectFile.cjs","sources":["../../../src/fs/deleteProjectFile.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type DeleteProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const deleteProjectFile = async (\n\targs: DeleteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tawait fs.rm(filePath, { recursive: true });\n\n\treturn filePath;\n};\n"],"names":["fs.rm"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"deleteProjectFile.cjs","sources":["../../../src/fs/deleteProjectFile.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type DeleteProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const deleteProjectFile = async (\n\targs: DeleteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tawait fs.rm(filePath, { recursive: true });\n\n\treturn filePath;\n};\n"],"names":["fs.rm"],"mappings":";;;AASO,MAAM,oBAAoB,OAChC,SACoB;AACpB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,QAAMA,QAAAA,GAAM,UAAU,EAAE,WAAW,MAAM;AAEzC,SAAO;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteProjectFile.js","sources":["../../../src/fs/deleteProjectFile.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type DeleteProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const deleteProjectFile = async (\n\targs: DeleteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tawait fs.rm(filePath, { recursive: true });\n\n\treturn filePath;\n};\n"],"names":["fs.rm"],"mappings":";
|
|
1
|
+
{"version":3,"file":"deleteProjectFile.js","sources":["../../../src/fs/deleteProjectFile.ts"],"sourcesContent":["import { SliceMachineHelpers } from \"../createSliceMachineHelpers\";\n\nimport * as fs from \"./lib/fsLimit\";\n\nexport type DeleteProjectFileArgs = {\n\tfilename: string;\n\thelpers: SliceMachineHelpers;\n};\n\nexport const deleteProjectFile = async (\n\targs: DeleteProjectFileArgs,\n): Promise<string> => {\n\tconst filePath = args.helpers.joinPathFromRoot(args.filename);\n\n\tawait fs.rm(filePath, { recursive: true });\n\n\treturn filePath;\n};\n"],"names":["fs.rm"],"mappings":";AASO,MAAM,oBAAoB,OAChC,SACoB;AACpB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ;AAE5D,QAAMA,GAAM,UAAU,EAAE,WAAW,MAAM;AAEzC,SAAO;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSliceDirectory.cjs","sources":["../../../src/fs/deleteSliceDirectory.ts"],"sourcesContent":["import {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceDirectoryArgs = BuildSliceDirectoryPathArgs;\n\nexport const deleteSliceDirectory = async (\n\targs: DeleteSliceDirectoryArgs,\n): Promise<string> => {\n\tconst dir = await buildSliceDirectoryPath(args);\n\tconst relativeDir = await buildSliceDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":["buildSliceDirectoryPath","deleteProjectFile"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"deleteSliceDirectory.cjs","sources":["../../../src/fs/deleteSliceDirectory.ts"],"sourcesContent":["import {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceDirectoryArgs = BuildSliceDirectoryPathArgs;\n\nexport const deleteSliceDirectory = async (\n\targs: DeleteSliceDirectoryArgs,\n): Promise<string> => {\n\tconst dir = await buildSliceDirectoryPath(args);\n\tconst relativeDir = await buildSliceDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":["buildSliceDirectoryPath","deleteProjectFile"],"mappings":";;;;AAQO,MAAM,uBAAuB,OACnC,SACoB;AACpB,QAAM,MAAM,MAAMA,wBAAAA,wBAAwB,IAAI;AAC9C,QAAM,cAAc,MAAMA,gDAAwB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,oCAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSliceDirectory.js","sources":["../../../src/fs/deleteSliceDirectory.ts"],"sourcesContent":["import {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceDirectoryArgs = BuildSliceDirectoryPathArgs;\n\nexport const deleteSliceDirectory = async (\n\targs: DeleteSliceDirectoryArgs,\n): Promise<string> => {\n\tconst dir = await buildSliceDirectoryPath(args);\n\tconst relativeDir = await buildSliceDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"deleteSliceDirectory.js","sources":["../../../src/fs/deleteSliceDirectory.ts"],"sourcesContent":["import {\n\tbuildSliceDirectoryPath,\n\tBuildSliceDirectoryPathArgs,\n} from \"./buildSliceDirectoryPath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceDirectoryArgs = BuildSliceDirectoryPathArgs;\n\nexport const deleteSliceDirectory = async (\n\targs: DeleteSliceDirectoryArgs,\n): Promise<string> => {\n\tconst dir = await buildSliceDirectoryPath(args);\n\tconst relativeDir = await buildSliceDirectoryPath({\n\t\t...args,\n\t\tabsolute: false,\n\t});\n\n\tawait deleteProjectFile({\n\t\tfilename: relativeDir,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn dir;\n};\n"],"names":[],"mappings":";;AAQO,MAAM,uBAAuB,OACnC,SACoB;AACpB,QAAM,MAAM,MAAM,wBAAwB,IAAI;AAC9C,QAAM,cAAc,MAAM,wBAAwB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,kBAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSliceFile.cjs","sources":["../../../src/fs/deleteSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceFileArgs = BuildSliceFilePathArgs;\n\nexport const deleteSliceFile = async (\n\targs: DeleteSliceFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildSliceFilePath","deleteProjectFile"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"deleteSliceFile.cjs","sources":["../../../src/fs/deleteSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceFileArgs = BuildSliceFilePathArgs;\n\nexport const deleteSliceFile = async (\n\targs: DeleteSliceFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":["buildSliceFilePath","deleteProjectFile"],"mappings":";;;;AAQO,MAAM,kBAAkB,OAC9B,SACoB;AACpB,QAAM,WAAW,MAAMA,mBAAAA,mBAAmB,IAAI;AAC9C,QAAM,mBAAmB,MAAMA,sCAAmB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAMC,oCAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSliceFile.js","sources":["../../../src/fs/deleteSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceFileArgs = BuildSliceFilePathArgs;\n\nexport const deleteSliceFile = async (\n\targs: DeleteSliceFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"deleteSliceFile.js","sources":["../../../src/fs/deleteSliceFile.ts"],"sourcesContent":["import {\n\tbuildSliceFilePath,\n\tBuildSliceFilePathArgs,\n} from \"./buildSliceFilePath\";\nimport { deleteProjectFile } from \"./deleteProjectFile\";\n\nexport type DeleteSliceFileArgs = BuildSliceFilePathArgs;\n\nexport const deleteSliceFile = async (\n\targs: DeleteSliceFileArgs,\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 deleteProjectFile({\n\t\tfilename: relativeFilePath,\n\t\thelpers: args.helpers,\n\t});\n\n\treturn filePath;\n};\n"],"names":[],"mappings":";;AAQO,MAAM,kBAAkB,OAC9B,SACoB;AACpB,QAAM,WAAW,MAAM,mBAAmB,IAAI;AAC9C,QAAM,mBAAmB,MAAM,mBAAmB;AAAA,IACjD,GAAG;AAAA,IACH,UAAU;AAAA,EAAA,CACV;AAED,QAAM,kBAAkB;AAAA,IACvB,UAAU;AAAA,IACV,SAAS,KAAK;AAAA,EAAA,CACd;AAED,SAAO;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPathExists.cjs","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;
|
|
1
|
+
{"version":3,"file":"checkPathExists.cjs","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,QAAAA,OAAU,IAAI;AAEpB,WAAO;AAAA,EACR,QAAQ;AACP,WAAO;AAAA,EACR;AACD;;"}
|