work.suroh.tk/node_modules/postcss/lib/node.js

609 lines
46 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
exports.__esModule = true;
exports.default = void 0;
var _cssSyntaxError = _interopRequireDefault(require("./css-syntax-error"));
var _stringifier = _interopRequireDefault(require("./stringifier"));
var _stringify = _interopRequireDefault(require("./stringify"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function cloneNode(obj, parent) {
var cloned = new obj.constructor();
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
var value = obj[i];
var type = typeof value;
if (i === 'parent' && type === 'object') {
if (parent) cloned[i] = parent;
} else if (i === 'source') {
cloned[i] = value;
} else if (value instanceof Array) {
cloned[i] = value.map(function (j) {
return cloneNode(j, cloned);
});
} else {
if (type === 'object' && value !== null) value = cloneNode(value);
cloned[i] = value;
}
}
return cloned;
}
/**
* All node classes inherit the following common methods.
*
* @abstract
*/
var Node =
/*#__PURE__*/
function () {
/**
* @param {object} [defaults] Value for node properties.
*/
function Node(defaults) {
if (defaults === void 0) {
defaults = {};
}
this.raws = {};
if (process.env.NODE_ENV !== 'production') {
if (typeof defaults !== 'object' && typeof defaults !== 'undefined') {
throw new Error('PostCSS nodes constructor accepts object, not ' + JSON.stringify(defaults));
}
}
for (var name in defaults) {
this[name] = defaults[name];
}
}
/**
* Returns a `CssSyntaxError` instance containing the original position
* of the node in the source, showing line and column numbers and also
* a small excerpt to facilitate debugging.
*
* If present, an input source map will be used to get the original position
* of the source, even from a previous compilation step
* (e.g., from Sass compilation).
*
* This method produces very useful error messages.
*
* @param {string} message Error description.
* @param {object} [opts] Options.
* @param {string} opts.plugin Plugin name that created this error.
* PostCSS will set it automatically.
* @param {string} opts.word A word inside a nodes string that should
* be highlighted as the source of the error.
* @param {number} opts.index An index inside a nodes string that should
* be highlighted as the source of the error.
*
* @return {CssSyntaxError} Error object to throw it.
*
* @example
* if (!variables[name]) {
* throw decl.error('Unknown variable ' + name, { word: name })
* // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black
* // color: $black
* // a
* // ^
* // background: white
* }
*/
var _proto = Node.prototype;
_proto.error = function error(message, opts) {
if (opts === void 0) {
opts = {};
}
if (this.source) {
var pos = this.positionBy(opts);
return this.source.input.error(message, pos.line, pos.column, opts);
}
return new _cssSyntaxError.default(message);
}
/**
* This method is provided as a convenience wrapper for {@link Result#warn}.
*
* @param {Result} result The {@link Result} instance
* that will receive the warning.
* @param {string} text Warning message.
* @param {object} [opts] Options
* @param {string} opts.plugin Plugin name that created this warning.
* PostCSS will set it automatically.
* @param {string} opts.word A word inside a nodes string that should
* be highlighted as the source of the warning.
* @param {number} opts.index An index inside a nodes string that should
* be highlighted as the source of the warning.
*
* @return {Warning} Created warning object.
*
* @example
* const plugin = postcss.plugin('postcss-deprecated', () => {
* return (root, result) => {
* root.walkDecls('bad', decl => {
* decl.warn(result, 'Deprecated property bad')
* })
* }
* })
*/
;
_proto.warn = function warn(result, text, opts) {
var data = {
node: this
};
for (var i in opts) {
data[i] = opts[i];
}
return result.warn(text, data);
}
/**
* Removes the node from its parent and cleans the parent properties
* from the node and its children.
*
* @example
* if (decl.prop.match(/^-webkit-/)) {
* decl.remove()
* }
*
* @return {Node} Node to make calls chain.
*/
;
_proto.remove = function remove() {
if (this.parent) {
this.parent.removeChild(this);
}
this.parent = undefined;
return this;
}
/**
* Returns a CSS string representing the node.
*
* @param {stringifier|syntax} [stringifier] A syntax to use
* in string generation.
*
* @return {string} CSS string of this node.
*
* @example
* postcss.rule({ selector: 'a' }).toString() //=> "a {}"
*/
;
_proto.toString = function toString(stringifier) {
if (stringifier === void 0) {
stringifier = _stringify.default;
}
if (stringifier.stringify) stringifier = stringifier.stringify;
var result = '';
stringifier(this, function (i) {
result += i;
});
return result;
}
/**
* Returns an exact clone of the node.
*
* The resulting cloned node and its (cloned) children will retain
* code style properties.
*
* @param {object} [overrides] New properties to override in the clone.
*
* @example
* decl.raws.before //=> "\n "
* const cloned = decl.clone({ prop: '-moz-' + decl.prop })
* cloned.raws.before //=> "\n "
* cloned.toString() //=> -moz-transform: scale(0)
*
* @return {Node} Clone of the node.
*/
;
_proto.clone = function clone(overrides) {
if (overrides === void 0) {
overrides = {};
}
var cloned = cloneNode(this);
for (var name in overrides) {
cloned[name] = overrides[name];
}
return cloned;
}
/**
* Shortcut to clone the node and insert the resulting cloned node
* before the current node.
*
* @param {object} [overrides] Mew properties to override in the clone.
*
* @example
* decl.cloneBefore({ prop: '-moz-' + decl.prop })
*
* @return {Node} New node
*/
;
_proto.cloneBefore = function cloneBefore(overrides) {
if (overrides === void 0) {
overrides = {};
}
var cloned = this.clone(overrides);
this.parent.insertBefore(this, cloned);
return cloned;
}
/**
* Shortcut to clone the node and insert the resulting cloned node
* after the current node.
*
* @param {object} [overrides] New properties to override in the clone.
*
* @return {Node} New node.
*/
;
_proto.cloneAfter = function cloneAfter(overrides) {
if (overrides === void 0) {
overrides = {};
}
var cloned = this.clone(overrides);
this.parent.insertAfter(this, cloned);
return cloned;
}
/**
* Inserts node(s) before the current node and removes the current node.
*
* @param {...Node} nodes Mode(s) to replace current one.
*
* @example
* if (atrule.name === 'mixin') {
* atrule.replaceWith(mixinRules[atrule.params])
* }
*
* @return {Node} Current node to methods chain.
*/
;
_proto.replaceWith = function replaceWith() {
if (this.parent) {
for (var _len = arguments.length, nodes = new Array(_len), _key = 0; _key < _len; _key++) {
nodes[_key] = arguments[_key];
}
for (var _i = 0, _nodes = nodes; _i < _nodes.length; _i++) {
var node = _nodes[_i];
this.parent.insertBefore(this, node);
}
this.remove();
}
return this;
}
/**
* Returns the next child of the nodes parent.
* Returns `undefined` if the current node is the last child.
*
* @return {Node|undefined} Next node.
*
* @example
* if (comment.text === 'delete next') {
* const next = comment.next()
* if (next) {
* next.remove()
* }
* }
*/
;
_proto.next = function next() {
if (!this.parent) return undefined;
var index = this.parent.index(this);
return this.parent.nodes[index + 1];
}
/**
* Returns the previous child of the nodes parent.
* Returns `undefined` if the current node is the first child.
*
* @return {Node|undefined} Previous node.
*
* @example
* const annotation = decl.prev()
* if (annotation.type === 'comment') {
* readAnnotation(annotation.text)
* }
*/
;
_proto.prev = function prev() {
if (!this.parent) return undefined;
var index = this.parent.index(this);
return this.parent.nodes[index - 1];
}
/**
* Insert new node before current node to current nodes parent.
*
* Just alias for `node.parent.insertBefore(node, add)`.
*
* @param {Node|object|string|Node[]} add New node.
*
* @return {Node} This node for methods chain.
*
* @example
* decl.before('content: ""')
*/
;
_proto.before = function before(add) {
this.parent.insertBefore(this, add);
return this;
}
/**
* Insert new node after current node to current nodes parent.
*
* Just alias for `node.parent.insertAfter(node, add)`.
*
* @param {Node|object|string|Node[]} add New node.
*
* @return {Node} This node for methods chain.
*
* @example
* decl.after('color: black')
*/
;
_proto.after = function after(add) {
this.parent.insertAfter(this, add);
return this;
};
_proto.toJSON = function toJSON() {
var fixed = {};
for (var name in this) {
if (!this.hasOwnProperty(name)) continue;
if (name === 'parent') continue;
var value = this[name];
if (value instanceof Array) {
fixed[name] = value.map(function (i) {
if (typeof i === 'object' && i.toJSON) {
return i.toJSON();
} else {
return i;
}
});
} else if (typeof value === 'object' && value.toJSON) {
fixed[name] = value.toJSON();
} else {
fixed[name] = value;
}
}
return fixed;
}
/**
* Returns a {@link Node#raws} value. If the node is missing
* the code style property (because the node was manually built or cloned),
* PostCSS will try to autodetect the code style property by looking
* at other nodes in the tree.
*
* @param {string} prop Name of code style property.
* @param {string} [defaultType] Name of default value, it can be missed
* if the value is the same as prop.
*
* @example
* const root = postcss.parse('a { background: white }')
* root.nodes[0].append({ prop: 'color', value: 'black' })
* root.nodes[0].nodes[1].raws.before //=> undefined
* root.nodes[0].nodes[1].raw('before') //=> ' '
*
* @return {string} Code style value.
*/
;
_proto.raw = function raw(prop, defaultType) {
var str = new _stringifier.default();
return str.raw(this, prop, defaultType);
}
/**
* Finds the Root instance of the nodes tree.
*
* @example
* root.nodes[0].nodes[0].root() === root
*
* @return {Root} Root parent.
*/
;
_proto.root = function root() {
var result = this;
while (result.parent) {
result = result.parent;
}
return result;
}
/**
* Clear the code style properties for the node and its children.
*
* @param {boolean} [keepBetween] Keep the raws.between symbols.
*
* @return {undefined}
*
* @example
* node.raws.before //=> ' '
* node.cleanRaws()
* node.raws.before //=> undefined
*/
;
_proto.cleanRaws = function cleanRaws(keepBetween) {
delete this.raws.before;
delete this.raws.after;
if (!keepBetween) delete this.raws.between;
};
_proto.positionInside = function positionInside(index) {
var string = this.toString();
var column = this.source.start.column;
var line = this.source.start.line;
for (var i = 0; i < index; i++) {
if (string[i] === '\n') {
column = 1;
line += 1;
} else {
column += 1;
}
}
return {
line: line,
column: column
};
};
_proto.positionBy = function positionBy(opts) {
var pos = this.source.start;
if (opts.index) {
pos = this.positionInside(opts.index);
} else if (opts.word) {
var index = this.toString().indexOf(opts.word);
if (index !== -1) pos = this.positionInside(index);
}
return pos;
}
/**
* @memberof Node#
* @member {string} type String representing the nodes type.
* Possible values are `root`, `atrule`, `rule`,
* `decl`, or `comment`.
*
* @example
* postcss.decl({ prop: 'color', value: 'black' }).type //=> 'decl'
*/
/**
* @memberof Node#
* @member {Container} parent The nodes parent node.
*
* @example
* root.nodes[0].parent === root
*/
/**
* @memberof Node#
* @member {source} source The input source of the node.
*
* The property is used in source map generation.
*
* If you create a node manually (e.g., with `postcss.decl()`),
* that node will not have a `source` property and will be absent
* from the source map. For this reason, the plugin developer should
* consider cloning nodes to create new ones (in which case the new nodes
* source will reference the original, cloned node) or setting
* the `source` property manually.
*
* ```js
* // Bad
* const prefixed = postcss.decl({
* prop: '-moz-' + decl.prop,
* value: decl.value
* })
*
* // Good
* const prefixed = decl.clone({ prop: '-moz-' + decl.prop })
* ```
*
* ```js
* if (atrule.name === 'add-link') {
* const rule = postcss.rule({ selector: 'a', source: atrule.source })
* atrule.parent.insertBefore(atrule, rule)
* }
* ```
*
* @example
* decl.source.input.from //=> '/home/ai/a.sass'
* decl.source.start //=> { line: 10, column: 2 }
* decl.source.end //=> { line: 10, column: 12 }
*/
/**
* @memberof Node#
* @member {object} raws Information to generate byte-to-byte equal
* node string as it was in the origin input.
*
* Every parser saves its own properties,
* but the default CSS parser uses:
*
* * `before`: the space symbols before the node. It also stores `*`
* and `_` symbols before the declaration (IE hack).
* * `after`: the space symbols after the last child of the node
* to the end of the node.
* * `between`: the symbols between the property and value
* for declarations, selector and `{` for rules, or last parameter
* and `{` for at-rules.
* * `semicolon`: contains true if the last child has
* an (optional) semicolon.
* * `afterName`: the space between the at-rule name and its parameters.
* * `left`: the space symbols between `/*` and the comments text.
* * `right`: the space symbols between the comments text
* and <code>*&#47;</code>.
* * `important`: the content of the important statement,
* if it is not just `!important`.
*
* PostCSS cleans selectors, declaration values and at-rule parameters
* from comments and extra spaces, but it stores origin content in raws
* properties. As such, if you dont change a declarations value,
* PostCSS will use the raw value with comments.
*
* @example
* const root = postcss.parse('a {\n color:black\n}')
* root.first.first.raws //=> { before: '\n ', between: ':' }
*/
;
return Node;
}();
var _default = Node;
/**
* @typedef {object} position
* @property {number} line Source line in file.
* @property {number} column Source column in file.
*/
/**
* @typedef {object} source
* @property {Input} input {@link Input} with input file
* @property {position} start The starting position of the nodes source.
* @property {position} end The ending position of the nodes source.
*/
exports.default = _default;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGUuZXM2Il0sIm5hbWVzIjpbImNsb25lTm9kZSIsIm9iaiIsInBhcmVudCIsImNsb25lZCIsImNvbnN0cnVjdG9yIiwiaSIsImhhc093blByb3BlcnR5IiwidmFsdWUiLCJ0eXBlIiwiQXJyYXkiLCJtYXAiLCJqIiwiTm9kZSIsImRlZmF1bHRzIiwicmF3cyIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIkVycm9yIiwiSlNPTiIsInN0cmluZ2lmeSIsIm5hbWUiLCJlcnJvciIsI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