Skip to content

Commit af0d9d2

Browse files
refactor: consistent line breaks in generated files. (#59)
1 parent 8f561c0 commit af0d9d2

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/css/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@knighted/css",
3-
"version": "1.1.0-rc.1",
3+
"version": "1.1.0-rc.2",
44
"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.",
55
"type": "module",
66
"main": "./dist/css.js",

packages/css/src/generateTypes.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ function formatSelectorModuleSource(
430430
selectors: Map<string, string>,
431431
proxyInfo?: SelectorModuleProxyInfo,
432432
): string {
433-
const header = '// Generated by @knighted/css/generate-types\n// Do not edit.\n\n'
433+
const header = '// Generated by @knighted/css/generate-types\n// Do not edit.'
434434
const entries = Array.from(selectors.entries()).sort(([a], [b]) => a.localeCompare(b))
435435
const lines = entries.map(
436436
([token, selector]) => ` ${JSON.stringify(token)}: ${JSON.stringify(selector)},`,
@@ -450,14 +450,15 @@ ${lines.join('\n')}
450450
proxyLines.push(
451451
`export { knightedCss } from '${proxyInfo.moduleSpecifier}?knighted-css'`,
452452
)
453-
proxyLines.push('')
454453
}
455-
const defaultExport = proxyInfo ? '' : '\nexport default stableSelectors\n'
456-
return `${header}${proxyLines.join('\n')}
457-
export const stableSelectors = ${literal}
454+
const defaultExport = proxyInfo ? '' : '\nexport default stableSelectors'
455+
const stableBlock = `export const stableSelectors = ${literal}
458456
459457
export type KnightedCssStableSelectors = typeof stableSelectors
460458
export type KnightedCssStableSelectorToken = keyof typeof stableSelectors${defaultExport}`
459+
const sections = [header, proxyLines.join('\n'), stableBlock].filter(Boolean)
460+
return `${sections.join('\n\n')}
461+
`
461462
}
462463

463464
function hashContent(content: string): string {

packages/playwright/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"build:auto-stable": "rspack --config rspack.auto-stable.config.js",
1313
"build:webpack": "webpack --config webpack.config.js",
1414
"build:ssr": "tsx scripts/render-ssr-preview.ts",
15+
"precheck-types": "npm run types",
1516
"check-types": "tsc --noEmit",
1617
"preview": "npm run build && http-server . -p 4174",
1718
"preview:auto-stable": "npm run build:auto-stable && http-server . -p 4175",
@@ -20,7 +21,7 @@
2021
"pretest": "npm run types && npm run build"
2122
},
2223
"dependencies": {
23-
"@knighted/css": "1.1.0-rc.1",
24+
"@knighted/css": "1.1.0-rc.2",
2425
"@knighted/jsx": "^1.7.3",
2526
"lit": "^3.2.1",
2627
"react": "^19.0.0",

0 commit comments

Comments
 (0)