typed-csv 1.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.
- package/README.md +190 -0
- package/dist/csv-loader/esbuild.d.mts +45 -0
- package/dist/csv-loader/esbuild.d.ts +45 -0
- package/dist/csv-loader/esbuild.js +2020 -0
- package/dist/csv-loader/esbuild.mjs +1985 -0
- package/dist/csv-loader/loader.d.mts +154 -0
- package/dist/csv-loader/loader.d.ts +154 -0
- package/dist/csv-loader/loader.js +1736 -0
- package/dist/csv-loader/loader.mjs +1701 -0
- package/dist/csv-loader/rollup.d.mts +60 -0
- package/dist/csv-loader/rollup.d.ts +60 -0
- package/dist/csv-loader/rollup.js +2006 -0
- package/dist/csv-loader/rollup.mjs +1971 -0
- package/dist/csv-loader/webpack.d.mts +42 -0
- package/dist/csv-loader/webpack.d.ts +42 -0
- package/dist/csv-loader/webpack.js +1979 -0
- package/dist/csv-loader/webpack.mjs +1948 -0
- package/dist/index.d.mts +65 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +877 -0
- package/dist/index.mjs +845 -0
- package/package.json +76 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LoaderContext } from '@rspack/core';
|
|
2
|
+
|
|
3
|
+
interface CsvLoaderOptions {
|
|
4
|
+
delimiter?: string;
|
|
5
|
+
quote?: string;
|
|
6
|
+
escape?: string;
|
|
7
|
+
bom?: boolean;
|
|
8
|
+
comment?: string | false;
|
|
9
|
+
trim?: boolean;
|
|
10
|
+
/** Generate TypeScript declaration file (.d.ts) */
|
|
11
|
+
emitTypes?: boolean;
|
|
12
|
+
/** Output directory for generated type files (relative to output path) */
|
|
13
|
+
typesOutputDir?: string;
|
|
14
|
+
/** Write .d.ts files to disk (useful for dev server) */
|
|
15
|
+
writeToDisk?: boolean;
|
|
16
|
+
/** Base directory for resolving referenced CSV files (default: directory of current file) */
|
|
17
|
+
refBaseDir?: string;
|
|
18
|
+
/** Primary key field name for referenced tables (default: 'id') */
|
|
19
|
+
defaultPrimaryKey?: string;
|
|
20
|
+
/** Current file path (used to resolve relative references) */
|
|
21
|
+
currentFilePath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* When false, reference fields store parsed IDs instead of resolved objects.
|
|
24
|
+
* Used by csvToModule to emit accessor-based code with lazy resolution.
|
|
25
|
+
* Default: true (resolves references eagerly by loading referenced CSV files).
|
|
26
|
+
*/
|
|
27
|
+
resolveReferences?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface CsvWebpackLoaderOptions extends CsvLoaderOptions {
|
|
31
|
+
/** Output directory for generated type files (relative to output path) */
|
|
32
|
+
typesOutputDir?: string;
|
|
33
|
+
/** Write .d.ts files to disk (useful for dev server) */
|
|
34
|
+
writeToDisk?: boolean;
|
|
35
|
+
/** Base directory for resolving referenced CSV files (default: directory of current file) */
|
|
36
|
+
refBaseDir?: string;
|
|
37
|
+
/** Primary key field name for referenced tables (default: 'id') */
|
|
38
|
+
defaultPrimaryKey?: string;
|
|
39
|
+
}
|
|
40
|
+
declare function csvLoader(this: LoaderContext<CsvWebpackLoaderOptions>, content: string): string | Buffer;
|
|
41
|
+
|
|
42
|
+
export { type CsvWebpackLoaderOptions, csvLoader as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LoaderContext } from '@rspack/core';
|
|
2
|
+
|
|
3
|
+
interface CsvLoaderOptions {
|
|
4
|
+
delimiter?: string;
|
|
5
|
+
quote?: string;
|
|
6
|
+
escape?: string;
|
|
7
|
+
bom?: boolean;
|
|
8
|
+
comment?: string | false;
|
|
9
|
+
trim?: boolean;
|
|
10
|
+
/** Generate TypeScript declaration file (.d.ts) */
|
|
11
|
+
emitTypes?: boolean;
|
|
12
|
+
/** Output directory for generated type files (relative to output path) */
|
|
13
|
+
typesOutputDir?: string;
|
|
14
|
+
/** Write .d.ts files to disk (useful for dev server) */
|
|
15
|
+
writeToDisk?: boolean;
|
|
16
|
+
/** Base directory for resolving referenced CSV files (default: directory of current file) */
|
|
17
|
+
refBaseDir?: string;
|
|
18
|
+
/** Primary key field name for referenced tables (default: 'id') */
|
|
19
|
+
defaultPrimaryKey?: string;
|
|
20
|
+
/** Current file path (used to resolve relative references) */
|
|
21
|
+
currentFilePath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* When false, reference fields store parsed IDs instead of resolved objects.
|
|
24
|
+
* Used by csvToModule to emit accessor-based code with lazy resolution.
|
|
25
|
+
* Default: true (resolves references eagerly by loading referenced CSV files).
|
|
26
|
+
*/
|
|
27
|
+
resolveReferences?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface CsvWebpackLoaderOptions extends CsvLoaderOptions {
|
|
31
|
+
/** Output directory for generated type files (relative to output path) */
|
|
32
|
+
typesOutputDir?: string;
|
|
33
|
+
/** Write .d.ts files to disk (useful for dev server) */
|
|
34
|
+
writeToDisk?: boolean;
|
|
35
|
+
/** Base directory for resolving referenced CSV files (default: directory of current file) */
|
|
36
|
+
refBaseDir?: string;
|
|
37
|
+
/** Primary key field name for referenced tables (default: 'id') */
|
|
38
|
+
defaultPrimaryKey?: string;
|
|
39
|
+
}
|
|
40
|
+
declare function csvLoader(this: LoaderContext<CsvWebpackLoaderOptions>, content: string): string | Buffer;
|
|
41
|
+
|
|
42
|
+
export { type CsvWebpackLoaderOptions, csvLoader as default };
|