@jjlmoya/utils-textiles 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/package.json +1 -1
  2. package/src/pages/[locale]/[slug].astro +30 -14
  3. package/src/tests/locale_completeness.test.ts +0 -33
  4. package/src/tests/shared-test-helpers.ts +56 -0
  5. package/src/tests/tool_exports.test.ts +34 -0
  6. package/src/tool/burnTest/bibliography.astro +2 -10
  7. package/src/tool/burnTest/bibliography.ts +16 -0
  8. package/src/tool/burnTest/i18n/de.ts +2 -16
  9. package/src/tool/burnTest/i18n/en.ts +2 -16
  10. package/src/tool/burnTest/i18n/es.ts +2 -16
  11. package/src/tool/burnTest/i18n/fr.ts +2 -16
  12. package/src/tool/burnTest/i18n/id.ts +2 -16
  13. package/src/tool/burnTest/i18n/it.ts +2 -16
  14. package/src/tool/burnTest/i18n/ja.ts +2 -16
  15. package/src/tool/burnTest/i18n/ko.ts +2 -16
  16. package/src/tool/burnTest/i18n/nl.ts +2 -16
  17. package/src/tool/burnTest/i18n/pl.ts +2 -16
  18. package/src/tool/burnTest/i18n/pt.ts +2 -16
  19. package/src/tool/burnTest/i18n/ru.ts +2 -16
  20. package/src/tool/burnTest/i18n/sv.ts +2 -16
  21. package/src/tool/burnTest/i18n/tr.ts +2 -16
  22. package/src/tool/burnTest/i18n/zh.ts +2 -16
  23. package/src/tool/burnTest/index.ts +1 -0
  24. package/src/tool/burnTest/seo.astro +2 -27
  25. package/src/tool/burnTest/textile-burn-test.css +11 -11
  26. package/src/tool/clothingSizeConverter/bibliography.astro +2 -10
  27. package/src/tool/clothingSizeConverter/bibliography.ts +10 -0
  28. package/src/tool/clothingSizeConverter/clothing-size-converter.css +13 -13
  29. package/src/tool/clothingSizeConverter/i18n/de.ts +2 -10
  30. package/src/tool/clothingSizeConverter/i18n/en.ts +2 -10
  31. package/src/tool/clothingSizeConverter/i18n/es.ts +2 -10
  32. package/src/tool/clothingSizeConverter/i18n/fr.ts +2 -10
  33. package/src/tool/clothingSizeConverter/i18n/id.ts +2 -10
  34. package/src/tool/clothingSizeConverter/i18n/it.ts +2 -10
  35. package/src/tool/clothingSizeConverter/i18n/ja.ts +2 -10
  36. package/src/tool/clothingSizeConverter/i18n/ko.ts +2 -10
  37. package/src/tool/clothingSizeConverter/i18n/nl.ts +2 -10
  38. package/src/tool/clothingSizeConverter/i18n/pl.ts +2 -10
  39. package/src/tool/clothingSizeConverter/i18n/pt.ts +2 -10
  40. package/src/tool/clothingSizeConverter/i18n/ru.ts +2 -10
  41. package/src/tool/clothingSizeConverter/i18n/sv.ts +2 -10
  42. package/src/tool/clothingSizeConverter/i18n/tr.ts +2 -10
  43. package/src/tool/clothingSizeConverter/i18n/zh.ts +2 -10
  44. package/src/tool/clothingSizeConverter/index.ts +1 -0
  45. package/src/tool/clothingSizeConverter/seo.astro +2 -27
  46. package/src/tool/fabricProjectCalculator/bibliography.astro +2 -10
  47. package/src/tool/fabricProjectCalculator/bibliography.ts +16 -0
  48. package/src/tool/fabricProjectCalculator/fabric-project-calculator.css +12 -12
  49. package/src/tool/fabricProjectCalculator/i18n/de.ts +2 -16
  50. package/src/tool/fabricProjectCalculator/i18n/en.ts +2 -16
  51. package/src/tool/fabricProjectCalculator/i18n/es.ts +2 -16
  52. package/src/tool/fabricProjectCalculator/i18n/fr.ts +2 -16
  53. package/src/tool/fabricProjectCalculator/i18n/id.ts +2 -16
  54. package/src/tool/fabricProjectCalculator/i18n/it.ts +2 -16
  55. package/src/tool/fabricProjectCalculator/i18n/ja.ts +2 -16
  56. package/src/tool/fabricProjectCalculator/i18n/ko.ts +2 -16
  57. package/src/tool/fabricProjectCalculator/i18n/nl.ts +2 -16
  58. package/src/tool/fabricProjectCalculator/i18n/pl.ts +2 -16
  59. package/src/tool/fabricProjectCalculator/i18n/pt.ts +2 -16
  60. package/src/tool/fabricProjectCalculator/i18n/ru.ts +2 -16
  61. package/src/tool/fabricProjectCalculator/i18n/sv.ts +2 -16
  62. package/src/tool/fabricProjectCalculator/i18n/tr.ts +2 -16
  63. package/src/tool/fabricProjectCalculator/i18n/zh.ts +2 -16
  64. package/src/tool/fabricProjectCalculator/index.ts +1 -0
  65. package/src/tool/fabricProjectCalculator/seo.astro +2 -27
  66. package/src/tool/fabricTruth/bibliography.astro +2 -10
  67. package/src/tool/fabricTruth/bibliography.ts +16 -0
  68. package/src/tool/fabricTruth/fabric-truthfulness.css +11 -11
  69. package/src/tool/fabricTruth/i18n/de.ts +2 -16
  70. package/src/tool/fabricTruth/i18n/en.ts +2 -16
  71. package/src/tool/fabricTruth/i18n/es.ts +2 -16
  72. package/src/tool/fabricTruth/i18n/fr.ts +2 -16
  73. package/src/tool/fabricTruth/i18n/id.ts +2 -16
  74. package/src/tool/fabricTruth/i18n/it.ts +2 -16
  75. package/src/tool/fabricTruth/i18n/ja.ts +2 -16
  76. package/src/tool/fabricTruth/i18n/ko.ts +2 -16
  77. package/src/tool/fabricTruth/i18n/nl.ts +2 -16
  78. package/src/tool/fabricTruth/i18n/pl.ts +2 -16
  79. package/src/tool/fabricTruth/i18n/pt.ts +2 -16
  80. package/src/tool/fabricTruth/i18n/ru.ts +2 -16
  81. package/src/tool/fabricTruth/i18n/sv.ts +2 -16
  82. package/src/tool/fabricTruth/i18n/tr.ts +2 -16
  83. package/src/tool/fabricTruth/i18n/zh.ts +2 -16
  84. package/src/tool/fabricTruth/index.ts +1 -0
  85. package/src/tool/fabricTruth/seo.astro +2 -27
  86. package/src/tool/fiberPrep/bibliography.astro +2 -10
  87. package/src/tool/fiberPrep/bibliography.ts +12 -0
  88. package/src/tool/fiberPrep/i18n/de.ts +2 -12
  89. package/src/tool/fiberPrep/i18n/en.ts +2 -12
  90. package/src/tool/fiberPrep/i18n/es.ts +2 -12
  91. package/src/tool/fiberPrep/i18n/fr.ts +2 -12
  92. package/src/tool/fiberPrep/i18n/id.ts +2 -12
  93. package/src/tool/fiberPrep/i18n/it.ts +2 -12
  94. package/src/tool/fiberPrep/i18n/ja.ts +2 -12
  95. package/src/tool/fiberPrep/i18n/ko.ts +2 -12
  96. package/src/tool/fiberPrep/i18n/nl.ts +2 -12
  97. package/src/tool/fiberPrep/i18n/pl.ts +2 -12
  98. package/src/tool/fiberPrep/i18n/pt.ts +2 -12
  99. package/src/tool/fiberPrep/i18n/ru.ts +2 -12
  100. package/src/tool/fiberPrep/i18n/sv.ts +2 -12
  101. package/src/tool/fiberPrep/i18n/tr.ts +2 -12
  102. package/src/tool/fiberPrep/i18n/zh.ts +2 -12
  103. package/src/tool/fiberPrep/index.ts +1 -0
  104. package/src/tool/fiberPrep/seo.astro +2 -27
  105. package/src/tool/knittingGauge/bibliography.astro +2 -10
  106. package/src/tool/knittingGauge/bibliography.ts +12 -0
  107. package/src/tool/knittingGauge/i18n/de.ts +2 -12
  108. package/src/tool/knittingGauge/i18n/en.ts +2 -12
  109. package/src/tool/knittingGauge/i18n/es.ts +2 -12
  110. package/src/tool/knittingGauge/i18n/fr.ts +2 -12
  111. package/src/tool/knittingGauge/i18n/id.ts +2 -12
  112. package/src/tool/knittingGauge/i18n/it.ts +2 -12
  113. package/src/tool/knittingGauge/i18n/ja.ts +2 -12
  114. package/src/tool/knittingGauge/i18n/ko.ts +2 -12
  115. package/src/tool/knittingGauge/i18n/nl.ts +2 -12
  116. package/src/tool/knittingGauge/i18n/pl.ts +2 -12
  117. package/src/tool/knittingGauge/i18n/pt.ts +2 -12
  118. package/src/tool/knittingGauge/i18n/ru.ts +2 -12
  119. package/src/tool/knittingGauge/i18n/sv.ts +2 -12
  120. package/src/tool/knittingGauge/i18n/tr.ts +2 -12
  121. package/src/tool/knittingGauge/i18n/zh.ts +2 -12
  122. package/src/tool/knittingGauge/index.ts +1 -0
  123. package/src/tool/knittingGauge/knitting-gauge-calculator.css +9 -9
  124. package/src/tool/knittingGauge/seo.astro +2 -27
  125. package/src/tool/laundryGuide/bibliography.astro +2 -10
  126. package/src/tool/laundryGuide/bibliography.ts +6 -0
  127. package/src/tool/laundryGuide/i18n/de.ts +2 -6
  128. package/src/tool/laundryGuide/i18n/en.ts +2 -6
  129. package/src/tool/laundryGuide/i18n/es.ts +2 -6
  130. package/src/tool/laundryGuide/i18n/fr.ts +2 -6
  131. package/src/tool/laundryGuide/i18n/id.ts +2 -6
  132. package/src/tool/laundryGuide/i18n/it.ts +2 -6
  133. package/src/tool/laundryGuide/i18n/ja.ts +2 -6
  134. package/src/tool/laundryGuide/i18n/ko.ts +2 -6
  135. package/src/tool/laundryGuide/i18n/nl.ts +2 -6
  136. package/src/tool/laundryGuide/i18n/pl.ts +2 -6
  137. package/src/tool/laundryGuide/i18n/pt.ts +2 -6
  138. package/src/tool/laundryGuide/i18n/ru.ts +2 -6
  139. package/src/tool/laundryGuide/i18n/sv.ts +2 -6
  140. package/src/tool/laundryGuide/i18n/tr.ts +2 -6
  141. package/src/tool/laundryGuide/i18n/zh.ts +2 -6
  142. package/src/tool/laundryGuide/index.ts +1 -0
  143. package/src/tool/laundryGuide/seo.astro +2 -27
  144. package/src/tool/needleConverter/bibliography.astro +2 -10
  145. package/src/tool/needleConverter/bibliography.ts +12 -0
  146. package/src/tool/needleConverter/i18n/de.ts +2 -12
  147. package/src/tool/needleConverter/i18n/en.ts +2 -12
  148. package/src/tool/needleConverter/i18n/es.ts +2 -12
  149. package/src/tool/needleConverter/i18n/fr.ts +2 -12
  150. package/src/tool/needleConverter/i18n/id.ts +2 -12
  151. package/src/tool/needleConverter/i18n/it.ts +2 -12
  152. package/src/tool/needleConverter/i18n/ja.ts +2 -12
  153. package/src/tool/needleConverter/i18n/ko.ts +2 -12
  154. package/src/tool/needleConverter/i18n/nl.ts +2 -12
  155. package/src/tool/needleConverter/i18n/pl.ts +2 -12
  156. package/src/tool/needleConverter/i18n/pt.ts +2 -12
  157. package/src/tool/needleConverter/i18n/ru.ts +2 -12
  158. package/src/tool/needleConverter/i18n/sv.ts +2 -12
  159. package/src/tool/needleConverter/i18n/tr.ts +2 -12
  160. package/src/tool/needleConverter/i18n/zh.ts +2 -12
  161. package/src/tool/needleConverter/index.ts +1 -0
  162. package/src/tool/needleConverter/knitting-needle-converter.css +13 -13
  163. package/src/tool/needleConverter/seo.astro +1 -1
  164. package/src/tool/sewingPatternScaler/bibliography.astro +2 -10
  165. package/src/tool/sewingPatternScaler/bibliography.ts +12 -0
  166. package/src/tool/sewingPatternScaler/i18n/de.ts +2 -12
  167. package/src/tool/sewingPatternScaler/i18n/en.ts +2 -12
  168. package/src/tool/sewingPatternScaler/i18n/es.ts +2 -12
  169. package/src/tool/sewingPatternScaler/i18n/fr.ts +2 -12
  170. package/src/tool/sewingPatternScaler/i18n/id.ts +2 -12
  171. package/src/tool/sewingPatternScaler/i18n/it.ts +2 -12
  172. package/src/tool/sewingPatternScaler/i18n/ja.ts +2 -12
  173. package/src/tool/sewingPatternScaler/i18n/ko.ts +2 -12
  174. package/src/tool/sewingPatternScaler/i18n/nl.ts +2 -12
  175. package/src/tool/sewingPatternScaler/i18n/pl.ts +2 -12
  176. package/src/tool/sewingPatternScaler/i18n/pt.ts +2 -12
  177. package/src/tool/sewingPatternScaler/i18n/ru.ts +2 -12
  178. package/src/tool/sewingPatternScaler/i18n/sv.ts +2 -12
  179. package/src/tool/sewingPatternScaler/i18n/tr.ts +2 -12
  180. package/src/tool/sewingPatternScaler/i18n/zh.ts +2 -12
  181. package/src/tool/sewingPatternScaler/index.ts +1 -0
  182. package/src/tool/sewingPatternScaler/seo.astro +2 -36
  183. package/src/tool/sewingPatternScaler/sewing-pattern-scaler.css +8 -8
  184. package/src/tool/shoeSizeConverter/bibliography.astro +2 -10
  185. package/src/tool/shoeSizeConverter/bibliography.ts +7 -0
  186. package/src/tool/shoeSizeConverter/i18n/de.ts +2 -7
  187. package/src/tool/shoeSizeConverter/i18n/en.ts +2 -7
  188. package/src/tool/shoeSizeConverter/i18n/es.ts +2 -7
  189. package/src/tool/shoeSizeConverter/i18n/fr.ts +2 -7
  190. package/src/tool/shoeSizeConverter/i18n/id.ts +2 -7
  191. package/src/tool/shoeSizeConverter/i18n/it.ts +2 -7
  192. package/src/tool/shoeSizeConverter/i18n/ja.ts +2 -7
  193. package/src/tool/shoeSizeConverter/i18n/ko.ts +2 -7
  194. package/src/tool/shoeSizeConverter/i18n/nl.ts +2 -7
  195. package/src/tool/shoeSizeConverter/i18n/pl.ts +2 -7
  196. package/src/tool/shoeSizeConverter/i18n/pt.ts +2 -7
  197. package/src/tool/shoeSizeConverter/i18n/ru.ts +2 -7
  198. package/src/tool/shoeSizeConverter/i18n/sv.ts +2 -7
  199. package/src/tool/shoeSizeConverter/i18n/tr.ts +2 -7
  200. package/src/tool/shoeSizeConverter/i18n/zh.ts +2 -7
  201. package/src/tool/shoeSizeConverter/index.ts +1 -0
  202. package/src/tool/shoeSizeConverter/seo.astro +2 -27
  203. package/src/tool/shoeSizeConverter/shoe-size-converter.css +3 -3
  204. package/src/tool/stainChemistry/bibliography.astro +2 -10
  205. package/src/tool/stainChemistry/bibliography.ts +16 -0
  206. package/src/tool/stainChemistry/i18n/de.ts +2 -16
  207. package/src/tool/stainChemistry/i18n/en.ts +2 -16
  208. package/src/tool/stainChemistry/i18n/es.ts +2 -16
  209. package/src/tool/stainChemistry/i18n/fr.ts +2 -16
  210. package/src/tool/stainChemistry/i18n/id.ts +2 -16
  211. package/src/tool/stainChemistry/i18n/it.ts +2 -16
  212. package/src/tool/stainChemistry/i18n/ja.ts +2 -16
  213. package/src/tool/stainChemistry/i18n/ko.ts +2 -16
  214. package/src/tool/stainChemistry/i18n/nl.ts +2 -16
  215. package/src/tool/stainChemistry/i18n/pl.ts +2 -16
  216. package/src/tool/stainChemistry/i18n/pt.ts +2 -16
  217. package/src/tool/stainChemistry/i18n/ru.ts +2 -16
  218. package/src/tool/stainChemistry/i18n/sv.ts +2 -16
  219. package/src/tool/stainChemistry/i18n/tr.ts +2 -16
  220. package/src/tool/stainChemistry/i18n/zh.ts +2 -16
  221. package/src/tool/stainChemistry/index.ts +1 -0
  222. package/src/tool/stainChemistry/seo.astro +2 -27
  223. package/src/tool/stainChemistry/stain-chemical-protocol.css +3 -3
  224. package/src/tool/yarnCalculator/bibliography.astro +2 -10
  225. package/src/tool/yarnCalculator/bibliography.ts +16 -0
  226. package/src/tool/yarnCalculator/i18n/de.ts +2 -16
  227. package/src/tool/yarnCalculator/i18n/en.ts +2 -16
  228. package/src/tool/yarnCalculator/i18n/es.ts +2 -16
  229. package/src/tool/yarnCalculator/i18n/fr.ts +2 -16
  230. package/src/tool/yarnCalculator/i18n/id.ts +2 -16
  231. package/src/tool/yarnCalculator/i18n/it.ts +2 -16
  232. package/src/tool/yarnCalculator/i18n/ja.ts +2 -16
  233. package/src/tool/yarnCalculator/i18n/ko.ts +2 -16
  234. package/src/tool/yarnCalculator/i18n/nl.ts +2 -16
  235. package/src/tool/yarnCalculator/i18n/pl.ts +2 -16
  236. package/src/tool/yarnCalculator/i18n/pt.ts +2 -16
  237. package/src/tool/yarnCalculator/i18n/ru.ts +2 -16
  238. package/src/tool/yarnCalculator/i18n/sv.ts +2 -16
  239. package/src/tool/yarnCalculator/i18n/tr.ts +2 -16
  240. package/src/tool/yarnCalculator/i18n/zh.ts +2 -16
  241. package/src/tool/yarnCalculator/index.ts +1 -0
  242. package/src/tool/yarnCalculator/seo.astro +2 -1
  243. package/src/tool/yarnCalculator/yarn-calculator.css +7 -7
  244. package/src/types.ts +2 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/utils-textiles",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -34,18 +34,28 @@ export async function getStaticPaths() {
34
34
  ]),
35
35
  ) as Partial<Record<KnownLocale, string>>;
36
36
 
37
+ const firstLoader = entry.i18n.en ?? Object.values(entry.i18n)[0];
38
+ const englishSlug = firstLoader ? (await firstLoader()).slug : entry.id;
39
+
37
40
  for (const { locale, content } of localeContents) {
38
- const allToolsNav = await Promise.all(
39
- ALL_TOOLS.map(async ({ entry: navEntry }) => ({
40
- id: navEntry.id,
41
- title: (await navEntry.i18n[locale]!()).title,
42
- href: `/${locale}/${(await navEntry.i18n[locale]!()).slug}`,
43
- isActive: navEntry.id === entry.id,
44
- })),
45
- );
41
+ const allToolsNav = (
42
+ await Promise.all(
43
+ ALL_TOOLS.map(async ({ entry: navEntry }) => {
44
+ const loader = navEntry.i18n[locale] ?? navEntry.i18n.en;
45
+ if (!loader) return null;
46
+ const navContent = await loader();
47
+ return {
48
+ id: navEntry.id,
49
+ title: navContent.title,
50
+ href: `/${locale}/${navContent.slug}`,
51
+ isActive: navEntry.id === entry.id,
52
+ };
53
+ }),
54
+ )
55
+ ).filter(Boolean) as NavItem[];
46
56
  paths.push({
47
57
  params: { locale, slug: content.slug },
48
- props: { Component, locale, content, localeUrls, allToolsNav },
58
+ props: { Component, locale, content, localeUrls, allToolsNav, englishSlug },
49
59
  });
50
60
  }
51
61
  }
@@ -66,11 +76,16 @@ interface Props {
66
76
  content: ToolLocaleContent;
67
77
  localeUrls: Partial<Record<KnownLocale, string>>;
68
78
  allToolsNav: NavItem[];
79
+ englishSlug: string;
69
80
  }
70
81
 
71
- const { Component, locale, content, localeUrls, allToolsNav } = Astro.props;
82
+ const { Component, locale, content, localeUrls, allToolsNav, englishSlug } = Astro.props;
83
+
84
+ const cssFiles = import.meta.glob("../../tool/*/*.css", { query: "?raw", import: "default" });
85
+ const cssKey = Object.keys(cssFiles).find((k) => k.endsWith(`/${englishSlug}.css`));
86
+ const toolCss = cssKey ? await cssFiles[cssKey]() as string : "";
72
87
 
73
- const seoContent: UtilitySEOContent = { locale, sections: content.seo };
88
+ const seoContent: UtilitySEOContent = { locale, sections: content.seo ?? [] };
74
89
 
75
90
  const words = content.title.split(" ");
76
91
  const titleHighlight = words[0] || "";
@@ -89,8 +104,9 @@ const titleBase = words.slice(1).join(" ") || "";
89
104
  tools={allToolsNav}
90
105
  />
91
106
  <Fragment slot="head">
107
+ {toolCss ? <Fragment set:html={`<style is:inline>${toolCss}</style>`} /> : null}
92
108
  {
93
- content.schemas.map((schema: unknown) => (
109
+ ( content.schemas ?? []).map((schema: unknown) => (
94
110
  <script
95
111
  is:inline
96
112
  type="application/ld+json"
@@ -116,11 +132,11 @@ const titleBase = words.slice(1).join(" ") || "";
116
132
  </section>
117
133
 
118
134
  <section class="section-faq">
119
- <FAQSection items={content.faq} title={content.ui.faqTitle} inLanguage={locale} />
135
+ <FAQSection items={content.faq} inLanguage={locale} />
120
136
  </section>
121
137
 
122
138
  <section class="section-bibliography">
123
- <Bibliography links={content.bibliography} title={content.ui.bibliographyTitle} />
139
+ <Bibliography links={content.bibliography} />
124
140
  </section>
125
141
  </div>
126
142
  </PreviewLayout>
@@ -1,40 +1,7 @@
1
1
  import { describe, it, expect } from 'vitest';
2
2
  import { ALL_TOOLS } from '../tools';
3
- import type { ToolLocaleContent } from '../types';
4
3
 
5
4
  describe('Locale Completeness Validation', () => {
6
- ALL_TOOLS.forEach((tool) => {
7
- describe(`Tool: ${tool.entry.id}`, () => {
8
- Object.keys(tool.entry.i18n).forEach((locale) => {
9
- describe(`Locale: ${locale}`, () => {
10
- it('faqTitle should be defined when faq items exist', async () => {
11
- const loader = tool.entry.i18n[locale as keyof typeof tool.entry.i18n];
12
- const content = (await loader?.()) as ToolLocaleContent;
13
-
14
- if (content.faq.length > 0) {
15
- expect(
16
- content.faqTitle,
17
- `Tool "${tool.entry.id}" locale "${locale}" has ${content.faq.length} FAQ items but is missing faqTitle`,
18
- ).toBeTruthy();
19
- }
20
- });
21
-
22
- it('bibliographyTitle should be defined when bibliography items exist', async () => {
23
- const loader = tool.entry.i18n[locale as keyof typeof tool.entry.i18n];
24
- const content = (await loader?.()) as ToolLocaleContent;
25
-
26
- if (content.bibliography.length > 0) {
27
- expect(
28
- content.bibliographyTitle,
29
- `Tool "${tool.entry.id}" locale "${locale}" has ${content.bibliography.length} bibliography items but is missing bibliographyTitle`,
30
- ).toBeTruthy();
31
- }
32
- });
33
- });
34
- });
35
- });
36
- });
37
-
38
5
  it('should have at least 1 tool registered', () => {
39
6
  expect(ALL_TOOLS.length).toBeGreaterThan(0);
40
7
  });
@@ -0,0 +1,56 @@
1
+ import type { ToolDefinition } from '../types';
2
+
3
+ export interface ToolExportValidationResult {
4
+ passed: boolean;
5
+ failures: string[];
6
+ }
7
+
8
+ function validateComponentType(
9
+ toolId: string,
10
+ componentName: string,
11
+ component: unknown,
12
+ failures: string[],
13
+ ): void {
14
+ if (typeof component !== 'function') {
15
+ failures.push(`${toolId}: ${componentName} is not a function (${typeof component})`);
16
+ }
17
+ }
18
+
19
+ async function validateComponentExecution(
20
+ toolId: string,
21
+ componentName: string,
22
+ fn: () => Promise<unknown>,
23
+ failures: string[],
24
+ ): Promise<void> {
25
+ try {
26
+ const result = await fn();
27
+ if (!result || typeof result !== 'object') {
28
+ failures.push(`${toolId}: ${componentName} import returned invalid result`);
29
+ }
30
+ } catch (error) {
31
+ failures.push(`${toolId}: ${componentName} execution error - ${error instanceof Error ? error.message : 'unknown'}`);
32
+ }
33
+ }
34
+
35
+ export async function validateToolExports(tools: ToolDefinition[]): Promise<ToolExportValidationResult> {
36
+ const failures: string[] = [];
37
+
38
+ for (const tool of tools) {
39
+ validateComponentType(tool.entry.id, 'Component', tool.Component, failures);
40
+ validateComponentType(tool.entry.id, 'SEOComponent', tool.SEOComponent, failures);
41
+ validateComponentType(tool.entry.id, 'BibliographyComponent', tool.BibliographyComponent, failures);
42
+
43
+ const componentFn = tool.Component as () => Promise<unknown>;
44
+ const seoFn = tool.SEOComponent as () => Promise<unknown>;
45
+ const bibFn = tool.BibliographyComponent as () => Promise<unknown>;
46
+
47
+ await validateComponentExecution(tool.entry.id, 'Component', componentFn, failures);
48
+ await validateComponentExecution(tool.entry.id, 'SEOComponent', seoFn, failures);
49
+ await validateComponentExecution(tool.entry.id, 'BibliographyComponent', bibFn, failures);
50
+ }
51
+
52
+ return {
53
+ passed: failures.length === 0,
54
+ failures,
55
+ };
56
+ }
@@ -0,0 +1,34 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { ALL_TOOLS } from '../tools';
3
+ import { validateToolExports } from './shared-test-helpers';
4
+
5
+ describe('Tool Exports Pattern Validation', () => {
6
+ describe('Component Exports Format', () => {
7
+ ALL_TOOLS.forEach((tool) => {
8
+ it(`${tool.entry.id}: Component should be a lazy-loaded function`, () => {
9
+ expect(typeof tool.Component).toBe('function');
10
+ expect(tool.Component).toBeInstanceOf(Function);
11
+ });
12
+
13
+ it(`${tool.entry.id}: SEOComponent should be a lazy-loaded function`, () => {
14
+ expect(typeof tool.SEOComponent).toBe('function');
15
+ expect(tool.SEOComponent).toBeInstanceOf(Function);
16
+ });
17
+
18
+ it(`${tool.entry.id}: BibliographyComponent should be a lazy-loaded function`, () => {
19
+ expect(typeof tool.BibliographyComponent).toBe('function');
20
+ expect(tool.BibliographyComponent).toBeInstanceOf(Function);
21
+ });
22
+ });
23
+ });
24
+
25
+ describe('Dynamic Import Validation', () => {
26
+ it('all tools must have functional dynamic imports', async () => {
27
+ const result = await validateToolExports(ALL_TOOLS);
28
+ if (!result.passed) {
29
+ throw new Error(`Tool export validation failed:\n${result.failures.join('\n')}`);
30
+ }
31
+ expect(result.passed).toBe(true);
32
+ });
33
+ });
34
+ });
@@ -1,14 +1,6 @@
1
1
  ---
2
2
  import { Bibliography as SharedBibliography } from '@jjlmoya/utils-shared';
3
- import { burnTest } from './index';
4
- import type { KnownLocale } from '../../types';
5
-
6
- interface Props {
7
- locale?: KnownLocale;
8
- }
9
-
10
- const { locale = 'es' } = Astro.props;
11
- const content = await burnTest.i18n[locale]?.();
3
+ import { bibliography } from './bibliography';
12
4
  ---
13
5
 
14
- {content && <SharedBibliography links={content.bibliography} />}
6
+ <SharedBibliography links={bibliography} />
@@ -0,0 +1,16 @@
1
+ import type { BibliographyEntry } from '../../types';
2
+
3
+ export const bibliography: BibliographyEntry[] = [
4
+ {
5
+ name: 'AATCC TM20: Fiber Analysis - Qualitative',
6
+ url: 'https://members.aatcc.org/store/tm20/485/',
7
+ },
8
+ {
9
+ name: 'Textile Fibers: Identification and Testing - NIST',
10
+ url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
11
+ },
12
+ {
13
+ name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
14
+ url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
15
+ },
16
+ ];
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'textilien-brennprobe';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Häufig gestellte Fragen',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliographie',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'textile-burn-test';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Frequently Asked Questions',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliography',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'identificador-fibras-combustion';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Preguntas Frecuentes',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliografía',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'test-combustion-textile';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Questions Fréquentes',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliographie',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'uji-bakar-tekstil';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Pertanyaan yang Sering Diajukan',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliografi',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'test-combustione-tessile';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Domande Frequenti',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliografia',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'textile-burn-test';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'よくある質問',
118
118
  faq: faqData,
119
- bibliographyTitle: '参考文献',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'textile-burn-test';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: '자주 묻는 질문',
118
118
  faq: faqData,
119
- bibliographyTitle: '참고 문헌',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'textiel-brandproef';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Veelgestelde Vragen',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliografie',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'test-spalania-tekstyliow';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Często Zadawane Pytania',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliografia',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'teste-combustao-textil';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Perguntas Frequentes',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Bibliografia',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [
@@ -1,5 +1,6 @@
1
1
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
2
  import type { ToolLocaleContent } from '../../../types';
3
+ import { bibliography } from '../bibliography';
3
4
  import type { BurnTestUI } from '../ui';
4
5
 
5
6
  const slug = 'test-na-gorenie-textilya';
@@ -114,23 +115,8 @@ export const content: ToolLocaleContent<BurnTestUI> = {
114
115
  slug,
115
116
  title,
116
117
  description,
117
- faqTitle: 'Часто задаваемые вопросы',
118
118
  faq: faqData,
119
- bibliographyTitle: 'Библиография',
120
- bibliography: [
121
- {
122
- name: 'AATCC TM20: Fiber Analysis - Qualitative',
123
- url: 'https://members.aatcc.org/store/tm20/485/',
124
- },
125
- {
126
- name: 'Textile Fibers: Identification and Testing - NIST',
127
- url: 'https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular41e3.pdf',
128
- },
129
- {
130
- name: 'Burn Test Chart for Fiber Identification - Fabric Mart',
131
- url: 'https://fabricmartfabrics.com/pages/burn-test-chart',
132
- },
133
- ],
119
+ bibliography: bibliography,
134
120
  howTo: howToData,
135
121
  schemas: [faqSchema, howToSchema, appSchema],
136
122
  seo: [