New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

metalsmith

Package Overview
Dependencies
Maintainers
5
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith - npm Package Compare versions

Comparing version 2.6.2 to 2.6.3

38

CHANGELOG.md

@@ -9,4 +9,22 @@ # Change Log

## [2.6.3] - 2024-03-05
### Removed
- Drops support for Node < 14.18.0 (4 minor versions) to be able to use 'node:' protocol imports" [`b170cf0`](https://github.com/metalsmith/metalsmith/commit/b170cf0)
### Updated
- Updated README.md code samples, links, and troubleshooting section
- **Dependencies:** [`774a164`](https://github.com/metalsmith/metalsmith/commit/774a164)
- `chokidar`: 3.5.3 ▶︎ 3.6.0
### Fixed
- Fixes ms.watch(false) unreliable behavior when the build errors. [`0d8d791`](https://github.com/metalsmith/metalsmith/commit/0d8d791)
## [2.6.2] - 2023-11-15
### Fixed
- TS fixes: add generic to Metalsmith.File, bring back Metalsmith.DoneCallback, add Metalsmith.Plugin promise signature [`3ae6275`](https://github.com/metalsmith/metalsmith/commit/3ae6275)

@@ -20,8 +38,18 @@ - [#394] Avoid leaking unhandled rejections in build/watch promises. [`cac48fc`](https://github.com/metalsmith/metalsmith/commit/cac48fc), [`5b48dce`](https://github.com/metalsmith/metalsmith/commit/5b48dce)

- [`34239d9`](https://github.com/metalsmith/metalsmith/commit/34239d9) Documents metalsmith.watch() getter signature in TS
- [`a719025`](https://github.com/metalsmith/metalsmith/commit/a719025) Normalizes ms.watch().paths to an array, allows access to a subset of chokidar options as advertised
- [`5a516b2`](https://github.com/metalsmith/metalsmith/commit/5a516b2) Sets chokidar watchOption awaitWriteFinish to false, and batch timer to 0 to speed up watching
- [`23b0944`](https://github.com/metalsmith/metalsmith/commit/23b0944) Fixes #389: ensure not missing watcher ready event to successfully launch build
- [`05265ce`](https://github.com/metalsmith/metalsmith/commit/05265ce) Fixes formatting issue in types JSdoc comments
### Added
- Documents metalsmith.watch() getter signature in TS [`34239d9`](https://github.com/metalsmith/metalsmith/commit/34239d9)
### Updated
- Normalizes ms.watch().paths to an array, allows access to a subset of chokidar options as advertised [`a719025`](https://github.com/metalsmith/metalsmith/commit/a719025)
- Sets chokidar watchOption awaitWriteFinish to false, and batch timer to 0 to speed up watching [`5a516b2`](https://github.com/metalsmith/metalsmith/commit/5a516b2)
### Fixed
- Fixes [#389]: ensure not missing watcher ready event to successfully launch build [`23b0944`](https://github.com/metalsmith/metalsmith/commit/23b0944)
- Fixes formatting issue in types JSdoc comments [`05265ce`](https://github.com/metalsmith/metalsmith/commit/05265ce)
[#389]: https://github.com/metalsmith/metalsmith/issues/389
## [2.6.0] - 2023-05-30

@@ -28,0 +56,0 @@

15

lib/index.js

@@ -555,7 +555,14 @@ 'use strict'

if (this.watch()) {
let msWatcher
return result.then((files) => {
const msWatcher = watcher(files, this)
msWatcher(this[symbol.watch], callback).then((close) => {
this[symbol.closeWatcher] = close
}, callback)
msWatcher = watcher(files, this)
msWatcher(this[symbol.watch], callback).then(
() => {
this[symbol.closeWatcher] = msWatcher.close
},
(err) => {
this[symbol.closeWatcher] = msWatcher.close
return callback(err)
}
)
})

@@ -562,0 +569,0 @@ } else {

@@ -76,3 +76,3 @@ /* c8 ignore start */

return function watcher({ paths, ...options }, onRebuild) {
function watcherFn({ paths, ...options }, onRebuild) {
const watcher = chokidar.watch(paths || metalsmith.source(), options)

@@ -83,2 +83,7 @@

const watcherReady = new Promise((resolve) => watcher.on('ready', () => resolve()))
watcherReady.then(() => {
watcherFn.close = function () {
return watcher.unwatch(paths).close()
}
})

@@ -151,8 +156,12 @@ const eventqueue = []

})
})
}, reject)
})
.catch(reject)
.catch((err) => {
watcherReady.then(() => reject(err), reject)
})
})
}
return watcherFn
}
/* c8 ignore end */
{
"name": "metalsmith",
"version": "2.6.2",
"version": "2.6.3",
"description": "An extremely simple, pluggable static site generator.",

@@ -63,3 +63,3 @@ "keywords": [

"dependencies": {
"chokidar": "^3.5.3",
"chokidar": "^3.6.0",
"commander": "^10.0.1",

@@ -77,20 +77,20 @@ "debug": "^4.3.4",

"@metalsmith/markdown": "^1.10.0",
"@types/debug": "^4.1.8",
"@types/micromatch": "^4.0.2",
"@types/debug": "^4.1.12",
"@types/micromatch": "^4.0.6",
"@types/node": "^14.14.0",
"assert-dir-equal": "^1.1.0",
"c8": "^8.0.1",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.1.0",
"mocha": "^10.2.0",
"prettier": "^3.0.3",
"release-it": "^16.1.5",
"c8": "^9.1.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"mocha": "^10.3.0",
"prettier": "^3.2.5",
"release-it": "^17.1.1",
"toml": "^3.0.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
},
"engines": {
"node": ">=14.14.0"
"node": ">=14.18.0"
}
}

@@ -9,3 +9,3 @@ # Metalsmith

> An extremely simple, _pluggable_ static site generator.
> An extremely simple, _pluggable_ static site generator for NodeJS.

@@ -58,3 +58,3 @@ In Metalsmith, all of the logic is handled by plugins. You simply chain them together.

import { fileURLToPath } from 'node:url'
import { dirname } from 'path'
import { dirname } from 'node:path'
import Metalsmith from 'metalsmith'

@@ -65,6 +65,7 @@ import collections from '@metalsmith/collections'

import permalinks from '@metalsmith/permalinks'
import drafts from '@metalsmith/drafts'
const __dirname = dirname(fileURLToPath(import.meta.url))
const t1 = performance.now()
const mode = process.env.NODE_ENV
const devMode = process.env.NODE_ENV === 'development'

@@ -75,7 +76,6 @@ Metalsmith(__dirname) // parent directory of this file

.clean(true) // clean destination before
.watch(mode === 'development') // rebuild on change in development
.env({
// pass NODE_ENV & other environment variables
DEBUG: process.env.DEBUG,
NODE_ENV: mode
NODE_ENV: process.env.NODE_ENV
})

@@ -90,20 +90,26 @@ .metadata({

})
.use(drafts(devMode)) // only include drafts when NODE_ENV === 'development'
.use(
collections({
// group all blog posts by internally
posts: 'posts/*.md' // adding key 'collections':'posts'
// group all blog posts by adding key
posts: 'posts/*.md' // collections:'posts' to metalsmith.metadata()
})
) // use `collections.posts` in layouts
.use(markdown()) // transpile all md into html
.use(
permalinks({
// change URLs to permalink URLs
relative: false // put css only in /css
markdown({
// transpile all md file contents into html
keys: ['description'], // and also file.description
globalRefs: {
// define links available to all markdown files
home: 'https://example.com'
}
})
)
.use(permalinks()) // change URLs to permalink URLs
.use(
layouts({
// wrap layouts around html
pattern: '**/*.html'
})
) // wrap layouts around html
)
.build((err) => {

@@ -126,8 +132,7 @@ // build process

```
```yml
---
title: A Catchy Title
date: 2021-12-01
date: 2024-01-01
---
An informative article.

@@ -138,11 +143,9 @@ ```

```
```js
{
'path/to/my-file.md': {
title: 'A Catchy Title',
date: <Date >,
contents: <Buffer 7a 66 7a 67...>,
stats: {
...
}
date: new Date(2024, 1, 1),
contents: Buffer.from('An informative article'),
stats: fs.Stats
}

@@ -233,3 +236,3 @@ }

- [Gitter Matrix community chat](https://app.gitter.im/#/room/#metalsmith_community:gitter.im) for chat, questions
- [Twitter announcements](https://twitter.com/@metalsmithio) and the [metalsmith.io news page](https://metalsmith.io/news) for updates
- [X (formerly Twitter) announcements](https://x.com/@metalsmithio) and the [metalsmith.io news page](https://metalsmith.io/news) for updates
- [Awesome Metalsmith](https://github.com/metalsmith/awesome-metalsmith) - great collection of resources, examples, and tutorials

@@ -242,4 +245,4 @@ - [emmer.dev on metalsmith](https://emmer.dev/blog/tag/metalsmith/) - A good collection of various how to's for metalsmith

Use [debug](https://github.com/debug-js/debug/) to debug your build with `export DEBUG=metalsmith-*,@metalsmith/*` (Linux) or `set DEBUG=metalsmith-*,@metalsmith/*` for Windows.
Use the excellent [metalsmith-debug-ui plugin](https://github.com/leviwheatcroft/metalsmith-debug-ui) to get a snapshot UI for every build step.
Set `metalsmith.env('DEBUG', '*metalsmith*')` to debug your build. This will log debug logs for all plugins using the built-in `metalsmith.debug` debugger.
For older plugins using [debug](https://github.com/debug-js/debug/) directly, run your build with `export DEBUG=metalsmith-*,@metalsmith/*` (Linux) or `set DEBUG=metalsmith-*,@metalsmith/*` for Windows.

@@ -250,3 +253,3 @@ ### Node Version Requirements

Metalsmith 2.6.x supports NodeJS versions 14.14.0 and higher.
Metalsmith 2.6.x supports NodeJS versions 14.18.0 and higher.
Metalsmith 2.5.x supports NodeJS versions 12 and higher.

@@ -253,0 +256,0 @@ Metalsmith 2.4.x supports NodeJS versions 8 and higher.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc