@marko/language-tools 2.5.17 → 2.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2226,6 +2226,19 @@ ${varShared("noop")}(`);
2226
2226
  if (!WROTE_COMMENT.has(comment)) {
2227
2227
  if (this.#code.charAt(comment.start + 1) === "/") {
2228
2228
  this.#extractor.write("//").copy(comment.value).write("\n");
2229
+ } else if (this.#code.charAt(comment.start + 1) === "!") {
2230
+ this.#extractor.write("/*");
2231
+ let startIndex = comment.value.start;
2232
+ for (const { index } of this.#read(comment.value).matchAll(
2233
+ /\*\//g
2234
+ )) {
2235
+ this.#extractor.copy({
2236
+ start: startIndex,
2237
+ end: startIndex = comment.value.start + index + 1
2238
+ }).write("\\");
2239
+ }
2240
+ this.#extractor.copy({ start: startIndex, end: comment.value.end });
2241
+ this.#extractor.write("*/");
2229
2242
  } else {
2230
2243
  this.#extractor.write("/*").copy(comment.value).write("*/");
2231
2244
  }
@@ -3218,7 +3231,7 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
3218
3231
  this.#writeAttrTagTree(nested2, `input["@${name}"]`, true);
3219
3232
  }
3220
3233
  }
3221
- this.#extractor.write(`})`);
3234
+ this.#extractor.write(`});`);
3222
3235
  }
3223
3236
  #getAttrTagTree(tag, attrTags) {
3224
3237
  if (!tag.hasAttrTags || !tag.body) return attrTags;
package/dist/index.mjs CHANGED
@@ -2189,6 +2189,19 @@ ${varShared("noop")}(`);
2189
2189
  if (!WROTE_COMMENT.has(comment)) {
2190
2190
  if (this.#code.charAt(comment.start + 1) === "/") {
2191
2191
  this.#extractor.write("//").copy(comment.value).write("\n");
2192
+ } else if (this.#code.charAt(comment.start + 1) === "!") {
2193
+ this.#extractor.write("/*");
2194
+ let startIndex = comment.value.start;
2195
+ for (const { index } of this.#read(comment.value).matchAll(
2196
+ /\*\//g
2197
+ )) {
2198
+ this.#extractor.copy({
2199
+ start: startIndex,
2200
+ end: startIndex = comment.value.start + index + 1
2201
+ }).write("\\");
2202
+ }
2203
+ this.#extractor.copy({ start: startIndex, end: comment.value.end });
2204
+ this.#extractor.write("*/");
2192
2205
  } else {
2193
2206
  this.#extractor.write("/*").copy(comment.value).write("*/");
2194
2207
  }
@@ -3181,7 +3194,7 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
3181
3194
  this.#writeAttrTagTree(nested2, `input["@${name}"]`, true);
3182
3195
  }
3183
3196
  }
3184
- this.#extractor.write(`})`);
3197
+ this.#extractor.write(`});`);
3185
3198
  }
3186
3199
  #getAttrTagTree(tag, attrTags) {
3187
3200
  if (!tag.hasAttrTags || !tag.body) return attrTags;
@@ -86,14 +86,19 @@ declare global {
86
86
  [K in keyof Rendered]: Rendered[K] extends infer Value
87
87
  ? undefined extends Value
88
88
  ? Value extends { scope: infer Scope }
89
- ? Partial<Scope>
89
+ ? [0] extends [1 & Scope]
90
+ ? never
91
+ : Partial<Scope>
90
92
  : never
91
93
  : Value extends { scope: infer Scope }
92
- ? Scope
94
+ ? [0] extends [1 & Scope]
95
+ ? never
96
+ : Scope
93
97
  : never
94
98
  : never;
95
99
  }[keyof Rendered]
96
- >;
100
+ > &
101
+ Record<any, never>;
97
102
 
98
103
  export function mutable<Lookup>(lookup: Lookup): UnionToIntersection<
99
104
  Lookup extends readonly (infer Item)[]
@@ -152,7 +157,7 @@ declare global {
152
157
  >(input: Input): Input;
153
158
 
154
159
  export function forOfTag<
155
- Value,
160
+ Value extends Iterable,
156
161
  Item extends Value extends
157
162
  | readonly (infer Item)[]
158
163
  | Iterable<infer Item>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/language-tools",
3
3
  "description": "Marko Language Tools",
4
- "version": "2.5.17",
4
+ "version": "2.5.19",
5
5
  "bugs": "https://github.com/marko-js/language-server/issues/new?template=Bug_report.md",
6
6
  "peerDependencies": {
7
7
  "@marko/compiler": "^5.28.4"