vendor: support native TypeScript source loading

This commit is contained in:
imccyu
2026-07-28 23:03:23 +08:00
parent eb38a365dc
commit 5ea161fa68
23 changed files with 77 additions and 72 deletions

View File

@@ -3,6 +3,7 @@
"description": "Type driven schema validator",
"version": "3.18.0",
"private": true,
"type": "module",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"types": "lib/types/index.d.ts",

View File

@@ -1,4 +1,4 @@
import { Binary, clone, deepEqual, Dict, filterKeys, isNullable, isPlainObject, pick, valueMap } from 'cosmokit'
import { Binary, clone, deepEqual, filterKeys, isNullable, isPlainObject, pick, valueMap, type Dict } from 'cosmokit'
import type { StandardSchemaV1 } from '@standard-schema/spec'
const kSchema = Symbol.for('schemastery')
@@ -899,4 +899,4 @@ defineMethod('intersect', ['list'], ({ list }) => {
defineMethod('transform', ['inner', 'callback', 'preserve'], ({ inner }, isInner) => inner!.toString(isInner))
export = Schema
export default Schema

View File

@@ -1,10 +1,9 @@
import { defineConfig } from 'tsdown'
/**
* schemastery has no `"type": "module"` and publishes dual-format output
* (package.json: main → lib/index.cjs, module → lib/index.mjs). The entry is
* the JS emitted by tsc under lib/types; pin the bundled extensions
* explicitly because the defaults for a CommonJS package would emit .mjs/.js.
* Schemastery publishes dual-format output (package.json: main → lib/index.cjs,
* module → lib/index.mjs). The entry is the JS emitted by tsc under lib/types;
* pin the bundled extensions explicitly so the package retains both formats.
*/
export default defineConfig({
entry: ['lib/types/index.js'],