@baseplate-dev/core-generators 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/generators/docker/docker-compose/docker-compose.generator.d.ts +1 -0
  2. package/dist/generators/docker/docker-compose/docker-compose.generator.d.ts.map +1 -1
  3. package/dist/generators/docker/docker-compose/docker-compose.generator.js +31 -1
  4. package/dist/generators/docker/docker-compose/docker-compose.generator.js.map +1 -1
  5. package/dist/generators/docker/docker-compose/postgres.d.ts +2 -0
  6. package/dist/generators/docker/docker-compose/postgres.d.ts.map +1 -1
  7. package/dist/generators/docker/docker-compose/postgres.js +17 -4
  8. package/dist/generators/docker/docker-compose/postgres.js.map +1 -1
  9. package/dist/generators/docker/docker-compose/redis.d.ts +3 -2
  10. package/dist/generators/docker/docker-compose/redis.d.ts.map +1 -1
  11. package/dist/generators/docker/docker-compose/redis.js +15 -4
  12. package/dist/generators/docker/docker-compose/redis.js.map +1 -1
  13. package/dist/generators/docker/docker-compose/types.d.ts +1 -0
  14. package/dist/generators/docker/docker-compose/types.d.ts.map +1 -1
  15. package/dist/generators/node/eslint/react-rules.d.ts.map +1 -1
  16. package/dist/generators/node/eslint/react-rules.js +18 -2
  17. package/dist/generators/node/eslint/react-rules.js.map +1 -1
  18. package/dist/generators/node/eslint/templates/eslint.config.js +4 -0
  19. package/dist/renderers/extractor/plugins/template-paths/paths-file.d.ts.map +1 -1
  20. package/dist/renderers/extractor/plugins/template-paths/paths-file.js +3 -4
  21. package/dist/renderers/extractor/plugins/template-paths/paths-file.js.map +1 -1
  22. package/dist/renderers/extractor/plugins/template-paths/template-paths.plugin.d.ts.map +1 -1
  23. package/dist/renderers/extractor/plugins/template-paths/template-paths.plugin.js +6 -1
  24. package/dist/renderers/extractor/plugins/template-paths/template-paths.plugin.js.map +1 -1
  25. package/dist/renderers/extractor/plugins/typed-templates-file.js +1 -1
  26. package/dist/renderers/extractor/plugins/typed-templates-file.js.map +1 -1
  27. package/dist/renderers/extractor/utils/deduplicate-templates.d.ts.map +1 -1
  28. package/dist/renderers/extractor/utils/deduplicate-templates.js +4 -3
  29. package/dist/renderers/extractor/utils/deduplicate-templates.js.map +1 -1
  30. package/dist/renderers/raw/index.d.ts +1 -0
  31. package/dist/renderers/raw/index.d.ts.map +1 -1
  32. package/dist/renderers/raw/index.js +1 -0
  33. package/dist/renderers/raw/index.js.map +1 -1
  34. package/dist/renderers/raw/raw-template-file-extractor.d.ts +10 -57
  35. package/dist/renderers/raw/raw-template-file-extractor.d.ts.map +1 -1
  36. package/dist/renderers/raw/raw-template-file-extractor.js +34 -18
  37. package/dist/renderers/raw/raw-template-file-extractor.js.map +1 -1
  38. package/dist/renderers/raw/render-raw-template-action.d.ts +2 -2
  39. package/dist/renderers/raw/render-raw-template-action.d.ts.map +1 -1
  40. package/dist/renderers/raw/render-raw-template-action.js +5 -10
  41. package/dist/renderers/raw/render-raw-template-action.js.map +1 -1
  42. package/dist/renderers/raw/render-raw-template-renderers.d.ts +10 -0
  43. package/dist/renderers/raw/render-raw-template-renderers.d.ts.map +1 -0
  44. package/dist/renderers/raw/render-raw-template-renderers.js +51 -0
  45. package/dist/renderers/raw/render-raw-template-renderers.js.map +1 -0
  46. package/dist/renderers/raw/types.d.ts +5 -67
  47. package/dist/renderers/raw/types.d.ts.map +1 -1
  48. package/dist/renderers/raw/types.js +2 -12
  49. package/dist/renderers/raw/types.js.map +1 -1
  50. package/dist/renderers/text/index.d.ts +1 -0
  51. package/dist/renderers/text/index.d.ts.map +1 -1
  52. package/dist/renderers/text/index.js +1 -0
  53. package/dist/renderers/text/index.js.map +1 -1
  54. package/dist/renderers/text/render-text-template-file-action.d.ts +1 -1
  55. package/dist/renderers/text/render-text-template-file-action.d.ts.map +1 -1
  56. package/dist/renderers/text/render-text-template-file-action.js +10 -19
  57. package/dist/renderers/text/render-text-template-file-action.js.map +1 -1
  58. package/dist/renderers/text/render-text-template-group-action.d.ts +1 -1
  59. package/dist/renderers/text/render-text-template-group-action.d.ts.map +1 -1
  60. package/dist/renderers/text/render-text-template-renderers.d.ts +10 -0
  61. package/dist/renderers/text/render-text-template-renderers.d.ts.map +1 -0
  62. package/dist/renderers/text/render-text-template-renderers.js +79 -0
  63. package/dist/renderers/text/render-text-template-renderers.js.map +1 -0
  64. package/dist/renderers/text/render-text-typed-templates.js +6 -6
  65. package/dist/renderers/text/render-text-typed-templates.js.map +1 -1
  66. package/dist/renderers/text/text-template-file-extractor.d.ts +14 -82
  67. package/dist/renderers/text/text-template-file-extractor.d.ts.map +1 -1
  68. package/dist/renderers/text/text-template-file-extractor.js +37 -22
  69. package/dist/renderers/text/text-template-file-extractor.js.map +1 -1
  70. package/dist/renderers/text/types.d.ts +12 -97
  71. package/dist/renderers/text/types.d.ts.map +1 -1
  72. package/dist/renderers/text/types.js +4 -21
  73. package/dist/renderers/text/types.js.map +1 -1
  74. package/dist/renderers/text/utils.d.ts +1 -2
  75. package/dist/renderers/text/utils.d.ts.map +1 -1
  76. package/dist/renderers/text/utils.js +2 -7
  77. package/dist/renderers/text/utils.js.map +1 -1
  78. package/dist/renderers/typescript/actions/render-ts-template-file-action.d.ts.map +1 -1
  79. package/dist/renderers/typescript/actions/render-ts-template-file-action.js +9 -13
  80. package/dist/renderers/typescript/actions/render-ts-template-file-action.js.map +1 -1
  81. package/dist/renderers/typescript/extractor/build-ts-project-export-map.d.ts +3 -1
  82. package/dist/renderers/typescript/extractor/build-ts-project-export-map.d.ts.map +1 -1
  83. package/dist/renderers/typescript/extractor/build-ts-project-export-map.js +14 -6
  84. package/dist/renderers/typescript/extractor/build-ts-project-export-map.js.map +1 -1
  85. package/dist/renderers/typescript/extractor/organize-ts-template-imports.js +1 -1
  86. package/dist/renderers/typescript/extractor/organize-ts-template-imports.js.map +1 -1
  87. package/dist/renderers/typescript/extractor/render-ts-import-providers.d.ts +2 -2
  88. package/dist/renderers/typescript/extractor/render-ts-import-providers.d.ts.map +1 -1
  89. package/dist/renderers/typescript/extractor/render-ts-import-providers.js +1 -1
  90. package/dist/renderers/typescript/extractor/render-ts-import-providers.js.map +1 -1
  91. package/dist/renderers/typescript/extractor/render-ts-template-renderers.d.ts +2 -2
  92. package/dist/renderers/typescript/extractor/render-ts-template-renderers.d.ts.map +1 -1
  93. package/dist/renderers/typescript/extractor/render-ts-template-renderers.js +5 -5
  94. package/dist/renderers/typescript/extractor/render-ts-template-renderers.js.map +1 -1
  95. package/dist/renderers/typescript/extractor/render-ts-typed-templates.d.ts +2 -2
  96. package/dist/renderers/typescript/extractor/render-ts-typed-templates.d.ts.map +1 -1
  97. package/dist/renderers/typescript/extractor/render-ts-typed-templates.js +12 -8
  98. package/dist/renderers/typescript/extractor/render-ts-typed-templates.js.map +1 -1
  99. package/dist/renderers/typescript/extractor/ts-template-file-extractor.d.ts +83 -158
  100. package/dist/renderers/typescript/extractor/ts-template-file-extractor.d.ts.map +1 -1
  101. package/dist/renderers/typescript/extractor/ts-template-file-extractor.js +46 -18
  102. package/dist/renderers/typescript/extractor/ts-template-file-extractor.js.map +1 -1
  103. package/dist/renderers/typescript/templates/types.d.ts +9 -104
  104. package/dist/renderers/typescript/templates/types.d.ts.map +1 -1
  105. package/dist/renderers/typescript/templates/types.js +1 -24
  106. package/dist/renderers/typescript/templates/types.js.map +1 -1
  107. package/package.json +4 -4
@@ -0,0 +1,79 @@
1
+ import { camelCase } from 'change-case';
2
+ import { groupBy } from 'es-toolkit';
3
+ import { GENERATED_PATHS_FILE_NAME, getPathsFileExportNames, } from '#src/renderers/extractor/plugins/template-paths/paths-file.js';
4
+ import { GENERATED_TYPED_TEMPLATES_FILE_NAME, getTypedTemplatesFileExportName, } from '#src/renderers/extractor/plugins/typed-templates-file.js';
5
+ import { resolvePackagePathSpecifier } from '#src/renderers/extractor/utils/index.js';
6
+ import { normalizeTsPathToJsPath } from '#src/utils/ts-paths.js';
7
+ import { tsImportBuilder } from '../typescript/imports/builder.js';
8
+ import { TsCodeUtils, tsTemplateWithImports, } from '../typescript/utils/ts-code-utils.js';
9
+ function createTextTaskDependencies(generatorName, usesPaths) {
10
+ const { rootExportName } = getPathsFileExportNames(generatorName);
11
+ return [
12
+ usesPaths
13
+ ? {
14
+ name: 'paths',
15
+ providerExpression: `${rootExportName}.provider`,
16
+ providerImportName: rootExportName,
17
+ providerImportSpecifier: normalizeTsPathToJsPath(`./${GENERATED_PATHS_FILE_NAME}`),
18
+ }
19
+ : undefined,
20
+ ].filter((x) => x !== undefined);
21
+ }
22
+ const builderActionTypeImport = TsCodeUtils.typeImportFragment('BuilderAction', '@baseplate-dev/sync');
23
+ function createTextRenderFunctionForTemplate(templateName, templateConfig, context) {
24
+ const isSingleton = templateConfig.fileOptions.kind === 'singleton';
25
+ const typedTemplatesExportName = getTypedTemplatesFileExportName(context.generatorName);
26
+ const templateExpression = tsTemplateWithImports(tsImportBuilder([typedTemplatesExportName]).from(`./${normalizeTsPathToJsPath(GENERATED_TYPED_TEMPLATES_FILE_NAME)}`)) `${typedTemplatesExportName}.${camelCase(templateName)}`;
27
+ return {
28
+ name: camelCase(templateName),
29
+ renderType: tsTemplateWithImports([
30
+ tsImportBuilder(['RenderTextTemplateFileActionInput'])
31
+ .typeOnly()
32
+ .from(resolvePackagePathSpecifier('@baseplate-dev/core-generators:src/renderers/text/render-text-template-file-action.ts', context.generatorPackageName)),
33
+ ]) `(options: Omit<RenderTextTemplateFileActionInput<typeof ${templateExpression}>, ${isSingleton ? "'destination' | " : ''}'template'>) => ${builderActionTypeImport}`,
34
+ renderFunction: tsTemplateWithImports([
35
+ tsImportBuilder(['renderTextTemplateFileAction']).from(resolvePackagePathSpecifier('@baseplate-dev/core-generators:src/renderers/text/render-text-template-file-action.ts', context.generatorPackageName)),
36
+ ]) `
37
+ (options) => renderTextTemplateFileAction(${TsCodeUtils.mergeFragmentsAsObjectPresorted({
38
+ template: templateExpression,
39
+ destination: isSingleton
40
+ ? `paths.${camelCase(templateName)}`
41
+ : undefined,
42
+ '...': 'options',
43
+ })})
44
+ `,
45
+ taskDependencies: createTextTaskDependencies(context.generatorName, templateConfig.fileOptions.kind === 'singleton'),
46
+ };
47
+ }
48
+ function createTextRenderFunctionForTemplateGroup(groupName, _templateConfigs, context) {
49
+ const typedTemplatesExportName = getTypedTemplatesFileExportName(context.generatorName);
50
+ const templatesExpression = tsTemplateWithImports(tsImportBuilder([typedTemplatesExportName]).from(`./${normalizeTsPathToJsPath(GENERATED_TYPED_TEMPLATES_FILE_NAME)}`)) `${typedTemplatesExportName}.${camelCase(groupName)}`;
51
+ return {
52
+ name: camelCase(groupName),
53
+ renderType: tsTemplateWithImports([
54
+ tsImportBuilder(['RenderTextTemplateGroupActionInput'])
55
+ .typeOnly()
56
+ .from(resolvePackagePathSpecifier('@baseplate-dev/core-generators:src/renderers/text/render-text-template-group-action.ts', context.generatorPackageName)),
57
+ ]) `(options: Omit<RenderTextTemplateGroupActionInput<typeof ${templatesExpression}>, 'group' | 'paths'>) => ${builderActionTypeImport}`,
58
+ renderFunction: tsTemplateWithImports([
59
+ tsImportBuilder(['renderTextTemplateGroupAction']).from(resolvePackagePathSpecifier('@baseplate-dev/core-generators:src/renderers/text/render-text-template-group-action.ts', context.generatorPackageName)),
60
+ ]) `
61
+ (options) => renderTextTemplateGroupAction(${TsCodeUtils.mergeFragmentsAsObjectPresorted({
62
+ group: templatesExpression,
63
+ paths: `paths`,
64
+ '...': 'options',
65
+ })})
66
+ `,
67
+ taskDependencies: createTextTaskDependencies(context.generatorName, true),
68
+ };
69
+ }
70
+ export function renderTextTemplateRenderers(templates, context) {
71
+ const templatesWithGroup = templates.filter((t) => t.config.group);
72
+ const templatesWithoutGroup = templates.filter((t) => !t.config.group);
73
+ const templateGroups = groupBy(templatesWithGroup, (t) => t.config.group ?? '');
74
+ return [
75
+ ...Object.entries(templateGroups).map(([groupName, templates]) => createTextRenderFunctionForTemplateGroup(`${groupName}Group`, templates.map((t) => t.config), context)),
76
+ ...templatesWithoutGroup.map((template) => createTextRenderFunctionForTemplate(template.name, template.config, context)),
77
+ ];
78
+ }
79
+ //# sourceMappingURL=render-text-template-renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-text-template-renderers.js","sourceRoot":"","sources":["../../../src/renderers/text/render-text-template-renderers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,+DAA+D,CAAC;AACvE,OAAO,EACL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,0DAA0D,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EACL,WAAW,EACX,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAO9C,SAAS,0BAA0B,CACjC,aAAqB,EACrB,SAAkB;IAElB,MAAM,EAAE,cAAc,EAAE,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAElE,OAAO;QACL,SAAS;YACP,CAAC,CAAC;gBACE,IAAI,EAAE,OAAO;gBACb,kBAAkB,EAAE,GAAG,cAAc,WAAW;gBAChD,kBAAkB,EAAE,cAAc;gBAClC,uBAAuB,EAAE,uBAAuB,CAC9C,KAAK,yBAAyB,EAAE,CACjC;aACF;YACH,CAAC,CAAC,SAAS;KACd,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,uBAAuB,GAAG,WAAW,CAAC,kBAAkB,CAC5D,eAAe,EACf,qBAAqB,CACtB,CAAC;AAEF,SAAS,mCAAmC,CAC1C,YAAoB,EACpB,cAAoC,EACpC,OAA2C;IAE3C,MAAM,WAAW,GAAG,c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E,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvE,MAAM,cAAc,GAAG,OAAO,CAC5B,kBAAkB,EAClB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAC5B,CAAC;IAEF,OAAO;QACL,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE,CAC/D,wCAAwC,CACtC,GAAG,SAAS,OAAO,EACnB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAC9B,OAAO,CACR,CACF;QACD,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxC,mCAAmC,CACjC,QAAQ,CAAC,IAAI,EACb,QAAQ,CAAC,MAAM,EACf,OAAO,CACR,CACF;KACF,CAAC;AACJ,CAAC"}
@@ -4,15 +4,15 @@ import { groupBy } from 'es-toolkit';
4
4
  import { resolvePackagePathSpecifier } from '#src/renderers/extractor/utils/package-path-specifier.js';
5
5
  import { tsImportBuilder } from '../typescript/imports/builder.js';
6
6
  import { TsCodeUtils, tsTemplate } from '../typescript/utils/ts-code-utils.js';
7
- function renderTextTypedTemplate(templatePath, metadata, { generatorPackageName }) {
8
- const exportName = camelCase(metadata.name);
7
+ function renderTextTypedTemplate(templateName, metadata, { generatorPackageName }) {
8
+ const exportName = camelCase(templateName);
9
9
  const createOptions = TsCodeUtils.mergeFragmentsAsObject({
10
- name: quot(metadata.name),
10
+ name: quot(templateName),
11
11
  group: metadata.group ? quot(metadata.group) : undefined,
12
12
  source: TsCodeUtils.templateWithImports([
13
13
  tsImportBuilder().default('path').from('node:path'),
14
14
  ]) `{
15
- path: path.join(import.meta.dirname, '../templates/${templatePath}'),
15
+ path: path.join(import.meta.dirname, '../templates/${metadata.sourceFile}'),
16
16
  }`,
17
17
  fileOptions: JSON.stringify(sortObjectKeys(metadata.fileOptions)),
18
18
  variables: JSON.stringify(sortObjectKeys(metadata.variables ?? {})),
@@ -27,7 +27,7 @@ function renderTextTypedTemplate(templatePath, metadata, { generatorPackageName
27
27
  }
28
28
  function renderTextTypedTemplateGroup(groupName, templates, context) {
29
29
  const renderedTemplates = templates
30
- .map(({ path, config }) => renderTextTypedTemplate(path, config, context))
30
+ .map(({ name, config }) => renderTextTypedTemplate(name, config, context))
31
31
  .toSorted((a, b) => a.exportName.localeCompare(b.exportName));
32
32
  const exportName = `${camelCase(groupName)}Group`;
33
33
  return {
@@ -44,7 +44,7 @@ export function renderTextTypedTemplates(templates, context) {
44
44
  const templatesByGroup = groupBy(templatesWithGroup, (t) => t.config.group ?? '');
45
45
  // Render the template groups
46
46
  const typedTemplateGroups = Object.entries(templatesByGroup).map(([groupName, templates]) => renderTextTypedTemplateGroup(groupName, templates, context));
47
- const typedTemplates = templatesWithoutGroup.map((t) => renderTextTypedTemplate(t.path, t.config, context));
47
+ const typedTemplates = templatesWithoutGroup.map((t) => renderTextTypedTemplate(t.name, t.config, context));
48
48
  return [...typedTemplateGroups, ...typedTemplates];
49
49
  }
50
50
  //# sourceMappingURL=render-text-typed-templates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-text-typed-templates.js","sourceRoot":"","sources":["../../../src/renderers/text/render-text-typed-templates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0DAA0D,CAAC;AAIvG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAM/E,SAAS,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AS,EAAE,OAAO,CAAC,CAC9D,CAAC;IAEF,MAAM,cAAc,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrD,uBAAuB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CACnD,CAAC;IAEF,OAAO,CAAC,GAAG,mBAAmB,EAAE,GAAG,cAAc,CAAC,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"render-text-typed-templates.js","sourceRoot":"","sources":["../../../src/renderers/text/render-text-typed-templates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0DAA0D,CAAC;AAIvG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAM/E,SAAS,uBAAuB,CAC9B,YAAoB,EACpB,QAAuC,EACvC,EAAE,oBAAoB,EAAkC;IAExD,MAAM,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,WAAW,CAAC,sBAAsB,CAAC;QACvD,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC;QACxB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;QACxD,MAAM,EAAE,WAAW,CAAC,mBAAmB,CAAC;YACtC,eAAe,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;SACpD,CAAC,CAAA;2DACqD,QAAQ,CAAC,UAAU;MACxE;QACF,WAAW,EAAE,IA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E,CACF,EAAE;SACJ,EACD,MAAM,CACP;QACD,UAAU;KACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,SAA0E,EAC1E,OAAuC;IAEvC,MAAM,kBAAkB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,MAAM,qBAAqB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvE,MAAM,gBAAgB,GAAG,OAAO,CAC9B,kBAAkB,EAClB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAC5B,CAAC;IAEF,6BAA6B;IAC7B,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAC9D,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE,CACzB,4BAA4B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAC9D,CAAC;IAEF,MAAM,cAAc,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrD,uBAAuB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CACnD,CAAC;IAEF,OAAO,CAAC,GAAG,mBAAmB,EAAE,GAAG,cAAc,CAAC,CAAC;AACrD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export declare const TextTemplateFileExtractor: import("@baseplate-dev/sync").TemplateFileExtractor<import("zod").ZodObject<import("zod").objectUtil.extendShape<{
2
- name: import("zod").ZodString;
2
+ sourceFile: import("zod").ZodString;
3
3
  type: import("zod").ZodString;
4
4
  }, {
5
5
  fileOptions: import("zod").ZodDefault<import("zod").ZodDiscriminatedUnion<"kind", [import("zod").ZodObject<{
@@ -34,7 +34,7 @@ export declare const TextTemplateFileExtractor: import("@baseplate-dev/sync").Te
34
34
  description?: string | undefined;
35
35
  }>>>;
36
36
  }>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
37
- name: import("zod").ZodString;
37
+ sourceFile: import("zod").ZodString;
38
38
  type: import("zod").ZodString;
39
39
  }, {
40
40
  fileOptions: import("zod").ZodDefault<import("zod").ZodDiscriminatedUnion<"kind", [import("zod").ZodObject<{
@@ -69,7 +69,7 @@ export declare const TextTemplateFileExtractor: import("@baseplate-dev/sync").Te
69
69
  description?: string | undefined;
70
70
  }>>>;
71
71
  }>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
72
- name: import("zod").ZodString;
72
+ sourceFile: import("zod").ZodString;
73
73
  type: import("zod").ZodString;
74
74
  }, {
75
75
  fileOptions: import("zod").ZodDefault<import("zod").ZodDiscriminatedUnion<"kind", [import("zod").ZodObject<{
@@ -103,80 +103,12 @@ export declare const TextTemplateFileExtractor: import("@baseplate-dev/sync").Te
103
103
  }, {
104
104
  description?: string | undefined;
105
105
  }>>>;
106
- }>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
107
- name: import("zod").ZodString;
108
- type: import("zod").ZodString;
109
- generator: import("zod").ZodString;
110
- }, {
111
- type: import("zod").ZodLiteral<"text">;
112
- fileOptions: import("zod").ZodDefault<import("zod").ZodDiscriminatedUnion<"kind", [import("zod").ZodObject<{
113
- kind: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodLiteral<"singleton">>>;
114
- generatorTemplatePath: import("zod").ZodOptional<import("zod").ZodString>;
115
- pathRootRelativePath: import("zod").ZodOptional<import("zod").ZodString>;
116
- }, "strip", import("zod").ZodTypeAny, {
117
- kind: "singleton";
118
- generatorTemplatePath?: string | undefined;
119
- pathRootRelativePath?: string | undefined;
120
- }, {
121
- kind?: "singleton" | undefined;
122
- generatorTemplatePath?: string | undefined;
123
- pathRootRelativePath?: string | undefined;
124
- }>, import("zod").ZodObject<{
125
- kind: import("zod").ZodLiteral<"instance">;
126
- generatorTemplatePath: import("zod").ZodString;
127
- }, "strip", import("zod").ZodTypeAny, {
128
- kind: "instance";
129
- generatorTemplatePath: string;
130
- }, {
131
- kind: "instance";
132
- generatorTemplatePath: string;
133
- }>]>>;
134
- group: import("zod").ZodOptional<import("zod").ZodString>;
135
- variables: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
136
- description: import("zod").ZodOptional<import("zod").ZodString>;
137
- }, {
138
- value: import("zod").ZodString;
139
- }>, "strip", import("zod").ZodTypeAny, {
140
- value: string;
141
- description?: string | undefined;
142
- }, {
143
- value: string;
144
- description?: string | undefined;
145
- }>>>;
146
- }>, "strip", import("zod").ZodTypeAny, {
147
- type: "text";
148
- name: string;
149
- fileOptions: {
150
- kind: "singleton";
151
- generatorTemplatePath?: string | undefined;
152
- pathRootRelativePath?: string | undefined;
153
- } | {
154
- kind: "instance";
155
- generatorTemplatePath: string;
156
- };
157
- generator: string;
158
- group?: string | undefined;
159
- variables?: Record<string, {
160
- value: string;
161
- description?: string | undefined;
162
- }> | undefined;
106
+ }>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
107
+ variables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
108
+ }, "strip", import("zod").ZodTypeAny, {
109
+ variables: Record<string, string>;
163
110
  }, {
164
- type: "text";
165
- name: string;
166
- generator: string;
167
- fileOptions?: {
168
- kind?: "singleton" | undefined;
169
- generatorTemplatePath?: string | undefined;
170
- pathRootRelativePath?: string | undefined;
171
- } | {
172
- kind: "instance";
173
- generatorTemplatePath: string;
174
- } | undefined;
175
- group?: string | undefined;
176
- variables?: Record<string, {
177
- value: string;
178
- description?: string | undefined;
179
- }> | undefined;
111
+ variables: Record<string, string>;
180
112
  }>, import("zod").ZodUnknown, (import("@baseplate-dev/sync").TemplateExtractorPlugin<"template-paths", {
181
113
  getPathRootRelativePath: (absolutePath: string) => string;
182
114
  getTemplatePathFromPathRootRelativePath: (pathRootRelativePath: string) => string;
@@ -206,10 +138,10 @@ export declare const TextTemplateFileExtractor: import("@baseplate-dev/sync").Te
206
138
  }, import("@baseplate-dev/sync").TemplateExtractorPlugin<"barrel-export", {
207
139
  addBarrelExport: (generatorName: string, barrelExport: import("../extractors.js").TemplateExtractorBarrelExport) => void;
208
140
  addGeneratedBarrelExport: (generatorName: string, generatedBarrelExport: import("../extractors.js").TemplateExtractorGeneratedBarrelExport) => void;
209
- }, []>[]>)[]>)[], {
210
- variables: Record<string, {
211
- value: string;
212
- description?: string | undefined;
213
- }>;
214
- }>;
141
+ }, []>[]>)[]> | import("@baseplate-dev/sync").TemplateExtractorPlugin<"template-renderers", {
142
+ addTemplateRenderer: (generatorName: string, rendererEntry: import("../extractor/plugins/template-renderers/types.js").TemplateRendererEntry) => void;
143
+ }, import("@baseplate-dev/sync").TemplateExtractorPlugin<"barrel-export", {
144
+ addBarrelExport: (generatorName: string, barrelExport: import("../extractors.js").TemplateExtractorBarrelExport) => void;
145
+ addGeneratedBarrelExport: (generatorName: string, generatedBarrelExport: import("../extractors.js").TemplateExtractorGeneratedBarrelExport) => void;
146
+ }, []>[]>)[]>;
215
147
  //# sourceMappingURL=text-template-file-extractor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-template-file-extractor.d.ts","sourceRoot":"","sources":["../../../src/renderers/text/text-template-file-extractor.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyGpC,CAAC"}
1
+ {"version":3,"file":"text-template-file-extractor.d.ts","sourceRoot":"","sources":["../../../src/renderers/text/text-template-file-extractor.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA+HpC,CAAC"}
@@ -1,39 +1,43 @@
1
1
  import { createTemplateFileExtractor, getGenerationConcurrencyLimit, } from '@baseplate-dev/sync';
2
- import { mapValues, omit } from 'es-toolkit';
2
+ import { mapValues } from 'es-toolkit';
3
3
  import pLimit from 'p-limit';
4
4
  import { templatePathsPlugin } from '../extractor/plugins/template-paths/template-paths.plugin.js';
5
+ import { templateRenderersPlugin } from '../extractor/plugins/template-renderers/template-renderers.plugin.js';
5
6
  import { typedTemplatesFilePlugin } from '../extractor/plugins/typed-templates-file.js';
6
7
  import { deduplicateTemplateFileExtractorSourceFiles } from '../extractor/utils/deduplicate-templates.js';
8
+ import { renderTextTemplateRenderers } from './render-text-template-renderers.js';
7
9
  import { renderTextTypedTemplates } from './render-text-typed-templates.js';
8
- import { textTemplateGeneratorTemplateMetadataSchema, textTemplateOutputTemplateMetadataSchema, } from './types.js';
10
+ import { textTemplateInstanceDataSchema, textTemplateMetadataSchema, } from './types.js';
9
11
  import { extractTemplateVariables } from './utils.js';
10
12
  const limit = pLimit(getGenerationConcurrencyLimit());
11
13
  export const TextTemplateFileExtractor = createTemplateFileExtractor({
12
14
  name: 'text',
13
- pluginDependencies: [templatePathsPlugin, typedTemplatesFilePlugin],
14
- outputTemplateMetadataSchema: textTemplateOutputTemplateMetadataSchema,
15
- generatorTemplateMetadataSchema: textTemplateGeneratorTemplateMetadataSchema,
15
+ pluginDependencies: [
16
+ templatePathsPlugin,
17
+ templateRenderersPlugin,
18
+ typedTemplatesFilePlugin,
19
+ ],
20
+ templateMetadataSchema: textTemplateMetadataSchema,
21
+ templateInstanceDataSchema: textTemplateInstanceDataSchema,
16
22
  extractTemplateMetadataEntries: (files, context) => {
17
23
  const deduplicatedFiles = deduplicateTemplateFileExtractorSourceFiles(files);
18
24
  const templatePathPlugin = context.getPlugin('template-paths');
19
- return deduplicatedFiles.map(({ metadata, absolutePath }) => {
25
+ return deduplicatedFiles.map(({ existingMetadata, instanceData, templateName, generatorName, absolutePath, }) => {
20
26
  try {
21
- const { pathRootRelativePath, generatorTemplatePath } = templatePathPlugin.resolveTemplatePaths(metadata.fileOptions, absolutePath, metadata.name, metadata.generator);
27
+ const { pathRootRelativePath, generatorTemplatePath } = templatePathPlugin.resolveTemplatePaths(existingMetadata.fileOptions, absolutePath, templateName, generatorName);
22
28
  return {
23
- generator: metadata.generator,
24
- generatorTemplatePath,
29
+ generator: generatorName,
25
30
  sourceAbsolutePath: absolutePath,
31
+ templateName,
26
32
  metadata: {
27
- name: metadata.name,
28
- type: metadata.type,
29
- group: metadata.group,
30
- fileOptions: metadata.fileOptions,
33
+ ...existingMetadata,
34
+ sourceFile: generatorTemplatePath,
31
35
  pathRootRelativePath,
32
- variables: mapValues(metadata.variables ?? {}, (variable) => omit(variable, ['value'])),
33
- },
34
- extractionContext: {
35
- variables: metadata.variables ?? {},
36
+ variables: mapValues(instanceData.variables, (_, key) => ({
37
+ description: existingMetadata.variables?.[key]?.description,
38
+ })),
36
39
  },
40
+ instanceData,
37
41
  };
38
42
  }
39
43
  catch (error) {
@@ -45,8 +49,8 @@ export const TextTemplateFileExtractor = createTemplateFileExtractor({
45
49
  await Promise.all(files.map((file) => limit(async () => {
46
50
  try {
47
51
  const contents = await api.readOutputFile(file.sourceAbsolutePath);
48
- const templateContents = extractTemplateVariables(contents, file.extractionContext?.variables ?? {}, file.sourceAbsolutePath);
49
- await api.writeTemplateFile(file.generator, file.generatorTemplatePath, templateContents);
52
+ const templateContents = extractTemplateVariables(contents, file.instanceData.variables, file.sourceAbsolutePath);
53
+ await api.writeTemplateFile(file.generator, file.metadata.sourceFile, templateContents);
50
54
  }
51
55
  catch (error) {
52
56
  throw new Error(`Error writing template file for ${file.sourceAbsolutePath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
@@ -55,21 +59,32 @@ export const TextTemplateFileExtractor = createTemplateFileExtractor({
55
59
  },
56
60
  writeGeneratedFiles: (generatorNames, context) => {
57
61
  const templatePathsPlugin = context.getPlugin('template-paths');
62
+ const templateRenderersPlugin = context.getPlugin('template-renderers');
58
63
  const typedTemplatesPlugin = context.getPlugin('typed-templates-file');
59
64
  for (const generatorName of generatorNames) {
60
65
  const generatorConfig = context.configLookup.getExtractorConfigOrThrow(generatorName);
61
- const templates = context.configLookup.getTemplatesForGenerator(generatorName, textTemplateGeneratorTemplateMetadataSchema, 'text');
66
+ const templates = context.configLookup.getTemplatesForGenerator(generatorName, textTemplateMetadataSchema, 'text');
67
+ // Add the typed templates to the typed templates plugin
62
68
  const typedTemplates = renderTextTypedTemplates(templates, {
63
69
  generatorPackageName: generatorConfig.packageName,
64
70
  });
65
71
  for (const typedTemplate of typedTemplates) {
66
72
  typedTemplatesPlugin.addTemplate(generatorName, typedTemplate);
67
73
  }
68
- for (const { config } of templates) {
74
+ // Add the path root relative paths to the template paths plugin
75
+ for (const { config, name } of templates) {
69
76
  if (config.pathRootRelativePath) {
70
- templatePathsPlugin.registerTemplatePathEntry(generatorName, config.name, config.pathRootRelativePath);
77
+ templatePathsPlugin.registerTemplatePathEntry(generatorName, name, config.pathRootRelativePath);
71
78
  }
72
79
  }
80
+ // Add the template renderer entries to the template renderers plugin
81
+ const templateRenderers = renderTextTemplateRenderers(templates, {
82
+ generatorPackageName: generatorConfig.packageName,
83
+ generatorName,
84
+ });
85
+ for (const templateRenderer of templateRenderers) {
86
+ templateRenderersPlugin.addTemplateRenderer(generatorName, templateRenderer);
87
+ }
73
88
  }
74
89
  },
75
90
  });
@@ -1 +1 @@
1
- {"version":3,"file":"text-template-file-extractor.js","sourceRoot":"","sources":["../../../src/renderers/text/text-template-file-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,2CAA2C,EAAE,MAAM,6CAA6C,CAAC;AAC1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EACL,2CAA2C,EAC3C,wCAAwC,GACzC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,KAAK,GAAG,MAAM,CAAC,6BAA6B,EAAE,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;IACnE,IAAI,EAAE,MAAM;IACZ,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,wBAAwB,CAAC;IACnE,4BAA4B,EAAE,wCAAwC;IACtE,+BAA+B,EAAE,2CAA2C;IAC5E,8BAA8B,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACjD,MAAM,iBAAiB,GACrB,2CAA2C,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAC/D,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE;YAC1D,IAAI,CAAC;gBACH,MAAM,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,GACnD,kBAAkB,CAAC,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;YAED,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;gBACnC,IAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC;oBAChC,mBAAmB,CAAC,yBAAyB,CAC3C,aAAa,EACb,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,oBAAoB,CAC5B,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"text-template-file-extractor.js","sourceRoot":"","sources":["../../../src/renderers/text/text-template-file-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,MAAM,MAAM,SAAS,CAAC;AAI7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,2CAA2C,EAAE,MAAM,6CAA6C,CAAC;AAC1G,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,KAAK,GAAG,MAAM,CAAC,6BAA6B,EAAE,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;IACnE,IAAI,EAAE,MAAM;IACZ,kBAAkB,EAAE;QAClB,mBAAmB;QACnB,uBAAuB;QACvB,wBAAwB;KACzB;IACD,sBAAsB,EAAE,0BAA0B;IAClD,0BAA0B,EAAE,8BAA8B;IAC1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wBAAwB,CAC7D,aAAa,EACb,0BAA0B,EAC1B,MAAM,CACP,CAAC;YAEF,wDAAwD;YACxD,MAAM,cAAc,GAAG,wBAAwB,CAAC,SAAS,EAAE;gBACzD,oBAAoB,EAAE,eAAe,CAAC,WAAW;aAClD,CAAC,CAAC;YACH,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;gBAC3C,oBAAoB,CAAC,WAAW,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;YACjE,CAAC;YAED,gEAAgE;YAChE,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,EAAE,CAAC;gBACzC,IAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC;oBAChC,mBAAmB,CAAC,yBAAyB,CAC3C,aAAa,EACb,IAAI,EACJ,MAAM,CAAC,oBAAoB,CAC5B,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,qEAAqE;YACrE,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,SAAS,EAAE;gBAC/D,oBAAoB,EAAE,eAAe,CAAC,WAAW;gBACjD,aAAa;aACd,CAAC,CAAC;YACH,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE,CAAC;gBACjD,uBAAuB,CAAC,mBAAmB,CACzC,aAAa,EACb,gBAAgB,CACjB,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -9,8 +9,8 @@ declare const textTemplateFileVariableSchema: z.ZodObject<{
9
9
  }, {
10
10
  description?: string | undefined;
11
11
  }>;
12
- export declare const textTemplateGeneratorTemplateMetadataSchema: z.ZodObject<z.objectUtil.extendShape<{
13
- name: z.ZodString;
12
+ export declare const textTemplateMetadataSchema: z.ZodObject<z.objectUtil.extendShape<{
13
+ sourceFile: z.ZodString;
14
14
  type: z.ZodString;
15
15
  }, {
16
16
  /**
@@ -57,7 +57,7 @@ export declare const textTemplateGeneratorTemplateMetadataSchema: z.ZodObject<z.
57
57
  description?: string | undefined;
58
58
  }>>>;
59
59
  }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
60
- name: z.ZodString;
60
+ sourceFile: z.ZodString;
61
61
  type: z.ZodString;
62
62
  }, {
63
63
  /**
@@ -104,7 +104,7 @@ export declare const textTemplateGeneratorTemplateMetadataSchema: z.ZodObject<z.
104
104
  description?: string | undefined;
105
105
  }>>>;
106
106
  }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
107
- name: z.ZodString;
107
+ sourceFile: z.ZodString;
108
108
  type: z.ZodString;
109
109
  }, {
110
110
  /**
@@ -151,107 +151,22 @@ export declare const textTemplateGeneratorTemplateMetadataSchema: z.ZodObject<z.
151
151
  description?: string | undefined;
152
152
  }>>>;
153
153
  }>, z.ZodTypeAny, "passthrough">>;
154
- export declare const textTemplateOutputTemplateMetadataSchema: z.ZodObject<z.objectUtil.extendShape<{
155
- name: z.ZodString;
156
- type: z.ZodString;
157
- generator: z.ZodString;
158
- }, {
159
- /**
160
- * The type of the template (always `text`)
161
- */
162
- type: z.ZodLiteral<"text">;
163
- /**
164
- * The options for the template file
165
- */
166
- fileOptions: z.ZodDefault<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
167
- kind: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"singleton">>>;
168
- generatorTemplatePath: z.ZodOptional<z.ZodString>;
169
- pathRootRelativePath: z.ZodOptional<z.ZodString>;
170
- }, "strip", z.ZodTypeAny, {
171
- kind: "singleton";
172
- generatorTemplatePath?: string | undefined;
173
- pathRootRelativePath?: string | undefined;
174
- }, {
175
- kind?: "singleton" | undefined;
176
- generatorTemplatePath?: string | undefined;
177
- pathRootRelativePath?: string | undefined;
178
- }>, z.ZodObject<{
179
- kind: z.ZodLiteral<"instance">;
180
- generatorTemplatePath: z.ZodString;
181
- }, "strip", z.ZodTypeAny, {
182
- kind: "instance";
183
- generatorTemplatePath: string;
184
- }, {
185
- kind: "instance";
186
- generatorTemplatePath: string;
187
- }>]>>;
188
- /**
189
- * The group to assign the template to when generating the typed templates.
190
- */
191
- group: z.ZodOptional<z.ZodString>;
154
+ export type TextTemplateMetadata = z.infer<typeof textTemplateMetadataSchema>;
155
+ export declare const textTemplateInstanceDataSchema: z.ZodObject<{
192
156
  /**
193
157
  * The variables for the template with their values.
194
158
  */
195
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<z.objectUtil.extendShape<{
196
- description: z.ZodOptional<z.ZodString>;
197
- }, {
198
- value: z.ZodString;
199
- }>, "strip", z.ZodTypeAny, {
200
- value: string;
201
- description?: string | undefined;
202
- }, {
203
- value: string;
204
- description?: string | undefined;
205
- }>>>;
206
- }>, "strip", z.ZodTypeAny, {
207
- type: "text";
208
- name: string;
209
- fileOptions: {
210
- kind: "singleton";
211
- generatorTemplatePath?: string | undefined;
212
- pathRootRelativePath?: string | undefined;
213
- } | {
214
- kind: "instance";
215
- generatorTemplatePath: string;
216
- };
217
- generator: string;
218
- group?: string | undefined;
219
- variables?: Record<string, {
220
- value: string;
221
- description?: string | undefined;
222
- }> | undefined;
159
+ variables: z.ZodRecord<z.ZodString, z.ZodString>;
160
+ }, "strip", z.ZodTypeAny, {
161
+ variables: Record<string, string>;
223
162
  }, {
224
- type: "text";
225
- name: string;
226
- generator: string;
227
- fileOptions?: {
228
- kind?: "singleton" | undefined;
229
- generatorTemplatePath?: string | undefined;
230
- pathRootRelativePath?: string | undefined;
231
- } | {
232
- kind: "instance";
233
- generatorTemplatePath: string;
234
- } | undefined;
235
- group?: string | undefined;
236
- variables?: Record<string, {
237
- value: string;
238
- description?: string | undefined;
239
- }> | undefined;
163
+ variables: Record<string, string>;
240
164
  }>;
241
- /**
242
- * Metadata for a text template file
243
- */
244
- export type TextTemplateOutputTemplateMetadata = z.infer<typeof textTemplateOutputTemplateMetadataSchema>;
165
+ export type TextTemplateInstanceData = z.infer<typeof textTemplateInstanceDataSchema>;
245
166
  /**
246
167
  * A variable for a text template.
247
168
  */
248
169
  export type TextTemplateFileVariable = z.infer<typeof textTemplateFileVariableSchema>;
249
- /**
250
- * A variable for a text template with a value.
251
- */
252
- export type TextTemplateFileVariableWithValue = TextTemplateFileVariable & {
253
- value: string;
254
- };
255
170
  /**
256
171
  * A template for a text file with replacements.
257
172
  */
@@ -276,6 +191,6 @@ export type TextTemplateGroup = Record<string, TextTemplateFile>;
276
191
  /**
277
192
  * Generator template metadata for text templates
278
193
  */
279
- export type TextGeneratorTemplateMetadata = z.infer<typeof textTemplateGeneratorTemplateMetadataSchema>;
194
+ export type TextGeneratorTemplateMetadata = z.infer<typeof textTemplateMetadataSchema>;
280
195
  export {};
281
196
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/renderers/text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI/E,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC,QAAA,MAAM,8BAA8B;;;;;;EAGlC,CAAC;AAEH,eAAO,MAAM,2CAA2C;UAXzB,EAAG,SAAS;UAE6B,EAAG,SAEzE;;IASE;;OAEG;;;;;;;;;;;;;;;;;;;;;;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;UA3BwB,EAAG,SAAS;UAE6B,EAAG,SAEzE;;IASE;;OAEG;;;;;;;;;;;;;;;;;;;;;;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;UA3BwB,EAAG,SAAS;UAE6B,EAAG,SAEzE;;IASE;;OAEG;;;;;;;;;;;;;;;;;;;;;;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;iCAEH,CAAC;AAEL,eAAO,MAAM,wCAAwC;UA/B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AQ,gBAAgB;IACxB;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,EAClD,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAEpD;AAED,MAAM,MAAM,sCAAsC,CAAC,CAAC,SAAS,gBAAgB,IAC3E;KACG,CAAC,IAAI,MAAM,CAAC,CAAC,WAAW,CAAC,GAAG,MAAM;CACpC,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,0BAA0B,CAClC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { templateConfigSchema, templateFileMetadataBaseSchema, } from '@baseplate-dev/sync';
1
+ import { templateConfigSchema } from '@baseplate-dev/sync';
2
2
  import { z } from 'zod';
3
3
  import { templateFileOptionsSchema } from '../schemas/template-file-options.js';
4
4
  export const TEXT_TEMPLATE_TYPE = 'text';
@@ -6,7 +6,7 @@ const textTemplateFileVariableSchema = z.object({
6
6
  // The description of the variable.
7
7
  description: z.string().optional(),
8
8
  });
9
- export const textTemplateGeneratorTemplateMetadataSchema = templateConfigSchema.extend({
9
+ export const textTemplateMetadataSchema = templateConfigSchema.extend({
10
10
  /**
11
11
  * The options for the template file
12
12
  */
@@ -24,28 +24,11 @@ export const textTemplateGeneratorTemplateMetadataSchema = templateConfigSchema.
24
24
  */
25
25
  variables: z.record(z.string(), textTemplateFileVariableSchema).optional(),
26
26
  });
27
- export const textTemplateOutputTemplateMetadataSchema = templateFileMetadataBaseSchema.extend({
28
- /**
29
- * The type of the template (always `text`)
30
- */
31
- type: z.literal(TEXT_TEMPLATE_TYPE),
32
- /**
33
- * The options for the template file
34
- */
35
- fileOptions: templateFileOptionsSchema,
36
- /**
37
- * The group to assign the template to when generating the typed templates.
38
- */
39
- group: z.string().optional(),
27
+ export const textTemplateInstanceDataSchema = z.object({
40
28
  /**
41
29
  * The variables for the template with their values.
42
30
  */
43
- variables: z
44
- .record(z.string(), textTemplateFileVariableSchema.extend({
45
- // The value of the variable.
46
- value: z.string(),
47
- }))
48
- .optional(),
31
+ variables: z.record(z.string(), z.string()),
49
32
  });
50
33
  /**
51
34
  * Create a text template file
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/renderers/text/types.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,mCAAmC;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2CAA2C,GACtD,oBAAoB,CAAC,MAAM,CAAC;IAC1B;;OAEG;IACH,WAAW,EAAE,yBAAyB;IACtC;;OAEG;IACH,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3C;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,8BAA8B,CAAC,CAAC,QAAQ,EAAE;CAC3E,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,wCAAwC,GACnD,8BAA8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