@antora/ui-loader 3.2.0-alpha.9 → 3.2.0-rc.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.
package/lib/file.js CHANGED
@@ -50,7 +50,7 @@ class ZipReadable extends Readable {
50
50
  throw new Error('ZipReadable requires ZipFile to be initialized with lazyEntries:true option')
51
51
  }
52
52
  if ((this._startPath = options.startPath) && (this._startPath = path.join('/', this._startPath + '/')) !== '/') {
53
- this._startPath = this._startPath.slice(1)
53
+ this._startPath = this._startPath.substring(1)
54
54
  } else {
55
55
  this._startPath = undefined
56
56
  }
@@ -66,7 +66,7 @@ class ZipReadable extends Readable {
66
66
  let path_ = entry.fileName
67
67
  if (this._startPath) {
68
68
  if (path_.length < this._startPath.length || !path_.startsWith(this._startPath)) return zipFile.readEntry()
69
- path_ = path_.slice(this._startPath.length)
69
+ path_ = path_.substring(this._startPath.length)
70
70
  }
71
71
  const isLink = (mode & fsc.S_IFMT) === fsc.S_IFLNK
72
72
  const stat = {
package/lib/load-ui.js CHANGED
@@ -15,6 +15,7 @@ const { posix: path } = ospath
15
15
  const picomatch = require('picomatch')
16
16
  const posixify = ospath.sep === '\\' ? (p) => p.replace(/\\/g, '/') : undefined
17
17
  const { pipeline, PassThrough, Writable } = require('node:stream')
18
+ const drain = () => new Writable({ objectMode: true, write: (_chunk, _enc, next) => next() })
18
19
  const forEach = (write, final) => new Writable({ objectMode: true, write, final })
19
20
  const through = () => new PassThrough({ objectMode: true })
20
21
  const UiCatalog = require('./ui-catalog')
@@ -275,7 +276,7 @@ function classifyFile (file, config) {
275
276
  }
276
277
 
277
278
  function resolveType (file) {
278
- const firstPathSegment = file.path.split('/', 1)[0]
279
+ const firstPathSegment = file.path.split('/')[0]
279
280
  if (firstPathSegment === 'layouts') return 'layout'
280
281
  if (firstPathSegment === 'helpers') return 'helper'
281
282
  if (firstPathSegment === 'partials') return 'partial'
@@ -284,7 +285,7 @@ function resolveType (file) {
284
285
 
285
286
  function resolveOut (file, outputDir = '_') {
286
287
  let dirname = path.join(outputDir, file.dirname)
287
- if (dirname.charAt() === '/') dirname = dirname.substr(1)
288
+ if (dirname.charAt() === '/') dirname = dirname.substring(1)
288
289
  const basename = file.basename
289
290
  return { dirname, basename, path: path.join(dirname, basename) }
290
291
  }
@@ -329,8 +330,8 @@ function srcFs (cwd) {
329
330
  }
330
331
 
331
332
  function srcZip (file, options = {}) {
332
- const result = options.testOnly // is it necessary to close streams in this case, or just sink()?
333
- ? forEach((file_, _, done) => (file_.isStream() ? file_.contents.on('close', done).destroy() : done()))
333
+ const result = options.testOnly
334
+ ? forEach((file_, _, done) => (file_.isStream() ? pipeline(file_.contents, through(), drain(), done) : done()))
334
335
  : through()
335
336
  yauzl[file instanceof Buffer ? 'fromBuffer' : 'open'](file, { lazyEntries: true }, (err, zipFile) => {
336
337
  if (err) return result.emit('error', err)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/ui-loader",
3
- "version": "3.2.0-alpha.9",
3
+ "version": "3.2.0-rc.1",
4
4
  "description": "Downloads a UI bundle, if necessary, and loads the files into a UI catalog for use in an Antora documentation pipeline.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "OpenDevise Inc. (https://opendevise.com)",
@@ -34,15 +34,15 @@
34
34
  "cache-directory": "~2.0",
35
35
  "fast-glob": "~3.3",
36
36
  "hpagent": "~1.2",
37
- "js-yaml": "~4.1",
37
+ "js-yaml": "~4.2",
38
38
  "picomatch": "~4.0",
39
39
  "should-proxy": "~1.0",
40
40
  "simple-get": "~4.0",
41
41
  "vinyl": "~3.0",
42
- "yauzl": "~3.1"
42
+ "yauzl": "~3.4"
43
43
  },
44
44
  "engines": {
45
- "node": ">=18.0.0"
45
+ "node": ">=20.0.0"
46
46
  },
47
47
  "files": [
48
48
  "lib/"
@@ -57,7 +57,7 @@
57
57
  "web publishing"
58
58
  ],
59
59
  "scripts": {
60
- "test": "_mocha",
60
+ "test": "node --test",
61
61
  "prepublishOnly": "npx -y downdoc@latest --prepublish",
62
62
  "postpublish": "npx -y downdoc@latest --postpublish"
63
63
  }