Skip to content

Commit

Permalink
mark vega imports as type only, use with instead of assert
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Jul 31, 2024
1 parent b316497 commit 9952d67
Show file tree
Hide file tree
Showing 30 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import bundleSize from 'rollup-plugin-bundle-size';

import pkg from './package.json' assert {type: 'json'};
import pkg from './package.json' with {type: 'json'};

export function disallowedImports() {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/aggregate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AggregateOp} from 'vega';
import type {AggregateOp} from 'vega';
import {hasOwnProperty, isString} from 'vega-util';
import {FieldName} from './channeldef';
import {contains, Flag, hasKey} from './util';
Expand Down
2 changes: 1 addition & 1 deletion src/axis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
Align,
Axis as VgAxis,
AxisEncode,
Expand Down
2 changes: 1 addition & 1 deletion src/compile/axis/parse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AxisEncode as VgAxisEncode, AxisOrient, SignalRef} from 'vega';
import type {AxisEncode as VgAxisEncode, AxisOrient, SignalRef} from 'vega';
import {Axis, AXIS_PARTS, isAxisProperty, isConditionalAxisValue} from '../../axis';
import {PositionScaleChannel, POSITION_SCALE_CHANNELS} from '../../channel';
import {getFieldOrDatumDef, PositionDatumDef, PositionFieldDef} from '../../channeldef';
Expand Down
2 changes: 1 addition & 1 deletion src/compile/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ExprRef, SignalRef, Text} from 'vega';
import type {ExprRef, SignalRef, Text} from 'vega';
import {array, isArray, stringValue} from 'vega-util';
import {AxisConfig, ConditionalAxisProperty} from '../axis';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/compile/compile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AutoSizeType, LoggerInterface, Spec as VgSpec} from 'vega';
import type {AutoSizeType, LoggerInterface, Spec as VgSpec} from 'vega';
import {isString, mergeConfig} from 'vega-util';
import {getPositionScaleChannel} from '../channel';
import * as vlFieldDef from '../channeldef';
Expand Down
2 changes: 1 addition & 1 deletion src/compile/data/facet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AggregateOp} from 'vega';
import type {AggregateOp} from 'vega';
import {isArray} from 'vega-util';
import {isBinning} from '../../bin';
import {COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../../channel';
Expand Down
2 changes: 1 addition & 1 deletion src/compile/data/filter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FilterTransform as VgFilterTransform} from 'vega';
import type {FilterTransform as VgFilterTransform} from 'vega';
import {LogicalComposition} from '../../logical';
import {Predicate} from '../../predicate';
import {duplicate} from '../../util';
Expand Down
2 changes: 1 addition & 1 deletion src/compile/data/filterinvalid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FilterTransform as VgFilterTransform} from 'vega';
import type {FilterTransform as VgFilterTransform} from 'vega';
import {isScaleChannel} from '../../channel';
import {TypedFieldDef, vgField as fieldRef} from '../../channeldef';
import {Dict, hash, keys} from '../../util';
Expand Down
2 changes: 1 addition & 1 deletion src/compile/data/flatten.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FlattenTransform as VgFlattenTransform} from 'vega';
import type {FlattenTransform as VgFlattenTransform} from 'vega';
import {FlattenTransform} from '../../transform';
import {duplicate, hash} from '../../util';
import {DataFlowNode} from './dataflow';
Expand Down
2 changes: 1 addition & 1 deletion src/compile/data/fold.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FoldTransform as VgFoldTransform} from 'vega';
import type {FoldTransform as VgFoldTransform} from 'vega';
import {FoldTransform} from '../../transform';
import {duplicate, hash} from '../../util';
import {DataFlowNode} from './dataflow';
Expand Down
2 changes: 1 addition & 1 deletion src/compile/mark/encode/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {MarkConfig} from 'vega';
import type {MarkConfig} from 'vega';
import {MarkDef} from '../../../mark';
import {hasKey} from '../../../util';
import {VG_MARK_CONFIGS, VgEncodeEntry, VgValueRef} from '../../../vega.schema';
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Color, InitSignal, Locale, NewSignal, RangeConfig, RangeScheme, SignalRef, writeConfig} from 'vega';
import {isObject, mergeConfig} from 'vega-util';
import type {Color, InitSignal, Locale, NewSignal, RangeConfig, RangeScheme, SignalRef} from 'vega';
import {isObject, mergeConfig, writeConfig} from 'vega-util';
import {Axis, AxisConfig, AxisConfigMixins, AXIS_CONFIGS, isConditionalAxisValue} from './axis';
import {signalOrValueRefWithCondition, signalRefOrValue} from './compile/common';
import {CompositeMarkConfigMixins, getAllCompositeMarks} from './compositemark';
Expand Down
2 changes: 1 addition & 1 deletion src/encoding.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AggregateOp} from 'vega';
import type {AggregateOp} from 'vega';
import {array, isArray} from 'vega-util';
import {isArgmaxDef, isArgminDef} from './aggregate';
import {isBinned, isBinning} from './bin';
Expand Down
2 changes: 1 addition & 1 deletion src/guide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SignalRef, Text} from 'vega';
import type {SignalRef, Text} from 'vega';
import {ConditionValueDefMixins, FormatMixins, ValueDef} from './channeldef';
import {LegendConfig} from './legend';
import {VgEncodeChannel} from './vega.schema';
Expand Down
12 changes: 11 additions & 1 deletion src/header.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import {Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig} from 'vega';
import type {
Align,
Color,
FontStyle,
FontWeight,
Orient,
SignalRef,
TextBaseline,
TitleAnchor,
TitleConfig
} from 'vega';
import {FormatMixins} from './channeldef';
import {ExprRef} from './expr';
import {Guide, VlOnlyGuideConfig} from './guide';
Expand Down
2 changes: 1 addition & 1 deletion src/impute.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ImputeSequence} from './transform';
import {ImputeMethod} from 'vega';
import type {ImputeMethod} from 'vega';

export interface ImputeParams {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/invalid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SignalRef} from 'vega';
import type {SignalRef} from 'vega';
import {ScaleChannel} from './channel';
import {Mark, MarkDef} from './mark';
import {isObject} from 'vega-util';
Expand Down
2 changes: 1 addition & 1 deletion src/legend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
BaseLegend,
LabelOverlap,
Legend as VgLegend,
Expand Down
14 changes: 3 additions & 11 deletions src/mark.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import {
Align,
Color,
Gradient,
MarkConfig as VgMarkConfig,
Orientation,
SignalRef,
TextBaseline,
hasOwnProperty
} from 'vega';
import type {Align, Color, Gradient, Orientation, SignalRef, TextBaseline, MarkConfig as VgMarkConfig} from 'vega';
import {hasOwnProperty} from 'vega-util';
import {CompositeMark, CompositeMarkDef} from './compositemark';
import {ExprRef} from './expr';
import {MarkInvalidMixins} from './invalid';
import {Flag, hasKey, keys} from './util';
import {MapExcludeValueRefAndReplaceSignalWith} from './vega.schema';
import {MarkInvalidMixins} from './invalid';

/**
* All types of primitive marks.
Expand Down
4 changes: 2 additions & 2 deletions src/normalize/selectioncompat.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {isArray} from 'vega';
import {isArray} from 'vega-util';
import {BinParams, isBinParams} from '../bin';
import {ChannelDef, Field, isConditionalDef, isFieldDef, isScaleFieldDef} from '../channeldef';
import {Encoding} from '../encoding';
import {LogicalComposition, normalizeLogicalComposition} from '../logical';
import {FacetedUnitSpec, GenericSpec, LayerSpec, RepeatSpec, UnitSpec} from '../spec';
import {SpecMapper} from '../spec/map';
import {isBin, isFilter, isLookup} from '../transform';
import {duplicate, entries, vals} from '../util';
import {NormalizerParams} from './base';
import {Encoding} from '../encoding';

export class SelectionCompatibilityNormalizer extends SpecMapper<
NormalizerParams,
Expand Down
2 changes: 1 addition & 1 deletion src/normalize/toplevelselection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isArray, isString} from 'vega';
import {isArray, isString} from 'vega-util';
import {Field} from '../channeldef';
import {VariableParameter} from '../parameter';
import {isSelectionParameter, SelectionParameter} from '../selection';
Expand Down
2 changes: 1 addition & 1 deletion src/parameter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Binding, Expr, InitSignal, NewSignal} from 'vega';
import type {Binding, Expr, InitSignal, NewSignal} from 'vega';
import {isSelectionParameter, TopLevelSelectionParameter} from './selection';

export type ParameterName = string;
Expand Down
2 changes: 1 addition & 1 deletion src/projection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {BaseProjection, SignalRef, Vector2} from 'vega';
import type {BaseProjection, SignalRef, Vector2} from 'vega';
import {ExprRef} from './expr';
import {MapExcludeValueRefAndReplaceSignalWith, ProjectionType} from './vega.schema';

Expand Down
7 changes: 3 additions & 4 deletions src/scale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
isObject,
import type {
ColorScheme,
RangeEnum,
ScaleBins,
ScaleInterpolateEnum,
Expand All @@ -8,8 +8,7 @@ import {
TimeInterval,
TimeIntervalStep
} from 'vega';
import type {ColorScheme} from 'vega-typings';
import {isString} from 'vega-util';
import {isString, isObject} from 'vega-util';
import * as CHANNEL from './channel';
import {Channel, isColorChannel} from './channel';
import {DateTime} from './datetime';
Expand Down
2 changes: 1 addition & 1 deletion src/selection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Binding, Color, Cursor, Stream, Vector2} from 'vega';
import type {Binding, Color, Cursor, Stream, Vector2} from 'vega';
import {isObject} from 'vega-util';
import {SingleDefUnitChannel} from './channel';
import {FieldName, PrimitiveValue} from './channeldef';
Expand Down
2 changes: 1 addition & 1 deletion src/spec/facet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {LayoutAlign, SignalRef} from 'vega';
import type {LayoutAlign, SignalRef} from 'vega';
import {BinParams} from '../bin';
import {ChannelDef, Field, FieldName, TypedFieldDef} from '../channeldef';
import {ExprRef} from '../expr';
Expand Down
2 changes: 1 addition & 1 deletion src/spec/toplevel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Color, SignalRef} from 'vega';
import type {Color, SignalRef} from 'vega';
import {BaseSpec} from '.';
import {getPositionScaleChannel} from '../channel';
import {signalRefOrValue} from '../compile/common';
Expand Down
2 changes: 1 addition & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AggregateOp} from 'vega';
import type {AggregateOp} from 'vega';
import {BinParams} from './bin';
import {FieldName} from './channeldef';
import {Data} from './data';
Expand Down
3 changes: 1 addition & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig} from 'vega-util';
import {hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig, isObject} from 'vega-util';
import {isLogicalAnd, isLogicalNot, isLogicalOr, LogicalComposition} from './logical';
import {isObject} from 'vega';

export const duplicate = structuredClone;

Expand Down

0 comments on commit 9952d67

Please sign in to comment.