typebulb 0.12.0 → 0.13.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 (191) hide show
  1. package/dist/agents/claude/client.js +341 -205
  2. package/dist/agents/claude/styles.css +3 -21
  3. package/dist/ai/aiProvider.d.ts +59 -0
  4. package/dist/ai/aiProvider.d.ts.map +1 -0
  5. package/dist/ai/aiProvider.js +109 -0
  6. package/dist/ai/aiProvider.js.map +1 -0
  7. package/dist/ai/aiProviders.d.ts +28 -0
  8. package/dist/ai/aiProviders.d.ts.map +1 -0
  9. package/dist/ai/aiProviders.js +47 -0
  10. package/dist/ai/aiProviders.js.map +1 -0
  11. package/dist/ai/chat.d.ts +32 -0
  12. package/dist/ai/chat.d.ts.map +1 -0
  13. package/dist/ai/chat.js +5 -0
  14. package/dist/ai/chat.js.map +1 -0
  15. package/dist/ai/index.d.ts +9 -0
  16. package/dist/ai/index.d.ts.map +1 -0
  17. package/dist/ai/index.js +11 -0
  18. package/dist/ai/index.js.map +1 -0
  19. package/dist/ai/protocol.d.ts +18 -0
  20. package/dist/ai/protocol.d.ts.map +1 -0
  21. package/dist/ai/protocol.js +3 -0
  22. package/dist/ai/protocol.js.map +1 -0
  23. package/dist/ai/providers/anthropic.d.ts +123 -0
  24. package/dist/ai/providers/anthropic.d.ts.map +1 -0
  25. package/dist/ai/providers/anthropic.js +130 -0
  26. package/dist/ai/providers/anthropic.js.map +1 -0
  27. package/dist/ai/providers/gemini.d.ts +62 -0
  28. package/dist/ai/providers/gemini.d.ts.map +1 -0
  29. package/dist/ai/providers/gemini.js +136 -0
  30. package/dist/ai/providers/gemini.js.map +1 -0
  31. package/dist/ai/providers/openAI.d.ts +146 -0
  32. package/dist/ai/providers/openAI.d.ts.map +1 -0
  33. package/dist/ai/providers/openAI.js +127 -0
  34. package/dist/ai/providers/openAI.js.map +1 -0
  35. package/dist/ai/providers/openRouter.d.ts +65 -0
  36. package/dist/ai/providers/openRouter.d.ts.map +1 -0
  37. package/dist/ai/providers/openRouter.js +82 -0
  38. package/dist/ai/providers/openRouter.js.map +1 -0
  39. package/dist/ai/sseParser.d.ts +32 -0
  40. package/dist/ai/sseParser.d.ts.map +1 -0
  41. package/dist/ai/sseParser.js +121 -0
  42. package/dist/ai/sseParser.js.map +1 -0
  43. package/dist/ai/stream.d.ts +20 -0
  44. package/dist/ai/stream.d.ts.map +1 -0
  45. package/dist/ai/stream.js +6 -0
  46. package/dist/ai/stream.js.map +1 -0
  47. package/dist/dts/cache.d.ts +30 -0
  48. package/dist/dts/cache.d.ts.map +1 -0
  49. package/dist/dts/cache.js +2 -0
  50. package/dist/dts/cache.js.map +1 -0
  51. package/dist/dts/definitelyTypedProvider.d.ts +20 -0
  52. package/dist/dts/definitelyTypedProvider.d.ts.map +1 -0
  53. package/dist/dts/definitelyTypedProvider.js +93 -0
  54. package/dist/dts/definitelyTypedProvider.js.map +1 -0
  55. package/dist/dts/dtsConfig.d.ts +12 -0
  56. package/dist/dts/dtsConfig.d.ts.map +1 -0
  57. package/dist/dts/dtsConfig.js +24 -0
  58. package/dist/dts/dtsConfig.js.map +1 -0
  59. package/dist/dts/dtsResolver.d.ts +63 -0
  60. package/dist/dts/dtsResolver.d.ts.map +1 -0
  61. package/dist/dts/dtsResolver.js +272 -0
  62. package/dist/dts/dtsResolver.js.map +1 -0
  63. package/dist/dts/fetchDts.d.ts +13 -0
  64. package/dist/dts/fetchDts.d.ts.map +1 -0
  65. package/dist/dts/fetchDts.js +46 -0
  66. package/dist/dts/fetchDts.js.map +1 -0
  67. package/dist/dts/httpFetch.d.ts +17 -0
  68. package/dist/dts/httpFetch.d.ts.map +1 -0
  69. package/dist/dts/httpFetch.js +35 -0
  70. package/dist/dts/httpFetch.js.map +1 -0
  71. package/dist/dts/index.d.ts +14 -0
  72. package/dist/dts/index.d.ts.map +1 -0
  73. package/dist/dts/index.js +14 -0
  74. package/dist/dts/index.js.map +1 -0
  75. package/dist/dts/libManifest.d.ts +41 -0
  76. package/dist/dts/libManifest.d.ts.map +1 -0
  77. package/dist/dts/libManifest.js +109 -0
  78. package/dist/dts/libManifest.js.map +1 -0
  79. package/dist/dts/negativeCacheHelper.d.ts +29 -0
  80. package/dist/dts/negativeCacheHelper.d.ts.map +1 -0
  81. package/dist/dts/negativeCacheHelper.js +44 -0
  82. package/dist/dts/negativeCacheHelper.js.map +1 -0
  83. package/dist/dts/tarballFetcher.d.ts +13 -0
  84. package/dist/dts/tarballFetcher.d.ts.map +1 -0
  85. package/dist/dts/tarballFetcher.js +58 -0
  86. package/dist/dts/tarballFetcher.js.map +1 -0
  87. package/dist/dts/tbTypings.d.ts +15 -0
  88. package/dist/dts/tbTypings.d.ts.map +1 -0
  89. package/dist/dts/tbTypings.js +210 -0
  90. package/dist/dts/tbTypings.js.map +1 -0
  91. package/dist/dts/typeProvider.d.ts +37 -0
  92. package/dist/dts/typeProvider.d.ts.map +1 -0
  93. package/dist/dts/typeProvider.js +30 -0
  94. package/dist/dts/typeProvider.js.map +1 -0
  95. package/dist/dts/typeRefScanner.d.ts +8 -0
  96. package/dist/dts/typeRefScanner.d.ts.map +1 -0
  97. package/dist/dts/typeRefScanner.js +33 -0
  98. package/dist/dts/typeRefScanner.js.map +1 -0
  99. package/dist/dts/typescriptProvider.d.ts +21 -0
  100. package/dist/dts/typescriptProvider.d.ts.map +1 -0
  101. package/dist/dts/typescriptProvider.js +140 -0
  102. package/dist/dts/typescriptProvider.js.map +1 -0
  103. package/dist/dts/virtualFs.d.ts +20 -0
  104. package/dist/dts/virtualFs.d.ts.map +1 -0
  105. package/dist/dts/virtualFs.js +48 -0
  106. package/dist/dts/virtualFs.js.map +1 -0
  107. package/dist/format/chunks.d.ts +20 -0
  108. package/dist/format/chunks.d.ts.map +1 -0
  109. package/dist/format/chunks.js +51 -0
  110. package/dist/format/chunks.js.map +1 -0
  111. package/dist/format/config.d.ts +17 -0
  112. package/dist/format/config.d.ts.map +1 -0
  113. package/dist/format/config.js +13 -0
  114. package/dist/format/config.js.map +1 -0
  115. package/dist/format/detection.d.ts +11 -0
  116. package/dist/format/detection.d.ts.map +1 -0
  117. package/dist/format/detection.js +43 -0
  118. package/dist/format/detection.js.map +1 -0
  119. package/dist/format/index.d.ts +8 -0
  120. package/dist/format/index.d.ts.map +1 -0
  121. package/dist/format/index.js +8 -0
  122. package/dist/format/index.js.map +1 -0
  123. package/dist/format/parse.d.ts +20 -0
  124. package/dist/format/parse.d.ts.map +1 -0
  125. package/dist/format/parse.js +88 -0
  126. package/dist/format/parse.js.map +1 -0
  127. package/dist/format/registry.d.ts +24 -0
  128. package/dist/format/registry.d.ts.map +1 -0
  129. package/dist/format/registry.js +31 -0
  130. package/dist/format/registry.js.map +1 -0
  131. package/dist/format/serialize.d.ts +8 -0
  132. package/dist/format/serialize.d.ts.map +1 -0
  133. package/dist/format/serialize.js +30 -0
  134. package/dist/format/serialize.js.map +1 -0
  135. package/dist/format/yaml.d.ts +4 -0
  136. package/dist/format/yaml.d.ts.map +1 -0
  137. package/dist/format/yaml.js +17 -0
  138. package/dist/format/yaml.js.map +1 -0
  139. package/dist/index.js +385 -84
  140. package/dist/lint/index.d.ts +29 -0
  141. package/dist/lint/index.d.ts.map +1 -0
  142. package/dist/lint/index.js +257 -0
  143. package/dist/lint/index.js.map +1 -0
  144. package/dist/render.js +174 -38
  145. package/dist/resolver/attempt.d.ts +2 -0
  146. package/dist/resolver/attempt.d.ts.map +1 -0
  147. package/dist/resolver/attempt.js +9 -0
  148. package/dist/resolver/attempt.js.map +1 -0
  149. package/dist/resolver/cdnClient.d.ts +46 -0
  150. package/dist/resolver/cdnClient.d.ts.map +1 -0
  151. package/dist/resolver/cdnClient.js +107 -0
  152. package/dist/resolver/cdnClient.js.map +1 -0
  153. package/dist/resolver/cdnConstants.d.ts +10 -0
  154. package/dist/resolver/cdnConstants.d.ts.map +1 -0
  155. package/dist/resolver/cdnConstants.js +10 -0
  156. package/dist/resolver/cdnConstants.js.map +1 -0
  157. package/dist/resolver/index.d.ts +20 -0
  158. package/dist/resolver/index.d.ts.map +1 -0
  159. package/dist/resolver/index.js +20 -0
  160. package/dist/resolver/index.js.map +1 -0
  161. package/dist/resolver/packageRef.d.ts +21 -0
  162. package/dist/resolver/packageRef.d.ts.map +1 -0
  163. package/dist/resolver/packageRef.js +89 -0
  164. package/dist/resolver/packageRef.js.map +1 -0
  165. package/dist/resolver/packageService.d.ts +40 -0
  166. package/dist/resolver/packageService.d.ts.map +1 -0
  167. package/dist/resolver/packageService.js +156 -0
  168. package/dist/resolver/packageService.js.map +1 -0
  169. package/dist/resolver/peerResolver.d.ts +33 -0
  170. package/dist/resolver/peerResolver.d.ts.map +1 -0
  171. package/dist/resolver/peerResolver.js +66 -0
  172. package/dist/resolver/peerResolver.js.map +1 -0
  173. package/dist/resolver/semver.d.ts +17 -0
  174. package/dist/resolver/semver.d.ts.map +1 -0
  175. package/dist/resolver/semver.js +56 -0
  176. package/dist/resolver/semver.js.map +1 -0
  177. package/dist/resolver/types.d.ts +33 -0
  178. package/dist/resolver/types.d.ts.map +1 -0
  179. package/dist/resolver/types.js +2 -0
  180. package/dist/resolver/types.js.map +1 -0
  181. package/dist/resolver/versionResolver.d.ts +29 -0
  182. package/dist/resolver/versionResolver.d.ts.map +1 -0
  183. package/dist/resolver/versionResolver.js +79 -0
  184. package/dist/resolver/versionResolver.js.map +1 -0
  185. package/dist/servers.js +142 -3
  186. package/dist/transpile/index.d.ts +19 -0
  187. package/dist/transpile/index.d.ts.map +1 -0
  188. package/dist/transpile/index.js +23 -0
  189. package/dist/transpile/index.js.map +1 -0
  190. package/dist/tsconfig.tsbuildinfo +1 -0
  191. package/package.json +99 -68
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Lints a bulb's code block for environment-specific issues — patterns that are
3
+ * valid TypeScript but break in the Typebulb runtime. Shared by typebulb.com and
4
+ * the CLI (`typebulb check`) so both enforce the same rules with the same
5
+ * AI-facing messages.
6
+ *
7
+ * Target-aware: `code.tsx` runs in the browser under an import map and a sandboxed
8
+ * iframe, `server.ts` runs in Node. The import-map / browser rules (dynamic
9
+ * import, URL / version / `.js`-deep-path imports, CSS imports, navigation) apply
10
+ * only to the client; the Sucrase / ESM core (require, `const enum`, `namespace`,
11
+ * `export =` / `import =`, `module {}`, redundant `tb`) applies to both.
12
+ */
13
+ export type LintTarget = 'client' | 'server';
14
+ export type LintIssueType = 'DYNAMIC_IMPORT' | 'COMMONJS_REQUIRE' | 'JS_EXTENSION_IMPORT' | 'URL_IMPORT' | 'VERSION_SPECIFIER_IMPORT' | 'REDUNDANT_TB_DECLARATION' | 'CONST_ENUM' | 'NAMESPACE_DECLARATION' | 'COMMONJS_EXPORT_EQUALS' | 'COMMONJS_IMPORT_EQUALS' | 'MODULE_DECLARATION' | 'CSS_FILE_IMPORT' | 'NAVIGATION';
15
+ export type LintIssue = {
16
+ type: LintIssueType;
17
+ severity: 'error';
18
+ message: string;
19
+ lineNumber?: number;
20
+ lineContent?: string;
21
+ };
22
+ /**
23
+ * Lint a bulb code block. `target` selects the ruleset: `client` (`code.tsx`,
24
+ * the browser superset) or `server` (`server.ts`, the Sucrase / ESM core only).
25
+ */
26
+ export declare function lint(source: string, options: {
27
+ target: LintTarget;
28
+ }): LintIssue[];
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lint/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE5C,MAAM,MAAM,aAAa,GACrB,gBAAgB,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,YAAY,GAC5E,0BAA0B,GAAG,0BAA0B,GAAG,YAAY,GACtE,uBAAuB,GAAG,wBAAwB,GAAG,wBAAwB,GAC7E,oBAAoB,GAAG,iBAAiB,GAAG,YAAY,CAAA;AAE3D,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AA4BD;;;GAGG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG,SAAS,EAAE,CAuBjF"}
@@ -0,0 +1,257 @@
1
+ /**
2
+ * Lints a bulb's code block for environment-specific issues — patterns that are
3
+ * valid TypeScript but break in the Typebulb runtime. Shared by typebulb.com and
4
+ * the CLI (`typebulb check`) so both enforce the same rules with the same
5
+ * AI-facing messages.
6
+ *
7
+ * Target-aware: `code.tsx` runs in the browser under an import map and a sandboxed
8
+ * iframe, `server.ts` runs in Node. The import-map / browser rules (dynamic
9
+ * import, URL / version / `.js`-deep-path imports, CSS imports, navigation) apply
10
+ * only to the client; the Sucrase / ESM core (require, `const enum`, `namespace`,
11
+ * `export =` / `import =`, `module {}`, redundant `tb`) applies to both.
12
+ */
13
+ const CLIENT = ['client'];
14
+ const BOTH = ['client', 'server'];
15
+ const RULES = [
16
+ { type: 'DYNAMIC_IMPORT', pattern: /\bimport\s*\(\s*['"`]/, targets: CLIENT },
17
+ { type: 'COMMONJS_REQUIRE', pattern: /\brequire\s*\(\s*['"`]/, targets: BOTH },
18
+ // Only flag .js extension when it appears in a deep import path (has /).
19
+ // Package names that ARE ".js" (like "decimal.js") are legitimate npm packages.
20
+ // Browser-only: a `.js` on a deep path is valid (often required) in Node ESM.
21
+ { type: 'JS_EXTENSION_IMPORT', pattern: /from\s+['"][^'"]*\/[^'"]*\.js['"]/, targets: CLIENT },
22
+ { type: 'URL_IMPORT', pattern: /from\s+['"]https?:\/\//, targets: CLIENT },
23
+ { type: 'VERSION_SPECIFIER_IMPORT', pattern: /from\s+['"][^'"]*@[\d^~]/, targets: CLIENT },
24
+ { type: 'REDUNDANT_TB_DECLARATION', pattern: /declare\s+(const|var|let)\s+tb\b/, targets: BOTH },
25
+ { type: 'CONST_ENUM', pattern: /\bconst\s+enum\b/, targets: BOTH },
26
+ { type: 'NAMESPACE_DECLARATION', pattern: /\bnamespace\s+\w+/, targets: BOTH },
27
+ { type: 'COMMONJS_EXPORT_EQUALS', pattern: /\bexport\s*=/, targets: BOTH },
28
+ { type: 'COMMONJS_IMPORT_EQUALS', pattern: /\bimport\s+\w+\s*=/, targets: BOTH },
29
+ { type: 'MODULE_DECLARATION', pattern: /\bmodule\s+\w+\s*\{/, targets: BOTH },
30
+ { type: 'CSS_FILE_IMPORT', pattern: /(?:from|import)\s+['"][^'"]*\.css['"]/, targets: CLIENT },
31
+ // Navigation APIs break the sandboxed iframe.
32
+ { type: 'NAVIGATION', pattern: /window\.(location\.(reload|assign|replace)\s*\(|open\s*\()/, targets: CLIENT },
33
+ { type: 'NAVIGATION', pattern: /window\.location(\.href)?\s*=[^=]/, targets: CLIENT },
34
+ ];
35
+ /**
36
+ * Lint a bulb code block. `target` selects the ruleset: `client` (`code.tsx`,
37
+ * the browser superset) or `server` (`server.ts`, the Sucrase / ESM core only).
38
+ */
39
+ export function lint(source, options) {
40
+ if (!source)
41
+ return [];
42
+ const { target } = options;
43
+ const issues = [];
44
+ const lines = source.split('\n');
45
+ for (let i = 0; i < lines.length; i++) {
46
+ const line = lines[i];
47
+ const lineNumber = i + 1;
48
+ for (const rule of RULES) {
49
+ if (!rule.targets.includes(target))
50
+ continue;
51
+ if (!rule.pattern.test(line))
52
+ continue;
53
+ issues.push({
54
+ type: rule.type,
55
+ severity: 'error',
56
+ message: messageFor(rule.type, lineNumber),
57
+ lineNumber,
58
+ lineContent: line,
59
+ });
60
+ }
61
+ }
62
+ return issues;
63
+ }
64
+ function messageFor(type, lineNumber) {
65
+ if (type === 'URL_IMPORT') {
66
+ return `Direct URL imports are not supported! Found on line ${lineNumber}.
67
+
68
+ **CRITICAL**: Import packages by name only. Do NOT use CDN URLs:
69
+
70
+ ✅ CORRECT - Package name only:
71
+ \`\`\`typescript
72
+ import React from "react"
73
+ import _ from "lodash"
74
+ \`\`\`
75
+
76
+ ❌ WRONG - Direct URL imports:
77
+ \`\`\`typescript
78
+ import React from "https://esm.sh/react"
79
+ import _ from "https://cdn.skypack.dev/lodash"
80
+ import x from "https://unpkg.com/some-package"
81
+ \`\`\`
82
+
83
+ **Fix:** Use the package name only. Package resolution is handled automatically.`;
84
+ }
85
+ if (type === 'VERSION_SPECIFIER_IMPORT') {
86
+ return `Version specifiers in imports are not supported! Found on line ${lineNumber}.
87
+
88
+ **CRITICAL**: Import packages by name only. Do NOT include version numbers:
89
+
90
+ ✅ CORRECT - Package name only:
91
+ \`\`\`typescript
92
+ import React from "react"
93
+ import _ from "lodash"
94
+ import { something } from "@scope/package"
95
+ \`\`\`
96
+
97
+ ❌ WRONG - Version in import path:
98
+ \`\`\`typescript
99
+ import React from "react@18.2.0"
100
+ import _ from "lodash@^4.17.0"
101
+ import { x } from "@scope/package@1.0.0"
102
+ \`\`\`
103
+
104
+ **Fix:** Remove the version specifier (everything from @ onwards). Versions are managed separately.`;
105
+ }
106
+ if (type === 'JS_EXTENSION_IMPORT') {
107
+ return `Deep import paths must NOT include \`.js\` extension! Found on line ${lineNumber}.
108
+
109
+ **CRITICAL**: Remove the \`.js\` extension from deep import paths (paths with \`/\`):
110
+
111
+ ✅ CORRECT - No extension in deep import:
112
+ \`\`\`typescript
113
+ import { OrbitControls } from "three/examples/jsm/controls/OrbitControls"
114
+ \`\`\`
115
+
116
+ ❌ WRONG - Has .js extension in deep import:
117
+ \`\`\`typescript
118
+ import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"
119
+ \`\`\`
120
+
121
+ **Note:** Package names that literally end with ".js" (like \`decimal.js\`) are fine - this rule only applies to file paths within packages.
122
+
123
+ **Fix:** Remove \`.js\` from the end of the import path.`;
124
+ }
125
+ if (type === 'DYNAMIC_IMPORT') {
126
+ return `Dynamic imports are not supported! You used \`import('...')\` on line ${lineNumber}.
127
+
128
+ **CRITICAL**: All imports MUST be at the TOP of the file using standard ES6 import syntax:
129
+
130
+ ✅ CORRECT - Static import at top of file:
131
+ \`\`\`typescript
132
+ import { createRoot } from 'react-dom/client'
133
+
134
+ // Later in code...
135
+ const root = createRoot(rootElement)
136
+ root.render(<App />)
137
+ \`\`\`
138
+
139
+ ❌ WRONG - Dynamic import() in code:
140
+ \`\`\`typescript
141
+ // This is completely invalid!
142
+ import('react-dom/client').then(({ createRoot }) => {
143
+ const root = createRoot(rootElement)
144
+ root.render(<App />)
145
+ })
146
+ \`\`\`
147
+
148
+ **Fix:** Move ALL import statements to the top of the file using standard \`import\` syntax.`;
149
+ }
150
+ if (type === 'REDUNDANT_TB_DECLARATION') {
151
+ return `Redundant \`declare const tb\` found on line ${lineNumber}.
152
+ The \`tb\` global is already provided by the environment. Remove this declaration.`;
153
+ }
154
+ if (type === 'CONST_ENUM') {
155
+ return `\`const enum\` is not supported! Found on line ${lineNumber}.
156
+
157
+ **Fix:** Use a regular \`enum\` or an object with \`as const\`:
158
+
159
+ \`\`\`typescript
160
+ // Option 1: Regular enum
161
+ enum Direction { Up, Down, Left, Right }
162
+
163
+ // Option 2: Object literal (often better)
164
+ const Direction = { Up: 0, Down: 1, Left: 2, Right: 3 } as const
165
+ \`\`\`
166
+
167
+ \`const enum\` requires the full TypeScript compiler to inline values at compile time. Regular \`enum\` and object literals work identically at runtime.`;
168
+ }
169
+ if (type === 'NAMESPACE_DECLARATION') {
170
+ return `TypeScript \`namespace\` is not supported! Found on line ${lineNumber}.
171
+
172
+ **Fix:** Use ES modules instead:
173
+
174
+ \`\`\`typescript
175
+ // Instead of: namespace MyLib { export function foo() {} }
176
+ // Just use top-level exports:
177
+ export function foo() {}
178
+ \`\`\`
179
+
180
+ Namespaces are a legacy TypeScript pattern. Use standard ES module imports/exports instead.`;
181
+ }
182
+ if (type === 'COMMONJS_EXPORT_EQUALS') {
183
+ return `\`export =\` syntax is not supported! Found on line ${lineNumber}.
184
+
185
+ **Fix:** Use ES module \`export default\` instead:
186
+
187
+ \`\`\`typescript
188
+ // Instead of: export = myValue
189
+ export default myValue
190
+ \`\`\``;
191
+ }
192
+ if (type === 'COMMONJS_IMPORT_EQUALS') {
193
+ return `\`import x =\` syntax is not supported! Found on line ${lineNumber}.
194
+
195
+ **Fix:** Use ES module \`import\` instead:
196
+
197
+ \`\`\`typescript
198
+ // Instead of: import x = require('module')
199
+ import x from 'module'
200
+ \`\`\``;
201
+ }
202
+ if (type === 'MODULE_DECLARATION') {
203
+ return `TypeScript \`module\` declarations are not supported! Found on line ${lineNumber}.
204
+
205
+ **Fix:** Use ES modules instead. The \`module Foo {}\` syntax is a legacy TypeScript pattern — use standard imports/exports.`;
206
+ }
207
+ if (type === 'CSS_FILE_IMPORT') {
208
+ return `Importing CSS files is not supported! Found on line ${lineNumber}.
209
+
210
+ **CRITICAL**: CSS imports don't work here. The styles.css block is already applied to the page automatically.
211
+
212
+ ✅ CORRECT - Just remove the import. CSS from the styles.css block is already applied to the page.
213
+
214
+ ❌ WRONG - Importing CSS as a file:
215
+ \`\`\`typescript
216
+ import "./styles.css"
217
+ import styles from "./styles.css"
218
+ \`\`\`
219
+
220
+ **Fix:** Delete the CSS import line entirely. Write styles in the styles.css block — they are loaded automatically.`;
221
+ }
222
+ if (type === 'NAVIGATION') {
223
+ return `Navigation is forbidden in this sandboxed environment! Found on line ${lineNumber}.
224
+
225
+ **CRITICAL**: \`window.location\` changes, \`window.open()\`, and page reloads will break the app.
226
+
227
+ ✅ CORRECT - Reset application state programmatically:
228
+ \`\`\`typescript
229
+ setState(initialState)
230
+ \`\`\`
231
+
232
+ ❌ WRONG - Browser navigation:
233
+ \`\`\`typescript
234
+ window.location.reload()
235
+ window.location.href = "..."
236
+ window.open("...")
237
+ \`\`\`
238
+
239
+ **Fix:** Remove the navigation call. To "restart", reset your state variables instead.`;
240
+ }
241
+ return `CommonJS \`require()\` is not supported! Found on line ${lineNumber}.
242
+
243
+ **CRITICAL**: Use ES6 \`import\` statements at the TOP of the file:
244
+
245
+ ✅ CORRECT - ES6 import:
246
+ \`\`\`typescript
247
+ import { something } from 'module-name'
248
+ \`\`\`
249
+
250
+ ❌ WRONG - CommonJS require:
251
+ \`\`\`typescript
252
+ const something = require('module-name') // NOT SUPPORTED!
253
+ \`\`\`
254
+
255
+ **Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`;
256
+ }
257
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lint/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkBH,MAAM,MAAM,GAA0B,CAAC,QAAQ,CAAC,CAAA;AAChD,MAAM,IAAI,GAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAIxD,MAAM,KAAK,GAAW;IACpB,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE;IAC7E,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9E,yEAAyE;IACzE,gFAAgF;IAChF,8EAA8E;IAC9E,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,mCAAmC,EAAE,OAAO,EAAE,MAAM,EAAE;IAC9F,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,EAAE;IAC1E,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,EAAE;IAC1F,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,kCAAkC,EAAE,OAAO,EAAE,IAAI,EAAE;IAChG,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE;IAClE,E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