js-build-tools 6.2.2 → 6.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +180 -9
  2. package/dist/build.js +66 -66
  3. package/dist/bundle.js +1 -1
  4. package/dist/docs.js +11 -11
  5. package/dist/partials/jsdocDocsFor.js +133 -113
  6. package/dist/partials/loadPlaywright.js +34 -0
  7. package/dist/partials/neostandardLint.js +5 -3
  8. package/dist/partials/resolveDocsMethod.js +12 -12
  9. package/dist/partials/serveStatic.js +57 -0
  10. package/dist/partials/tsFor.js +2 -2
  11. package/dist/partials/typeDocsFor.js +28 -22
  12. package/dist/partials.js +169 -149
  13. package/dist/partials.min.js +1 -1
  14. package/dist/test-helpers/setUp.js +6 -0
  15. package/dist/utilities/convertMjsFilesForDocs.js +1 -0
  16. package/dist/utilities/dotGet.js +1 -0
  17. package/dist/utilities/dotNotate.js +5 -0
  18. package/dist/utilities/dotSet.js +1 -0
  19. package/dist/utilities/esmNamedExportsToCjs.js +1 -0
  20. package/dist/utilities/getBundleConfigs.js +1 -0
  21. package/dist/utilities/isObject.js +1 -0
  22. package/dist/utilities/strAfter.js +1 -0
  23. package/dist/utilities/strBefore.js +1 -0
  24. package/functions/bundle.mjs +1 -1
  25. package/functions/jsdocEsmExports.test.mjs +24 -0
  26. package/functions/partials/jsdocDocsFor.mjs +33 -13
  27. package/functions/partials/jsdocDocsFor.test.mjs +51 -0
  28. package/functions/partials/loadPlaywright.mjs +23 -0
  29. package/functions/partials/loadPlaywright.test.mjs +71 -0
  30. package/functions/partials/neostandardLint.mjs +5 -3
  31. package/functions/partials/serveStatic.mjs +47 -0
  32. package/functions/partials/serveStatic.test.mjs +71 -0
  33. package/functions/partials/tsFor.mjs +2 -2
  34. package/functions/partials/typeDocsFor.mjs +24 -20
  35. package/functions/partials/typeDocsFor.test.mjs +23 -0
  36. package/functions/partials.mjs +2 -0
  37. package/functions/partials.test.mjs +1 -1
  38. package/functions/test-helpers/setUp.mjs +6 -0
  39. package/functions/utilities/convertMjsFilesForDocs.mjs +1 -0
  40. package/functions/utilities/dotGet.mjs +1 -0
  41. package/functions/utilities/dotNotate.mjs +5 -0
  42. package/functions/utilities/dotSet.mjs +1 -0
  43. package/functions/utilities/esmNamedExportsToCjs.mjs +1 -0
  44. package/functions/utilities/getBundleConfigs.mjs +1 -0
  45. package/functions/utilities/isObject.mjs +1 -0
  46. package/functions/utilities/strAfter.mjs +1 -0
  47. package/functions/utilities/strBefore.mjs +1 -0
  48. package/gulp.config.mjs +2 -2
  49. package/gulpfile.base.mjs +1 -3
  50. package/jsdoc.base.js +9 -3
  51. package/jsdoc.esmExports.js +17 -0
  52. package/package.json +16 -10
package/dist/partials.js CHANGED
@@ -1,150 +1,170 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "addToReadme", {
7
- enumerable: true,
8
- get: function () {
9
- return _addToReadme.addToReadme;
10
- }
11
- });
12
- Object.defineProperty(exports, "beginWatcher", {
13
- enumerable: true,
14
- get: function () {
15
- return _beginWatcher.beginWatcher;
16
- }
17
- });
18
- Object.defineProperty(exports, "clean", {
19
- enumerable: true,
20
- get: function () {
21
- return _clean.clean;
22
- }
23
- });
24
- Object.defineProperty(exports, "copyFor", {
25
- enumerable: true,
26
- get: function () {
27
- return _copyFor.copyFor;
28
- }
29
- });
30
- Object.defineProperty(exports, "distFor", {
31
- enumerable: true,
32
- get: function () {
33
- return _distFor.distFor;
34
- }
35
- });
36
- Object.defineProperty(exports, "distForSrc", {
37
- enumerable: true,
38
- get: function () {
39
- return _distForSrc.distForSrc;
40
- }
41
- });
42
- Object.defineProperty(exports, "distSeries", {
43
- enumerable: true,
44
- get: function () {
45
- return _distSeries.distSeries;
46
- }
47
- });
48
- Object.defineProperty(exports, "imagesFor", {
49
- enumerable: true,
50
- get: function () {
51
- return _imagesFor.imagesFor;
52
- }
53
- });
54
- Object.defineProperty(exports, "importModule", {
55
- enumerable: true,
56
- get: function () {
57
- return _loadPeer.importModule;
58
- }
59
- });
60
- Object.defineProperty(exports, "importPeer", {
61
- enumerable: true,
62
- get: function () {
63
- return _loadPeer.importPeer;
64
- }
65
- });
66
- Object.defineProperty(exports, "jsdocDocsFor", {
67
- enumerable: true,
68
- get: function () {
69
- return _jsdocDocsFor.jsdocDocsFor;
70
- }
71
- });
72
- Object.defineProperty(exports, "minifyFor", {
73
- enumerable: true,
74
- get: function () {
75
- return _minifyFor.minifyFor;
76
- }
77
- });
78
- Object.defineProperty(exports, "neostandardLint", {
79
- enumerable: true,
80
- get: function () {
81
- return _neostandardLint.neostandardLint;
82
- }
83
- });
84
- Object.defineProperty(exports, "readmeTemplate", {
85
- enumerable: true,
86
- get: function () {
87
- return _readmeTemplate.readmeTemplate;
88
- }
89
- });
90
- Object.defineProperty(exports, "removeDirectory", {
91
- enumerable: true,
92
- get: function () {
93
- return _removeDirectory.removeDirectory;
94
- }
95
- });
96
- Object.defineProperty(exports, "requirePeer", {
97
- enumerable: true,
98
- get: function () {
99
- return _loadPeer.requirePeer;
100
- }
101
- });
102
- Object.defineProperty(exports, "resolveDocsMethod", {
103
- enumerable: true,
104
- get: function () {
105
- return _resolveDocsMethod.resolveDocsMethod;
106
- }
107
- });
108
- Object.defineProperty(exports, "runOnChange", {
109
- enumerable: true,
110
- get: function () {
111
- return _runOnChange.runOnChange;
112
- }
113
- });
114
- Object.defineProperty(exports, "sassFor", {
115
- enumerable: true,
116
- get: function () {
117
- return _sassFor.sassFor;
118
- }
119
- });
120
- Object.defineProperty(exports, "tsFor", {
121
- enumerable: true,
122
- get: function () {
123
- return _tsFor.tsFor;
124
- }
125
- });
126
- Object.defineProperty(exports, "typeDocsFor", {
127
- enumerable: true,
128
- get: function () {
129
- return _typeDocsFor.typeDocsFor;
130
- }
131
- });
132
- var _addToReadme = require("./partials/addToReadme.js");
133
- var _beginWatcher = require("./partials/beginWatcher.js");
134
- var _clean = require("./partials/clean.js");
135
- var _copyFor = require("./partials/copyFor.js");
136
- var _distFor = require("./partials/distFor.js");
137
- var _distForSrc = require("./partials/distForSrc.js");
138
- var _distSeries = require("./partials/distSeries.js");
139
- var _imagesFor = require("./partials/imagesFor.js");
140
- var _loadPeer = require("./partials/loadPeer.js");
141
- var _jsdocDocsFor = require("./partials/jsdocDocsFor.js");
142
- var _minifyFor = require("./partials/minifyFor.js");
143
- var _neostandardLint = require("./partials/neostandardLint.js");
144
- var _readmeTemplate = require("./partials/readmeTemplate.js");
145
- var _removeDirectory = require("./partials/removeDirectory.js");
146
- var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
147
- var _runOnChange = require("./partials/runOnChange.js");
148
- var _sassFor = require("./partials/sassFor.js");
149
- var _tsFor = require("./partials/tsFor.js");
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "addToReadme", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _addToReadme.addToReadme;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "beginWatcher", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _beginWatcher.beginWatcher;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "clean", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _clean.clean;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "copyFor", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _copyFor.copyFor;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "distFor", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _distFor.distFor;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "distForSrc", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _distForSrc.distForSrc;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "distSeries", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _distSeries.distSeries;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "imagesFor", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _imagesFor.imagesFor;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "importModule", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _loadPeer.importModule;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "importPeer", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _loadPeer.importPeer;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "jsdocDocsFor", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _jsdocDocsFor.jsdocDocsFor;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "launchBrowser", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _loadPlaywright.launchBrowser;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "loadPlaywright", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _loadPlaywright.loadPlaywright;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "minifyFor", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _minifyFor.minifyFor;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "neostandardLint", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _neostandardLint.neostandardLint;
94
+ }
95
+ });
96
+ Object.defineProperty(exports, "readmeTemplate", {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _readmeTemplate.readmeTemplate;
100
+ }
101
+ });
102
+ Object.defineProperty(exports, "removeDirectory", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _removeDirectory.removeDirectory;
106
+ }
107
+ });
108
+ Object.defineProperty(exports, "requirePeer", {
109
+ enumerable: true,
110
+ get: function () {
111
+ return _loadPeer.requirePeer;
112
+ }
113
+ });
114
+ Object.defineProperty(exports, "resolveDocsMethod", {
115
+ enumerable: true,
116
+ get: function () {
117
+ return _resolveDocsMethod.resolveDocsMethod;
118
+ }
119
+ });
120
+ Object.defineProperty(exports, "runOnChange", {
121
+ enumerable: true,
122
+ get: function () {
123
+ return _runOnChange.runOnChange;
124
+ }
125
+ });
126
+ Object.defineProperty(exports, "sassFor", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _sassFor.sassFor;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, "serveStatic", {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _serveStatic.serveStatic;
136
+ }
137
+ });
138
+ Object.defineProperty(exports, "tsFor", {
139
+ enumerable: true,
140
+ get: function () {
141
+ return _tsFor.tsFor;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, "typeDocsFor", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _typeDocsFor.typeDocsFor;
148
+ }
149
+ });
150
+ var _addToReadme = require("./partials/addToReadme.js");
151
+ var _beginWatcher = require("./partials/beginWatcher.js");
152
+ var _clean = require("./partials/clean.js");
153
+ var _copyFor = require("./partials/copyFor.js");
154
+ var _distFor = require("./partials/distFor.js");
155
+ var _distForSrc = require("./partials/distForSrc.js");
156
+ var _distSeries = require("./partials/distSeries.js");
157
+ var _imagesFor = require("./partials/imagesFor.js");
158
+ var _loadPeer = require("./partials/loadPeer.js");
159
+ var _jsdocDocsFor = require("./partials/jsdocDocsFor.js");
160
+ var _loadPlaywright = require("./partials/loadPlaywright.js");
161
+ var _minifyFor = require("./partials/minifyFor.js");
162
+ var _neostandardLint = require("./partials/neostandardLint.js");
163
+ var _readmeTemplate = require("./partials/readmeTemplate.js");
164
+ var _removeDirectory = require("./partials/removeDirectory.js");
165
+ var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
166
+ var _runOnChange = require("./partials/runOnChange.js");
167
+ var _sassFor = require("./partials/sassFor.js");
168
+ var _serveStatic = require("./partials/serveStatic.js");
169
+ var _tsFor = require("./partials/tsFor.js");
150
170
  var _typeDocsFor = require("./partials/typeDocsFor.js");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"addToReadme",{enumerable:!0,get:function(){return _addToReadme.addToReadme}}),Object.defineProperty(exports,"beginWatcher",{enumerable:!0,get:function(){return _beginWatcher.beginWatcher}}),Object.defineProperty(exports,"clean",{enumerable:!0,get:function(){return _clean.clean}}),Object.defineProperty(exports,"copyFor",{enumerable:!0,get:function(){return _copyFor.copyFor}}),Object.defineProperty(exports,"distFor",{enumerable:!0,get:function(){return _distFor.distFor}}),Object.defineProperty(exports,"distForSrc",{enumerable:!0,get:function(){return _distForSrc.distForSrc}}),Object.defineProperty(exports,"distSeries",{enumerable:!0,get:function(){return _distSeries.distSeries}}),Object.defineProperty(exports,"imagesFor",{enumerable:!0,get:function(){return _imagesFor.imagesFor}}),Object.defineProperty(exports,"importModule",{enumerable:!0,get:function(){return _loadPeer.importModule}}),Object.defineProperty(exports,"importPeer",{enumerable:!0,get:function(){return _loadPeer.importPeer}}),Object.defineProperty(exports,"jsdocDocsFor",{enumerable:!0,get:function(){return _jsdocDocsFor.jsdocDocsFor}}),Object.defineProperty(exports,"minifyFor",{enumerable:!0,get:function(){return _minifyFor.minifyFor}}),Object.defineProperty(exports,"neostandardLint",{enumerable:!0,get:function(){return _neostandardLint.neostandardLint}}),Object.defineProperty(exports,"readmeTemplate",{enumerable:!0,get:function(){return _readmeTemplate.readmeTemplate}}),Object.defineProperty(exports,"removeDirectory",{enumerable:!0,get:function(){return _removeDirectory.removeDirectory}}),Object.defineProperty(exports,"requirePeer",{enumerable:!0,get:function(){return _loadPeer.requirePeer}}),Object.defineProperty(exports,"resolveDocsMethod",{enumerable:!0,get:function(){return _resolveDocsMethod.resolveDocsMethod}}),Object.defineProperty(exports,"runOnChange",{enumerable:!0,get:function(){return _runOnChange.runOnChange}}),Object.defineProperty(exports,"sassFor",{enumerable:!0,get:function(){return _sassFor.sassFor}}),Object.defineProperty(exports,"tsFor",{enumerable:!0,get:function(){return _tsFor.tsFor}}),Object.defineProperty(exports,"typeDocsFor",{enumerable:!0,get:function(){return _typeDocsFor.typeDocsFor}});var _addToReadme=require("./partials/addToReadme.js"),_beginWatcher=require("./partials/beginWatcher.js"),_clean=require("./partials/clean.js"),_copyFor=require("./partials/copyFor.js"),_distFor=require("./partials/distFor.js"),_distForSrc=require("./partials/distForSrc.js"),_distSeries=require("./partials/distSeries.js"),_imagesFor=require("./partials/imagesFor.js"),_loadPeer=require("./partials/loadPeer.js"),_jsdocDocsFor=require("./partials/jsdocDocsFor.js"),_minifyFor=require("./partials/minifyFor.js"),_neostandardLint=require("./partials/neostandardLint.js"),_readmeTemplate=require("./partials/readmeTemplate.js"),_removeDirectory=require("./partials/removeDirectory.js"),_resolveDocsMethod=require("./partials/resolveDocsMethod.js"),_runOnChange=require("./partials/runOnChange.js"),_sassFor=require("./partials/sassFor.js"),_tsFor=require("./partials/tsFor.js"),_typeDocsFor=require("./partials/typeDocsFor.js");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"addToReadme",{enumerable:!0,get:function(){return _addToReadme.addToReadme}}),Object.defineProperty(exports,"beginWatcher",{enumerable:!0,get:function(){return _beginWatcher.beginWatcher}}),Object.defineProperty(exports,"clean",{enumerable:!0,get:function(){return _clean.clean}}),Object.defineProperty(exports,"copyFor",{enumerable:!0,get:function(){return _copyFor.copyFor}}),Object.defineProperty(exports,"distFor",{enumerable:!0,get:function(){return _distFor.distFor}}),Object.defineProperty(exports,"distForSrc",{enumerable:!0,get:function(){return _distForSrc.distForSrc}}),Object.defineProperty(exports,"distSeries",{enumerable:!0,get:function(){return _distSeries.distSeries}}),Object.defineProperty(exports,"imagesFor",{enumerable:!0,get:function(){return _imagesFor.imagesFor}}),Object.defineProperty(exports,"importModule",{enumerable:!0,get:function(){return _loadPeer.importModule}}),Object.defineProperty(exports,"importPeer",{enumerable:!0,get:function(){return _loadPeer.importPeer}}),Object.defineProperty(exports,"jsdocDocsFor",{enumerable:!0,get:function(){return _jsdocDocsFor.jsdocDocsFor}}),Object.defineProperty(exports,"launchBrowser",{enumerable:!0,get:function(){return _loadPlaywright.launchBrowser}}),Object.defineProperty(exports,"loadPlaywright",{enumerable:!0,get:function(){return _loadPlaywright.loadPlaywright}}),Object.defineProperty(exports,"minifyFor",{enumerable:!0,get:function(){return _minifyFor.minifyFor}}),Object.defineProperty(exports,"neostandardLint",{enumerable:!0,get:function(){return _neostandardLint.neostandardLint}}),Object.defineProperty(exports,"readmeTemplate",{enumerable:!0,get:function(){return _readmeTemplate.readmeTemplate}}),Object.defineProperty(exports,"removeDirectory",{enumerable:!0,get:function(){return _removeDirectory.removeDirectory}}),Object.defineProperty(exports,"requirePeer",{enumerable:!0,get:function(){return _loadPeer.requirePeer}}),Object.defineProperty(exports,"resolveDocsMethod",{enumerable:!0,get:function(){return _resolveDocsMethod.resolveDocsMethod}}),Object.defineProperty(exports,"runOnChange",{enumerable:!0,get:function(){return _runOnChange.runOnChange}}),Object.defineProperty(exports,"sassFor",{enumerable:!0,get:function(){return _sassFor.sassFor}}),Object.defineProperty(exports,"serveStatic",{enumerable:!0,get:function(){return _serveStatic.serveStatic}}),Object.defineProperty(exports,"tsFor",{enumerable:!0,get:function(){return _tsFor.tsFor}}),Object.defineProperty(exports,"typeDocsFor",{enumerable:!0,get:function(){return _typeDocsFor.typeDocsFor}});var _addToReadme=require("./partials/addToReadme.js"),_beginWatcher=require("./partials/beginWatcher.js"),_clean=require("./partials/clean.js"),_copyFor=require("./partials/copyFor.js"),_distFor=require("./partials/distFor.js"),_distForSrc=require("./partials/distForSrc.js"),_distSeries=require("./partials/distSeries.js"),_imagesFor=require("./partials/imagesFor.js"),_loadPeer=require("./partials/loadPeer.js"),_jsdocDocsFor=require("./partials/jsdocDocsFor.js"),_loadPlaywright=require("./partials/loadPlaywright.js"),_minifyFor=require("./partials/minifyFor.js"),_neostandardLint=require("./partials/neostandardLint.js"),_readmeTemplate=require("./partials/readmeTemplate.js"),_removeDirectory=require("./partials/removeDirectory.js"),_resolveDocsMethod=require("./partials/resolveDocsMethod.js"),_runOnChange=require("./partials/runOnChange.js"),_sassFor=require("./partials/sassFor.js"),_serveStatic=require("./partials/serveStatic.js"),_tsFor=require("./partials/tsFor.js"),_typeDocsFor=require("./partials/typeDocsFor.js");
@@ -76,6 +76,12 @@ const setDefaults = (testDir = 'test-temp') => {
76
76
  gulpConfig.set('dist.from', `${srcPath}/**/!(*.test).js`);
77
77
  gulpConfig.set('dist.main', `${distPath}/main`);
78
78
  gulpConfig.set('dist.to', distPath);
79
+ // Reset explicitly, for the same reason as readme.fromEsm below: this project's own build-tools.config.json turns
80
+ // docs on and points them at the website checkout, which would leak into every test that never sets these itself.
81
+ gulpConfig.set('docs.enabled', false);
82
+ gulpConfig.set('docs.from', srcPath);
83
+ gulpConfig.set('docs.to', `${tempDir}docs`);
84
+ gulpConfig.set('docs.title', '');
79
85
  gulpConfig.set('fonts.from', `${srcPath}/fonts/**/*`);
80
86
  gulpConfig.set('fonts.to', `${browserPath}/fonts`);
81
87
  gulpConfig.set('images.from', `${srcPath}/img/**/*.+(png|jpg|jpeg|gif|svg)`);
@@ -22,6 +22,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
22
22
  * @param {Array<string>} mjsFilePaths - Real `.mjs` files to convert. An empty array is a safe, cheap no-op.
23
23
  * @returns {{filePaths: Array<string>, cleanUp: function(): void}} The temp `.js` file paths to pass to
24
24
  * jsdoc-to-markdown instead of the real `.mjs` ones, and a function to remove the temp directory afterward.
25
+ * @private
25
26
  */
26
27
  const convertMjsFilesForDocs = (mjsFilePaths = []) => {
27
28
  if (mjsFilePaths.length === 0) {
@@ -14,6 +14,7 @@ var _strBefore = require("./strBefore.js");
14
14
  * @param {string} [dotNotation=''] - The path to the property
15
15
  * @param {string|null} [defaultValue=null] - The default value to return if the property is not found
16
16
  * @returns {*} The value of the property
17
+ * @private
17
18
  */
18
19
  const dotGet = (arrayObject = {}, dotNotation = '', defaultValue = null) => {
19
20
  if (!dotNotation) {
@@ -11,12 +11,14 @@ var _isObject = require("./isObject.js");
11
11
  * Convert an array of keys into a regex, return a function to test if incoming keys match.
12
12
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
13
13
  * @returns {Function} The dot-notated array
14
+ * @private
14
15
  */
15
16
  const handleRetainObjects = (retainObjects = []) => {
16
17
  if (!retainObjects.length) {
17
18
  /**
18
19
  * Bypass the test function if there are no retainObjects.
19
20
  * @returns {false}
21
+ * @private
20
22
  */
21
23
  return (currentKey, value, results) => false;
22
24
  }
@@ -28,6 +30,7 @@ const handleRetainObjects = (retainObjects = []) => {
28
30
  * @param {*} value - The value of the key
29
31
  * @param {Object} results - The result object to add to
30
32
  * @returns {boolean}
33
+ * @private
31
34
  */
32
35
  return (currentKey, value, results) => {
33
36
  if (!currentKey.match(retainRegex)) {
@@ -45,6 +48,7 @@ const handleRetainObjects = (retainObjects = []) => {
45
48
  * @param {string} [prepend=''] - The path for the property being processed
46
49
  * @param {Object<string, *>} [results={}] - The final notated object to return
47
50
  * @returns {Object<string, *>} The dot-notated object
51
+ * @private
48
52
  */
49
53
  const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
50
54
  for (let key in arrayObject) {
@@ -70,6 +74,7 @@ const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) =>
70
74
  * @param {Object} arrayObject - The array or object to dot-notate
71
75
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
72
76
  * @returns {Object<string, *>} The dot-notated object
77
+ * @private
73
78
  */
74
79
  const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects));
75
80
  exports.dotNotate = dotNotate;
@@ -14,6 +14,7 @@ var _strBefore = require("./strBefore.js");
14
14
  * @param {string} dotNotation - The path for the property
15
15
  * @param {*} value - The default value to return if the property is not found
16
16
  * @returns {Object} The modified object
17
+ * @private
17
18
  */
18
19
  const dotSet = (arrayObject, dotNotation, value = null) => {
19
20
  let key = (0, _strBefore.strBefore)(dotNotation, '.');
@@ -18,6 +18,7 @@ exports.esmNamedExportsToCjs = void 0;
18
18
  * @memberOf module:utilities
19
19
  * @param {string} source - The raw ESM source text (never executed, just rewritten as text).
20
20
  * @returns {string} The rewritten text, safe to write out with a `.js` extension for jsdoc-to-markdown to read.
21
+ * @private
21
22
  */
22
23
  const esmNamedExportsToCjs = source => {
23
24
  const exportedNames = [];
@@ -18,6 +18,7 @@ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e;
18
18
  * specify what's actually different about it.
19
19
  * @memberOf module:utilities
20
20
  * @returns {Array<{name: string, main: string, ignore: Array, exclude: Array}>}
21
+ * @private
21
22
  */
22
23
  const getBundleConfigs = () => {
23
24
  const primary = {
@@ -9,6 +9,7 @@ exports.isObject = void 0;
9
9
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/isObject.ts Sí, funciona}
10
10
  * @param {*} object
11
11
  * @returns {boolean}
12
+ * @private
12
13
  */
13
14
  const isObject = object => typeof object === 'object' && object !== null;
14
15
  exports.isObject = isObject;
@@ -10,6 +10,7 @@ exports.strAfter = void 0;
10
10
  * @param {string} str
11
11
  * @param {string} search
12
12
  * @returns {string}
13
+ * @private
13
14
  */
14
15
  const strAfter = (str, search) => {
15
16
  const index = str.indexOf(search);
@@ -10,6 +10,7 @@ exports.strBefore = void 0;
10
10
  * @param {string} str
11
11
  * @param {string} search
12
12
  * @returns {string}
13
+ * @private
13
14
  */
14
15
  const strBefore = (str, search) => {
15
16
  const index = str.indexOf(search);
@@ -14,7 +14,7 @@ import { getBundleConfigs } from './utilities/getBundleConfigs.mjs'
14
14
  *
15
15
  * A bundle's name does double duty: it names the output file (name.js) and, via browserify's
16
16
  * `standalone` option, is also the name its exports are exposed under - as a global when loaded
17
- * with a bare <script> tag, or as the module when required via CommonJS/AMD. Without this, a
17
+ * with a bare `<script>` tag, or as the module when required via CommonJS/AMD. Without this, a
18
18
  * bundle built from a real entry point (one that actually exports something) builds successfully
19
19
  * but exposes nothing a consumer can reach.
20
20
  *
@@ -0,0 +1,24 @@
1
+ import path from 'node:path'
2
+ import jsdocBase from '../jsdoc.base.js'
3
+ import { handlers } from '../jsdoc.esmExports.js'
4
+
5
+ describe('jsdoc.esmExports', () => {
6
+ test('is one of the plugins in jsdoc.base', () => {
7
+ expect(jsdocBase.plugins).toContain(path.resolve('jsdoc.esmExports.js'))
8
+ })
9
+
10
+ test('drops the exports. jsdoc gives a documented export of a file without its own @module tag', () => {
11
+ const doclet = { name: 'exports.build', longname: 'module:js-build-tools.exports.build' }
12
+ handlers.newDoclet({ doclet })
13
+ expect(doclet).toEqual({ name: 'build', longname: 'module:js-build-tools.build' })
14
+ })
15
+
16
+ test('leaves every other name as it is', () => {
17
+ const doclet = { name: 'build', longname: 'module:js-build-tools.build' }
18
+ handlers.newDoclet({ doclet })
19
+ expect(doclet).toEqual({ name: 'build', longname: 'module:js-build-tools.build' })
20
+ const exportsless = { name: 'exportsThing', longname: 'exportsThing' }
21
+ handlers.newDoclet({ doclet: exportsless })
22
+ expect(exportsless).toEqual({ name: 'exportsThing', longname: 'exportsThing' })
23
+ })
24
+ })
@@ -6,14 +6,16 @@ import { execFile } from 'node:child_process'
6
6
  import { promisify } from 'node:util'
7
7
  import * as gulpConfig from '../../gulp.config.mjs'
8
8
  import { removeDirectory } from './removeDirectory.mjs'
9
- // jsdoc.base.js is CommonJS (it's also required directly by consuming projects' own .jsdoc.conf.js, and by this
10
- // project's own legacy htmldocs script) - Node's ESM loader imports a CJS module's module.exports as the default
11
- // export directly, no createRequire/import.meta needed (import.meta.url tripped up this project's own Babel CJS
12
- // transform, which Jest relies on to run .mjs test files - confirmed by removing it and nothing else changing).
9
+ // jsdoc.base.js is CommonJS (it's also required directly by consuming projects' own .jsdoc.conf.js) - Node's ESM
10
+ // loader imports a CJS module's module.exports as the default export directly, no createRequire/import.meta needed
11
+ // (import.meta.url tripped up this project's own Babel CJS transform, which Jest relies on to run .mjs test files -
12
+ // confirmed by removing it and nothing else changing).
13
13
  import jsdocBase from '../../jsdoc.base.js'
14
14
 
15
15
  const execFileAsync = promisify(execFile)
16
16
 
17
+ const escapeHtml = text => String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
18
+
17
19
  const jsdocInstallHint = 'Install it in your project with: npm install --save-dev jsdoc'
18
20
  const themeInstallHint = name => `Install it in your project with: npm install --save-dev ${name}`
19
21
 
@@ -60,11 +62,9 @@ export const resolveJsdocBin = (projectPath = process.cwd()) =>
60
62
  path.join(resolvePeerDir('jsdoc', { task: 'docs', installHint: jsdocInstallHint, projectPath }), 'jsdoc.js')
61
63
 
62
64
  /**
63
- * Resolve a jsdoc theme package's own template directory, for jsdoc's own opts.template config key. Not
64
- * necessarily the package's own root - clean-jsdoc-theme's own docs say to point opts.template at its `dist`
65
- * subdirectory specifically, confirmed by reading its real README rather than assuming every theme follows the
66
- * classic jsdoc template layout (a bare package root with its own tmpl/static folders) - clean-jsdoc-theme does
67
- * not (it is a modern, self-contained, server-rendered theme with no such folders at its package root at all).
65
+ * Resolve a jsdoc theme package's own template directory, for jsdoc's own opts.template config key: the folder
66
+ * holding its publish.js. That is the package root for a classic jsdoc template (clean-jsdoc-theme 4.x included),
67
+ * but `dist` for a bundled one (clean-jsdoc-theme 5.x).
68
68
  * @memberOf module:partials
69
69
  * @param {string} name
70
70
  * @param {string} [projectPath=process.cwd()]
@@ -72,7 +72,8 @@ export const resolveJsdocBin = (projectPath = process.cwd()) =>
72
72
  */
73
73
  export const resolveJsdocTheme = (name, projectPath = process.cwd()) => {
74
74
  const packageDir = resolvePeerDir(name, { task: 'docs', installHint: themeInstallHint(name), projectPath })
75
- return name === 'clean-jsdoc-theme' ? path.join(packageDir, 'dist') : packageDir
75
+ const distDir = path.join(packageDir, 'dist')
76
+ return fs.existsSync(path.join(distDir, 'publish.js')) ? distDir : packageDir
76
77
  }
77
78
 
78
79
  /**
@@ -82,7 +83,8 @@ export const resolveJsdocTheme = (name, projectPath = process.cwd()) => {
82
83
  * options generated here instead of hand-maintained per project. Configure this with 'docs.from', 'docs.to',
83
84
  * 'docs.index', 'docs.theme' and 'docs.title'.
84
85
  * @memberOf module:partials
85
- * @param {string} [srcPath=gulpConfig.get('docs.from')] - The directory (or glob) holding the JS source.
86
+ * @param {string|Array<string>} [srcPath=gulpConfig.get('docs.from')] - The directory (or directories and files) holding
87
+ * the JS source.
86
88
  * @param {string} [outPath=gulpConfig.get('docs.to')] - The directory the documentation is generated into (cleared first).
87
89
  * @param {function(string, Array<string>): Promise<Object>} [runJsdoc] - Runs the jsdoc CLI, tests can inject a stand-in.
88
90
  * @returns {Function} A gulp task, it accepts an optional callback and returns a promise.
@@ -100,12 +102,13 @@ export const jsdocDocsFor = (
100
102
  const theme = gulpConfig.get('docs.theme') || 'clean-jsdoc-theme'
101
103
  const themeDir = resolveJsdocTheme(theme)
102
104
  const indexFile = gulpConfig.get('docs.index')
105
+ const title = gulpConfig.get('docs.title')
103
106
  await removeDirectory(outPath)
104
107
  const config = {
105
108
  ...jsdocBase,
106
109
  source: {
107
110
  ...jsdocBase.source,
108
- include: [path.resolve(srcPath)]
111
+ include: [].concat(srcPath).map(includePath => path.resolve(includePath))
109
112
  },
110
113
  opts: {
111
114
  destination: path.resolve(outPath),
@@ -114,6 +117,17 @@ export const jsdocDocsFor = (
114
117
  // quick-start example, which sets this explicitly, not assumed from jsdoc's own classic defaults.
115
118
  recurse: true,
116
119
  template: themeDir,
120
+ // clean-jsdoc-theme's own options for the name in its header and the home page's <title> (otherwise "Home").
121
+ // The header is given as a link: a plain-text title links to the site root ("/"), while every page is in one
122
+ // folder, so index.html is the home page wherever they are served. Both are printed unescaped by the theme.
123
+ ...(title
124
+ ? {
125
+ theme_opts: {
126
+ title: `<a href="index.html" class="sidebar-title sidebar-title-anchor">${escapeHtml(title)}</a>`,
127
+ homepageTitle: escapeHtml(title)
128
+ }
129
+ }
130
+ : {}),
117
131
  ...(indexFile && fs.existsSync(indexFile) ? { readme: path.resolve(indexFile) } : {})
118
132
  }
119
133
  }
@@ -122,7 +136,13 @@ export const jsdocDocsFor = (
122
136
  const configPath = path.join(workDir, 'jsdoc.conf.json')
123
137
  fs.writeFileSync(configPath, JSON.stringify(config))
124
138
  const bin = resolveJsdocBin()
125
- await runJsdoc(bin, ['-c', configPath])
139
+ // Pass on what jsdoc and the theme report (warnings such as a page which failed to render), which would
140
+ // otherwise be lost with the captured output
141
+ const { stdout = '', stderr = '' } = (await runJsdoc(bin, ['-c', configPath])) || {}
142
+ const report = `${stdout}${stderr}`.trim()
143
+ if (report) {
144
+ console.warn(report)
145
+ }
126
146
  } finally {
127
147
  await removeDirectory(workDir)
128
148
  }