From ffefc50281ce19ea23d16d81d1aaf8124e8ae899 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Tue, 16 Nov 2021 22:29:22 -0500 Subject: [PATCH 1/3] Drop support for Node.js 0.8 --- .github/workflows/ci.yml | 14 -------------- HISTORY.md | 5 +++++ package.json | 3 +-- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fec4bc..50fba08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,6 @@ jobs: strategy: matrix: name: - - Node.js 0.8 - Node.js 0.10 - Node.js 4.x - Node.js 6.x @@ -21,11 +20,6 @@ jobs: - Node.js 16.x include: - - name: Node.js 0.8 - node-version: "0.8" - npm-i: mocha@2.5.3 supertest@1.1.0 - npm-rm: nyc - - name: Node.js 0.10 node-version: "0.10" npm-i: mocha@3.5.3 supertest@2.0.0 @@ -65,14 +59,6 @@ jobs: shell: bash -eo pipefail -l {0} run: | nvm install --default ${{ matrix.node-version }} - if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then - nvm install --alias=npm 0.10 - npm install -g npm@1.2.8000 - NPM=$(which npm) - nvm use ${{ matrix.node-version }} - ln -fs "$NPM" "$(which npm)" - sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")" - fi dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" - name: Configure npm diff --git a/HISTORY.md b/HISTORY.md index f3a4dfe..b47a231 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +5.x +=== + + * Drop support for Node.js 0.8 + 4.2.0 / 2021-11-16 ================== diff --git a/package.json b/package.json index 5033400..5268bc2 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,7 @@ "README.md" ], "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": ">= 0.10" }, "scripts": { "lint": "eslint .", From 5ee89a19975707985473bb3589b58cd9c72bec58 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Tue, 16 Nov 2021 22:31:10 -0500 Subject: [PATCH 2/3] Drop support for Express.js 2.x --- HISTORY.md | 1 + lib/hbs.js | 16 ---------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index b47a231..612b338 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,7 @@ 5.x === + * Drop support for Express.js 2.x * Drop support for Node.js 0.8 4.2.0 / 2021-11-16 diff --git a/lib/hbs.js b/lib/hbs.js index 21264b6..8bba0f7 100644 --- a/lib/hbs.js +++ b/lib/hbs.js @@ -207,22 +207,6 @@ function middleware(filename, options, cb) { tryReadFileAndCache(layout_filename); } -// express 2.x template engine compliance -Instance.prototype.compile = function (str) { - if (typeof str !== 'string') { - return str; - } - - var template = this.handlebars.compile(str); - return function (locals) { - return template(locals, { - helpers: locals.blockHelpers, - partials: null, - data: null - }); - }; -}; - Instance.prototype.registerHelper = function () { this.handlebars.registerHelper.apply(this.handlebars, arguments); }; From 361bdd71f3263892b1e5871f1b366028b7bafa8c Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Mon, 22 Nov 2021 14:53:52 -0500 Subject: [PATCH 3/3] Use uid-safe for async helpers tracking --- HISTORY.md | 1 + lib/async.js | 15 +++------------ package.json | 1 + 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 612b338..a43e25f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,7 @@ * Drop support for Express.js 2.x * Drop support for Node.js 0.8 + * Use `uid-safe` for async helpers tracking 4.2.0 / 2021-11-16 ================== diff --git a/lib/async.js b/lib/async.js index 617aeb4..ebea64c 100644 --- a/lib/async.js +++ b/lib/async.js @@ -1,5 +1,7 @@ /// provides the async helper functionality +var uid = require('uid-safe') + function Waiter() { if (!(this instanceof Waiter)) { return new Waiter(); @@ -51,17 +53,6 @@ Waiter.prototype.done = function(fn) { } }; -var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_'; - -var gen_id = function() { - var res = ''; - for (var i=0 ; i<8 ; ++i) { - res += alphabet[Math.floor(Math.random() * alphabet.length)]; - } - - return res; -}; - module.exports = function() { // baton which contains the current // set of deferreds @@ -86,7 +77,7 @@ module.exports = function() { waiter = new Waiter(); } - var id = '__' + gen_id() + '__'; + var id = '__' + uid.sync(10) + '__' var cur_waiter = waiter; waiter.wait(); diff --git a/package.json b/package.json index 5268bc2..2fb5f04 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "main": "lib/hbs.js", "dependencies": { "handlebars": "4.7.7", + "uid-safe": "2.1.5", "walk": "2.3.15" }, "devDependencies": {