Skip to content

Commit 24694f9

Browse files
Version 5.1.0 (#34)
## Main changes * Support [Tail-Recursion Elimination on Conditional Types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#tailrec-conditional), that comes with TypeScript 4.5 and allows users to use more variables (infinity?), than before. Fixes #27. ## Chore * Update dependencies * Update "Known issues" section and links to types in `README.md` * Add a test for a big amount of variables * Change spaces to tabs
1 parent 62e4e70 commit 24694f9

16 files changed

Lines changed: 4380 additions & 4207 deletions

.editorconfig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ root = true
22

33
[*]
44
charset = utf-8
5-
indent_size = 2
6-
indent_style = space
5+
indent_style = tab
76
insert_final_newline = true
87
max_line_length = 80
98
trim_trailing_whitespace = true
9+
10+
# For a pretty visual representation.
11+
[*.md]
12+
indent_size = 2
13+
indent_style = space

.eslintrc

Lines changed: 219 additions & 219 deletions
Large diffs are not rendered by default.

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Lint
2424
uses: borales/actions-yarn@v2.3.0
2525
with:
26-
cmd: lint
26+
cmd: lint:check
2727
- name: Test
2828
uses: borales/actions-yarn@v2.3.0
2929
with:

.prettierrc

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
{
2-
"arrowParens": "avoid",
3-
"bracketSpacing": true,
4-
"endOfLine": "auto",
5-
"jsxBracketSameLine": false,
6-
"jsxSingleQuote": false,
7-
"printWidth": 80,
8-
"quoteProps": "as-needed",
9-
"semi": true,
10-
"singleQuote": false,
11-
"tabWidth": 2,
12-
"trailingComma": "all",
13-
"useTabs": false
2+
"arrowParens": "always",
3+
"bracketSameLine": false,
4+
"bracketSpacing": true,
5+
"endOfLine": "auto",
6+
"jsxSingleQuote": false,
7+
"printWidth": 80,
8+
"quoteProps": "as-needed",
9+
"semi": true,
10+
"singleQuote": false,
11+
"trailingComma": "all",
12+
"useTabs": true,
13+
"overrides": [
14+
{
15+
"files": "*.md",
16+
"options": {
17+
"tabWidth": 2,
18+
"useTabs": false
19+
}
20+
}
21+
]
1422
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"typescript.tsdk": "node_modules\\typescript\\lib"
2+
"typescript.tsdk": "node_modules\\typescript\\lib"
33
}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A small, dependency-free and strongly typed template engine.
2323
[minzip-size-badge]: https://flat.badgen.net/bundlephobia/minzip/hydrate-text
2424
[size-link]: https://bundlephobia.com/package/hydrate-text
2525
[types-badge]: https://flat.badgen.net/npm/types/hydrate-text
26-
[types-link]: https://github.com/vasilii-kovalev/hydrate-text/blob/main/src/index.ts#L1-L75
26+
[types-link]: https://github.com/vasilii-kovalev/hydrate-text/blob/main/src/index.ts#L1-L90
2727
[coverage-badge]: https://flat.badgen.net/coveralls/c/github/vasilii-kovalev/hydrate-text
2828
[coverage-link]: https://coveralls.io/github/vasilii-kovalev/hydrate-text
2929
[vulnerabilities-badge]: https://flat.badgen.net/snyk/vasilii-kovalev/hydrate-text
@@ -145,13 +145,14 @@ function configureHydrateText(
145145
) => typeof hydrateText;
146146
```
147147

148-
Check out [types.ts](./src/types.ts) file for more information.
148+
Check out the "Types" section in the [source file](./src/index.ts) for more information.
149149

150150
## Known issues
151151

152-
- If a string has more than 8 variables, an error "Type instantiation is excessively deep and possibly infinite" can occur. In this case, it is better to break the string down into several pieces.
152+
- SyntaxError: Unexpected token 'export'.
153153

154-
Check out the [original TypeScript issue](https://github.com/microsoft/TypeScript/issues/37613) for more information.
154+
The problem appears when running tests using Jest. That's because of lack of CommonJS support. A solution can be found [here](https://github.com/vasilii-kovalev/hydrate-text/issues/32).
155+
Not supporting CommonJS is intended, since all the industry is moving towards ES modules, and CommonJS will be retired at some point.
155156

156157
## Background
157158

jest.config.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"collectCoverageFrom": ["src/index.ts"],
3-
"testEnvironment": "node",
4-
"transform": {
5-
"^.+\\.ts$": "@swc-node/jest"
6-
}
2+
"collectCoverageFrom": ["src/index.ts"],
3+
"testEnvironment": "node",
4+
"transform": {
5+
"^.+\\.ts$": "@swc-node/jest"
6+
}
77
}

package.json

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,65 @@
11
{
2-
"name": "hydrate-text",
3-
"version": "5.0.2",
4-
"description": "A small, dependency-free and strongly typed template engine.",
5-
"sideEffects": false,
6-
"type": "module",
7-
"main": "dist/index.js",
8-
"types": "dist/index.d.ts",
9-
"files": [
10-
"dist"
11-
],
12-
"keywords": [
13-
"javascript",
14-
"string",
15-
"template engine",
16-
"template",
17-
"tree-shakable",
18-
"typescript",
19-
"zero-dependency"
20-
],
21-
"author": "Vasilii Kovalev <vasilii.kovalev95@yandex.ru>",
22-
"license": "MIT",
23-
"repository": {
24-
"type": "git",
25-
"url": "git+https://github.com/vasilii-kovalev/hydrate-text.git"
26-
},
27-
"homepage": "https://github.com/vasilii-kovalev/hydrate-text#readme",
28-
"bugs": {
29-
"url": "https://github.com/vasilii-kovalev/hydrate-text/issues"
30-
},
31-
"scripts": {
32-
"tslint": "tsc --project tsconfig.tslint.json",
33-
"types": "check-dts **/*.ts",
34-
"eslint:check": "eslint src",
35-
"eslint:fix": "eslint src --fix",
36-
"prettier:check": "prettier . --check",
37-
"prettier:fix": "prettier . --write",
38-
"lint": "npm-run-all tslint types eslint:check prettier:check",
39-
"test": "jest --coverage",
40-
"build": "tsc --project tsconfig.build.json",
41-
"postbuild": "prettier dist --write",
42-
"prepare": "npm-run-all build",
43-
"prepublishOnly": "npm-run-all lint test",
44-
"postversion": "git push && git push --tags"
45-
},
46-
"devDependencies": {
47-
"@swc-node/jest": "^1.3.1",
48-
"@types/jest": "^26.0.24",
49-
"@types/node": "^16.4.5",
50-
"@typescript-eslint/eslint-plugin": "4.28.5",
51-
"@typescript-eslint/parser": "4.28.5",
52-
"check-dts": "^0.5.4",
53-
"eslint": "7.31.0",
54-
"eslint-config-prettier": "8.3.0",
55-
"eslint-plugin-import": "2.23.4",
56-
"eslint-plugin-jest": "24.4.0",
57-
"eslint-plugin-prettier": "3.4.0",
58-
"jest": "^27.0.6",
59-
"npm-run-all": "^4.1.5",
60-
"prettier": "^2.3.2",
61-
"typescript": "^4.3.5"
62-
}
2+
"name": "hydrate-text",
3+
"version": "5.1.0",
4+
"description": "A small, dependency-free and strongly typed template engine.",
5+
"sideEffects": false,
6+
"type": "module",
7+
"main": "dist/index.js",
8+
"types": "dist/index.d.ts",
9+
"files": [
10+
"dist"
11+
],
12+
"keywords": [
13+
"javascript",
14+
"string",
15+
"template engine",
16+
"template",
17+
"tree-shakable",
18+
"typescript",
19+
"zero-dependency"
20+
],
21+
"author": "Vasilii Kovalev <vasilii.kovalev95@yandex.ru>",
22+
"license": "MIT",
23+
"repository": {
24+
"type": "git",
25+
"url": "git+https://github.com/vasilii-kovalev/hydrate-text.git"
26+
},
27+
"homepage": "https://github.com/vasilii-kovalev/hydrate-text#readme",
28+
"bugs": {
29+
"url": "https://github.com/vasilii-kovalev/hydrate-text/issues"
30+
},
31+
"scripts": {
32+
"tslint": "tsc --project tsconfig.tslint.json",
33+
"types": "check-dts",
34+
"eslint:check": "eslint src",
35+
"eslint:fix": "eslint src --fix",
36+
"prettier:check": "prettier . --check",
37+
"prettier:fix": "prettier . --write",
38+
"lint:check": "npm-run-all tslint types eslint:check prettier:check",
39+
"lint:fix": "npm-run-all tslint types eslint:fix prettier:fix",
40+
"test": "jest --coverage",
41+
"check": "npm-run-all lint:check test",
42+
"build": "tsc --project tsconfig.build.json",
43+
"postbuild": "prettier dist --write",
44+
"prepare": "npm-run-all build",
45+
"prepublishOnly": "npm-run-all check",
46+
"postversion": "git push && git push --tags"
47+
},
48+
"devDependencies": {
49+
"@swc-node/jest": "^1.4.1",
50+
"@types/jest": "^27.0.3",
51+
"@types/node": "^16.11.9",
52+
"@typescript-eslint/eslint-plugin": "5.4.0",
53+
"@typescript-eslint/parser": "5.4.0",
54+
"check-dts": "^0.6.4",
55+
"eslint": "8.3.0",
56+
"eslint-config-prettier": "8.3.0",
57+
"eslint-plugin-import": "2.25.3",
58+
"eslint-plugin-jest": "25.2.4",
59+
"eslint-plugin-prettier": "4.0.0",
60+
"jest": "^27.3.1",
61+
"npm-run-all": "^4.1.5",
62+
"prettier": "^2.4.1",
63+
"typescript": "^4.5.2"
64+
}
6365
}

0 commit comments

Comments
 (0)