tools: rebuild lint-md.js

Update lint-md.js from updated rollup modules.

PR-URL: https://github.com/nodejs/node/pull/26393
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
Rich Trott 2019-03-01 22:14:14 -08:00
parent d9536f73e5
commit d3d79d9f86

View File

@ -539,7 +539,7 @@ module.exports = require("util");
module.exports = statistics module.exports = statistics
/* Get stats for a file, list of files, or list of messages. */ // Get stats for a file, list of files, or list of messages.
function statistics(files) { function statistics(files) {
var result = {true: 0, false: 0, null: 0} var result = {true: 0, false: 0, null: 0}
@ -556,10 +556,10 @@ function statistics(files) {
function count(value) { function count(value) {
if (value) { if (value) {
if (value[0] && value[0].messages) { if (value[0] && value[0].messages) {
/* Multiple vfiles */ // Multiple vfiles
countInAll(value) countInAll(value)
} else { } else {
/* One vfile / messages */ // One vfile / messages
countAll(value.messages || value) countAll(value.messages || value)
} }
} }
@ -958,10 +958,8 @@ Duplex.prototype._destroy = function (err, cb) {
"use strict"; "use strict";
/* Expose. */
module.exports = factory module.exports = factory
/* Factory. */
function factory(file) { function factory(file) {
var contents = indices(String(file)) var contents = indices(String(file))
@ -971,13 +969,12 @@ function factory(file) {
} }
} }
/* Factory to get the line and column-based `position` for // Factory to get the line and column-based `position` for `offset` in the bound
* `offset` in the bound indices. */ // indices.
function offsetToPositionFactory(indices) { function offsetToPositionFactory(indices) {
return offsetToPosition return offsetToPosition
/* Get the line and column-based `position` for // Get the line and column-based `position` for `offset` in the bound indices.
* `offset` in the bound indices. */
function offsetToPosition(offset) { function offsetToPosition(offset) {
var index = -1 var index = -1
var length = indices.length var length = indices.length
@ -1000,13 +997,13 @@ function offsetToPositionFactory(indices) {
} }
} }
/* Factory to get the `offset` for a line and column-based // Factory to get the `offset` for a line and column-based `position` in the
* `position` in the bound indices. */ // bound indices.
function positionToOffsetFactory(indices) { function positionToOffsetFactory(indices) {
return positionToOffset return positionToOffset
/* Get the `offset` for a line and column-based // Get the `offset` for a line and column-based `position` in the bound
* `position` in the bound indices. */ // indices.
function positionToOffset(position) { function positionToOffset(position) {
var line = position && position.line var line = position && position.line
var column = position && position.column var column = position && position.column
@ -1019,7 +1016,7 @@ function positionToOffsetFactory(indices) {
} }
} }
/* Get indices of line-breaks in `value`. */ // Get indices of line-breaks in `value`.
function indices(value) { function indices(value) {
var result = [] var result = []
var index = value.indexOf('\n') var index = value.indexOf('\n')
@ -3479,15 +3476,15 @@ function setup(env) {
var prevTime; var prevTime;
function debug() { function debug() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// Disabled? // Disabled?
if (!debug.enabled) { if (!debug.enabled) {
return; return;
} }
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var self = debug; // Set `diff` timestamp var self = debug; // Set `diff` timestamp
var curr = Number(new Date()); var curr = Number(new Date());
@ -3815,34 +3812,33 @@ var windows = process.platform === 'win32'
var prefix = windows ? /* istanbul ignore next */ '' : 'lib' var prefix = windows ? /* istanbul ignore next */ '' : 'lib'
var globals = path.resolve(npmPrefix, prefix, 'node_modules') var globals = path.resolve(npmPrefix, prefix, 'node_modules')
/* istanbul ignore next - If were in Electron, were running in a modified // If were in Electron, were running in a modified Node that cannot really
* Node that cannot really install global node modules. To find the actual // install global node modules. To find the actual modules, the user has to
* modules, the user has to either set `prefix` in their `.npmrc` (which is // either set `prefix` in their `.npmrc` (which is picked up by `npm-prefix`).
* picked up by `npm-prefix`). Most people dont do that, and some use NVM // Most people dont do that, and some use NVM instead to manage different
* instead to manage different versions of Node. Luckily NVM leaks some // versions of Node. Luckily NVM leaks some environment variables that we can
* environment variables that we can pick up on to try and detect the actual // pick up on to try and detect the actual modules.
* modules. */ /* istanbul ignore next */
if (electron && nvm && !fs.existsSync(globals)) { if (electron && nvm && !fs.existsSync(globals)) {
globals = path.resolve(nvm, '..', prefix, 'node_modules') globals = path.resolve(nvm, '..', prefix, 'node_modules')
} }
/* Load the plug-in found using `resolvePlugin`. */ // Load the plug-in found using `resolvePlugin`.
function loadPlugin(name, options) { function loadPlugin(name, options) {
return __webpack_require__(141)(resolvePlugin(name, options) || name) return __webpack_require__(141)(resolvePlugin(name, options) || name)
} }
/* Find a plugin. // Find a plugin.
* //
* See also: // See also:
* <https://docs.npmjs.com/files/folders#node-modules> // <https://docs.npmjs.com/files/folders#node-modules>
* <https://github.com/sindresorhus/resolve-from> // <https://github.com/sindresorhus/resolve-from>
* //
* Uses the standard node module loading strategy to find $name // Uses the standard node module loading strategy to find $name in each given
* in each given `cwd` (and optionally the global node_modules // `cwd` (and optionally the global `node_modules` directory).
* directory). //
* // If a prefix is given and $name is not a path, `$prefix-$name` is also
* If a prefix is given and $name is not a path, `$prefix-$name` // searched (preferring these over non-prefixed modules).
* is also searched (preferring these over non-prefixed modules). */
function resolvePlugin(name, options) { function resolvePlugin(name, options) {
var settings = options || {} var settings = options || {}
var prefix = settings.prefix var prefix = settings.prefix
@ -3852,6 +3848,8 @@ function resolvePlugin(name, options) {
var length var length
var index var index
var plugin var plugin
var slash
var scope = ''
if (cwd && typeof cwd === 'object') { if (cwd && typeof cwd === 'object') {
sources = cwd.concat() sources = cwd.concat()
@ -3859,19 +3857,33 @@ function resolvePlugin(name, options) {
sources = [cwd || process.cwd()] sources = [cwd || process.cwd()]
} }
/* Non-path. */ // Non-path.
if (name.indexOf(path.sep) === -1 && name.charAt(0) !== '.') { if (name.charAt(0) !== '.') {
if (settings.global == null ? globally : settings.global) { if (settings.global == null ? globally : settings.global) {
sources.push(globals) sources.push(globals)
} }
/* Unprefix module. */ // Unprefix module.
if (prefix) { if (prefix) {
prefix = prefix.charAt(prefix.length - 1) === '-' ? prefix : prefix + '-' prefix = prefix.charAt(prefix.length - 1) === '-' ? prefix : prefix + '-'
if (name.slice(0, prefix.length) !== prefix) { // Scope?
plugin = prefix + name if (name.charAt(0) === '@') {
slash = name.indexOf('/')
// Lets keep the algorithm simple. No need to care if this is a
// “valid” scope (I think?). But we do check for the slash.
if (slash !== -1) {
scope = name.slice(0, slash + 1)
name = name.slice(slash + 1)
}
} }
if (name.slice(0, prefix.length) !== prefix) {
plugin = scope + prefix + name
}
name = scope + name
} }
} }
@ -5564,12 +5576,12 @@ var stringify = __webpack_require__(27)
module.exports = VMessage module.exports = VMessage
/* Inherit from `Error#`. */ // Inherit from `Error#`.
function VMessagePrototype() {} function VMessagePrototype() {}
VMessagePrototype.prototype = Error.prototype VMessagePrototype.prototype = Error.prototype
VMessage.prototype = new VMessagePrototype() VMessage.prototype = new VMessagePrototype()
/* Message properties. */ // Message properties.
var proto = VMessage.prototype var proto = VMessage.prototype
proto.file = '' proto.file = ''
@ -5581,11 +5593,11 @@ proto.fatal = null
proto.column = null proto.column = null
proto.line = null proto.line = null
/* Construct a new VMessage. // Construct a new VMessage.
* //
* Note: We cannot invoke `Error` on the created context, // Note: We cannot invoke `Error` on the created context, as that adds readonly
* as that adds readonly `line` and `column` attributes on // `line` and `column` attributes on Safari 9, thus throwing and failing the
* Safari 9, thus throwing and failing the data. */ // data.
function VMessage(reason, position, origin) { function VMessage(reason, position, origin) {
var parts var parts
var range var range
@ -5604,18 +5616,18 @@ function VMessage(reason, position, origin) {
end: {line: null, column: null} end: {line: null, column: null}
} }
/* Node. */ // Node.
if (position && position.position) { if (position && position.position) {
position = position.position position = position.position
} }
if (position) { if (position) {
/* Position. */ // Position.
if (position.start) { if (position.start) {
location = position location = position
position = position.start position = position.start
} else { } else {
/* Point. */ // Point.
location.start = position location.start = position
} }
} }
@ -18936,16 +18948,17 @@ function encodeHex(character) {
} }
function State(options) { function State(options) {
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
this.indent = Math.max(1, (options['indent'] || 2)); this.indent = Math.max(1, (options['indent'] || 2));
this.skipInvalid = options['skipInvalid'] || false; this.noArrayIndent = options['noArrayIndent'] || false;
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); this.skipInvalid = options['skipInvalid'] || false;
this.styleMap = compileStyleMap(this.schema, options['styles'] || null); this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
this.sortKeys = options['sortKeys'] || false; this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
this.lineWidth = options['lineWidth'] || 80; this.sortKeys = options['sortKeys'] || false;
this.noRefs = options['noRefs'] || false; this.lineWidth = options['lineWidth'] || 80;
this.noCompatMode = options['noCompatMode'] || false; this.noRefs = options['noRefs'] || false;
this.condenseFlow = options['condenseFlow'] || false; this.noCompatMode = options['noCompatMode'] || false;
this.condenseFlow = options['condenseFlow'] || false;
this.implicitTypes = this.schema.compiledImplicit; this.implicitTypes = this.schema.compiledImplicit;
this.explicitTypes = this.schema.compiledExplicit; this.explicitTypes = this.schema.compiledExplicit;
@ -19565,13 +19578,14 @@ function writeNode(state, level, object, block, compact, iskey) {
} }
} }
} else if (type === '[object Array]') { } else if (type === '[object Array]') {
var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
if (block && (state.dump.length !== 0)) { if (block && (state.dump.length !== 0)) {
writeBlockSequence(state, level, state.dump, compact); writeBlockSequence(state, arrayLevel, state.dump, compact);
if (duplicate) { if (duplicate) {
state.dump = '&ref_' + duplicateIndex + state.dump; state.dump = '&ref_' + duplicateIndex + state.dump;
} }
} else { } else {
writeFlowSequence(state, level, state.dump); writeFlowSequence(state, arrayLevel, state.dump);
if (duplicate) { if (duplicate) {
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
} }
@ -35184,7 +35198,7 @@ function tableCell(node) {
/* 302 */ /* 302 */
/***/ (function(module) { /***/ (function(module) {
module.exports = {"_args":[["remark@10.0.0","/Users/trott/io.js/tools/node-lint-md-cli-rollup"]],"_from":"remark@10.0.0","_id":"remark@10.0.0","_inBundle":false,"_integrity":"sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ==","_location":"/remark","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"remark@10.0.0","name":"remark","escapedName":"remark","rawSpec":"10.0.0","saveSpec":null,"fetchSpec":"10.0.0"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/remark/-/remark-10.0.0.tgz","_spec":"10.0.0","_where":"/Users/trott/io.js/tools/node-lint-md-cli-rollup","author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"bugs":{"url":"https://github.com/remarkjs/remark/issues"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"dependencies":{"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"},"description":"Markdown processor powered by plugins","devDependencies":{"tape":"^4.9.1"},"files":["index.js"],"homepage":"http://remark.js.org","keywords":["markdown","abstract","syntax","tree","ast","parse","stringify","process"],"license":"MIT","name":"remark","repository":{"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"},"scripts":{"test":"tape test.js"},"version":"10.0.0","xo":false}; module.exports = {"name":"remark","version":"10.0.1","description":"Markdown processor powered by plugins","license":"MIT","keywords":["markdown","abstract","syntax","tree","ast","parse","stringify","process"],"homepage":"https://remark.js.org","repository":"https://github.com/remarkjs/remark/tree/master/packages/remark","bugs":"https://github.com/remarkjs/remark/issues","author":"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)","contributors":["Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"],"files":["index.js"],"dependencies":{"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"},"devDependencies":{"tape":"^4.9.1"},"scripts":{"test":"tape test.js"},"xo":false,"_resolved":"https://registry.npmjs.org/remark/-/remark-10.0.1.tgz","_integrity":"sha512-E6lMuoLIy2TyiokHprMjcWNJ5UxfGQjaMSMhV+f4idM625UjjK4j798+gPs5mfjzDE6vL0oFKVeZM6gZVSVrzQ==","_from":"remark@10.0.1"};
/***/ }), /***/ }),
/* 303 */ /* 303 */
@ -35269,9 +35283,9 @@ var control = __webpack_require__(306)
module.exports = lint module.exports = lint
/* `remark-lint`. This adds support for ignoring stuff from // `remark-lint`. This adds support for ignoring stuff from messages
* messages (`<!--lint ignore-->`). // (`<!--lint ignore-->`).
* All rules are in their own packages and presets. */ // All rules are in their own packages and presets.
function lint() { function lint() {
this.use(lintMessageControl) this.use(lintMessageControl)
} }
@ -35288,19 +35302,14 @@ function lintMessageControl() {
"use strict"; "use strict";
var control = __webpack_require__(307); var control = __webpack_require__(307)
var marker = __webpack_require__(308); var marker = __webpack_require__(308)
var xtend = __webpack_require__(7); var xtend = __webpack_require__(7)
module.exports = messageControl; module.exports = messageControl
function messageControl(options) { function messageControl(options) {
var settings = options || {}; return control(xtend({marker: marker, test: 'html'}, options))
return control(xtend(options, {
marker: settings.marker || marker,
test: settings.test || 'html'
}));
} }
@ -35622,106 +35631,64 @@ function detectGaps(tree, file) {
"use strict"; "use strict";
/* Expose. */
module.exports = marker module.exports = marker
/* HTML type. */ var whiteSpaceExpression = /\s+/g
var T_HTML = 'html'
/* Expression for eliminating extra spaces */ var parametersExpression = /\s+([-a-z0-9_]+)(?:=(?:"((?:\\[\s\S]|[^"])+)"|'((?:\\[\s\S]|[^'])+)'|((?:\\[\s\S]|[^"'\s])+)))?/gi
var SPACES = /\s+/g
/* Expression for parsing parameters. */ var commentExpression = /\s*([a-zA-Z0-9-]+)(\s+([\s\S]*))?\s*/
var PARAMETERS = new RegExp(
'\\s+' + var markerExpression = new RegExp(
'(' + '(\\s*<!--' + commentExpression.source + '-->\\s*)'
'[-a-z0-9_]+' +
')' +
'(?:' +
'=' +
'(?:' +
'"' +
'(' +
'(?:' +
'\\\\[\\s\\S]' +
'|' +
'[^"]' +
')+' +
')' +
'"' +
'|' +
"'" +
'(' +
'(?:' +
'\\\\[\\s\\S]' +
'|' +
"[^']" +
')+' +
')' +
"'" +
'|' +
'(' +
'(?:' +
'\\\\[\\s\\S]' +
'|' +
'[^"\'\\s]' +
')+' +
')' +
')' +
')?',
'gi'
) )
var MARKER = new RegExp( // Parse a comment marker.
'(' +
'\\s*' +
'<!--' +
'\\s*' +
'([a-zA-Z0-9-]+)' +
'(\\s+([\\s\\S]*?))?' +
'\\s*' +
'-->' +
'\\s*' +
')'
)
/* Parse a comment marker */
function marker(node) { function marker(node) {
var type
var value var value
var match var match
var params var params
if (!node || node.type !== T_HTML) { if (!node) {
return null
}
type = node.type
if (type !== 'html' && type !== 'comment') {
return null return null
} }
value = node.value value = node.value
match = value.match(MARKER) match = value.match(type === 'comment' ? commentExpression : markerExpression)
if (!match || match[1].length !== value.length) { if (!match || match[0].length !== value.length) {
return null return null
} }
params = parameters(match[3] || '') match = match.slice(node.type === 'comment' ? 1 : 2)
params = parameters(match[1] || '')
if (!params) { if (!params) {
return null return null
} }
return { return {
name: match[2], name: match[0],
attributes: match[4] || '', attributes: match[2] || '',
parameters: params, parameters: params,
node: node node: node
} }
} }
/* Parse `value` into an object. */ // Parse `value` into an object.
function parameters(value) { function parameters(value) {
var attributes = {} var attributes = {}
var rest = value.replace(PARAMETERS, replacer) var rest = value.replace(parametersExpression, replacer)
return rest.replace(SPACES, '') ? null : attributes return rest.replace(whiteSpaceExpression, '') ? null : attributes
/* eslint-disable max-params */ /* eslint-disable max-params */
function replacer($0, $1, $2, $3, $4) { function replacer($0, $1, $2, $3, $4) {