Skip to content

Commit

Permalink
style: require type-only imports
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Jun 28, 2024
1 parent 6ce7d6b commit 3d2fc29
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 35 deletions.
3 changes: 2 additions & 1 deletion packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import defaultLoaderRegistry from './lib/defaultLoaderRegistry.js'
import defaultLogger from './lib/defaultLogger.js'
import createPipeline from './lib/factory/pipeline.js'
import run from './lib/run.js'
import Pipeline, { PipelineOptions } from './lib/Pipeline.js'
import type { PipelineOptions } from './lib/Pipeline.js'
import type Pipeline from './lib/Pipeline.js'

export type { default as Step } from './lib/Step.js'
export type { default as Pipeline, PipelineOptions } from './lib/Pipeline.js'
Expand Down
6 changes: 4 additions & 2 deletions packages/core/lib/Pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as otel from '@opentelemetry/api'
import once from 'onetime'
import streams, { Stream } from 'readable-stream'
import type { Stream } from 'readable-stream'
import streams from 'readable-stream'
import createStream, { assertWritable } from './factory/stream.js'
import { isReadable } from './isStream.js'
import nextLoop from './nextLoop.js'
import StreamObject, { Options as BaseOptions } from './StreamObject.js'
import type { Options as BaseOptions } from './StreamObject.js'
import StreamObject from './StreamObject.js'
import tracer from './tracer.js'

const { finished } = streams
Expand Down
5 changes: 3 additions & 2 deletions packages/core/lib/Step.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import once from 'onetime'
import { Stream } from 'readable-stream'
import StreamObject, { Options as BaseOptions } from './StreamObject.js'
import type { Stream } from 'readable-stream'
import type { Options as BaseOptions } from './StreamObject.js'
import StreamObject from './StreamObject.js'
import tracer from './tracer.js'
import type { Operation } from './factory/operation.js'

Expand Down
10 changes: 5 additions & 5 deletions packages/core/lib/StreamObject.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Stream } from 'readable-stream'
import { LoaderRegistry } from 'rdf-loaders-registry'
import { Logger } from 'winston'
import type { Stream } from 'readable-stream'
import type { LoaderRegistry } from 'rdf-loaders-registry'
import type { Logger } from 'winston'
import type { GraphPointer } from 'clownface'
import * as otel from '@opentelemetry/api'
import { Context, VariableMap } from '../index.js'
import type * as otel from '@opentelemetry/api'
import type { Context, VariableMap } from '../index.js'
import { VariableMap as VariableMapImpl } from './VariableMap.js'

export interface Options {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/lib/factory/arguments.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import parseArguments from 'rdf-loader-code/arguments.js'
import type { GraphPointer } from 'clownface'
import { Logger } from 'winston'
import { LoaderRegistry } from 'rdf-loaders-registry'
import type { Logger } from 'winston'
import type { LoaderRegistry } from 'rdf-loaders-registry'
import { unknownVariable } from '../loader/variable.js'
import { Context, VariableMap } from '../../index.js'
import type { Context, VariableMap } from '../../index.js'

async function createArguments(ptr: GraphPointer, { basePath, context, loaderRegistry, variables }: { basePath: string; context: Pick<Context, 'env'>; loaderRegistry: LoaderRegistry; logger: Logger; variables: VariableMap }) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
8 changes: 4 additions & 4 deletions packages/core/lib/factory/operation.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MultiPointer } from 'clownface'
import { Logger } from 'winston'
import { LoaderRegistry } from 'rdf-loaders-registry'
import type { Logger } from 'winston'
import type { LoaderRegistry } from 'rdf-loaders-registry'
import { isGraphPointer } from 'is-graph-pointer'
import { Stream } from 'readable-stream'
import { Context, VariableMap } from '../../index.js'
import type { Stream } from 'readable-stream'
import type { Context, VariableMap } from '../../index.js'

export type Operation = (this: Context, ...args: unknown[]) => Promise<Stream | (() => AsyncGenerator)> | Stream | (() => AsyncGenerator)

Expand Down
6 changes: 3 additions & 3 deletions packages/core/lib/factory/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { DatasetCore, Term } from '@rdfjs/types'
import type { GraphPointer, MultiPointer } from 'clownface'
import { Logger } from 'winston'
import { LoaderRegistry } from 'rdf-loaders-registry'
import type { Logger } from 'winston'
import type { LoaderRegistry } from 'rdf-loaders-registry'
import type { Environment } from 'barnard59-env'
import defaultLoaderRegistry from '../defaultLoaderRegistry.js'
import defaultLogger from '../defaultLogger.js'
import metadata from '../metadata.js'
import Pipeline from '../Pipeline.js'
import { VariableMap as VariableMapImpl } from '../VariableMap.js'
import { Context, VariableMap } from '../../index.js'
import type { Context, VariableMap } from '../../index.js'
import createStep from './step.js'
import createVariables from './variables.js'

Expand Down
8 changes: 4 additions & 4 deletions packages/core/lib/factory/step.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Duplex } from 'node:stream'
import { Stream } from 'readable-stream'
import type { Stream } from 'readable-stream'
import { SpanStatusCode } from '@opentelemetry/api'
import type { GraphPointer } from 'clownface'
import { Logger } from 'winston'
import { LoaderRegistry } from 'rdf-loaders-registry'
import type { Logger } from 'winston'
import type { LoaderRegistry } from 'rdf-loaders-registry'
import { isStream } from '../isStream.js'
import PipelineError from '../PipelineError.js'
import Step from '../Step.js'
import tracer from '../tracer.js'
import { Context, VariableMap } from '../../index.js'
import type { Context, VariableMap } from '../../index.js'
import createArguments from './arguments.js'
import createOperation from './operation.js'

Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/factory/stream.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Readable, Writable, Duplex } from 'readable-stream'
import Pipeline from '../Pipeline.js'
import StreamObject from '../StreamObject.js'
import type Pipeline from '../Pipeline.js'
import type StreamObject from '../StreamObject.js'
import { isWritable as streamIsWritable } from '../isStream.js'

export function isWritable(arg: StreamObject): arg is StreamObject<Writable> {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/lib/factory/variables.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MultiPointer } from 'clownface'
import { Logger } from 'winston'
import { LoaderRegistry } from 'rdf-loaders-registry'
import type { Logger } from 'winston'
import type { LoaderRegistry } from 'rdf-loaders-registry'
import { isGraphPointer } from 'is-graph-pointer'
import { VariableMap } from '../VariableMap.js'
import { Context } from '../../index.js'
import type { Context } from '../../index.js'

async function createVariables(ptr: MultiPointer, { basePath, context, loaderRegistry, logger }: { basePath: string; context: Pick<Context, 'env'>; loaderRegistry: LoaderRegistry; logger: Logger }) {
const variables = new VariableMap()
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/isStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
isWritableStream as isWritable,
isDuplexStream as isDuplex,
} from 'is-stream'
import { Stream, Writable } from 'readable-stream'
import type { Stream, Writable } from 'readable-stream'

const isReadableObjectMode = (stream: Stream) => isReadable(stream) && stream._readableState.objectMode
const isWritableObjectMode = (stream: Stream) => isWritable(stream) && (stream as Writable)._writableState.objectMode
Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/loader/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as fs from 'fs'
import { isLiteral } from 'is-graph-pointer'
import untildify from 'untildify'
import type { GraphPointer } from 'clownface'
import LoaderRegistry from 'rdf-loaders-registry'
import type LoaderRegistry from 'rdf-loaders-registry'
import type { Environment } from 'barnard59-env'
import { VariableMap } from '../VariableMap.js'
import type { VariableMap } from '../VariableMap.js'

export default function loader(ptr: GraphPointer, { basePath, variables }: { basePath: string; variables: VariableMap }) {
if (isLiteral(ptr)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/loader/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LoaderRegistry } from 'rdf-loaders-registry'
import type { LoaderRegistry } from 'rdf-loaders-registry'
import type { Environment } from 'barnard59-env'
import type { GraphPointer } from 'clownface'
import createPipeline from '../factory/pipeline.js'
import { Context, VariableMap } from '../../index.js'
import type { Context, VariableMap } from '../../index.js'

interface Options {
basePath: string
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/loader/variable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Term } from '@rdfjs/types'
import type { Environment } from 'barnard59-env'
import type { GraphPointer } from 'clownface'
import LoaderRegistry from 'rdf-loaders-registry'
import type LoaderRegistry from 'rdf-loaders-registry'
import cloneTerm from '../cloneTerm.js'
import { VariableMap } from '../VariableMap.js'

Expand Down

0 comments on commit 3d2fc29

Please sign in to comment.