token :
token[1];
- if (serializeContext.format.wrapAt && serializeContext.column + value.length > serializeContext.format.wrapAt) {
+ serializeContext.wrap(value);
+ serializeContext.track(value);
+ serializeContext.output.push(value);
+}
+
+function wrap(value, serializeContext) {
+ if (serializeContext.column + value.length > serializeContext.format.wrapAt) {
track(lineBreak, serializeContext);
serializeContext.output.push(lineBreak);
}
-
- track(value, serializeContext);
- serializeContext.output.push(value);
}
function track(value, serializeContext) {
line: 1,
output: [],
spaceAfterClosingBrace: context.options.compatibility.properties.spaceAfterClosingBrace,
- store: store
+ store: store,
+ track: context.options.format.wrapAt ?
+ function (value) { track(value, serializeContext); } :
+ function () { /* noop */ },
+ wrap: context.options.format.wrapAt ?
+ function (value) { wrap(value, serializeContext); } :
+ function () { /* noop */ }
};
all(tokens, serializeContext, false);
var value = fromString ? element : element[1];
var mappings = fromString ? null : element[2];
- if (serializeContext.format.wrapAt && serializeContext.column + value.length > serializeContext.format.wrapAt) {
+ serializeContext.wrap(value);
+ track(value, mappings, serializeContext);
+ serializeContext.output.push(value);
+}
+
+function wrap(value, serializeContext) {
+ if (serializeContext.column + value.length > serializeContext.format.wrapAt) {
track(lineBreak, false, serializeContext);
serializeContext.output.push(lineBreak);
}
-
- track(value, mappings, serializeContext);
- serializeContext.output.push(value);
}
function track(value, mappings, serializeContext) {
outputMap: new SourceMapGenerator(),
sourcesContent: context.sourcesContent,
spaceAfterClosingBrace: context.options.compatibility.properties.spaceAfterClosingBrace,
- store: store
+ store: store,
+ wrap: context.options.format.wrapAt ?
+ function (value) { wrap(value, serializeContext); } :
+ function () { /* noop */ }
};
all(tokens, serializeContext, false);