@jakubmazanec/carson 3.0.6-unstable.f50b9d9c → 3.0.6
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/README.md +1 -1
- package/build/commands/create-project/CreateProject.js +0 -1
- package/build/commands/create-project/CreateProject.js.map +1 -1
- package/build/commands/create-project/CreateProjectInput.js +0 -1
- package/build/commands/create-project/CreateProjectInput.js.map +1 -1
- package/build/commands/create-project/createProjectCommand.js +0 -1
- package/build/commands/create-project/createProjectCommand.js.map +1 -1
- package/build/commands/create-project/runCreateProject.js +0 -1
- package/build/commands/create-project/runCreateProject.js.map +1 -1
- package/build/commands/create-project.js +0 -1
- package/build/commands/create-project.js.map +1 -1
- package/build/commands/create-workspace/CreateWorkspace.js +0 -1
- package/build/commands/create-workspace/CreateWorkspace.js.map +1 -1
- package/build/commands/create-workspace/CreateWorkspaceInput.js +0 -1
- package/build/commands/create-workspace/CreateWorkspaceInput.js.map +1 -1
- package/build/commands/create-workspace/createWorkspaceCommand.js +0 -1
- package/build/commands/create-workspace/createWorkspaceCommand.js.map +1 -1
- package/build/commands/create-workspace/runCreateWorkspace.js +0 -1
- package/build/commands/create-workspace/runCreateWorkspace.js.map +1 -1
- package/build/commands/create-workspace.js +0 -1
- package/build/commands/create-workspace.js.map +1 -1
- package/build/commands/internals/CommandStatus.js +0 -1
- package/build/commands/internals/packageNameToDirectory.js +0 -1
- package/build/commands/internals/packageNameToDirectory.js.map +1 -1
- package/build/commands/internals.js +0 -1
- package/build/commands/internals.js.map +1 -1
- package/build/commands/update-workspace/UpdateWorkspace.js +0 -1
- package/build/commands/update-workspace/UpdateWorkspace.js.map +1 -1
- package/build/commands/update-workspace/runUpdateWorkspace.js +0 -1
- package/build/commands/update-workspace/runUpdateWorkspace.js.map +1 -1
- package/build/commands/update-workspace/updateWorkspaceCommand.js +0 -1
- package/build/commands/update-workspace/updateWorkspaceCommand.js.map +1 -1
- package/build/commands/update-workspace.js +0 -1
- package/build/commands/update-workspace.js.map +1 -1
- package/build/commands.js +0 -1
- package/build/commands.js.map +1 -1
- package/build/constants.js +0 -1
- package/build/constants.js.map +1 -1
- package/build/main.js +0 -1
- package/build/main.js.map +1 -1
- package/build/modules.d.js +0 -1
- package/build/run.js +0 -1
- package/build/run.js.map +1 -1
- package/build/template/CarsonTemplate.js +0 -1
- package/build/template/CarsonTemplateConfig.js +0 -1
- package/build/template/CarsonTemplateConfig.js.map +1 -1
- package/build/template/CarsonTemplateError.js +0 -1
- package/build/template/CarsonTemplateError.js.map +1 -1
- package/build/template/TemplateAttributes.js +0 -1
- package/build/template/TemplateAttributes.js.map +1 -1
- package/build/template/TemplateData.js +0 -1
- package/build/template/TemplateData.js.map +1 -1
- package/build/template/TemplateRender.js +0 -1
- package/build/template/TemplateRenders.js +0 -1
- package/build/template/applyTemplateRenders.js +0 -1
- package/build/template/applyTemplateRenders.js.map +1 -1
- package/build/template/internals/TemplateRenderSnapshot.js +0 -1
- package/build/template/internals/TemplateRenderSnapshot.js.map +1 -1
- package/build/template/internals/TemplateRenderSnapshots.js +0 -1
- package/build/template/internals/TemplateRenderSnapshots.js.map +1 -1
- package/build/template/internals/createUsingTemplateRender.js +0 -1
- package/build/template/internals/createUsingTemplateRender.js.map +1 -1
- package/build/template/internals/deleteUsingTemplateRenderSnapshot.js +0 -1
- package/build/template/internals/deleteUsingTemplateRenderSnapshot.js.map +1 -1
- package/build/template/internals/importCarsonTemplate.js +0 -1
- package/build/template/internals/importCarsonTemplate.js.map +1 -1
- package/build/template/internals/insertUsingTemplateRender.js +0 -1
- package/build/template/internals/insertUsingTemplateRender.js.map +1 -1
- package/build/template/internals/loadTemplateRenderSnapshots.js +0 -1
- package/build/template/internals/loadTemplateRenderSnapshots.js.map +1 -1
- package/build/template/internals/merge.js +0 -1
- package/build/template/internals/merge.js.map +1 -1
- package/build/template/internals/mergeUsingTemplateRender.js +0 -1
- package/build/template/internals/mergeUsingTemplateRender.js.map +1 -1
- package/build/template/internals/overwriteUsingTemplateRender.js +0 -1
- package/build/template/internals/overwriteUsingTemplateRender.js.map +1 -1
- package/build/template/internals/parseCarsonTemplateId.js +0 -1
- package/build/template/internals/parseCarsonTemplateId.js.map +1 -1
- package/build/template/internals/prettify.js +0 -1
- package/build/template/internals/prettify.js.map +1 -1
- package/build/template/internals/readCarsonTemplate.js +0 -1
- package/build/template/internals/readCarsonTemplate.js.map +1 -1
- package/build/template/internals/resolveModule.js +0 -1
- package/build/template/internals/resolveModule.js.map +1 -1
- package/build/template/internals/saveTemplateRenderSnapshots.js +0 -1
- package/build/template/internals/saveTemplateRenderSnapshots.js.map +1 -1
- package/build/template/internals/simplify.js +0 -1
- package/build/template/internals/simplify.js.map +1 -1
- package/build/template/internals/uninsertUsingTemplateRenderSnapshot.js +0 -1
- package/build/template/internals/uninsertUsingTemplateRenderSnapshot.js.map +1 -1
- package/build/template/internals/unmerge.js +0 -1
- package/build/template/internals/unmerge.js.map +1 -1
- package/build/template/internals/unmergeUsingTemplateRenderSnapshot.js +0 -1
- package/build/template/internals/unmergeUsingTemplateRenderSnapshot.js.map +1 -1
- package/build/template/internals.js +0 -1
- package/build/template/internals.js.map +1 -1
- package/build/template/renderCarsonTemplate.js +0 -1
- package/build/template/renderCarsonTemplate.js.map +1 -1
- package/build/template.js +0 -1
- package/build/template.js.map +1 -1
- package/build/workspace/Project.js +0 -1
- package/build/workspace/Project.js.map +1 -1
- package/build/workspace/ProjectConfig.js +0 -1
- package/build/workspace/ProjectConfig.js.map +1 -1
- package/build/workspace/ProjectCreateOptions.js +0 -1
- package/build/workspace/ProjectError.js +0 -1
- package/build/workspace/ProjectError.js.map +1 -1
- package/build/workspace/ProjectOptions.js +0 -1
- package/build/workspace/ProjectUpdateOptions.js +0 -1
- package/build/workspace/Workspace.js +0 -1
- package/build/workspace/Workspace.js.map +1 -1
- package/build/workspace/WorkspaceConfig.js +0 -1
- package/build/workspace/WorkspaceConfig.js.map +1 -1
- package/build/workspace/WorkspaceCreateOptions.js +0 -1
- package/build/workspace/WorkspaceCreateProjectOptions.js +0 -1
- package/build/workspace/WorkspaceDependencies.js +0 -1
- package/build/workspace/WorkspaceDependencies.js.map +1 -1
- package/build/workspace/WorkspaceDependenciesFromWorkspaceOptions.js +0 -1
- package/build/workspace/WorkspaceDependenciesGetVersionsOptions.js +0 -1
- package/build/workspace/WorkspaceDependency.js +0 -1
- package/build/workspace/WorkspaceDependencyProject.js +0 -1
- package/build/workspace/WorkspaceError.js +0 -1
- package/build/workspace/WorkspaceError.js.map +1 -1
- package/build/workspace/WorkspaceFindAndReadOptions.js +0 -1
- package/build/workspace/WorkspaceOptions.js +0 -1
- package/build/workspace/WorkspaceOptionsProject.js +0 -1
- package/build/workspace/WorkspacePackageJson.js +0 -1
- package/build/workspace/WorkspaceProjectGlobs.js +0 -1
- package/build/workspace/WorkspaceProjects.js +0 -1
- package/build/workspace/WorkspaceRepository.js +0 -1
- package/build/workspace/WorkspaceUpdateOptions.js +0 -1
- package/build/workspace/internals/compareProjectPath.js +0 -1
- package/build/workspace/internals/compareProjectPath.js.map +1 -1
- package/build/workspace/internals/compareSemver.js +0 -1
- package/build/workspace/internals/compareSemver.js.map +1 -1
- package/build/workspace/internals/compareWorkspaceDependencyProjectName.js +0 -1
- package/build/workspace/internals/compareWorkspaceDependencyProjectName.js.map +1 -1
- package/build/workspace/internals/containsProject.js +0 -1
- package/build/workspace/internals/containsProject.js.map +1 -1
- package/build/workspace/internals/containsWorkspace.js +0 -1
- package/build/workspace/internals/containsWorkspace.js.map +1 -1
- package/build/workspace/internals/getPackageJsonWorkspaces.js +0 -1
- package/build/workspace/internals/getPackageJsonWorkspaces.js.map +1 -1
- package/build/workspace/internals/getRepositoryBranches.js +0 -1
- package/build/workspace/internals/getRepositoryBranches.js.map +1 -1
- package/build/workspace/internals/getRepositoryUrl.js +0 -1
- package/build/workspace/internals/getRepositoryUrl.js.map +1 -1
- package/build/workspace/internals.js +0 -1
- package/build/workspace/internals.js.map +1 -1
- package/build/workspace/saveProjectConfig.js +0 -1
- package/build/workspace/saveProjectConfig.js.map +1 -1
- package/build/workspace/saveWorkspaceConfig.js +0 -1
- package/build/workspace/saveWorkspaceConfig.js.map +1 -1
- package/build/workspace.js +0 -1
- package/build/workspace.js.map +1 -1
- package/package.json +11 -11
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/deleteUsingTemplateRenderSnapshot.ts"],
|
|
4
4
|
"sourcesContent": ["import fs from 'fs-extra';\nimport path from 'node:path';\n\nimport {CarsonTemplateError} from '../CarsonTemplateError.js';\nimport {prettify} from './prettify.js';\nimport {type TemplateRenderSnapshot} from './TemplateRenderSnapshot.js';\n\nexport type DeleteUsingTemplateRenderOptions = {\n onlyDeleteWhenContentsMatch?: boolean;\n};\n\nexport async function deleteUsingTemplateRenderSnapshot(\n templateRenderSnapshot: TemplateRenderSnapshot,\n basePath: string,\n options?: DeleteUsingTemplateRenderOptions,\n) {\n let to = path.join(basePath, templateRenderSnapshot.attributes.to);\n\n if (!(await fs.pathExists(to))) {\n return;\n }\n\n if (options?.onlyDeleteWhenContentsMatch) {\n if (!templateRenderSnapshot.content) {\n throw new CarsonTemplateError('INVALID_SNAPSHOT');\n }\n\n let existingContent = await fs.readFile(to, {encoding: 'utf8'});\n let newContent = await prettify(templateRenderSnapshot.content, to);\n\n if (existingContent.trim() === newContent.trim()) {\n await fs.rm(to);\n }\n\n return;\n }\n\n await fs.rm(to);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAQ,2BAA0B;AAClC,SAAQ,gBAAe;AAOvB,sBAAsB,kCACpB,wBACA,UACA,SACA;AACA,MAAI,KAAK,KAAK,KAAK,UAAU,uBAAuB,WAAW,EAAE;AAEjE,MAAI,CAAE,MAAM,GAAG,WAAW,EAAE,GAAI;AAC9B;AAAA,EACF;AAEA,MAAI,SAAS,6BAA6B;AACxC,QAAI,CAAC,uBAAuB,SAAS;AACnC,YAAM,IAAI,oBAAoB,kBAAkB;AAAA,IAClD;AAEA,QAAI,kBAAkB,MAAM,GAAG,SAAS,IAAI,EAAC,UAAU,OAAM,CAAC;AAC9D,QAAI,aAAa,MAAM,SAAS,uBAAuB,SAAS,EAAE;AAElE,QAAI,gBAAgB,KAAK,MAAM,WAAW,KAAK,GAAG;AAChD,YAAM,GAAG,GAAG,EAAE;AAAA,IAChB;AAEA;AAAA,EACF;AAEA,QAAM,GAAG,GAAG,EAAE;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/importCarsonTemplate.ts"],
|
|
4
4
|
"sourcesContent": ["import {parseCarsonTemplateId} from './parseCarsonTemplateId.js';\n\ntype Module = {\n [key: string]: unknown;\n default: unknown;\n};\n\nexport async function importCarsonTemplate(templateId: string) {\n let [moduleId] = parseCarsonTemplateId(templateId);\n let {default: _, ...moduleWithoutDefault} = (await import(moduleId)) as Module;\n\n return moduleWithoutDefault;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,6BAA4B;AAOpC,sBAAsB,qBAAqB,YAAoB;AAC7D,MAAI,CAAC,QAAQ,IAAI,sBAAsB,UAAU;AACjD,MAAI,EAAC,SAAS,GAAG,GAAG,qBAAoB,IAAK,MAAM,OAAO;AAE1D,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/insertUsingTemplateRender.ts"],
|
|
4
4
|
"sourcesContent": ["import fs from 'fs-extra';\nimport _ from 'lodash';\nimport path from 'node:path';\n\nimport {CarsonTemplateError} from '../CarsonTemplateError.js';\nimport {type TemplateRender} from '../TemplateRender.js';\nimport {prettify} from './prettify.js';\n\nexport async function insertUsingTemplateRender(templateRender: TemplateRender, basePath: string) {\n let to = path.join(basePath, templateRender.attributes.to);\n let extension = path.extname(to);\n\n switch (extension) {\n case '.md': {\n if (await fs.pathExists(to)) {\n let targetFile = await fs.readFile(to, {encoding: 'utf8'});\n let newContent = `<!-- ${templateRender.attributes.strategy[1]} -->${templateRender.content}<!-- ${templateRender.attributes.strategy[1]} -->`;\n let oldContentRegexp = new RegExp(\n `<!--\\\\s*${_.escapeRegExp(\n templateRender.attributes.strategy[1],\n )}\\\\s-->[\\\\s\\\\S]*<!--\\\\s*${_.escapeRegExp(templateRender.attributes.strategy[1])}\\\\s-->`,\n 'u',\n );\n let newFile = targetFile.replace(oldContentRegexp, newContent);\n\n await fs.writeFile(to, await prettify(newFile, to), {encoding: 'utf8'});\n }\n\n break;\n }\n\n default: {\n throw new CarsonTemplateError('STRATEGY_UNSUPPORTED_EXTENSION', {\n messageParameters: [\n templateRender.attributes.strategy,\n templateRender.template.path,\n extension,\n ],\n data: {\n path: templateRender.template.path,\n },\n });\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,UAAU;AAEjB,SAAQ,2BAA0B;AAElC,SAAQ,gBAAe;AAEvB,sBAAsB,0BAA0B,gBAAgC,UAAkB;AAChG,MAAI,KAAK,KAAK,KAAK,UAAU,eAAe,WAAW,EAAE;AACzD,MAAI,YAAY,KAAK,QAAQ,EAAE;AAE/B,UAAQ,WAAW;AAAA,IACjB,KAAK,OAAO;AACV,UAAI,MAAM,GAAG,WAAW,EAAE,GAAG;AAC3B,YAAI,aAAa,MAAM,GAAG,SAAS,IAAI,EAAC,UAAU,OAAM,CAAC;AACzD,YAAI,aAAa,QAAQ,eAAe,WAAW,SAAS,CAAC,CAAC,OAAO,eAAe,OAAO,QAAQ,eAAe,WAAW,SAAS,CAAC,CAAC;AACxI,YAAI,mBAAmB,IAAI;AAAA,UACzB,WAAW,EAAE;AAAA,YACX,eAAe,WAAW,SAAS,CAAC;AAAA,UACtC,CAAC,0BAA0B,EAAE,aAAa,eAAe,WAAW,SAAS,CAAC,CAAC,CAAC;AAAA,UAChF;AAAA,QACF;AACA,YAAI,UAAU,WAAW,QAAQ,kBAAkB,UAAU;AAE7D,cAAM,GAAG,UAAU,IAAI,MAAM,SAAS,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAAA,MACxE;AAEA;AAAA,IACF;AAAA,IAEA,SAAS;AACP,YAAM,IAAI,oBAAoB,kCAAkC;AAAA,QAC9D,mBAAmB;AAAA,UACjB,eAAe,WAAW;AAAA,UAC1B,eAAe,SAAS;AAAA,UACxB;AAAA,QACF;AAAA,QACA,MAAM;AAAA,UACJ,MAAM,eAAe,SAAS;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/loadTemplateRenderSnapshots.ts"],
|
|
4
4
|
"sourcesContent": ["import {inflateSync, strFromU8} from 'fflate';\nimport fs from 'fs-extra';\n\nimport {templateRenderSnapshotsSchema} from './TemplateRenderSnapshots.js';\n\nexport async function loadTemplateRenderSnapshots(templateRenderSnapshotsPath: string) {\n let compressedSnapshots = await fs.readFile(templateRenderSnapshotsPath);\n let decompressedSnapshots = inflateSync(new Uint8Array(compressedSnapshots));\n let parsingResult = templateRenderSnapshotsSchema.safeParse(\n JSON.parse(strFromU8(decompressedSnapshots)),\n );\n\n if (!parsingResult.success) {\n throw parsingResult.error;\n }\n\n return parsingResult.data;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,aAAa,iBAAgB;AACrC,OAAO,QAAQ;AAEf,SAAQ,qCAAoC;AAE5C,sBAAsB,4BAA4B,6BAAqC;AACrF,MAAI,sBAAsB,MAAM,GAAG,SAAS,2BAA2B;AACvE,MAAI,wBAAwB,YAAY,IAAI,WAAW,mBAAmB,CAAC;AAC3E,MAAI,gBAAgB,8BAA8B;AAAA,IAChD,KAAK,MAAM,UAAU,qBAAqB,CAAC;AAAA,EAC7C;AAEA,MAAI,CAAC,cAAc,SAAS;AAC1B,UAAM,cAAc;AAAA,EACtB;AAEA,SAAO,cAAc;AACvB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/merge.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Merges two JSON-like variables. Only simple objects, not arrays, are merged recursively.\n */\nexport function merge(a: unknown, b: unknown) {\n if (b === undefined || b == null) {\n return a;\n }\n\n if (typeof b !== 'object' || Array.isArray(b)) {\n return a;\n }\n\n if (a === undefined || a == null) {\n return a;\n }\n\n if (typeof a !== 'object' || Array.isArray(a)) {\n return a;\n }\n\n const newA: Record<string, unknown> = {...a};\n\n for (let [key, value] of Object.entries(b)) {\n if (\n (a as Record<string, unknown>)[key] &&\n typeof (a as Record<string, unknown>)[key] === 'object' &&\n !Array.isArray((a as Record<string, unknown>)[key]) &&\n (b as Record<string, unknown>)[key] &&\n typeof (b as Record<string, unknown>)[key] === 'object' &&\n !Array.isArray((b as Record<string, unknown>)[key])\n ) {\n const result = merge(\n (a as Record<string, unknown>)[key],\n (b as Record<string, unknown>)[key],\n );\n\n newA[key] = result;\n } else {\n newA[key] = value;\n }\n }\n\n return newA;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAGO,gBAAS,MAAM,GAAY,GAAY;AAC5C,MAAI,MAAM,UAAa,KAAK,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,UAAa,KAAK,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,OAAgC,EAAC,GAAG,EAAC;AAE3C,WAAS,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,CAAC,GAAG;AAC1C,QACG,EAA8B,GAAG,KAClC,OAAQ,EAA8B,GAAG,MAAM,YAC/C,CAAC,MAAM,QAAS,EAA8B,GAAG,CAAC,KACjD,EAA8B,GAAG,KAClC,OAAQ,EAA8B,GAAG,MAAM,YAC/C,CAAC,MAAM,QAAS,EAA8B,GAAG,CAAC,GAClD;AACA,YAAM,SAAS;AAAA,QACZ,EAA8B,GAAG;AAAA,QACjC,EAA8B,GAAG;AAAA,MACpC;AAEA,WAAK,GAAG,IAAI;AAAA,IACd,OAAO;AACL,WAAK,GAAG,IAAI;AAAA,IACd;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/mergeUsingTemplateRender.ts"],
|
|
4
4
|
"sourcesContent": ["import {type Json} from '@jakubmazanec/zod-utils';\nimport fs from 'fs-extra';\nimport json from 'json5';\nimport path from 'node:path';\nimport yaml from 'yaml';\n\nimport {CarsonTemplateError} from '../CarsonTemplateError.js';\nimport {type TemplateRender} from '../TemplateRender.js';\nimport {merge} from './merge.js';\nimport {prettify} from './prettify.js';\n\nexport async function mergeUsingTemplateRender(templateRender: TemplateRender, basePath: string) {\n let to = path.join(basePath, templateRender.attributes.to);\n let extension = path.extname(to);\n\n switch (extension) {\n case '.json': {\n if (await fs.pathExists(to)) {\n let targetFile = (await fs.readJson(to)) as Json;\n let fileToMerge = json.parse<Json>(templateRender.content);\n let newFile = JSON.stringify(merge(targetFile, fileToMerge), null, 2);\n\n await fs.writeFile(to, await prettify(newFile, to), {encoding: 'utf8'});\n } else {\n await fs.writeFile(to, await prettify(templateRender.content, to), {encoding: 'utf8'});\n }\n\n break;\n }\n\n case '.yaml': {\n if (await fs.pathExists(to)) {\n let targetFile = yaml.parse(await fs.readFile(to, {encoding: 'utf8'})) as unknown;\n let fileToMerge = yaml.parse(templateRender.content) as unknown;\n let newFile = yaml.stringify(merge(targetFile, fileToMerge));\n\n await fs.writeFile(to, await prettify(newFile, to), {encoding: 'utf8'});\n } else {\n await fs.writeFile(to, await prettify(templateRender.content, to), {encoding: 'utf8'});\n }\n\n break;\n }\n\n default: {\n throw new CarsonTemplateError('STRATEGY_UNSUPPORTED_EXTENSION', {\n messageParameters: [\n templateRender.attributes.strategy,\n templateRender.template.path,\n extension,\n ],\n data: {\n path: templateRender.template.path,\n },\n });\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AACA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,UAAU;AAEjB,SAAQ,2BAA0B;AAElC,SAAQ,aAAY;AACpB,SAAQ,gBAAe;AAEvB,sBAAsB,yBAAyB,gBAAgC,UAAkB;AAC/F,MAAI,KAAK,KAAK,KAAK,UAAU,eAAe,WAAW,EAAE;AACzD,MAAI,YAAY,KAAK,QAAQ,EAAE;AAE/B,UAAQ,WAAW;AAAA,IACjB,KAAK,SAAS;AACZ,UAAI,MAAM,GAAG,WAAW,EAAE,GAAG;AAC3B,YAAI,aAAc,MAAM,GAAG,SAAS,EAAE;AACtC,YAAI,cAAc,KAAK,MAAY,eAAe,OAAO;AACzD,YAAI,UAAU,KAAK,UAAU,MAAM,YAAY,WAAW,GAAG,MAAM,CAAC;AAEpE,cAAM,GAAG,UAAU,IAAI,MAAM,SAAS,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAAA,MACxE,OAAO;AACL,cAAM,GAAG,UAAU,IAAI,MAAM,SAAS,eAAe,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAAA,MACvF;AAEA;AAAA,IACF;AAAA,IAEA,KAAK,SAAS;AACZ,UAAI,MAAM,GAAG,WAAW,EAAE,GAAG;AAC3B,YAAI,aAAa,KAAK,MAAM,MAAM,GAAG,SAAS,IAAI,EAAC,UAAU,OAAM,CAAC,CAAC;AACrE,YAAI,cAAc,KAAK,MAAM,eAAe,OAAO;AACnD,YAAI,UAAU,KAAK,UAAU,MAAM,YAAY,WAAW,CAAC;AAE3D,cAAM,GAAG,UAAU,IAAI,MAAM,SAAS,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAAA,MACxE,OAAO;AACL,cAAM,GAAG,UAAU,IAAI,MAAM,SAAS,eAAe,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAAA,MACvF;AAEA;AAAA,IACF;AAAA,IAEA,SAAS;AACP,YAAM,IAAI,oBAAoB,kCAAkC;AAAA,QAC9D,mBAAmB;AAAA,UACjB,eAAe,WAAW;AAAA,UAC1B,eAAe,SAAS;AAAA,UACxB;AAAA,QACF;AAAA,QACA,MAAM;AAAA,UACJ,MAAM,eAAe,SAAS;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/overwriteUsingTemplateRender.ts"],
|
|
4
4
|
"sourcesContent": ["import fs from 'fs-extra';\nimport path from 'node:path';\n\nimport {type TemplateRender} from '../TemplateRender.js';\nimport {prettify} from './prettify.js';\n\nexport async function overwriteUsingTemplateRender(\n templateRender: TemplateRender,\n basePath: string,\n) {\n let to = path.join(basePath, templateRender.attributes.to);\n\n await fs.ensureDir(path.dirname(to));\n await fs.writeFile(to, await prettify(templateRender.content, to), {encoding: 'utf8'});\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAGjB,SAAQ,gBAAe;AAEvB,sBAAsB,6BACpB,gBACA,UACA;AACA,MAAI,KAAK,KAAK,KAAK,UAAU,eAAe,WAAW,EAAE;AAEzD,QAAM,GAAG,UAAU,KAAK,QAAQ,EAAE,CAAC;AACnC,QAAM,GAAG,UAAU,IAAI,MAAM,SAAS,eAAe,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AACvF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/parseCarsonTemplateId.ts"],
|
|
4
4
|
"sourcesContent": ["import {CarsonTemplateError} from '../CarsonTemplateError.js';\n\nexport function parseCarsonTemplateId(value: string): [moduleId: string, templateName: string] {\n let parts = value.split(':');\n\n if (!parts[0] || !parts[1]) {\n throw new CarsonTemplateError('INVALID_CARSON_TEMPLATE_ID', {\n messageParameters: [value],\n });\n }\n\n return [parts[0], parts[1]];\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,2BAA0B;AAE3B,gBAAS,sBAAsB,OAAyD;AAC7F,MAAI,QAAQ,MAAM,MAAM,GAAG;AAE3B,MAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG;AAC1B,UAAM,IAAI,oBAAoB,8BAA8B;AAAA,MAC1D,mBAAmB,CAAC,KAAK;AAAA,IAC3B,CAAC;AAAA,EACH;AAEA,SAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;AAC5B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/prettify.ts"],
|
|
4
4
|
"sourcesContent": ["import prettier, {type Plugin} from 'prettier';\nimport packageJsonPrettierPlugin from 'prettier-plugin-packagejson';\n\nconst NO_INFERRED_PARSER = /parser.*inferred/i;\n\nexport async function prettify(content: string, targetPath: string) {\n let prettifiedContent = content;\n\n try {\n let prettierOptions = await prettier.resolveConfig(targetPath, {editorconfig: true});\n\n prettifiedContent = await prettier.format(content, {\n ...prettierOptions,\n filepath: targetPath,\n plugins: [...(prettierOptions?.plugins ?? []), packageJsonPrettierPlugin as Plugin],\n });\n } catch (error: unknown) {\n if (!NO_INFERRED_PARSER.test((error as Error).message)) {\n throw error;\n }\n }\n\n return prettifiedContent;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,cAA6B;AACpC,OAAO,+BAA+B;AAEtC,MAAM,qBAAqB;AAE3B,sBAAsB,SAAS,SAAiB,YAAoB;AAClE,MAAI,oBAAoB;AAExB,MAAI;AACF,QAAI,kBAAkB,MAAM,SAAS,cAAc,YAAY,EAAC,cAAc,KAAI,CAAC;AAEnF,wBAAoB,MAAM,SAAS,OAAO,SAAS;AAAA,MACjD,GAAG;AAAA,MACH,UAAU;AAAA,MACV,SAAS,CAAC,GAAI,iBAAiB,WAAW,CAAC,GAAI,yBAAmC;AAAA,IACpF,CAAC;AAAA,EACH,SAAS,OAAgB;AACvB,QAAI,CAAC,mBAAmB,KAAM,MAAgB,OAAO,GAAG;AACtD,YAAM;AAAA,IACR;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/readCarsonTemplate.ts"],
|
|
4
4
|
"sourcesContent": ["import {Template} from '@jakubmazanec/template';\nimport {readFile} from '@jakubmazanec/zod-utils';\nimport glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport path from 'node:path';\n\nimport {TEMPLATE_CONFIG_FILENAME, TEMPLATES_PATH} from '../../constants.js';\nimport {type CarsonTemplate} from '../CarsonTemplate.js';\nimport {carsonTemplateConfigSchema} from '../CarsonTemplateConfig.js';\nimport {CarsonTemplateError} from '../CarsonTemplateError.js';\nimport {templateAttributesSchema} from '../TemplateAttributes.js';\nimport {parseCarsonTemplateId} from './parseCarsonTemplateId.js';\nimport {resolveModule} from './resolveModule.js';\n\nexport async function readCarsonTemplate(templateId: string): Promise<CarsonTemplate> {\n let [moduleId, templateName] = parseCarsonTemplateId(templateId);\n let modulePath = await resolveModule(moduleId);\n let carsonTemplatePath = path.join(modulePath, TEMPLATES_PATH, templateName);\n\n if (await fs.pathExists(carsonTemplatePath)) {\n let templateConfigPath = path.join(carsonTemplatePath, TEMPLATE_CONFIG_FILENAME);\n let templateConfig = await readFile(templateConfigPath, carsonTemplateConfigSchema, {\n throwOnZodError: true,\n });\n let templateFilePaths = await glob('**/*.ejs', {\n cwd: carsonTemplatePath,\n dot: true,\n });\n let carsonTemplate: CarsonTemplate = {\n id: templateId,\n name: templateName,\n config: templateConfig,\n files: [],\n };\n\n for (let templateFilePath of templateFilePaths) {\n carsonTemplate.files.push(\n await Template.read(path.join(carsonTemplatePath, templateFilePath), {\n attributesSchema: templateAttributesSchema,\n }),\n );\n }\n\n return carsonTemplate;\n }\n\n throw new CarsonTemplateError('CARSON_TEMPLATE_NOT_FOUND', {\n messageParameters: [templateName, moduleId],\n });\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,gBAAe;AACvB,SAAQ,gBAAe;AACvB,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAQ,0BAA0B,sBAAqB;AAEvD,SAAQ,kCAAiC;AACzC,SAAQ,2BAA0B;AAClC,SAAQ,gCAA+B;AACvC,SAAQ,6BAA4B;AACpC,SAAQ,qBAAoB;AAE5B,sBAAsB,mBAAmB,YAA6C;AACpF,MAAI,CAAC,UAAU,YAAY,IAAI,sBAAsB,UAAU;AAC/D,MAAI,aAAa,MAAM,cAAc,QAAQ;AAC7C,MAAI,qBAAqB,KAAK,KAAK,YAAY,gBAAgB,YAAY;AAE3E,MAAI,MAAM,GAAG,WAAW,kBAAkB,GAAG;AAC3C,QAAI,qBAAqB,KAAK,KAAK,oBAAoB,wBAAwB;AAC/E,QAAI,iBAAiB,MAAM,SAAS,oBAAoB,4BAA4B;AAAA,MAClF,iBAAiB;AAAA,IACnB,CAAC;AACD,QAAI,oBAAoB,MAAM,KAAK,YAAY;AAAA,MAC7C,KAAK;AAAA,MACL,KAAK;AAAA,IACP,CAAC;AACD,QAAI,iBAAiC;AAAA,MACnC,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,OAAO,CAAC;AAAA,IACV;AAEA,aAAS,oBAAoB,mBAAmB;AAC9C,qBAAe,MAAM;AAAA,QACnB,MAAM,SAAS,KAAK,KAAK,KAAK,oBAAoB,gBAAgB,GAAG;AAAA,UACnE,kBAAkB;AAAA,QACpB,CAAC;AAAA,MACH;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,oBAAoB,6BAA6B;AAAA,IACzD,mBAAmB,CAAC,cAAc,QAAQ;AAAA,EAC5C,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/resolveModule.ts"],
|
|
4
4
|
"sourcesContent": ["import {createRequire} from 'node:module';\nimport path from 'node:path';\n\nexport async function resolveModule(moduleId: string) {\n let require = createRequire(import.meta.url);\n let modulePath = path.dirname(require.resolve(`${moduleId}/package.json`));\n\n return modulePath;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,qBAAoB;AAC5B,OAAO,UAAU;AAEjB,sBAAsB,cAAc,UAAkB;AACpD,MAAI,UAAU,cAAc,YAAY,GAAG;AAC3C,MAAI,aAAa,KAAK,QAAQ,QAAQ,QAAQ,GAAG,QAAQ,eAAe,CAAC;AAEzE,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/saveTemplateRenderSnapshots.ts"],
|
|
4
4
|
"sourcesContent": ["import {deflateSync, strToU8} from 'fflate';\nimport fs from 'fs-extra';\nimport path from 'node:path';\nimport yaml from 'yaml';\n\nimport {type TemplateRenders} from '../TemplateRenders.js';\nimport {simplify} from './simplify.js';\nimport {type TemplateRenderSnapshots} from './TemplateRenderSnapshots.js';\n\nexport async function saveTemplateRenderSnapshots(\n templateRenders: TemplateRenders,\n templateRenderSnapshotsPath: string,\n) {\n let templateRendersSnapshots: TemplateRenderSnapshots = [];\n\n for (let templateRender of templateRenders) {\n if (\n templateRender.attributes.strategy === 'overwrite' ||\n templateRender.attributes.strategy[0] === 'insert'\n ) {\n templateRendersSnapshots.push({\n attributes: {\n to: templateRender.attributes.to,\n strategy: templateRender.attributes.strategy,\n },\n });\n\n continue;\n }\n\n if (templateRender.attributes.strategy === 'ensure') {\n templateRendersSnapshots.push({\n attributes: {\n to: templateRender.attributes.to,\n strategy: templateRender.attributes.strategy,\n },\n content: templateRender.content,\n });\n\n continue;\n }\n\n if (templateRender.attributes.strategy === 'merge') {\n let extension = path.extname(templateRender.attributes.to);\n let content;\n\n switch (extension) {\n case '.json': {\n content = JSON.stringify(simplify(JSON.parse(templateRender.content)));\n\n break;\n }\n\n case '.yaml': {\n content = yaml.stringify(simplify(yaml.parse(templateRender.content)));\n\n break;\n }\n\n default: {\n content = templateRender.content;\n }\n }\n\n templateRendersSnapshots.push({\n attributes: {\n to: templateRender.attributes.to,\n strategy: templateRender.attributes.strategy,\n },\n content,\n });\n\n continue;\n }\n }\n\n await fs.writeFile(\n templateRenderSnapshotsPath,\n deflateSync(strToU8(JSON.stringify(templateRendersSnapshots)), {level: 1, mem: 0}),\n );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,aAAa,eAAc;AACnC,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,UAAU;AAGjB,SAAQ,gBAAe;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|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/simplify.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Simplifies JSON for usage in snapshots: string, number or boolean values are replaced with `null`.\n */\nexport function simplify(a: unknown) {\n if (a === undefined || a == null) {\n return null;\n }\n\n if (typeof a !== 'object' || Array.isArray(a)) {\n return null;\n }\n\n const newA: Record<string, unknown> = {...a};\n\n for (let [key] of Object.entries(a)) {\n if (\n (a as Record<string, unknown>)[key] &&\n typeof (a as Record<string, unknown>)[key] === 'object' &&\n !Array.isArray((a as Record<string, unknown>)[key])\n ) {\n const result = simplify((a as Record<string, unknown>)[key]);\n\n newA[key] = result;\n } else {\n newA[key] = null;\n }\n }\n\n return newA;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAGO,gBAAS,SAAS,GAAY;AACnC,MAAI,MAAM,UAAa,KAAK,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,OAAgC,EAAC,GAAG,EAAC;AAE3C,WAAS,CAAC,GAAG,KAAK,OAAO,QAAQ,CAAC,GAAG;AACnC,QACG,EAA8B,GAAG,KAClC,OAAQ,EAA8B,GAAG,MAAM,YAC/C,CAAC,MAAM,QAAS,EAA8B,GAAG,CAAC,GAClD;AACA,YAAM,SAAS,SAAU,EAA8B,GAAG,CAAC;AAE3D,WAAK,GAAG,IAAI;AAAA,IACd,OAAO;AACL,WAAK,GAAG,IAAI;AAAA,IACd;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/uninsertUsingTemplateRenderSnapshot.ts"],
|
|
4
4
|
"sourcesContent": ["import fs from 'fs-extra';\nimport _ from 'lodash';\nimport path from 'node:path';\n\nimport {CarsonTemplateError} from '../CarsonTemplateError.js';\nimport {prettify} from './prettify.js';\nimport {type TemplateRenderSnapshot} from './TemplateRenderSnapshot.js';\n\nexport async function uninsertUsingTemplateRenderSnapshot(\n templateRenderSnapshot: TemplateRenderSnapshot,\n basePath: string,\n) {\n let to = path.join(basePath, templateRenderSnapshot.attributes.to);\n let extension = path.extname(to);\n\n switch (extension) {\n case '.md': {\n if (await fs.pathExists(to)) {\n let targetFile = await fs.readFile(to, {encoding: 'utf8'});\n let newContent = `<!-- ${templateRenderSnapshot.attributes.strategy[1]} --><!-- ${templateRenderSnapshot.attributes.strategy[1]} -->`;\n let oldContentRegexp = new RegExp(\n `<!--\\\\s*${_.escapeRegExp(\n templateRenderSnapshot.attributes.strategy[1],\n )}\\\\s-->[\\\\s\\\\S]*<!--\\\\s*${_.escapeRegExp(templateRenderSnapshot.attributes.strategy[1])}\\\\s-->`,\n 'u',\n );\n let newFile = targetFile.replace(oldContentRegexp, newContent);\n\n await fs.writeFile(to, await prettify(newFile, to), {encoding: 'utf8'});\n }\n\n break;\n }\n\n default: {\n throw new CarsonTemplateError('INVALID_SNAPSHOT');\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,UAAU;AAEjB,SAAQ,2BAA0B;AAClC,SAAQ,gBAAe;AAGvB,sBAAsB,oCACpB,wBACA,UACA;AACA,MAAI,KAAK,KAAK,KAAK,UAAU,uBAAuB,WAAW,EAAE;AACjE,MAAI,YAAY,KAAK,QAAQ,EAAE;AAE/B,UAAQ,WAAW;AAAA,IACjB,KAAK,OAAO;AACV,UAAI,MAAM,GAAG,WAAW,EAAE,GAAG;AAC3B,YAAI,aAAa,MAAM,GAAG,SAAS,IAAI,EAAC,UAAU,OAAM,CAAC;AACzD,YAAI,aAAa,QAAQ,uBAAuB,WAAW,SAAS,CAAC,CAAC,YAAY,uBAAuB,WAAW,SAAS,CAAC,CAAC;AAC/H,YAAI,mBAAmB,IAAI;AAAA,UACzB,WAAW,EAAE;AAAA,YACX,uBAAuB,WAAW,SAAS,CAAC;AAAA,UAC9C,CAAC,0BAA0B,EAAE,aAAa,uBAAuB,WAAW,SAAS,CAAC,CAAC,CAAC;AAAA,UACxF;AAAA,QACF;AACA,YAAI,UAAU,WAAW,QAAQ,kBAAkB,UAAU;AAE7D,cAAM,GAAG,UAAU,IAAI,MAAM,SAAS,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAAA,MACxE;AAEA;AAAA,IACF;AAAA,IAEA,SAAS;AACP,YAAM,IAAI,oBAAoB,kBAAkB;AAAA,IAClD;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/unmerge.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Reverts {@link merge}.\n */\nexport function unmerge(a: unknown, b: unknown) {\n if (b === undefined || b == null) {\n return a;\n }\n\n if (typeof b !== 'object' || Array.isArray(b)) {\n return a;\n }\n\n if (a === undefined || a == null) {\n return a;\n }\n\n if (typeof a !== 'object' || Array.isArray(a)) {\n return a;\n }\n\n const newA: Record<string, unknown> = {};\n\n for (let [key] of Object.entries(a)) {\n if (!Object.hasOwn(b, key)) {\n newA[key] = (a as Record<string, unknown>)[key];\n\n continue;\n } else if (\n (a as Record<string, unknown>)[key] &&\n typeof (a as Record<string, unknown>)[key] === 'object' &&\n !Array.isArray((a as Record<string, unknown>)[key]) &&\n (b as Record<string, unknown>)[key] &&\n typeof (b as Record<string, unknown>)[key] === 'object' &&\n !Array.isArray((b as Record<string, unknown>)[key])\n ) {\n const result = unmerge(\n (a as Record<string, unknown>)[key],\n (b as Record<string, unknown>)[key],\n );\n\n if (Object.keys(result as Record<string, unknown>).length > 0) {\n newA[key] = result;\n }\n }\n }\n\n return newA;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAGO,gBAAS,QAAQ,GAAY,GAAY;AAC9C,MAAI,MAAM,UAAa,KAAK,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,UAAa,KAAK,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,OAAgC,CAAC;AAEvC,WAAS,CAAC,GAAG,KAAK,OAAO,QAAQ,CAAC,GAAG;AACnC,QAAI,CAAC,OAAO,OAAO,GAAG,GAAG,GAAG;AAC1B,WAAK,GAAG,IAAK,EAA8B,GAAG;AAE9C;AAAA,IACF,WACG,EAA8B,GAAG,KAClC,OAAQ,EAA8B,GAAG,MAAM,YAC/C,CAAC,MAAM,QAAS,EAA8B,GAAG,CAAC,KACjD,EAA8B,GAAG,KAClC,OAAQ,EAA8B,GAAG,MAAM,YAC/C,CAAC,MAAM,QAAS,EAA8B,GAAG,CAAC,GAClD;AACA,YAAM,SAAS;AAAA,QACZ,EAA8B,GAAG;AAAA,QACjC,EAA8B,GAAG;AAAA,MACpC;AAEA,UAAI,OAAO,KAAK,MAAiC,EAAE,SAAS,GAAG;AAC7D,aAAK,GAAG,IAAI;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/template/internals/unmergeUsingTemplateRenderSnapshot.ts"],
|
|
4
4
|
"sourcesContent": ["import {type Json} from '@jakubmazanec/zod-utils';\nimport fs from 'fs-extra';\nimport json from 'json5';\nimport path from 'node:path';\nimport yaml from 'yaml';\n\nimport {CarsonTemplateError} from '../CarsonTemplateError.js';\nimport {prettify} from './prettify.js';\nimport {type TemplateRenderSnapshot} from './TemplateRenderSnapshot.js';\nimport {unmerge} from './unmerge.js';\n\nexport async function unmergeUsingTemplateRenderSnapshot(\n templateRenderSnapshot: TemplateRenderSnapshot,\n outputPath: string,\n) {\n let to = path.join(outputPath, templateRenderSnapshot.attributes.to);\n let extension = path.extname(to);\n\n if (!templateRenderSnapshot.content) {\n throw new CarsonTemplateError('INVALID_SNAPSHOT');\n }\n\n switch (extension) {\n case '.json': {\n let targetFile = (await fs.readJson(to)) as Json;\n let fileToMerge = json.parse<Json>(templateRenderSnapshot.content);\n let newFile = JSON.stringify(unmerge(targetFile, fileToMerge));\n\n await fs.writeFile(to, await prettify(newFile, to), {encoding: 'utf8'});\n\n break;\n }\n\n case '.yaml': {\n let targetFile = yaml.parse(await fs.readFile(to, {encoding: 'utf8'})) as unknown;\n let fileToMerge = yaml.parse(templateRenderSnapshot.content) as unknown;\n let newFile = yaml.stringify(unmerge(targetFile, fileToMerge));\n\n await fs.writeFile(to, await prettify(newFile, to), {encoding: 'utf8'});\n\n break;\n }\n\n default: {\n throw new CarsonTemplateError('INVALID_SNAPSHOT');\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AACA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,UAAU;AAEjB,SAAQ,2BAA0B;AAClC,SAAQ,gBAAe;AAEvB,SAAQ,eAAc;AAEtB,sBAAsB,mCACpB,wBACA,YACA;AACA,MAAI,KAAK,KAAK,KAAK,YAAY,uBAAuB,WAAW,EAAE;AACnE,MAAI,YAAY,KAAK,QAAQ,EAAE;AAE/B,MAAI,CAAC,uBAAuB,SAAS;AACnC,UAAM,IAAI,oBAAoB,kBAAkB;AAAA,EAClD;AAEA,UAAQ,WAAW;AAAA,IACjB,KAAK,SAAS;AACZ,UAAI,aAAc,MAAM,GAAG,SAAS,EAAE;AACtC,UAAI,cAAc,KAAK,MAAY,uBAAuB,OAAO;AACjE,UAAI,UAAU,KAAK,UAAU,QAAQ,YAAY,WAAW,CAAC;AAE7D,YAAM,GAAG,UAAU,IAAI,MAAM,SAAS,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAEtE;AAAA,IACF;AAAA,IAEA,KAAK,SAAS;AACZ,UAAI,aAAa,KAAK,MAAM,MAAM,GAAG,SAAS,IAAI,EAAC,UAAU,OAAM,CAAC,CAAC;AACrE,UAAI,cAAc,KAAK,MAAM,uBAAuB,OAAO;AAC3D,UAAI,UAAU,KAAK,UAAU,QAAQ,YAAY,WAAW,CAAC;AAE7D,YAAM,GAAG,UAAU,IAAI,MAAM,SAAS,SAAS,EAAE,GAAG,EAAC,UAAU,OAAM,CAAC;AAEtE;AAAA,IACF;AAAA,IAEA,SAAS;AACP,YAAM,IAAI,oBAAoB,kBAAkB;AAAA,IAClD;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/template/internals.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './internals/createUsingTemplateRender.js';\nexport * from './internals/deleteUsingTemplateRenderSnapshot.js';\nexport * from './internals/importCarsonTemplate.js';\nexport * from './internals/insertUsingTemplateRender.js';\nexport * from './internals/loadTemplateRenderSnapshots.js';\nexport * from './internals/merge.js';\nexport * from './internals/mergeUsingTemplateRender.js';\nexport * from './internals/overwriteUsingTemplateRender.js';\nexport * from './internals/parseCarsonTemplateId.js';\nexport * from './internals/prettify.js';\nexport * from './internals/readCarsonTemplate.js';\nexport * from './internals/resolveModule.js';\nexport * from './internals/saveTemplateRenderSnapshots.js';\nexport * from './internals/simplify.js';\nexport * from './internals/TemplateRenderSnapshot.js';\nexport * from './internals/TemplateRenderSnapshots.js';\nexport * from './internals/uninsertUsingTemplateRenderSnapshot.js';\nexport * from './internals/unmerge.js';\nexport * from './internals/unmergeUsingTemplateRenderSnapshot.js';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/template/renderCarsonTemplate.ts"],
|
|
4
4
|
"sourcesContent": ["import {pathToPosixPath} from '@jakubmazanec/fs-utils';\nimport {type TemplateError} from '@jakubmazanec/template';\nimport _ from 'lodash';\nimport path from 'node:path';\n\nimport {type CarsonTemplate} from './CarsonTemplate.js';\nimport {CarsonTemplateError} from './CarsonTemplateError.js';\nimport {importCarsonTemplate, parseCarsonTemplateId, resolveModule} from './internals.js';\nimport {type TemplateData} from './TemplateData.js';\nimport {type TemplateRenders} from './TemplateRenders.js';\n\nexport type RenderCarsonTemplateOptions = {\n template: CarsonTemplate;\n templateData: TemplateData;\n};\n\n/**\n * Renders a Carson template with provided template data.\n */\nexport async function renderCarsonTemplate(\n options: RenderCarsonTemplateOptions,\n): Promise<TemplateRenders> {\n let [moduleId] = parseCarsonTemplateId(options.template.id);\n let modulePath = await resolveModule(moduleId);\n let templateModule = await importCarsonTemplate(options.template.id);\n let templateRenders: TemplateRenders = [];\n\n for (let file of options.template.files) {\n let filePath = pathToPosixPath(\n `${moduleId}/${path.relative(modulePath, file.path ?? modulePath)}`,\n );\n\n try {\n templateRenders.push(\n ...(\n await file.render(\n {\n ...templateModule,\n ...options.templateData,\n },\n {disablePrettier: true},\n )\n ).map((templateRender) => ({\n ...templateRender,\n template: {\n path: filePath,\n },\n })),\n );\n } catch (error: unknown) {\n if ((error as InstanceType<typeof TemplateError>).code === 'FAILED_RENDER') {\n // rethrowing original FAILED_RENDER with more informative description\n throw new CarsonTemplateError('FAILED_RENDER', {\n messageParameters: [filePath],\n cause: (error as InstanceType<typeof TemplateError>).cause,\n });\n } else {\n throw error;\n }\n }\n }\n\n templateRenders = _.sortBy(templateRenders, [\n (templateRender) => templateRender.attributes.to,\n (templateRender) => templateRender.attributes.strategy,\n (templateRender) => templateRender.content,\n ]);\n\n return templateRenders;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,uBAAsB;AAE9B,OAAO,OAAO;AACd,OAAO,UAAU;AAGjB,SAAQ,2BAA0B;AAClC,SAAQ,sBAAsB,uBAAuB,qBAAoB;AAYzE,sBAAsB,qBACpB,SAC0B;AAC1B,MAAI,CAAC,QAAQ,IAAI,sBAAsB,QAAQ,SAAS,EAAE;AAC1D,MAAI,aAAa,MAAM,cAAc,QAAQ;AAC7C,MAAI,iBAAiB,MAAM,qBAAqB,QAAQ,SAAS,EAAE;AACnE,MAAI,kBAAmC,CAAC;AAExC,WAAS,QAAQ,QAAQ,SAAS,OAAO;AACvC,QAAI,WAAW;AAAA,MACb,GAAG,QAAQ,IAAI,KAAK,SAAS,YAAY,KAAK,QAAQ,UAAU,CAAC;AAAA,IACnE;AAEA,QAAI;AACF,sBAAgB;AAAA,QACd,IACE,MAAM,KAAK;AAAA,UACT;AAAA,YACE,GAAG;AAAA,YACH,GAAG,QAAQ;AAAA,UACb;AAAA,UACA,EAAC,iBAAiB,KAAI;AAAA,QACxB,GACA,IAAI,CAAC,oBAAoB;AAAA,UACzB,GAAG;AAAA,UACH,UAAU;AAAA,YACR,MAAM;AAAA,UACR;AAAA,QACF,EAAE;AAAA,MACJ;AAAA,IACF,SAAS,OAAgB;AACvB,UAAK,MAA6C,SAAS,iBAAiB;AAE1E,cAAM,IAAI,oBAAoB,iBAAiB;AAAA,UAC7C,mBAAmB,CAAC,QAAQ;AAAA,UAC5B,OAAQ,MAA6C;AAAA,QACvD,CAAC;AAAA,MACH,OAAO;AACL,cAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,oBAAkB,EAAE,OAAO,iBAAiB;AAAA,IAC1C,CAAC,mBAAmB,eAAe,WAAW;AAAA,IAC9C,CAAC,mBAAmB,eAAe,WAAW;AAAA,IAC9C,CAAC,mBAAmB,eAAe;AAAA,EACrC,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/template.js
CHANGED
package/build/template.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../source/template.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './template/applyTemplateRenders.js';\nexport type * from './template/CarsonTemplate.js';\nexport * from './template/CarsonTemplateConfig.js';\nexport * from './template/CarsonTemplateError.js';\nexport * from './template/renderCarsonTemplate.js';\nexport * from './template/TemplateAttributes.js';\nexport * from './template/TemplateData.js';\nexport type * from './template/TemplateRender.js';\nexport type * from './template/TemplateRenders.js';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/workspace/Project.ts"],
|
|
4
4
|
"sourcesContent": ["import {ensureEmptyDirectory, pathToPosixPath} from '@jakubmazanec/fs-utils';\nimport {type PackageJson, packageJsonSchema, readFile} from '@jakubmazanec/zod-utils';\nimport fs from 'fs-extra';\nimport json5 from 'json5';\nimport path from 'node:path';\nimport {z} from 'zod';\n\nimport {\n CARSON_CONFIG_DIRECTORY,\n PROJECT_CONFIG_FILENAME,\n PROJECT_SNAPSHOT_FILENAME,\n} from '../constants.js';\nimport {applyTemplateRenders} from '../template/applyTemplateRenders.js';\nimport {readCarsonTemplate} from '../template/internals.js';\nimport {renderCarsonTemplate} from '../template/renderCarsonTemplate.js';\nimport {type ProjectConfig, projectConfigSchema} from './ProjectConfig.js';\nimport {type ProjectCreateOptions} from './ProjectCreateOptions.js';\nimport {ProjectError} from './ProjectError.js';\nimport {type ProjectOptions} from './ProjectOptions.js';\nimport {type ProjectUpdateOptions} from './ProjectUpdateOptions.js';\nimport {saveProjectConfig} from './saveProjectConfig.js';\nimport {type Workspace} from './Workspace.js';\n\n/**\n * Project represent a self-contained piece of software (e.g. a package, or an app) that is part of a {@link Workspace}. Currently only Node.js projects are supported.\n *\n * @typeParam M If true, the project belongs to a multi-project workspace.\n */\nexport class Project<M extends boolean = true> {\n /** Project name. */\n name?: string;\n\n /** Project path. */\n path: string;\n\n /** Project path relative to workspace path. */\n relativePath: string;\n\n /** Project configuration; if it's not found, the default is an empty object. */\n config: ProjectConfig;\n\n /** Parsed project `package.json` file; if it's not found, the default is an empty object. */\n packageJson: PackageJson;\n\n /** Parent {@link Workspace} instance. */\n workspace: Workspace<M>;\n\n /** Errors found during reading from the file system. */\n errors: Array<InstanceType<typeof ProjectError>> = [];\n\n constructor({\n path: projectPath,\n name,\n config,\n packageJson,\n workspace,\n errors,\n }: ProjectOptions<M>) {\n // TODO: check that this path and workspace path are correct, i.e. project path must always be inside of workspace path\n this.path = projectPath;\n\n if (name) {\n this.name = name;\n }\n\n if (config) {\n this.config = config;\n } else {\n this.config = {};\n }\n\n if (packageJson) {\n this.packageJson = packageJson;\n } else {\n this.packageJson = {};\n }\n\n this.workspace = workspace;\n\n if (errors) {\n this.errors = errors;\n }\n\n if (this.packageJson.name?.length) {\n this.name = this.packageJson.name;\n }\n\n this.relativePath = pathToPosixPath(path.relative(this.workspace.path, this.path));\n }\n\n static async create<M extends boolean>({\n templateId,\n workspace,\n projectPath,\n projectName,\n args,\n }: ProjectCreateOptions<M>): Promise<Project<M>> {\n let project = new this({\n path: projectPath,\n name: projectName,\n config: {\n template: templateId,\n },\n workspace,\n });\n\n // if the workspace is single-project, it shares a directory with the project, so we can't insist on it being an empty directory\n if (workspace.isMultiProject) {\n try {\n await ensureEmptyDirectory(project.path);\n } catch {\n throw new ProjectError('PROJECT_PATH_NOT_EMPTY', {\n messageParameters: [project.path],\n data: {\n path: project.path,\n },\n });\n }\n }\n\n let template = await readCarsonTemplate(templateId);\n let templateRenders = await renderCarsonTemplate({\n template,\n templateData: {\n workspace,\n project,\n args,\n },\n });\n\n if (!template.config.autoEject && workspace.config.template) {\n await saveProjectConfig({projectPath: project.path, projectConfig: {template: templateId}});\n }\n\n await applyTemplateRenders({\n templateRenders,\n targetPath: project.path,\n snapshotPath:\n template.config.autoEject || !workspace.config.template ?\n undefined\n : path.join(project.path, CARSON_CONFIG_DIRECTORY, PROJECT_SNAPSHOT_FILENAME),\n ignoreStrategies: ['check'],\n });\n\n await project.read();\n\n return project;\n }\n\n static async read<M extends boolean>(\n projectPath: string,\n workspace: Workspace<M>,\n ): Promise<Project<M>> {\n let project = new this({\n path: projectPath,\n workspace,\n });\n\n await project.read();\n\n return project;\n }\n\n async read() {\n if (!(await fs.pathExists(this.path))) {\n throw new ProjectError('NO_SUCH_PROJECT_PATH', {\n messageParameters: [this.path],\n data: {\n path: this.path,\n },\n });\n }\n\n let errors: Array<InstanceType<typeof ProjectError>> = [];\n\n // load project config\n let projectConfigPath = path.join(this.path, CARSON_CONFIG_DIRECTORY, PROJECT_CONFIG_FILENAME);\n let doesProjectConfigExist = await fs.pathExists(projectConfigPath);\n let projectConfig: ProjectConfig | z.ZodError;\n\n if (doesProjectConfigExist) {\n projectConfig = await readFile(projectConfigPath, projectConfigSchema, {\n parser: (rawString: string) => json5.parse<unknown>(rawString),\n });\n } else {\n projectConfig = {};\n }\n\n if (projectConfig instanceof z.ZodError) {\n let zodError = projectConfig;\n\n errors.push(\n new ProjectError('INVALID_PROJECT_CONFIG', {\n messageParameters: [projectConfigPath],\n data: {\n path: projectConfigPath,\n zodIssues: zodError.issues,\n },\n }),\n );\n\n projectConfig = {};\n }\n\n // load package.json\n let packageJsonPath = path.join(this.path, 'package.json');\n let doesPackageJsonExist = await fs.pathExists(packageJsonPath);\n let packageJson: PackageJson | z.ZodError;\n\n if (doesPackageJsonExist) {\n packageJson = await readFile(packageJsonPath, packageJsonSchema, {\n parser: (rawString: string) => json5.parse<unknown>(rawString),\n });\n } else {\n packageJson = {};\n }\n\n if (packageJson instanceof z.ZodError) {\n let zodError = packageJson;\n\n errors.push(\n new ProjectError('INVALID_PACKAGE_JSON', {\n messageParameters: [packageJsonPath],\n data: {\n path: packageJsonPath,\n zodIssues: zodError.issues,\n },\n }),\n );\n\n packageJson = {};\n }\n\n if (packageJson.name?.length) {\n this.name = packageJson.name;\n }\n\n this.config = projectConfig;\n this.packageJson = packageJson;\n this.errors = errors;\n\n return this;\n }\n\n async update({args}: ProjectUpdateOptions): Promise<this> {\n if (!this.config.template) {\n throw new ProjectError('MISSING_CARSON_TEMPLATE_ID', {\n messageParameters: [path.join(this.path, CARSON_CONFIG_DIRECTORY, PROJECT_CONFIG_FILENAME)],\n });\n }\n\n let template = await readCarsonTemplate(this.config.template);\n let templateRenders = await renderCarsonTemplate({\n template,\n templateData: {\n workspace: this.workspace,\n project: this,\n args,\n },\n });\n\n await applyTemplateRenders({\n templateRenders,\n targetPath: this.path,\n snapshotPath:\n template.config.autoEject || !this.workspace.config.template ?\n undefined\n : path.join(this.path, CARSON_CONFIG_DIRECTORY, PROJECT_SNAPSHOT_FILENAME),\n ignoreStrategies: ['create'],\n });\n\n await this.read();\n\n return this;\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,sBAAsB,uBAAsB;AACpD,SAA0B,mBAAmB,gBAAe;AAC5D,OAAO,QAAQ;AACf,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAQ,SAAQ;AAEhB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAQ,4BAA2B;AACnC,SAAQ,0BAAyB;AACjC,SAAQ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,mBAAmB,CAAC,KAAK,KAAK,KAAK,MAAM,yBAAyB,uBAAuB,CAAC;AAAA,MAC5F,CAAC;AAAA,IACH;AAEA,QAAI,WAAW,MAAM,mBAAmB,KAAK,OAAO,QAAQ;AAC5D,QAAI,kBAAkB,MAAM,qBAAqB;AAAA,MAC/C;AAAA,MACA,cAAc;AAAA,QACZ,WAAW,KAAK;AAAA,QAChB,SAAS;AAAA,QACT;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,qBAAqB;AAAA,MACzB;AAAA,MACA,YAAY,KAAK;AAAA,MACjB,cACE,SAAS,OAAO,aAAa,CAAC,KAAK,UAAU,OAAO,WAClD,SACA,KAAK,KAAK,KAAK,MAAM,yBAAyB,yBAAyB;AAAA,MAC3E,kBAAkB,CAAC,QAAQ;AAAA,IAC7B,CAAC;AAED,UAAM,KAAK,KAAK;AAEhB,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/workspace/ProjectConfig.ts"],
|
|
4
4
|
"sourcesContent": ["import {z} from 'zod';\n\nexport const projectConfigSchema = z\n .object({\n template: z.string().optional(),\n })\n .catchall(z.unknown());\n\n/**\n * A project configuration.\n */\nexport type ProjectConfig = z.infer<typeof projectConfigSchema>;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,SAAQ;AAET,aAAM,sBAAsB,EAChC,OAAO;AAAA,EACN,UAAU,EAAE,OAAO,EAAE,SAAS;AAChC,CAAC,EACA,SAAS,EAAE,QAAQ,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/workspace/ProjectError.ts"],
|
|
4
4
|
"sourcesContent": ["import {createCustomErrorWithData} from '@jakubmazanec/error';\nimport {type ZodIssue} from 'zod';\n\n/**\n * A subclass of `Error` that indicates a project failure.\n */\nexport const ProjectError = createCustomErrorWithData(\n 'ProjectError',\n {\n INVALID_PACKAGE_JSON: 'Invalid package.json file \"{0}\".',\n INVALID_PROJECT_CONFIG: 'Invalid project config file \"{0}\".',\n NO_SUCH_PROJECT_PATH: 'Project path \"{0}\" doesn\\'t exist.',\n PROJECT_PATH_NOT_EMPTY: 'Project path \"{0}\" must be an empty directory.',\n MISSING_CARSON_TEMPLATE_ID: 'Project config \"{0}\" is missing the Carson template ID.',\n },\n class ProjectErrorData {\n path?: string;\n zodIssues?: ZodIssue[];\n },\n);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAQ,iCAAgC;AAMjC,aAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,sBAAsB;AAAA,IACtB,wBAAwB;AAAA,IACxB,sBAAsB;AAAA,IACtB,wBAAwB;AAAA,IACxB,4BAA4B;AAAA,EAC9B;AAAA,EACA,MAAM,iBAAiB;AAAA,IACrB;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|