xbintsc 0.6.8 → 0.6.10

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 (71) hide show
  1. package/dist/src/cli/help.d.ts +1 -1
  2. package/dist/src/cli/main.js +1 -0
  3. package/dist/src/cli/main.js.map +1 -1
  4. package/dist/src/driver/config.js +1 -0
  5. package/dist/src/driver/config.js.map +1 -1
  6. package/dist/src/driver/toolchain.d.ts +10 -0
  7. package/dist/src/driver/toolchain.js +69 -8
  8. package/dist/src/driver/toolchain.js.map +1 -1
  9. package/dist/src/driver/version.d.ts +1 -1
  10. package/dist/src/driver/version.js +1 -1
  11. package/dist/src/driver/version.js.map +1 -1
  12. package/dist/tests/driver/config.test.js +15 -2
  13. package/dist/tests/driver/config.test.js.map +1 -1
  14. package/dist/tests/driver/toolchain.test.js +23 -2
  15. package/dist/tests/driver/toolchain.test.js.map +1 -1
  16. package/dist/tests/e2e/gui-helpers.d.ts +2 -0
  17. package/dist/tests/e2e/gui-helpers.js +1 -0
  18. package/dist/tests/e2e/gui-helpers.js.map +1 -1
  19. package/dist/tests/e2e/gui-layout.test.js +47 -0
  20. package/dist/tests/e2e/gui-layout.test.js.map +1 -1
  21. package/dist/tests/e2e/gui-paint.test.js +108 -0
  22. package/dist/tests/e2e/gui-paint.test.js.map +1 -1
  23. package/dist/tests/e2e/gui-unsupported.test.d.ts +6 -0
  24. package/dist/tests/e2e/gui-unsupported.test.js +123 -0
  25. package/dist/tests/e2e/gui-unsupported.test.js.map +1 -0
  26. package/doc/ai/extensions.md +7 -4
  27. package/doc/ai/zh-CN/extensions.md +6 -3
  28. package/doc/gui/dom.md +69 -1
  29. package/doc/gui/known-issues.md +12 -5
  30. package/doc/gui/layout.md +19 -6
  31. package/doc/gui/rendering.md +16 -9
  32. package/doc/requirements.md +5 -3
  33. package/doc/zh-CN/gui/dom.md +61 -1
  34. package/doc/zh-CN/gui/known-issues.md +11 -4
  35. package/doc/zh-CN/gui/layout.md +14 -4
  36. package/doc/zh-CN/gui/rendering.md +13 -10
  37. package/doc/zh-CN/requirements.md +5 -2
  38. package/package.json +7 -7
  39. package/runtime/ext_gui/clip_values.cpp +11 -0
  40. package/runtime/ext_gui/css.cpp +27 -2
  41. package/runtime/ext_gui/css_selector.cpp +23 -0
  42. package/runtime/ext_gui/css_sheet.cpp +7 -0
  43. package/runtime/ext_gui/document.cpp +3 -0
  44. package/runtime/ext_gui/document_animation.cpp +4 -1
  45. package/runtime/ext_gui/dom_api.cpp +3 -0
  46. package/runtime/ext_gui/dom_parse.cpp +4 -0
  47. package/runtime/ext_gui/effect_values.cpp +28 -7
  48. package/runtime/ext_gui/gradient_values.cpp +25 -5
  49. package/runtime/ext_gui/inline_svg.cpp +3 -0
  50. package/runtime/ext_gui/layout_flow.cpp +12 -2
  51. package/runtime/ext_gui/layout_inline.cpp +80 -7
  52. package/runtime/ext_gui/media_query.cpp +7 -1
  53. package/runtime/ext_gui/paint.cpp +58 -23
  54. package/runtime/ext_gui/paint.h +7 -4
  55. package/runtime/ext_gui/paint_clip.cpp +74 -19
  56. package/runtime/ext_gui/paint_internal.h +7 -1
  57. package/runtime/ext_gui/renderer_clip.cpp +19 -17
  58. package/runtime/ext_gui/style.cpp +5 -1
  59. package/runtime/ext_gui/style.h +5 -0
  60. package/runtime/ext_gui/style_cascade.cpp +2 -0
  61. package/runtime/ext_gui/style_internal.h +7 -2
  62. package/runtime/ext_gui/style_print.cpp +3 -0
  63. package/runtime/ext_gui/style_text.cpp +11 -0
  64. package/runtime/ext_gui/style_values.cpp +89 -90
  65. package/runtime/ext_gui/transform.cpp +2 -0
  66. package/runtime/ext_gui/warnings.cpp +300 -0
  67. package/runtime/ext_gui/warnings.h +59 -0
  68. package/src/cli/main.ts +1 -0
  69. package/src/driver/config.ts +1 -0
  70. package/src/driver/toolchain.ts +79 -8
  71. package/src/driver/version.ts +1 -1
@@ -0,0 +1,300 @@
1
+ /*
2
+ * xbintsc GUI engine — implementation of the unsupported-feature diagnostics
3
+ * (see `warnings.h`).
4
+ */
5
+
6
+ #include "warnings.h"
7
+
8
+ #include <SDL3/SDL.h>
9
+
10
+ #include <cstdio>
11
+ #include <cstring>
12
+ #include <string>
13
+ #include <unordered_set>
14
+
15
+ namespace xtgui {
16
+
17
+ namespace {
18
+
19
+ struct SeenNames {
20
+ std::unordered_set<std::string> names;
21
+ };
22
+
23
+ /** Print one line per distinct name; repeated uses are dropped. */
24
+ bool firstUse(SeenNames *seen, const std::string &name) {
25
+ return seen->names.insert(name).second;
26
+ }
27
+
28
+ bool warningsSuppressed() {
29
+ static int suppressed = -1;
30
+ if (suppressed < 0) {
31
+ const char *value = SDL_getenv("XT_GUI_NO_WARNINGS");
32
+ suppressed = value != nullptr && value[0] != '\0' && std::strcmp(value, "0") != 0 ? 1 : 0;
33
+ }
34
+ return suppressed != 0;
35
+ }
36
+
37
+ /** The parser and `createElement` already lowercase the common case; only pay
38
+ * for a copy when the caller really passed mixed case. */
39
+ bool hasUpperAscii(const std::string &text) {
40
+ for (char c : text) {
41
+ if (c >= 'A' && c <= 'Z') return true;
42
+ }
43
+ return false;
44
+ }
45
+
46
+ std::string lowerAscii(const std::string &text) {
47
+ std::string out = text;
48
+ for (char &c : out) {
49
+ if (c >= 'A' && c <= 'Z') c = (char)(c - 'A' + 'a');
50
+ }
51
+ return out;
52
+ }
53
+
54
+ std::string truncated(const std::string &text, size_t limit) {
55
+ if (text.size() <= limit) return text;
56
+ return text.substr(0, limit) + "...";
57
+ }
58
+
59
+ /**
60
+ * HTML elements whose browser behaviour the engine does not implement.
61
+ *
62
+ * They still create a box (and their text descendants still render), but a page
63
+ * that relies on a table layout, a native form control, an embedded document or
64
+ * an interactive disclosure is not going to get it. Tags that render correctly
65
+ * as a generic inline/block box (`button`, `label`, custom elements, …) are
66
+ * intentionally absent, as are the tags the engine implements (`img`, `svg`,
67
+ * `canvas`, `video`, `audio`, …).
68
+ *
69
+ * Update this list when an element gains real support, and mirror the change in
70
+ * `doc/gui/dom.md` (and its Chinese translation).
71
+ */
72
+ const std::unordered_set<std::string> &unsupportedElements() {
73
+ static const std::unordered_set<std::string> names = {
74
+ "applet", "area", "basefont", "bgsound", "blink", "caption",
75
+ "col", "colgroup", "datalist", "details", "dialog", "embed",
76
+ "frame", "frameset", "iframe", "input", "isindex", "keygen",
77
+ "map", "marquee", "math", "meter", "noembed", "noframes",
78
+ "object", "optgroup", "option", "output", "param", "plaintext",
79
+ "progress", "select", "summary", "table", "tbody", "td",
80
+ "template", "textarea", "tfoot", "th", "thead", "tr",
81
+ "track", "xmp",
82
+ };
83
+ return names;
84
+ }
85
+
86
+ /**
87
+ * SVG elements NanoSVG does not render.
88
+ *
89
+ * The list mirrors `doc/gui/known-issues.md`: text, `<use>`/symbols, filters,
90
+ * masks, clip paths, patterns, markers, embedded images and animation are not
91
+ * part of the rasteriser's subset.
92
+ */
93
+ const std::unordered_set<std::string> &unsupportedSvgElements() {
94
+ static const std::unordered_set<std::string> names = {
95
+ "altglyph", "altglyphdef", "altglyphitem", "animate",
96
+ "animatecolor", "animatemotion", "animatetransform", "clippath",
97
+ "color-profile", "cursor", "feblend", "fecolormatrix",
98
+ "fecomponenttransfer", "fecomposite", "feconvolvematrix", "fediffuselighting",
99
+ "fedisplacementmap", "fedistantlight", "fedropshadow", "feflood",
100
+ "fefunca", "fefuncb", "fefuncg", "fefuncr",
101
+ "fegaussianblur", "feimage", "femerge", "femergenode",
102
+ "femorphology", "feoffset", "fepointlight", "fespecularlighting",
103
+ "fespotlight", "fetile", "feturbulence", "filter",
104
+ "font", "font-face", "font-face-format", "font-face-name",
105
+ "font-face-src", "font-face-uri", "foreignobject", "glyph",
106
+ "glyphref", "hkern", "image", "marker",
107
+ "mask", "mpath", "pattern", "set",
108
+ "switch", "symbol", "text", "textpath",
109
+ "tref", "tspan", "use", "view",
110
+ "vkern",
111
+ };
112
+ return names;
113
+ }
114
+
115
+ /** Attributes that request browser behaviour the engine has no subsystem for. */
116
+ const std::unordered_set<std::string> &unsupportedAttributes() {
117
+ static const std::unordered_set<std::string> names = {
118
+ "autofocus", "clip-path", "contenteditable", "controls", "draggable",
119
+ "filter", "hidden", "href", "marker-end", "marker-mid",
120
+ "marker-start", "mask", "poster", "sizes", "srcset",
121
+ "tabindex",
122
+ };
123
+ return names;
124
+ }
125
+
126
+ void warnElementOnce(const std::string &name) {
127
+ static SeenNames seen;
128
+ if (!firstUse(&seen, name)) return;
129
+ std::fprintf(stderr,
130
+ "xt_gui: warning: unsupported element <%s>; the engine has no browser "
131
+ "behaviour for it\n",
132
+ name.c_str());
133
+ }
134
+
135
+ void warnSvgElementOnce(const std::string &name) {
136
+ static SeenNames seen;
137
+ if (!firstUse(&seen, name)) return;
138
+ std::fprintf(stderr, "xt_gui: warning: unsupported SVG element <%s>; it is not rendered\n",
139
+ name.c_str());
140
+ }
141
+
142
+ void warnAttributeOnce(const std::string &tag, const std::string &attribute) {
143
+ static SeenNames seen;
144
+ std::string key = tag;
145
+ key += ':';
146
+ key += attribute;
147
+ if (!firstUse(&seen, key)) return;
148
+ std::fprintf(stderr,
149
+ "xt_gui: warning: unsupported attribute '%s' on <%s>; the engine has no "
150
+ "behaviour for it\n",
151
+ attribute.c_str(), tag.c_str());
152
+ }
153
+
154
+ void warnPropertyOnce(const std::string &name) {
155
+ static SeenNames seen;
156
+ if (!firstUse(&seen, name)) return;
157
+ std::fprintf(stderr, "xt_gui: warning: unsupported CSS property '%s'; it is ignored\n",
158
+ name.c_str());
159
+ }
160
+
161
+ void warnAtRuleOnce(const std::string &name) {
162
+ static SeenNames seen;
163
+ if (!firstUse(&seen, name)) return;
164
+ std::fprintf(stderr, "xt_gui: warning: unsupported at-rule '@%s'; its rule is ignored\n",
165
+ name.c_str());
166
+ }
167
+
168
+ void warnDescriptorOnce(const std::string &name) {
169
+ static SeenNames seen;
170
+ if (!firstUse(&seen, name)) return;
171
+ std::fprintf(stderr,
172
+ "xt_gui: warning: unsupported @font-face descriptor '%s'; it is ignored\n",
173
+ name.c_str());
174
+ }
175
+
176
+ void warnSelectorOnce(const std::string &selector) {
177
+ static SeenNames seen;
178
+ if (!firstUse(&seen, selector)) return;
179
+ std::fprintf(stderr, "xt_gui: warning: unsupported selector '%s'; the rule is ignored\n",
180
+ truncated(selector, 80).c_str());
181
+ }
182
+
183
+ void warnPseudoClassOnce(const std::string &name) {
184
+ static SeenNames seen;
185
+ if (!firstUse(&seen, name)) return;
186
+ std::fprintf(stderr, "xt_gui: warning: unsupported pseudo-class ':%s'; it never matches\n",
187
+ name.c_str());
188
+ }
189
+
190
+ void warnPseudoElementOnce(const std::string &name) {
191
+ static SeenNames seen;
192
+ if (!firstUse(&seen, name)) return;
193
+ std::fprintf(stderr, "xt_gui: warning: unsupported pseudo-element '::%s'; it is not generated\n",
194
+ name.c_str());
195
+ }
196
+
197
+ void warnMediaFeatureOnce(const std::string &name) {
198
+ static SeenNames seen;
199
+ if (!firstUse(&seen, name)) return;
200
+ std::fprintf(stderr,
201
+ "xt_gui: warning: unsupported media feature '%s'; the query is treated as "
202
+ "not matching\n",
203
+ name.c_str());
204
+ }
205
+
206
+ void warnFunctionOnce(const std::string &property, const std::string &function) {
207
+ static SeenNames seen;
208
+ std::string key = property;
209
+ key += ':';
210
+ key += function;
211
+ if (!firstUse(&seen, key)) return;
212
+ std::fprintf(stderr, "xt_gui: warning: unsupported function '%s()' in '%s'; it is ignored\n",
213
+ function.c_str(), property.c_str());
214
+ }
215
+
216
+ void warnUnitOnce(const std::string &unit) {
217
+ static SeenNames seen;
218
+ if (!firstUse(&seen, unit)) return;
219
+ std::fprintf(stderr, "xt_gui: warning: unsupported CSS unit '%s'; the value is ignored\n",
220
+ unit.c_str());
221
+ }
222
+
223
+ } // namespace
224
+
225
+ void xt_warn_unsupported_element(const std::string &tag) {
226
+ if (warningsSuppressed()) return;
227
+ if (!hasUpperAscii(tag)) {
228
+ if (unsupportedElements().count(tag) != 0) warnElementOnce(tag);
229
+ return;
230
+ }
231
+ const std::string name = lowerAscii(tag);
232
+ if (unsupportedElements().count(name) != 0) warnElementOnce(name);
233
+ }
234
+
235
+ void xt_warn_unsupported_svg_element(const std::string &tag) {
236
+ if (warningsSuppressed()) return;
237
+ const std::string name = hasUpperAscii(tag) ? lowerAscii(tag) : tag;
238
+ if (unsupportedSvgElements().count(name) != 0) warnSvgElementOnce(name);
239
+ }
240
+
241
+ void xt_warn_unsupported_attribute(const std::string &tag, const std::string &attribute) {
242
+ if (warningsSuppressed()) return;
243
+ const std::string name = hasUpperAscii(attribute) ? lowerAscii(attribute) : attribute;
244
+ if (unsupportedAttributes().count(name) == 0) return;
245
+ const std::string element = hasUpperAscii(tag) ? lowerAscii(tag) : tag;
246
+ warnAttributeOnce(element, name);
247
+ }
248
+
249
+ void xt_warn_unsupported_property(const std::string &property) {
250
+ if (warningsSuppressed()) return;
251
+ if (!hasUpperAscii(property)) {
252
+ warnPropertyOnce(property);
253
+ return;
254
+ }
255
+ warnPropertyOnce(lowerAscii(property));
256
+ }
257
+
258
+ void xt_warn_unsupported_at_rule(const std::string &name) {
259
+ if (warningsSuppressed() || name.empty()) return;
260
+ warnAtRuleOnce(hasUpperAscii(name) ? lowerAscii(name) : name);
261
+ }
262
+
263
+ void xt_warn_unsupported_descriptor(const std::string &name) {
264
+ if (warningsSuppressed() || name.empty()) return;
265
+ warnDescriptorOnce(hasUpperAscii(name) ? lowerAscii(name) : name);
266
+ }
267
+
268
+ void xt_warn_unsupported_selector(const std::string &selector) {
269
+ if (warningsSuppressed()) return;
270
+ const std::string text = selector;
271
+ if (text.empty()) return;
272
+ warnSelectorOnce(text);
273
+ }
274
+
275
+ void xt_warn_unsupported_pseudo_class(const std::string &name) {
276
+ if (warningsSuppressed() || name.empty()) return;
277
+ warnPseudoClassOnce(hasUpperAscii(name) ? lowerAscii(name) : name);
278
+ }
279
+
280
+ void xt_warn_unsupported_pseudo_element(const std::string &name) {
281
+ if (warningsSuppressed() || name.empty()) return;
282
+ warnPseudoElementOnce(hasUpperAscii(name) ? lowerAscii(name) : name);
283
+ }
284
+
285
+ void xt_warn_unsupported_media_feature(const std::string &name) {
286
+ if (warningsSuppressed() || name.empty()) return;
287
+ warnMediaFeatureOnce(hasUpperAscii(name) ? lowerAscii(name) : name);
288
+ }
289
+
290
+ void xt_warn_unsupported_function(const std::string &property, const std::string &function) {
291
+ if (warningsSuppressed() || function.empty()) return;
292
+ warnFunctionOnce(property, hasUpperAscii(function) ? lowerAscii(function) : function);
293
+ }
294
+
295
+ void xt_warn_unsupported_unit(const std::string &unit) {
296
+ if (warningsSuppressed() || unit.empty()) return;
297
+ warnUnitOnce(hasUpperAscii(unit) ? lowerAscii(unit) : unit);
298
+ }
299
+
300
+ } // namespace xtgui
@@ -0,0 +1,59 @@
1
+ /*
2
+ * xbintsc GUI engine — diagnostics for the features outside the supported
3
+ * HTML/CSS subset.
4
+ *
5
+ * The engine deliberately keeps rendering when a page uses an element or a
6
+ * declaration it does not implement; these helpers make that fallback visible
7
+ * instead of silent. Each name is reported once per process, so a property used
8
+ * by every rule (or a table cell repeated on every row) cannot flood stderr on
9
+ * every restyle.
10
+ *
11
+ * Set `XT_GUI_NO_WARNINGS=1` to silence the reports (they are development
12
+ * aids; a shipped application usually starts without a console on Windows).
13
+ */
14
+ #ifndef XT_GUI_WARNINGS_H
15
+ #define XT_GUI_WARNINGS_H
16
+
17
+ #include <string>
18
+
19
+ namespace xtgui {
20
+
21
+ /** Report an unsupported HTML element once per tag name. */
22
+ void xt_warn_unsupported_element(const std::string &tag);
23
+
24
+ /** Report an unsupported SVG child element once per tag name. */
25
+ void xt_warn_unsupported_svg_element(const std::string &tag);
26
+
27
+ /** Report an unsupported HTML attribute once per element/tag pair. */
28
+ void xt_warn_unsupported_attribute(const std::string &tag, const std::string &attribute);
29
+
30
+ /** Report an unsupported CSS property once per property name. */
31
+ void xt_warn_unsupported_property(const std::string &property);
32
+
33
+ /** Report an ignored at-rule once per at-rule name (`supports`, `layer`, …). */
34
+ void xt_warn_unsupported_at_rule(const std::string &name);
35
+
36
+ /** Report an ignored `@font-face` descriptor once per descriptor name. */
37
+ void xt_warn_unsupported_descriptor(const std::string &name);
38
+
39
+ /** Report a selector the parser had to drop. */
40
+ void xt_warn_unsupported_selector(const std::string &selector);
41
+
42
+ /** Report an unsupported pseudo-class (`:has`, `:nth-of-type`, …). */
43
+ void xt_warn_unsupported_pseudo_class(const std::string &name);
44
+
45
+ /** Report an unsupported pseudo-element (`::selection`, `::marker`, …). */
46
+ void xt_warn_unsupported_pseudo_element(const std::string &name);
47
+
48
+ /** Report an unsupported `@media` feature and why its query is treated as false. */
49
+ void xt_warn_unsupported_media_feature(const std::string &name);
50
+
51
+ /** Report an unsupported CSS function inside `property` (`transform`, `filter`, …). */
52
+ void xt_warn_unsupported_function(const std::string &property, const std::string &function);
53
+
54
+ /** Report an unsupported length unit (`vmin`, `ch`, `dvh`, …). */
55
+ void xt_warn_unsupported_unit(const std::string &unit);
56
+
57
+ } // namespace xtgui
58
+
59
+ #endif /* XT_GUI_WARNINGS_H */
package/src/cli/main.ts CHANGED
@@ -338,6 +338,7 @@ function mergeAppConfig(flags: Map<string, string | boolean>, config: ProjectCon
338
338
  ...(bundleId !== undefined ? { bundleId } : {}),
339
339
  ...(bundle !== undefined ? { bundle } : {}),
340
340
  ...(icon !== undefined ? { icon } : {}),
341
+ ...(base.console !== undefined ? { console: base.console } : {}),
341
342
  };
342
343
  }
343
344
 
@@ -123,6 +123,7 @@ export function parseProjectConfig(text: string, where: string = CONFIG_FILE_NAM
123
123
  icon: readString(appRoot, "icon", `${where}: 'app'`),
124
124
  bundle: readBoolean(appRoot, "bundle", `${where}: 'app'`),
125
125
  bundleId: readString(appRoot, "bundleId", `${where}: 'app'`),
126
+ console: readBoolean(appRoot, "console", `${where}: 'app'`),
126
127
  };
127
128
  for (const key of Object.keys(app) as (keyof AppConfig)[]) {
128
129
  if (app[key] === undefined) delete app[key];
@@ -144,6 +144,75 @@ export function probeClang(
144
144
  }
145
145
  }
146
146
 
147
+ /**
148
+ * Release years that name their install directory after the year, mapped to the
149
+ * major version each release actually ships (VS 2022 is version 17).
150
+ */
151
+ const VISUAL_STUDIO_YEAR_MAJOR: Readonly<Record<string, number>> = {
152
+ "2015": 14,
153
+ "2017": 15,
154
+ "2019": 16,
155
+ "2022": 17,
156
+ };
157
+
158
+ /**
159
+ * Sort key for a directory under `%ProgramFiles%\Microsoft Visual Studio`.
160
+ * Releases up to 2022 use year names ("2022"); Visual Studio 2026 (version 18)
161
+ * and later use the plain major version ("18").
162
+ */
163
+ function visualStudioMajor(directoryName: string): number {
164
+ const known = VISUAL_STUDIO_YEAR_MAJOR[directoryName];
165
+ if (known !== undefined) return known;
166
+ return /^\d+$/.test(directoryName) ? Number(directoryName) : -1;
167
+ }
168
+
169
+ /** Immediate subdirectory names, or `[]` when the directory cannot be read. */
170
+ function subdirectories(directory: string): string[] {
171
+ try {
172
+ return readdirSync(directory, { withFileTypes: true })
173
+ .filter((entry) => entry.isDirectory())
174
+ .map((entry) => entry.name);
175
+ } catch {
176
+ return [];
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Preference order when one release has several installs; channel names not
182
+ * listed here (for example `Insiders`) follow alphabetically.
183
+ */
184
+ const VISUAL_STUDIO_EDITIONS: readonly string[] = ["Community", "Professional", "Enterprise", "BuildTools"];
185
+
186
+ function editionRank(edition: string): number {
187
+ const index = VISUAL_STUDIO_EDITIONS.indexOf(edition);
188
+ return index === -1 ? VISUAL_STUDIO_EDITIONS.length : index;
189
+ }
190
+
191
+ /**
192
+ * The `VC\Tools\Llvm` directory of every Visual Studio installation under one
193
+ * `Microsoft Visual Studio` root, newest release first.
194
+ *
195
+ * Both layouts are discovered by enumerating directories — `<year>\<edition>`
196
+ * for 2019/2022 (for example `2022\BuildTools`) and `<major>\<channel>` for
197
+ * Visual Studio 2026 and later (for example `18\Insiders`) — so a future
198
+ * release needs no code change and a non-default channel still works.
199
+ */
200
+ export function visualStudioLlvmDirs(visualStudioRoot: string): string[] {
201
+ const versions = subdirectories(visualStudioRoot)
202
+ .filter((name) => visualStudioMajor(name) >= 0)
203
+ .sort((a, b) => visualStudioMajor(b) - visualStudioMajor(a));
204
+ const dirs: string[] = [];
205
+ for (const version of versions) {
206
+ const editions = subdirectories(join(visualStudioRoot, version)).sort(
207
+ (a, b) => editionRank(a) - editionRank(b) || a.localeCompare(b),
208
+ );
209
+ for (const edition of editions) {
210
+ dirs.push(join(visualStudioRoot, version, edition, "VC", "Tools", "Llvm"));
211
+ }
212
+ }
213
+ return dirs;
214
+ }
215
+
147
216
  /**
148
217
  * Visual Studio ships its own LLVM build (`VC\Tools\Llvm\x64\bin\clang.exe`).
149
218
  * It is a perfectly good driver but is not on `PATH` in a plain shell, so probe
@@ -152,17 +221,19 @@ export function probeClang(
152
221
  */
153
222
  function visualStudioClangCandidates(): string[] {
154
223
  if (process.platform !== "win32") return [];
155
- const roots = [process.env.ProgramFiles, process.env["ProgramFiles(x86)"], process.env.ProgramW6432]
156
- .filter((root): root is string => Boolean(root));
224
+ const roots = [
225
+ ...new Set(
226
+ [process.env.ProgramFiles, process.env["ProgramFiles(x86)"], process.env.ProgramW6432].filter(
227
+ (root): root is string => Boolean(root),
228
+ ),
229
+ ),
230
+ ];
157
231
  const arch = process.arch === "arm64" ? "ARM64" : "x64";
158
232
  const candidates: string[] = [];
159
233
  for (const root of roots) {
160
- for (const year of ["2022", "2019"]) {
161
- for (const edition of ["Community", "Professional", "Enterprise", "BuildTools"]) {
162
- const llvm = join(root, "Microsoft Visual Studio", year, edition, "VC", "Tools", "Llvm");
163
- candidates.push(join(llvm, arch, "bin", "clang.exe"));
164
- candidates.push(join(llvm, "bin", "clang.exe"));
165
- }
234
+ for (const llvm of visualStudioLlvmDirs(join(root, "Microsoft Visual Studio"))) {
235
+ candidates.push(join(llvm, arch, "bin", "clang.exe"));
236
+ candidates.push(join(llvm, "bin", "clang.exe"));
166
237
  }
167
238
  candidates.push(join(root, "LLVM", "bin", "clang.exe"));
168
239
  }
@@ -9,4 +9,4 @@
9
9
  * `main`/`master` only (see `.githooks/pre-commit`), so feature branches never
10
10
  * change this line and merging two of them cannot conflict here.
11
11
  */
12
- export const COMPILER_VERSION = "0.6.8";
12
+ export const COMPILER_VERSION = "0.6.10";