diff --git a/src/compiler/preprocess/decode_sourcemap.ts b/src/compiler/preprocess/decode_sourcemap.ts index c7e13c2853..fc63c5b9c8 100644 --- a/src/compiler/preprocess/decode_sourcemap.ts +++ b/src/compiler/preprocess/decode_sourcemap.ts @@ -1,5 +1,5 @@ import { decode as decode_mappings } from 'sourcemap-codec'; -import { Processed } from './types'; +import { Processed } from '.'; /** * Import decoded sourcemap from mozilla/source-map/SourceMapGenerator diff --git a/src/compiler/preprocess/index.ts b/src/compiler/preprocess/index.ts index 93b48996c1..441a64fee8 100644 --- a/src/compiler/preprocess/index.ts +++ b/src/compiler/preprocess/index.ts @@ -3,7 +3,39 @@ import { getLocator } from 'locate-character'; import { MappedCode, SourceLocation, parse_attached_sourcemap, sourcemap_add_offset, combine_sourcemaps } from '../utils/mapped_code'; import { decode_map } from './decode_sourcemap'; import { replace_in_code, slice_source } from './replace_in_code'; -import { MarkupPreprocessor, Source, Preprocessor, PreprocessorGroup, Processed } from './types'; + +import { Location } from 'locate-character'; + +export interface Source { + source: string; + get_location: (search: number) => Location; + file_basename: string; + filename: string; +} + +export interface Processed { + code: string; + map?: string | object; // we are opaque with the type here to avoid dependency on the remapping module for our public types. + dependencies?: string[]; + toString?: () => string; +} + +export type MarkupPreprocessor = (options: { + content: string; + filename: string; +}) => Processed | Promise; + +export type Preprocessor = (options: { + content: string; + attributes: Record; + filename?: string; +}) => Processed | Promise; + +export interface PreprocessorGroup { + markup?: MarkupPreprocessor; + style?: Preprocessor; + script?: Preprocessor; +} interface SourceUpdate { string?: string; diff --git a/src/compiler/preprocess/replace_in_code.ts b/src/compiler/preprocess/replace_in_code.ts index 9f49abb0f8..450cf05edb 100644 --- a/src/compiler/preprocess/replace_in_code.ts +++ b/src/compiler/preprocess/replace_in_code.ts @@ -1,5 +1,5 @@ import { MappedCode } from '../utils/mapped_code'; -import { Source } from './types'; +import { Source } from '.'; interface Replacement { offset: number; diff --git a/src/compiler/preprocess/types.ts b/src/compiler/preprocess/types.ts deleted file mode 100644 index 06890ad7b5..0000000000 --- a/src/compiler/preprocess/types.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Location } from 'locate-character'; - -export interface Source { - source: string; - get_location: (search: number) => Location; - file_basename: string; - filename: string; -} - -export interface Processed { - code: string; - map?: string | object; // we are opaque with the type here to avoid dependency on the remapping module for our public types. - dependencies?: string[]; - toString?: () => string; -} - -export type MarkupPreprocessor = (options: { - content: string; - filename: string; -}) => Processed | Promise; - -export type Preprocessor = (options: { - content: string; - attributes: Record; - filename?: string; -}) => Processed | Promise; - -export interface PreprocessorGroup { - markup?: MarkupPreprocessor; - style?: Preprocessor; - script?: Preprocessor; -} diff --git a/src/compiler/utils/mapped_code.ts b/src/compiler/utils/mapped_code.ts index d0cab9f49f..deda0f1e0b 100644 --- a/src/compiler/utils/mapped_code.ts +++ b/src/compiler/utils/mapped_code.ts @@ -1,7 +1,7 @@ import { DecodedSourceMap, RawSourceMap, SourceMapLoader } from '@ampproject/remapping/dist/types/types'; import remapping from '@ampproject/remapping'; import { SourceMap } from 'magic-string'; -import { Source, Processed } from '../preprocess/types'; +import { Source, Processed } from '../preprocess'; export type SourceLocation = { line: number;