jtcsv 2.2.7 → 3.0.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 (140) hide show
  1. package/README.md +31 -1
  2. package/bin/jtcsv.js +891 -821
  3. package/bin/jtcsv.ts +2534 -0
  4. package/csv-to-json.js +168 -145
  5. package/dist/jtcsv-core.cjs.js +1407 -0
  6. package/dist/jtcsv-core.cjs.js.map +1 -0
  7. package/dist/jtcsv-core.esm.js +1379 -0
  8. package/dist/jtcsv-core.esm.js.map +1 -0
  9. package/dist/jtcsv-core.umd.js +1413 -0
  10. package/dist/jtcsv-core.umd.js.map +1 -0
  11. package/dist/jtcsv-full.cjs.js +1912 -0
  12. package/dist/jtcsv-full.cjs.js.map +1 -0
  13. package/dist/jtcsv-full.esm.js +1880 -0
  14. package/dist/jtcsv-full.esm.js.map +1 -0
  15. package/dist/jtcsv-full.umd.js +1918 -0
  16. package/dist/jtcsv-full.umd.js.map +1 -0
  17. package/dist/jtcsv-workers.esm.js +759 -0
  18. package/dist/jtcsv-workers.esm.js.map +1 -0
  19. package/dist/jtcsv-workers.umd.js +773 -0
  20. package/dist/jtcsv-workers.umd.js.map +1 -0
  21. package/dist/jtcsv.cjs.js +61 -19
  22. package/dist/jtcsv.cjs.js.map +1 -1
  23. package/dist/jtcsv.esm.js +61 -19
  24. package/dist/jtcsv.esm.js.map +1 -1
  25. package/dist/jtcsv.umd.js +61 -19
  26. package/dist/jtcsv.umd.js.map +1 -1
  27. package/errors.js +188 -2
  28. package/examples/advanced/conditional-transformations.js +446 -0
  29. package/examples/advanced/conditional-transformations.ts +446 -0
  30. package/examples/advanced/csv-parser.worker.js +89 -0
  31. package/examples/advanced/csv-parser.worker.ts +89 -0
  32. package/examples/advanced/nested-objects-example.js +306 -0
  33. package/examples/advanced/nested-objects-example.ts +306 -0
  34. package/examples/advanced/performance-optimization.js +504 -0
  35. package/examples/advanced/performance-optimization.ts +504 -0
  36. package/examples/advanced/run-demo-server.js +116 -0
  37. package/examples/advanced/run-demo-server.ts +116 -0
  38. package/examples/advanced/web-worker-usage.html +874 -0
  39. package/examples/async-multithreaded-example.ts +335 -0
  40. package/examples/cli-advanced-usage.md +288 -0
  41. package/examples/cli-batch-processing.ts +38 -0
  42. package/examples/cli-tool.js +0 -3
  43. package/examples/cli-tool.ts +183 -0
  44. package/examples/error-handling.js +21 -7
  45. package/examples/error-handling.ts +356 -0
  46. package/examples/express-api.js +0 -3
  47. package/examples/express-api.ts +164 -0
  48. package/examples/large-dataset-example.js +0 -3
  49. package/examples/large-dataset-example.ts +204 -0
  50. package/examples/ndjson-processing.js +1 -1
  51. package/examples/ndjson-processing.ts +456 -0
  52. package/examples/plugin-excel-exporter.js +3 -4
  53. package/examples/plugin-excel-exporter.ts +406 -0
  54. package/examples/react-integration.tsx +637 -0
  55. package/examples/schema-validation.ts +640 -0
  56. package/examples/simple-usage.js +254 -254
  57. package/examples/simple-usage.ts +194 -0
  58. package/examples/streaming-example.js +4 -5
  59. package/examples/streaming-example.ts +419 -0
  60. package/examples/web-workers-advanced.ts +28 -0
  61. package/index.d.ts +1 -3
  62. package/index.js +15 -1
  63. package/json-save.js +9 -3
  64. package/json-to-csv.js +168 -21
  65. package/package.json +69 -10
  66. package/plugins/express-middleware/README.md +21 -2
  67. package/plugins/express-middleware/example.js +3 -4
  68. package/plugins/express-middleware/example.ts +135 -0
  69. package/plugins/express-middleware/index.d.ts +1 -1
  70. package/plugins/express-middleware/index.js +270 -118
  71. package/plugins/express-middleware/index.ts +557 -0
  72. package/plugins/fastify-plugin/index.js +2 -4
  73. package/plugins/fastify-plugin/index.ts +443 -0
  74. package/plugins/hono/index.ts +226 -0
  75. package/plugins/nestjs/index.ts +201 -0
  76. package/plugins/nextjs-api/examples/ConverterComponent.tsx +386 -0
  77. package/plugins/nextjs-api/examples/api-convert.js +0 -2
  78. package/plugins/nextjs-api/examples/api-convert.ts +67 -0
  79. package/plugins/nextjs-api/index.tsx +339 -0
  80. package/plugins/nextjs-api/route.js +2 -3
  81. package/plugins/nextjs-api/route.ts +370 -0
  82. package/plugins/nuxt/index.ts +94 -0
  83. package/plugins/nuxt/runtime/composables/useJtcsv.ts +100 -0
  84. package/plugins/nuxt/runtime/plugin.ts +71 -0
  85. package/plugins/remix/index.js +1 -1
  86. package/plugins/remix/index.ts +260 -0
  87. package/plugins/sveltekit/index.js +1 -1
  88. package/plugins/sveltekit/index.ts +301 -0
  89. package/plugins/trpc/index.ts +267 -0
  90. package/src/browser/browser-functions.ts +402 -0
  91. package/src/browser/core.js +92 -0
  92. package/src/browser/core.ts +152 -0
  93. package/src/browser/csv-to-json-browser.d.ts +3 -0
  94. package/src/browser/csv-to-json-browser.js +36 -14
  95. package/src/browser/csv-to-json-browser.ts +264 -0
  96. package/src/browser/errors-browser.ts +303 -0
  97. package/src/browser/extensions/plugins.js +92 -0
  98. package/src/browser/extensions/plugins.ts +93 -0
  99. package/src/browser/extensions/workers.js +39 -0
  100. package/src/browser/extensions/workers.ts +39 -0
  101. package/src/browser/globals.d.ts +5 -0
  102. package/src/browser/index.ts +192 -0
  103. package/src/browser/json-to-csv-browser.d.ts +3 -0
  104. package/src/browser/json-to-csv-browser.js +13 -3
  105. package/src/browser/json-to-csv-browser.ts +262 -0
  106. package/src/browser/streams.js +12 -2
  107. package/src/browser/streams.ts +336 -0
  108. package/src/browser/workers/csv-parser.worker.ts +377 -0
  109. package/src/browser/workers/worker-pool.ts +548 -0
  110. package/src/core/delimiter-cache.js +22 -8
  111. package/src/core/delimiter-cache.ts +310 -0
  112. package/src/core/node-optimizations.ts +449 -0
  113. package/src/core/plugin-system.js +29 -11
  114. package/src/core/plugin-system.ts +400 -0
  115. package/src/core/transform-hooks.ts +558 -0
  116. package/src/engines/fast-path-engine-new.ts +347 -0
  117. package/src/engines/fast-path-engine.ts +854 -0
  118. package/src/errors.ts +72 -0
  119. package/src/formats/ndjson-parser.ts +469 -0
  120. package/src/formats/tsv-parser.ts +334 -0
  121. package/src/index-with-plugins.js +16 -9
  122. package/src/index-with-plugins.ts +395 -0
  123. package/src/types/index.ts +255 -0
  124. package/src/utils/bom-utils.js +259 -0
  125. package/src/utils/bom-utils.ts +373 -0
  126. package/src/utils/encoding-support.js +124 -0
  127. package/src/utils/encoding-support.ts +155 -0
  128. package/src/utils/schema-validator.js +19 -19
  129. package/src/utils/schema-validator.ts +819 -0
  130. package/src/utils/transform-loader.js +1 -1
  131. package/src/utils/transform-loader.ts +389 -0
  132. package/src/utils/zod-adapter.js +170 -0
  133. package/src/utils/zod-adapter.ts +280 -0
  134. package/src/web-server/index.js +10 -10
  135. package/src/web-server/index.ts +683 -0
  136. package/src/workers/csv-multithreaded.ts +310 -0
  137. package/src/workers/csv-parser.worker.ts +227 -0
  138. package/src/workers/worker-pool.ts +409 -0
  139. package/stream-csv-to-json.js +26 -8
  140. package/stream-json-to-csv.js +1 -0
@@ -0,0 +1,303 @@
1
+ // Система ошибок для браузерной версии jtcsv
2
+ // Адаптирована для работы без Node.js специфичных API
3
+
4
+ /**
5
+ * Детали ошибки
6
+ */
7
+ export interface ErrorDetails {
8
+ [key: string]: any;
9
+ originalError?: Error;
10
+ lineNumber?: number;
11
+ limit?: any;
12
+ actual?: any;
13
+ }
14
+
15
+ /**
16
+ * Базовый класс ошибки jtcsv
17
+ */
18
+ export class JTCSVError extends Error {
19
+ code: string;
20
+ details: ErrorDetails;
21
+
22
+ constructor(message: string, code: string = 'JTCSV_ERROR', details: ErrorDetails = {}) {
23
+ super(message);
24
+ this.name = 'JTCSVError';
25
+ this.code = code;
26
+ this.details = details;
27
+
28
+ // Сохранение stack trace
29
+ if (Error.captureStackTrace) {
30
+ Error.captureStackTrace(this, JTCSVError);
31
+ }
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Ошибка валидации
37
+ */
38
+ export class ValidationError extends JTCSVError {
39
+ constructor(message: string, details: ErrorDetails = {}) {
40
+ super(message, 'VALIDATION_ERROR', details);
41
+ this.name = 'ValidationError';
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Ошибка безопасности
47
+ */
48
+ export class SecurityError extends JTCSVError {
49
+ constructor(message: string, details: ErrorDetails = {}) {
50
+ super(message, 'SECURITY_ERROR', details);
51
+ this.name = 'SecurityError';
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Ошибка файловой системы (адаптирована для браузера)
57
+ */
58
+ export class FileSystemError extends JTCSVError {
59
+ constructor(message: string, originalError?: Error, details: ErrorDetails = {}) {
60
+ super(message, 'FILE_SYSTEM_ERROR', { ...details, originalError });
61
+ this.name = 'FileSystemError';
62
+
63
+ if (originalError && (originalError as any).code) {
64
+ this.code = (originalError as any).code;
65
+ }
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Ошибка парсинга
71
+ */
72
+ export class ParsingError extends JTCSVError {
73
+ lineNumber?: number;
74
+
75
+ constructor(message: string, lineNumber?: number, details: ErrorDetails = {}) {
76
+ super(message, 'PARSING_ERROR', { ...details, lineNumber });
77
+ this.name = 'ParsingError';
78
+ this.lineNumber = lineNumber;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Ошибка превышения лимита
84
+ */
85
+ export class LimitError extends JTCSVError {
86
+ limit: any;
87
+ actual: any;
88
+
89
+ constructor(message: string, limit: any, actual: any, details: ErrorDetails = {}) {
90
+ super(message, 'LIMIT_ERROR', { ...details, limit, actual });
91
+ this.name = 'LimitError';
92
+ this.limit = limit;
93
+ this.actual = actual;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Ошибка конфигурации
99
+ */
100
+ export class ConfigurationError extends JTCSVError {
101
+ constructor(message: string, details: ErrorDetails = {}) {
102
+ super(message, 'CONFIGURATION_ERROR', details);
103
+ this.name = 'ConfigurationError';
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Коды ошибок
109
+ */
110
+ export const ERROR_CODES = {
111
+ JTCSV_ERROR: 'JTCSV_ERROR',
112
+ VALIDATION_ERROR: 'VALIDATION_ERROR',
113
+ SECURITY_ERROR: 'SECURITY_ERROR',
114
+ FILE_SYSTEM_ERROR: 'FILE_SYSTEM_ERROR',
115
+ PARSING_ERROR: 'PARSING_ERROR',
116
+ LIMIT_ERROR: 'LIMIT_ERROR',
117
+ CONFIGURATION_ERROR: 'CONFIGURATION_ERROR',
118
+ INVALID_INPUT: 'INVALID_INPUT',
119
+ SECURITY_VIOLATION: 'SECURITY_VIOLATION',
120
+ FILE_NOT_FOUND: 'FILE_NOT_FOUND',
121
+ PARSE_FAILED: 'PARSE_FAILED',
122
+ SIZE_LIMIT: 'SIZE_LIMIT',
123
+ INVALID_CONFIG: 'INVALID_CONFIG',
124
+ UNKNOWN_ERROR: 'UNKNOWN_ERROR'
125
+ } as const;
126
+
127
+ export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
128
+
129
+ /**
130
+ * Безопасное выполнение функции с обработкой ошибок
131
+ *
132
+ * @param fn - Функция для выполнения
133
+ * @param errorCode - Код ошибки по умолчанию
134
+ * @param errorDetails - Детали ошибки
135
+ * @returns Результат выполнения функции
136
+ */
137
+ export function safeExecute<T>(
138
+ fn: () => T,
139
+ errorCode: ErrorCode = 'UNKNOWN_ERROR',
140
+ errorDetails: ErrorDetails = {}
141
+ ): T {
142
+ try {
143
+ if (typeof fn === 'function') {
144
+ return fn();
145
+ }
146
+ throw new ValidationError('Function expected');
147
+ } catch (error) {
148
+ // Если ошибка уже является JTCSVError, перебросить её
149
+ if (error instanceof JTCSVError) {
150
+ throw error;
151
+ }
152
+
153
+ // Определить тип ошибки на основе сообщения или кода
154
+ let enhancedError: JTCSVError;
155
+ const errorMessage = (error as Error).message || String(error);
156
+
157
+ if (errorMessage.includes('validation') || errorMessage.includes('Validation')) {
158
+ enhancedError = new ValidationError(errorMessage, { ...errorDetails, originalError: error as Error });
159
+ } else if (errorMessage.includes('security') || errorMessage.includes('Security')) {
160
+ enhancedError = new SecurityError(errorMessage, { ...errorDetails, originalError: error as Error });
161
+ } else if (errorMessage.includes('parsing') || errorMessage.includes('Parsing')) {
162
+ enhancedError = new ParsingError(errorMessage, undefined, { ...errorDetails, originalError: error as Error });
163
+ } else if (errorMessage.includes('limit') || errorMessage.includes('Limit')) {
164
+ enhancedError = new LimitError(errorMessage, null, null, { ...errorDetails, originalError: error as Error });
165
+ } else if (errorMessage.includes('configuration') || errorMessage.includes('Configuration')) {
166
+ enhancedError = new ConfigurationError(errorMessage, { ...errorDetails, originalError: error as Error });
167
+ } else if (errorMessage.includes('file') || errorMessage.includes('File')) {
168
+ enhancedError = new FileSystemError(errorMessage, error as Error, errorDetails);
169
+ } else {
170
+ // Общая ошибка
171
+ enhancedError = new JTCSVError(errorMessage, errorCode, { ...errorDetails, originalError: error as Error });
172
+ }
173
+
174
+ // Сохранить оригинальный stack trace если возможно
175
+ if ((error as Error).stack) {
176
+ enhancedError.stack = (error as Error).stack;
177
+ }
178
+
179
+ throw enhancedError;
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Асинхронная версия safeExecute
185
+ */
186
+ export async function safeExecuteAsync<T>(
187
+ fn: () => Promise<T> | T,
188
+ errorCode: ErrorCode = 'UNKNOWN_ERROR',
189
+ errorDetails: ErrorDetails = {}
190
+ ): Promise<T> {
191
+ try {
192
+ if (typeof fn === 'function') {
193
+ return await fn();
194
+ }
195
+ throw new ValidationError('Function expected');
196
+ } catch (error) {
197
+ // Если ошибка уже является JTCSVError, перебросить её
198
+ if (error instanceof JTCSVError) {
199
+ throw error;
200
+ }
201
+
202
+ // Определить тип ошибки
203
+ let enhancedError: JTCSVError;
204
+ const errorMessage = (error as Error).message || String(error);
205
+
206
+ if (errorMessage.includes('validation') || errorMessage.includes('Validation')) {
207
+ enhancedError = new ValidationError(errorMessage, { ...errorDetails, originalError: error as Error });
208
+ } else if (errorMessage.includes('security') || errorMessage.includes('Security')) {
209
+ enhancedError = new SecurityError(errorMessage, { ...errorDetails, originalError: error as Error });
210
+ } else if (errorMessage.includes('parsing') || errorMessage.includes('Parsing')) {
211
+ enhancedError = new ParsingError(errorMessage, undefined, { ...errorDetails, originalError: error as Error });
212
+ } else if (errorMessage.includes('limit') || errorMessage.includes('Limit')) {
213
+ enhancedError = new LimitError(errorMessage, null, null, { ...errorDetails, originalError: error as Error });
214
+ } else if (errorMessage.includes('configuration') || errorMessage.includes('Configuration')) {
215
+ enhancedError = new ConfigurationError(errorMessage, { ...errorDetails, originalError: error as Error });
216
+ } else if (errorMessage.includes('file') || errorMessage.includes('File')) {
217
+ enhancedError = new FileSystemError(errorMessage, error as Error, errorDetails);
218
+ } else {
219
+ enhancedError = new JTCSVError(errorMessage, errorCode, { ...errorDetails, originalError: error as Error });
220
+ }
221
+
222
+ if ((error as Error).stack) {
223
+ enhancedError.stack = (error as Error).stack;
224
+ }
225
+
226
+ throw enhancedError;
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Создать сообщение об ошибке
232
+ */
233
+ export function createErrorMessage(
234
+ error: Error | JTCSVError,
235
+ includeStack: boolean = false
236
+ ): string {
237
+ let message = error.message || 'Unknown error';
238
+
239
+ if (error instanceof JTCSVError) {
240
+ message = `[${error.code}] ${message}`;
241
+
242
+ if (error instanceof ParsingError && error.lineNumber) {
243
+ message += ` (line ${error.lineNumber})`;
244
+ }
245
+
246
+ if (error instanceof LimitError && error.limit && error.actual) {
247
+ message += ` (limit: ${error.limit}, actual: ${error.actual})`;
248
+ }
249
+ }
250
+
251
+ if (includeStack && error.stack) {
252
+ message += `\n${error.stack}`;
253
+ }
254
+
255
+ return message;
256
+ }
257
+
258
+ /**
259
+ * Обработка ошибки
260
+ */
261
+ export function handleError(
262
+ error: Error | JTCSVError,
263
+ options: {
264
+ log?: boolean;
265
+ throw?: boolean;
266
+ format?: boolean;
267
+ } = {}
268
+ ): string {
269
+ const { log = true, throw: shouldThrow = false, format = true } = options;
270
+ const message = format ? createErrorMessage(error) : error.message;
271
+
272
+ if (log) {
273
+ console.error(`[jtcsv] ${message}`);
274
+
275
+ if (error instanceof JTCSVError && error.details) {
276
+ console.error('Error details:', error.details);
277
+ }
278
+ }
279
+
280
+ if (shouldThrow) {
281
+ throw error;
282
+ }
283
+
284
+ return message;
285
+ }
286
+
287
+ // Экспорт для Node.js совместимости
288
+ if (typeof module !== 'undefined' && module.exports) {
289
+ module.exports = {
290
+ JTCSVError,
291
+ ValidationError,
292
+ SecurityError,
293
+ FileSystemError,
294
+ ParsingError,
295
+ LimitError,
296
+ ConfigurationError,
297
+ ERROR_CODES,
298
+ safeExecute,
299
+ safeExecuteAsync,
300
+ createErrorMessage,
301
+ handleError
302
+ };
303
+ }
@@ -0,0 +1,92 @@
1
+ // Расширение плагинов для jtcsv
2
+ // Подключает все плагины (express, fastify, nextjs и т.д.)
3
+
4
+ const jtcsvPlugins = {
5
+ // Плагины будут добавлены динамически при импорте
6
+ // Это placeholder для будущей реализации
7
+ };
8
+
9
+ // Динамический импорт плагинов (ленивая загрузка)
10
+ // Пути относительно корня проекта (плагины находятся в plugins/)
11
+ async function loadExpressPlugin() {
12
+ const mod = await import('../../../plugins/express-middleware/index.js');
13
+ return mod.default || mod;
14
+ }
15
+
16
+ async function loadFastifyPlugin() {
17
+ const mod = await import('../../../plugins/fastify-plugin/index.js');
18
+ return mod.default || mod;
19
+ }
20
+
21
+ async function loadNextJsPlugin() {
22
+ const mod = await import('../../../plugins/nextjs-api/index.js');
23
+ return mod.default || mod;
24
+ }
25
+
26
+ async function loadNestJsPlugin() {
27
+ const mod = await import('../../../plugins/nestjs/index.js');
28
+ return mod.default || mod;
29
+ }
30
+
31
+ async function loadRemixPlugin() {
32
+ const mod = await import('../../../plugins/remix/index.js');
33
+ return mod.default || mod;
34
+ }
35
+
36
+ async function loadNuxtPlugin() {
37
+ const mod = await import('../../../plugins/nuxt/index.js');
38
+ return mod.default || mod;
39
+ }
40
+
41
+ async function loadSvelteKitPlugin() {
42
+ const mod = await import('../../../plugins/sveltekit/index.js');
43
+ return mod.default || mod;
44
+ }
45
+
46
+ async function loadHonoPlugin() {
47
+ const mod = await import('../../../plugins/hono/index.js');
48
+ return mod.default || mod;
49
+ }
50
+
51
+ async function loadTrpcPlugin() {
52
+ const mod = await import('../../../plugins/trpc/index.js');
53
+ return mod.default || mod;
54
+ }
55
+
56
+ Object.assign(jtcsvPlugins, {
57
+ loadExpressPlugin,
58
+ loadFastifyPlugin,
59
+ loadNextJsPlugin,
60
+ loadNestJsPlugin,
61
+ loadRemixPlugin,
62
+ loadNuxtPlugin,
63
+ loadSvelteKitPlugin,
64
+ loadHonoPlugin,
65
+ loadTrpcPlugin
66
+ });
67
+
68
+ // Экспорт
69
+ if (typeof module !== 'undefined' && module.exports) {
70
+ module.exports = jtcsvPlugins;
71
+ } else if (typeof define === 'function' && define.amd) {
72
+ define([], () => jtcsvPlugins);
73
+ } else if (typeof window !== 'undefined' && window.jtcsv) {
74
+ // Расширяем глобальный jtcsv, если он существует
75
+ if (!window.jtcsv.plugins) {
76
+ window.jtcsv.plugins = {};
77
+ }
78
+ Object.assign(window.jtcsv.plugins, jtcsvPlugins);
79
+ }
80
+
81
+ export default jtcsvPlugins;
82
+ export {
83
+ loadExpressPlugin,
84
+ loadFastifyPlugin,
85
+ loadNextJsPlugin,
86
+ loadNestJsPlugin,
87
+ loadRemixPlugin,
88
+ loadNuxtPlugin,
89
+ loadSvelteKitPlugin,
90
+ loadHonoPlugin,
91
+ loadTrpcPlugin
92
+ };
@@ -0,0 +1,93 @@
1
+ // Расширение плагинов для jtcsv
2
+ // Подключает все плагины (express, fastify, nextjs и т.д.)
3
+
4
+ const jtcsvPlugins = {
5
+ // Плагины будут добавлены динамически при импорте
6
+ // Это placeholder для будущей реализации
7
+ };
8
+
9
+ // Динамический импорт плагинов (ленивая загрузка)
10
+ // Пути относительно корня проекта (плагины находятся в plugins/)
11
+ async function loadExpressPlugin() {
12
+ const mod = await import('../../../plugins/express-middleware/index.js');
13
+ return mod.default || mod;
14
+ }
15
+
16
+ async function loadFastifyPlugin() {
17
+ const mod = await import('../../../plugins/fastify-plugin/index.js');
18
+ return mod.default || mod;
19
+ }
20
+
21
+ async function loadNextJsPlugin() {
22
+ // @ts-ignore - the TS source lives in .tsx, use runtime JS
23
+ const mod = await import('../../../plugins/nextjs-api/index.js');
24
+ return mod.default || mod;
25
+ }
26
+
27
+ async function loadNestJsPlugin() {
28
+ const mod = await import('../../../plugins/nestjs/index.js');
29
+ return mod.default || mod;
30
+ }
31
+
32
+ async function loadRemixPlugin() {
33
+ const mod = await import('../../../plugins/remix/index.js');
34
+ return mod.default || mod;
35
+ }
36
+
37
+ async function loadNuxtPlugin() {
38
+ const mod = await import('../../../plugins/nuxt/index.js');
39
+ return mod.default || mod;
40
+ }
41
+
42
+ async function loadSvelteKitPlugin() {
43
+ const mod = await import('../../../plugins/sveltekit/index.js');
44
+ return mod.default || mod;
45
+ }
46
+
47
+ async function loadHonoPlugin() {
48
+ const mod = await import('../../../plugins/hono/index.js');
49
+ return mod.default || mod;
50
+ }
51
+
52
+ async function loadTrpcPlugin() {
53
+ const mod = await import('../../../plugins/trpc/index.js');
54
+ return mod.default || mod;
55
+ }
56
+
57
+ Object.assign(jtcsvPlugins, {
58
+ loadExpressPlugin,
59
+ loadFastifyPlugin,
60
+ loadNextJsPlugin,
61
+ loadNestJsPlugin,
62
+ loadRemixPlugin,
63
+ loadNuxtPlugin,
64
+ loadSvelteKitPlugin,
65
+ loadHonoPlugin,
66
+ loadTrpcPlugin
67
+ });
68
+
69
+ // Экспорт
70
+ if (typeof module !== 'undefined' && module.exports) {
71
+ module.exports = jtcsvPlugins;
72
+ } else if (typeof define === 'function' && define.amd) {
73
+ define([], () => jtcsvPlugins);
74
+ } else if (typeof window !== 'undefined' && window.jtcsv) {
75
+ // Расширяем глобальный jtcsv, если он существует
76
+ if (!window.jtcsv.plugins) {
77
+ window.jtcsv.plugins = {};
78
+ }
79
+ Object.assign(window.jtcsv.plugins, jtcsvPlugins);
80
+ }
81
+
82
+ export default jtcsvPlugins;
83
+ export {
84
+ loadExpressPlugin,
85
+ loadFastifyPlugin,
86
+ loadNextJsPlugin,
87
+ loadNestJsPlugin,
88
+ loadRemixPlugin,
89
+ loadNuxtPlugin,
90
+ loadSvelteKitPlugin,
91
+ loadHonoPlugin,
92
+ loadTrpcPlugin
93
+ };
@@ -0,0 +1,39 @@
1
+ // Расширение Web Workers для jtcsv
2
+ // Дополнительный модуль для параллельной обработки больших CSV
3
+
4
+ import { createWorkerPool, parseCSVWithWorker } from '../workers/worker-pool.js';
5
+
6
+ async function createWorkerPoolLazy(options = {}) {
7
+ const mod = await import('../workers/worker-pool.js');
8
+ return mod.createWorkerPool(options);
9
+ }
10
+
11
+ async function parseCSVWithWorkerLazy(csvInput, options = {}, onProgress = null) {
12
+ const mod = await import('../workers/worker-pool.js');
13
+ return mod.parseCSVWithWorker(csvInput, options, onProgress);
14
+ }
15
+
16
+ const jtcsvWorkers = {
17
+ createWorkerPool,
18
+ parseCSVWithWorker,
19
+ createWorkerPoolLazy,
20
+ parseCSVWithWorkerLazy
21
+ };
22
+
23
+ // Экспорт
24
+ if (typeof module !== 'undefined' && module.exports) {
25
+ module.exports = jtcsvWorkers;
26
+ } else if (typeof define === 'function' && define.amd) {
27
+ define([], () => jtcsvWorkers);
28
+ } else if (typeof window !== 'undefined' && window.jtcsv) {
29
+ // Расширяем глобальный jtcsv, если он существует
30
+ Object.assign(window.jtcsv, jtcsvWorkers);
31
+ }
32
+
33
+ export default jtcsvWorkers;
34
+ export {
35
+ createWorkerPool,
36
+ parseCSVWithWorker,
37
+ createWorkerPoolLazy,
38
+ parseCSVWithWorkerLazy
39
+ };
@@ -0,0 +1,39 @@
1
+ // Расширение Web Workers для jtcsv
2
+ // Дополнительный модуль для параллельной обработки больших CSV
3
+
4
+ import { createWorkerPool, parseCSVWithWorker } from '../workers/worker-pool';
5
+
6
+ async function createWorkerPoolLazy(options = {}) {
7
+ const mod = await import('../workers/worker-pool');
8
+ return mod.createWorkerPool(options);
9
+ }
10
+
11
+ async function parseCSVWithWorkerLazy(csvInput, options = {}, onProgress = null) {
12
+ const mod = await import('../workers/worker-pool');
13
+ return mod.parseCSVWithWorker(csvInput, options, onProgress);
14
+ }
15
+
16
+ const jtcsvWorkers = {
17
+ createWorkerPool,
18
+ parseCSVWithWorker,
19
+ createWorkerPoolLazy,
20
+ parseCSVWithWorkerLazy
21
+ };
22
+
23
+ // Экспорт
24
+ if (typeof module !== 'undefined' && module.exports) {
25
+ module.exports = jtcsvWorkers;
26
+ } else if (typeof define === 'function' && define.amd) {
27
+ define([], () => jtcsvWorkers);
28
+ } else if (typeof window !== 'undefined' && window.jtcsv) {
29
+ // Расширяем глобальный jtcsv, если он существует
30
+ Object.assign(window.jtcsv, jtcsvWorkers);
31
+ }
32
+
33
+ export default jtcsvWorkers;
34
+ export {
35
+ createWorkerPool,
36
+ parseCSVWithWorker,
37
+ createWorkerPoolLazy,
38
+ parseCSVWithWorkerLazy
39
+ };
@@ -0,0 +1,5 @@
1
+ declare const define: any;
2
+
3
+ interface Window {
4
+ jtcsv: any;
5
+ }