-import {Chart} from '../dist/types';
+import {Chart} from '../dist/types.js';
-export * from '../dist/types';
+export * from '../dist/types.js';
export default Chart;
-export * from '../dist/helpers/types';
+export * from '../dist/helpers.js';
"unpkg": "./dist/chart.umd.js",
"main": "./dist/chart.js",
"exports": {
- ".": "./dist/chart.js",
- "./auto": "./auto/auto.js",
- "./helpers": "./helpers/helpers.js"
+ ".": {
+ "import": "./dist/chart.js",
+ "types": "./dist/types.d.ts"
+ },
+ "./auto": {
+ "import": "./auto/auto.js",
+ "types": "./auto/auto.d.ts"
+ },
+ "./helpers": {
+ "import": "./helpers/helpers.js",
+ "types": "./helpers/helpers.d.ts"
+ }
},
"types": "./dist/types.d.ts",
"keywords": [
"files": [
"auto/**",
"dist/**",
- "types/**",
"helpers/**"
],
"scripts": {
"autobuild": "rollup -c -w",
- "emitDeclarations": "tsc --emitDeclarationOnly",
- "build": "rollup -c && npm run emitDeclarations",
+ "build": "tsc --noEmit && rollup -c",
"dev": "karma start ./karma.conf.cjs --auto-watch --no-single-run --browsers chrome --grep",
"dev:ff": "karma start ./karma.conf.cjs --auto-watch --no-single-run --browsers firefox --grep",
"docs": "pnpm run build && pnpm --filter \"./docs/**\" build",
"docs:dev": "pnpm run build && pnpm --filter \"./docs/**\" dev",
"lint-js": "eslint \"src/**/*.{js,ts}\" \"test/**/*.js\" \"docs/**/*.js\"",
"lint-md": "eslint \"**/*.md\"",
- "lint-types": "eslint \"types/**/*.ts\" && pnpm run build && node types/tests/autogen.js && tsc -p types/tests/",
+ "lint-types": "eslint \"types/**/*.ts\" && pnpm build && node types/tests/autogen.js && tsc -p types/tests/",
"lint": "concurrently \"pnpm:lint-*\"",
"test-size": "size-limit",
"test": "pnpm lint && pnpm test-ci",
"pixelmatch": "^5.3.0",
"rollup": "^2.77.2",
"rollup-plugin-cleanup": "^3.2.1",
+ "rollup-plugin-dts": "^4.2.2",
"rollup-plugin-istanbul": "^3.0.0",
"rollup-plugin-swc3": "^0.3.0",
"rollup-plugin-terser": "^7.0.2",
"html-entities": "1.4.0"
},
"peerDependencyRules": {
- "ignoreMissing": ["chart.js"]
+ "ignoreMissing": [
+ "chart.js"
+ ]
}
}
}
pixelmatch: ^5.3.0
rollup: ^2.77.2
rollup-plugin-cleanup: ^3.2.1
+ rollup-plugin-dts: ^4.2.2
rollup-plugin-istanbul: ^3.0.0
rollup-plugin-swc3: ^0.3.0
rollup-plugin-terser: ^7.0.2
pixelmatch: 5.3.0
rollup: 2.77.2
rollup-plugin-cleanup: 3.2.1_rollup@2.77.2
+ rollup-plugin-dts: 4.2.2_oo3i3f3qmqiztdz5qgxrrjmd5e
rollup-plugin-istanbul: 3.0.0_rollup@2.77.2
rollup-plugin-swc3: 0.3.0_niznp7c4dpiumotw6saahmrjuy
rollup-plugin-terser: 7.0.2_rollup@2.77.2
typescript: 4.7.4
web-vitals: 2.1.4
+ test/integration/typescript-node:
+ specifiers:
+ chart.js: workspace:*
+ ts-expect: ^1.3.0
+ typescript: ^4.7.4
+ dependencies:
+ chart.js: link:../../..
+ typescript: 4.7.4
+ devDependencies:
+ ts-expect: 1.3.0
+
+ test/integration/typescript-node-next:
+ specifiers:
+ chart.js: workspace:*
+ ts-expect: ^1.3.0
+ typescript: ^4.7.4
+ dependencies:
+ chart.js: link:../../..
+ typescript: 4.7.4
+ devDependencies:
+ ts-expect: 1.3.0
+
packages:
/@ampproject/remapping/2.2.0:
dependencies:
sourcemap-codec: 1.4.8
+ /magic-string/0.26.3:
+ resolution: {integrity: sha512-u1Po0NDyFcwdg2nzHT88wSK0+Rih0N1M+Ph1Sp08k8yvFFU3KR72wryS7e1qMPJypt99WB7fIFVCA92mQrMjrg==}
+ engines: {node: '>=12'}
+ dependencies:
+ sourcemap-codec: 1.4.8
+ dev: true
+
/make-dir/2.1.0:
resolution: {integrity: sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==}
engines: {node: '>=6'}
rollup-pluginutils: 2.8.2
dev: true
+ /rollup-plugin-dts/4.2.2_oo3i3f3qmqiztdz5qgxrrjmd5e:
+ resolution: {integrity: sha512-A3g6Rogyko/PXeKoUlkjxkP++8UDVpgA7C+Tdl77Xj4fgEaIjPSnxRmR53EzvoYy97VMVwLAOcWJudaVAuxneQ==}
+ engines: {node: '>=v12.22.11'}
+ peerDependencies:
+ rollup: ^2.55
+ typescript: ^4.1
+ dependencies:
+ magic-string: 0.26.3
+ rollup: 2.77.2
+ typescript: 4.7.4
+ optionalDependencies:
+ '@babel/code-frame': 7.18.6
+ dev: true
+
/rollup-plugin-istanbul/3.0.0_rollup@2.77.2:
resolution: {integrity: sha512-z8kD2A57qTcxgqjbJ8cZBBE/IGYk+iJtE42sCaZjrSe/uBEUq5jJYvQwquJ+Acfko1LMYww4EJfeMJmc0GttpQ==}
peerDependencies:
resolution: {integrity: sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==}
dev: false
+ /ts-expect/1.3.0:
+ resolution: {integrity: sha512-e4g0EJtAjk64xgnFPD6kTBUtpnMVzDrMb12N1YZV0VvSlhnVT3SGxiYTLdGy8Q5cYHOIC/FAHmZ10eGrAguicQ==}
+ dev: true
+
/tsconfig-paths/3.14.1:
resolution: {integrity: sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==}
dependencies:
import resolve from '@rollup/plugin-node-resolve';
import {swc} from 'rollup-plugin-swc3';
import {terser} from 'rollup-plugin-terser';
+import dts from 'rollup-plugin-dts';
import {readFileSync} from 'fs';
const {version, homepage} = JSON.parse(readFileSync('./package.json'));
indent: false,
sourcemap: true,
},
+ },
+
+ // Types
+ // dist/types.d.ts
+ // dist/helpers.d.ts
+ {
+ input: {
+ 'dist/types': 'src/types.ts',
+ 'dist/helpers': 'src/helpers/types.ts'
+ },
+ plugins: [dts()],
+ output: {
+ dir: './',
+ chunkFileNames: 'dist/chunks/[name].d.ts',
+ entryFileNames: '[name].d.ts',
+ format: 'es'
+ }
}
];
--- /dev/null
+{
+ "private": true,
+ "type": "module",
+ "description": "chart.js should work in node next typescript project",
+ "dependencies": {
+ "chart.js": "workspace:*",
+ "typescript": "^4.7.4"
+ },
+ "scripts": {
+ "test": "tsc"
+ },
+ "devDependencies": {
+ "ts-expect": "^1.3.0"
+ }
+}
--- /dev/null
+/* eslint-disable @typescript-eslint/no-explicit-any, no-console */
+import {Chart} from 'chart.js';
+import AutoChart from 'chart.js/auto';
+import {debounce} from 'chart.js/helpers';
+import {TypeOf, expectType} from 'ts-expect';
+
+expectType<TypeOf<typeof Chart.register, any>>(false);
+expectType<TypeOf<typeof AutoChart.register, any>>(false);
+expectType<TypeOf<typeof debounce, any>>(false);
--- /dev/null
+{
+ "compilerOptions": {
+ "moduleResolution": "NodeNext",
+ "noEmit": true,
+ "lib": ["es2018", "DOM"]
+ },
+ "include": [
+ "./src/**/*.ts",
+ ]
+}
--- /dev/null
+{
+ "private": true,
+ "type": "module",
+ "description": "chart.js should work in node typescript project",
+ "dependencies": {
+ "chart.js": "workspace:*",
+ "typescript": "^4.7.4"
+ },
+ "scripts": {
+ "test": "tsc"
+ },
+ "devDependencies": {
+ "ts-expect": "^1.3.0"
+ }
+}
--- /dev/null
+/* eslint-disable @typescript-eslint/no-explicit-any, no-console */
+import {Chart} from 'chart.js';
+import AutoChart from 'chart.js/auto';
+import {debounce} from 'chart.js/helpers';
+import {TypeOf, expectType} from 'ts-expect';
+
+expectType<TypeOf<typeof Chart.register, any>>(false);
+expectType<TypeOf<typeof AutoChart.register, any>>(false);
+expectType<TypeOf<typeof debounce, any>>(false);
--- /dev/null
+{
+ "compilerOptions": {
+ "moduleResolution": "Node",
+ "noEmit": true,
+ "lib": ["es2018", "DOM"]
+ },
+ "include": [
+ "./src/**/*.ts",
+ ]
+}
try {
const fn = path.resolve(__dirname, 'autogen_helpers.ts');
fd = fs.openSync(fn, 'w+');
- fs.writeSync(fd, 'import * as helpers from \'../../src/helpers/types\';\n\n');
+ fs.writeSync(fd, 'import * as helpers from \'../../dist/helpers\';\n\n');
fs.writeSync(fd, 'const testKeys: unknown[] = [];\n');
for (const key of Object.keys(helpers)) {