mirror of
https://github.com/sass/sass.git
synced 2024-09-21 10:37:22 +00:00
Replace FileImporterResult with a plain URL (#3180)
Supplying a source map URL doesn't make sense for a file importer, for two reasons: 1. A canonical `file:` URL is already the recommended source map URL because it's always available on the local system. 2. Because a FileImporter doesn't know the fully-resolved canonical URL of the file it loads, it doesn't have any way of determining what the full source map URL should be anyway.
This commit is contained in:
parent
3b6deaf731
commit
ea3d97b8d6
8
js-api-doc/importer.d.ts
vendored
8
js-api-doc/importer.d.ts
vendored
@ -9,17 +9,11 @@ export interface FileImporter<
|
||||
findFileUrl(
|
||||
url: string,
|
||||
options: {fromImport: boolean}
|
||||
): PromiseOr<FileImporterResult | null, sync>;
|
||||
): PromiseOr<URL | null, sync>;
|
||||
|
||||
canonicalize?: never;
|
||||
}
|
||||
|
||||
export interface FileImporterResult {
|
||||
url: URL;
|
||||
|
||||
sourceMapUrl?: URL;
|
||||
}
|
||||
|
||||
export interface Importer<sync extends 'sync' | 'async' = 'sync' | 'async'> {
|
||||
canonicalize(
|
||||
url: string,
|
||||
|
7
js-api-doc/index.d.ts
vendored
7
js-api-doc/index.d.ts
vendored
@ -13,12 +13,7 @@ export {
|
||||
/** @hidden */
|
||||
export {Exception} from './exception';
|
||||
/** @hidden */
|
||||
export {
|
||||
FileImporter,
|
||||
FileImporterResult,
|
||||
Importer,
|
||||
ImporterResult,
|
||||
} from './importer';
|
||||
export {FileImporter, Importer, ImporterResult} from './importer';
|
||||
export {Logger, SourceSpan, SourceLocation} from './logger';
|
||||
/** @hidden */
|
||||
export {
|
||||
|
25
spec/js-api/importer.d.ts
vendored
25
spec/js-api/importer.d.ts
vendored
@ -50,34 +50,11 @@ export interface FileImporter<
|
||||
findFileUrl(
|
||||
url: string,
|
||||
options: {fromImport: boolean}
|
||||
): PromiseOr<FileImporterResult | null, sync>;
|
||||
): PromiseOr<URL | null, sync>;
|
||||
|
||||
canonicalize?: never;
|
||||
}
|
||||
|
||||
export interface FileImporterResult {
|
||||
/**
|
||||
* The partially-resolved `file:` URL of a file on disk.
|
||||
*
|
||||
* > Because this is [resolved] after being returned, it doesn't need to be a
|
||||
* > full canonical URL. Users' `FileImporter`s may simply append the relative
|
||||
* > URL to a path and let the compiler resolve extensions, partials, and
|
||||
* > index files.
|
||||
*
|
||||
* [resolved]: ../spec/modules.md#resolving-a-file-url
|
||||
*/
|
||||
url: URL;
|
||||
|
||||
/**
|
||||
* A browser-accessible URL indicating the resolved location of the imported
|
||||
* stylesheet.
|
||||
*
|
||||
* The implementation must use this URL in source maps to refer to source
|
||||
* spans in `css`.
|
||||
*/
|
||||
sourceMapUrl?: URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface represents an [importer]. When the importer is invoked with a
|
||||
* string `string`:
|
||||
|
7
spec/js-api/index.d.ts
vendored
7
spec/js-api/index.d.ts
vendored
@ -38,12 +38,7 @@ export {
|
||||
compileStringAsync,
|
||||
} from './compile';
|
||||
export {Exception} from './exception';
|
||||
export {
|
||||
FileImporter,
|
||||
FileImporterResult,
|
||||
Importer,
|
||||
ImporterResult,
|
||||
} from './importer';
|
||||
export {FileImporter, Importer, ImporterResult} from './importer';
|
||||
export {Logger, SourceSpan, SourceLocation} from './logger';
|
||||
export {
|
||||
CustomFunction,
|
||||
|
Loading…
Reference in New Issue
Block a user