Skip to content

Commit 0e5f554

Browse files
committed
fix typings
1 parent 5e8d912 commit 0e5f554

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

src/core-loader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import postcss, { AcceptedPlugin } from 'postcss'
22

33
import Parser, { PathFetcher, ExportTokens } from './parser';
4-
import { defaultPlugins, values, localByDefault, extractImports, scope } from './plugins';
4+
import { defaultPlugins, values, localByDefault, extractImports, scope, Source } from './plugins';
55

66
export interface CoreResult {
77
injectableSource: string,
@@ -23,7 +23,7 @@ export default class CoreLoader {
2323
}
2424

2525
load(
26-
sourceString: string,
26+
sourceString: Source,
2727
sourcePath: string = '',
2828
trace: string = '',
2929
pathFetcher: PathFetcher = CoreLoader.defaultPathFetcher

src/file-system-loader.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AcceptedPlugin } from 'postcss';
44

55
import CoreLoader, { CoreResult } from './core-loader';
66
import { ExportTokens } from './parser';
7+
import { Source } from './plugins';
78

89
export default class FileSystemLoader {
910
static defaultPlugins = CoreLoader.defaultPlugins;
@@ -41,8 +42,8 @@ export default class FileSystemLoader {
4142
}
4243
};
4344

44-
load(file: string, relativeTo?: string, depTrace?: string): Promise<CoreResult> {
45-
return this.pathFetcher(file, relativeTo, depTrace)
45+
load(sourceString: Source, relativeTo?: string, depTrace?: string): Promise<CoreResult> {
46+
return this.pathFetcher(sourceString.toString(), relativeTo, depTrace)
4647
.then(exportTokens => {
4748
let written = new Set(),
4849
injectableSources: string[] = [];

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
export { default as default, CoreResult } from './core-loader';
1+
export { default as default, CoreResult as Result } from './core-loader';
22
export { default as FileSystemLoader } from './file-system-loader';
33
export { ExportTokens, PathFetcher } from './parser';
4+
export { Source } from './plugins';

src/plugins.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export const extractImports: AcceptedPlugin = ExtractImports;
99
export const scope: AcceptedPlugin = Scope;
1010
export const values: AcceptedPlugin = Values;
1111

12+
export type Source = string | {
13+
toString(): string;
14+
};
15+
1216
export const defaultPlugins = [
1317
values,
1418
localByDefault,

0 commit comments

Comments
 (0)