diff --git a/build/rolldown.config.mjs b/build/rolldown.config.mjs index d2b5cf7bf4..13bef8712e 100644 --- a/build/rolldown.config.mjs +++ b/build/rolldown.config.mjs @@ -40,7 +40,7 @@ if (BUNDLE) { } const rolldownConfig = { - input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`), + input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.ts`), // oxc strips the types and lowers the syntax, so the dist path carries no // Babel. The targets come from .browserslistrc, the same source Babel read. transform: { diff --git a/build/tsconfig.entries.json b/build/tsconfig.entries.json new file mode 100644 index 0000000000..5933d244e8 --- /dev/null +++ b/build/tsconfig.entries.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + // The bundle entries are rolldown inputs, not part of the published type + // surface (build/tsconfig.dts.json emits from js/src only), so the per-file + // declaration constraints that keep js/src emittable do not apply here. The + // UMD entry cannot satisfy them anyway: a default-exported object of + // component classes is not inferable under isolatedDeclarations, and the + // explicit-value workaround collides with object-shorthand. + "declaration": false, + "isolatedDeclarations": false + }, + "include": ["../js/index.esm.ts", "../js/index.umd.ts"] +} diff --git a/eslint.config.mjs b/eslint.config.mjs index 2bce470c4f..c6eebfc191 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -149,7 +149,7 @@ export default [ { // The library sources are migrating to TypeScript file by file, so this // block only applies where a `.ts` file already exists. - files: ['js/src/**/*.ts', 'js/tests/vitest.config.mts'], + files: ['js/index.esm.ts', 'js/index.umd.ts', 'js/src/**/*.ts', 'js/tests/vitest.config.mts'], languageOptions: { parser: tseslint.parser, sourceType: 'module' diff --git a/js/index.esm.js b/js/index.esm.ts similarity index 90% rename from js/index.esm.js rename to js/index.esm.ts index 76e194b509..d0628af55f 100644 --- a/js/index.esm.js +++ b/js/index.esm.ts @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * CoreUI PRO index.esm.js + * CoreUI PRO index.esm.ts * Licensed under MIT (https://coreui.io/pro/license/) * -------------------------------------------------------------------------- */ diff --git a/js/index.umd.js b/js/index.umd.ts similarity index 95% rename from js/index.umd.js rename to js/index.umd.ts index 89c1368bc9..fbaf30d4ab 100644 --- a/js/index.umd.js +++ b/js/index.umd.ts @@ -1,7 +1,7 @@ /** * -------------------------------------------------------------------------- - * CoreUI PRO index.esm.js - * Licensed under MIT (Licensed under MIT (https://coreui.io/pro/license/) + * CoreUI PRO index.umd.ts + * Licensed under MIT (https://coreui.io/pro/license/) * -------------------------------------------------------------------------- */ diff --git a/package.json b/package.json index 5d64562248..50adc80740 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "js-compile-bundle": "rolldown --environment BUNDLE:true --config build/rolldown.config.mjs --sourcemap", "js-compile-bundle-bootstrap": "rolldown --environment BOOTSTRAP:true,BUNDLE:true --config build/rolldown.config.mjs --sourcemap", "js-compile-plugins": "node build/build-plugins.mjs", - "js-typecheck": "tsc --noEmit", + "js-typecheck": "npm-run-all --aggregate-output --parallel js-typecheck-src js-typecheck-entries", + "js-typecheck-src": "tsc --noEmit", + "js-typecheck-entries": "tsc --project build/tsconfig.entries.json", "js-typecheck-dist": "tsc --project js/tests/types/tsconfig.json", "js-emit-types": "tsc --project build/tsconfig.dts.json", "js-lint": "eslint --cache --cache-location .cache/.eslintcache --report-unused-disable-directives",