diff --git a/package.json b/package.json index 0d8d654a..6401d240 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "lint": "eslint . --ext .js,.ts", "timeseries": "node --loader ts-node/esm scripts/timeseries.js", "build": "yarn run build:esm && yarn run build:cjs", - "build:esm": "tsc --module es2020 --target es2019 --outDir dist/esm", + "build:esm": "tsc --module esnext --target es2019 --outDir dist/esm", "build:cjs": "tsc --module commonjs --target es2015 --outDir dist/cjs && sed 's/\"type\": \"module\",/\"type:\": \"commonjs\",/' dist/cjs/package.json > dist/cjs/package-changed.json && mv dist/cjs/package-changed.json dist/cjs/package.json", "prepublishOnly": "yarn build", "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js", diff --git a/src/lib/getCrumb.ts b/src/lib/getCrumb.ts index 2ad3fbae..28ef57ea 100644 --- a/src/lib/getCrumb.ts +++ b/src/lib/getCrumb.ts @@ -1,6 +1,8 @@ import type { RequestInfo, RequestInit, Response } from "node-fetch"; import type { ExtendedCookieJar } from "./cookieJar"; -import pkg from "../../package.json"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: we have to ignore this for csm output. +import pkg from "../../package.json" assert { type: "json" }; import { Logger } from "./options.js"; import { Cookie } from "tough-cookie"; import { showNotice } from "./notices.js"; diff --git a/src/lib/validateAndCoerceTypes.ts b/src/lib/validateAndCoerceTypes.ts index 60060e12..c960d1ea 100644 --- a/src/lib/validateAndCoerceTypes.ts +++ b/src/lib/validateAndCoerceTypes.ts @@ -1,4 +1,6 @@ -import pkg from "../../package.json"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: we have to ignore this for csm output. +import pkg from "../../package.json" assert { type: "json" }; import { FailedYahooValidationError, InvalidOptionsError } from "./errors.js"; import { StaticDecode, type TSchema } from "@sinclair/typebox"; import { diff --git a/src/lib/yahooFinanceFetch.ts b/src/lib/yahooFinanceFetch.ts index 8344ed44..10020a75 100644 --- a/src/lib/yahooFinanceFetch.ts +++ b/src/lib/yahooFinanceFetch.ts @@ -5,7 +5,9 @@ import type { YahooFinanceOptions } from "./options.js"; import type { QueueOptions } from "./queue.js"; import errors from "./errors.js"; -import pkg from "../../package.json"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: we have to ignore this for csm output.assert +import pkg from "../../package.json" assert { type: "json" }; import getCrumb from "./getCrumb.js"; const userAgent = `${pkg.name}/${pkg.version} (+${pkg.repository})`; diff --git a/src/modules/fundamentalsTimeSeries.ts b/src/modules/fundamentalsTimeSeries.ts index 5b920c99..f90b7390 100644 --- a/src/modules/fundamentalsTimeSeries.ts +++ b/src/modules/fundamentalsTimeSeries.ts @@ -5,7 +5,9 @@ import type { ModuleOptionsWithValidateFalse, ModuleThis, } from "../lib/moduleCommon.js"; -import Timeseries_Keys from "../lib/timeseries.json"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: we have to ignore this for csm output. +import Timeseries_Keys from "../lib/timeseries.json" assert { type: "json" }; import { YahooFinanceDate, YahooNumber } from "../lib/yahooFinanceTypes.js"; const FundamentalsTimeSeries_Types = ["quarterly", "annual", "trailing"]; diff --git a/tsconfig.json b/tsconfig.json index 9301e22b..b42a3043 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "moduleResolution": "node", - "module": "es2020", + "module": "esnext", "target": "es2020", "outDir": "dist/default", "allowJs": true,