| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 101de9d commit e95fd6a
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,3 +6,4 @@ test/fixtures | |||
| 6 | 6 | test/**/node_modules | |
| 7 | 7 | test/disabled | |
| 8 | 8 | test/tmp*/ | |
| 9 | + tools/doc/node_modules | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -514,7 +514,7 @@ bench-idle: | |||
| 514 | 514 | $(NODE) benchmark/idle_clients.js & | |
| 515 | 515 | ||
| 516 | 516 | jslint: | |
| 517 | - $(NODE) tools/eslint/bin/eslint.js src lib test tools/eslint-rules \ | ||
| 517 | + $(NODE) tools/eslint/bin/eslint.js lib src test tools/doc tools/eslint-rules \ | ||
| 518 | 518 | --rulesdir tools/eslint-rules --quiet | |
| 519 | 519 | ||
| 520 | 520 | CPPLINT_EXCLUDE ?= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,12 +4,13 @@ const fs = require('fs'); | |||
| 4 | 4 | const path = require('path'); | |
| 5 | 5 | const marked = require('marked'); | |
| 6 | 6 | ||
| 7 | - const doc = path.resolve(__dirname, '..', '..', 'doc', 'api', 'addons.markdown'); | ||
| 8 | - const verifyDir = path.resolve(__dirname, '..', '..', 'test', 'addons'); | ||
| 7 | + const rootDir = path.resolve(__dirname, '..', '..'); | ||
| 8 | + const doc = path.resolve(rootDir, 'doc', 'api', 'addons.markdown'); | ||
| 9 | + const verifyDir = path.resolve(rootDir, 'test', 'addons'); | ||
| 9 | 10 | ||
| 10 | 11 | const contents = fs.readFileSync(doc).toString(); | |
| 11 | 12 | ||
| 12 | - let tokens = marked.lexer(contents, {}); | ||
| 13 | + const tokens = marked.lexer(contents, {}); | ||
| 13 | 14 | let files = null; | |
| 14 | 15 | let blockName; | |
| 15 | 16 | let id = 0; | |
@@ -27,7 +28,7 @@ oldDirs = oldDirs.filter(function(dir) { | |||
| 27 | 28 | for (var i = 0; i < tokens.length; i++) { | |
| 28 | 29 | var token = tokens[i]; | |
| 29 | 30 | if (token.type === 'heading' && token.text) { | |
| 30 | - blockName = token.text | ||
| 31 | + blockName = token.text; | ||
| 31 | 32 | if (files && Object.keys(files).length !== 0) { | |
| 32 | 33 | verifyFiles(files, | |
| 33 | 34 | blockName, | |
@@ -60,8 +61,14 @@ function verifyFiles(files, blockName, onprogress, ondone) { | |||
| 60 | 61 | return; | |
| 61 | 62 | } | |
| 62 | 63 | ||
| 63 | - blockName = blockName.toLowerCase().replace(/\s/g, '_').replace(/[^a-z\d_]/g, '') | ||
| 64 | - let dir = path.resolve(verifyDir, `${(++id < 10 ? '0' : '') + id}_${blockName}`); | ||
| 64 | + blockName = blockName | ||
| 65 | + .toLowerCase() | ||
| 66 | + .replace(/\s/g, '_') | ||
| 67 | + .replace(/[^a-z\d_]/g, ''); | ||
| 68 | + const dir = path.resolve( | ||
| 69 | + verifyDir, | ||
| 70 | + `${(++id < 10 ? '0' : '') + id}_${blockName}` | ||
| 71 | + ); | ||
| 65 | 72 | ||
| 66 | 73 | files = Object.keys(files).map(function(name) { | |
| 67 | 74 | return { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 1 | 3 | var processIncludes = require('./preprocess.js'); | |
| 2 | - var marked = require('marked'); | ||
| 3 | 4 | var fs = require('fs'); | |
| 4 | - var path = require('path'); | ||
| 5 | 5 | ||
| 6 | 6 | // parse the args. | |
| 7 | 7 | // Don't use nopt or whatever for this. It's simple enough. | |
@@ -11,15 +11,15 @@ var format = 'json'; | |||
| 11 | 11 | var template = null; | |
| 12 | 12 | var inputFile = null; | |
| 13 | 13 | ||
| 14 | - args.forEach(function (arg) { | ||
| 14 | + args.forEach(function(arg) { | ||
| 15 | 15 | if (!arg.match(/^\-\-/)) { | |
| 16 | 16 | inputFile = arg; | |
| 17 | 17 | } else if (arg.match(/^\-\-format=/)) { | |
| 18 | 18 | format = arg.replace(/^\-\-format=/, ''); | |
| 19 | 19 | } else if (arg.match(/^\-\-template=/)) { | |
| 20 | 20 | template = arg.replace(/^\-\-template=/, ''); | |
| 21 | 21 | } | |
| 22 | - }) | ||
| 22 | + }); | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | if (!inputFile) { | |
@@ -35,8 +35,6 @@ fs.readFile(inputFile, 'utf8', function(er, input) { | |||
| 35 | 35 | }); | |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | - | ||
| 39 | - | ||
| 40 | 38 | function next(er, input) { | |
| 41 | 39 | if (er) throw er; | |
| 42 | 40 | switch (format) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 1 | 3 | var fs = require('fs'); | |
| 2 | 4 | var marked = require('marked'); | |
| 3 | 5 | var path = require('path'); | |
@@ -6,7 +8,14 @@ var preprocess = require('./preprocess.js'); | |||
| 6 | 8 | module.exports = toHTML; | |
| 7 | 9 | ||
| 8 | 10 | // TODO(chrisdickinson): never stop vomitting / fix this. | |
| 9 | - var gtocPath = path.resolve(path.join(__dirname, '..', '..', 'doc', 'api', '_toc.markdown')); | ||
| 11 | + var gtocPath = path.resolve(path.join( | ||
| 12 | + __dirname, | ||
| 13 | + '..', | ||
| 14 | + '..', | ||
| 15 | + 'doc', | ||
| 16 | + 'api', | ||
| 17 | + '_toc.markdown' | ||
| 18 | + )); | ||
| 10 | 19 | var gtocLoading = null; | |
| 11 | 20 | var gtocData = null; | |
| 12 | 21 | ||
@@ -55,7 +64,10 @@ function loadGtoc(cb) { | |||
| 55 | 64 | } | |
| 56 | 65 | ||
| 57 | 66 | function toID(filename) { | |
| 58 | - return filename.replace('.html', '').replace(/[^\w\-]/g, '-').replace(/-+/g, '-'); | ||
| 67 | + return filename | ||
| 68 | + .replace('.html', '') | ||
| 69 | + .replace(/[^\w\-]/g, '-') | ||
| 70 | + .replace(/-+/g, '-'); | ||
| 59 | 71 | } | |
| 60 | 72 | ||
| 61 | 73 | function render(lexed, filename, template, cb) { | |
@@ -85,7 +97,7 @@ function render(lexed, filename, template, cb) { | |||
| 85 | 97 | ||
| 86 | 98 | // content has to be the last thing we do with | |
| 87 | 99 | // the lexed tokens, because it's destructive. | |
| 88 | - content = marked.parser(lexed); | ||
| 100 | + const content = marked.parser(lexed); | ||
| 89 | 101 | template = template.replace(/__CONTENT__/g, content); | |
| 90 | 102 | ||
| 91 | 103 | cb(null, template); | |
@@ -173,7 +185,6 @@ function parseAPIHeader(text) { | |||
| 173 | 185 | ||
| 174 | 186 | // section is just the first heading | |
| 175 | 187 | function getSection(lexed) { | |
| 176 | - var section = ''; | ||
| 177 | 188 | for (var i = 0, l = lexed.length; i < l; i++) { | |
| 178 | 189 | var tok = lexed[i]; | |
| 179 | 190 | if (tok.type === 'heading') return tok.text; | |
@@ -183,7 +194,6 @@ function getSection(lexed) { | |||
| 183 | 194 | ||
| 184 | 195 | ||
| 185 | 196 | function buildToc(lexed, filename, cb) { | |
| 186 | - var indent = 0; | ||
| 187 | 197 | var toc = []; | |
| 188 | 198 | var depth = 0; | |
| 189 | 199 | lexed.forEach(function(tok) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 1 | 3 | module.exports = doJSON; | |
| 2 | 4 | ||
| 3 | 5 | // Take the lexed input, and return a JSON-encoded object | |
@@ -12,7 +14,7 @@ function doJSON(input, filename, cb) { | |||
| 12 | 14 | var current = root; | |
| 13 | 15 | var state = null; | |
| 14 | 16 | var lexed = marked.lexer(input); | |
| 15 | - lexed.forEach(function (tok) { | ||
| 17 | + lexed.forEach(function(tok) { | ||
| 16 | 18 | var type = tok.type; | |
| 17 | 19 | var text = tok.text; | |
| 18 | 20 | ||
@@ -31,7 +33,7 @@ function doJSON(input, filename, cb) { | |||
| 31 | 33 | if (type === 'heading' && | |
| 32 | 34 | !text.trim().match(/^example/i)) { | |
| 33 | 35 | if (tok.depth - depth > 1) { | |
| 34 | - return cb(new Error('Inappropriate heading level\n'+ | ||
| 36 | + return cb(new Error('Inappropriate heading level\n' + | ||
| 35 | 37 | JSON.stringify(tok))); | |
| 36 | 38 | } | |
| 37 | 39 | ||
@@ -77,7 +79,7 @@ function doJSON(input, filename, cb) { | |||
| 77 | 79 | // | |
| 78 | 80 | // If one of these isnt' found, then anything that comes between | |
| 79 | 81 | // here and the next heading should be parsed as the desc. | |
| 80 | - var stability | ||
| 82 | + var stability; | ||
| 81 | 83 | if (state === 'AFTERHEADING') { | |
| 82 | 84 | if (type === 'code' && | |
| 83 | 85 | (stability = text.match(/^Stability: ([0-5])(?:\s*-\s*)?(.*)$/))) { | |
@@ -125,7 +127,7 @@ function doJSON(input, filename, cb) { | |||
| 125 | 127 | finishSection(current, stack[stack.length - 1]); | |
| 126 | 128 | } | |
| 127 | 129 | ||
| 128 | - return cb(null, root) | ||
| 130 | + return cb(null, root); | ||
| 129 | 131 | } | |
| 130 | 132 | ||
| 131 | 133 | ||
@@ -146,7 +148,7 @@ function doJSON(input, filename, cb) { | |||
| 146 | 148 | // { type: 'list_item_end' }, | |
| 147 | 149 | // { type: 'list_item_start' }, | |
| 148 | 150 | // { type: 'text', | |
| 149 | - // text: 'silent: Boolean, whether or not to send output to parent\'s stdio.' }, | ||
| 151 | + // text: 'silent: Boolean, whether to send output to parent\'s stdio.' }, | ||
| 150 | 152 | // { type: 'text', text: 'Default: `false`' }, | |
| 151 | 153 | // { type: 'space' }, | |
| 152 | 154 | // { type: 'list_item_end' }, | |
@@ -168,7 +170,7 @@ function doJSON(input, filename, cb) { | |||
| 168 | 170 | // desc: 'string arguments passed to worker.' }, | |
| 169 | 171 | // { name: 'silent', | |
| 170 | 172 | // type: 'boolean', | |
| 171 | - // desc: 'whether or not to send output to parent\'s stdio.', | ||
| 173 | + // desc: 'whether to send output to parent\'s stdio.', | ||
| 172 | 174 | // default: 'false' } ] } ] | |
| 173 | 175 | ||
| 174 | 176 | function processList(section) { | |
@@ -231,7 +233,7 @@ function processList(section) { | |||
| 231 | 233 | // each item is an argument, unless the name is 'return', | |
| 232 | 234 | // in which case it's the return value. | |
| 233 | 235 | section.signatures = section.signatures || []; | |
| 234 | - var sig = {} | ||
| 236 | + var sig = {}; | ||
| 235 | 237 | section.signatures.push(sig); | |
| 236 | 238 | sig.params = values.filter(function(v) { | |
| 237 | 239 | if (v.name === 'return') { | |
@@ -273,7 +275,7 @@ function parseSignature(text, sig) { | |||
| 273 | 275 | params = params[1]; | |
| 274 | 276 | // the [ is irrelevant. ] indicates optionalness. | |
| 275 | 277 | params = params.replace(/\[/g, ''); | |
| 276 | - params = params.split(/,/) | ||
| 278 | + params = params.split(/,/); | ||
| 277 | 279 | params.forEach(function(p, i, _) { | |
| 278 | 280 | p = p.trim(); | |
| 279 | 281 | if (!p) return; | |
@@ -362,7 +364,7 @@ function parseListItem(item) { | |||
| 362 | 364 | ||
| 363 | 365 | function finishSection(section, parent) { | |
| 364 | 366 | if (!section || !parent) { | |
| 365 | - throw new Error('Invalid finishSection call\n'+ | ||
| 367 | + throw new Error('Invalid finishSection call\n' + | ||
| 366 | 368 | JSON.stringify(section) + '\n' + | |
| 367 | 369 | JSON.stringify(parent)); | |
| 368 | 370 | } | |
@@ -405,7 +407,7 @@ function finishSection(section, parent) { | |||
| 405 | 407 | // properties are a bit special. | |
| 406 | 408 | // their "type" is the type of object, not "property" | |
| 407 | 409 | if (section.properties) { | |
| 408 | - section.properties.forEach(function (p) { | ||
| 410 | + section.properties.forEach(function(p) { | ||
| 409 | 411 | if (p.typeof) p.type = p.typeof; | |
| 410 | 412 | else delete p.type; | |
| 411 | 413 | delete p.typeof; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 1 | 3 | module.exports = preprocess; | |
| 2 | 4 | ||
| 3 | 5 | var path = require('path'); | |
@@ -8,7 +10,7 @@ var includeData = {}; | |||
| 8 | 10 | ||
| 9 | 11 | function preprocess(inputFile, input, cb) { | |
| 10 | 12 | input = stripComments(input); | |
| 11 | - processIncludes(inputFile, input, function (err, data) { | ||
| 13 | + processIncludes(inputFile, input, function(err, data) { | ||
| 12 | 14 | if (err) return cb(err); | |
| 13 | 15 | ||
| 14 | 16 | cb(null, data); | |
@@ -47,7 +49,7 @@ function processIncludes(inputFile, input, cb) { | |||
| 47 | 49 | if (er) return cb(errState = er); | |
| 48 | 50 | incCount--; | |
| 49 | 51 | includeData[fname] = inc; | |
| 50 | - input = input.split(include+'\n').join(includeData[fname]+'\n'); | ||
| 52 | + input = input.split(include + '\n').join(includeData[fname] + '\n'); | ||
| 51 | 53 | if (incCount === 0) { | |
| 52 | 54 | return cb(null, input); | |
| 53 | 55 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -259,7 +259,7 @@ goto jslint | |||
| 259 | 259 | :jslint | |
| 260 | 260 | if not defined jslint goto exit | |
| 261 | 261 | echo running jslint | |
| 262 | - %config%\node tools\eslint\bin\eslint.js src lib test tools\eslint-rules --rulesdir tools\eslint-rules --quiet | ||
| 262 | + %config%\node tools\eslint\bin\eslint.js lib src test tools\doc tools\eslint-rules --rulesdir tools\eslint-rules --quiet | ||
| 263 | 263 | goto exit | |
| 264 | 264 | ||
| 265 | 265 | :create-msvs-files-failed | |
| Back | FazBrowse Home | New Git URL |
0 commit comments