@@ -5,17 +5,17 @@ var fs$1 = require('fs');
55var os = require ( 'os' ) ;
66var crypto = require ( 'crypto' ) ;
77var node_url = require ( 'node:url' ) ;
8- var node_path = require ( 'node:path' ) ;
8+ var path$2 = require ( 'node:path' ) ;
99var actualFS = require ( 'node:fs' ) ;
1010var promises = require ( 'node:fs/promises' ) ;
1111var node_events = require ( 'node:events' ) ;
1212var Stream = require ( 'node:stream' ) ;
1313var node_string_decoder = require ( 'node:string_decoder' ) ;
14+ var os$1 = require ( 'node:os' ) ;
1415var assert = require ( 'assert' ) ;
1516var url = require ( 'url' ) ;
1617var cp = require ( 'child_process' ) ;
1718var util = require ( 'node:util' ) ;
18- var os$1 = require ( 'node:os' ) ;
1919
2020var _documentCurrentScript = typeof document !== 'undefined' ? document . currentScript : null ;
2121function _interopNamespaceDefault ( e ) {
@@ -5992,7 +5992,7 @@ class PathWin32 extends PathBase {
59925992 * @internal
59935993 */
59945994 getRootString ( path ) {
5995- return node_path . win32 . parse ( path ) . root ;
5995+ return path$2 . win32 . parse ( path ) . root ;
59965996 }
59975997 /**
59985998 * @internal
@@ -6700,7 +6700,7 @@ class PathScurryWin32 extends PathScurryBase {
67006700 sep = '\\' ;
67016701 constructor ( cwd = process . cwd ( ) , opts = { } ) {
67026702 const { nocase = true } = opts ;
6703- super ( cwd , node_path . win32 , '\\' , { ...opts , nocase } ) ;
6703+ super ( cwd , path$2 . win32 , '\\' , { ...opts , nocase } ) ;
67046704 this . nocase = nocase ;
67056705 for ( let p = this . cwd ; p ; p = p . parent ) {
67066706 p . nocase = this . nocase ;
@@ -6713,7 +6713,7 @@ class PathScurryWin32 extends PathScurryBase {
67136713 // if the path starts with a single separator, it's not a UNC, and we'll
67146714 // just get separator as the root, and driveFromUNC will return \
67156715 // In that case, mount \ on the root from the cwd.
6716- return node_path . win32 . parse ( dir ) . root . toUpperCase ( ) ;
6716+ return path$2 . win32 . parse ( dir ) . root . toUpperCase ( ) ;
67176717 }
67186718 /**
67196719 * @internal
@@ -6742,7 +6742,7 @@ class PathScurryPosix extends PathScurryBase {
67426742 sep = '/' ;
67436743 constructor ( cwd = process . cwd ( ) , opts = { } ) {
67446744 const { nocase = false } = opts ;
6745- super ( cwd , node_path . posix , '/' , { ...opts , nocase } ) ;
6745+ super ( cwd , path$2 . posix , '/' , { ...opts , nocase } ) ;
67466746 this . nocase = nocase ;
67476747 }
67486748 /**
@@ -8135,15 +8135,18 @@ class FileSet {
81358135 if ( stat . isFile ( ) && ! this . files . includes ( file ) ) {
81368136 this . files . push ( file ) ;
81378137 } else if ( stat . isDirectory ( ) && ! this . dirs . includes ( file ) ) {
8138- this . dirs . push ( file . endsWith ( '/' ) ? file : `${ file } / ` ) ;
8138+ this . dirs . push ( file . endsWith ( path$2 . sep ) ? file : `${ file } ${ path$2 . sep } ` ) ;
81398139 }
81408140 } catch ( err ) {
81418141 if ( err . code === 'ENOENT' ) {
8142- if ( glob . hasMagic ( file ) ) {
8143- const found = await glob ( file , { mark : true } ) ;
8142+ const posixPath = os$1 . platform ( ) === 'win32'
8143+ ? file . replaceAll ( path$2 . sep , path$2 . posix . sep )
8144+ : file ;
8145+ if ( glob . hasMagic ( posixPath ) ) {
8146+ const found = await glob ( posixPath , { mark : true } ) ;
81448147 if ( found . length ) {
81458148 for ( const match of found ) {
8146- if ( match . endsWith ( '/' ) ) {
8149+ if ( match . endsWith ( path$2 . sep ) ) {
81478150 if ( ! this . dirs . includes ( match ) ) this . dirs . push ( match ) ;
81488151 } else {
81498152 if ( ! this . files . includes ( match ) ) this . files . push ( match ) ;
@@ -8262,6 +8265,9 @@ class JsdocCommand {
82628265 async execute ( ) {
82638266 this . inputFileSet = new FileSet ( ) ;
82648267 await this . inputFileSet . add ( this . options . files ) ;
8268+ /* node-glob v9+ (used by file-set) no longer sorts the output by default. We will continue to sort the file list, for now, as it's what the user expected by default. The user's system locale is used. */
8269+ const collator = new Intl . Collator ( ) ;
8270+ this . inputFileSet . files . sort ( collator . compare ) ;
82658271
82668272 if ( this . options . source . length ) {
82678273 this . tempFiles = this . options . source . map ( source => new TempFile ( source ) ) ;
@@ -8351,7 +8357,6 @@ class Explain extends JsdocCommand {
83518357 }
83528358
83538359 async _runJsdoc ( ) {
8354- // console.log('SKDJKLAHS', this.options, this.tempFileSet?.files, this.inputFileSet.files)
83558360 const cmd = this . options . source . length
83568361 ? `node ${ this . jsdocPath } ${ toSpawnArgs$1 ( this . jsdocOptions ) . join ( ' ' ) } -X ${ this . tempFileSet . files . join ( ' ' ) } `
83578362 : `node ${ this . jsdocPath } ${ toSpawnArgs$1 ( this . jsdocOptions ) . join ( ' ' ) } -X ${ this . inputFileSet . files . join ( ' ' ) } ` ;
@@ -8453,8 +8458,7 @@ const jsdoc = {
84538458 * @typicalname options
84548459 */
84558460class JsdocOptions {
8456- constructor ( options ) {
8457- options = options || { } ;
8461+ constructor ( options = { } ) {
84588462
84598463 /**
84608464 * One or more filenames to process. Either `files`, `source` or `configure` must be supplied.
@@ -8535,6 +8539,12 @@ class JsdocOptions {
85358539 */
85368540 this . readme = options . readme ;
85378541
8542+ /* Warning to avoid a common mistake where dmd templates are passed in.. a jsdoc template must be a filename. */
8543+ if ( options . template !== undefined && options . template ?. split ( / \r ? \n / ) ?. length !== 1 ) {
8544+ console . warn ( 'Suspicious `options.template` value - the jsdoc `template` option must be a file path.' ) ;
8545+ console . warn ( options . template ) ;
8546+ }
8547+
85388548 /**
85398549 * The path to the template to use. Default: path/to/jsdoc/templates/default.
85408550 * @type {string }
0 commit comments