diff --git a/.all-contributorsrc b/.all-contributorsrc
index 4d023b3452..a848776299 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -693,6 +693,15 @@
"contributions": [
"doc"
]
+ },
+ {
+ "login": "vrugtehagel",
+ "name": "Koen",
+ "avatar_url": "https://avatars.githubusercontent.com/u/41021050?v=4",
+ "profile": "https://vrugtehagel.nl",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/.eslintrc.json b/.eslintrc.json
index 66b32c6ce9..1438fa7729 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -23,6 +23,7 @@
"prefer-const": 2,
"no-unused-vars": "off",
"indent": "off",
+ "no-mixed-operators": "off",
"no-dupe-class-members": "off",
"no-useless-constructor": "off",
"@typescript-eslint/indent": ["error", 2],
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 31aec23ea7..ffaa871a2a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -12,7 +12,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
- node-version: '18'
+ node-version: '14'
- name: Install Dependencies
run: npm ci
- name: Release
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 4d9ed10b8c..8c3ef8f97b 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -5,8 +5,19 @@ jobs:
name: Test
strategy:
matrix:
- os: [ubuntu-latest, macos-latest]
+ os: [ubuntu-latest]
timezone: [Etc/GMT, Asia/Shanghai, America/New_York]
+ node-version: [22]
+ include:
+ - os: macos-latest
+ timezone: America/New_York
+ node-versoin: 22
+ - os: ubuntu-latest
+ timezone: Etc/GMT
+ node-version: 16
+ - os: ubuntu-latest
+ timezone: Asia/Shanghai
+ node-version: 14
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
@@ -16,7 +27,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
- node-version: '20'
+ node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Download artifacts
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 692d0adb0b..ff009037e7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## [10.16.2](https://github.com/harttle/liquidjs/compare/v10.16.1...v10.16.2) (2024-08-15)
+
+
+### Bug Fixes
+
+* support for NodeJS 14 ([85bd0d3](https://github.com/harttle/liquidjs/commit/85bd0d35a6d949a02db49ba546407fe5be17db5e))
+
## [10.16.1](https://github.com/harttle/liquidjs/compare/v10.16.0...v10.16.1) (2024-07-25)
diff --git a/README.md b/README.md
index e872b95513..fe94dded27 100644
--- a/README.md
+++ b/README.md
@@ -203,6 +203,7 @@ Want to contribute? see [Contribution Guidelines][contribution]. Thanks goes to
Adam Tanner 💻 |
Guillermo Casal Caro 💻 |
Josh Soref 📖 |
+ Koen 💻 |
diff --git a/package-lock.json b/package-lock.json
index cf8ccf176b..79c4906cff 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "liquidjs",
- "version": "10.16.1",
+ "version": "10.16.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1648,10 +1648,13 @@
"dev": true
},
"@types/node": {
- "version": "18.15.3",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz",
- "integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==",
- "dev": true
+ "version": "22.3.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz",
+ "integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==",
+ "dev": true,
+ "requires": {
+ "undici-types": "~6.18.2"
+ }
},
"@types/normalize-package-data": {
"version": "2.4.1",
@@ -10277,6 +10280,12 @@
"which-boxed-primitive": "^1.0.2"
}
},
+ "undici-types": {
+ "version": "6.18.2",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz",
+ "integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==",
+ "dev": true
+ },
"unique-string": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz",
diff --git a/package.json b/package.json
index 48d9ea6c5e..b58bc72d3c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "liquidjs",
- "version": "10.16.1",
+ "version": "10.16.2",
"description": "A simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.",
"main": "dist/liquid.node.cjs.js",
"module": "dist/liquid.node.esm.js",
@@ -70,6 +70,7 @@
"@semantic-release/release-notes-generator": "^10.0.3",
"@types/benchmark": "^1.0.31",
"@types/express": "^4.17.2",
+ "@types/node": "^22.3.0",
"@types/jest": "^29.4.0",
"@types/jsdom": "^12.2.2",
"@types/sinon": "^10.0.13",
diff --git a/rollup.config.mjs b/rollup.config.mjs
index 87b6edbce1..7c32fa4951 100644
--- a/rollup.config.mjs
+++ b/rollup.config.mjs
@@ -50,6 +50,10 @@ const browserStream = {
delimiters: ['', ''],
'./streamed-emitter': '../build/streamed-emitter-browser'
}
+const browserPerf = {
+ include: ['./src/context/context.ts', './src/render/render.ts'],
+ 'node:perf_hooks': '../build/perf_hooks-browser'
+}
const esmRequire = {
include: './src/fs/node.ts',
delimiters: ['', ''],
@@ -95,6 +99,7 @@ const browserEsm = {
versionInjection,
replace(browserFS),
replace(browserStream),
+ replace(browserPerf),
typescript(tsconfig('es6'))
],
treeshake,
@@ -113,6 +118,7 @@ const browserUmd = {
versionInjection,
replace(browserFS),
replace(browserStream),
+ replace(browserPerf),
typescript(tsconfig('es5'))
],
treeshake,
@@ -131,6 +137,7 @@ const browserMin = {
versionInjection,
replace(browserFS),
replace(browserStream),
+ replace(browserPerf),
typescript(tsconfig('es5')),
uglify()
],
diff --git a/src/build/perf_hooks-browser.ts b/src/build/perf_hooks-browser.ts
new file mode 100644
index 0000000000..d68935436d
--- /dev/null
+++ b/src/build/perf_hooks-browser.ts
@@ -0,0 +1,5 @@
+const polyfill = {
+ now: () => Date.now()
+}
+
+export const performance = typeof window === 'object' && window.performance || polyfill
diff --git a/src/context/context.ts b/src/context/context.ts
index 50bb168475..f12bcfff2e 100644
--- a/src/context/context.ts
+++ b/src/context/context.ts
@@ -1,3 +1,4 @@
+import { performance } from 'node:perf_hooks'
import { Drop } from '../drop/drop'
import { __assign } from 'tslib'
import { NormalizedFullOptions, defaultOptions, RenderOptions } from '../liquid-options'
diff --git a/src/parser/parser.spec.ts b/src/parser/parser.spec.ts
new file mode 100644
index 0000000000..ca436338fa
--- /dev/null
+++ b/src/parser/parser.spec.ts
@@ -0,0 +1,19 @@
+import { Parser } from './parser'
+import { Liquid, TokenKind } from '..'
+
+describe('Parser', () => {
+ it('should coerce input to string', () => {
+ const parser = new Parser(new Liquid())
+ const templates = parser.parse({} as any)
+ expect(templates.length).toEqual(1)
+ expect(templates[0]).toMatchObject({
+ str: '[object Object]',
+ token: {
+ kind: TokenKind.HTML,
+ input: '[object Object]',
+ begin: 0,
+ end: 15
+ }
+ })
+ })
+})
diff --git a/src/render/render.ts b/src/render/render.ts
index 2705815781..cb4f17db32 100644
--- a/src/render/render.ts
+++ b/src/render/render.ts
@@ -1,3 +1,4 @@
+import { performance } from 'node:perf_hooks'
import { toPromise, RenderError, LiquidErrors, LiquidError } from '../util'
import { Context } from '../context'
import { Template } from '../template'
diff --git a/test/e2e/drop.spec.ts b/test/e2e/drop.spec.ts
index c1950ba603..d60b425a54 100644
--- a/test/e2e/drop.spec.ts
+++ b/test/e2e/drop.spec.ts
@@ -1,8 +1,7 @@
-import { Liquid } from '../../src/liquid'
-import { Drop } from '../../src/drop/drop'
+import { Drop, Liquid } from '../..'
class SettingsDrop extends Drop {
- private foo = 'FOO'
+ public foo = 'FOO'
public bar () {
return 'BAR'
}