diff --git a/README.md b/README.md
index 3083587..f6fd0b4 100644
--- a/README.md
+++ b/README.md
@@ -190,13 +190,12 @@ The loader appends `export const knightedCss = "/* compiled css */"` to the modu
#### TypeScript support for loader queries
-Until we publish the ambient declarations to npm, copy [`packages/types/loader-queries.d.ts`](./packages/types/loader-queries.d.ts) into your project (or reference it directly via `typeRoots`). That file declares the two query patterns we rely on:
+Loader query types ship directly with `@knighted/css`. Reference them once in your project—either by adding `"types": ["@knighted/css/loader-queries"]` to `tsconfig.json` or dropping `/// ` into a global `.d.ts`—and the following ambient modules become available everywhere:
- `*?knighted-css` imports expose a `knightedCss: string` export.
-- `*?knighted-css&combined` (and permutations that include both flags) also gain a default export typed as `KnightedCssCombinedModule>` so you can narrow it to your source module.
+- `*?knighted-css&combined` (and any query that includes both flags) expose `knightedCss` and return the original module exports, which you can narrow with `KnightedCssCombinedModule` before destructuring named members.
-> [!NOTE]
-> We plan to publish these under an `@types/knighted__css` package. Until then, vendoring the declaration file keeps your project unblocked.
+No vendor copies are necessary—the declarations live inside `@knighted/css`, you just need to point your TypeScript config at the shipped `loader-queries` subpath once.
#### Combined module + CSS import
diff --git a/package-lock.json b/package-lock.json
index 74aedfa..1a24707 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7,7 +7,6 @@
"name": "knighted-monorepo",
"workspaces": [
"packages/css",
- "packages/types",
"packages/playwright"
],
"devDependencies": {
@@ -2971,10 +2970,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/knighted__css": {
- "resolved": "packages/types",
- "link": true
- },
"node_modules/@types/less": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/@types/less/-/less-3.0.8.tgz",
@@ -10477,6 +10472,7 @@
"integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@discoveryjs/json-ext": "^0.5.0",
"@webpack-cli/configtest": "^2.1.1",
@@ -11014,7 +11010,7 @@
},
"packages/css": {
"name": "@knighted/css",
- "version": "1.0.0-rc.1",
+ "version": "1.0.0-rc.2",
"license": "MIT",
"dependencies": {
"dependency-tree": "^11.2.0",
@@ -11041,14 +11037,13 @@
"name": "@knighted/css-playwright-fixture",
"version": "0.0.0",
"dependencies": {
- "@knighted/css": "1.0.0-rc.1",
+ "@knighted/css": "1.0.0-rc.2",
"@knighted/jsx": "^1.2.1",
"lit": "^3.2.1",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@types/knighted__css": "1.0.0-rc.1",
"@types/react": "^19.0.4",
"@types/react-dom": "^19.0.2",
"@vanilla-extract/webpack-plugin": "^2.3.15",
@@ -11060,6 +11055,7 @@
"packages/types": {
"name": "@types/knighted__css",
"version": "1.0.0-rc.1",
+ "extraneous": true,
"dependencies": {
"@knighted/css": "1.0.0-rc.1"
}
diff --git a/package.json b/package.json
index 5946366..9bc316c 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,6 @@
"type": "module",
"workspaces": [
"packages/css",
- "packages/types",
"packages/playwright"
],
"engines": {
diff --git a/packages/types/loader-queries.d.ts b/packages/css/loader-queries.d.ts
similarity index 100%
rename from packages/types/loader-queries.d.ts
rename to packages/css/loader-queries.d.ts
diff --git a/packages/css/package.json b/packages/css/package.json
index f447b77..ab86f01 100644
--- a/packages/css/package.json
+++ b/packages/css/package.json
@@ -1,13 +1,26 @@
{
"name": "@knighted/css",
- "version": "1.0.0-rc.1",
+ "version": "1.0.0-rc.2",
"description": "A build-time utility that traverses JavaScript/TypeScript module dependency graphs to extract, compile, and optimize all imported CSS into a single, in-memory string.",
"type": "module",
"main": "./dist/css.js",
- "types": "./dist/css.d.ts",
+ "types": "./types.d.ts",
+ "typesVersions": {
+ "*": {
+ "loader": [
+ "./dist/loader.d.ts"
+ ],
+ "loader-queries": [
+ "./loader-queries.d.ts"
+ ],
+ "*": [
+ "./types.d.ts"
+ ]
+ }
+ },
"exports": {
".": {
- "types": "./dist/css.d.ts",
+ "types": "./types.d.ts",
"import": "./dist/css.js",
"require": "./dist/cjs/css.cjs"
},
@@ -15,6 +28,10 @@
"types": "./dist/loader.d.ts",
"import": "./dist/loader.js",
"require": "./dist/cjs/loader.cjs"
+ },
+ "./loader-queries": {
+ "types": "./loader-queries.d.ts",
+ "default": "./loader-queries.d.ts"
}
},
"keywords": [
@@ -56,7 +73,9 @@
}
},
"files": [
- "dist"
+ "dist",
+ "loader-queries.d.ts",
+ "types.d.ts"
],
"author": "KCM ",
"license": "MIT",
diff --git a/packages/types/index.d.ts b/packages/css/types.d.ts
similarity index 61%
rename from packages/types/index.d.ts
rename to packages/css/types.d.ts
index 015dff9..5c2bda0 100644
--- a/packages/types/index.d.ts
+++ b/packages/css/types.d.ts
@@ -1,3 +1,3 @@
///
-export {}
+export * from './dist/css.js'
diff --git a/packages/playwright/package.json b/packages/playwright/package.json
index 67ccebe..bd6f825 100644
--- a/packages/playwright/package.json
+++ b/packages/playwright/package.json
@@ -14,14 +14,13 @@
"pretest": "npm run build"
},
"dependencies": {
- "@knighted/css": "1.0.0-rc.1",
+ "@knighted/css": "1.0.0-rc.2",
"@knighted/jsx": "^1.2.1",
"lit": "^3.2.1",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@types/knighted__css": "1.0.0-rc.1",
"@types/react": "^19.0.4",
"@types/react-dom": "^19.0.2",
"@vanilla-extract/webpack-plugin": "^2.3.15",
diff --git a/packages/playwright/tsconfig.json b/packages/playwright/tsconfig.json
index 2f4e2bf..5ec9fc6 100644
--- a/packages/playwright/tsconfig.json
+++ b/packages/playwright/tsconfig.json
@@ -7,7 +7,8 @@
"outDir": "dist",
"skipLibCheck": true,
"declaration": true,
- "jsx": "react-jsx"
+ "jsx": "react-jsx",
+ "types": ["@knighted/css/loader-queries"]
},
"include": ["src"]
}
diff --git a/packages/types/loader.d.ts b/packages/types/loader.d.ts
deleted file mode 100644
index 015dff9..0000000
--- a/packages/types/loader.d.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-///
-
-export {}
diff --git a/packages/types/package.json b/packages/types/package.json
deleted file mode 100644
index 2a93abb..0000000
--- a/packages/types/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "@types/knighted__css",
- "version": "1.0.0-rc.1",
- "private": false,
- "type": "module",
- "types": "index.d.ts",
- "files": [
- "index.d.ts",
- "loader-queries.d.ts"
- ],
- "dependencies": {
- "@knighted/css": "1.0.0-rc.1"
- }
-}