diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 2f3a7f3..0f9f9f2 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -59,7 +59,7 @@ module.exports = { 'no-var': 'error', }, parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 2022, sourceType: 'module', }, }; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e9b9d3..1631db1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,6 @@ jobs: strategy: matrix: node-vesion: - - 18 - 20 - 22 - 24 diff --git a/package.json b/package.json index e547aab..b16fe47 100644 --- a/package.json +++ b/package.json @@ -13,34 +13,26 @@ "license": "ISC", "author": "", "type": "module", + "types": "./types/index.d.ts", "exports": { ".": { - "require": { - "types": "./types/index.d.ts", - "default": "./dist/cjs/index.js" - }, - "import": { - "types": "./types/index.d.ts", - "default": "./dist/esm/index.js" - }, - "default": { - "types": "./types/index.d.ts", - "default": "./dist/cjs/index.js" - } + "types": "./types/index.d.ts", + "default": "./dist/index.js" } }, - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "types/index.d.ts", + "files": [ + "dist", + "types" + ], "scripts": { "lint": "eslint .", "prepublishOnly": "pnpm run build", - "build": "npm-run-all build:parser build:esm build:cjs", - "build:cjs": "tsc --module commonjs --moduleResolution node --target es5 --outDir dist/cjs", - "build:esm": "tsc --module es2015 --target es5 --outDir dist/esm", + "build": "npm-run-all build:parser build:esm", + "build:esm": "tsc --module es2022 --outDir dist", "build:jison": "jison -m js src/handlebars.yy src/handlebars.l -o lib/parser.js", - "build:parser": "npm-run-all build:jison build:parser-suffix", + "build:parser": "npm-run-all build:jison build:parser-suffix build:parser-clean", "build:parser-suffix": "combine-files lib/parser.js,src/parser-suffix.js lib/parser.js", + "build:parser-clean": "node --input-type=module -e \"import{readFileSync,writeFileSync}from'fs';const f='lib/parser.js';writeFileSync(f,readFileSync(f,'utf8').replace(/^\\s*_token_stack:\\n/m,''))\"", "pretest": "pnpm run build", "test": "mocha --inline-diffs spec", "pretest:bail": "pnpm run build", @@ -65,7 +57,7 @@ }, "packageManager": "pnpm@9.12.2", "engines": { - "node": "^18 || ^20 || ^22 || >=24" + "node": "^20 || ^22 || >=24" }, "publishConfig": { "access": "public", diff --git a/spec/ast.js b/spec/ast.js index 31c4c44..f6687e1 100644 --- a/spec/ast.js +++ b/spec/ast.js @@ -1,4 +1,4 @@ -import { parse, parseWithoutProcessing } from '../dist/esm/index.js'; +import { parse, parseWithoutProcessing } from '../dist/index.js'; import { equals } from './utils.js'; describe('ast', function () { diff --git a/spec/parser.js b/spec/parser.js index 93ad216..7e8265b 100644 --- a/spec/parser.js +++ b/spec/parser.js @@ -1,4 +1,4 @@ -import { parse, print } from '../dist/esm/index.js'; +import { parse, print } from '../dist/index.js'; import { equals, equalsAst, shouldThrow } from './utils.js'; describe('parser', function () { diff --git a/spec/utils.js b/spec/utils.js index 503eff0..91627db 100644 --- a/spec/utils.js +++ b/spec/utils.js @@ -1,4 +1,4 @@ -import { parse, print } from '../dist/esm/index.js'; +import { parse, print } from '../dist/index.js'; let AssertError; if (Error.captureStackTrace) { diff --git a/spec/visitor.js b/spec/visitor.js index 4135466..28a7cce 100644 --- a/spec/visitor.js +++ b/spec/visitor.js @@ -1,4 +1,4 @@ -import { Visitor, parse, print, Exception } from '../dist/esm/index.js'; +import { Visitor, parse, print, Exception } from '../dist/index.js'; import { equals, shouldThrow } from './utils.js'; describe('Visitor', function () { diff --git a/tsconfig.json b/tsconfig.json index ee1839f..8f6dfed 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { "compilerOptions": { // Compilation Configuration - "target": "es2017", + "target": "es2022", + "module": "es2022", "inlineSources": true, "inlineSourceMap": true, "outDir": "dist",