diff --git a/jsr.json b/jsr.json new file mode 100644 index 0000000..9636861 --- /dev/null +++ b/jsr.json @@ -0,0 +1,12 @@ +{ + "name": "@eta-dev/eta", + "version": "3.4.0", + "exports": "./src/index.ts", + "publish": { + "include": [ + "LICENSE", + "README.md", + "src/**/*.ts" + ] + } +} diff --git a/jsr.release.js b/jsr.release.js new file mode 100644 index 0000000..03a86f1 --- /dev/null +++ b/jsr.release.js @@ -0,0 +1,4 @@ +require('node:fs').writeFileSync('jsr.json', JSON.stringify({ + ...require('./jsr.json'), + "version": require('./package.json').version, +}, null, 2) + '\n'); diff --git a/package.json b/package.json index a3bfd93..3c56521 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,8 @@ "format": "prettier --write '{src,test}/**/**.ts'", "lint": "eslint src/*.ts test/*.spec.ts --ext .js,.ts", "prebuild": "rimraf dist", - "release": "npm run build && np", + "release": "npm run build && np && npx jsr publish", + "postversion": "node ./jsr.release.js", "size": "size-limit", "start": "microbundle watch", "test": "jest --coverage && npm run size", diff --git a/src/compile-string.ts b/src/compile-string.ts index 48fc254..b149854 100644 --- a/src/compile-string.ts +++ b/src/compile-string.ts @@ -74,7 +74,7 @@ return __eta.res; * ``` */ -export function compileBody(this: Eta, buff: Array) { +export function compileBody(this: Eta, buff: Array): string { const config = this.config; let i = 0; diff --git a/src/core.ts b/src/core.ts index 3286b84..0f5b8c0 100644 --- a/src/core.ts +++ b/src/core.ts @@ -34,8 +34,8 @@ export class Eta { renderStringAsync = renderStringAsync; filepathCache: Record = {}; - templatesSync = new Cacher({}); - templatesAsync = new Cacher({}); + templatesSync: Cacher = new Cacher({}); + templatesAsync: Cacher = new Cacher({}); // resolvePath takes a relative path from the "views" directory resolvePath: null | ((this: Eta, template: string, options?: Partial) => string) = null; @@ -47,7 +47,7 @@ export class Eta { this.config = { ...this.config, ...customConfig }; } - withConfig(customConfig: Partial) { + withConfig(customConfig: Partial): this & { config: EtaConfig }{ return { ...this, config: { ...this.config, ...customConfig } }; }