Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit aac6589

Browse files
committed
feat(sassloader): export importer namespace
1 parent f17707d commit aac6589

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/SassFactory.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { buildContext } from './interop/context';
2+
import { buildImporter } from './interop/importer';
3+
import { wrapSassImporter } from './interop/importer/wrapSassImporter';
24
import { buildInteropUtility } from './interop/interopUtility';
35
import { getVersion } from './interop/miscellaneous';
46
import { wrapSassOptions } from './interop/options/wrapSassOptions';
@@ -14,9 +16,13 @@ interface SassFactory {
1416
*/
1517
getVersion: ReturnType<typeof getVersion>;
1618
/**
17-
* creation method to context api
19+
* Creation method to context api
1820
*/
1921
context: ReturnType<typeof buildContext>;
22+
/**
23+
* Create method to importer api
24+
*/
25+
importer: ReturnType<typeof buildImporter>;
2026
/**
2127
* utility functions to interop raw libsass interface
2228
*/
@@ -27,6 +33,7 @@ interface SassFactory {
2733
raw: {
2834
context: ReturnType<typeof wrapSassContext>;
2935
options: ReturnType<typeof wrapSassOptions>;
36+
importer: ReturnType<typeof wrapSassImporter>;
3037
};
3138
}
3239

src/interop/options/sassOptions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { StringMethodInterface } from '../interopUtility';
44
import { wrapSassContext } from '../wrapSassContext';
55
import { wrapSassOptions } from './wrapSassOptions';
66

7+
/**
8+
* Interop interface to `sass_option*` api
9+
* (https://github.com/sass/libsass/blob/master/docs/api-context.md#sass-options-api)
10+
*/
711
interface SassOptionsInterface {
812
/**
913
* Property accessor to `sass_option_(get|set)_precision`
@@ -84,9 +88,6 @@ enum OutputStyle {
8488
/**
8589
* @internal
8690
*
87-
* Interop interface to `sass_option*` api
88-
* (https://github.com/sass/libsass/blob/master/docs/api-context.md#sass-options-api)
89-
*
9091
*/
9192
class SassOptions implements SassOptionsInterface {
9293
/**

src/sassLoader.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { buildContext } from './interop/context';
2+
import { buildImporter } from './interop/importer';
3+
import { wrapSassImporter } from './interop/importer/wrapSassImporter';
24
import { buildInteropUtility } from './interop/interopUtility';
35
import { getVersion } from './interop/miscellaneous';
46
import { wrapSassOptions } from './interop/options/wrapSassOptions';
@@ -16,15 +18,19 @@ export const sassLoader = (asmModule: SassAsmModule): SassFactory => {
1618
const { cwrap } = asmModule;
1719
const cwrapCtx = wrapSassContext(cwrap);
1820
const cwrapOptions = wrapSassOptions(cwrap);
21+
const cwrapImporter = wrapSassImporter(cwrap);
22+
1923
const interop = buildInteropUtility(asmModule);
2024

2125
return {
2226
getVersion: getVersion(asmModule),
2327
context: buildContext(cwrapCtx, cwrapOptions, interop),
28+
importer: buildImporter(cwrapImporter, interop),
2429
interop,
2530
raw: {
2631
context: cwrapCtx,
27-
options: cwrapOptions
32+
options: cwrapOptions,
33+
importer: cwrapImporter
2834
}
2935
};
3036
};

0 commit comments

Comments
 (0)