Skip to content

Commit 50568ae

Browse files
authored
fixes and tests for #style, prettier fixes, ssr ts removal (#753)
* fixes and tests for #style, prettier fixes, ssr ts removal * lint * update #style docs, add missing tsconfigs, workspaces update * remove adapter test logs
1 parent 8a9bbfc commit 50568ae

39 files changed

Lines changed: 1759 additions & 194 deletions

File tree

.cursor/rules/project.mdc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ Source Code (.ripple) → Parse → Analyze → Transform → Output (JS + CSS)
127127
prop, let, const, function, component, for_pattern)
128128
- **Reactivity analysis:** Marks tracked expressions, derives tracking metadata
129129
- **CSS scoping:** Hash-based class names via `CSS_HASH_IDENTIFIER`
130+
- **`#style` analysis:** Validates usage context, collects referenced classes,
131+
cross-checks against standalone CSS selectors
130132
- **Server block analysis:** Tracks exports from `#server` blocks
131133

132134
### Phase 3: Transform (`packages/ripple/src/compiler/phases/3-transform/`)
@@ -191,6 +193,7 @@ and once with `mode: 'server'`.
191193
| `Attribute` | Element attribute with `name`, `value`, `shorthand` |
192194
| `RefAttribute` | `ref={...}` reference binding |
193195
| `SpreadAttribute` | `{...props}` spread |
196+
| `StyleIdentifier` | `#style` compile-time identifier for scoped CSS classes |
194197
| `CSS.StyleSheet` | Parsed CSS with `hash` for scoping |
195198

196199
## Runtime Architecture

.github/copilot-instructions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ Source Code (.ripple) → Parse → Analyze → Transform → Output (JS + CSS)
122122
prop, let, const, function, component, for_pattern)
123123
- **Reactivity analysis:** Marks tracked expressions, derives tracking metadata
124124
- **CSS scoping:** Hash-based class names via `CSS_HASH_IDENTIFIER`
125+
- **`#style` analysis:** Validates usage context, collects referenced classes,
126+
cross-checks against standalone CSS selectors
125127
- **Server block analysis:** Tracks exports from `#server` blocks
126128

127129
### Phase 3: Transform (`packages/ripple/src/compiler/phases/3-transform/`)
@@ -186,6 +188,7 @@ and once with `mode: 'server'`.
186188
| `Attribute` | Element attribute with `name`, `value`, `shorthand` |
187189
| `RefAttribute` | `ref={...}` reference binding |
188190
| `SpreadAttribute` | `{...props}` spread |
191+
| `StyleIdentifier` | `#style` compile-time identifier for scoped CSS classes |
189192
| `CSS.StyleSheet` | Parsed CSS with `hash` for scoping |
190193
191194
## Runtime Architecture

.rulesync/rules/project.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ Source Code (.ripple) → Parse → Analyze → Transform → Output (JS + CSS)
129129
prop, let, const, function, component, for_pattern)
130130
- **Reactivity analysis:** Marks tracked expressions, derives tracking metadata
131131
- **CSS scoping:** Hash-based class names via `CSS_HASH_IDENTIFIER`
132+
- **`#style` analysis:** Validates usage context, collects referenced classes,
133+
cross-checks against standalone CSS selectors
132134
- **Server block analysis:** Tracks exports from `#server` blocks
133135

134136
### Phase 3: Transform (`packages/ripple/src/compiler/phases/3-transform/`)
@@ -193,6 +195,7 @@ and once with `mode: 'server'`.
193195
| `Attribute` | Element attribute with `name`, `value`, `shorthand` |
194196
| `RefAttribute` | `ref={...}` reference binding |
195197
| `SpreadAttribute` | `{...props}` spread |
198+
| `StyleIdentifier` | `#style` compile-time identifier for scoped CSS classes |
196199
| `CSS.StyleSheet` | Parsed CSS with `hash` for scoping |
197200
198201
## Runtime Architecture

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Source Code (.ripple) → Parse → Analyze → Transform → Output (JS + CSS)
126126
prop, let, const, function, component, for_pattern)
127127
- **Reactivity analysis:** Marks tracked expressions, derives tracking metadata
128128
- **CSS scoping:** Hash-based class names via `CSS_HASH_IDENTIFIER`
129+
- **`#style` analysis:** Validates usage context, collects referenced classes,
130+
cross-checks against standalone CSS selectors
129131
- **Server block analysis:** Tracks exports from `#server` blocks
130132

131133
### Phase 3: Transform (`packages/ripple/src/compiler/phases/3-transform/`)
@@ -190,6 +192,7 @@ and once with `mode: 'server'`.
190192
| `Attribute` | Element attribute with `name`, `value`, `shorthand` |
191193
| `RefAttribute` | `ref={...}` reference binding |
192194
| `SpreadAttribute` | `{...props}` spread |
195+
| `StyleIdentifier` | `#style` compile-time identifier for scoped CSS classes |
193196
| `CSS.StyleSheet` | Parsed CSS with `hash` for scoping |
194197
195198
## Runtime Architecture

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ Source Code (.ripple) → Parse → Analyze → Transform → Output (JS + CSS)
122122
prop, let, const, function, component, for_pattern)
123123
- **Reactivity analysis:** Marks tracked expressions, derives tracking metadata
124124
- **CSS scoping:** Hash-based class names via `CSS_HASH_IDENTIFIER`
125+
- **`#style` analysis:** Validates usage context, collects referenced classes,
126+
cross-checks against standalone CSS selectors
125127
- **Server block analysis:** Tracks exports from `#server` blocks
126128

127129
### Phase 3: Transform (`packages/ripple/src/compiler/phases/3-transform/`)
@@ -186,6 +188,7 @@ and once with `mode: 'server'`.
186188
| `Attribute` | Element attribute with `name`, `value`, `shorthand` |
187189
| `RefAttribute` | `ref={...}` reference binding |
188190
| `SpreadAttribute` | `{...props}` spread |
191+
| `StyleIdentifier` | `#style` compile-time identifier for scoped CSS classes |
189192
| `CSS.StyleSheet` | Parsed CSS with `hash` for scoping |
190193
191194
## Runtime Architecture

GEMINI.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Source Code (.ripple) → Parse → Analyze → Transform → Output (JS + CSS)
126126
prop, let, const, function, component, for_pattern)
127127
- **Reactivity analysis:** Marks tracked expressions, derives tracking metadata
128128
- **CSS scoping:** Hash-based class names via `CSS_HASH_IDENTIFIER`
129+
- **`#style` analysis:** Validates usage context, collects referenced classes,
130+
cross-checks against standalone CSS selectors
129131
- **Server block analysis:** Tracks exports from `#server` blocks
130132

131133
### Phase 3: Transform (`packages/ripple/src/compiler/phases/3-transform/`)
@@ -190,6 +192,7 @@ and once with `mode: 'server'`.
190192
| `Attribute` | Element attribute with `name`, `value`, `shorthand` |
191193
| `RefAttribute` | `ref={...}` reference binding |
192194
| `SpreadAttribute` | `{...props}` spread |
195+
| `StyleIdentifier` | `#style` compile-time identifier for scoped CSS classes |
193196
| `CSS.StyleSheet` | Parsed CSS with `hash` for scoping |
194197
195198
## Runtime Architecture

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
"copy-tree-sitter-queries": "node ./scripts/copy-tree-sitter-queries.js"
2727
},
2828
"devDependencies": {
29-
"@changesets/changelog-github": "^0.5.2",
30-
"@changesets/cli": "^2.29.8",
29+
"@changesets/changelog-github": "catalog:default",
30+
"@changesets/cli": "catalog:default",
3131
"@ripple-ts/eslint-plugin": "workspace:*",
3232
"@ripple-ts/prettier-plugin": "workspace:*",
3333
"@ripple-ts/vite-plugin": "workspace:*",
3434
"eslint": "catalog:default",
3535
"jsdom": "catalog:default",
3636
"linkedom": "catalog:default",
3737
"prettier": "catalog:default",
38-
"rulesync": "^7.3.0",
38+
"rulesync": "catalog:default",
3939
"source-map": "catalog:default",
4040
"type-fest": "catalog:default",
4141
"vitest": "catalog:default",

packages/adapter-bun/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"noEmit": true
5+
},
6+
"include": ["./src/**/*", "./tests/**/*"],
7+
"exclude": ["dist", "node_modules"]
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"noEmit": true
5+
},
6+
"include": ["./src/**/*", "./tests/**/*"],
7+
"exclude": ["dist", "node_modules"]
8+
}

packages/adapter-vercel/src/adapt.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ function generate_vercel_config(options) {
299299
* @returns {Promise<void>}
300300
*/
301301
export async function adapt(options = {}) {
302-
const { outDir = 'dist', serverless = {}, isr = false } = options;
302+
const { outDir = 'dist', serverless = {}, isr = false, verbose = true } = options;
303+
304+
const log = verbose ? console.log.bind(console) : () => {};
303305

304306
const project_root = process.cwd();
305307
const build_dir = resolve(project_root, outDir);
@@ -330,7 +332,7 @@ export async function adapt(options = {}) {
330332
// Clean and create output directory
331333
// ------------------------------------------------------------------
332334

333-
console.log('[adapter-vercel] Generating Vercel Build Output...');
335+
log('[adapter-vercel] Generating Vercel Build Output...');
334336

335337
rmSync(output_dir, { recursive: true, force: true });
336338
mkdirSync(output_dir, { recursive: true });
@@ -341,7 +343,7 @@ export async function adapt(options = {}) {
341343

342344
const static_dir = join(output_dir, 'static');
343345

344-
console.log('[adapter-vercel] Copying static assets...');
346+
log('[adapter-vercel] Copying static assets...');
345347
copy_dir(client_dir, static_dir);
346348

347349
// Remove index.html from static output — SSR handles the root route.
@@ -359,7 +361,7 @@ export async function adapt(options = {}) {
359361
const func_dir = join(output_dir, 'functions', 'index.func');
360362
mkdirSync(func_dir, { recursive: true });
361363

362-
console.log('[adapter-vercel] Tracing server dependencies...');
364+
log('[adapter-vercel] Tracing server dependencies...');
363365

364366
// Trace and copy all dependencies of the server entry.
365367
// The trace result tells us the project-relative path where the entry
@@ -420,7 +422,7 @@ export async function adapt(options = {}) {
420422

421423
vc_config.prerender = prerender;
422424

423-
console.log(
425+
log(
424426
`[adapter-vercel] ISR enabled (expiration: ${isr.expiration === false ? 'never' : isr.expiration + 's'})`,
425427
);
426428
}
@@ -431,7 +433,7 @@ export async function adapt(options = {}) {
431433
// 3. Generate the Build Output API config
432434
// ------------------------------------------------------------------
433435

434-
console.log('[adapter-vercel] Writing config...');
436+
log('[adapter-vercel] Writing config...');
435437

436438
const vercel_config = generate_vercel_config(options);
437439
write(join(output_dir, 'config.json'), JSON.stringify(vercel_config, null, '\t'));
@@ -440,8 +442,8 @@ export async function adapt(options = {}) {
440442
// Summary
441443
// ------------------------------------------------------------------
442444

443-
console.log('[adapter-vercel] Build output generated at .vercel/output/');
444-
console.log(` Static: ${static_dir}`);
445-
console.log(` Function: ${func_dir}`);
446-
console.log(` Runtime: ${runtime}`);
445+
log('[adapter-vercel] Build output generated at .vercel/output/');
446+
log(` Static: ${static_dir}`);
447+
log(` Function: ${func_dir}`);
448+
log(` Runtime: ${runtime}`);
447449
}

0 commit comments

Comments
 (0)