| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dcfb182 commit 54a250e
26 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -336,7 +336,7 @@ test-valgrind: all | |||
| 336 | 336 | test-check-deopts: all | |
| 337 | 337 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential | |
| 338 | 338 | ||
| 339 | - DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.js doc/api/addons.md | ||
| 339 | + DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.mjs doc/api/addons.md | ||
| 340 | 340 | ||
| 341 | 341 | ifeq ($(OSTYPE),aix) | |
| 342 | 342 | DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp | |
@@ -587,12 +587,12 @@ test-doc: doc-only lint-md ## Builds, lints, and verifies the docs. | |||
| 587 | 587 | else \ | |
| 588 | 588 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) doctool; \ | |
| 589 | 589 | fi | |
| 590 | - $(NODE) tools/doc/checkLinks.js . | ||
| 590 | + $(NODE) tools/doc/checkLinks.mjs . | ||
| 591 | 591 | ||
| 592 | 592 | .PHONY: test-doc-ci | |
| 593 | 593 | test-doc-ci: doc-only | |
| 594 | 594 | $(PYTHON) tools/test.py --shell $(NODE) $(TEST_CI_ARGS) $(PARALLEL_ARGS) doctool | |
| 595 | - $(NODE) tools/doc/checkLinks.js . | ||
| 595 | + $(NODE) tools/doc/checkLinks.mjs . | ||
| 596 | 596 | ||
| 597 | 597 | test-known-issues: all | |
| 598 | 598 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) known_issues | |
@@ -734,33 +734,33 @@ run-npm-ci = $(PWD)/$(NPM) ci | |||
| 734 | 734 | ||
| 735 | 735 | LINK_DATA = out/doc/apilinks.json | |
| 736 | 736 | VERSIONS_DATA = out/previous-doc-versions.json | |
| 737 | - gen-api = tools/doc/generate.js --node-version=$(FULLVERSION) \ | ||
| 737 | + gen-api = tools/doc/generate.mjs --node-version=$(FULLVERSION) \ | ||
| 738 | 738 | --apilinks=$(LINK_DATA) $< --output-directory=out/doc/api \ | |
| 739 | 739 | --versions-file=$(VERSIONS_DATA) | |
| 740 | - gen-apilink = tools/doc/apilinks.js $(LINK_DATA) $(wildcard lib/*.js) | ||
| 740 | + gen-apilink = tools/doc/apilinks.mjs $(LINK_DATA) $(wildcard lib/*.js) | ||
| 741 | 741 | ||
| 742 | - $(LINK_DATA): $(wildcard lib/*.js) tools/doc/apilinks.js | out/doc | ||
| 742 | + $(LINK_DATA): $(wildcard lib/*.js) tools/doc/apilinks.mjs | out/doc | ||
| 743 | 743 | $(call available-node, $(gen-apilink)) | |
| 744 | 744 | ||
| 745 | 745 | # Regenerate previous versions data if the current version changes | |
| 746 | - $(VERSIONS_DATA): CHANGELOG.md src/node_version.h tools/doc/versions.js | ||
| 747 | - $(call available-node, tools/doc/versions.js $@) | ||
| 746 | + $(VERSIONS_DATA): CHANGELOG.md src/node_version.h tools/doc/versions.mjs | ||
| 747 | + $(call available-node, tools/doc/versions.mjs $@) | ||
| 748 | 748 | ||
| 749 | - out/doc/api/%.json out/doc/api/%.html: doc/api/%.md tools/doc/generate.js \ | ||
| 750 | - tools/doc/markdown.js tools/doc/html.js tools/doc/json.js \ | ||
| 751 | - tools/doc/apilinks.js $(VERSIONS_DATA) | $(LINK_DATA) out/doc/api | ||
| 749 | + out/doc/api/%.json out/doc/api/%.html: doc/api/%.md tools/doc/generate.mjs \ | ||
| 750 | + tools/doc/markdown.mjs tools/doc/html.mjs tools/doc/json.mjs \ | ||
| 751 | + tools/doc/apilinks.mjs $(VERSIONS_DATA) | $(LINK_DATA) out/doc/api | ||
| 752 | 752 | $(call available-node, $(gen-api)) | |
| 753 | 753 | ||
| 754 | - out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.js \ | ||
| 755 | - tools/doc/apilinks.js | out/doc/api | ||
| 756 | - $(call available-node, tools/doc/allhtml.js) | ||
| 754 | + out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.mjs \ | ||
| 755 | + tools/doc/apilinks.mjs | out/doc/api | ||
| 756 | + $(call available-node, tools/doc/allhtml.mjs) | ||
| 757 | 757 | ||
| 758 | - out/doc/api/all.json: $(apidocs_json) tools/doc/alljson.js | out/doc/api | ||
| 759 | - $(call available-node, tools/doc/alljson.js) | ||
| 758 | + out/doc/api/all.json: $(apidocs_json) tools/doc/alljson.mjs | out/doc/api | ||
| 759 | + $(call available-node, tools/doc/alljson.mjs) | ||
| 760 | 760 | ||
| 761 | 761 | .PHONY: out/doc/api/stability | |
| 762 | - out/doc/api/stability: out/doc/api/all.json tools/doc/stability.js | out/doc/api | ||
| 763 | - $(call available-node, tools/doc/stability.js) | ||
| 762 | + out/doc/api/stability: out/doc/api/all.json tools/doc/stability.mjs | out/doc/api | ||
| 763 | + $(call available-node, tools/doc/stability.mjs) | ||
| 764 | 764 | ||
| 765 | 765 | .PHONY: docopen | |
| 766 | 766 | docopen: out/doc/api/all.html | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | <!-- | |
| 2 | 2 | NB(chrisdickinson): if you move this file, be sure to update | |
| 3 | - tools/doc/html.js to point at the new location. | ||
| 3 | + tools/doc/html.mjs to point at the new location. | ||
| 4 | 4 | --> | |
| 5 | 5 | ||
| 6 | 6 | <!--introduced_in=v0.10.0--> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,7 @@ const { | |||
| 30 | 30 | allowGlobals, | |
| 31 | 31 | mustCall, | |
| 32 | 32 | mustCallAtLeast, | |
| 33 | + mustSucceed, | ||
| 33 | 34 | hasMultiLocalhost, | |
| 34 | 35 | skipIfDumbTerminal, | |
| 35 | 36 | skipIfEslintMissing, | |
@@ -76,6 +77,7 @@ export { | |||
| 76 | 77 | allowGlobals, | |
| 77 | 78 | mustCall, | |
| 78 | 79 | mustCallAtLeast, | |
| 80 | + mustSucceed, | ||
| 79 | 81 | hasMultiLocalhost, | |
| 80 | 82 | skipIfDumbTerminal, | |
| 81 | 83 | skipIfEslintMissing, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,15 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | - | ||
| 3 | - require('../common'); | ||
| 4 | - const fixtures = require('../common/fixtures'); | ||
| 5 | - const tmpdir = require('../common/tmpdir'); | ||
| 6 | - const fs = require('fs'); | ||
| 7 | - const assert = require('assert'); | ||
| 8 | - const path = require('path'); | ||
| 9 | - const { execFileSync } = require('child_process'); | ||
| 10 | - | ||
| 11 | - const script = path.join(__dirname, '..', '..', 'tools', 'doc', 'apilinks.js'); | ||
| 1 | + import '../common/index.mjs'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 3 | + import tmpdir from '../common/tmpdir.js'; | ||
| 4 | + | ||
| 5 | + import assert from 'assert'; | ||
| 6 | + import { execFileSync } from 'child_process'; | ||
| 7 | + import fs from 'fs'; | ||
| 8 | + import path from 'path'; | ||
| 9 | + import { fileURLToPath } from 'url'; | ||
| 10 | + | ||
| 11 | + const script = fileURLToPath( | ||
| 12 | + new URL('../../tools/doc/apilinks.mjs', import.meta.url)); | ||
| 12 | 13 | const apilinks = fixtures.path('apilinks'); | |
| 13 | 14 | ||
| 14 | 15 | tmpdir.refresh(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,22 +1,14 @@ | |||
| 1 | - 'use strict'; | ||
| 1 | + import '../common/index.mjs'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 2 | 3 | ||
| 3 | - const common = require('../common'); | ||
| 4 | - // The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree. | ||
| 5 | - try { | ||
| 6 | - require('../../tools/node_modules/eslint/node_modules/js-yaml'); | ||
| 7 | - } catch { | ||
| 8 | - common.skip('missing js-yaml (eslint not present)'); | ||
| 9 | - } | ||
| 4 | + import assert from 'assert'; | ||
| 5 | + import { readFileSync } from 'fs'; | ||
| 6 | + import { createRequire } from 'module'; | ||
| 10 | 7 | ||
| 11 | - const assert = require('assert'); | ||
| 12 | - const { readFileSync } = require('fs'); | ||
| 13 | - const fixtures = require('../common/fixtures'); | ||
| 14 | - const { replaceLinks } = require('../../tools/doc/markdown.js'); | ||
| 15 | - const html = require('../../tools/doc/html.js'); | ||
| 16 | - const path = require('path'); | ||
| 8 | + import * as html from '../../tools/doc/html.mjs'; | ||
| 9 | + import { replaceLinks } from '../../tools/doc/markdown.mjs'; | ||
| 17 | 10 | ||
| 18 | - module.paths.unshift( | ||
| 19 | - path.join(__dirname, '..', '..', 'tools', 'doc', 'node_modules')); | ||
| 11 | + const require = createRequire(new URL('../../tools/doc/', import.meta.url)); | ||
| 20 | 12 | const unified = require('unified'); | |
| 21 | 13 | const markdown = require('remark-parse'); | |
| 22 | 14 | const remark2rehype = require('remark-rehype'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,21 +1,13 @@ | |||
| 1 | - 'use strict'; | ||
| 1 | + import * as common from '../common/index.mjs'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 2 | 3 | ||
| 3 | - const common = require('../common'); | ||
| 4 | - // The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree. | ||
| 5 | - try { | ||
| 6 | - require('../../tools/node_modules/eslint/node_modules/js-yaml'); | ||
| 7 | - } catch { | ||
| 8 | - common.skip('missing js-yaml (eslint not present)'); | ||
| 9 | - } | ||
| 4 | + import assert from 'assert'; | ||
| 5 | + import fs from 'fs'; | ||
| 6 | + import { createRequire } from 'module'; | ||
| 10 | 7 | ||
| 11 | - const assert = require('assert'); | ||
| 12 | - const fs = require('fs'); | ||
| 13 | - const path = require('path'); | ||
| 14 | - const fixtures = require('../common/fixtures'); | ||
| 15 | - const json = require('../../tools/doc/json.js'); | ||
| 8 | + import * as json from '../../tools/doc/json.mjs'; | ||
| 16 | 9 | ||
| 17 | - module.paths.unshift( | ||
| 18 | - path.join(__dirname, '..', '..', 'tools', 'doc', 'node_modules')); | ||
| 10 | + const require = createRequire(new URL('../../tools/doc/', import.meta.url)); | ||
| 19 | 11 | const unified = require('unified'); | |
| 20 | 12 | const markdown = require('remark-parse'); | |
| 21 | 13 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,16 @@ | |||
| 1 | - 'use strict'; | ||
| 1 | + import '../common/index.mjs'; | ||
| 2 | + import tmpdir from '../common/tmpdir.js'; | ||
| 2 | 3 | ||
| 3 | - require('../common'); | ||
| 4 | - const assert = require('assert'); | ||
| 5 | - const { spawnSync } = require('child_process'); | ||
| 6 | - const fs = require('fs'); | ||
| 7 | - const path = require('path'); | ||
| 8 | - const tmpdir = require('../common/tmpdir'); | ||
| 9 | - const util = require('util'); | ||
| 4 | + import assert from 'assert'; | ||
| 5 | + import { spawnSync } from 'child_process'; | ||
| 6 | + import fs from 'fs'; | ||
| 7 | + import path from 'path'; | ||
| 8 | + import { fileURLToPath } from 'url'; | ||
| 9 | + import util from 'util'; | ||
| 10 | 10 | ||
| 11 | 11 | const debuglog = util.debuglog('test'); | |
| 12 | - const versionsTool = path.resolve(__dirname, '../../tools/doc/versions.js'); | ||
| 12 | + const versionsTool = fileURLToPath( | ||
| 13 | + new URL('../../tools/doc/versions.mjs', import.meta.url)); | ||
| 13 | 14 | ||
| 14 | 15 | // At the time of writing these are the minimum expected versions. | |
| 15 | 16 | // New versions of Node.js do not have to be explicitly added here. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,8 @@ | |||
| 1 | - 'use strict'; | ||
| 1 | + import '../common/index.mjs'; | ||
| 2 | 2 | ||
| 3 | - require('../common'); | ||
| 4 | - const assert = require('assert'); | ||
| 3 | + import assert from 'assert'; | ||
| 5 | 4 | ||
| 6 | - const { referenceToLocalMdFile } = require('../../tools/doc/markdown.js'); | ||
| 5 | + import { referenceToLocalMdFile } from '../../tools/doc/markdown.mjs'; | ||
| 7 | 6 | ||
| 8 | 7 | { | |
| 9 | 8 | const shouldBeSpotted = [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,20 +1,20 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | - const common = require('../common'); | ||
| 1 | + import * as common from '../common/index.mjs'; | ||
| 2 | + | ||
| 3 | + import assert from 'assert'; | ||
| 4 | + import fs from 'fs'; | ||
| 5 | + import path from 'path'; | ||
| 6 | + | ||
| 3 | 7 | if (common.isWindows) { | |
| 4 | 8 | common.skip('`make doc` does not run on Windows'); | |
| 5 | 9 | } | |
| 6 | 10 | ||
| 7 | 11 | // This tests that `make doc` generates the documentation properly. | |
| 8 | 12 | // Note that for this test to pass, `make doc` must be run first. | |
| 9 | 13 | ||
| 10 | - const assert = require('assert'); | ||
| 11 | - const fs = require('fs'); | ||
| 12 | - const path = require('path'); | ||
| 13 | - | ||
| 14 | - const apiPath = path.resolve(__dirname, '..', '..', 'out', 'doc', 'api'); | ||
| 15 | - const mdPath = path.resolve(__dirname, '..', '..', 'doc', 'api'); | ||
| 16 | - const allMD = fs.readdirSync(mdPath); | ||
| 17 | - const allDocs = fs.readdirSync(apiPath); | ||
| 14 | + const apiURL = new URL('../../out/doc/api/', import.meta.url); | ||
| 15 | + const mdURL = new URL('../../doc/api/', import.meta.url); | ||
| 16 | + const allMD = fs.readdirSync(mdURL); | ||
| 17 | + const allDocs = fs.readdirSync(apiURL); | ||
| 18 | 18 | assert.ok(allDocs.includes('index.html')); | |
| 19 | 19 | ||
| 20 | 20 | const actualDocs = allDocs.filter( | |
@@ -33,7 +33,7 @@ for (const name of actualDocs) { | |||
| 33 | 33 | ); | |
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | - const toc = fs.readFileSync(path.resolve(apiPath, 'index.html'), 'utf8'); | ||
| 36 | + const toc = fs.readFileSync(new URL('./index.html', apiURL), 'utf8'); | ||
| 37 | 37 | const re = /href="([^/]+\.html)"/; | |
| 38 | 38 | const globalRe = new RegExp(re, 'g'); | |
| 39 | 39 | const links = toc.match(globalRe); | |
@@ -56,8 +56,9 @@ for (const actualDoc of actualDocs) { | |||
| 56 | 56 | assert.ok( | |
| 57 | 57 | expectedDocs.includes(actualDoc), `${actualDoc} does not match TOC`); | |
| 58 | 58 | ||
| 59 | - assert.ok( | ||
| 60 | - fs.statSync(path.join(apiPath, actualDoc)).size !== 0, | ||
| 59 | + assert.notStrictEqual( | ||
| 60 | + fs.statSync(new URL(`./${actualDoc}`, apiURL)).size, | ||
| 61 | + 0, | ||
| 61 | 62 | `${actualDoc} is empty` | |
| 62 | 63 | ); | |
| 63 | 64 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,7 +78,7 @@ added: v0.10.0 | |||
| 78 | 78 | ||
| 79 | 79 | * Returns: {SomeClass | null} The next `SomeClass` in line. | |
| 80 | 80 | ||
| 81 | - `SomeClass` must be registered in `tools/doc/type-parser.js` | ||
| 81 | + `SomeClass` must be registered in `tools/doc/type-parser.mjs` | ||
| 82 | 82 | to be properly parsed in `{type}` fields. | |
| 83 | 83 | ||
| 84 | 84 | ### SomeClass.someProperty | |
| Back | FazBrowse Home | New Git URL |
0 commit comments