From ea98399c242c224db3223997f6fa98cdbcd3dffe Mon Sep 17 00:00:00 2001 From: hypercross Date: Sat, 13 Jun 2026 10:22:18 +0800 Subject: [PATCH] refactor: rename package from inline-schema to typed-csv --- AGENTS.md | 4 ++-- README.md | 10 +++++----- csv-loader.md | 16 ++++++++-------- package.json | 4 ++-- src/csv-loader/esbuild.ts | 4 ++-- src/csv-loader/rollup.ts | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 94a9b8f..5fa4a2a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,12 +13,12 @@ No linter or formatter is configured. No CI pipeline exists. Single-package TypeScript library with two runtime entry points: -- **`inline-schema`** (`src/index.ts`) — core schema parser, value parser, and validator +- **`typed-csv`** (`src/index.ts`) — core schema parser, value parser, and validator - `src/parser.ts` — `parseSchema()` turns schema strings into AST (`Schema` type) - `src/validator.ts` — `parseValue()` and `createValidator()` operate on the AST - `src/types.ts` — union type `Schema = Primitive | Tuple | Array | Reference | StringLiteral | Union` -- **`inline-schema/csv-loader`** (`src/csv-loader/loader.ts`) — CSV loader with `@table` reference resolution +- **`typed-csv/csv-loader`** (`src/csv-loader/loader.ts`) — CSV loader with `@table` reference resolution - `loader.ts` — `parseCsv()` (eager resolution) and `csvToModule()` (accessor-based output with lazy resolution); `resolveReferences: false` mode stores IDs instead of resolved objects - `webpack.ts`, `rollup.ts`, `esbuild.ts` — bundler plugin wrappers around `csvToModule` diff --git a/README.md b/README.md index 8ec707b..f9ecd80 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# inline-schema +# typed-csv -A TypeScript library for parsing and validating inline schemas with a TypeScript-like syntax using `;` instead of `,`. +A TypeScript library for typed CSV data with inline schema validation using a TypeScript-like syntax with `;` instead of `,`. ## Installation ```bash -npm install inline-schema +npm install typed-csv ``` ## Usage @@ -13,7 +13,7 @@ npm install inline-schema ### Basic Example ```typescript -import { defineSchema } from 'inline-schema'; +import { defineSchema } from 'typed-csv'; // Define a schema const stringSchema = defineSchema('string'); @@ -157,7 +157,7 @@ module.exports = { rules: [ { test: /\.schema\.csv$/, - use: 'inline-schema/csv-loader', + use: 'typed-csv/csv-loader', }, ], }, diff --git a/csv-loader.md b/csv-loader.md index adf3e98..f72c0eb 100644 --- a/csv-loader.md +++ b/csv-loader.md @@ -1,18 +1,18 @@ -# inline-schema/csv-loader +# typed-csv/csv-loader -A rspack/rollup loader for CSV files that uses inline-schema for type validation. +A rspack/rollup loader for CSV files that uses typed-csv for type validation. ## Installation ```bash -npm install inline-schema +npm install typed-csv ``` ## Usage The loader expects: - **First row**: Property names (headers) -- **Second row**: Inline-schema definitions for each property +- **Second row**: typed-csv schema definitions for each property - **Remaining rows**: Data values ### Example CSV @@ -35,7 +35,7 @@ module.exports = { { test: /\.schema\.csv$/, use: { - loader: 'inline-schema/csv-loader', + loader: 'typed-csv/csv-loader', options: { delimiter: ',', quote: '"', @@ -60,7 +60,7 @@ module.exports = { ```typescript import { defineConfig } from 'vite'; -import { csvLoader } from 'inline-schema/csv-loader/rollup'; +import { csvLoader } from 'typed-csv/csv-loader/rollup'; export default defineConfig({ plugins: [ @@ -85,7 +85,7 @@ export default defineConfig({ ```typescript import { defineConfig } from 'tsup'; -import { csvLoader } from 'inline-schema/csv-loader/rollup'; +import { csvLoader } from 'typed-csv/csv-loader/rollup'; export default defineConfig({ entry: ['src/index.ts'], @@ -139,7 +139,7 @@ import data from './data.csv'; ## Schema Syntax -Uses [inline-schema](https://github.com/your-repo/inline-schema) syntax: +Uses [typed-csv](https://github.com/your-repo/typed-csv) syntax: | Type | Schema | Example | |------|--------|---------| diff --git a/package.json b/package.json index 7191f66..b2c9332 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "inline-schema", + "name": "typed-csv", "version": "1.0.0", "main": "./dist/index.js", "module": "./dist/index.mjs", @@ -49,7 +49,7 @@ ], "author": "", "license": "ISC", - "description": "A TypeScript library for parsing and validating inline schemas", + "description": "A TypeScript library for typed CSV data with inline schema validation", "dependencies": { "csv-parse": "^5.5.6" }, diff --git a/src/csv-loader/esbuild.ts b/src/csv-loader/esbuild.ts index f776fbd..4b86e0e 100644 --- a/src/csv-loader/esbuild.ts +++ b/src/csv-loader/esbuild.ts @@ -39,7 +39,7 @@ function matchesPattern( } /** - * Esbuild plugin for loading CSV files with inline-schema validation. + * Esbuild plugin for loading CSV files with typed-csv validation. */ export function csvLoader(options: CsvEsbuildOptions = {}): Plugin { const { @@ -54,7 +54,7 @@ export function csvLoader(options: CsvEsbuildOptions = {}): Plugin { const includeFilter = createFilter(include); return { - name: "inline-schema-csv", + name: "typed-csv", setup(build) { build.onLoad({ filter: includeFilter }, async (args) => { diff --git a/src/csv-loader/rollup.ts b/src/csv-loader/rollup.ts index 2eaad9e..4922ebe 100644 --- a/src/csv-loader/rollup.ts +++ b/src/csv-loader/rollup.ts @@ -53,7 +53,7 @@ interface RollupPlugin { } /** - * Rollup plugin for loading CSV files with inline-schema validation. + * Rollup plugin for loading CSV files with typed-csv validation. * Works with both Vite and Tsup (esbuild). */ export function csvLoader(options: CsvRollupOptions = {}): RollupPlugin { @@ -67,7 +67,7 @@ export function csvLoader(options: CsvRollupOptions = {}): RollupPlugin { } = options; return { - name: "inline-schema-csv", + name: "typed-csv", transform(code: string, id: string) { // Check if file matches the include/exclude patterns