effect-start 0.32.0 → 0.34.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 (200) hide show
  1. package/dist/Entity.d.ts +6 -1
  2. package/dist/Entity.d.ts.map +1 -1
  3. package/dist/Entity.js +43 -5
  4. package/dist/Entity.js.map +1 -1
  5. package/dist/Fetch.js.map +1 -1
  6. package/dist/FileRouterCodegen.js +2 -2
  7. package/dist/FileRouterCodegen.js.map +1 -1
  8. package/dist/Html.d.ts +5 -11
  9. package/dist/Html.d.ts.map +1 -1
  10. package/dist/Html.js +21 -1
  11. package/dist/Html.js.map +1 -1
  12. package/dist/KeyValueStore.d.ts +37 -0
  13. package/dist/KeyValueStore.d.ts.map +1 -0
  14. package/dist/KeyValueStore.js +99 -0
  15. package/dist/KeyValueStore.js.map +1 -0
  16. package/dist/Route.d.ts +2 -2
  17. package/dist/Route.d.ts.map +1 -1
  18. package/dist/Route.js +1 -1
  19. package/dist/Route.js.map +1 -1
  20. package/dist/RouteBody.d.ts +2 -2
  21. package/dist/RouteBody.d.ts.map +1 -1
  22. package/dist/RouteHttp.d.ts.map +1 -1
  23. package/dist/RouteHttp.js +45 -35
  24. package/dist/RouteHttp.js.map +1 -1
  25. package/dist/RouteMount.d.ts +20 -31
  26. package/dist/RouteMount.d.ts.map +1 -1
  27. package/dist/RouteMount.js +0 -15
  28. package/dist/RouteMount.js.map +1 -1
  29. package/dist/Start.d.ts.map +1 -1
  30. package/dist/Start.js +4 -0
  31. package/dist/Start.js.map +1 -1
  32. package/dist/StaticFiles.d.ts +2 -2
  33. package/dist/StaticFiles.d.ts.map +1 -1
  34. package/dist/StaticFiles.js +7 -8
  35. package/dist/StaticFiles.js.map +1 -1
  36. package/dist/bun/BunRoute.d.ts.map +1 -1
  37. package/dist/bun/BunRoute.js +90 -78
  38. package/dist/bun/BunRoute.js.map +1 -1
  39. package/dist/bun/BunServer.d.ts +1 -1
  40. package/dist/bun/BunServer.d.ts.map +1 -1
  41. package/dist/bun/BunServer.js +8 -1
  42. package/dist/bun/BunServer.js.map +1 -1
  43. package/dist/bundler/BundleRoute.d.ts +4 -4
  44. package/dist/bundler/BundleRoute.d.ts.map +1 -1
  45. package/dist/datastar/attributes/computed.js +3 -3
  46. package/dist/datastar/attributes/computed.js.map +1 -1
  47. package/dist/datastar/attributes/on.js +11 -36
  48. package/dist/datastar/attributes/on.js.map +1 -1
  49. package/dist/datastar/engine.d.ts +9 -7
  50. package/dist/datastar/engine.d.ts.map +1 -1
  51. package/dist/datastar/engine.js +45 -29
  52. package/dist/datastar/engine.js.map +1 -1
  53. package/dist/datastar/jsx.d.ts +70 -0
  54. package/dist/datastar/jsx.d.ts.map +1 -0
  55. package/dist/datastar/jsx.js +2 -0
  56. package/dist/datastar/jsx.js.map +1 -0
  57. package/dist/datastar/window.d.ts +8 -0
  58. package/dist/datastar/window.d.ts.map +1 -0
  59. package/dist/datastar/window.js +4 -0
  60. package/dist/datastar/window.js.map +1 -0
  61. package/dist/experimental/KeyValueStore.d.ts +37 -0
  62. package/dist/experimental/KeyValueStore.d.ts.map +1 -0
  63. package/dist/experimental/KeyValueStore.js +99 -0
  64. package/dist/experimental/KeyValueStore.js.map +1 -0
  65. package/dist/experimental/SqlCache.d.ts +19 -0
  66. package/dist/experimental/SqlCache.d.ts.map +1 -0
  67. package/dist/experimental/SqlCache.js +35 -0
  68. package/dist/experimental/SqlCache.js.map +1 -0
  69. package/dist/experimental/SqlIntrospect.d.ts +92 -0
  70. package/dist/experimental/SqlIntrospect.d.ts.map +1 -0
  71. package/dist/experimental/SqlIntrospect.js +478 -0
  72. package/dist/experimental/SqlIntrospect.js.map +1 -0
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +1 -0
  76. package/dist/index.js.map +1 -1
  77. package/dist/jsx-runtime.d.ts +2 -2
  78. package/dist/jsx-runtime.d.ts.map +1 -1
  79. package/dist/jsx.d.ts +3216 -0
  80. package/dist/jsx.d.ts.map +1 -0
  81. package/dist/jsx.js +6 -0
  82. package/dist/jsx.js.map +1 -0
  83. package/dist/lint/plugin.d.ts +4 -3
  84. package/dist/lint/plugin.js +56 -17
  85. package/dist/lint/plugin.js.map +1 -1
  86. package/dist/sql/index.d.ts +0 -2
  87. package/dist/sql/index.d.ts.map +1 -1
  88. package/dist/sql/index.js +0 -2
  89. package/dist/sql/index.js.map +1 -1
  90. package/dist/studio/StudioLogger.d.ts.map +1 -1
  91. package/dist/studio/StudioLogger.js +2 -1
  92. package/dist/studio/StudioLogger.js.map +1 -1
  93. package/dist/studio/StudioStore.d.ts +3 -0
  94. package/dist/studio/StudioStore.d.ts.map +1 -1
  95. package/dist/studio/StudioStore.js +13 -0
  96. package/dist/studio/StudioStore.js.map +1 -1
  97. package/dist/studio/_Pretty.d.ts +4 -0
  98. package/dist/studio/_Pretty.d.ts.map +1 -0
  99. package/dist/studio/_Pretty.js +56 -0
  100. package/dist/studio/_Pretty.js.map +1 -0
  101. package/dist/studio/routes/errors/route.d.ts +2 -2
  102. package/dist/studio/routes/fiberDetail.d.ts +2 -2
  103. package/dist/studio/routes/fibers/route.d.ts +2 -2
  104. package/dist/studio/routes/layout.d.ts +2 -0
  105. package/dist/studio/routes/layout.d.ts.map +1 -1
  106. package/dist/studio/routes/layout.html +3 -12
  107. package/dist/studio/routes/layout.js +6 -1
  108. package/dist/studio/routes/layout.js.map +1 -1
  109. package/dist/studio/routes/logs/route.d.ts +2 -2
  110. package/dist/studio/routes/metrics/route.d.ts +2 -2
  111. package/dist/studio/routes/route.d.ts +2 -2
  112. package/dist/studio/routes/routes/route.d.ts +2 -2
  113. package/dist/studio/routes/services/route.d.ts +2 -2
  114. package/dist/studio/routes/system/route.d.ts +2 -2
  115. package/dist/studio/routes/traceDetail.d.ts +2 -2
  116. package/dist/studio/routes/traces/route.d.ts +2 -2
  117. package/dist/studio/routes/traces/route.d.ts.map +1 -1
  118. package/dist/studio/routes/traces/route.js +5 -2
  119. package/dist/studio/routes/traces/route.js.map +1 -1
  120. package/dist/studio/routes/tree.d.ts +22 -0
  121. package/dist/studio/routes/tree.d.ts.map +1 -1
  122. package/dist/studio/ui/Errors.d.ts +1 -1
  123. package/dist/studio/ui/Errors.js +1 -1
  124. package/dist/studio/ui/Errors.js.map +1 -1
  125. package/dist/studio/ui/Fibers.d.ts +2 -2
  126. package/dist/studio/ui/Fibers.d.ts.map +1 -1
  127. package/dist/studio/ui/Fibers.js +4 -3
  128. package/dist/studio/ui/Fibers.js.map +1 -1
  129. package/dist/studio/ui/Logs.d.ts +1 -1
  130. package/dist/studio/ui/Logs.d.ts.map +1 -1
  131. package/dist/studio/ui/Logs.js +2 -1
  132. package/dist/studio/ui/Logs.js.map +1 -1
  133. package/dist/studio/ui/Metrics.d.ts +1 -1
  134. package/dist/studio/ui/Routes.d.ts +1 -1
  135. package/dist/studio/ui/Routes.d.ts.map +1 -1
  136. package/dist/studio/ui/Services.d.ts +1 -1
  137. package/dist/studio/ui/Services.d.ts.map +1 -1
  138. package/dist/studio/ui/Shell.d.ts +2 -2
  139. package/dist/studio/ui/Shell.d.ts.map +1 -1
  140. package/dist/studio/ui/System.d.ts +1 -1
  141. package/dist/studio/ui/Traces.d.ts +3 -3
  142. package/dist/studio/ui/Traces.d.ts.map +1 -1
  143. package/dist/studio/ui/Traces.js +5 -11
  144. package/dist/studio/ui/Traces.js.map +1 -1
  145. package/dist/studio/ui/_PrettyValue.d.ts +10 -0
  146. package/dist/studio/ui/_PrettyValue.d.ts.map +1 -0
  147. package/dist/studio/ui/_PrettyValue.js +27 -0
  148. package/dist/studio/ui/_PrettyValue.js.map +1 -0
  149. package/dist/tailwind/TailwindPlugin.d.ts.map +1 -1
  150. package/dist/tailwind/TailwindPlugin.js +89 -62
  151. package/dist/tailwind/TailwindPlugin.js.map +1 -1
  152. package/dist/ts/import-plugin.cjs +388 -0
  153. package/dist/ts/import-plugin.cjs.map +1 -0
  154. package/dist/ts/import-plugin.d.cts +87 -0
  155. package/dist/ts/import-plugin.d.cts.map +1 -0
  156. package/dist/ts/import-plugin.d.ts +87 -0
  157. package/dist/ts/import-plugin.d.ts.map +1 -0
  158. package/dist/ts/import-plugin.js +390 -0
  159. package/dist/ts/import-plugin.js.map +1 -0
  160. package/package.json +109 -8
  161. package/src/Entity.ts +62 -8
  162. package/src/Fetch.ts +1 -1
  163. package/src/FileRouterCodegen.ts +2 -2
  164. package/src/Html.ts +28 -21
  165. package/src/Route.ts +2 -2
  166. package/src/RouteBody.ts +2 -2
  167. package/src/RouteHttp.ts +45 -47
  168. package/src/RouteMount.ts +23 -65
  169. package/src/Start.ts +4 -0
  170. package/src/StaticFiles.ts +7 -10
  171. package/src/bun/BunRoute.ts +117 -95
  172. package/src/bun/BunServer.ts +9 -2
  173. package/src/datastar/README.md +24 -8
  174. package/src/datastar/attributes/computed.ts +3 -3
  175. package/src/datastar/attributes/on.ts +11 -37
  176. package/src/datastar/engine.ts +61 -37
  177. package/src/datastar/jsx.d.ts +12 -26
  178. package/src/datastar/types.d.ts +8 -0
  179. package/src/experimental/KeyValueStore.ts +161 -0
  180. package/src/{sql → experimental}/SqlCache.ts +1 -1
  181. package/src/{sql → experimental}/SqlIntrospect.ts +1 -1
  182. package/src/index.ts +1 -0
  183. package/src/jsx-runtime.ts +1 -1
  184. package/src/jsx.d.ts +17 -2
  185. package/src/lint/plugin.js +54 -19
  186. package/src/sql/index.ts +0 -2
  187. package/src/studio/StudioLogger.ts +2 -1
  188. package/src/studio/StudioStore.ts +18 -0
  189. package/src/studio/_Pretty.ts +59 -0
  190. package/src/studio/routes/layout.html +3 -12
  191. package/src/studio/routes/layout.tsx +9 -1
  192. package/src/studio/routes/traces/route.tsx +5 -1
  193. package/src/studio/ui/Errors.tsx +1 -1
  194. package/src/studio/ui/Fibers.tsx +14 -10
  195. package/src/studio/ui/Logs.tsx +15 -10
  196. package/src/studio/ui/Traces.tsx +40 -68
  197. package/src/studio/ui/_PrettyValue.tsx +34 -0
  198. package/src/tailwind/TailwindPlugin.ts +102 -75
  199. package/src/RouteTrie.ts +0 -205
  200. package/src/experimental/index.ts +0 -1
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+ const ts = require("typescript/lib/tsserverlibrary");
3
+ const path = require("node:path");
4
+ /**
5
+ * @typedef {Object} PluginOptions
6
+ * @property {readonly string[]} [paths]
7
+ * @property {boolean} [ignoreNamedExport]
8
+ * @property {"PascalCase" | "camelCase"} [nameTransform]
9
+ * @property {boolean} [capitalizedFilesOnly]
10
+ */
11
+ /**
12
+ * @typedef {Object} CompletionEntryData
13
+ * @property {string} [modulePath]
14
+ * @memberof ts
15
+ */
16
+ function init() {
17
+ /**
18
+ * @param {ts.server.PluginCreateInfo} info
19
+ */
20
+ function create(info) {
21
+ /**
22
+ * @param {...unknown} params
23
+ */
24
+ const log = (...params) => {
25
+ const text = params.map((p) => (p ? JSON.stringify(p) : p)).join(" ");
26
+ info.project.projectService.logger.info(`[namespace-import] ${text}`);
27
+ };
28
+ log("Start init");
29
+ const getCompletionsAtPosition = info.languageService.getCompletionsAtPosition;
30
+ /**
31
+ * @param {string} fileName
32
+ * @param {number} position
33
+ * @param {ts.GetCompletionsAtPositionOptions} [options]
34
+ * @returns {ts.CompletionInfo | undefined}
35
+ */
36
+ info.languageService.getCompletionsAtPosition = (fileName, position, options) => {
37
+ log("getCompletionsAtPosition", { fileName, position, options });
38
+ const original = getCompletionsAtPosition(fileName, position, options);
39
+ if (original == null ||
40
+ options?.triggerCharacter != null ||
41
+ !isAutoCompletablePosition(info.languageService.getProgram()?.getSourceFile(fileName), position)) {
42
+ return original;
43
+ }
44
+ const originalEntries = filterNamedImportEntries(original.entries, info);
45
+ const namespaceImportEntries = getCompletionEntries(info);
46
+ original.entries = [...originalEntries, ...namespaceImportEntries];
47
+ return original;
48
+ };
49
+ const getCompletionEntryDetails = info.languageService.getCompletionEntryDetails;
50
+ /**
51
+ * @param {string} fileName
52
+ * @param {number} position
53
+ * @param {string} name
54
+ * @param {ts.FormatCodeOptions} [options]
55
+ * @param {string} [source]
56
+ * @param {ts.UserPreferences} [preferences]
57
+ * @param {ts.CompletionEntryData} [data]
58
+ * @returns {ts.CompletionEntryDetails | undefined}
59
+ */
60
+ info.languageService.getCompletionEntryDetails = (fileName, position, name, options, source, preferences, data) => {
61
+ log("getCompletionEntryDetails", { fileName, position, name, options, source });
62
+ if (data?.modulePath == null) {
63
+ return getCompletionEntryDetails(fileName, position, name, options, source, preferences, data);
64
+ }
65
+ return getCompletionEntryDetails(name, fileName, data.modulePath, info);
66
+ };
67
+ const getCodeFixesAtPosition = info.languageService.getCodeFixesAtPosition;
68
+ /**
69
+ * @param {string} fileName
70
+ * @param {number} start
71
+ * @param {number} end
72
+ * @param {readonly number[]} errorCodes
73
+ * @param {ts.FormatCodeSettings} formatOptions
74
+ * @param {ts.UserPreferences} preferences
75
+ * @returns {readonly ts.CodeFixAction[]}
76
+ */
77
+ info.languageService.getCodeFixesAtPosition = (fileName, start, end, errorCodes, formatOptions, preferences) => {
78
+ log("getCodeFixesAtPosition", {
79
+ fileName,
80
+ start,
81
+ end,
82
+ errorCodes,
83
+ formatOptions,
84
+ preferences,
85
+ });
86
+ const original = getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions, preferences);
87
+ const importAction = getCodeFixActionByName(fileName, start, end, info);
88
+ if (importAction) {
89
+ return [importAction, ...original];
90
+ }
91
+ return original;
92
+ };
93
+ }
94
+ return { create };
95
+ }
96
+ /**
97
+ * @param {ts.server.PluginCreateInfo} info
98
+ * @returns {ts.CompletionEntry[]}
99
+ */
100
+ function getCompletionEntries(info) {
101
+ const modulePaths = getModulePathsToImport(info.config.options, info.project);
102
+ return modulePaths.map((modulePath) => {
103
+ const name = transformImportName(getFileNameWithoutExt(modulePath), info.config.options);
104
+ return {
105
+ name: name,
106
+ kind: ScriptElementKind.alias,
107
+ source: modulePath,
108
+ sortText: "16" + name, // Lower priority than local symbols (TS uses 11-15 for locals)
109
+ hasAction: true,
110
+ isImportStatementCompletion: true,
111
+ data: {
112
+ exportName: name,
113
+ modulePath: modulePath,
114
+ },
115
+ };
116
+ });
117
+ }
118
+ /**
119
+ * @param {ts.CompletionEntry[]} entries
120
+ * @param {ts.server.PluginCreateInfo} info
121
+ * @returns {ts.CompletionEntry[]}
122
+ */
123
+ function filterNamedImportEntries(entries, info) {
124
+ /** @type {PluginOptions} */
125
+ const options = info.config.options;
126
+ if (!options.ignoreNamedExport) {
127
+ return entries;
128
+ }
129
+ const currentDir = info.project.getCurrentDirectory();
130
+ const dirPaths = options.paths.map((dirPath) => path.resolve(currentDir, dirPath));
131
+ return entries.filter((entry) => {
132
+ return !dirPaths.some((dirPath) => entry.data?.exportName && entry.data.fileName?.startsWith(dirPath));
133
+ });
134
+ }
135
+ /**
136
+ * @param {ts.Node} parent
137
+ * @param {number} pos
138
+ * @returns {ts.Node | undefined}
139
+ */
140
+ function getTokenAtPosition(parent, pos) {
141
+ if (pos < parent.pos || pos >= parent.end)
142
+ return;
143
+ if (parent.kind >= ts.SyntaxKind.FirstToken && parent.kind <= ts.SyntaxKind.LastToken)
144
+ return parent;
145
+ outer: while (true) {
146
+ for (const child of parent.getChildren()) {
147
+ if (child.end > pos && child.kind !== ts.SyntaxKind.JSDocComment) {
148
+ if (child.kind >= ts.SyntaxKind.FirstToken && child.kind <= ts.SyntaxKind.LastToken)
149
+ return child;
150
+ parent = child;
151
+ continue outer;
152
+ }
153
+ }
154
+ return;
155
+ }
156
+ }
157
+ /**
158
+ * @param {ts.SourceFile | undefined} sourceFile
159
+ * @param {number} position
160
+ * @returns {boolean}
161
+ */
162
+ function isAutoCompletablePosition(sourceFile, position) {
163
+ if (!sourceFile) {
164
+ return false;
165
+ }
166
+ const token = getTokenAtPosition(sourceFile, position)?.kind ?? ts.SyntaxKind.Unknown;
167
+ return token !== ts.SyntaxKind.StringLiteral;
168
+ }
169
+ /**
170
+ * @param {string} name
171
+ * @param {string} selfPath
172
+ * @param {string} modulePath
173
+ * @param {ts.server.PluginCreateInfo} info
174
+ * @returns {ts.CompletionEntryDetails}
175
+ */
176
+ function getCompletionEntryDetails(name, selfPath, modulePath, info) {
177
+ /** @type {ts.CodeFixAction} */
178
+ const action = getCodeFixActionFromPath(name, selfPath, modulePath, info.project);
179
+ return {
180
+ name: name,
181
+ kind: ScriptElementKind.alias,
182
+ kindModifiers: "",
183
+ displayParts: [],
184
+ codeActions: [action],
185
+ };
186
+ }
187
+ /**
188
+ * @param {string} selfPath
189
+ * @param {number} start
190
+ * @param {number} end
191
+ * @param {ts.server.PluginCreateInfo} info
192
+ * @returns {ts.CodeFixAction | null}
193
+ */
194
+ function getCodeFixActionByName(selfPath, start, end, info) {
195
+ const name = info.languageService.getProgram()?.getSourceFile(selfPath)?.text.slice(start, end);
196
+ if (!name) {
197
+ return null;
198
+ }
199
+ const modulePaths = getModulePathsToImport(info.config.options, info.project);
200
+ const modulePath = modulePaths.find((filePath) => getFileNameWithoutExt(filePath) === name);
201
+ if (modulePath) {
202
+ return getCodeFixActionFromPath(name, selfPath, modulePath, info.project);
203
+ }
204
+ else {
205
+ return null;
206
+ }
207
+ }
208
+ /**
209
+ * @param {PluginOptions} options
210
+ * @param {ts.server.Project} project
211
+ * @returns {string[]}
212
+ */
213
+ function getModulePathsToImport(options, project) {
214
+ const currentDir = project.getCurrentDirectory();
215
+ let modulePaths;
216
+ if (options.paths && options.paths.length > 0) {
217
+ // Use specified paths
218
+ modulePaths = options.paths.flatMap((dirPath) => {
219
+ return project.readDirectory(path.resolve(currentDir, dirPath), [
220
+ ".ts",
221
+ ".tsx",
222
+ ".js",
223
+ ".jsx",
224
+ ]);
225
+ });
226
+ }
227
+ else {
228
+ // Default: scan entire project directory
229
+ modulePaths = project.readDirectory(currentDir, [".ts", ".tsx", ".js", ".jsx"], undefined, undefined, 10);
230
+ }
231
+ const filteredPaths = modulePaths.filter((filePath) => {
232
+ if (filePath.includes("/node_modules/")) {
233
+ return false;
234
+ }
235
+ const basename = getFileNameWithoutExt(filePath);
236
+ if (basename.includes(".")) {
237
+ return false;
238
+ }
239
+ if (options.capitalizedFilesOnly ?? true) {
240
+ return /^[A-Z]/.test(basename);
241
+ }
242
+ return true;
243
+ });
244
+ return [...new Set(filteredPaths)];
245
+ }
246
+ /**
247
+ * @param {string} filePath
248
+ * @returns {string}
249
+ */
250
+ function getFileNameWithoutExt(filePath) {
251
+ const ext = path.extname(filePath);
252
+ return path.basename(filePath, ext);
253
+ }
254
+ /**
255
+ * @param {string} filePath
256
+ * @returns {string}
257
+ */
258
+ function getFilePathWithoutExt(filePath) {
259
+ const ext = path.extname(filePath);
260
+ return filePath.slice(0, filePath.length - ext.length);
261
+ }
262
+ /**
263
+ * @param {string} selfPath
264
+ * @param {string} modulePath
265
+ * @param {ts.server.Project} project
266
+ * @returns {string}
267
+ */
268
+ function getModuleSpceifier(selfPath, modulePath, project) {
269
+ const compilerOptions = project.getCompilerOptions();
270
+ const program = project.getLanguageService().getProgram();
271
+ const importingSourceFile = program?.getSourceFile(selfPath);
272
+ // Use TypeScript's internal API with the project's actual host
273
+ if (importingSourceFile && project.projectService?.host) {
274
+ try {
275
+ const host = project.projectService.host;
276
+ const moduleSpecifier = ts.moduleSpecifiers.getModuleSpecifier(compilerOptions, importingSourceFile, selfPath, modulePath, host);
277
+ return moduleSpecifier;
278
+ }
279
+ catch (e) {
280
+ // If the internal API fails, we need a fallback
281
+ }
282
+ }
283
+ // Simple fallback that respects importModuleSpecifierEnding
284
+ let specifier;
285
+ if (compilerOptions.baseUrl) {
286
+ specifier = path.posix.relative(compilerOptions.baseUrl, modulePath);
287
+ }
288
+ else {
289
+ const selfDir = path.dirname(selfPath);
290
+ const relativePath = path.relative(selfDir, modulePath);
291
+ specifier = relativePath.startsWith(".") ? relativePath : "./" + relativePath;
292
+ // Convert Windows paths to posix for import statements
293
+ specifier = specifier.replace(/\\/g, "/");
294
+ }
295
+ // Remove the original extension
296
+ specifier = getFilePathWithoutExt(specifier);
297
+ // Apply importModuleSpecifierEnding if specified
298
+ if (compilerOptions.importModuleSpecifierEnding === "js") {
299
+ // Use the actual file extension when importModuleSpecifierEnding is "js"
300
+ const originalExt = path.extname(modulePath);
301
+ specifier += originalExt;
302
+ }
303
+ else if (compilerOptions.importModuleSpecifierEnding === "minimal") {
304
+ // Keep without extension (current behavior)
305
+ }
306
+ else {
307
+ // Default behavior - add the original extension
308
+ const originalExt = path.extname(modulePath);
309
+ specifier += originalExt;
310
+ }
311
+ return specifier;
312
+ }
313
+ /**
314
+ * @param {string} name
315
+ * @param {string} selfPath
316
+ * @param {string} modulePath
317
+ * @param {ts.server.Project} project
318
+ * @returns {ts.CodeFixAction}
319
+ */
320
+ function getCodeFixActionFromPath(name, selfPath, modulePath, project) {
321
+ const moduleSpecifier = getModuleSpceifier(selfPath, modulePath, project);
322
+ const text = `import * as ${name} from "${moduleSpecifier}";\n`;
323
+ return {
324
+ fixName: "namespace-import",
325
+ description: text,
326
+ changes: [
327
+ {
328
+ fileName: selfPath,
329
+ textChanges: [
330
+ {
331
+ span: {
332
+ start: 0,
333
+ length: 0,
334
+ },
335
+ newText: text,
336
+ },
337
+ ],
338
+ },
339
+ ],
340
+ commands: [],
341
+ };
342
+ }
343
+ /**
344
+ * @param {string} name
345
+ * @param {PluginOptions} options
346
+ * @returns {string}
347
+ */
348
+ function transformImportName(name, options) {
349
+ if (options.nameTransform) {
350
+ return stringCase(name, { pascalCase: options.nameTransform === "PascalCase" });
351
+ }
352
+ else {
353
+ return name;
354
+ }
355
+ }
356
+ /**
357
+ * Simple string case transformation implementation
358
+ * @param {string} str
359
+ * @param {Object} [options]
360
+ * @param {boolean} [options.pascalCase=false]
361
+ * @returns {string}
362
+ */
363
+ function stringCase(str, options = {}) {
364
+ const words = str
365
+ .replace(/[^a-zA-Z0-9]/g, " ")
366
+ .split(/\s+/)
367
+ .filter(Boolean);
368
+ const result = words
369
+ .map((word, index) => {
370
+ if (index === 0 && !options.pascalCase) {
371
+ return word.toLowerCase();
372
+ }
373
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
374
+ })
375
+ .join("");
376
+ return result;
377
+ }
378
+ module.exports = init;
379
+ module.exports.getCompletionEntries = getCompletionEntries;
380
+ module.exports.filterNamedImportEntries = filterNamedImportEntries;
381
+ module.exports.isAutoCompletablePosition = isAutoCompletablePosition;
382
+ module.exports.getCompletionEntryDetails = getCompletionEntryDetails;
383
+ module.exports.getCodeFixActionByName = getCodeFixActionByName;
384
+ module.exports.getModuleSpceifier = getModuleSpceifier;
385
+ module.exports.getModulePathsToImport = getModulePathsToImport;
386
+ module.exports.getFileNameWithoutExt = getFileNameWithoutExt;
387
+ module.exports.transformImportName = transformImportName;
388
+ //# sourceMappingURL=import-plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-plugin.cjs","sourceRoot":"","sources":["../../src/ts/import-plugin.cjs"],"names":[],"mappings":";AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAA;AACpD,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAEjC;;;;;;GAMG;AAEH;;;;GAIG;AACH,SAAS,IAAI;IACX;;OAEG;IACH,SAAS,MAAM,CAAC,IAAI;QAClB;;WAEG;QACH,MAAM,GAAG,GAAG,CAAC,GAAG,MAAM,EAAE,EAAE;YACxB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACrE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAA;QACvE,CAAC,CAAA;QAED,GAAG,CAAC,YAAY,CAAC,CAAA;QAEjB,MAAM,wBAAwB,GAAG,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAA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,CAAA;AAC9D,MAAM,CAAC,OAAO,CAAC,qBAAqB,GAAG,qBAAqB,CAAA;AAC5D,MAAM,CAAC,OAAO,CAAC,mBAAmB,GAAG,mBAAmB,CAAA"}
@@ -0,0 +1,87 @@
1
+ export = init;
2
+ /**
3
+ * @typedef {Object} PluginOptions
4
+ * @property {readonly string[]} [paths]
5
+ * @property {boolean} [ignoreNamedExport]
6
+ * @property {"PascalCase" | "camelCase"} [nameTransform]
7
+ * @property {boolean} [capitalizedFilesOnly]
8
+ */
9
+ /**
10
+ * @typedef {Object} CompletionEntryData
11
+ * @property {string} [modulePath]
12
+ * @memberof ts
13
+ */
14
+ declare function init(): {
15
+ create: (info: ts.server.PluginCreateInfo) => void;
16
+ };
17
+ declare namespace init {
18
+ export { getCompletionEntries, filterNamedImportEntries, isAutoCompletablePosition, getCompletionEntryDetails, getCodeFixActionByName, getModuleSpceifier, getModulePathsToImport, getFileNameWithoutExt, transformImportName, PluginOptions, CompletionEntryData };
19
+ }
20
+ import ts = require("typescript");
21
+ /**
22
+ * @param {ts.server.PluginCreateInfo} info
23
+ * @returns {ts.CompletionEntry[]}
24
+ */
25
+ declare function getCompletionEntries(info: ts.server.PluginCreateInfo): ts.CompletionEntry[];
26
+ /**
27
+ * @param {ts.CompletionEntry[]} entries
28
+ * @param {ts.server.PluginCreateInfo} info
29
+ * @returns {ts.CompletionEntry[]}
30
+ */
31
+ declare function filterNamedImportEntries(entries: ts.CompletionEntry[], info: ts.server.PluginCreateInfo): ts.CompletionEntry[];
32
+ /**
33
+ * @param {ts.SourceFile | undefined} sourceFile
34
+ * @param {number} position
35
+ * @returns {boolean}
36
+ */
37
+ declare function isAutoCompletablePosition(sourceFile: ts.SourceFile | undefined, position: number): boolean;
38
+ /**
39
+ * @param {string} name
40
+ * @param {string} selfPath
41
+ * @param {string} modulePath
42
+ * @param {ts.server.PluginCreateInfo} info
43
+ * @returns {ts.CompletionEntryDetails}
44
+ */
45
+ declare function getCompletionEntryDetails(name: string, selfPath: string, modulePath: string, info: ts.server.PluginCreateInfo): ts.CompletionEntryDetails;
46
+ /**
47
+ * @param {string} selfPath
48
+ * @param {number} start
49
+ * @param {number} end
50
+ * @param {ts.server.PluginCreateInfo} info
51
+ * @returns {ts.CodeFixAction | null}
52
+ */
53
+ declare function getCodeFixActionByName(selfPath: string, start: number, end: number, info: ts.server.PluginCreateInfo): ts.CodeFixAction | null;
54
+ /**
55
+ * @param {string} selfPath
56
+ * @param {string} modulePath
57
+ * @param {ts.server.Project} project
58
+ * @returns {string}
59
+ */
60
+ declare function getModuleSpceifier(selfPath: string, modulePath: string, project: ts.server.Project): string;
61
+ /**
62
+ * @param {PluginOptions} options
63
+ * @param {ts.server.Project} project
64
+ * @returns {string[]}
65
+ */
66
+ declare function getModulePathsToImport(options: PluginOptions, project: ts.server.Project): string[];
67
+ /**
68
+ * @param {string} filePath
69
+ * @returns {string}
70
+ */
71
+ declare function getFileNameWithoutExt(filePath: string): string;
72
+ /**
73
+ * @param {string} name
74
+ * @param {PluginOptions} options
75
+ * @returns {string}
76
+ */
77
+ declare function transformImportName(name: string, options: PluginOptions): string;
78
+ type PluginOptions = {
79
+ paths?: readonly string[] | undefined;
80
+ ignoreNamedExport?: boolean | undefined;
81
+ nameTransform?: "PascalCase" | "camelCase" | undefined;
82
+ capitalizedFilesOnly?: boolean | undefined;
83
+ };
84
+ type CompletionEntryData = {
85
+ modulePath?: string | undefined;
86
+ };
87
+ //# sourceMappingURL=import-plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-plugin.d.cts","sourceRoot":"","sources":["../../src/ts/import-plugin.cjs"],"names":[],"mappings":";AAGA;;;;;;GAMG;AAEH;;;;GAIG;AACH;mBAEa,EAAE,CAAC,MAAM,CAAC,gBAAgB;EA0HtC;;;;;AAGD;;;GAGG;AACH,4CAHW,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,eAAe,EAAE,CAoBhC;AAED;;;;GAIG;AACH,mDAJW,EAAE,CAAC,eAAe,EAAE,QACpB,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,eAAe,EAAE,CAgBhC;AAwBD;;;;GAIG;AACH,uDAJW,EAAE,CAAC,UAAU,GAAG,SAAS,YACzB,MAAM,GACJ,OAAO,CAQnB;AAED;;;;;;GAMG;AACH,iDANW,MAAM,YACN,MAAM,cACN,MAAM,QACN,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,sBAAsB,CAYrC;AAED;;;;;;GAMG;AACH,kDANW,MAAM,SACN,MAAM,OACN,MAAM,QACN,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,aAAa,GAAG,IAAI,CAenC;AAsED;;;;;GAKG;AACH,8CALW,MAAM,cACN,MAAM,WACN,EAAE,CAAC,MAAM,CAAC,OAAO,GACf,MAAM,CAoDlB;AA5HD;;;;GAIG;AACH,iDAJW,aAAa,WACb,EAAE,CAAC,MAAM,CAAC,OAAO,GACf,MAAM,EAAE,CA6CpB;AAED;;;GAGG;AACH,iDAHW,MAAM,GACJ,MAAM,CAKlB;AAoGD;;;;GAIG;AACH,2CAJW,MAAM,WACN,aAAa,GACX,MAAM,CAQlB"}
@@ -0,0 +1,87 @@
1
+ export = init;
2
+ /**
3
+ * @typedef {Object} PluginOptions
4
+ * @property {readonly string[]} [paths]
5
+ * @property {boolean} [ignoreNamedExport]
6
+ * @property {"PascalCase" | "camelCase"} [nameTransform]
7
+ * @property {boolean} [capitalizedFilesOnly]
8
+ */
9
+ /**
10
+ * @typedef {Object} CompletionEntryData
11
+ * @property {string} [modulePath]
12
+ * @memberof ts
13
+ */
14
+ declare function init(): {
15
+ create: (info: ts.server.PluginCreateInfo) => void;
16
+ };
17
+ declare namespace init {
18
+ export { getCompletionEntries, filterNamedImportEntries, isAutoCompletablePosition, getCompletionEntryDetails, getCodeFixActionByName, getModuleSpceifier, getModulePathsToImport, getFileNameWithoutExt, transformImportName, PluginOptions, CompletionEntryData };
19
+ }
20
+ import ts = require("typescript");
21
+ /**
22
+ * @param {ts.server.PluginCreateInfo} info
23
+ * @returns {ts.CompletionEntry[]}
24
+ */
25
+ declare function getCompletionEntries(info: ts.server.PluginCreateInfo): ts.CompletionEntry[];
26
+ /**
27
+ * @param {ts.CompletionEntry[]} entries
28
+ * @param {ts.server.PluginCreateInfo} info
29
+ * @returns {ts.CompletionEntry[]}
30
+ */
31
+ declare function filterNamedImportEntries(entries: ts.CompletionEntry[], info: ts.server.PluginCreateInfo): ts.CompletionEntry[];
32
+ /**
33
+ * @param {ts.SourceFile | undefined} sourceFile
34
+ * @param {number} position
35
+ * @returns {boolean}
36
+ */
37
+ declare function isAutoCompletablePosition(sourceFile: ts.SourceFile | undefined, position: number): boolean;
38
+ /**
39
+ * @param {string} name
40
+ * @param {string} selfPath
41
+ * @param {string} modulePath
42
+ * @param {ts.server.PluginCreateInfo} info
43
+ * @returns {ts.CompletionEntryDetails}
44
+ */
45
+ declare function getCompletionEntryDetails(name: string, selfPath: string, modulePath: string, info: ts.server.PluginCreateInfo): ts.CompletionEntryDetails;
46
+ /**
47
+ * @param {string} selfPath
48
+ * @param {number} start
49
+ * @param {number} end
50
+ * @param {ts.server.PluginCreateInfo} info
51
+ * @returns {ts.CodeFixAction | null}
52
+ */
53
+ declare function getCodeFixActionByName(selfPath: string, start: number, end: number, info: ts.server.PluginCreateInfo): ts.CodeFixAction | null;
54
+ /**
55
+ * @param {string} selfPath
56
+ * @param {string} modulePath
57
+ * @param {ts.server.Project} project
58
+ * @returns {string}
59
+ */
60
+ declare function getModuleSpceifier(selfPath: string, modulePath: string, project: ts.server.Project): string;
61
+ /**
62
+ * @param {PluginOptions} options
63
+ * @param {ts.server.Project} project
64
+ * @returns {string[]}
65
+ */
66
+ declare function getModulePathsToImport(options: PluginOptions, project: ts.server.Project): string[];
67
+ /**
68
+ * @param {string} filePath
69
+ * @returns {string}
70
+ */
71
+ declare function getFileNameWithoutExt(filePath: string): string;
72
+ /**
73
+ * @param {string} name
74
+ * @param {PluginOptions} options
75
+ * @returns {string}
76
+ */
77
+ declare function transformImportName(name: string, options: PluginOptions): string;
78
+ type PluginOptions = {
79
+ paths?: readonly string[] | undefined;
80
+ ignoreNamedExport?: boolean | undefined;
81
+ nameTransform?: "PascalCase" | "camelCase" | undefined;
82
+ capitalizedFilesOnly?: boolean | undefined;
83
+ };
84
+ type CompletionEntryData = {
85
+ modulePath?: string | undefined;
86
+ };
87
+ //# sourceMappingURL=import-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-plugin.d.ts","sourceRoot":"","sources":["../../src/ts/import-plugin.js"],"names":[],"mappings":";AAGA;;;;;;GAMG;AAEH;;;;GAIG;AACH;mBAEa,EAAE,CAAC,MAAM,CAAC,gBAAgB;EA0HtC;;;;;AAID;;;GAGG;AACH,4CAHW,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,eAAe,EAAE,CAoBhC;AAED;;;;GAIG;AACH,mDAJW,EAAE,CAAC,eAAe,EAAE,QACpB,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,eAAe,EAAE,CAgBhC;AAwBD;;;;GAIG;AACH,uDAJW,EAAE,CAAC,UAAU,GAAG,SAAS,YACzB,MAAM,GACJ,OAAO,CAQnB;AAED;;;;;;GAMG;AACH,iDANW,MAAM,YACN,MAAM,cACN,MAAM,QACN,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,sBAAsB,CAYrC;AAED;;;;;;GAMG;AACH,kDANW,MAAM,SACN,MAAM,OACN,MAAM,QACN,EAAE,CAAC,MAAM,CAAC,gBAAgB,GACxB,EAAE,CAAC,aAAa,GAAG,IAAI,CAenC;AAsED;;;;;GAKG;AACH,8CALW,MAAM,cACN,MAAM,WACN,EAAE,CAAC,MAAM,CAAC,OAAO,GACf,MAAM,CAoDlB;AA5HD;;;;GAIG;AACH,iDAJW,aAAa,WACb,EAAE,CAAC,MAAM,CAAC,OAAO,GACf,MAAM,EAAE,CA6CpB;AAED;;;GAGG;AACH,iDAHW,MAAM,GACJ,MAAM,CAKlB;AAoGD;;;;GAIG;AACH,2CAJW,MAAM,WACN,aAAa,GACX,MAAM,CAQlB"}