Skip to content

Commit

Permalink
Remove core import from various files (#1183)
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinscott authored Oct 8, 2023
1 parent 4557bf9 commit 540bc5a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/upscalerjs/src/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { getUpscaler, } from './upscaler';
export { getPatchesFromImage, } from './image-utils';
export { AbortError, } from './errors-and-warnings';
export type { ModelDefinition, } from '@upscalerjs/core';
export type { ModelDefinition, } from '../../../shared/src/types';
export * from './types';
8 changes: 4 additions & 4 deletions packages/upscalerjs/src/shared/makeTick.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { vi, expect, } from 'vitest';
import * as tf from '@tensorflow/tfjs-node';
import {
isTensor,
} from '@upscalerjs/core';
} from '../../../shared/src/constants';
import {
AbortError,
} from './errors-and-warnings.js';
import { makeTick } from './makeTick.js';

import type * as core from '@upscalerjs/core';
import type * as sharedConstants from '../../../shared/src/constants';

vi.mock('@upscalerjs/core', async () => {
const { isTensor, ...rest} = await vi.importActual('@upscalerjs/core') as typeof core;
vi.mock('../../../shared/src/constants', async () => {
const { isTensor, ...rest} = await vi.importActual('../../../shared/src/constants') as typeof sharedConstants;
return {
...rest,
isTensor: vi.fn(isTensor),
Expand Down
3 changes: 2 additions & 1 deletion packages/upscalerjs/src/shared/makeTick.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { YieldedIntermediaryValue, } from './types';
import { isAborted, } from './utils';
import { isTensor, TF, } from '@upscalerjs/core';
import { isTensor, } from '../../../shared/src/constants';
import type { TF, } from '../../../shared/src/types';
import { AbortError, } from './errors-and-warnings';

type TickFunction = (result?: YieldedIntermediaryValue) => Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion packages/upscalerjs/src/shared/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Tensor3D, Tensor4D, } from '@tensorflow/tfjs-core';
import type { LayersModel, layers, } from '@tensorflow/tfjs-layers';
import type { TF, GraphModel, ModelDefinitionObjectOrFn, ModelDefinition, } from '@upscalerjs/core';
export type { ProcessFn, } from '@upscalerjs/core';

export type WarmupSizesByPatchSize = {
patchSize: number;
Expand Down Expand Up @@ -109,7 +110,6 @@ export type Patch = {
post: PatchCoordinates;
};

export type { ProcessFn, } from '@upscalerjs/core';
export interface Internals<T extends TF, Input> extends InternalConfig<T, Input> {
tf: T;
getUpscaleOptions: GetUpscaleOptions;
Expand Down
2 changes: 1 addition & 1 deletion packages/upscalerjs/src/shared/upscaler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getModel } from './model-utils';
import { cancellableWarmup } from './warmup';
import { cancellableUpscale } from './upscale';
import { WarmupSizes } from './types';
import { ModelDefinition } from '@upscalerjs/core';
import type { ModelDefinition } from '../../../shared/src/types';
import * as _tf from '@tensorflow/tfjs-node';
import * as tfn from '@tensorflow/tfjs-node';

Expand Down

0 comments on commit 540bc5a

Please sign in to comment.