1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | function default_1(SourceMapOutput, environment) {
|
4 | var SourceMapBuilder = (function () {
|
5 | function SourceMapBuilder(options) {
|
6 | this.options = options;
|
7 | }
|
8 | SourceMapBuilder.prototype.toCSS = function (rootNode, options, imports) {
|
9 | var sourceMapOutput = new SourceMapOutput({
|
10 | contentsIgnoredCharsMap: imports.contentsIgnoredChars,
|
11 | rootNode: rootNode,
|
12 | contentsMap: imports.contents,
|
13 | sourceMapFilename: this.options.sourceMapFilename,
|
14 | sourceMapURL: this.options.sourceMapURL,
|
15 | outputFilename: this.options.sourceMapOutputFilename,
|
16 | sourceMapBasepath: this.options.sourceMapBasepath,
|
17 | sourceMapRootpath: this.options.sourceMapRootpath,
|
18 | outputSourceFiles: this.options.outputSourceFiles,
|
19 | sourceMapGenerator: this.options.sourceMapGenerator,
|
20 | sourceMapFileInline: this.options.sourceMapFileInline,
|
21 | disableSourcemapAnnotation: this.options.disableSourcemapAnnotation
|
22 | });
|
23 | var css = sourceMapOutput.toCSS(options);
|
24 | this.sourceMap = sourceMapOutput.sourceMap;
|
25 | this.sourceMapURL = sourceMapOutput.sourceMapURL;
|
26 | if (this.options.sourceMapInputFilename) {
|
27 | this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename);
|
28 | }
|
29 | if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) {
|
30 | this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL);
|
31 | }
|
32 | return css + this.getCSSAppendage();
|
33 | };
|
34 | SourceMapBuilder.prototype.getCSSAppendage = function () {
|
35 | var sourceMapURL = this.sourceMapURL;
|
36 | if (this.options.sourceMapFileInline) {
|
37 | if (this.sourceMap === undefined) {
|
38 | return '';
|
39 | }
|
40 | sourceMapURL = "data:application/json;base64," + environment.encodeBase64(this.sourceMap);
|
41 | }
|
42 | if (this.options.disableSourcemapAnnotation) {
|
43 | return '';
|
44 | }
|
45 | if (sourceMapURL) {
|
46 | return "/*# sourceMappingURL=" + sourceMapURL + " */";
|
47 | }
|
48 | return '';
|
49 | };
|
50 | SourceMapBuilder.prototype.getExternalSourceMap = function () {
|
51 | return this.sourceMap;
|
52 | };
|
53 | SourceMapBuilder.prototype.setExternalSourceMap = function (sourceMap) {
|
54 | this.sourceMap = sourceMap;
|
55 | };
|
56 | SourceMapBuilder.prototype.isInline = function () {
|
57 | return this.options.sourceMapFileInline;
|
58 | };
|
59 | SourceMapBuilder.prototype.getSourceMapURL = function () {
|
60 | return this.sourceMapURL;
|
61 | };
|
62 | SourceMapBuilder.prototype.getOutputFilename = function () {
|
63 | return this.options.sourceMapOutputFilename;
|
64 | };
|
65 | SourceMapBuilder.prototype.getInputFilename = function () {
|
66 | return this.sourceMapInputFilename;
|
67 | };
|
68 | return SourceMapBuilder;
|
69 | }());
|
70 | return SourceMapBuilder;
|
71 | }
|
72 | exports.default = default_1;
|
73 | ;
|
74 |
|
\ | No newline at end of file |