Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
- run: vp i
- run: vp run build
- run: vp exec playwright install --with-deps
- run: vp run test -c vitest.ci.config.ts
- run: vp run test
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ When syncing upstream or considering filing issues, review this list. If a diver
- Iterate on aria snapshot utility feature

```sh
vp run test test/aria.test.ts --browser.headless --update
vp run test-chrome test/aria.test.ts --browser.headless --update
```
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"dev": "vp pack --watch --sourcemap",
"build": "vp pack",
"typecheck": "tsc -b",
"test-chrome": "vitest --project='*chromium*'",
"test-unit": "vitest --project=unit",
"test": "vitest"
},
"devDependencies": {
Expand All @@ -41,8 +43,7 @@
"typescript": "^5.8.2",
"vite": "^8.0.0",
"vite-plus": "latest",
"vitest": "^4.1.0",
"yaml": "^2.8.2"
"vitest": "^4.1.0"
},
"packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be"
}
6 changes: 2 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 9 additions & 12 deletions src/aria/folk/isomorphic/ariaSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,9 @@ export type ContainerMode = 'contain' | 'equal' | 'deep-equal'

export type AriaTemplateNode = AriaTemplateRoleNode | AriaTemplateTextNode

import type * as yamlTypes from 'yaml'

type YamlLibrary = {
parseDocument: typeof yamlTypes.parseDocument
Scalar: typeof yamlTypes.Scalar
YAMLMap: typeof yamlTypes.YAMLMap
YAMLSeq: typeof yamlTypes.YAMLSeq
LineCounter: typeof yamlTypes.LineCounter
}
import type * as yamlTypes from '../../yaml'

type YamlLibrary = typeof yamlTypes
type ParsedYamlPosition = { line: number; col: number }
type ParsingOptions = yamlTypes.ParseOptions

Expand Down Expand Up @@ -246,7 +239,11 @@ export function parseAriaSnapshot(
const itemIsString =
item instanceof yaml.Scalar && typeof item.value === 'string'
if (itemIsString) {
const childNode = KeyParser.parse(item, parseOptions, errors)
const childNode = KeyParser.parse(
item as yamlTypes.Scalar<string>,
parseOptions,
errors
)
if (childNode) {
container.children = container.children || []
container.children.push(childNode)
Expand Down Expand Up @@ -295,7 +292,7 @@ export function parseAriaSnapshot(
}
container.children.push({
kind: 'text',
text: textValue(value.value),
text: textValue(value.value as string),
})
continue
}
Expand Down Expand Up @@ -332,7 +329,7 @@ export function parseAriaSnapshot(
continue
}
container.props = container.props ?? {}
container.props[key.value.slice(1)] = textValue(value.value)
container.props[key.value.slice(1)] = textValue(value.value as string)
continue
}

Expand Down
5 changes: 3 additions & 2 deletions src/aria/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type AriaTemplateNode,
parseAriaSnapshotUnsafe,
} from './folk/isomorphic/ariaSnapshot'
import * as yaml from './yaml'

export type { AriaNode, AriaTemplateNode } from './folk/isomorphic/ariaSnapshot'

Expand All @@ -19,6 +20,6 @@ export { renderAriaTemplate } from './template'

export { matchAriaTree } from './match'

export function parseAriaTemplate(yamlLib: any, text: string): AriaTemplateNode {
return parseAriaSnapshotUnsafe(yamlLib, text)
export function parseAriaTemplate(text: string): AriaTemplateNode {
return parseAriaSnapshotUnsafe(yaml, text)
}
Loading
Loading