@vesk/compiler 0.2.50 → 0.2.51

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/errors.d.ts CHANGED
@@ -38,6 +38,26 @@ export declare class VeskError extends Error {
38
38
  * - `value` — `ns.max` read as a value. Component tags resolve; plain value
39
39
  * reads do not, because nothing binds `ns` at runtime.
40
40
  */
41
+ /**
42
+ * An imported `.ts`/`.js` module could not be parsed.
43
+ *
44
+ * This used to be silent, and that is the whole point of the diagnostic. A
45
+ * parse failure meant the module's RAW, untranspiled source was substituted,
46
+ * so TypeScript syntax reached `new Function` and the module blew up much
47
+ * later with a bare `Unexpected token ':'` — attributed to no file, at a
48
+ * point in the build far from the code that caused it. It also poisoned the
49
+ * whole shared module graph: one unparseable module left its exports
50
+ * undefined, so unrelated consumers failed with `X is not iterable`.
51
+ *
52
+ * Two real constructs hit this: a parameter annotation that survived the
53
+ * stripper only when the parameter also had a default value, and a generic
54
+ * arrow's type parameter list, which the JSX tokenizer cannot read at all.
55
+ * Both are fixed; this error exists so the NEXT such gap is reported at the
56
+ * right file with the right line instead of surfacing three modules later.
57
+ */
58
+ static moduleParseFailed(context?: VeskErrorOptions & {
59
+ reason?: string;
60
+ }): VeskError;
41
61
  static vskNamespaceMember(context?: VeskErrorOptions & {
42
62
  form?: 'nested' | 'value';
43
63
  }): VeskError;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAoBxD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,GAAE,MAAU,GAAG,MAAM,GAAG,IAAI,CAWrG;AAqCD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAA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AE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS;IAmBvF,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAM,EAAO,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS;IAO3G,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,EAAO,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS;IAYvG,MAAM,CAAC,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS;IAmB/G,MAAM,CAAC,cAAc,CAAC,OAAO,GAAE,gBAAgB,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,SAAS;IAmBpF,QAAQ,IAAI,MAAM;IA0BlB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAclC"}
package/dist/errors.js CHANGED
@@ -169,6 +169,39 @@ export class VeskError extends Error {
169
169
  * - `value` — `ns.max` read as a value. Component tags resolve; plain value
170
170
  * reads do not, because nothing binds `ns` at runtime.
171
171
  */
172
+ /**
173
+ * An imported `.ts`/`.js` module could not be parsed.
174
+ *
175
+ * This used to be silent, and that is the whole point of the diagnostic. A
176
+ * parse failure meant the module's RAW, untranspiled source was substituted,
177
+ * so TypeScript syntax reached `new Function` and the module blew up much
178
+ * later with a bare `Unexpected token ':'` — attributed to no file, at a
179
+ * point in the build far from the code that caused it. It also poisoned the
180
+ * whole shared module graph: one unparseable module left its exports
181
+ * undefined, so unrelated consumers failed with `X is not iterable`.
182
+ *
183
+ * Two real constructs hit this: a parameter annotation that survived the
184
+ * stripper only when the parameter also had a default value, and a generic
185
+ * arrow's type parameter list, which the JSX tokenizer cannot read at all.
186
+ * Both are fixed; this error exists so the NEXT such gap is reported at the
187
+ * right file with the right line instead of surfacing three modules later.
188
+ */
189
+ static moduleParseFailed(context = {}) {
190
+ return new VeskError(`Could not parse an imported module${context.reason ? `: ${context.reason}` : '.'}`, {
191
+ ...context,
192
+ code: context.code || 'V0901',
193
+ suggestions: [
194
+ 'Check the line the ^ marker points at — it is the construct the parser stopped on.',
195
+ 'If it is TypeScript syntax the stripper does not handle, simplifying it here fixes every module that imports this file.',
196
+ 'This is a bug in the compiler, not in your code, if the construct is ordinary TypeScript — please report it with the source line.',
197
+ ],
198
+ nextSteps: [
199
+ 'A module that fails to parse is substituted with its raw source, so every type annotation it contains becomes a runtime SyntaxError.',
200
+ 'The failure is reported here, at the offending file and line, rather than as an `Unexpected token` in whichever module happened to import it.',
201
+ ],
202
+ tip: 'Ordinary TypeScript should parse; if this fires on valid TS, the parser is missing a construct.',
203
+ });
204
+ }
172
205
  static vskNamespaceMember(context = {}) {
173
206
  const nested = context.form === 'nested';
174
207
  return new VeskError(nested
@@ -1 +1 @@
1
- {"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../src/ir-generator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAsBP,MAAM,uBAAuB,CAAC;AA2T/B,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkCnL;AA6nCD,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAqT9E"}
1
+ {"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../src/ir-generator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAsBP,MAAM,uBAAuB,CAAC;AA2T/B,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkCnL;AAo+CD,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAmV9E"}