Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
f5534bb
feat(line): triggerAreaEvent option for more control over mouse event
sjcobb May 27, 2025
f95af4c
Rename option to triggerLineOnlyEvent
sjcobb Jun 13, 2025
dea397d
change line series option to triggerEvent, deprecate triggerLineEvent
sjcobb Jun 26, 2025
57f9ceb
test: revert incorrect modification introduced in c4481090e1a228c883b…
100pah Jul 27, 2025
724b7bf
Merge pull request #21138 from apache/fix/check-build
plainheart Jul 28, 2025
7aa73b2
feat(radar): add clockwise options support
daidr Jul 29, 2025
f27e1e3
test(radar): add radar chart direction test case
daidr Jul 29, 2025
a69836a
Merge pull request #21145 from apache/release
100pah Jul 31, 2025
5956c51
test(pie-coord-sys): migrate test cases: "pie on amap" and "pie on bm…
100pah Jul 31, 2025
fb0658c
fix(husky): remote checkheader from pre-commit temporarily, since it …
100pah Jul 31, 2025
110c613
Merge pull request #21146 from apache/fix/check-header-tmp
Ovilia Jul 31, 2025
700097e
Merge remote-tracking branch 'origin/master' into fix/ts-export-type
100pah Jul 31, 2025
8fcf940
test(pie-coord-sys): test for pie on two grid within a single echarts…
100pah Jul 31, 2025
5643027
fix(ts): Fix the option type of dataZoom reference (querying) axis.
100pah Jul 31, 2025
98778a0
fix(ts): Fix exported option type of visualMap referencing (querying)…
100pah Jul 31, 2025
e8ff528
fix(ts): Add and supplement option type for users ts check - the coor…
100pah Jul 31, 2025
8cc7ef9
fix(ts): prop `map` should not be mandatory; consider the case that s…
100pah Aug 3, 2025
bf459eb
fix(ts): fix matrix type for matrix.x.data: [null, null, null]
100pah Aug 3, 2025
6907479
fix(viewCoodSys): Fix legacy center impl, introduced in v6.0.0.
100pah Aug 4, 2025
ca875d2
chore(deps-dev): bump tmp from 0.2.1 to 0.2.4
dependabot[bot] Aug 6, 2025
5966ad1
fix(dataZoom): handleLabel should be an optional type #21161
Ovilia Aug 7, 2025
8c4653f
Merge pull request #21143 from daidr/feat/radar-clockwise
Ovilia Aug 7, 2025
3ae4c55
chore: add unpkg entry
kingyue737 Aug 7, 2025
7db0681
fix: Fix missing semicolon in pre-publish.js.
zhangqin2-yewu Aug 7, 2025
29ebb23
Merge pull request #21179 from zhangqin2-yewu/feat_repair_semicolon
plainheart Aug 7, 2025
2d0b35a
Merge pull request #21177 from kingyue737/patch-1
plainheart Aug 7, 2025
a3420d7
Merge pull request #21175 from apache/fix-type
plainheart Aug 7, 2025
d0d53db
Merge pull request #21172 from apache/dependabot/npm_and_yarn/tmp-0.2.4
plainheart Aug 7, 2025
5e54f9d
feat(matrix): Support matrix.x/y.length for conveniently create a hea…
100pah Aug 8, 2025
4bf741e
fix(toolbox): dataView darkmode
notthistrain Aug 8, 2025
cda66de
fix(ts): Remove incorrect type in thumbnail.
100pah Aug 10, 2025
5468223
ts(axisBreak): Fix type - should be optional.
100pah Aug 10, 2025
89065c0
fix(chord): add missing export entry for chord chart
plainheart Aug 11, 2025
4015f23
ts: Fix export typo.
100pah Aug 11, 2025
4c3f305
chore: property shorthand,update src/theme/dark.ts
notthistrain Aug 12, 2025
38116d0
Merge pull request #21197 from apache/fix/chord/export-entry
Ovilia Aug 18, 2025
cbf5c62
fix(bar): wrong data label position when bar width/height is 0
Justin-ZS Aug 22, 2025
edbadad
Merge pull request #21176 from notthistrain/fix-21170
Ovilia Aug 22, 2025
2e42179
fix(dataset): wrong area when dimension name is empty string
Justin-ZS Aug 22, 2025
ae81f7a
Merge pull request #21147 from apache/fix/ts-export-type
100pah Aug 22, 2025
792ce90
fix: axisLabel.formatter does not receive indexs when using customVa…
Aug 24, 2025
8ba89a9
Merge pull request #21218 from Justin-ZS/fix/21144
Ovilia Aug 25, 2025
d69383c
fix(gauge): apply correct color to progress when set to 'auto'
Aug 25, 2025
dfcc8d9
Correct type of nodeScaleRatio on graph
ocshawn Aug 26, 2025
6b2860f
Merge pull request #21229 from ocshawn/fix-graphNodeScaleRatioType
plainheart Aug 28, 2025
afe0bc3
fix(dataZoom): handle NaN rect coords in positionGroup. close #21195
alesmit Aug 11, 2025
369d3b6
test: add visual test case
alesmit Aug 30, 2025
be1028e
Merge pull request #21219 from Justin-ZS/fix/20756_2
Ovilia Sep 2, 2025
0b06d7f
feat(gauge): extract duplication to variable
Sep 2, 2025
e192f49
test: added a test case
Sep 2, 2025
b94047f
Merge pull request #21224 from StNimmerlein/fix/color-progress-bar-in…
Ovilia Sep 8, 2025
91739bb
feat(pie):add `tangential-fixed` rotation mode to keep labels tangent…
Sep 10, 2025
f2570e7
feat(pie):add `tangential-fixed` rotation mode to keep labels tangent…
Sep 10, 2025
4d2f183
Merge pull request #21220 from szymonpachucki/fix-21216
Ovilia Sep 16, 2025
5139180
Merge pull request #21196 from alesmit/fix-21195
Ovilia Sep 16, 2025
ddf6ac8
chore(deps-dev): bump tar-fs from 3.0.9 to 3.1.1 in /test/runTest
dependabot[bot] Sep 24, 2025
7985f20
Merge pull request #21291 from apache/dependabot/npm_and_yarn/test/ru…
plainheart Sep 25, 2025
17b6c77
fix(core): mark echarts instance object as raw in Vue (resolves #2126…
plainheart Sep 26, 2025
37209e2
Merge pull request #21293 from apache/fix/markRaw-in-vue
100pah Sep 26, 2025
919bfff
Fix the each() method example
Yurunsoft Sep 28, 2025
2a234b3
feat(visualMap): able to set the 'dimension' to an array
Justin-ZS Mar 10, 2025
a762c7b
feat(visualMap): add seriesTargets to mapping different series -> dim…
Justin-ZS Sep 29, 2025
6eddf4b
test(visualmap): add more test
Justin-ZS Sep 29, 2025
1808e50
feat(axis): support dataMin/dataMax to calc a nice axis range
Justin-ZS Mar 19, 2025
a4dfbec
fix: code review
Justin-ZS Sep 29, 2025
2362925
feat(sunburst): align root node label to center
akashsonune Oct 9, 2025
8f319ed
chore: apply review comment
akashsonune Oct 10, 2025
9c07df0
chore: apply review comment
akashsonune Oct 10, 2025
37649a5
fix(pie):rename tangential-fixed rotation mode to tangential-noflip f…
MC-YCY Oct 11, 2025
9f741e1
Merge pull request #21294 from Yurunsoft/fix-each-example
plainheart Oct 13, 2025
075d1a8
fix: axis common types. close #21312
gzamann Oct 13, 2025
b217c9b
Merge pull request #21306 from akashsonune/feat/align-root-node-label…
Ovilia Oct 14, 2025
6b82c48
Merge pull request #21313 from gzamann/fix-axis-common-type
Ovilia Oct 14, 2025
fa2d67a
style(pie):fix unnecessary formatting in pie-label-rotate.html
MC-YCY Oct 14, 2025
6be0047
Merge pull request #21258 from MC-YCY/fix-label-tangential-fixed
Ovilia Oct 15, 2025
94aa06d
fix: horizontal candlesticks with encode. close #21322
PPRAMANIK62 Oct 20, 2025
bb875b5
fix: resolve not-null checks and improved layout selection logic
PPRAMANIK62 Oct 23, 2025
8eb93d0
fix: added more test cases and resolved unnescessary changes
PPRAMANIK62 Oct 24, 2025
51ae58d
Merge pull request #21320 from mynk2611/fix-20216
mynk2611 Oct 24, 2025
2a09845
Merge pull request #21191 from apache/feat/matrix-tweak
plainheart Oct 24, 2025
f6f7bdf
fix: revert irrelevant changes
Justin-ZS Oct 24, 2025
9233c5e
github: (1) Add security checking hints in PR template. (2) Merge "Mi…
100pah Oct 24, 2025
6b102fc
Merge pull request #21327 from apache/pr-template-mod
plainheart Oct 25, 2025
79f355a
chore(deps-dev): bump validator from 13.7.0 to 13.15.20
dependabot[bot] Oct 28, 2025
976f5bb
Merge pull request #21330 from apache/dependabot/npm_and_yarn/validat…
plainheart Oct 28, 2025
f94f221
fix: (1) priority of defaults by layout and axis types. (2) init anim…
100pah Oct 30, 2025
3844954
Merge pull request #21325 from PPRAMANIK62/fix-21322
100pah Oct 30, 2025
1e9b6e1
Merge pull request #20838 from Justin-ZS/feat/20770
Ovilia Oct 31, 2025
18c17b7
fix: code review
Justin-ZS Oct 31, 2025
b322f2c
style: use zrUtil.find rather than array.find
plainheart Oct 31, 2025
7a39313
Merge pull request #20703 from Justin-ZS/fix/20662
plainheart Oct 31, 2025
cb2d46d
fix(workflow): fix match pattern for changed files collection in the …
plainheart Nov 7, 2025
6f305b4
Merge pull request #21347 from apache/workflow/fix-lint-diff-file-pat…
Ovilia Nov 10, 2025
3010cb8
fix(time-axis): resolve TypeError when using customValues with format…
Srajan-Sanjay-Saxena Nov 12, 2025
e9b24db
test: add customValues with formatter test case to axis-customTicks.html
Srajan-Sanjay-Saxena Nov 12, 2025
aa9db72
Merge pull request #21352 from Srajan-Sanjay-Saxena/fix/time-axis-cus…
plainheart Nov 14, 2025
61afd73
feat(line): 1) add `selfType` property into line/area trigger event f…
plainheart Nov 14, 2025
3a39f66
Merge remote-tracking branch 'remotes/upstream/master' into fix-21000…
plainheart Nov 14, 2025
27d3dbc
test(line): add VRT test case
plainheart Nov 14, 2025
68a151a
fix(line): tweak logic
plainheart Nov 14, 2025
5a575c9
fix(line): tweak deprecation tip
plainheart Nov 14, 2025
ccbbd8a
Merge pull request #21001 from sjcobb/fix-21000-line-event
plainheart Nov 14, 2025
2e280ee
chore(deps-dev): bump js-yaml from 3.14.0 to 3.14.2
dependabot[bot] Nov 18, 2025
9a4eb7e
Merge pull request #21380 from apache/dependabot/npm_and_yarn/js-yaml…
Ovilia Nov 19, 2025
19e8f88
chore(deps-dev): bump js-yaml from 4.1.0 to 4.1.1 in /test/runTest
dependabot[bot] Nov 19, 2025
6907c99
Merge pull request #21381 from apache/dependabot/npm_and_yarn/test/ru…
plainheart Nov 19, 2025
cc18151
fix(toolbox): fix default emphasis color
Ovilia Nov 20, 2025
18f5f85
Merge pull request #21384 from apache/fix-toolbox
Ovilia Nov 20, 2025
611a832
fix(parallel): calculate axis extent after processing series extents
jackhickson Nov 23, 2025
936e870
test(parallel): add parallel series max min test case
jackhickson Nov 24, 2025
e79fb09
fix(tooltip): Changing tooltip config doesn't refresh the displayed t…
Justin-ZS Mar 10, 2025
272d631
fix: code review
Justin-ZS Mar 13, 2025
0698205
fix: code review
Justin-ZS Nov 27, 2025
23ae6c0
Merge pull request #20710 from Justin-ZS/fix/20706
Justin-ZS Dec 1, 2025
0b99fb0
chore(deps-dev): bump validator from 13.15.20 to 13.15.23
dependabot[bot] Dec 2, 2025
9cbbe57
Merge pull request #21402 from apache/dependabot/npm_and_yarn/validat…
plainheart Dec 3, 2025
09c721f
fix(matrix): label formatter not work
Justin-ZS Dec 3, 2025
7cdcb5e
fix(types): remove export assignment to support typescript esm compat…
akashsonune Dec 5, 2025
819208a
fix: code review
Justin-ZS Dec 10, 2025
a0b8a78
Merge branch 'master' into pr-21411
100pah Dec 11, 2025
ba79acf
Merge pull request #21410 from Justin-ZS/fix/21403
Ovilia Dec 15, 2025
c237496
Merge pull request #21425 from fanwww/fix-pie-labelLine-smooth
fanwww Dec 15, 2025
b594aae
Merge pull request #21387 from jackhickson/fix-18082
plainheart Dec 16, 2025
ea65b17
test: mv TS test cases
100pah Dec 17, 2025
905027d
test: Enrich TS test cases -- package.json "type": "module" and tscon…
100pah Dec 17, 2025
921496a
fix(axis): refactor axisLabel formatter
Ovilia Dec 18, 2025
2292edb
Merge pull request #21432 from apache/fix-axisTickLabel
plainheart Dec 18, 2025
376338c
ts: refactor TS entries to satisfy recent TS versions and modern usag…
100pah Dec 18, 2025
e21c419
tweak
100pah Dec 18, 2025
047f05e
ts: update rollup-plugin-dts to support new features.
100pah Dec 18, 2025
83ee45c
Merge pull request #21411 from akashsonune/fix/remove-export-assignme…
100pah Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ One of the following should be checked.

## Misc

### Security Checking

- [ ] This PR uses security-sensitive Web APIs.

<!-- PLEASE CHECK IT AGAINST: <https://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributors> -->

### ZRender Changes

- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
Expand All @@ -61,10 +67,6 @@ One of the following should be checked.

N.A.



## Others

### Merging options

- [ ] Please squash the commits into a single one when merging.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Collect changed files
run: |
mkdir ~/tmp/
git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --diff-filter=ACM --name-only --relative '*src/**/*.ts' > ~/tmp/changed_files
git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --diff-filter=ACM --name-only --relative '*src/*.ts' '*src/**/*.ts' > ~/tmp/changed_files
echo -e "Changed files: \n$(cat ~/tmp/changed_files)"

- name: Lint
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ node_modules

test/data/map/tool
test/data/map/raw

/test/types/package-lock.json

theme/thumb
pre-publish-tmp
todo
Expand Down
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@

npm run lint
npm run checktype
npm run checkheader
90 changes: 57 additions & 33 deletions build/pre-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async function runTsCompile(localTs, compilerOptions, srcPathList) {
}
});
if (allDiagnostics.length > 0) {
throw new Error('TypeScript Compile Failed')
throw new Error('TypeScript Compile Failed');
}
}
module.exports.runTsCompile = runTsCompile;
Expand Down Expand Up @@ -378,32 +378,43 @@ async function readFilePaths({patterns, cwd}) {
async function bundleDTS() {

const outDir = nodePath.resolve(__dirname, '../types/dist');
const commonConfig = {
onwarn(warning, rollupWarn) {
// Not warn circular dependency
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
plugins: [
dts({
respectExternal: true
})
// {
// generateBundle(options, bundle) {
// for (let chunk of Object.values(bundle)) {
// chunk.code = `
// type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
// ${chunk.code}`
// }
// }
// }
]
};

function createCommonConfig(opt) {
return {
onwarn(warning, rollupWarn) {
// Not warn circular dependency
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
plugins: [
dts({
respectExternal: true,
// - `package.json` `{"type": "module"}` requires explicit file extensions in
// imports; otherwise `tsc` reports error TS(2834).
// - When importing a `.d.ts`, a proper solution can be
// `import {xxx} from "./yyy.js"` instead of `from "./yyy.d.ts"`; otherwise
// `tsc` reports error TS(2846).
// Use `explicitFileExtension: "js"` to use `.js` as the extension of a import paths.
explicitFileExtension: 'js',
umdExportName: opt.umdExportName,
})
// {
// generateBundle(options, bundle) {
// for (let chunk of Object.values(bundle)) {
// chunk.code = `
// type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
// ${chunk.code}`
// }
// }
// }
]
};
}

// Bundle chunks.
const parts = [
'core', 'charts', 'components', 'renderers', 'option', 'features'
'all', 'core', 'charts', 'components', 'renderers', 'option', 'features'
];
const inputs = {};
parts.forEach(partName => {
Expand All @@ -412,27 +423,39 @@ async function bundleDTS() {

const bundle = await rollup.rollup({
input: inputs,
...commonConfig
...createCommonConfig({})
});
let idx = 1;
await bundle.write({
dir: outDir,
minifyInternalExports: false,
manualChunks: (id) => {
// Only create one chunk.
// Only create one chunk. All of the public entries should import from 'shared.d.ts';
// otherwise TS error 2442 (Types have separate declarations of a private property)
// may occur.
return 'shared';
},
chunkFileNames: 'shared.d.ts'
});

// Bundle all in one
const bundleAllInOne = await rollup.rollup({
// Bundle a single, self-contained ESM `echarts/types/dist/echarts.d.ts` with no imports,
// for online type checkers (e.g., echarts-examples) usage.
const bundleStandaloneESM = await rollup.rollup({
input: nodePath.resolve(__dirname, `../types/src/export/all.d.ts`),
...commonConfig
...createCommonConfig({})
});
await bundleAllInOne.write({
await bundleStandaloneESM.write({
file: nodePath.resolve(outDir, 'echarts.d.ts')
});

// Bundle a UMD `echarts/types/dist/echarts.d.cts`.
// See section "TypeScript entries" in `echarts/package.README.md` for more details.
const bundleStandaloneCJS = await rollup.rollup({
input: nodePath.resolve(__dirname, `../types/src/export/all.d.ts`),
...createCommonConfig({umdExportName: 'echarts'})
});
await bundleStandaloneCJS.write({
file: nodePath.resolve(outDir, 'echarts.d.cts')
});
}

function readTSConfig() {
Expand All @@ -451,8 +474,9 @@ function generateEntries() {
fs.writeFileSync(nodePath.join(__dirname, `../${entryPath}.js`), jsCode, 'utf-8');
}

// Make the d.ts in the same dir as .js, so that the can be found by tsc.
// package.json "types" in "exports" does not always seam to work.
// Create xxx.d.ts in the same dir with xxx.js, so that they can be found by `tsc`.
// This way is more reliable than using "types" field in `package.json` "exports"
// considering older versions of `tsc`.
const dtsCode = fs.readFileSync(nodePath.join(__dirname, `/template/${entryPath}.d.ts`), 'utf-8');
fs.writeFileSync(nodePath.join(__dirname, `../${entryPath}.d.ts`), dtsCode, 'utf-8');
});
Expand Down
4 changes: 3 additions & 1 deletion build/template/charts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* under the License.
*/

export * from './types/dist/charts';
// A pseudo `.js` to redirect to `.d.ts`.
export * from './types/dist/charts.js';
// See section "TypeScript entries" in `echarts/package.README.md` for more details.
4 changes: 3 additions & 1 deletion build/template/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* under the License.
*/

export * from './types/dist/components';
// A pseudo `.js` to redirect to `.d.ts`.
export * from './types/dist/components.js';
// See section "TypeScript entries" in `echarts/package.README.md` for more details.
4 changes: 3 additions & 1 deletion build/template/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* under the License.
*/

export * from './types/dist/core';
// A pseudo `.js` to redirect to `.d.ts`.
export * from './types/dist/core.js';
// See section "TypeScript entries" in `echarts/package.README.md` for more details.
4 changes: 3 additions & 1 deletion build/template/features.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* under the License.
*/

export * from './types/dist/features';
// A pseudo `.js` to redirect to `.d.ts`.
export * from './types/dist/features.js';
// See section "TypeScript entries" in `echarts/package.README.md` for more details.
4 changes: 3 additions & 1 deletion build/template/option.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* under the License.
*/

export * from './types/dist/option';
// A pseudo `.js` to redirect to `.d.ts`.
export * from './types/dist/option.js';
// See section "TypeScript entries" in `echarts/package.README.md` for more details.
4 changes: 3 additions & 1 deletion build/template/renderers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* under the License.
*/

export * from './types/dist/renderers';
// A pseudo `.js` to redirect to `.d.ts`.
export * from './types/dist/renderers.js';
// See section "TypeScript entries" in `echarts/package.README.md` for more details.
4 changes: 3 additions & 1 deletion build/template/ssr/client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* under the License.
*/

export * from './types/index';
// A pseudo `.js` to redirect to `.d.ts`.
// See `package.README.json` for more details.
export * from './types/index.js';
119 changes: 101 additions & 18 deletions build/testDts.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,113 @@ async function installTs() {
}

async function runTests() {
const compilerOptions = {
declaration: false,
importHelpers: false,
sourceMap: false,
pretty: false,
removeComments: false,
allowJs: false,
outDir: __dirname + '/../test/types/tmp',
typeRoots: [__dirname + '/../types/dist'],
rootDir: __dirname + '/../test/types',

// Must pass in most strict cases
strict: true
};
const testsList = await globby(__dirname + '/../test/types/*.ts');
const casesESM = await globby(__dirname + '/../test/types/esm/*.ts');
const casesCJS = await globby(__dirname + '/../test/types/cjs/*.ts');
const casesNoModule = await globby(__dirname + '/../test/types/no-module/*.ts');

const tsVersions = getTypeScriptVersions();

function createCompilerOptions(overrideOptions) {
return {
declaration: false,
importHelpers: false,
sourceMap: false,
pretty: false,
removeComments: false,
allowJs: false,
rootDir: __dirname + '/../test/types',
outDir: __dirname + '/../test/types/tmp',
// Disable global types, necessary to avoid other
// irrelevant node_modules types interference.
typeRoots: [],
// Must pass in most strict cases
strict: true,
...overrideOptions
};
};

async function singleTest(ts, tsVersion, tsconfigModule, tsconfigModuleResolution, testList) {
if (!isSupportedTSConfigModuleField(ts, tsconfigModule)) {
console.log(`Skip: tsVersion: ${tsVersion} does not support {"module": "${tsconfigModule}"}.`);
return;
}
if (!isSupportedTSConfigModuleResolutionField(ts, tsVersion, tsconfigModuleResolution)) {
console.log(`Skip: tsVersion: ${tsVersion} does not support {"moduleResolution": "${tsconfigModuleResolution}"}.`);
return;
}

console.log(`Testing: tsVersion: ${tsVersion}, tsconfig: {"module": "${tsconfigModule}", "moduleResolution": "${tsconfigModuleResolution}"}`);
await runTsCompile(ts, createCompilerOptions({
// noEmit: true,
module: tsconfigModule,
moduleResolution: tsconfigModuleResolution,
}), testList);
}

for (const version of tsVersions) {
console.log(`Testing ts version ${version}`);
const ts = require(typeScriptPath(version));
await runTsCompile(ts, compilerOptions, testsList);

console.log(`Finished test of ts version ${version}`);
// console.log(ts.ModuleKind);
// console.log(ts.ModuleResolutionKind);

// await singleTest(ts, version, undefined , undefined, casesESM);
// await singleTest(ts, version, 'None', 'classic', casesNoModule);
// await singleTest(ts, version, 'CommonJS', 'node', casesESM);
// await singleTest(ts, version, 'CommonJS', 'node', casesCJS);
// await singleTest(ts, version, 'ESNext', 'node', casesESM);
// await singleTest(ts, version, 'ESNext', 'Bundler', casesESM);
await singleTest(ts, version, 'NodeNext', 'NodeNext', casesESM);
// await singleTest(ts, version, 'NodeNext', 'NodeNext', casesCJS);

console.log(`Finished test of tsVersion ${version}`);
}
}

function isSupportedTSConfigModuleField(ts, moduleName) {
if (moduleName === undefined) {
return true;
}
const map = {
'none': 'None',
'commonjs': 'CommonJS',
'amd': 'AMD',
'umd': 'UMD',
'system': 'System',
'es6': 'ES2015',
'es2015': 'ES2015',
'es2020': 'ES2020',
'es2022': 'ES2022',
'esnext': 'ESNext',
'node16': 'Node16',
'nodenext': 'NodeNext',
};
const enumKey = map[moduleName.toLowerCase()];
return enumKey != null && ts.ModuleKind[enumKey] != null;
}

function isSupportedTSConfigModuleResolutionField(ts, tsVersion, moduleResolutionName) {
if (moduleResolutionName === undefined) {
return true;
}
const map = {
'classic': 'Classic',
'node': 'NodeJs',
// 'nodejs': 'NodeJs', // Older TS do not support value "nodejs".
'node10': 'Node10',
'node16': 'Node16',
'nodenext': 'NodeNext',
'bundler': 'Bundler',
};
const enumKey = map[moduleResolutionName.toLowerCase()];

if (enumKey === 'NodeNext') {
// "NodeNext" is unstable before TSv4.7, and error will be thrown.
if (semver.lt(tsVersion + '.0', '4.7.0')) {
return false;
}
}

return enumKey != null && ts.ModuleResolutionKind[enumKey] != null;
}

function getTypeScriptVersions() {
Expand Down
13 changes: 12 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@
* under the License.
*/

/**
* @deprecated
* Temporarily retain it in case users reference it like this:
* ```ts
* /// <reference path="../node_modules/echarts/index.d.ts" />
* var myChart = echarts.init(...);
* ```
*
* See section "TypeScript entries" in `echarts/package.README.md` for more details.
*/

import * as echarts from './types/dist/echarts';
// Export for UMD module.
export as namespace echarts;
export = echarts;
export = echarts;
Loading
Loading