Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1b5cbe4
feat: vibed formatter
runeb Jul 17, 2025
a92b2cb
test: add skipped tests for formatting comments
runeb Jul 17, 2025
0baaadf
fix: address bug that treated desc as func
runeb Jul 21, 2025
e903bf9
chore: prettify
runeb Jul 21, 2025
ef926f1
chore: add types
runeb Jul 21, 2025
7d1cd32
Merge branch 'main' into feat/fmt
runeb Jul 22, 2025
c5fe2c5
fix: add tests for string escaping, remove dead code
runeb Jul 22, 2025
a89c69d
chore: prettify
runeb Jul 22, 2025
2955ddf
Update src/formatter/nodeFormatters.ts
runeb Jul 23, 2025
1f6fb41
fix: move formatter to new beta export
runeb Jul 23, 2025
f4b2665
chore: rename formatter to serializer
runeb Jul 23, 2025
dc59a32
fix: improve indentation manager and API consistency
runeb Jul 23, 2025
1af9a0e
Merge branch 'main' into feat/fmt
runeb Jul 23, 2025
d28aa53
chore: rename public api for serializing nodes to serializeString
runeb Jul 23, 2025
643e1a8
refactor: remove redundant serializeWithParens wrapper
runeb Jul 28, 2025
09bf579
refactor: use JSON.stringify for all value serialization
runeb Jul 28, 2025
6797366
Update src/serializer/nodeSerializers.ts
runeb Jul 28, 2025
adba760
fix: escape quote in error message
runeb Jul 28, 2025
aef36fd
refactor: remove dead code path for colon operator
runeb Jul 28, 2025
3b9ff8b
refactor: use @ts-expect-error pattern for object attribute types
runeb Jul 28, 2025
b62a283
refactor: remove remnants of configurable spacing variables
runeb Jul 28, 2025
26efc1e
fix: delinting fixes
runeb Jul 28, 2025
b46cacb
fix: add GROQ queries to test suite and fix surfaced serialization bugs
runeb Jul 28, 2025
16306d4
refactor: rename beta to experimental and make module self-contained
runeb Jul 29, 2025
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
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.nyc_output
dist
tap-snapshots
tap-snapshots
test/fixtures
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
"require": "./dist/1.js",
"default": "./dist/1.js"
},
"./experimental": {
"source": "./src/experimental.ts",
"import": "./dist/experimental.mjs",
"require": "./dist/experimental.js",
"default": "./dist/experimental.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
Expand All @@ -37,6 +43,9 @@
"*": {
"1": [
"./dist/1.d.ts"
],
"experimental": [
"./dist/experimental.d.ts"
]
}
},
Expand Down
40 changes: 40 additions & 0 deletions src/experimental.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Experimental features - API subject to change

// Re-export all the same exports as the main module for self-contained usage
export {evaluate} from './evaluator'
export type {GroqFunction, GroqFunctionArg, GroqPipeFunction} from './evaluator/functions'
export type {Scope} from './evaluator/scope'
export type {
Context,
DereferenceFunction,
Document,
EvaluateOptions,
Executor,
} from './evaluator/types'
export * from './nodeTypes'
export {parse} from './parser'
export type {ParseOptions} from './types'
export type {
AnyStaticValue,
ArrayValue,
BooleanValue,
DateTimeValue,
GroqType,
NullValue,
NumberValue,
ObjectValue,
PathValue,
StaticValue,
StreamValue,
StringValue,
Value,
} from './values'
export {DateTime, Path} from './values'

// Type evaluation
export type * from './typeEvaluator'
export {createReferenceTypeNode, typeEvaluate} from './typeEvaluator'

// Experimental serializer exports
export {serializeString} from './serializer'
export type {SerializeOptions} from './serializer'
15 changes: 15 additions & 0 deletions src/serializer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {ExprNode} from '../nodeTypes'
import {NodeSerializer} from './nodeSerializers'

export interface SerializeOptions {
/** Indentation string (default: " ") */
indentString?: string
}

/**
* Serialize a GROQ AST node into formatted string
*/
export function serializeString(node: ExprNode, options: SerializeOptions = {}): string {
const serializer = new NodeSerializer({indentString: options.indentString})
return serializer.serialize(node)
}
Loading
Loading