Skip to content

Commit b8829b3

Browse files
committed
Switch to unplugin-vts
Workaround for qmhc/unplugin-dts#467 And tweak tsconfigs
1 parent 757d724 commit b8829b3

File tree

10 files changed

+108
-106
lines changed

10 files changed

+108
-106
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
"postcss-mixins": "patches/postcss-mixins.patch",
6969
"app-builder-lib": "patches/app-builder-lib.patch",
7070
"knip": "patches/knip.patch",
71-
"plist": "patches/plist.patch"
71+
"plist": "patches/plist.patch",
72+
"unplugin-dts": "patches/unplugin-dts.patch"
7273
},
7374
"peerDependencyRules": {
7475
"allowedVersions": {

packages/module-api/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@
4141
"rollup-plugin-external-globals": "^0.13.0",
4242
"semver": "^7.6.3",
4343
"typescript": "^6.0.0",
44+
"unplugin-dts": "1.0.0-beta.6",
4445
"vite": "^7.3.2",
45-
"vite-plugin-dts": "^4.5.0",
4646
"vitest": "^4.0.0",
4747
"vitest-sonar-reporter": "^3.0.0"
4848
},
4949
"peerDependencies": {
5050
"@matrix-org/react-sdk-module-api": "*",
5151
"@types/react": "*",
5252
"@types/react-dom": "*",
53-
"matrix-widget-api": "*",
5453
"matrix-web-i18n": "*",
54+
"matrix-widget-api": "*",
5555
"react": "^19"
5656
},
5757
"peerDependenciesMeta": {
@@ -64,6 +64,5 @@
6464
"matrix-web-i18n": {
6565
"optional": true
6666
}
67-
},
68-
"dependencies": {}
67+
}
6968
}

packages/module-api/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"$schema": "http://json.schemastore.org/tsconfig",
33
"compilerOptions": {
4+
"rootDir": "./src",
45
"target": "esnext",
56
"lib": ["dom", "es2022", "esnext"],
67
"esModuleInterop": true,

packages/module-api/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
88
import { dirname, resolve } from "node:path";
99
import { fileURLToPath } from "node:url";
1010
import { defineConfig } from "vite";
11-
import dts from "vite-plugin-dts";
11+
import dts from "unplugin-dts/vite";
1212
import externalGlobals from "rollup-plugin-external-globals";
1313

1414
import packageJson from "./package.json" with { type: "json" };

packages/playwright-common/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"$schema": "http://json.schemastore.org/tsconfig",
33
"compilerOptions": {
4+
"rootDir": "./src",
45
"target": "esnext",
56
"lib": ["dom", "es2022", "esnext"],
67
"esModuleInterop": true,

packages/shared-components/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"@fetch-mock/vitest": "^0.2.18",
7575
"@fontsource/inter": "catalog:",
7676
"@matrix-org/react-sdk-module-api": "^2.5.0",
77+
"@microsoft/api-extractor": "^7.56.0",
7778
"@playwright/test": "catalog:",
7879
"@storybook/addon-a11y": "^10.0.7",
7980
"@storybook/addon-designs": "^11.0.1",
@@ -113,8 +114,8 @@
113114
"typedoc-plugin-markdown": "^4.9.0",
114115
"typedoc-plugin-missing-exports": "^4.1.2",
115116
"typescript": "catalog:",
117+
"unplugin-dts": "1.0.0-beta.6",
116118
"vite": "^8.0.0",
117-
"vite-plugin-dts": "^4.5.4",
118119
"vite-plugin-node-polyfills": "^0.26.0",
119120
"vitest": "^4.0.18",
120121
"vitest-sonar-reporter": "^3.0.0"

packages/shared-components/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"rootDir": "./src",
34
"allowImportingTsExtensions": true,
45
"experimentalDecorators": false,
56
"emitDecoratorMetadata": false,

packages/shared-components/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { dirname, resolve } from "node:path";
1010
import { fileURLToPath } from "node:url";
1111
import { defineConfig, esmExternalRequirePlugin } from "vite";
12-
import dts from "vite-plugin-dts";
12+
import dts from "unplugin-dts/vite";
1313

1414
const __dirname = dirname(fileURLToPath(import.meta.url));
1515

@@ -51,7 +51,7 @@ export default defineConfig({
5151
},
5252
plugins: [
5353
dts({
54-
rollupTypes: true,
54+
bundleTypes: true,
5555
include: ["src/**/*.{ts,tsx}"],
5656
exclude: ["src/**/*.test.{ts,tsx}", "src/**/*.stories.{ts,tsx}"],
5757
copyDtsFiles: true,

patches/unplugin-dts.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/dist/shared/unplugin-dts.Dv6DEU-x.mjs b/dist/shared/unplugin-dts.Dv6DEU-x.mjs
2+
index ad5f1183abb26a97ed92068f623ef1eb61fc54ca..5e3e5d0d25fe067ecfd5f3f8ecbd4808139758b9 100644
3+
--- a/dist/shared/unplugin-dts.Dv6DEU-x.mjs
4+
+++ b/dist/shared/unplugin-dts.Dv6DEU-x.mjs
5+
@@ -920,7 +920,7 @@ class Runtime {
6+
const maybeEmitted = (sourceFile) => {
7+
return !(compilerOptions.noEmitForJsFiles && jsRE.test(sourceFile.fileName)) && !sourceFile.isDeclarationFile && !program.isSourceFileFromExternalLibrary(sourceFile);
8+
};
9+
- let publicRoot = compilerOptions.rootDir ? ensureAbsolute(resolveConfigDir(compilerOptions.rootDir, root), root) : compilerOptions.composite && compilerOptions.configFilePath ? dirname(compilerOptions.configFilePath) : queryPublicPath(
10+
+ let publicRoot = compilerOptions.rootDir ? ensureAbsolute(resolveConfigDir(compilerOptions.rootDir, root), root) : compilerOptions.composite && compilerOptions.configFilePath ? dirname(compilerOptions.configFilePath) : compare(ts.version, '6.0.0', '>=') ? (configPath ? dirname(configPath) : root) : queryPublicPath(
11+
program.getSourceFiles().filter(maybeEmitted).map((sourceFile) => sourceFile.fileName)
12+
);
13+
publicRoot = normalizePath(publicRoot);

0 commit comments

Comments
 (0)