diff --git a/package-lock.json b/package-lock.json index 011aa14..dcccfce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11331,7 +11331,7 @@ }, "packages/css": { "name": "@knighted/css", - "version": "1.1.0-rc.1", + "version": "1.1.0-rc.2", "license": "MIT", "dependencies": { "es-module-lexer": "^2.0.0", @@ -11366,7 +11366,7 @@ "name": "@knighted/css-playwright-fixture", "version": "0.0.0", "dependencies": { - "@knighted/css": "1.1.0-rc.1", + "@knighted/css": "1.1.0-rc.2", "@knighted/jsx": "^1.7.3", "lit": "^3.2.1", "react": "^19.0.0", diff --git a/packages/css/package.json b/packages/css/package.json index b8c0393..4f5ee83 100644 --- a/packages/css/package.json +++ b/packages/css/package.json @@ -1,6 +1,6 @@ { "name": "@knighted/css", - "version": "1.1.0-rc.1", + "version": "1.1.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", diff --git a/packages/css/src/generateTypes.ts b/packages/css/src/generateTypes.ts index 6b769fe..6241b01 100644 --- a/packages/css/src/generateTypes.ts +++ b/packages/css/src/generateTypes.ts @@ -430,7 +430,7 @@ function formatSelectorModuleSource( selectors: Map, proxyInfo?: SelectorModuleProxyInfo, ): string { - const header = '// Generated by @knighted/css/generate-types\n// Do not edit.\n\n' + const header = '// Generated by @knighted/css/generate-types\n// Do not edit.' const entries = Array.from(selectors.entries()).sort(([a], [b]) => a.localeCompare(b)) const lines = entries.map( ([token, selector]) => ` ${JSON.stringify(token)}: ${JSON.stringify(selector)},`, @@ -450,14 +450,15 @@ ${lines.join('\n')} proxyLines.push( `export { knightedCss } from '${proxyInfo.moduleSpecifier}?knighted-css'`, ) - proxyLines.push('') } - const defaultExport = proxyInfo ? '' : '\nexport default stableSelectors\n' - return `${header}${proxyLines.join('\n')} -export const stableSelectors = ${literal} + const defaultExport = proxyInfo ? '' : '\nexport default stableSelectors' + const stableBlock = `export const stableSelectors = ${literal} export type KnightedCssStableSelectors = typeof stableSelectors export type KnightedCssStableSelectorToken = keyof typeof stableSelectors${defaultExport}` + const sections = [header, proxyLines.join('\n'), stableBlock].filter(Boolean) + return `${sections.join('\n\n')} +` } function hashContent(content: string): string { diff --git a/packages/playwright/package.json b/packages/playwright/package.json index 59336bd..fa3a9dd 100644 --- a/packages/playwright/package.json +++ b/packages/playwright/package.json @@ -12,6 +12,7 @@ "build:auto-stable": "rspack --config rspack.auto-stable.config.js", "build:webpack": "webpack --config webpack.config.js", "build:ssr": "tsx scripts/render-ssr-preview.ts", + "precheck-types": "npm run types", "check-types": "tsc --noEmit", "preview": "npm run build && http-server . -p 4174", "preview:auto-stable": "npm run build:auto-stable && http-server . -p 4175", @@ -20,7 +21,7 @@ "pretest": "npm run types && npm run build" }, "dependencies": { - "@knighted/css": "1.1.0-rc.1", + "@knighted/css": "1.1.0-rc.2", "@knighted/jsx": "^1.7.3", "lit": "^3.2.1", "react": "^19.0.0",