Compare commits

...
173 Commits
Author SHA1 Message Date
semantic-release-bot 607a5cda3f chore(release): 9.10.0 [skip ci]
# [9.10.0](https://github.com/harttle/liquidjs/compare/v9.9.0...v9.10.0) (2020-03-03)

### Features

* support json filter, closes [#192](https://github.com/harttle/liquidjs/issues/192) ([aa27a6c](https://github.com/harttle/liquidjs/commit/aa27a6c))
* with & for in `render` tag, closes [#195](https://github.com/harttle/liquidjs/issues/195) ([6ea6881](https://github.com/harttle/liquidjs/commit/6ea6881))
2020-03-03 23:12:54 +00:00
harttle 6ea6881f08 feat: with & for in render tag, closes #195 2020-03-04 07:08:54 +08:00
harttle aa27a6cd7b feat: support json filter, closes #192 2020-03-04 03:42:18 +08:00
harttle 152778b6e3 docs: include demo for LiquidJS used in browsers, #165 2020-03-03 00:37:37 +08:00
semantic-release-bot 3bf926b434 chore(release): 9.9.0 [skip ci]
# [9.9.0](https://github.com/harttle/liquidjs/compare/v9.8.0...v9.9.0) (2020-03-02)

### Features

* move filters/tags to instances, fixes [#188](https://github.com/harttle/liquidjs/issues/188) ([df8a919](https://github.com/harttle/liquidjs/commit/df8a919))
2020-03-02 16:11:08 +00:00
harttle df8a919f71 feat: move filters/tags to instances, fixes #188 2020-03-03 00:02:29 +08:00
semantic-release-bot f6762078e0 chore(release): 9.8.0 [skip ci]
# [9.8.0](https://github.com/harttle/liquidjs/compare/v9.7.2...v9.8.0) (2020-02-20)

### Features

* "today" when using date filter, fixes [#193](https://github.com/harttle/liquidjs/issues/193) ([185312d](https://github.com/harttle/liquidjs/commit/185312d))
2020-02-20 17:53:27 +00:00
harttle 185312dbff feat: "today" when using date filter, fixes #193 2020-02-21 01:48:10 +08:00
semantic-release-bot 5cd42f4500 chore(release): 9.7.2 [skip ci]
## [9.7.2](https://github.com/harttle/liquidjs/compare/v9.7.1...v9.7.2) (2020-02-20)

### Bug Fixes

* add funding entry to show up in npm fund command ([40095a8](https://github.com/harttle/liquidjs/commit/40095a8))
2020-02-20 17:37:45 +00:00
Zach LeathermanandJun Yang 40095a8e71 fix: add funding entry to show up in npm fund command 2020-02-21 01:33:43 +08:00
semantic-release-bot 14527a2545 chore(release): 9.7.1 [skip ci]
## [9.7.1](https://github.com/harttle/liquidjs/compare/v9.7.0...v9.7.1) (2020-02-19)

### Bug Fixes

* update index.html ([22386b0](https://github.com/harttle/liquidjs/commit/22386b0))
2020-02-19 10:31:46 +00:00
Peter deHaanandharttle 22386b0212 fix: update index.html
Fix a couple of errors that were appearing on https://harttle.land/liquidjs/#feature-list
2020-02-19 18:27:09 +08:00
semantic-release-bot 66541a62fd chore(release): 9.7.0 [skip ci]
# [9.7.0](https://github.com/harttle/liquidjs/compare/v9.6.2...v9.7.0) (2020-02-07)

### Bug Fixes

* expression and string literal parser, [#186](https://github.com/harttle/liquidjs/issues/186) ([fc0cf6f](https://github.com/harttle/liquidjs/commit/fc0cf6f))

### Features

* globals shared between tags, see [#185](https://github.com/harttle/liquidjs/issues/185) ([870e7ec](https://github.com/harttle/liquidjs/commit/870e7ec))
2020-02-07 21:05:21 +00:00
harttle 870e7ec6aa feat: globals shared between tags, see #185 2020-02-08 04:59:23 +08:00
harttle fc0cf6fe7b fix: expression and string literal parser, #186 2020-02-08 03:15:55 +08:00
allcontributors[bot]andJun Yang 46b69db87a docs: update .all-contributorsrc [skip ci] 2020-01-10 11:32:04 +08:00
allcontributors[bot]andJun Yang 9733199dc3 docs: update README.md [skip ci] 2020-01-10 11:32:04 +08:00
semantic-release-bot 1e6e9fe1a9 chore(release): 9.6.2 [skip ci]
## [9.6.2](https://github.com/harttle/liquidjs/compare/v9.6.1...v9.6.2) (2020-01-10)

### Performance Improvements

* prevent multiple case evaluations ([807e840](https://github.com/harttle/liquidjs/commit/807e840))
2020-01-10 03:29:50 +00:00
Martin SchusterandJun Yang 807e840712 perf: prevent multiple case evaluations 2020-01-10 11:25:52 +08:00
harttle a9afc9730c docs: add tgrandgent as contributor 2020-01-04 13:55:14 +08:00
harttle 5f9abdc8c6 test: integration cases for opts.fs, see #181 2020-01-04 13:53:08 +08:00
semantic-release-bot e24d9ab1b6 chore(release): 9.6.1 [skip ci]
## [9.6.1](https://github.com/harttle/liquidjs/compare/v9.6.0...v9.6.1) (2020-01-04)

### Bug Fixes

* add `this` to fs references in parseFile ([4b079c5](https://github.com/harttle/liquidjs/commit/4b079c5))
2020-01-04 04:09:40 +00:00
tgrandgentandJun Yang 4b079c54b1 fix: add this to fs references in parseFile 2020-01-04 12:05:39 +08:00
dependabot[bot]andJun Yang b600028607 chore(deps): bump handlebars from 4.1.0 to 4.5.3
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.1.0 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.1.0...v4.5.3)

Signed-off-by: dependabot[bot] <[email protected]>
2019-12-26 22:50:33 -06:00
semantic-release-bot 5ec3f95317 chore(release): 9.6.0 [skip ci]
# [9.6.0](https://github.com/harttle/liquidjs/compare/v9.5.0...v9.6.0) (2019-12-15)

### Features

* full syntax for strftime, close [#177](https://github.com/harttle/liquidjs/issues/177) ([ba5ff3f](https://github.com/harttle/liquidjs/commit/ba5ff3f))
2019-12-15 02:33:24 +00:00
harttle ba5ff3f41c feat: full syntax for strftime, close #177
- strftime syntax: <flags><width><modifier><conversion>
- new conversions: %n, %t
- fixed conversions: %N
- flags: _ ^ - 0 # :
- modifiers: E, O (ignored)
2019-12-15 02:28:33 +00:00
harttle c69ad538d4 test: remove mock for strftime cases 2019-12-14 18:34:14 +00:00
dependabot[bot]andJun Yang a373e50990 chore(deps): bump npm from 6.10.2 to 6.13.4
Bumps [npm](https://github.com/npm/cli) from 6.10.2 to 6.13.4.
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v6.10.2...v6.13.4)

Signed-off-by: dependabot[bot] <[email protected]>
2019-12-14 00:28:06 -06:00
semantic-release-bot 90d78ae6d5 chore(release): 9.5.0 [skip ci]
# [9.5.0](https://github.com/harttle/liquidjs/compare/v9.4.2...v9.5.0) (2019-12-12)

### Features

* nested property for the `where` filter, [#178](https://github.com/harttle/liquidjs/issues/178) ([60ec74f](https://github.com/harttle/liquidjs/commit/60ec74f))
2019-12-12 17:21:49 +00:00
harttle 60ec74f55d feat: nested property for the where filter, #178 2019-12-13 01:15:29 +08:00
semantic-release-bot 6502984b50 chore(release): 9.4.2 [skip ci]
## [9.4.2](https://github.com/harttle/liquidjs/compare/v9.4.1...v9.4.2) (2019-11-15)

### Bug Fixes

* reading .first, .last of Array, closes [#175](https://github.com/harttle/liquidjs/issues/175) ([f82da11](https://github.com/harttle/liquidjs/commit/f82da11))
2019-11-15 17:19:40 +00:00
harttle f82da11f5a fix: reading .first, .last of Array, closes #175 2019-11-16 01:14:09 +08:00
semantic-release-bot ef289039fb chore(release): 9.4.1 [skip ci]
## [9.4.1](https://github.com/harttle/liquidjs/compare/v9.4.0...v9.4.1) (2019-11-15)

### Bug Fixes

* remove node dependencies for esm bundle, see [#173](https://github.com/harttle/liquidjs/issues/173) ([04df929](https://github.com/harttle/liquidjs/commit/04df929))
2019-11-15 02:58:48 +00:00
harttle 04df9294b5 fix: remove node dependencies for esm bundle, see #173 2019-11-15 10:53:54 +08:00
semantic-release-bot 79892f6b72 chore(release): 9.4.0 [skip ci]
# [9.4.0](https://github.com/harttle/liquidjs/compare/v9.3.1...v9.4.0) (2019-11-14)

### Features

* add ability to pass JSON context to CLI ([9504e4e](https://github.com/harttle/liquidjs/commit/9504e4e))
2019-11-14 13:18:08 +00:00
allcontributors[bot]andJun Yang 19f3e23b27 docs: update .all-contributorsrc 2019-11-14 07:08:21 -06:00
allcontributors[bot]andJun Yang 993ea20b80 docs: update README.md 2019-11-14 07:08:21 -06:00
harttle 08cbb12228 chore: introduce commit message lint 2019-11-14 21:01:55 +08:00
Brandon Pittmanandharttle 9504e4e45b feat: add ability to pass JSON context to CLI
If you pass a JSON file or JSON string as the first argument to the CLI, you can use variables in your templates that get parsed by the CLI.
2019-11-14 21:01:37 +08:00
semantic-release-bot 0b9b50c5d7 chore(release): 9.3.1 [skip ci]
## [9.3.1](https://github.com/harttle/liquidjs/compare/v9.3.0...v9.3.1) (2019-11-09)

### Bug Fixes

* liquidjs command in /bin/liquid.js, fixes [#169](https://github.com/harttle/liquidjs/issues/169) ([0073b90](https://github.com/harttle/liquidjs/commit/0073b90))
2019-11-09 16:17:47 +00:00
harttle 0073b90b31 fix: liquidjs command in /bin/liquid.js, fixes #169 2019-11-10 00:13:18 +08:00
Jun YangandGitHub 081c432334 docs: update readme 2019-11-09 10:26:58 +08:00
semantic-release-bot 390cd23f5f chore(release): 9.3.0 [skip ci]
# [9.3.0](https://github.com/harttle/liquidjs/compare/v9.2.0...v9.3.0) (2019-11-07)

### Features

* support require.resolve for lookup, see [#168](https://github.com/harttle/liquidjs/issues/168) ([2dd4355](https://github.com/harttle/liquidjs/commit/2dd4355))
2019-11-07 10:51:46 +00:00
harttle 2dd43559b5 feat: support require.resolve for lookup, see #168 2019-11-07 18:46:37 +08:00
dependabot[bot]andJun Yang 5492fb0b17 chore(deps): bump eslint-utils from 1.4.0 to 1.4.3
Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.4.0 to 1.4.3.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.4.0...v1.4.3)

Signed-off-by: dependabot[bot] <[email protected]>
2019-11-03 07:51:34 -06:00
semantic-release-bot 1ecff1c341 chore(release): 9.2.0 [skip ci]
# [9.2.0](https://github.com/harttle/liquidjs/compare/v9.1.1...v9.2.0) (2019-10-26)

### Features

* Support for the "render" tag [#163](https://github.com/harttle/liquidjs/issues/163) ([d5e7b04](https://github.com/harttle/liquidjs/commit/d5e7b04))
2019-10-26 16:11:59 +00:00
Jun Yang d5e7b047bb feat: Support for the "render" tag #163 2019-10-27 00:06:16 +08:00
harttle b82fa9ed2b pref: remove await/async from internal async calls 2019-10-26 08:57:33 -05:00
harttle d4ad4b8a8c docs: add .nojekyll 2019-10-24 19:30:46 +08:00
harttle ab8db5394b docs: fix some typos for the website demos 2019-10-20 22:57:28 +08:00
harttle b02a227a81 docs: add home page for API doc 2019-10-20 22:53:29 +08:00
harttle 41a33834e7 docs: add related packages in README 2019-10-19 17:30:49 +08:00
harttle 53e7ea51bd chore: upgrade sinon 2019-10-14 14:56:58 +08:00
harttle ef3e520628 docs: update typedoc 2019-10-14 12:38:18 +08:00
semantic-release-bot be755a900c chore(release): 9.1.1 [skip ci]
## [9.1.1](https://github.com/harttle/liquidjs/compare/v9.1.0...v9.1.1) (2019-10-10)

### Performance Improvements

* add string flattening to reduce retained memory (node only) ([3ad512c](https://github.com/harttle/liquidjs/commit/3ad512c))
2019-10-10 01:39:53 +00:00
Patrick MalouinandJun Yang 3ad512c51c perf: add string flattening to reduce retained memory (node only)
add a memory footprint benchmark
2019-10-10 09:35:15 +08:00
harttle 7bae5bcb79 docs: add demo for React hooks and context (#150) 2019-10-08 21:50:59 +08:00
harttle 3a7ddaa2c3 chore: set demo packages private 2019-10-08 21:50:32 +08:00
semantic-release-bot 362e2d6451 chore(release): 9.1.0 [skip ci]
# [9.1.0](https://github.com/harttle/liquidjs/compare/v9.0.1...v9.1.0) (2019-10-07)

### Features

* alias getTemplate() to parseFile() ([6b83788](https://github.com/harttle/liquidjs/commit/6b83788))
2019-10-07 15:40:44 +00:00
harttle 6b83788077 feat: alias getTemplate() to parseFile()
* deprecate Liquid#getTemplate: use Liquid#parseFile instead
* deprecate Liquid#getTemplateSync: use Liquid#parseFileSync instead
2019-10-07 23:34:12 +08:00
harttle 4f8fc89c6f docs: update reactjs demo for consistant ES6 style 2019-10-07 22:40:36 +08:00
harttle cc8851e56f doc: add Contribute Guidelines 2019-10-05 11:37:59 +08:00
semantic-release-bot 154deeda76 chore(release): 9.0.1 [skip ci]
## [9.0.1](https://github.com/harttle/liquidjs/compare/v9.0.0...v9.0.1) (2019-10-02)

### Bug Fixes

* `unless` content is not waited, fixes [#160](https://github.com/harttle/liquidjs/issues/160) ([d2c8d13](https://github.com/harttle/liquidjs/commit/d2c8d13))
2019-10-02 14:37:23 +00:00
harttle d2c8d133ff fix: unless content is not waited, fixes #160 2019-10-02 22:30:35 +08:00
Jun YangandGitHub 96d98e4ebb doc: update live demo link, see #157 2019-09-14 21:48:22 +08:00
harttle f661cd8b85 doc: fix underscore prefixed doc files by adding .jekyll 2019-08-27 13:07:21 +08:00
harttle 493c4951e1 doc: update typedoc 2019-08-27 12:17:53 +08:00
harttle d3f3d81e2e doc: update typedoc and README.md 2019-08-26 23:31:53 +08:00
semantic-release-bot c2ba1e1f1a chore(release): 9.0.0 [skip ci]
# [9.0.0](https://github.com/harttle/liquidjs/compare/v8.5.3...v9.0.0) (2019-08-26)

### Bug Fixes

* break/continue omitting output before them, [#123](https://github.com/harttle/liquidjs/issues/123) ([ae45c46](https://github.com/harttle/liquidjs/commit/ae45c46))
* reactjs demo during yarn install, fixes [#145](https://github.com/harttle/liquidjs/issues/145) ([b65df44](https://github.com/harttle/liquidjs/commit/b65df44))

### Code Refactoring

* return value of Tag#render is no longer used ([8028f82](https://github.com/harttle/liquidjs/commit/8028f82))

### Features

* renderSync, parseAndRenderSync and renderFileSync, see [#48](https://github.com/harttle/liquidjs/issues/48) ([7fb01ad](https://github.com/harttle/liquidjs/commit/7fb01ad))

### Performance Improvements

* target to es6, fixes [#137](https://github.com/harttle/liquidjs/issues/137) ([3b9fc7e](https://github.com/harttle/liquidjs/commit/3b9fc7e))

### BREAKING CHANGES

* Tag#render now returns void, use emitter argument
to write rendered html.
* ship to Node.js 8, the dist/liquid.cjs.js (main) nolonger
supports Node.js 6, other bundles are also provided via dist/liquid.esm.js, dist/liquid.js (ES5 umd) and liquid.min.js (minified ES5 umd)
* remove default export, now should be used like import
{Liquid} from 'liquidjs'
2019-08-26 15:21:34 +00:00
allcontributors[bot]andJun Yang 31bec7e66e docs: update .all-contributorsrc 2019-08-26 10:16:07 -05:00
allcontributors[bot]andJun Yang 0b6f86d02a docs: update README.md 2019-08-26 10:16:07 -05:00
harttle 28330e1127 chore: fix benchmark 2019-08-26 10:15:43 -05:00
harttle 0426d08fd0 style: fix linting 2019-08-26 10:15:43 -05:00
harttle 7fb01ad69a feat: renderSync, parseAndRenderSync and renderFileSync, see #48 2019-08-26 10:15:43 -05:00
harttle 8028f82499 refactor: return value of Tag#render is no longer used
BREAKING CHANGE: Tag#render now returns void, use emitter argument
to write rendered html.
2019-08-26 10:15:43 -05:00
harttle 76019e9e18 refactor: rewrite expression evaluation, fix #130 2019-08-26 10:15:43 -05:00
semantic-release-botandJun Yang 538610e169 chore(release): 8.5.1 [skip ci]
## [8.5.1](https://github.com/harttle/liquidjs/compare/v8.5.0...v8.5.1) (2019-08-05)

### Bug Fixes

* publish bin directory to npm, fixes [#146](https://github.com/harttle/liquidjs/issues/146) ([a85b650](https://github.com/harttle/liquidjs/commit/a85b650))
2019-08-26 10:15:43 -05:00
harttle b65df447dc fix: reactjs demo during yarn install, fixes #145
simply remove unused dependencies fixes this issue, but I removed
all package-lock.json / yarn.lock since the demo should always be
in sync with the codebase
2019-08-26 10:15:43 -05:00
harttle 3b9fc7e6bf perf: target to es6, fixes #137
BREAKING CHANGE: ship to Node.js 8, the dist/liquid.cjs.js (main) nolonger
supports Node.js 6, other bundles are also provided via dist/liquid.esm.js, dist/liquid.js (ES5 umd) and liquid.min.js (minified ES5 umd)
2019-08-26 10:15:43 -05:00
harttle f35ab6b72e doc: update README and typedoc 2019-08-26 10:15:43 -05:00
harttle ab3b824cf8 style: fix linting 2019-08-26 10:15:43 -05:00
harttle ae45c4622e fix: break/continue omitting output before them, #123
BREAKING CHANGE: remove default export, now should be used like import
{Liquid} from 'liquidjs'
2019-08-26 10:15:43 -05:00
harttle 854e12ba53 refactor: add emitter for code generation 2019-08-26 10:15:43 -05:00
semantic-release-bot ad8e2f7e63 chore(release): 8.5.3 [skip ci]
## [8.5.3](https://github.com/harttle/liquidjs/compare/v8.5.2...v8.5.3) (2019-08-25)

### Bug Fixes

* escape filter when input is undefined ([a00945c](https://github.com/harttle/liquidjs/commit/a00945c))
2019-08-25 09:23:56 +00:00
jamelaitandJun Yang e17bc97d8e fix escape filter with stringify 2019-08-25 04:19:37 -05:00
Jamel AandJun Yang aa15f3dfe1 fixing lint errors 2019-08-25 04:19:37 -05:00
jamelaitandJun Yang a00945cad7 fix: escape filter when input is undefined 2019-08-25 04:19:37 -05:00
allcontributors[bot]andJun Yang 0f4e6d9981 docs: update .all-contributorsrc 2019-08-12 01:54:55 -05:00
allcontributors[bot]andJun Yang db5de49f5e docs: update README.md 2019-08-12 01:54:55 -05:00
semantic-release-bot d50fd1df35 chore(release): 8.5.2 [skip ci]
## [8.5.2](https://github.com/harttle/liquidjs/compare/v8.5.1...v8.5.2) (2019-08-09)

### Bug Fixes

* quotation tokenizing, [#151](https://github.com/harttle/liquidjs/issues/151) ([1e4f237](https://github.com/harttle/liquidjs/commit/1e4f237))
2019-08-09 17:29:27 +00:00
Jun Yang 1e4f237022 fix: quotation tokenizing, #151 2019-08-10 01:24:36 +08:00
Joonas MertanenandJun Yang 9956c53b09 Correctly tokenize quotation marks within single token 2019-08-08 08:08:18 -05:00
Joonas MertanenandJun Yang af841dc872 Add test for property access syntax 2019-08-08 08:08:18 -05:00
Jun YangandGitHub 0408ae7f53 Update README.md 2019-08-06 10:56:03 +08:00
semantic-release-bot 3cf35fd58e chore(release): 8.5.1 [skip ci]
## [8.5.1](https://github.com/harttle/liquidjs/compare/v8.5.0...v8.5.1) (2019-08-05)

### Bug Fixes

* publish bin directory to npm, fixes [#146](https://github.com/harttle/liquidjs/issues/146) ([a85b650](https://github.com/harttle/liquidjs/commit/a85b650))
2019-08-05 17:58:55 +00:00
harttle 58f546ff80 doc: fix doc files with underscores 2019-08-06 01:52:50 +08:00
harttle a85b650ab2 fix: publish bin directory to npm, fixes #146 2019-08-06 01:48:12 +08:00
Jun YangandGitHub d487a2d3ea Create FUNDING.yml 2019-08-06 01:40:34 +08:00
harttle 0b543817ff doc: introduce typedoc and sponsorship, for #126 2019-08-06 01:36:34 +08:00
azuandJun Yang 0d52d570fc docs: fix link in README 2019-08-05 00:23:48 -05:00
semantic-release-bot c354164352 chore(release): 8.5.0 [skip ci]
# [8.5.0](https://github.com/harttle/liquidjs/compare/v8.4.1...v8.5.0) (2019-08-01)

### Features

* CLI support ([fc045b5](https://github.com/harttle/liquidjs/commit/fc045b5))
2019-08-01 05:20:02 +00:00
harttle fc045b5bbc feat: CLI support
echo '{{ "hello" | capitalize }}' | liquidjs
2019-08-01 13:15:55 +08:00
Robin BijlaniandJun Yang c8c6dd8275 Fix: Stringify append and prepend values 2019-07-25 13:12:07 +08:00
semantic-release-bot 49c45a463b chore(release): 8.4.1 [skip ci]
## [8.4.1](https://github.com/harttle/liquidjs/compare/v8.4.0...v8.4.1) (2019-07-22)

### Bug Fixes

* some filters on undefined variable throws, [#140](https://github.com/harttle/liquidjs/issues/140) ([6e6ea0a](https://github.com/harttle/liquidjs/commit/6e6ea0a))
2019-07-22 08:52:48 +00:00
harttle cef5d1aa1a chore: remove support for node_js 6 2019-07-22 16:48:48 +08:00
harttle 6e6ea0ae58 fix: some filters on undefined variable throws, #140 2019-07-22 16:48:48 +08:00
harttle dc9a6e019e doc: make the purpose clear #139 , add plugin list 2019-07-22 02:04:53 +08:00
semantic-release-bot 5adebaa710 chore(release): 8.4.0 [skip ci]
# [8.4.0](https://github.com/harttle/liquidjs/compare/v8.3.0...v8.4.0) (2019-07-06)

### Features

* at_least, at_most, sort_naturual for [#132](https://github.com/harttle/liquidjs/issues/132) ([e6f5f1c](https://github.com/harttle/liquidjs/commit/e6f5f1c))
2019-07-06 06:54:15 +00:00
harttle 34d5af25a4 chore: trying to fix TS4053 2019-07-06 14:49:39 +08:00
harttle 88c89fe3b3 style: introduce @typescript-eslint/recommended 2019-07-06 14:33:34 +08:00
harttle e6f5f1cd85 feat: at_least, at_most, sort_naturual for #132 2019-07-05 12:09:00 +08:00
semantic-release-bot 570400ebcc chore(release): 8.3.0 [skip ci]
# [8.3.0](https://github.com/harttle/liquidjs/compare/v8.2.4...v8.3.0) (2019-06-27)

### Features

* fs option implemented by [#138](https://github.com/harttle/liquidjs/issues/138) ([3f5e23c](https://github.com/harttle/liquidjs/commit/3f5e23c))
2019-06-27 01:47:56 +00:00
Jun Yang 3f5e23c42b feat: fs option implemented by #138 2019-06-27 09:42:29 +08:00
Jun Yang 96c061bee0 style: remove semi 2019-06-27 09:32:51 +08:00
Patrick MalouinandJun Yang edb2cc1f37 Expose fs as an option to override the default implementations 2019-06-27 09:25:17 +08:00
harttle 2ae8c37a4f chore: add @semantic-release/github for notify 2019-06-17 17:24:07 +08:00
semantic-release-bot 0bc5908f17 chore(release): 8.2.4 [skip ci]
## [8.2.4](https://github.com/harttle/liquidjs/compare/v8.2.3...v8.2.4) (2019-06-17)

### Performance Improvements

* improve getTemplate() when cache is enabled ([1ffba2b](https://github.com/harttle/liquidjs/commit/1ffba2b))
2019-06-17 03:10:34 +00:00
Patrick MalouinandJun Yang 1ffba2bc76 perf: improve getTemplate() when cache is enabled
Checking for file existence is unnecessary when cache contains entry.
2019-06-17 11:01:02 +08:00
semantic-release-bot bbebb5515c chore(release): 8.2.3 [skip ci]
## [8.2.3](https://github.com/harttle/liquidjs/compare/v8.2.2...v8.2.3) (2019-05-19)

### Bug Fixes

* reverse filter not pure, see [#126](https://github.com/harttle/liquidjs/issues/126) ([505c408](https://github.com/harttle/liquidjs/commit/505c408))
2019-05-19 06:10:34 +00:00
Jun Yang b14430a161 style: test/integration/builtin/filters/array.ts 2019-05-19 14:05:28 +08:00
Jun Yang 505c408a85 fix: reverse filter not pure, see #126 2019-05-19 13:58:11 +08:00
Jun Yang 224679a7d7 chore: speedup unit test on windows 2019-05-19 13:00:51 +08:00
semantic-release-bot 2cb4bffd3e chore(release): 8.2.2 [skip ci]
## [8.2.2](https://github.com/harttle/liquidjs/compare/v8.2.1...v8.2.2) (2019-05-12)

### Bug Fixes

* date from integer, [#125](https://github.com/harttle/liquidjs/issues/125) ([fdf0043](https://github.com/harttle/liquidjs/commit/fdf0043))
* pass drops directly to filters/tags ([bef2909](https://github.com/harttle/liquidjs/commit/bef2909))
2019-05-12 15:02:33 +00:00
harttle c940e6c997 chore: try to make unit test locale independent 2019-05-12 22:58:29 +08:00
harttle d8ba009773 chore: fix building 2019-05-12 21:29:58 +08:00
harttle fdf0043b9c fix: date from integer, #125 2019-05-12 21:03:35 +08:00
harttle bef290923c fix: pass drops directly to filters/tags 2019-05-12 20:03:32 +08:00
semantic-release-bot 4282accaa2 chore(release): 8.2.1 [skip ci]
## [8.2.1](https://github.com/harttle/liquidjs/compare/v8.2.0...v8.2.1) (2019-04-26)

### Bug Fixes

* `default` filter is not working with an empty string, [#122](https://github.com/harttle/liquidjs/issues/122) ([6075c0a](https://github.com/harttle/liquidjs/commit/6075c0a))
2019-04-26 16:32:20 +00:00
harttle 6075c0a54f fix: default filter is not working with an empty string, #122 2019-04-27 00:26:17 +08:00
semantic-release-bot 87489f6098 chore(release): 8.2.0 [skip ci]
# [8.2.0](https://github.com/harttle/liquidjs/compare/v8.1.0...v8.2.0) (2019-04-17)

### Features

* pass context to filters ([00bc1ef](https://github.com/harttle/liquidjs/commit/00bc1ef))
2019-04-17 02:51:13 +00:00
harttle 6c5dc336e7 chore: fix linting, working on #120 2019-04-17 10:45:02 +08:00
harttle 00bc1efe6a feat: pass context to filters 2019-04-17 10:24:55 +08:00
harttle 6fb4796202 chore: set outDir to dist, see #119 2019-04-16 11:23:29 +08:00
semantic-release-bot 7483613b23 chore(release): 8.1.0 [skip ci]
# [8.1.0](https://github.com/harttle/liquidjs/compare/v8.0.3...v8.1.0) (2019-04-02)

### Features

* where filter, working on [#118](https://github.com/harttle/liquidjs/issues/118) ([daa0b57](https://github.com/harttle/liquidjs/commit/daa0b57))
2019-04-02 04:55:18 +00:00
harttle 7762dd9612 chore: fix linting 2019-04-02 12:10:35 +08:00
Jun Yang daa0b574fc feat: where filter, working on #118
doc: https://shopify.github.io/liquid/filters/where/
ruby impl: https://github.com/Shopify/liquid/blob/14cd011cb5eef042af192ad5294c8f0e1ae89f06/lib/liquid/standardfilters.rb
2019-04-02 00:46:32 +08:00
semantic-release-bot a084183246 chore(release): 8.0.3 [skip ci]
## [8.0.3](https://github.com/harttle/liquidjs/compare/v8.0.2...v8.0.3) (2019-04-01)

### Bug Fixes

* slice filter on negative `begin`, [#117](https://github.com/harttle/liquidjs/issues/117) ([eadb6f3](https://github.com/harttle/liquidjs/commit/eadb6f3))
2019-04-01 03:04:24 +00:00
harttle eadb6f3711 fix: slice filter on negative begin, #117 2019-04-01 10:57:08 +08:00
semantic-release-bot dba26f24e6 chore(release): 8.0.2 [skip ci]
## [8.0.2](https://github.com/harttle/liquidjs/compare/v8.0.1...v8.0.2) (2019-03-25)

### Performance Improvements

* use polymophism instead duck test ([82d7673](https://github.com/harttle/liquidjs/commit/82d7673))
2019-03-25 15:15:04 +00:00
Jun Yang 722da6a7ee doc: update README 2019-03-25 23:01:04 +08:00
harttle 82d7673554 perf: use polymophism instead duck test 2019-03-25 20:11:23 +08:00
harttle 64dd057552 refactor: Context#propertyAccessSeq => parseProp 2019-03-25 10:36:23 +08:00
harttle 45e3c2bb8e refactor: switch Context <-> Scope concepts 2019-03-25 10:36:23 +08:00
Jun Yang 76345a64c3 doc: update README.md 2019-03-23 22:28:33 +08:00
semantic-release-bot 9e69652655 chore(release): 8.0.1 [skip ci]
## [8.0.1](https://github.com/harttle/liquidjs/compare/v8.0.0...v8.0.1) (2019-03-22)

### Bug Fixes

* incorrect scope when using assign with for, fixes [#115](https://github.com/harttle/liquidjs/issues/115) ([defbb58](https://github.com/harttle/liquidjs/commit/defbb58))
2019-03-22 12:48:41 +00:00
harttle defbb58e66 fix: incorrect scope when using assign with for, fixes #115
* remove AssignScope, CaptureScope, IncrementScope, DecrementScope concepts
* introduce Scope.environments for decrement/increment
* assign to scopes[0] for assign/capture
2019-03-22 20:38:54 +08:00
ssendevandJun Yang b7b92c63cf async Register Tags example 2019-03-21 20:46:21 +08:00
ssendevandJun Yang 265534b7b7 Fix Register Tags example 2019-03-21 20:46:21 +08:00
semantic-release-bot 84ea2c7488 chore(release): 8.0.0 [skip ci]
# [8.0.0](https://github.com/harttle/liquidjs/compare/v7.5.1...v8.0.0) (2019-03-10)

### Code Refactoring

* use camelCase for JavaScript APIs ([64e0c87](https://github.com/harttle/liquidjs/commit/64e0c87))

### Features

* promise support for drops, working on [#65](https://github.com/harttle/liquidjs/issues/65) ([4a8088d](https://github.com/harttle/liquidjs/commit/4a8088d))

### BREAKING CHANGES

* Options and method names in JavaScript API are now renamed to cammelCase, for a complete list see #109
2019-03-10 11:28:39 +00:00
Jun Yang 64e0c876e9 refactor: use camelCase for JavaScript APIs
BREAKING CHANGE: Options and method names in JavaScript API are now renamed to cammelCase, for a complete list see #109
2019-03-10 19:21:09 +08:00
Jun Yang 4a8088d4e4 feat: promise support for drops, working on #65 2019-03-10 18:05:52 +08:00
harttle ad0930f152 test: cover parseFilters in template/value.ts 2019-03-06 01:46:35 +08:00
harttle 998832c772 refactor: mv custom filter test 2019-03-06 01:40:31 +08:00
semantic-release-bot 4ba224043b chore(release): 7.5.1 [skip ci]
## [7.5.1](https://github.com/harttle/liquidjs/compare/v7.5.0...v7.5.1) (2019-03-05)

### Bug Fixes

* named params for filters, working on [#113](https://github.com/harttle/liquidjs/issues/113) ([5ffc904](https://github.com/harttle/liquidjs/commit/5ffc904))
2019-03-05 17:39:56 +00:00
harttle 5ffc904f80 fix: named params for filters, working on #113 2019-03-06 01:30:47 +08:00
semantic-release-bot 08646f75b0 chore(release): 7.5.0 [skip ci]
# [7.5.0](https://github.com/harttle/liquidjs/compare/v7.4.0...v7.5.0) (2019-03-01)

### Features

* tablerowloop object ([3647305](https://github.com/harttle/liquidjs/commit/3647305))
2019-03-01 22:06:31 +00:00
Jun Yang 3647305dcf feat: tablerowloop object
See: https://www.rubydoc.info/gems/liquid/Liquid/TablerowloopDrop
2019-03-02 06:00:30 +08:00
Jun Yang cca0306f5b chore: fix mocha pattern for windows
See: https://github.com/mochajs/mocha/issues/2895
2019-03-02 03:57:38 +08:00
Jun Yang eeeacc4492 chore: fix rollup.config.ts 2019-03-02 03:42:57 +08:00
Jun Yang d44e1d727a chore: fix test on windows 10 2019-03-02 03:36:33 +08:00
semantic-release-bot f960904df4 chore(release): 7.4.0 [skip ci]
# [7.4.0](https://github.com/harttle/liquidjs/compare/v7.3.1...v7.4.0) (2019-02-28)

### Bug Fixes

* math filters now return number, resolves [#110](https://github.com/harttle/liquidjs/issues/110) ([b4acdb4](https://github.com/harttle/liquidjs/commit/b4acdb4))

### Features

* exported Drop interface for [#107](https://github.com/harttle/liquidjs/issues/107) ([7bee9fc](https://github.com/harttle/liquidjs/commit/7bee9fc)), closes [#109](https://github.com/harttle/liquidjs/issues/109)
2019-02-28 05:13:55 +00:00
harttle b4acdb463a fix: math filters now return number, resolves #110
* fix linting
* numbers are no longer fixed:
    i.e. {{0.3 | minus 0.1}} now renders as 0.19999
    Stick to JavaScript number behavior, see: 8.0.0
2019-02-28 13:02:51 +08:00
harttle 21d674e22b chore: fix benchmark npm script 2019-02-28 00:05:37 +08:00
harttle 7bee9fc92d feat: exported Drop interface for #107
Deprecate snake_cased options and APIs, sed #109
2019-02-28 00:05:08 +08:00
harttle b69c3a3203 refactor: IDrop interface => abstract method 2019-02-28 00:05:08 +08:00
harttle d5b9916b2f refactor: Drop.prototype.value => valueOf 2019-02-28 00:05:08 +08:00
semantic-release-bot d0118402e4 chore(release): 7.3.1 [skip ci]
## [7.3.1](https://github.com/harttle/liquidjs/compare/v7.3.0...v7.3.1) (2019-02-25)

### Bug Fixes

* **#108:** remove absolute path in emitted d.ts ([53a835a](https://github.com/harttle/liquidjs/commit/53a835a)), closes [#108](https://github.com/harttle/liquidjs/issues/108)
2019-02-25 17:03:07 +00:00
harttle 31bc71d472 chore: fix linting 2019-02-26 00:56:12 +08:00
harttle 53a835ab54 fix(#108): remove absolute path in emitted d.ts 2019-02-26 00:43:30 +08:00
harttle 75b3e15ca9 chore: fix rollup.config.ts types 2019-02-25 00:12:31 +08:00
harttle f34573ee21 chore: stick with es6 for testing 2019-02-24 23:42:44 +08:00
harttle 875f71d5f2 chore: a simple liquid_method_missing case for #97 2019-02-24 23:08:53 +08:00
harttle 407ac6d0a4 refactor: remove /dist from repo 2019-02-24 23:03:12 +08:00
526 changed files with 57616 additions and 46941 deletions
+248
View File
@@ -0,0 +1,248 @@
{
"projectName": "liquidjs",
"projectOwner": "harttle",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"commitConvention": "eslint",
"contributors": [
{
"login": "harttle",
"name": "Jun Yang",
"avatar_url": "https://avatars3.githubusercontent.com/u/4427974?v=4",
"profile": "https://harttle.land",
"contributions": [
"maintenance",
"code"
]
},
{
"login": "chenos",
"name": "chenos",
"avatar_url": "https://avatars0.githubusercontent.com/u/2993310?v=4",
"profile": "https://github.com/chenos",
"contributions": [
"code"
]
},
{
"login": "zachleat",
"name": "Zach Leatherman",
"avatar_url": "https://avatars2.githubusercontent.com/u/39355?v=4",
"profile": "https://zachleat.com/",
"contributions": [
"bug"
]
},
{
"login": "thardy",
"name": "Tim Hardy",
"avatar_url": "https://avatars3.githubusercontent.com/u/120636?v=4",
"profile": "https://github.com/thardy",
"contributions": [
"code"
]
},
{
"login": "paulrobertlloyd",
"name": "Paul Robert Lloyd",
"avatar_url": "https://avatars3.githubusercontent.com/u/813383?v=4",
"profile": "https://paulrobertlloyd.com/",
"contributions": [
"code",
"bug"
]
},
{
"login": "aleclarson",
"name": "Alec Larson",
"avatar_url": "https://avatars2.githubusercontent.com/u/1925840?v=4",
"profile": "https://twitter.com/alecdotbiz",
"contributions": [
"code"
]
},
{
"login": "pmalouin",
"name": "Patrick Malouin",
"avatar_url": "https://avatars1.githubusercontent.com/u/1411117?v=4",
"profile": "https://github.com/pmalouin",
"contributions": [
"code",
"doc"
]
},
{
"login": "jaswrks",
"name": "jaswrks",
"avatar_url": "https://avatars3.githubusercontent.com/u/1563559?v=4",
"profile": "https://jaswrks.com",
"contributions": [
"code"
]
},
{
"login": "oott123",
"name": "三三",
"avatar_url": "https://avatars2.githubusercontent.com/u/905663?v=4",
"profile": "https://oott123.com",
"contributions": [
"code",
"ideas"
]
},
{
"login": "ssendev",
"name": "ssendev",
"avatar_url": "https://avatars0.githubusercontent.com/u/450793?v=4",
"profile": "https://github.com/ssendev",
"contributions": [
"code",
"doc"
]
},
{
"login": "wojtask9",
"name": "wojtask9",
"avatar_url": "https://avatars3.githubusercontent.com/u/6099236?v=4",
"profile": "https://github.com/wojtask9",
"contributions": [
"code"
]
},
{
"login": "thelornenelson",
"name": "Andrew Barclay",
"avatar_url": "https://avatars3.githubusercontent.com/u/24596583?v=4",
"profile": "https://github.com/thelornenelson",
"contributions": [
"code"
]
},
{
"login": "cmawhorter",
"name": "Cory Mawhorter",
"avatar_url": "https://avatars2.githubusercontent.com/u/142338?v=4",
"profile": "https://www.stam.pr/",
"contributions": [
"code"
]
},
{
"login": "thehappybug",
"name": "Mehdi Jaffery",
"avatar_url": "https://avatars0.githubusercontent.com/u/3393530?v=4",
"profile": "https://github.com/thehappybug",
"contributions": [
"code"
]
},
{
"login": "robinbijlani",
"name": "Robin Bijlani",
"avatar_url": "https://avatars0.githubusercontent.com/u/2503108?v=4",
"profile": "https://github.com/robinbijlani",
"contributions": [
"code",
"bug"
]
},
{
"login": "ryaninvents",
"name": "Ryan Kennedy",
"avatar_url": "https://avatars3.githubusercontent.com/u/8356669?v=4",
"profile": "https://www.rmkennedy.com",
"contributions": [
"code"
]
},
{
"login": "strax",
"name": "Sami Kukkonen",
"avatar_url": "https://avatars2.githubusercontent.com/u/587213?v=4",
"profile": "https://github.com/strax",
"contributions": [
"code"
]
},
{
"login": "ScottFreeCode",
"name": "Scott Santucci",
"avatar_url": "https://avatars3.githubusercontent.com/u/16506071?v=4",
"profile": "https://ScottFreeCode.github.io/",
"contributions": [
"code"
]
},
{
"login": "stevenanthonyrevo",
"name": "Steven ",
"avatar_url": "https://avatars3.githubusercontent.com/u/8505293?v=4",
"profile": "http://stevenrescigno.com",
"contributions": [
"example",
"code"
]
},
{
"login": "azu",
"name": "azu",
"avatar_url": "https://avatars1.githubusercontent.com/u/19714?v=4",
"profile": "https://efcl.info/",
"contributions": [
"doc"
]
},
{
"login": "wyozi",
"name": "Joonas",
"avatar_url": "https://avatars3.githubusercontent.com/u/4894573?v=4",
"profile": "https://github.com/wyozi",
"contributions": [
"code"
]
},
{
"login": "jamelait",
"name": "Jamel A.",
"avatar_url": "https://avatars1.githubusercontent.com/u/14369255?v=4",
"profile": "https://github.com/jamelait",
"contributions": [
"code"
]
},
{
"login": "brandonpittman",
"name": "Brandon Pittman",
"avatar_url": "https://avatars0.githubusercontent.com/u/967145?v=4",
"profile": "https://brandonpittman.net",
"contributions": [
"code"
]
},
{
"login": "tgrandgent",
"name": "tgrandgent",
"avatar_url": "https://avatars3.githubusercontent.com/u/17069042?v=4",
"profile": "https://github.com/tgrandgent",
"contributions": [
"code"
]
},
{
"login": "mastodon0",
"name": "Martin Schuster",
"avatar_url": "https://avatars1.githubusercontent.com/u/7924332?v=4",
"profile": "https://github.com/mastodon0",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
"skipCi": true
}
+13 -2
View File
@@ -1,5 +1,5 @@
{
"extends": "standard",
"extends": ["standard", "plugin:@typescript-eslint/recommended"],
"env": {
"mocha": true,
"es6": true,
@@ -17,7 +17,18 @@
"no-var": 2,
"prefer-const": 2,
"no-unused-vars": "off",
"indent": "off",
"no-dupe-class-members": "off",
"no-useless-constructor": "off",
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"import/export": "off",
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false }]
}
}
+12
View File
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: liquidjs
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+4 -1
View File
@@ -9,8 +9,11 @@ coverage/
# modules
node_modules/
build/
dist/
demo/*/package-lock.json
demo/*/yarn.json
# editors
.*.swp
.vscode
+3 -2
View File
@@ -2,12 +2,13 @@ language: node_js
node_js:
- "10"
- "8"
- "6"
jobs:
include:
- stage: test
name: 'Linting'
script: npm run lint
script:
- npm run lint
- commitlint-travis
- name: 'Coverage'
script: npm run coverage-coveralls
- stage: release
+328
View File
@@ -1,3 +1,331 @@
# [9.10.0](https://github.com/harttle/liquidjs/compare/v9.9.0...v9.10.0) (2020-03-03)
### Features
* support json filter, closes [#192](https://github.com/harttle/liquidjs/issues/192) ([aa27a6c](https://github.com/harttle/liquidjs/commit/aa27a6c))
* with & for in `render` tag, closes [#195](https://github.com/harttle/liquidjs/issues/195) ([6ea6881](https://github.com/harttle/liquidjs/commit/6ea6881))
# [9.9.0](https://github.com/harttle/liquidjs/compare/v9.8.0...v9.9.0) (2020-03-02)
### Features
* move filters/tags to instances, fixes [#188](https://github.com/harttle/liquidjs/issues/188) ([df8a919](https://github.com/harttle/liquidjs/commit/df8a919))
# [9.8.0](https://github.com/harttle/liquidjs/compare/v9.7.2...v9.8.0) (2020-02-20)
### Features
* "today" when using date filter, fixes [#193](https://github.com/harttle/liquidjs/issues/193) ([185312d](https://github.com/harttle/liquidjs/commit/185312d))
## [9.7.2](https://github.com/harttle/liquidjs/compare/v9.7.1...v9.7.2) (2020-02-20)
### Bug Fixes
* add funding entry to show up in npm fund command ([40095a8](https://github.com/harttle/liquidjs/commit/40095a8))
## [9.7.1](https://github.com/harttle/liquidjs/compare/v9.7.0...v9.7.1) (2020-02-19)
### Bug Fixes
* update index.html ([22386b0](https://github.com/harttle/liquidjs/commit/22386b0))
# [9.7.0](https://github.com/harttle/liquidjs/compare/v9.6.2...v9.7.0) (2020-02-07)
### Bug Fixes
* expression and string literal parser, [#186](https://github.com/harttle/liquidjs/issues/186) ([fc0cf6f](https://github.com/harttle/liquidjs/commit/fc0cf6f))
### Features
* globals shared between tags, see [#185](https://github.com/harttle/liquidjs/issues/185) ([870e7ec](https://github.com/harttle/liquidjs/commit/870e7ec))
## [9.6.2](https://github.com/harttle/liquidjs/compare/v9.6.1...v9.6.2) (2020-01-10)
### Performance Improvements
* prevent multiple case evaluations ([807e840](https://github.com/harttle/liquidjs/commit/807e840))
## [9.6.1](https://github.com/harttle/liquidjs/compare/v9.6.0...v9.6.1) (2020-01-04)
### Bug Fixes
* add `this` to fs references in parseFile ([4b079c5](https://github.com/harttle/liquidjs/commit/4b079c5))
# [9.6.0](https://github.com/harttle/liquidjs/compare/v9.5.0...v9.6.0) (2019-12-15)
### Features
* full syntax for strftime, close [#177](https://github.com/harttle/liquidjs/issues/177) ([ba5ff3f](https://github.com/harttle/liquidjs/commit/ba5ff3f))
# [9.5.0](https://github.com/harttle/liquidjs/compare/v9.4.2...v9.5.0) (2019-12-12)
### Features
* nested property for the `where` filter, [#178](https://github.com/harttle/liquidjs/issues/178) ([60ec74f](https://github.com/harttle/liquidjs/commit/60ec74f))
## [9.4.2](https://github.com/harttle/liquidjs/compare/v9.4.1...v9.4.2) (2019-11-15)
### Bug Fixes
* reading .first, .last of Array, closes [#175](https://github.com/harttle/liquidjs/issues/175) ([f82da11](https://github.com/harttle/liquidjs/commit/f82da11))
## [9.4.1](https://github.com/harttle/liquidjs/compare/v9.4.0...v9.4.1) (2019-11-15)
### Bug Fixes
* remove node dependencies for esm bundle, see [#173](https://github.com/harttle/liquidjs/issues/173) ([04df929](https://github.com/harttle/liquidjs/commit/04df929))
# [9.4.0](https://github.com/harttle/liquidjs/compare/v9.3.1...v9.4.0) (2019-11-14)
### Features
* add ability to pass JSON context to CLI ([9504e4e](https://github.com/harttle/liquidjs/commit/9504e4e))
## [9.3.1](https://github.com/harttle/liquidjs/compare/v9.3.0...v9.3.1) (2019-11-09)
### Bug Fixes
* liquidjs command in /bin/liquid.js, fixes [#169](https://github.com/harttle/liquidjs/issues/169) ([0073b90](https://github.com/harttle/liquidjs/commit/0073b90))
# [9.3.0](https://github.com/harttle/liquidjs/compare/v9.2.0...v9.3.0) (2019-11-07)
### Features
* support require.resolve for lookup, see [#168](https://github.com/harttle/liquidjs/issues/168) ([2dd4355](https://github.com/harttle/liquidjs/commit/2dd4355))
## [9.1.1](https://github.com/harttle/liquidjs/compare/v9.1.0...v9.1.1) (2019-10-10)
### Performance Improvements
* add string flattening to reduce retained memory (node only) ([3ad512c](https://github.com/harttle/liquidjs/commit/3ad512c))
# [9.1.0](https://github.com/harttle/liquidjs/compare/v9.0.1...v9.1.0) (2019-10-07)
### Features
* alias getTemplate() to parseFile() ([6b83788](https://github.com/harttle/liquidjs/commit/6b83788))
## [9.0.1](https://github.com/harttle/liquidjs/compare/v9.0.0...v9.0.1) (2019-10-02)
### Bug Fixes
* `unless` content is not waited, fixes [#160](https://github.com/harttle/liquidjs/issues/160) ([d2c8d13](https://github.com/harttle/liquidjs/commit/d2c8d13))
# [9.0.0](https://github.com/harttle/liquidjs/compare/v8.5.3...v9.0.0) (2019-08-26)
### Bug Fixes
* break/continue omitting output before them, [#123](https://github.com/harttle/liquidjs/issues/123) ([ae45c46](https://github.com/harttle/liquidjs/commit/ae45c46))
* reactjs demo during yarn install, fixes [#145](https://github.com/harttle/liquidjs/issues/145) ([b65df44](https://github.com/harttle/liquidjs/commit/b65df44))
### Code Refactoring
* return value of Tag#render is no longer used ([8028f82](https://github.com/harttle/liquidjs/commit/8028f82))
### Features
* renderSync, parseAndRenderSync and renderFileSync, see [#48](https://github.com/harttle/liquidjs/issues/48) ([7fb01ad](https://github.com/harttle/liquidjs/commit/7fb01ad))
### Performance Improvements
* target to es6, fixes [#137](https://github.com/harttle/liquidjs/issues/137) ([3b9fc7e](https://github.com/harttle/liquidjs/commit/3b9fc7e))
### BREAKING CHANGES
* Tag#render now returns void, use emitter argument
to write rendered html.
* ship to Node.js 8, the dist/liquid.cjs.js (main) nolonger
supports Node.js 6, other bundles are also provided via dist/liquid.esm.js, dist/liquid.js (ES5 umd) and liquid.min.js (minified ES5 umd)
* remove default export, now should be used like import
{Liquid} from 'liquidjs'
## [8.5.3](https://github.com/harttle/liquidjs/compare/v8.5.2...v8.5.3) (2019-08-25)
### Bug Fixes
* escape filter when input is undefined ([a00945c](https://github.com/harttle/liquidjs/commit/a00945c))
## [8.5.2](https://github.com/harttle/liquidjs/compare/v8.5.1...v8.5.2) (2019-08-09)
### Bug Fixes
* quotation tokenizing, [#151](https://github.com/harttle/liquidjs/issues/151) ([1e4f237](https://github.com/harttle/liquidjs/commit/1e4f237))
## [8.5.1](https://github.com/harttle/liquidjs/compare/v8.5.0...v8.5.1) (2019-08-05)
### Bug Fixes
* publish bin directory to npm, fixes [#146](https://github.com/harttle/liquidjs/issues/146) ([a85b650](https://github.com/harttle/liquidjs/commit/a85b650))
# [8.5.0](https://github.com/harttle/liquidjs/compare/v8.4.1...v8.5.0) (2019-08-01)
### Features
* CLI support ([fc045b5](https://github.com/harttle/liquidjs/commit/fc045b5))
## [8.4.1](https://github.com/harttle/liquidjs/compare/v8.4.0...v8.4.1) (2019-07-22)
### Bug Fixes
* some filters on undefined variable throws, [#140](https://github.com/harttle/liquidjs/issues/140) ([6e6ea0a](https://github.com/harttle/liquidjs/commit/6e6ea0a))
# [8.4.0](https://github.com/harttle/liquidjs/compare/v8.3.0...v8.4.0) (2019-07-06)
### Features
* at_least, at_most, sort_naturual for [#132](https://github.com/harttle/liquidjs/issues/132) ([e6f5f1c](https://github.com/harttle/liquidjs/commit/e6f5f1c))
# [8.3.0](https://github.com/harttle/liquidjs/compare/v8.2.4...v8.3.0) (2019-06-27)
### Features
* fs option implemented by [#138](https://github.com/harttle/liquidjs/issues/138) ([3f5e23c](https://github.com/harttle/liquidjs/commit/3f5e23c))
## [8.2.4](https://github.com/harttle/liquidjs/compare/v8.2.3...v8.2.4) (2019-06-17)
### Performance Improvements
* improve getTemplate() when cache is enabled ([1ffba2b](https://github.com/harttle/liquidjs/commit/1ffba2b))
## [8.2.3](https://github.com/harttle/liquidjs/compare/v8.2.2...v8.2.3) (2019-05-19)
### Bug Fixes
* reverse filter not pure, see [#126](https://github.com/harttle/liquidjs/issues/126) ([505c408](https://github.com/harttle/liquidjs/commit/505c408))
## [8.2.2](https://github.com/harttle/liquidjs/compare/v8.2.1...v8.2.2) (2019-05-12)
### Bug Fixes
* date from integer, [#125](https://github.com/harttle/liquidjs/issues/125) ([fdf0043](https://github.com/harttle/liquidjs/commit/fdf0043))
* pass drops directly to filters/tags ([bef2909](https://github.com/harttle/liquidjs/commit/bef2909))
## [8.2.1](https://github.com/harttle/liquidjs/compare/v8.2.0...v8.2.1) (2019-04-26)
### Bug Fixes
* `default` filter is not working with an empty string, [#122](https://github.com/harttle/liquidjs/issues/122) ([6075c0a](https://github.com/harttle/liquidjs/commit/6075c0a))
# [8.2.0](https://github.com/harttle/liquidjs/compare/v8.1.0...v8.2.0) (2019-04-17)
### Features
* pass context to filters ([00bc1ef](https://github.com/harttle/liquidjs/commit/00bc1ef))
# [8.1.0](https://github.com/harttle/liquidjs/compare/v8.0.3...v8.1.0) (2019-04-02)
### Features
* where filter, working on [#118](https://github.com/harttle/liquidjs/issues/118) ([daa0b57](https://github.com/harttle/liquidjs/commit/daa0b57))
## [8.0.3](https://github.com/harttle/liquidjs/compare/v8.0.2...v8.0.3) (2019-04-01)
### Bug Fixes
* slice filter on negative `begin`, [#117](https://github.com/harttle/liquidjs/issues/117) ([eadb6f3](https://github.com/harttle/liquidjs/commit/eadb6f3))
## [8.0.2](https://github.com/harttle/liquidjs/compare/v8.0.1...v8.0.2) (2019-03-25)
### Performance Improvements
* use polymophism instead duck test ([82d7673](https://github.com/harttle/liquidjs/commit/82d7673))
## [8.0.1](https://github.com/harttle/liquidjs/compare/v8.0.0...v8.0.1) (2019-03-22)
### Bug Fixes
* incorrect scope when using assign with for, fixes [#115](https://github.com/harttle/liquidjs/issues/115) ([defbb58](https://github.com/harttle/liquidjs/commit/defbb58))
# [8.0.0](https://github.com/harttle/liquidjs/compare/v7.5.1...v8.0.0) (2019-03-10)
### Code Refactoring
* use camelCase for JavaScript APIs ([64e0c87](https://github.com/harttle/liquidjs/commit/64e0c87))
### Features
* promise support for drops, working on [#65](https://github.com/harttle/liquidjs/issues/65) ([4a8088d](https://github.com/harttle/liquidjs/commit/4a8088d))
### BREAKING CHANGES
* Options and method names in JavaScript API are now renamed to cammelCase, for a complete list see #109
## [7.5.1](https://github.com/harttle/liquidjs/compare/v7.5.0...v7.5.1) (2019-03-05)
### Bug Fixes
* named params for filters, working on [#113](https://github.com/harttle/liquidjs/issues/113) ([5ffc904](https://github.com/harttle/liquidjs/commit/5ffc904))
# [7.5.0](https://github.com/harttle/liquidjs/compare/v7.4.0...v7.5.0) (2019-03-01)
### Features
* tablerowloop object ([3647305](https://github.com/harttle/liquidjs/commit/3647305))
# [7.4.0](https://github.com/harttle/liquidjs/compare/v7.3.1...v7.4.0) (2019-02-28)
### Bug Fixes
* math filters now return number, resolves [#110](https://github.com/harttle/liquidjs/issues/110) ([b4acdb4](https://github.com/harttle/liquidjs/commit/b4acdb4))
### Features
* exported Drop interface for [#107](https://github.com/harttle/liquidjs/issues/107) ([7bee9fc](https://github.com/harttle/liquidjs/commit/7bee9fc)), closes [#109](https://github.com/harttle/liquidjs/issues/109)
## [7.3.1](https://github.com/harttle/liquidjs/compare/v7.3.0...v7.3.1) (2019-02-25)
### Bug Fixes
* **#108:** remove absolute path in emitted d.ts ([53a835a](https://github.com/harttle/liquidjs/commit/53a835a)), closes [#108](https://github.com/harttle/liquidjs/issues/108)
# [7.3.0](https://github.com/harttle/liquidjs/compare/v7.2.2...v7.3.0) (2019-02-24)
+93 -237
View File
@@ -1,280 +1,136 @@
# liquidjs
[![npm](https://img.shields.io/npm/v/liquidjs.svg)](https://www.npmjs.org/package/liquidjs)
[![npm](https://img.shields.io/npm/dm/liquidjs.svg)](https://www.npmjs.org/package/liquidjs)
[![npm version](https://img.shields.io/npm/v/liquidjs.svg)](https://www.npmjs.org/package/liquidjs)
[![downloads](https://img.shields.io/npm/dm/liquidjs.svg)](https://www.npmjs.org/package/liquidjs)
[![Build Status](https://travis-ci.org/harttle/liquidjs.svg?branch=master)](https://travis-ci.org/harttle/liquidjs)
[![Coveralls](https://img.shields.io/coveralls/harttle/liquidjs.svg)](https://coveralls.io/github/harttle/liquidjs?branch=master)
[![dependencies](https://img.shields.io/david/harttle/liquidjs.svg)](https://david-dm.org/harttle/liquidjs)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/harttle/liquidjs)
[![GitHub issues](https://img.shields.io/github/issues-closed/harttle/liquidjs.svg)](https://github.com/harttle/liquidjs/issues)
[![GitHub contributors](https://img.shields.io/github/contributors/harttle/liquidjs.svg)](https://github.com/harttle/liquidjs/graphs/contributors)
[![David](https://img.shields.io/david/harttle/liquidjs.svg)](https://david-dm.org/harttle/liquidjs)
[![David Dev](https://img.shields.io/david/dev/harttle/liquidjs.svg)](https://david-dm.org/harttle/liquidjs?type=dev)
[![DUB](https://img.shields.io/dub/l/vibe-d.svg)](https://github.com/harttle/liquidjs/blob/master/LICENSE)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://github.com/harttle/liquidjs)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/harttle/liquidjs)
[![DUB license](https://img.shields.io/dub/l/vibe-d.svg)](https://github.com/harttle/liquidjs/blob/master/LICENSE)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits)
[![open collective](https://img.shields.io/opencollective/all/liquidjs)](https://opencollective.com/liquidjs)
This is a liquid implementation for both Node.js and browsers. Website: <http://harttle.github.io/liquidjs/>, Live Demo: <https://jsfiddle.net/6u40xbzs/>
A [shopify][shopify/liquid] compatible [Liquid][tutorial] template engine in pure JavaScript.
**The purpose of this repo** is to provide a standard Liquid implementation for the JavaScript community.
All features, filters and tags in [shopify/liquid](https://github.com/Shopify/liquid) are supposed to be built in LiquidJS,
though there are still some differences and limitations (see below).
**Features**
> Version 9 has published, [see how to migrate to 9.0.0](https://github.com/harttle/liquidjs/wiki/Migrate-to-9)!
* Fully compatible to [shopify][shopify/liquid], with all [tags][tags] and [filters][filters] implemented
* Support layout(extend) and include syntax
* In pure JavaScript with Promise-based API
## Get Started
**Differences**
Though being compatible with [Ruby Liquid](https://github.com/shopify/liquid) is one of our priorities, there're still certain differences. You may need some configuration to get it compatible in these senarios:
* Dynamic file locating (enabled by default), which means layout/partial name can be an variable in liquidjs. See [#51](https://github.com/harttle/liquidjs/issues/51).
* Truthy and Falsy. All values except `undefined`, `null`, `false` are truthy, whereas in Ruby Liquid all except `nil` and `false` are truthy. See [#26](https://github.com/harttle/liquidjs/pull/26).
* Number Rendering. Since JavaScript do not distinguish `float` and `integer`, we cannot either convert between them nor render regarding to their type. See [#59](https://github.com/harttle/liquidjs/issues/59).
* [.to_liquid()](https://github.com/Shopify/liquid/wiki/Introduction-to-Drops) has a `.toLiquid()` alias and and the JavaScript `.toString()` is aliased to `.to_s()`.
* [.to_s()](https://www.rubydoc.info/gems/liquid/Liquid/Drop) uses `JSON.prototype.stringify` as default, rather than Ruby's inspect.
## TOC
* Usage
* [Render from String](#render-from-string)
* [Render from File](#render-from-file)
* [Use with Express.js](#use-with-expressjs)
* [Use in Browser](#use-in-browser)
* [Include Partials](#include-partials)
* [Layout Templates (Extends)](#layout-templates-extends)
* API Spec
* [Constructor Options](#options)
* [Register Filters](#register-filters), [Builtin Filters](https://github.com/harttle/liquidjs/wiki/Builtin-Filters)
* [Register Tags](#register-tags), [Builtin Tags](https://github.com/harttle/liquidjs/wiki/Builtin-Tags)
* [Operators](https://github.com/harttle/liquidjs/wiki/Operators)
* [Whitespace Control](https://github.com/harttle/liquidjs/wiki/Whitespace-Control)
* [Contribute Guidelines](#contribute-guidelines)
## Render from String
Install as Node.js dependency:
Install via npm:
```bash
# You'll need a promise-polyfill for Node.js < 4
npm install --save liquidjs
```
Parse and Render:
```javascript
var Liquid = require('liquidjs');
var { Liquid } = require('liquidjs');
var engine = new Liquid();
engine
.parseAndRender('{{name | capitalize}}', {name: 'alice'})
.then(console.log);
// outputs 'Alice'
.then(console.log); // outputs 'Alice'
```
Caching templates:
Or include the UMD build, a live demo is available on jsfiddle: <https://jsfiddle.net/x43eb0z6/>. You may need a [Promise polyfill][pp] for Node.js &lt; 4 and ES5 browsers like [IE and Android UC][caniuse-promises].
```javascript
var tpl = engine.parse('{{name | capitalize}}');
engine
.render(tpl, {name: 'alice'})
.then(console.log);
// outputs 'Alice'
```html
<script src="//unpkg.com/liquidjs/dist/liquid.min.js"></script> <!--for production-->
<script src="//unpkg.com/liquidjs/dist/liquid.js"></script> <!--for development-->
```
## Render from File
Also available from CLI:
```javascript
var engine = new Liquid({
root: path.resolve(__dirname, 'views/'), // dirs to lookup layouts/includes
extname: '.liquid' // the extname used for layouts/includes, defaults ""
});
engine.renderFile("hello.liquid", {name: 'alice'})
.then(console.log) // outputs "Alice"
// which is equivalent to:
engine
.renderFile("hello", {name: 'alice'})
.then(console.log) // outputs "Alice"
```bash
echo '{{"hello" | capitalize}}' | npx liquidjs
```
## Use with Express.js
For detailed documents, see:
```javascript
// register liquid engine
app.engine('liquid', engine.express());
app.set('views', './views'); // specify the views directory
app.set('view engine', 'liquid'); // set to default
```
* The [Wiki Page](https://github.com/harttle/liquidjs/wiki) contains tutorials and advanced topics.
* The [API Reference](https://harttle.github.io/liquidjs/classes/_liquid_.liquid.html) provides detailed descriptions for classes, methods and properties.
[Here](demo/express/)'s an Express demo. When used with Express.js,
Express [`views`][express-views] will be included when looking up
partials(includes and layouts).
## Differences and Limitations
## Use in Browser
* Dynamic file locating (enabled by default), that means layout/partial names are treated as variables in liquidjs. See [#51](https://github.com/harttle/liquidjs/issues/51).
* Truthy and Falsy. All values except `undefined`, `null`, `false` are truthy, whereas in Ruby Liquid all except `nil` and `false` are truthy. See [#26](https://github.com/harttle/liquidjs/pull/26).
* Number. In JavaScript we cannot distinguish or convert between `float` and `integer`, see [#59](https://github.com/harttle/liquidjs/issues/59). And when applied `size` filter, numbers always return 0, which is 8 for integer in ruby, cause they do not have a `length` property.
* [.to_liquid()](https://github.com/Shopify/liquid/wiki/Introduction-to-Drops) is replaced by `.toLiquid()`
* [.to_s()](https://www.rubydoc.info/gems/liquid/Liquid/Drop) is replaced by JavaScript `.toString()`
You can get a dist file for browsers from
Features that available on shopify website but not on shopify/liquid repo will not be implemented in this repo,
but there're some plugins available: <https://github.com/harttle/liquidjs/wiki/Plugins>
* [Releases][releases] page for liquidjs, or
* unpkg.com: <https://unpkg.com/liquidjs/dist/liquid.min.js>
## Related Packages
Here's the demo:
* JSFiddle: <https://jsfiddle.net/6u40xbzs/>
* Demo directory: [/demo/browser/](demo/browser/).
Note: For [IE and Android UC][caniuse-promises] browser, you will need a [Promise polyfill][pp].
## Include Partials
```
// file: color.liquid
color: '{{ color }}' shape: '{{ shape }}'
// file: theme.liquid
{% assign shape = 'circle' %}
{% include 'color' %}
{% include 'color' with 'red' %}
{% include 'color', color: 'yellow', shape: 'square' %}
```
The output will be:
```
color: '' shape: 'circle'
color: 'red' shape: 'circle'
color: 'yellow' shape: 'square'
```
## Layout Templates (Extends)
```
// file: default-layout.liquid
Header
{% block content %}My default content{% endblock %}
Footer
// file: page.liquid
{% layout "default-layout" %}
{% block content %}My page content{% endblock %}
```
The output of `page.liquid`:
```
Header
My page content
Footer
```
* It's possible to define multiple blocks.
* block name is optional when there's only one block.
## Options
The full list of options for `Liquid()` is listed as following:
* `root` is a directory or an array of directories to resolve layouts and includes, as well as the filename passed in when calling `.renderFile()`.
If an array, the files are looked up in the order they occur in the array.
Defaults to `["."]`
* `extname` is used to lookup the template file when filepath doesn't include an extension name. Eg: setting to `".html"` will allow including file by basename. Defaults to `""`.
* `cache` indicates whether or not to cache resolved templates. Defaults to `false`.
* `dynamicPartials`: if set, treat `<filepath>` parameter in `{%include filepath %}`, `{%layout filepath%}` as a variable, otherwise as a literal value. Defaults to `true`.
* `strict_filters` is used to enable strict filter existence. If set to `false`, undefined filters will be rendered as empty string. Otherwise, undefined filters will cause an exception. Defaults to `false`.
* `strict_variables` is used to enable strict variable derivation.
If set to `false`, undefined variables will be rendered as empty string.
Otherwise, undefined variables will cause an exception. Defaults to `false`.
* `trim_tag_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of tags (`{% %}`) until `\n` (inclusive). Defaults to `false`.
* `trim_tag_left` is similiar to `trim_tag_right`, whereas the `\n` is exclusive. Defaults to `false`. See [Whitespace Control][whitespace control] for details.
* `trim_output_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of values (`{{ }}`) until `\n` (inclusive). Defaults to `false`.
* `trim_output_left` is similiar to `trim_output_right`, whereas the `\n` is exclusive. Defaults to `false`. See [Whitespace Control][whitespace control] for details.
* `tag_delimiter_left` and `tag_delimiter_right` are used to override the delimiter for liquid tags.
* `output_delimiter_left` and `output_delimiter_right` are used to override the delimiter for liquid outputs.
* `greedy` is used to specify whether `trim_left`/`trim_right` is greedy. When set to `true`, all consecutive blank characters including `\n` will be trimed regardless of line breaks. Defaults to `true`.
## Register Filters
```javascript
// Usage: {{ name | uppper }}
engine.registerFilter('upper', v => v.toUpperCase())
```
Filter arguments will be passed to the registered filter function, for example:
```javascript
// Usage: {{ 1 | add: 2, 3 }}
engine.registerFilter('add', (initial, arg1, arg2) => initial + arg1 + arg2)
```
See existing filter implementations here: <https://github.com/harttle/liquidjs/tree/master/src/builtin/filters>
## Register Tags
```javascript
// Usage: {% upper name%}
engine.registerTag('upper', {
parse: function(tagToken, remainTokens) {
this.str = tagToken.args; // name
},
render: function(scope, hash) {
var str = Liquid.evalValue(this.str, scope); // 'alice'
return Promise.resolve(str.toUpperCase()); // 'Alice'
}
});
```
* `parse`: Read tokens from `remainTokens` until your end token.
* `render`: Combine scope data with your parsed tokens into HTML string.
See existing tag implementations here: <https://github.com/harttle/liquidjs/tree/master/src/builtin/tags>
## Plugin API
A pack of tags or filters can be encapsulated into a **plugin**, which will be typically installed via npm.
```javascript
engine.plugin(require('./some-plugin'));
// some-plugin.js
module.exports = function (Liquid) {
// here `this` refers to the engine instance
// `Liquid` provides facilities to implement tags and filters
this.registerFilter('foo', x => x);
}
```
Plugin List:
* To add your plugin, contact me or simply send a PR.
* [gulp-liquidjs](https://www.npmjs.com/package/@tuanpham-dev/gulp-liquidjs): A shopify compatible Liquid template engine for Gulp using liquidjs.
* [grunt-liquify](https://www.npmjs.com/package/grunt-liquify): A Grunt task to process Liquid using liquidjs. Use it to add Liquid magic to your scripts and css assets.
* [react-liquid](https://github.com/aquibm/react-liquid#readme): Liquid templating language component for React
* [@11ty/eleventy](https://www.npmjs.com/package/@11ty/eleventy): A simpler static site generator. An alternative to Jekyll. Written in JavaScript. Transforms a directory of templates (of varying types) into HTML.
## Contribute Guidelines
This repo uses [eslint](https://eslint.org/) to check code style, [semantic-release](https://github.com/semantic-release/semantic-release) to generate changelog and publish to npm and Github Releases.
* **Code Style**: <https://github.com/standard/eslint-config-standard>, `npm run lint` to check locally.
* **Testing**: make sure test cases still pass, use `npm test` to check locally.
* **Commit Message**: align to [The Angular Commit Message Guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits), especially the [Type identifier](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#type), to allow the semantic-release bot do the work.
* Code Style: <https://github.com/standard/eslint-config-standard>, `npm run lint` to check locally.
* Commit Message: <https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits>
## Contributors ✨
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any [kind](https://allcontributors.org/docs/en/emoji-key) are welcome!
Thanks goes to these wonderful people:
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://harttle.land"><img src="https://avatars3.githubusercontent.com/u/4427974?v=4" width="100px;" alt=""/><br /><sub><b>Jun Yang</b></sub></a><br /><a href="#maintenance-harttle" title="Maintenance">🚧</a> <a href="https://github.com/harttle/liquidjs/commits?author=harttle" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/chenos"><img src="https://avatars0.githubusercontent.com/u/2993310?v=4" width="100px;" alt=""/><br /><sub><b>chenos</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=chenos" title="Code">💻</a></td>
<td align="center"><a href="https://zachleat.com/"><img src="https://avatars2.githubusercontent.com/u/39355?v=4" width="100px;" alt=""/><br /><sub><b>Zach Leatherman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/issues?q=author%3Azachleat" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/thardy"><img src="https://avatars3.githubusercontent.com/u/120636?v=4" width="100px;" alt=""/><br /><sub><b>Tim Hardy</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thardy" title="Code">💻</a></td>
<td align="center"><a href="https://paulrobertlloyd.com/"><img src="https://avatars3.githubusercontent.com/u/813383?v=4" width="100px;" alt=""/><br /><sub><b>Paul Robert Lloyd</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=paulrobertlloyd" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/issues?q=author%3Apaulrobertlloyd" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://twitter.com/alecdotbiz"><img src="https://avatars2.githubusercontent.com/u/1925840?v=4" width="100px;" alt=""/><br /><sub><b>Alec Larson</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=aleclarson" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/pmalouin"><img src="https://avatars1.githubusercontent.com/u/1411117?v=4" width="100px;" alt=""/><br /><sub><b>Patrick Malouin</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=pmalouin" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/commits?author=pmalouin" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="https://jaswrks.com"><img src="https://avatars3.githubusercontent.com/u/1563559?v=4" width="100px;" alt=""/><br /><sub><b>jaswrks</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=jaswrks" title="Code">💻</a></td>
<td align="center"><a href="https://oott123.com"><img src="https://avatars2.githubusercontent.com/u/905663?v=4" width="100px;" alt=""/><br /><sub><b>三三</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=oott123" title="Code">💻</a> <a href="#ideas-oott123" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/ssendev"><img src="https://avatars0.githubusercontent.com/u/450793?v=4" width="100px;" alt=""/><br /><sub><b>ssendev</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ssendev" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/commits?author=ssendev" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/wojtask9"><img src="https://avatars3.githubusercontent.com/u/6099236?v=4" width="100px;" alt=""/><br /><sub><b>wojtask9</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=wojtask9" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/thelornenelson"><img src="https://avatars3.githubusercontent.com/u/24596583?v=4" width="100px;" alt=""/><br /><sub><b>Andrew Barclay</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thelornenelson" title="Code">💻</a></td>
<td align="center"><a href="https://www.stam.pr/"><img src="https://avatars2.githubusercontent.com/u/142338?v=4" width="100px;" alt=""/><br /><sub><b>Cory Mawhorter</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=cmawhorter" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/thehappybug"><img src="https://avatars0.githubusercontent.com/u/3393530?v=4" width="100px;" alt=""/><br /><sub><b>Mehdi Jaffery</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thehappybug" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/robinbijlani"><img src="https://avatars0.githubusercontent.com/u/2503108?v=4" width="100px;" alt=""/><br /><sub><b>Robin Bijlani</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=robinbijlani" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/issues?q=author%3Arobinbijlani" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://www.rmkennedy.com"><img src="https://avatars3.githubusercontent.com/u/8356669?v=4" width="100px;" alt=""/><br /><sub><b>Ryan Kennedy</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ryaninvents" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/strax"><img src="https://avatars2.githubusercontent.com/u/587213?v=4" width="100px;" alt=""/><br /><sub><b>Sami Kukkonen</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=strax" title="Code">💻</a></td>
<td align="center"><a href="https://ScottFreeCode.github.io/"><img src="https://avatars3.githubusercontent.com/u/16506071?v=4" width="100px;" alt=""/><br /><sub><b>Scott Santucci</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ScottFreeCode" title="Code">💻</a></td>
<td align="center"><a href="http://stevenrescigno.com"><img src="https://avatars3.githubusercontent.com/u/8505293?v=4" width="100px;" alt=""/><br /><sub><b>Steven </b></sub></a><br /><a href="#example-stevenanthonyrevo" title="Examples">💡</a> <a href="https://github.com/harttle/liquidjs/commits?author=stevenanthonyrevo" title="Code">💻</a></td>
<td align="center"><a href="https://efcl.info/"><img src="https://avatars1.githubusercontent.com/u/19714?v=4" width="100px;" alt=""/><br /><sub><b>azu</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=azu" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/wyozi"><img src="https://avatars3.githubusercontent.com/u/4894573?v=4" width="100px;" alt=""/><br /><sub><b>Joonas</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=wyozi" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/jamelait"><img src="https://avatars1.githubusercontent.com/u/14369255?v=4" width="100px;" alt=""/><br /><sub><b>Jamel A.</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=jamelait" title="Code">💻</a></td>
<td align="center"><a href="https://brandonpittman.net"><img src="https://avatars0.githubusercontent.com/u/967145?v=4" width="100px;" alt=""/><br /><sub><b>Brandon Pittman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=brandonpittman" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/tgrandgent"><img src="https://avatars3.githubusercontent.com/u/17069042?v=4" width="100px;" alt=""/><br /><sub><b>tgrandgent</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=tgrandgent" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/mastodon0"><img src="https://avatars1.githubusercontent.com/u/7924332?v=4" width="100px;" alt=""/><br /><sub><b>Martin Schuster</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=mastodon0" title="Code">💻</a></td>
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
[![donate to liquidjs collective](https://opencollective.com/webpack/donate/[email protected]?color=blue)](https://opencollective.com/liquidjs/donate)
[nunjucks]: http://mozilla.github.io/nunjucks/
[liquid-node]: https://github.com/sirlantis/liquid-node
[shopify/liquid]: https://shopify.github.io/liquid/
[jekyll]: http://jekyllrb.com/
[gh]: https://pages.github.com/
[releases]: https://github.com/harttle/liquidjs/releases
[any-promise]: https://github.com/kevinbeaty/any-promise
[test]: https://github.com/harttle/liquidjs/tree/master/test
[caniuse-promises]: http://caniuse.com/#feat=promises
[whitespace control]: https://github.com/harttle/liquidjs/wiki/Whitespace-Control
[tags]: https://github.com/harttle/liquidjs/wiki/Builtin-Tags
[filters]: https://github.com/harttle/liquidjs/wiki/Builtin-Filters
[express-views]: http://expressjs.com/en/guide/using-template-engines.html
[pp]: https://github.com/taylorhakes/promise-polyfill
[tutorial]: https://shopify.github.io/liquid/basics/introduction/
+5 -7
View File
@@ -1,7 +1,5 @@
import * as Benchmark from 'benchmark'
import Liquid from 'src/liquid'
import TagToken from 'src/parser/tag-token'
import Scope from 'src/scope/scope'
import { Context, TagToken, Liquid } from '../src/liquid'
const engine = new Liquid({
root: __dirname,
@@ -13,8 +11,8 @@ engine.registerTag('header', {
const [key, val] = token.args.split(':')
this[key] = val
},
render: function (scope: Scope) {
const title = this.liquid.evalValue(this.content, scope)
render: function (ctx: Context) {
const title = this.liquid.evalValue(this.content, ctx)
return `<h1>${title}</h1>`
}
})
@@ -34,13 +32,13 @@ const template = `
</ul>
`
export default function () {
export function demo () {
console.log('--- demo ---')
return new Promise(resolve => {
new Benchmark.Suite('demo')
.add('demo', {
defer: true,
fn: (d: any) => engine.parseAndRender(template, ctx).then(x => d.resolve(x))
fn: (d: any) => engine.parseAndRender(template, ctx).then((x: any) => d.resolve(x))
})
.on('cycle', (event: any) => console.log(String(event.target)))
.on('complete', resolve)
+7 -3
View File
@@ -1,11 +1,15 @@
import output from './output'
import tag from './tag'
import demo from './demo'
import { output } from './output'
import { tag } from './tag'
import { demo } from './demo'
import { layout } from './layout'
import { memory } from './memory'
async function main () {
await output()
await tag()
await demo()
await layout()
await memory()
}
main()
+36
View File
@@ -0,0 +1,36 @@
import * as Benchmark from 'benchmark'
import { Liquid } from '../src/liquid'
const engineOptions = {
root: __dirname,
extname: '.liquid'
}
const engine = new Liquid(engineOptions)
const cachingEngine = new Liquid({
...engineOptions,
cache: true
})
const template = `
{% layout "./templates/layout.liquid" %}
{% block body %}a small body{% endblock %}
`
export function layout () {
console.log('--- layout ---')
return new Promise(resolve => {
new Benchmark.Suite('layout')
.add('cache=false', {
defer: true,
fn: (d: any) => engine.parseAndRender(template, {}).then((x: any) => d.resolve(x))
})
.add('cache=true', {
defer: true,
fn: (d: any) => cachingEngine.parseAndRender(template, {}).then((x: any) => d.resolve(x))
})
.on('cycle', (event: any) => console.log(String(event.target)))
.on('complete', resolve)
.run({ 'async': true })
})
}
+32
View File
@@ -0,0 +1,32 @@
import { join } from 'path'
import { readFileSync } from 'fs'
import { getHeapStatistics } from 'v8'
import { Liquid } from '../src/liquid'
const engineOptions = {
root: __dirname,
extname: '.liquid'
}
const engine = new Liquid(engineOptions)
const templateString = readFileSync(join(__dirname, 'templates/lorem-html.liquid'), 'utf8')
const templateSizeKb = templateString.length / 1024
const NB_INSTANCES_TO_RETAIN = 250
export function memory () {
console.log('--- memory ---')
const initialUsedHeapSize = getHeapStatistics().used_heap_size
const templates = []
for (let i = 0; i < NB_INSTANCES_TO_RETAIN; i++) {
templates.push(engine.parse(templateString))
}
const finalUsedHeapSize = getHeapStatistics().used_heap_size
const heapDifference = finalUsedHeapSize - initialUsedHeapSize
const avgRetainedPerTemplate = (heapDifference / NB_INSTANCES_TO_RETAIN) / 1024
console.log(`retained memory for a ${templateSizeKb}KB template: ${avgRetainedPerTemplate}KB (${NB_INSTANCES_TO_RETAIN} samples)`)
}
+3 -3
View File
@@ -1,9 +1,9 @@
import * as Benchmark from 'benchmark'
import Liquid from '../src/liquid'
import { Liquid } from '../src/liquid'
const liquid = new Liquid()
export default function () {
export function output () {
console.log('--- output ---')
return new Promise(resolve => {
new Benchmark.Suite('output')
@@ -21,6 +21,6 @@ export default function () {
function test (str: string) {
return {
defer: true,
fn: (d: any) => liquid.parseAndRender(str).then(x => d.resolve(x))
fn: (d: any) => liquid.parseAndRender(str).then((x: any) => d.resolve(x))
}
}
+3 -3
View File
@@ -1,9 +1,9 @@
import * as Benchmark from 'benchmark'
import Liquid from '../src/liquid'
import { Liquid } from '../src/liquid'
const liquid = new Liquid()
export default function () {
export function tag () {
console.log('--- tag ---')
return new Promise(resolve => {
new Benchmark.Suite('tag')
@@ -25,6 +25,6 @@ export default function () {
function test (str: string) {
return {
defer: true,
fn: (d: any) => liquid.parseAndRender(str).then(x => d.resolve(x))
fn: (d: any) => liquid.parseAndRender(str).then((x: any) => d.resolve(x))
}
}
+2
View File
@@ -0,0 +1,2 @@
This is a barely empty layout with a body:
{% block body %}{% endblock %}
+38
View File
@@ -0,0 +1,38 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- You may use a different charset if needed -->
<title>Latin Lipsum - Courtesy generator.lorem-ipsum.info</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet, falli detraxit facilisis sit ex. Nec vidit nihil ut, vis utamur definitionem in. Ancillae phaedrum ut eos. Ne eam errem cotidieque.
</p>
<p>
Sit amet vitae referrentur ad, oportere necessitatibus vituperatoribus vim ne. Audiam quaeque nusquam ei eos, mel ex adhuc prompta complectitur. Decore voluptua cotidieque vel ei, veri novum persecuti te sea. Nisl novum sea cu. Dicta delicatissimi ut est. Et has eripuit impedit mediocrem.
</p>
<p>
Eu vim evertitur argumentum, pro legendos iudicabit voluptatibus ne. Ne alii nullam deserunt duo, vis no animal verterem. Ne quo veniam euripidis. Pri discere mentitum vituperatoribus ne. Meliore corrumpit vim at, has ea admodum convenire.
</p>
<p>
Ne mea alii detraxit electram, his ne epicurei gloriatur consetetur. Ex pro aeque omnes appareat, possit integre accommodare eu quo. Qui in porro molestiae, no sit equidem petentium patrioque, omnes voluptaria vim te. Odio quot rebum ad sed, ei sale reque inani sea.
</p>
<p>
At mea vidit petentium, mei lorem pertinacia signiferumque ne. Per eu dicam postea probatus, sea pericula accusamus omittantur ad. Id mei munere ullamcorper. Oportere ocurreret cu vel. Pri ne dicant soluta graecis, duis ponderum corrumpit sed eu, pro ei rebum vivendum.
</p>
<p>
Eum ea exerci sententiae constituam, ut lorem putant volutpat pro. Vix ex iudicabit salutatus principes, pri nisl erat ut, ne cum persius verterem phaedrum. Vix mundi vitae eu. Vel summo vocent albucius in. Qui omnis partem possim ex, wisi doctus efficiantur cu has. Aperiri denique ea pri, cum dissentias signiferumque eu. Per posse dissentiet necessitatibus id, omnis eleifend te mel.
</p>
<p>
Phaedrum erroribus adolescens ut nec, duo mutat viris id. In tale purto dolores sit, ei consul inermis est, his ea movet expetenda. Cibo scribentur id eam, per an quem iracundia, has erat zril solet eu. Falli fierent ne cum, eam placerat facilisis suscipiantur te. Id quo dicat tractatos definiebas, est copiosae splendide id.
</p>
<p>
Constituto neglegentur qui ne, eum ne putent phaedrum, no quod nominati consulatu per. Mei cu accusam principes interesset, vim fugit abhorreant eu, ludus feugait an sed. Clita expetendis definitionem has in, meis pericula no mea, soluta nemore cotidieque eos cu. Summo populo signiferumque pri eu, eum no labores democritum posidonium, pro ignota adipisci in. Tollit molestie id mei.
</p>
<p>
Ipsum impetus et eam, ei his epicuri instructior. Impedit ullamcorper vim an. Impedit ullamcorper vim an. Et eum senserit sententiae reprimique, quem detracto sententiae at sed, no inermis ocurreret rationibus sea pericula no.
</body></html>
+21
View File
@@ -0,0 +1,21 @@
{
"extends": ["standard"],
"env": {
"mocha": true,
"es6": true,
"browser": true,
"node": true
},
"plugins": [
"mocha",
"standard",
"promise"
],
"rules": {
"no-var": 2,
"prefer-const": 2,
"@typescript-eslint/no-var-requires": "off",
"no-unused-vars": "off",
"indent": "off"
}
}
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env node
function isQuote (c) {
return c === '"' || c === "'"
}
function isOperator (c) {
return '!=<>'.includes(c)
}
function isNumber (c) {
return c >= '0' && c <= '9'
}
function isCharacter (c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
}
function isVariable (c) {
return '_-?'.includes(c) || isCharacter(c) || isNumber(c)
}
function isBlank (c) {
return c === '\n' || c === '\t' || c === ' ' || c === '\r'
}
const types = []
for (let i = 0; i < 128; i++) {
const c = String.fromCharCode(i)
let n = 0
if (isVariable(c)) n |= 1
if (isOperator(c)) n |= 2
if (isBlank(c)) n |= 4
if (isQuote(c)) n |= 8
types.push(n)
}
console.log(`
const TYPES = '${types.join('')}'
const VARIABLE = 1
const OPERATOR = 2
const BLANK = 4
const QUOTE = 8
`.trim())
Executable
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env node
const Liquid = require('..').Liquid
const contextArg = process.argv.slice(2)[0]
let context = {}
if (contextArg) {
if (contextArg.endsWith('.json')) {
const fs = require('fs')
context = JSON.parse(fs.readFileSync(contextArg, 'utf8'))
} else {
context = JSON.parse(contextArg)
}
}
let tpl = ''
process.stdin.on('data', chunk => (tpl += chunk))
process.stdin.on('end', () => render(tpl))
async function render (tpl) {
const liquid = new Liquid()
const html = await liquid.parseAndRender(tpl, context)
process.stdout.write(html)
}
+1
View File
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
+9
View File
@@ -0,0 +1,9 @@
# LiquidJS for Browsers
## Get Started
```bash
cd demo/browser
npm install
npm start
```
-1
View File
@@ -1 +0,0 @@
<h2>Welcome to {{ name | capitalize}}, {% include 'date.html' %}</h2>
+4 -7
View File
@@ -8,22 +8,19 @@
<body>
<script>
var engine = new window.Liquid({
var Liquid = window.liquidjs.Liquid
var engine = new Liquid({
extname: '.html',
cache: true
});
var src = '<h2>Welcome to {{ name | capitalize}}, ' +
'access time: {{date|date: "%Y-%m-%d %H:%M:%S"}}&lt;/h2>';
var src = "<h2>Welcome to {{ name | capitalize}}, {% include 'date.html' %}</h2>";
var ctx = {
name: 'Liquid',
date: new Date()
};
engine.parseAndRender(src, ctx)
.then(function(html) {
return engine.renderFile('hello', ctx);
})
.then(function(html) {
document.body.innerHTML += html
document.body.innerHTML = html
});
</script>
</body>
-220
View File
@@ -1,220 +0,0 @@
{
"name": "liquidjs-demo-browser",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"async": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
"dev": true
},
"colors": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
"dev": true
},
"corser": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
"integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c=",
"dev": true
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"dev": true,
"requires": {
"ms": "2.1.1"
}
},
"ecstatic": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.1.tgz",
"integrity": "sha512-/rrctvxZ78HMI/tPIsqdvFKHHscxR3IJuKrZI2ZoUgkt2SiufyLFBmcco+aqQBIu6P1qBsUNG3drAAGLx80vTQ==",
"dev": true,
"requires": {
"he": "1.2.0",
"mime": "1.6.0",
"minimist": "1.2.0",
"url-join": "2.0.5"
}
},
"eventemitter3": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz",
"integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==",
"dev": true
},
"follow-redirects": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz",
"integrity": "sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==",
"dev": true,
"requires": {
"debug": "3.2.6"
}
},
"he": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true
},
"http-proxy": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz",
"integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==",
"dev": true,
"requires": {
"eventemitter3": "3.1.0",
"follow-redirects": "1.7.0",
"requires-port": "1.0.0"
}
},
"http-server": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/http-server/-/http-server-0.11.1.tgz",
"integrity": "sha512-6JeGDGoujJLmhjiRGlt8yK8Z9Kl0vnl/dQoQZlc4oeqaUoAKQg94NILLfrY3oWzSyFaQCVNTcKE5PZ3cH8VP9w==",
"dev": true,
"requires": {
"colors": "1.0.3",
"corser": "2.0.1",
"ecstatic": "3.3.1",
"http-proxy": "1.17.0",
"opener": "1.4.3",
"optimist": "0.6.1",
"portfinder": "1.0.20",
"union": "0.4.6"
}
},
"liquidjs": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-7.0.0.tgz",
"integrity": "sha512-/JL+VQUI++6iCS7JQ4fPPeji6vyvHCU/iuz2bLSiE0tn0eO3kf8GEyfaXnQUHSroy8SmJu7HQIvjvOErtYEvUg=="
},
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"dev": true
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
"minimist": "0.0.8"
},
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
}
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"dev": true
},
"opener": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz",
"integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=",
"dev": true
},
"optimist": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
"integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
"dev": true,
"requires": {
"minimist": "0.0.10",
"wordwrap": "0.0.3"
},
"dependencies": {
"minimist": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
"dev": true
}
}
},
"portfinder": {
"version": "1.0.20",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.20.tgz",
"integrity": "sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw==",
"dev": true,
"requires": {
"async": "1.5.2",
"debug": "2.6.9",
"mkdirp": "0.5.1"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
}
}
},
"qs": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-2.3.3.tgz",
"integrity": "sha1-6eha2+ddoLvkyOBHaghikPhjtAQ=",
"dev": true
},
"requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true
},
"union": {
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/union/-/union-0.4.6.tgz",
"integrity": "sha1-GY+9rrolTniLDvy2MLwR8kopWeA=",
"dev": true,
"requires": {
"qs": "2.3.3"
}
},
"url-join": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.5.tgz",
"integrity": "sha1-WvIvGMBSoACkjXuCxenC4v7tpyg=",
"dev": true
},
"wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
"dev": true
}
}
}
+3 -4
View File
@@ -1,6 +1,7 @@
{
"name": "liquidjs-demo-browser",
"version": "1.0.0",
"private": true,
"description": "Liquidjs Demo for Browser Usage",
"main": "index.html",
"scripts": {
@@ -8,10 +9,8 @@
},
"author": "harttle <[email protected]>",
"license": "ISC",
"devDependencies": {
"http-server": "^0.11.1"
},
"dependencies": {
"liquidjs": "^7.0.0"
"http-server": "^0.11.1",
"liquidjs": "*"
}
}
+9
View File
@@ -0,0 +1,9 @@
# LiquidJS for Express.js
## Get Started
```bash
cd demo/express
npm install
npm start
```
+1 -1
View File
@@ -1,5 +1,5 @@
const express = require('express')
const Liquid = require('../..')
const { Liquid } = require('liquidjs')
const app = express()
const engine = new Liquid({
+3 -1
View File
@@ -1,6 +1,7 @@
{
"name": "express-demo",
"version": "1.0.0",
"private": true,
"description": "Express Demo Using liquidjs",
"main": "index.js",
"scripts": {
@@ -10,6 +11,7 @@
"author": "harttle",
"license": "MIT",
"dependencies": {
"express": "^4.14.0"
"express": "^4.14.0",
"liquidjs": "*"
}
}
+9
View File
@@ -0,0 +1,9 @@
# LiquidJS for Node.js
## Get Started
```bash
cd demo/nodejs
npm install
npm start
```
+4 -4
View File
@@ -1,4 +1,4 @@
const Liquid = require('liquidjs')
const { Liquid } = require('liquidjs')
const engine = new Liquid({
root: __dirname,
@@ -10,9 +10,9 @@ engine.registerTag('header', {
const [key, val] = token.args.split(':')
this[key] = val
},
render: function (scope, hash) {
const title = this.liquid.evalValue(this.content, scope)
return `<h1>${title}</h1>`
render: async function (scope, hash, emitter) {
const title = await this.liquid.evalValue(this.content, scope)
emitter.write(`<h1>${title}</h1>`)
}
})
-12
View File
@@ -1,12 +0,0 @@
{
"name": "Node.js demo for liquidjs",
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"liquidjs": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-7.0.0.tgz",
"integrity": "sha512-/JL+VQUI++6iCS7JQ4fPPeji6vyvHCU/iuz2bLSiE0tn0eO3kf8GEyfaXnQUHSroy8SmJu7HQIvjvOErtYEvUg=="
}
}
}
+2 -1
View File
@@ -1,11 +1,12 @@
{
"name": "liquidjs-demo-nodejs",
"description": "Node.js demo for liquidjs",
"private": true,
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"liquidjs": "^7.0.0"
"liquidjs": "*"
}
}
+1
View File
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
+3
View File
@@ -0,0 +1,3 @@
{
"extends": ["react-app"]
}
-16737
View File
File diff suppressed because it is too large Load Diff
+1 -6
View File
@@ -3,10 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"dns": "^0.2.2",
"html-react-parser": "^0.4.7",
"liquidjs": "^6.0.1",
"path": "^0.12.7",
"liquidjs": "^9.1.0",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-promise": "^2.0.3",
@@ -18,9 +16,6 @@
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
+9 -32
View File
@@ -1,38 +1,17 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import tpl from './views/demo.liquid';
import Parser from 'html-react-parser';
import { engine } from './engine';
let path = require('path')
let Liquid = require('liquidjs');
export class App extends Component {
async componentDidMount() {
const html = await engine.renderFile(tpl.toString(), {name: 'alice', logo: logo })
this.setState({ html }) // outputs "Alice"
}
let config = require('./views/demo.liquid');
let pageConfig = config.toString()
let Parser = require('html-react-parser');
class App extends Component {
componentDidMount() {
let engine = new Liquid({
root: path.resolve(__dirname, 'views/'), // dirs to lookup layouts/includes
extname: '.liquid' // the extname used for layouts/includes, defaults
});
engine.registerFilter('image', d => {
let img = `<img src="${d}" class="App-logo" alt="logo"></img>`;
return img
})
engine.renderFile(pageConfig, {name: 'alice', logo: logo })
.then((htmlTemp) => {
this.setState({ html: htmlTemp })
}) // outputs "Alice"
}
state = {
html: []
}
state = { html: '' }
render() {
return (
@@ -42,5 +21,3 @@ state = {
);
}
}
export default App;
+41
View File
@@ -0,0 +1,41 @@
/*
* function Component with Hooks: Modify ./index.js to apply this file
*/
import React, { useState, useLayoutEffect } from 'react';
import './App.css';
import logo from './logo.svg';
import tplsrc from './views/showing-click-times.liquid';
import Parser from 'html-react-parser';
import { engine } from './engine';
import { Context } from './Context';
import { ClickButton } from './ClickButton';
const fetchTpl = engine.getTemplate(tplsrc.toString())
export function App() {
const [state, setState] = useState({
logo: logo,
name: 'alice',
clickCount: 0,
html: ''
});
useLayoutEffect(() => {
fetchTpl
.then(tpl => engine.render(tpl, state))
.then(html => setState({...state, html}))
}, [state.clickCount])
return (
<div className="App">
{Parser(`${state.html}`)}
<Context.Provider
value={{
count: () => setState({...state, clickCount: state.clickCount + 1})
}}
>
<ClickButton/>
</Context.Provider>
</div>
);
}
+5
View File
@@ -0,0 +1,5 @@
button {
position: fixed;
right: 20px;
bottom: 20px;
}
+15
View File
@@ -0,0 +1,15 @@
import './ClickButton.css';
import React from 'react';
import { Context } from './Context';
export function ClickButton() {
return (
<Context.Consumer>
{context => (
<button onClick={context.count}>
Click Here!
</button>
)}
</Context.Consumer>
);
};
+3
View File
@@ -0,0 +1,3 @@
import React from "react";
export const Context = React.createContext()
+12
View File
@@ -0,0 +1,12 @@
import path from 'path';
import { Liquid } from 'liquidjs';
export const engine = new Liquid({
root: path.resolve(__dirname, 'views/'), // dirs to lookup layouts/includes
extname: '.liquid' // the extname used for layouts/includes, defaults
});
engine.registerFilter('image', d => {
let img = `<img src="${d}" class="App-logo" alt="logo"></img>`;
return img
})
+2 -1
View File
@@ -1,8 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { App } from './App';
// import { App } from './AppWithHooks';
ReactDOM.render(<App />, document.getElementById('root'));
@@ -0,0 +1,14 @@
<header className="App-header">
{{ logo | image }}
<h2>Welcome {{name | capitalize}}</h2>
<p>Edit <code>src/App.js</code> and save to reload.</p>
<p>You have clicked {{clickCount}} times.</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
File diff suppressed because it is too large Load Diff
+11
View File
@@ -0,0 +1,11 @@
# LiquidJS for TypeScript
LiquidJS is written in TypeScript and type definitions are available in `liquidjs` package.
## Get Started
```bash
cd demo/typescript
npm install
npm start
```
+5 -5
View File
@@ -1,4 +1,4 @@
import Liquid from 'liquidjs'
import { Liquid, TagToken, Hash, Context, Emitter } from 'liquidjs'
const engine = new Liquid({
root: __dirname,
@@ -6,13 +6,13 @@ const engine = new Liquid({
})
engine.registerTag('header', {
parse: function (token) {
parse: function (token: TagToken) {
const [key, val] = token.args.split(':')
this[key] = val
},
render: function (scope, hash) {
const title = this.liquid.evalValue(this['content'], scope)
return `<h1>${title}</h1>`
render: async function (context: Context, hash: Hash, emitter: Emitter) {
const title = await this.liquid.evalValue(this['content'], context)
emitter.write(`<h1>${title}</h1>`)
}
})
-8701
View File
File diff suppressed because it is too large Load Diff
+3 -4
View File
@@ -1,14 +1,13 @@
{
"name": "liquidjs-demo-typescript",
"private": true,
"description": "TypeScript demo for liquidjs",
"main": "index.ts",
"scripts": {
"start": "ts-node index.ts"
},
"dependencies": {
"liquidjs": "^7.0.0"
},
"devDependencies": {
"ts-node": "^8.0.2"
"ts-node": "^8.0.2",
"liquidjs": "*"
}
}
-1
View File
@@ -1 +0,0 @@
export default function (): Promise<{}>;
-1
View File
@@ -1 +0,0 @@
export {};
-1
View File
@@ -1 +0,0 @@
export default function (): Promise<{}>;
-1
View File
@@ -1 +0,0 @@
export default function (): Promise<{}>;
-15
View File
@@ -1,15 +0,0 @@
declare const _default: {
'join': (v: any[], arg: string) => string;
'last': <T>(v: T[]) => T;
'first': <T>(v: T[]) => T;
'map': <T1, T2>(arr: {
[key: string]: T1;
}[], arg: string) => T1[];
'reverse': (v: any[]) => any[];
'sort': <T>(v: T[], arg: (lhs: T, rhs: T) => number) => T[];
'size': (v: string | any[]) => number;
'concat': <T1, T2>(v: T1[], arg: T2 | T2[]) => (T1 | T2)[];
'slice': <T>(v: T[], begin: number, length: number) => T[];
'uniq': <T>(arr: T[]) => T[];
};
export default _default;
-4
View File
@@ -1,4 +0,0 @@
declare const _default: {
'date': (v: string | Date, arg: string) => string | Date;
};
export default _default;
-8
View File
@@ -1,8 +0,0 @@
declare function escape(str: string): string;
declare const _default: {
'escape': typeof escape;
'escape_once': (str: string) => string;
'newline_to_br': (v: string) => string;
'strip_html': (v: string) => string;
};
export default _default;
-32
View File
@@ -1,32 +0,0 @@
declare const _default: {
'join': (v: any[], arg: string) => string;
'last': <T>(v: T[]) => T;
'first': <T>(v: T[]) => T;
'map': <T1, T2>(arr: {
[key: string]: T1;
}[], arg: string) => T1[];
'reverse': (v: any[]) => any[];
'sort': <T>(v: T[], arg: (lhs: T, rhs: T) => number) => T[];
'size': (v: string | any[]) => number;
'concat': <T1, T2>(v: T1[], arg: T2 | T2[]) => (T1 | T2)[];
'slice': <T>(v: T[], begin: number, length: number) => T[];
'uniq': <T>(arr: T[]) => T[];
'default': <T1, T2>(v: T1, arg: T2) => T1 | T2;
'date': (v: string | Date, arg: string) => string | Date;
'url_decode': (x: string) => string;
'url_encode': (x: string) => string;
'abs': (v: number) => number;
'ceil': (v: number) => number;
'divided_by': (v: number, arg: number) => number;
'floor': (v: number) => number;
'minus': (l: number, r: number) => string;
'modulo': (l: number, r: number) => string;
'round': (v: number, arg?: number) => number;
'plus': (l: number, r: number) => string;
'times': (v: number, arg: number) => number;
'escape': (str: string) => string;
'escape_once': (str: string) => string;
'newline_to_br': (v: string) => string;
'strip_html': (v: string) => string;
};
export default _default;
-12
View File
@@ -1,12 +0,0 @@
declare const _default: {
'abs': (v: number) => number;
'ceil': (v: number) => number;
'divided_by': (v: number, arg: number) => number;
'floor': (v: number) => number;
'minus': (l: number, r: number) => string;
'modulo': (l: number, r: number) => string;
'round': (v: number, arg?: number) => number;
'plus': (l: number, r: number) => string;
'times': (v: number, arg: number) => number;
};
export default _default;
-4
View File
@@ -1,4 +0,0 @@
declare const _default: {
'default': <T1, T2>(v: T1, arg: T2) => T1 | T2;
};
export default _default;
-5
View File
@@ -1,5 +0,0 @@
import { FilterImpl } from 'src/template/filter/filter-impl';
declare const _default: {
[key: string]: FilterImpl;
};
export default _default;
-5
View File
@@ -1,5 +0,0 @@
declare const _default: {
'url_decode': (x: string) => string;
'url_encode': (x: string) => string;
};
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-4
View File
@@ -1,4 +0,0 @@
declare const _default: {
render: () => Promise<never>;
};
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-4
View File
@@ -1,4 +0,0 @@
declare const _default: {
render: () => Promise<never>;
};
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-5
View File
@@ -1,5 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const tags: {
[key: string]: ITagImplOptions;
};
export default tags;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-3
View File
@@ -1,3 +0,0 @@
import ITagImplOptions from 'src/template/tag/itag-impl-options';
declare const _default: ITagImplOptions;
export default _default;
-1
View File
@@ -1 +0,0 @@
export {};
-3
View File
@@ -1,3 +0,0 @@
import IFS from './ifs';
declare const _default: IFS;
export default _default;
-5
View File
@@ -1,5 +0,0 @@
export default interface IFS {
exists: (filepath: string) => Promise<boolean>;
readFile: (filepath: string) => Promise<string>;
resolve: (root: string, file: string, ext: string) => string;
}
-3
View File
@@ -1,3 +0,0 @@
import IFS from './ifs';
declare const fs: IFS;
export default fs;
-52
View File
@@ -1,52 +0,0 @@
export interface LiquidOptions {
/** `root` is a directory or an array of directories to resolve layouts and includes, as well as the filename passed in when calling `.renderFile()`. If an array, the files are looked up in the order they occur in the array. Defaults to `["."]` */
root?: string | string[];
/** `extname` is used to lookup the template file when filepath doesn't include an extension name. Eg: setting to `".html"` will allow including file by basename. Defaults to `""`. */
extname?: string;
/** `cache` indicates whether or not to cache resolved templates. Defaults to `false`. */
cache?: boolean;
/** `dynamicPartials`: if set, treat `<filepath>` parameter in `{%include filepath %}`, `{%layout filepath%}` as a variable, otherwise as a literal value. Defaults to `true`. */
dynamicPartials?: boolean;
/** `strict_filters` is used to enable strict filter existence. If set to `false`, undefined filters will be rendered as empty string. Otherwise, undefined filters will cause an exception. Defaults to `false`. */
strict_filters?: boolean;
/** `strict_variables` is used to enable strict variable derivation. If set to `false`, undefined variables will be rendered as empty string. Otherwise, undefined variables will cause an exception. Defaults to `false`. */
strict_variables?: boolean;
/** `trim_tag_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of tags (`{% %}`) until `\n` (inclusive). Defaults to `false`. */
trim_tag_right?: boolean;
/** `trim_tag_left` is similar to `trim_tag_right`, whereas the `\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */
trim_tag_left?: boolean;
/** ``trim_output_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of values (`{{ }}`) until `\n` (inclusive). Defaults to `false`. */
trim_output_right?: boolean;
/** `trim_output_left` is similar to `trim_output_right`, whereas the `\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */
trim_output_left?: boolean;
/** `tag_delimiter_left` and `tag_delimiter_right` are used to override the delimiter for liquid tags **/
tag_delimiter_left?: string;
tag_delimiter_right?: string;
/** `output_delimiter_left` and `output_delimiter_right` are used to override the delimiter for liquid outputs **/
output_delimiter_left?: string;
output_delimiter_right?: string;
/** `greedy` is used to specify whether `trim_left`/`trim_right` is greedy. When set to `true`, all consecutive blank characters including `\n` will be trimed regardless of line breaks. Defaults to `true`. */
greedy?: boolean;
}
export interface NormalizedOptions extends LiquidOptions {
root?: string[];
}
export interface NormalizedFullOptions extends NormalizedOptions {
root: string[];
extname: string;
cache: boolean;
dynamicPartials: boolean;
strict_filters: boolean;
strict_variables: boolean;
trim_tag_right: boolean;
trim_tag_left: boolean;
trim_output_right: boolean;
trim_output_left: boolean;
tag_delimiter_left: string;
tag_delimiter_right: string;
output_delimiter_left: string;
output_delimiter_right: string;
greedy: boolean;
}
export declare function normalize(options?: LiquidOptions): NormalizedOptions;
export declare function applyDefault(options?: NormalizedOptions): NormalizedFullOptions;
-2397
View File
File diff suppressed because it is too large Load Diff
-1
View File
File diff suppressed because one or more lines are too long
-33
View File
@@ -1,33 +0,0 @@
import Scope from './scope/scope';
import * as Types from './types';
import ITemplate from './template/itemplate';
import Render from './render/render';
import Parser from './parser/parser';
import ITagImplOptions from './template/tag/itag-impl-options';
import { isTruthy, isFalsy, evalExp, evalValue } from './render/syntax';
import { LiquidOptions, NormalizedFullOptions } from './liquid-options';
import { FilterImpl } from './template/filter/filter-impl';
export default class Liquid {
options: NormalizedFullOptions;
renderer: Render;
parser: Parser;
private cache;
private tokenizer;
constructor(opts?: LiquidOptions);
parse(html: string, filepath?: string): ITemplate[];
render(tpl: Array<ITemplate>, ctx?: object, opts?: LiquidOptions): Promise<string>;
parseAndRender(html: string, ctx?: object, opts?: LiquidOptions): Promise<string>;
getTemplate(file: string, opts?: LiquidOptions): Promise<any>;
renderFile(file: string, ctx?: object, opts?: LiquidOptions): Promise<string>;
evalValue(str: string, scope: Scope): any;
registerFilter(name: string, filter: FilterImpl): void;
registerTag(name: string, tag: ITagImplOptions): void;
plugin(plugin: (this: Liquid, L: typeof Liquid) => void): void;
express(): (this: any, filePath: string, ctx: object, cb: (err: Error | null, html?: string | undefined) => void) => void;
static default: typeof Liquid;
static isTruthy: typeof isTruthy;
static isFalsy: typeof isFalsy;
static evalExp: typeof evalExp;
static evalValue: typeof evalValue;
static Types: typeof Types;
}
-2424
View File
File diff suppressed because it is too large Load Diff
-1
View File
File diff suppressed because one or more lines are too long
-2
View File
File diff suppressed because one or more lines are too long
-1
View File
File diff suppressed because one or more lines are too long
-6
View File
@@ -1,6 +0,0 @@
import Token from './token';
export default class DelimitedToken extends Token {
trimLeft: boolean;
trimRight: boolean;
constructor(raw: string, value: string, input: string, line: number, pos: number, file?: string);
}
-4
View File
@@ -1,4 +0,0 @@
import Token from './token';
export default class HTMLToken extends Token {
constructor(str: string, input: string, line: number, col: number, file?: string);
}
-35
View File
@@ -1,35 +0,0 @@
export declare const quoted: RegExp;
export declare const quoteBalanced: RegExp;
export declare const integer: RegExp;
export declare const number: RegExp;
export declare const bool: RegExp;
export declare const identifier: RegExp;
export declare const subscript: RegExp;
export declare const literal: RegExp;
export declare const variable: RegExp;
export declare const rangeLimit: RegExp;
export declare const range: RegExp;
export declare const rangeCapture: RegExp;
export declare const value: RegExp;
export declare const hash: RegExp;
export declare const hashCapture: RegExp;
export declare const tagLine: RegExp;
export declare const literalLine: RegExp;
export declare const variableLine: RegExp;
export declare const numberLine: RegExp;
export declare const boolLine: RegExp;
export declare const quotedLine: RegExp;
export declare const rangeLine: RegExp;
export declare const integerLine: RegExp;
export declare const valueDeclaration: RegExp;
export declare const valueList: RegExp;
export declare const filter: RegExp;
export declare const filterCapture: RegExp;
export declare const filterLine: RegExp;
export declare const operators: RegExp[];
export declare function isInteger(str: string): boolean;
export declare function isLiteral(str: string): boolean;
export declare function isRange(str: string): boolean;
export declare function isVariable(str: string): boolean;
export declare function matchValue(str: string): RegExpExecArray | null;
export declare function parseLiteral(str: string): string | number | boolean;
-4
View File
@@ -1,4 +0,0 @@
import DelimitedToken from './delimited-token';
export default class OutputToken extends DelimitedToken {
constructor(raw: string, value: string, input: string, line: number, pos: number, file?: string);
}
-15
View File
@@ -1,15 +0,0 @@
import Token from 'src/parser/token';
import ITemplate from 'src/template/itemplate';
declare type ParseToken = ((token: Token, remainTokens: Array<Token>) => ITemplate);
export default class ParseStream {
private tokens;
private handlers;
private stopRequested;
private parseToken;
constructor(tokens: Array<Token>, parseToken: ParseToken);
on<T extends ITemplate | Token | undefined>(name: string, cb: (arg: T) => void): ParseStream;
trigger<T extends Token | ITemplate>(event: string, arg?: T): boolean;
start(): this;
stop(): this;
}
export {};
-14
View File
@@ -1,14 +0,0 @@
import Liquid from 'src/liquid';
import ParseStream from './parse-stream';
import Token from './token';
import Tag from 'src/template/tag/tag';
import Output from 'src/template/output';
import HTML from 'src/template/html';
import ITemplate from 'src/template/itemplate';
export default class Parser {
liquid: Liquid;
constructor(liquid: Liquid);
parse(tokens: Array<Token>): ITemplate[];
parseToken(token: Token, remainTokens: Array<Token>): Tag | Output | HTML;
parseStream(tokens: Array<Token>): ParseStream;
}
-6
View File
@@ -1,6 +0,0 @@
import DelimitedToken from './delimited-token';
export default class TagToken extends DelimitedToken {
name: string;
args: string;
constructor(raw: string, value: string, input: string, line: number, pos: number, file?: string);
}
-10
View File
@@ -1,10 +0,0 @@
export default class Token {
type: string;
line: number;
col: number;
raw: string;
input: string;
file?: string;
value: string;
constructor(raw: string, input: string, line: number, col: number, file?: string);
}
-7
View File
@@ -1,7 +0,0 @@
import Token from './token';
import { NormalizedFullOptions } from '../liquid-options';
export default class Tokenizer {
options: NormalizedFullOptions;
constructor(options?: NormalizedFullOptions);
tokenize(input: string, file?: string): Token[];
}
-3
View File
@@ -1,3 +0,0 @@
import Token from 'src/parser/token';
import { NormalizedFullOptions } from 'src/liquid-options';
export default function whiteSpaceCtrl(tokens: Token[], options: NormalizedFullOptions): void;

Some files were not shown because too many files have changed in this diff Show More