@@ -5,17 +5,17 @@ var fs$1 = require('fs');
5
5
var os = require ( 'os' ) ;
6
6
var crypto = require ( 'crypto' ) ;
7
7
var node_url = require ( 'node:url' ) ;
8
- var node_path = require ( 'node:path' ) ;
8
+ var path$2 = require ( 'node:path' ) ;
9
9
var actualFS = require ( 'node:fs' ) ;
10
10
var promises = require ( 'node:fs/promises' ) ;
11
11
var node_events = require ( 'node:events' ) ;
12
12
var Stream = require ( 'node:stream' ) ;
13
13
var node_string_decoder = require ( 'node:string_decoder' ) ;
14
+ var os$1 = require ( 'node:os' ) ;
14
15
var assert = require ( 'assert' ) ;
15
16
var url = require ( 'url' ) ;
16
17
var cp = require ( 'child_process' ) ;
17
18
var util = require ( 'node:util' ) ;
18
- var os$1 = require ( 'node:os' ) ;
19
19
20
20
var _documentCurrentScript = typeof document !== 'undefined' ? document . currentScript : null ;
21
21
function _interopNamespaceDefault ( e ) {
@@ -5992,7 +5992,7 @@ class PathWin32 extends PathBase {
5992
5992
* @internal
5993
5993
*/
5994
5994
getRootString ( path ) {
5995
- return node_path . win32 . parse ( path ) . root ;
5995
+ return path$2 . win32 . parse ( path ) . root ;
5996
5996
}
5997
5997
/**
5998
5998
* @internal
@@ -6700,7 +6700,7 @@ class PathScurryWin32 extends PathScurryBase {
6700
6700
sep = '\\' ;
6701
6701
constructor ( cwd = process . cwd ( ) , opts = { } ) {
6702
6702
const { nocase = true } = opts ;
6703
- super ( cwd , node_path . win32 , '\\' , { ...opts , nocase } ) ;
6703
+ super ( cwd , path$2 . win32 , '\\' , { ...opts , nocase } ) ;
6704
6704
this . nocase = nocase ;
6705
6705
for ( let p = this . cwd ; p ; p = p . parent ) {
6706
6706
p . nocase = this . nocase ;
@@ -6713,7 +6713,7 @@ class PathScurryWin32 extends PathScurryBase {
6713
6713
// if the path starts with a single separator, it's not a UNC, and we'll
6714
6714
// just get separator as the root, and driveFromUNC will return \
6715
6715
// 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 ( ) ;
6717
6717
}
6718
6718
/**
6719
6719
* @internal
@@ -6742,7 +6742,7 @@ class PathScurryPosix extends PathScurryBase {
6742
6742
sep = '/' ;
6743
6743
constructor ( cwd = process . cwd ( ) , opts = { } ) {
6744
6744
const { nocase = false } = opts ;
6745
- super ( cwd , node_path . posix , '/' , { ...opts , nocase } ) ;
6745
+ super ( cwd , path$2 . posix , '/' , { ...opts , nocase } ) ;
6746
6746
this . nocase = nocase ;
6747
6747
}
6748
6748
/**
@@ -8135,15 +8135,18 @@ class FileSet {
8135
8135
if ( stat . isFile ( ) && ! this . files . includes ( file ) ) {
8136
8136
this . files . push ( file ) ;
8137
8137
} 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 } ` ) ;
8139
8139
}
8140
8140
} catch ( err ) {
8141
8141
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 } ) ;
8144
8147
if ( found . length ) {
8145
8148
for ( const match of found ) {
8146
- if ( match . endsWith ( '/' ) ) {
8149
+ if ( match . endsWith ( path$2 . sep ) ) {
8147
8150
if ( ! this . dirs . includes ( match ) ) this . dirs . push ( match ) ;
8148
8151
} else {
8149
8152
if ( ! this . files . includes ( match ) ) this . files . push ( match ) ;
@@ -8262,6 +8265,9 @@ class JsdocCommand {
8262
8265
async execute ( ) {
8263
8266
this . inputFileSet = new FileSet ( ) ;
8264
8267
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 ) ;
8265
8271
8266
8272
if ( this . options . source . length ) {
8267
8273
this . tempFiles = this . options . source . map ( source => new TempFile ( source ) ) ;
@@ -8351,7 +8357,6 @@ class Explain extends JsdocCommand {
8351
8357
}
8352
8358
8353
8359
async _runJsdoc ( ) {
8354
- // console.log('SKDJKLAHS', this.options, this.tempFileSet?.files, this.inputFileSet.files)
8355
8360
const cmd = this . options . source . length
8356
8361
? `node ${ this . jsdocPath } ${ toSpawnArgs$1 ( this . jsdocOptions ) . join ( ' ' ) } -X ${ this . tempFileSet . files . join ( ' ' ) } `
8357
8362
: `node ${ this . jsdocPath } ${ toSpawnArgs$1 ( this . jsdocOptions ) . join ( ' ' ) } -X ${ this . inputFileSet . files . join ( ' ' ) } ` ;
@@ -8453,8 +8458,7 @@ const jsdoc = {
8453
8458
* @typicalname options
8454
8459
*/
8455
8460
class JsdocOptions {
8456
- constructor ( options ) {
8457
- options = options || { } ;
8461
+ constructor ( options = { } ) {
8458
8462
8459
8463
/**
8460
8464
* One or more filenames to process. Either `files`, `source` or `configure` must be supplied.
@@ -8535,6 +8539,12 @@ class JsdocOptions {
8535
8539
*/
8536
8540
this . readme = options . readme ;
8537
8541
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
+
8538
8548
/**
8539
8549
* The path to the template to use. Default: path/to/jsdoc/templates/default.
8540
8550
* @type {string }
0 commit comments