Skip to content

Commit

Permalink
feat: Use .ts extension in all relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Nov 29, 2024
1 parent 18e6112 commit e502055
Show file tree
Hide file tree
Showing 72 changed files with 469 additions and 469 deletions.
16 changes: 8 additions & 8 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { resolve } from 'node:path'
import { parseArgs } from 'node:util'

import { type Token, prettyToken } from './parse/cst.js'
import { Lexer } from './parse/lexer.js'
import { Parser } from './parse/parser.js'
import { Composer } from './compose/composer.js'
import { LineCounter } from './parse/line-counter.js'
import { type Document } from './doc/Document.js'
import { prettifyError } from './errors.js'
import { visit, type visitor } from './visit.js'
import { type Token, prettyToken } from './parse/cst.ts'
import { Lexer } from './parse/lexer.ts'
import { Parser } from './parse/parser.ts'
import { Composer } from './compose/composer.ts'
import { LineCounter } from './parse/line-counter.ts'
import { type Document } from './doc/Document.ts'
import { prettifyError } from './errors.ts'
import { visit, type visitor } from './visit.ts'

export const help = `\
yaml: A command-line YAML processor and inspector
Expand Down
24 changes: 12 additions & 12 deletions src/compose/compose-collection.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { isNode } from '../nodes/identity.js'
import type { ParsedNode } from '../nodes/Node.js'
import { Scalar } from '../nodes/Scalar.js'
import { YAMLMap } from '../nodes/YAMLMap.js'
import { YAMLSeq } from '../nodes/YAMLSeq.js'
import { isNode } from '../nodes/identity.ts'
import type { ParsedNode } from '../nodes/Node.ts'
import { Scalar } from '../nodes/Scalar.ts'
import { YAMLMap } from '../nodes/YAMLMap.ts'
import { YAMLSeq } from '../nodes/YAMLSeq.ts'
import type {
BlockMap,
BlockSequence,
FlowCollection,
SourceToken
} from '../parse/cst.js'
import { CollectionTag } from '../schema/types.js'
import type { ComposeContext, ComposeNode } from './compose-node.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveBlockMap } from './resolve-block-map.js'
import { resolveBlockSeq } from './resolve-block-seq.js'
import { resolveFlowCollection } from './resolve-flow-collection.js'
} from '../parse/cst.ts'
import { CollectionTag } from '../schema/types.ts'
import type { ComposeContext, ComposeNode } from './compose-node.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveBlockMap } from './resolve-block-map.ts'
import { resolveBlockSeq } from './resolve-block-seq.ts'
import { resolveFlowCollection } from './resolve-flow-collection.ts'

function resolveCollection(
CN: ComposeNode,
Expand Down
18 changes: 9 additions & 9 deletions src/compose/compose-doc.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { Directives } from '../doc/directives.js'
import { Document } from '../doc/Document.js'
import type { ParsedNode } from '../nodes/Node.js'
import type { Directives } from '../doc/directives.ts'
import { Document } from '../doc/Document.ts'
import type { ParsedNode } from '../nodes/Node.ts'
import type {
DocumentOptions,
ParseOptions,
SchemaOptions
} from '../options.js'
import type * as CST from '../parse/cst.js'
} from '../options.ts'
import type * as CST from '../parse/cst.ts'
import {
ComposeContext,
composeEmptyNode,
composeNode
} from './compose-node.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveEnd } from './resolve-end.js'
import { resolveProps } from './resolve-props.js'
} from './compose-node.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveEnd } from './resolve-end.ts'
import { resolveProps } from './resolve-props.ts'

export function composeDoc<
Contents extends ParsedNode = ParsedNode,
Expand Down
24 changes: 12 additions & 12 deletions src/compose/compose-node.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { Directives } from '../doc/directives.js'
import { Alias } from '../nodes/Alias.js'
import { isScalar } from '../nodes/identity.js'
import type { ParsedNode } from '../nodes/Node.js'
import type { ParseOptions } from '../options.js'
import type { FlowScalar, SourceToken, Token } from '../parse/cst.js'
import type { Schema } from '../schema/Schema.js'
import { composeCollection } from './compose-collection.js'
import { composeScalar } from './compose-scalar.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveEnd } from './resolve-end.js'
import { emptyScalarPosition } from './util-empty-scalar-position.js'
import type { Directives } from '../doc/directives.ts'
import { Alias } from '../nodes/Alias.ts'
import { isScalar } from '../nodes/identity.ts'
import type { ParsedNode } from '../nodes/Node.ts'
import type { ParseOptions } from '../options.ts'
import type { FlowScalar, SourceToken, Token } from '../parse/cst.ts'
import type { Schema } from '../schema/Schema.ts'
import { composeCollection } from './compose-collection.ts'
import { composeScalar } from './compose-scalar.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveEnd } from './resolve-end.ts'
import { emptyScalarPosition } from './util-empty-scalar-position.ts'

export interface ComposeContext {
atKey: boolean
Expand Down
18 changes: 9 additions & 9 deletions src/compose/compose-scalar.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { isScalar, SCALAR } from '../nodes/identity.js'
import { Scalar } from '../nodes/Scalar.js'
import type { BlockScalar, FlowScalar, SourceToken } from '../parse/cst.js'
import type { Schema } from '../schema/Schema.js'
import type { ScalarTag } from '../schema/types.js'
import type { ComposeContext } from './compose-node.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveBlockScalar } from './resolve-block-scalar.js'
import { resolveFlowScalar } from './resolve-flow-scalar.js'
import { isScalar, SCALAR } from '../nodes/identity.ts'
import { Scalar } from '../nodes/Scalar.ts'
import type { BlockScalar, FlowScalar, SourceToken } from '../parse/cst.ts'
import type { Schema } from '../schema/Schema.ts'
import type { ScalarTag } from '../schema/types.ts'
import type { ComposeContext } from './compose-node.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveBlockScalar } from './resolve-block-scalar.ts'
import { resolveFlowScalar } from './resolve-flow-scalar.ts'

export function composeScalar(
ctx: ComposeContext,
Expand Down
18 changes: 9 additions & 9 deletions src/compose/composer.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Directives } from '../doc/directives.js'
import { Document } from '../doc/Document.js'
import { ErrorCode, YAMLParseError, YAMLWarning } from '../errors.js'
import { isCollection, isPair } from '../nodes/identity.js'
import type { ParsedNode, Range } from '../nodes/Node.js'
import { Directives } from '../doc/directives.ts'
import { Document } from '../doc/Document.ts'
import { ErrorCode, YAMLParseError, YAMLWarning } from '../errors.ts'
import { isCollection, isPair } from '../nodes/identity.ts'
import type { ParsedNode, Range } from '../nodes/Node.ts'
import type {
DocumentOptions,
ParseOptions,
SchemaOptions
} from '../options.js'
import type { Token } from '../parse/cst.js'
import { composeDoc } from './compose-doc.js'
import { resolveEnd } from './resolve-end.js'
} from '../options.ts'
import type { Token } from '../parse/cst.ts'
import { composeDoc } from './compose-doc.ts'
import { resolveEnd } from './resolve-end.ts'

type ErrorSource =
| number
Expand Down
22 changes: 11 additions & 11 deletions src/compose/resolve-block-map.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { ParsedNode } from '../nodes/Node.js'
import { Pair } from '../nodes/Pair.js'
import { YAMLMap } from '../nodes/YAMLMap.js'
import type { BlockMap } from '../parse/cst.js'
import { CollectionTag } from '../schema/types.js'
import type { ComposeContext, ComposeNode } from './compose-node.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveProps } from './resolve-props.js'
import { containsNewline } from './util-contains-newline.js'
import { flowIndentCheck } from './util-flow-indent-check.js'
import { mapIncludes } from './util-map-includes.js'
import type { ParsedNode } from '../nodes/Node.ts'
import { Pair } from '../nodes/Pair.ts'
import { YAMLMap } from '../nodes/YAMLMap.ts'
import type { BlockMap } from '../parse/cst.ts'
import { CollectionTag } from '../schema/types.ts'
import type { ComposeContext, ComposeNode } from './compose-node.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveProps } from './resolve-props.ts'
import { containsNewline } from './util-contains-newline.ts'
import { flowIndentCheck } from './util-flow-indent-check.ts'
import { mapIncludes } from './util-map-includes.ts'

const startColMsg = 'All mapping items must start at the same column'

Expand Down
10 changes: 5 additions & 5 deletions src/compose/resolve-block-scalar.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Range } from '../nodes/Node.js'
import { Scalar } from '../nodes/Scalar.js'
import type { BlockScalar } from '../parse/cst.js'
import type { ComposeContext } from './compose-node.js'
import type { ComposeErrorHandler } from './composer.js'
import { Range } from '../nodes/Node.ts'
import { Scalar } from '../nodes/Scalar.ts'
import type { BlockScalar } from '../parse/cst.ts'
import type { ComposeContext } from './compose-node.ts'
import type { ComposeErrorHandler } from './composer.ts'

export function resolveBlockScalar(
ctx: ComposeContext,
Expand Down
14 changes: 7 additions & 7 deletions src/compose/resolve-block-seq.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { YAMLSeq } from '../nodes/YAMLSeq.js'
import type { BlockSequence } from '../parse/cst.js'
import { CollectionTag } from '../schema/types.js'
import type { ComposeContext, ComposeNode } from './compose-node.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveProps } from './resolve-props.js'
import { flowIndentCheck } from './util-flow-indent-check.js'
import { YAMLSeq } from '../nodes/YAMLSeq.ts'
import type { BlockSequence } from '../parse/cst.ts'
import { CollectionTag } from '../schema/types.ts'
import type { ComposeContext, ComposeNode } from './compose-node.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveProps } from './resolve-props.ts'
import { flowIndentCheck } from './util-flow-indent-check.ts'

export function resolveBlockSeq(
{ composeNode, composeEmptyNode }: ComposeNode,
Expand Down
4 changes: 2 additions & 2 deletions src/compose/resolve-end.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SourceToken } from '../parse/cst.js'
import type { ComposeErrorHandler } from './composer.js'
import type { SourceToken } from '../parse/cst.ts'
import type { ComposeErrorHandler } from './composer.ts'

export function resolveEnd(
end: SourceToken[] | undefined,
Expand Down
26 changes: 13 additions & 13 deletions src/compose/resolve-flow-collection.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { isPair } from '../nodes/identity.js'
import { Pair } from '../nodes/Pair.js'
import { YAMLMap } from '../nodes/YAMLMap.js'
import { YAMLSeq } from '../nodes/YAMLSeq.js'
import type { FlowCollection, Token } from '../parse/cst.js'
import { Schema } from '../schema/Schema.js'
import { CollectionTag } from '../schema/types.js'
import type { ComposeContext, ComposeNode } from './compose-node.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveEnd } from './resolve-end.js'
import { resolveProps } from './resolve-props.js'
import { containsNewline } from './util-contains-newline.js'
import { mapIncludes } from './util-map-includes.js'
import { isPair } from '../nodes/identity.ts'
import { Pair } from '../nodes/Pair.ts'
import { YAMLMap } from '../nodes/YAMLMap.ts'
import { YAMLSeq } from '../nodes/YAMLSeq.ts'
import type { FlowCollection, Token } from '../parse/cst.ts'
import { Schema } from '../schema/Schema.ts'
import { CollectionTag } from '../schema/types.ts'
import type { ComposeContext, ComposeNode } from './compose-node.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveEnd } from './resolve-end.ts'
import { resolveProps } from './resolve-props.ts'
import { containsNewline } from './util-contains-newline.ts'
import { mapIncludes } from './util-map-includes.ts'

const blockMsg = 'Block collections are not allowed within flow collections'
const isBlock = (token: Token | null | undefined) =>
Expand Down
12 changes: 6 additions & 6 deletions src/compose/resolve-flow-scalar.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ErrorCode } from '../errors.js'
import { Range } from '../nodes/Node.js'
import { Scalar } from '../nodes/Scalar.js'
import type { FlowScalar } from '../parse/cst.js'
import type { ComposeErrorHandler } from './composer.js'
import { resolveEnd } from './resolve-end.js'
import { ErrorCode } from '../errors.ts'
import { Range } from '../nodes/Node.ts'
import { Scalar } from '../nodes/Scalar.ts'
import type { FlowScalar } from '../parse/cst.ts'
import type { ComposeErrorHandler } from './composer.ts'
import { resolveEnd } from './resolve-end.ts'

type FlowScalarErrorHandler = (
offset: number,
Expand Down
4 changes: 2 additions & 2 deletions src/compose/resolve-props.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SourceToken, Token } from '../parse/cst.js'
import type { ComposeErrorHandler } from './composer.js'
import type { SourceToken, Token } from '../parse/cst.ts'
import type { ComposeErrorHandler } from './composer.ts'

export interface ResolvePropsArg {
flow?: 'flow map' | 'flow sequence'
Expand Down
2 changes: 1 addition & 1 deletion src/compose/util-contains-newline.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from '../parse/cst.js'
import type { Token } from '../parse/cst.ts'

export function containsNewline(key: Token | null | undefined) {
if (!key) return null
Expand Down
2 changes: 1 addition & 1 deletion src/compose/util-empty-scalar-position.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from '../parse/cst.js'
import type { Token } from '../parse/cst.ts'

export function emptyScalarPosition(
offset: number,
Expand Down
6 changes: 3 additions & 3 deletions src/compose/util-flow-indent-check.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Token } from '../parse/cst'
import { ComposeErrorHandler } from './composer'
import { containsNewline } from './util-contains-newline'
import { Token } from '../parse/cst.ts'
import { ComposeErrorHandler } from './composer.ts'
import { containsNewline } from './util-contains-newline.ts'

export function flowIndentCheck(
indent: number,
Expand Down
8 changes: 4 additions & 4 deletions src/compose/util-map-includes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isScalar } from '../nodes/identity.js'
import type { ParsedNode } from '../nodes/Node.js'
import type { Pair } from '../nodes/Pair.js'
import type { ComposeContext } from './compose-node.js'
import { isScalar } from '../nodes/identity.ts'
import type { ParsedNode } from '../nodes/Node.ts'
import type { Pair } from '../nodes/Pair.ts'
import type { ComposeContext } from './compose-node.ts'

export function mapIncludes(
ctx: ComposeContext,
Expand Down
34 changes: 17 additions & 17 deletions src/doc/Document.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import type { YAMLError, YAMLWarning } from '../errors.js'
import { Alias } from '../nodes/Alias.js'
import { collectionFromPath, isEmptyPath } from '../nodes/Collection.js'
import type { YAMLError, YAMLWarning } from '../errors.ts'
import { Alias } from '../nodes/Alias.ts'
import { collectionFromPath, isEmptyPath } from '../nodes/Collection.ts'
import {
DOC,
isCollection,
isNode,
isScalar,
NODE_TYPE
} from '../nodes/identity.js'
import type { Node, NodeType, ParsedNode, Range } from '../nodes/Node.js'
import { Pair } from '../nodes/Pair.js'
import type { Scalar } from '../nodes/Scalar.js'
import { toJS, ToJSContext } from '../nodes/toJS.js'
import type { YAMLMap } from '../nodes/YAMLMap.js'
import type { YAMLSeq } from '../nodes/YAMLSeq.js'
} from '../nodes/identity.ts'
import type { Node, NodeType, ParsedNode, Range } from '../nodes/Node.ts'
import { Pair } from '../nodes/Pair.ts'
import type { Scalar } from '../nodes/Scalar.ts'
import { toJS, ToJSContext } from '../nodes/toJS.ts'
import type { YAMLMap } from '../nodes/YAMLMap.ts'
import type { YAMLSeq } from '../nodes/YAMLSeq.ts'
import type {
CreateNodeOptions,
DocumentOptions,
ParseOptions,
SchemaOptions,
ToJSOptions,
ToStringOptions
} from '../options.js'
import { Schema } from '../schema/Schema.js'
import { stringifyDocument } from '../stringify/stringifyDocument.js'
import { anchorNames, createNodeAnchors, findNewAnchor } from './anchors.js'
import { applyReviver } from './applyReviver.js'
import { createNode, CreateNodeContext } from './createNode.js'
import { Directives } from './directives.js'
} from '../options.ts'
import { Schema } from '../schema/Schema.ts'
import { stringifyDocument } from '../stringify/stringifyDocument.ts'
import { anchorNames, createNodeAnchors, findNewAnchor } from './anchors.ts'
import { applyReviver } from './applyReviver.ts'
import { createNode, CreateNodeContext } from './createNode.ts'
import { Directives } from './directives.ts'

export type Replacer = any[] | ((key: any, value: any) => unknown)

Expand Down
16 changes: 8 additions & 8 deletions src/doc/anchors.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { isCollection, isScalar } from '../nodes/identity.js'
import type { Node } from '../nodes/Node.js'
import type { Scalar } from '../nodes/Scalar.js'
import type { YAMLMap } from '../nodes/YAMLMap.js'
import type { YAMLSeq } from '../nodes/YAMLSeq.js'
import { visit } from '../visit.js'
import { CreateNodeContext } from './createNode.js'
import type { Document } from './Document.js'
import { isCollection, isScalar } from '../nodes/identity.ts'
import type { Node } from '../nodes/Node.ts'
import type { Scalar } from '../nodes/Scalar.ts'
import type { YAMLMap } from '../nodes/YAMLMap.ts'
import type { YAMLSeq } from '../nodes/YAMLSeq.ts'
import { visit } from '../visit.ts'
import { CreateNodeContext } from './createNode.ts'
import type { Document } from './Document.ts'

/**
* Verify that the input string is a valid anchor.
Expand Down
Loading

0 comments on commit e502055

Please sign in to comment.