diff --git a/package-lock.json b/package-lock.json index ddd8b42..09c1138 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,11 +21,12 @@ "copyfiles": "^2.4.1", "jsdom": "^25.0.1", "rollup-plugin-visualizer": "^5.12.0", + "rollup-preserve-directives": "^1.1.2", "tslib": "^2.8.0", "typedoc": "^0.26.10", "typescript": "^5.6.3", "vite": "^5.4.10", - "vite-plugin-dts": "^4.1.1", + "vite-plugin-dts": "^4.3.0", "vite-plugin-progress": "^0.0.7", "vitest": "^2.1.3" } @@ -1075,19 +1076,19 @@ } }, "node_modules/@microsoft/api-extractor": { - "version": "7.47.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.47.4.tgz", - "integrity": "sha512-HKm+P4VNzWwvq1Ey+Jfhhj/3MjsD+ka2hbt8L5AcRM95lu1MFOYnz3XlU7Gr79Q/ZhOb7W/imAKeYrOI0bFydg==", + "version": "7.47.11", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.47.11.tgz", + "integrity": "sha512-lrudfbPub5wzBhymfFtgZKuBvXxoSIAdrvS2UbHjoMT2TjIEddq6Z13pcve7A03BAouw0x8sW8G4txdgfiSwpQ==", "dev": true, "license": "MIT", "dependencies": { - "@microsoft/api-extractor-model": "7.29.4", + "@microsoft/api-extractor-model": "7.29.8", "@microsoft/tsdoc": "~0.15.0", "@microsoft/tsdoc-config": "~0.17.0", - "@rushstack/node-core-library": "5.5.1", + "@rushstack/node-core-library": "5.9.0", "@rushstack/rig-package": "0.5.3", - "@rushstack/terminal": "0.13.3", - "@rushstack/ts-command-line": "4.22.3", + "@rushstack/terminal": "0.14.2", + "@rushstack/ts-command-line": "4.23.0", "lodash": "~4.17.15", "minimatch": "~3.0.3", "resolve": "~1.22.1", @@ -1100,15 +1101,15 @@ } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.29.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.29.4.tgz", - "integrity": "sha512-LHOMxmT8/tU1IiiiHOdHFF83Qsi+V8d0kLfscG4EvQE9cafiR8blOYr8SfkQKWB1wgEilQgXJX3MIA4vetDLZw==", + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.29.8.tgz", + "integrity": "sha512-t3Z/xcO6TRbMcnKGVMs4uMzv/gd5j0NhMiJIGjD4cJMeFJ1Hf8wnLSx37vxlRlL0GWlGJhnFgxvnaL6JlS+73g==", "dev": true, "license": "MIT", "dependencies": { "@microsoft/tsdoc": "~0.15.0", "@microsoft/tsdoc-config": "~0.17.0", - "@rushstack/node-core-library": "5.5.1" + "@rushstack/node-core-library": "5.9.0" } }, "node_modules/@microsoft/api-extractor/node_modules/minimatch": { @@ -1480,9 +1481,9 @@ ] }, "node_modules/@rushstack/node-core-library": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.5.1.tgz", - "integrity": "sha512-ZutW56qIzH8xIOlfyaLQJFx+8IBqdbVCZdnj+XT1MorQ1JqqxHse8vbCpEM+2MjsrqcbxcgDIbfggB1ZSQ2A3g==", + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.9.0.tgz", + "integrity": "sha512-MMsshEWkTbXqxqFxD4gcIUWQOCeBChlGczdZbHfqmNZQFLHB3yWxDFSMHFUdu2/OB9NUk7Awn5qRL+rws4HQNg==", "dev": true, "license": "MIT", "dependencies": { @@ -1567,13 +1568,13 @@ } }, "node_modules/@rushstack/terminal": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.13.3.tgz", - "integrity": "sha512-fc3zjXOw8E0pXS5t9vTiIPx9gHA0fIdTXsu9mT4WbH+P3mYvnrX0iAQ5a6NvyK1+CqYWBTw/wVNx7SDJkI+WYQ==", + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.14.2.tgz", + "integrity": "sha512-2fC1wqu1VCExKC0/L+0noVcFQEXEnoBOtCIex1TOjBzEDWcw8KzJjjj7aTP6mLxepG0XIyn9OufeFb6SFsa+sg==", "dev": true, "license": "MIT", "dependencies": { - "@rushstack/node-core-library": "5.5.1", + "@rushstack/node-core-library": "5.9.0", "supports-color": "~8.1.1" }, "peerDependencies": { @@ -1586,13 +1587,13 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "4.22.3", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.22.3.tgz", - "integrity": "sha512-edMpWB3QhFFZ4KtSzS8WNjBgR4PXPPOVrOHMbb7kNpmQ1UFS9HdVtjCXg1H5fG+xYAbeE+TMPcVPUyX2p84STA==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.0.tgz", + "integrity": "sha512-jYREBtsxduPV6ptNq8jOKp9+yx0ld1Tb/Tkdnlj8gTjazl1sF3DwX2VbluyYrNd0meWIL0bNeer7WDf5tKFjaQ==", "dev": true, "license": "MIT", "dependencies": { - "@rushstack/terminal": "0.13.3", + "@rushstack/terminal": "0.14.2", "@types/argparse": "1.0.38", "argparse": "~1.0.9", "string-argv": "~0.3.1" @@ -2022,61 +2023,48 @@ } }, "node_modules/@volar/language-core": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.3.4.tgz", - "integrity": "sha512-wXBhY11qG6pCDAqDnbBRFIDSIwbqkWI7no+lj5+L7IlA7HRIjRP7YQLGzT0LF4lS6eHkMSsclXqy9DwYJasZTQ==", + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.10.tgz", + "integrity": "sha512-hG3Z13+nJmGaT+fnQzAkS0hjJRa2FCeqZt6Bd+oGNhUkQ+mTFsDETg5rqUTxyzIh5pSOGY7FHCWUS8G82AzLCA==", "dev": true, "license": "MIT", "dependencies": { - "@volar/source-map": "2.3.4" + "@volar/source-map": "2.4.10" } }, "node_modules/@volar/source-map": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.3.4.tgz", - "integrity": "sha512-C+t63nwcblqLIVTYXaVi/+gC8NukDaDIQI72J3R7aXGvtgaVB16c+J8Iz7/VfOy7kjYv7lf5GhBny6ACw9fTGQ==", + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.10.tgz", + "integrity": "sha512-OCV+b5ihV0RF3A7vEvNyHPi4G4kFa6ukPmyVocmqm5QzOd8r5yAtiNvaPEjl8dNvgC/lj4JPryeeHLdXd62rWA==", "dev": true, "license": "MIT" }, "node_modules/@volar/typescript": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.3.4.tgz", - "integrity": "sha512-acCvt7dZECyKcvO5geNybmrqOsu9u8n5XP1rfiYsOLYGPxvHRav9BVmEdRyZ3vvY6mNyQ1wLL5Hday4IShe17w==", + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.10.tgz", + "integrity": "sha512-F8ZtBMhSXyYKuBfGpYwqA5rsONnOwAVvjyE7KPYJ7wgZqo2roASqNWUnianOomJX5u1cxeRooHV59N0PhvEOgw==", "dev": true, "license": "MIT", "dependencies": { - "@volar/language-core": "2.3.4", + "@volar/language-core": "2.4.10", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "node_modules/@vue/compiler-core": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.37.tgz", - "integrity": "sha512-ZDDT/KiLKuCRXyzWecNzC5vTcubGz4LECAtfGPENpo0nrmqJHwuWtRLxk/Sb9RAKtR9iFflFycbkjkY+W/PZUQ==", + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.12.tgz", + "integrity": "sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.24.7", - "@vue/shared": "3.4.37", - "entities": "^5.0.0", + "@babel/parser": "^7.25.3", + "@vue/shared": "3.5.12", + "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.0" } }, - "node_modules/@vue/compiler-core/node_modules/entities": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-5.0.0.tgz", - "integrity": "sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/@vue/compiler-core/node_modules/estree-walker": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", @@ -2085,14 +2073,14 @@ "license": "MIT" }, "node_modules/@vue/compiler-dom": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.37.tgz", - "integrity": "sha512-rIiSmL3YrntvgYV84rekAtU/xfogMUJIclUMeIKEtVBFngOL3IeZHhsH3UaFEgB5iFGpj6IW+8YuM/2Up+vVag==", + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.12.tgz", + "integrity": "sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg==", "dev": true, "license": "MIT", "dependencies": { - "@vue/compiler-core": "3.4.37", - "@vue/shared": "3.4.37" + "@vue/compiler-core": "3.5.12", + "@vue/shared": "3.5.12" } }, "node_modules/@vue/compiler-vue2": { @@ -2107,13 +2095,13 @@ } }, "node_modules/@vue/language-core": { - "version": "2.0.29", - "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-2.0.29.tgz", - "integrity": "sha512-o2qz9JPjhdoVj8D2+9bDXbaI4q2uZTHQA/dbyZT4Bj1FR9viZxDJnLcKVHfxdn6wsOzRgpqIzJEEmSSvgMvDTQ==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-2.1.6.tgz", + "integrity": "sha512-MW569cSky9R/ooKMh6xa2g1D0AtRKbL56k83dzus/bx//RDJk24RHWkMzbAlXjMdDNyxAaagKPRquBIxkxlCkg==", "dev": true, "license": "MIT", "dependencies": { - "@volar/language-core": "~2.4.0-alpha.18", + "@volar/language-core": "~2.4.1", "@vue/compiler-dom": "^3.4.0", "@vue/compiler-vue2": "^2.7.16", "@vue/shared": "^3.4.0", @@ -2131,27 +2119,10 @@ } } }, - "node_modules/@vue/language-core/node_modules/@volar/language-core": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.0-alpha.18.tgz", - "integrity": "sha512-JAYeJvYQQROmVRtSBIczaPjP3DX4QW1fOqW1Ebs0d3Y3EwSNRglz03dSv0Dm61dzd0Yx3WgTW3hndDnTQqgmyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@volar/source-map": "2.4.0-alpha.18" - } - }, - "node_modules/@vue/language-core/node_modules/@volar/source-map": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.0-alpha.18.tgz", - "integrity": "sha512-MTeCV9MUwwsH0sNFiZwKtFrrVZUK6p8ioZs3xFzHc2cvDXHWlYN3bChdQtwKX+FY2HG6H3CfAu1pKijolzIQ8g==", - "dev": true, - "license": "MIT" - }, "node_modules/@vue/shared": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.37.tgz", - "integrity": "sha512-nIh8P2fc3DflG8+5Uw8PT/1i17ccFn0xxN/5oE9RfV5SVnd7G0XEFRwakrnNFE/jlS95fpGXDVG5zDETS26nmg==", + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.12.tgz", + "integrity": "sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg==", "dev": true, "license": "MIT" }, @@ -3400,16 +3371,6 @@ "node": ">=6 <7 || >=8" } }, - "node_modules/fs-extra/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3436,6 +3397,7 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3518,6 +3480,7 @@ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, + "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, @@ -3674,9 +3637,9 @@ "license": "ISC" }, "node_modules/is-core-module": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz", - "integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", "dev": true, "license": "MIT", "dependencies": { @@ -5001,6 +4964,19 @@ } } }, + "node_modules/rollup-preserve-directives": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/rollup-preserve-directives/-/rollup-preserve-directives-1.1.2.tgz", + "integrity": "sha512-OOaYh4zO0Dcd/eVWGB8H69CgTiohl+jJqc2TLtjLENVIQaV2rxO3OW6RILzCQOdDvPT+/rzwRp+97OXhem895Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.5" + }, + "peerDependencies": { + "rollup": "^2.0.0 || ^3.0.0 || ^4.0.0" + } + }, "node_modules/rrweb-cssom": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", @@ -5890,6 +5866,16 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -6060,22 +6046,21 @@ } }, "node_modules/vite-plugin-dts": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-4.1.1.tgz", - "integrity": "sha512-SxYXwJQbAZ1IMtGEcOuzzZtDWCdcV2JkU7esvpPA8E5tIWVcJB42rZwN9EdULicWGLfaXrUgPIGVSidXBTae2Q==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-4.3.0.tgz", + "integrity": "sha512-LkBJh9IbLwL6/rxh0C1/bOurDrIEmRE7joC+jFdOEEciAFPbpEKOLSAr5nNh5R7CJ45cMbksTrFfy52szzC5eA==", "dev": true, "license": "MIT", "dependencies": { - "@microsoft/api-extractor": "7.47.4", + "@microsoft/api-extractor": "^7.47.11", "@rollup/pluginutils": "^5.1.0", - "@volar/typescript": "^2.3.4", - "@vue/language-core": "2.0.29", + "@volar/typescript": "^2.4.4", + "@vue/language-core": "2.1.6", "compare-versions": "^6.1.1", "debug": "^4.3.6", "kolorist": "^1.8.0", "local-pkg": "^0.5.0", - "magic-string": "^0.30.11", - "vue-tsc": "2.0.29" + "magic-string": "^0.30.11" }, "engines": { "node": "^14.18.0 || >=16.0.0" @@ -6194,53 +6179,6 @@ "dev": true, "license": "MIT" }, - "node_modules/vue-tsc": { - "version": "2.0.29", - "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-2.0.29.tgz", - "integrity": "sha512-MHhsfyxO3mYShZCGYNziSbc63x7cQ5g9kvijV7dRe1TTXBRLxXyL0FnXWpUF1xII2mJ86mwYpYsUmMwkmerq7Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@volar/typescript": "~2.4.0-alpha.18", - "@vue/language-core": "2.0.29", - "semver": "^7.5.4" - }, - "bin": { - "vue-tsc": "bin/vue-tsc.js" - }, - "peerDependencies": { - "typescript": ">=5.0.0" - } - }, - "node_modules/vue-tsc/node_modules/@volar/language-core": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.0-alpha.18.tgz", - "integrity": "sha512-JAYeJvYQQROmVRtSBIczaPjP3DX4QW1fOqW1Ebs0d3Y3EwSNRglz03dSv0Dm61dzd0Yx3WgTW3hndDnTQqgmyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@volar/source-map": "2.4.0-alpha.18" - } - }, - "node_modules/vue-tsc/node_modules/@volar/source-map": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.0-alpha.18.tgz", - "integrity": "sha512-MTeCV9MUwwsH0sNFiZwKtFrrVZUK6p8ioZs3xFzHc2cvDXHWlYN3bChdQtwKX+FY2HG6H3CfAu1pKijolzIQ8g==", - "dev": true, - "license": "MIT" - }, - "node_modules/vue-tsc/node_modules/@volar/typescript": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.0-alpha.18.tgz", - "integrity": "sha512-sXh5Y8sqGUkgxpMWUGvRXggxYHAVxg0Pa1C42lQZuPDrW6vHJPR0VCK8Sr7WJsAW530HuNQT/ZIskmXtxjybMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@volar/language-core": "2.4.0-alpha.18", - "path-browserify": "^1.0.1", - "vscode-uri": "^3.0.8" - } - }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", @@ -6670,9 +6608,6 @@ "license": "MIT", "devDependencies": { "@microsoft/tsdoc": "^0.15.0" - }, - "engines": { - "node": ">=20.0.0" } }, "packages/react": { @@ -7358,18 +7293,18 @@ } }, "@microsoft/api-extractor": { - "version": "7.47.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.47.4.tgz", - "integrity": "sha512-HKm+P4VNzWwvq1Ey+Jfhhj/3MjsD+ka2hbt8L5AcRM95lu1MFOYnz3XlU7Gr79Q/ZhOb7W/imAKeYrOI0bFydg==", + "version": "7.47.11", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.47.11.tgz", + "integrity": "sha512-lrudfbPub5wzBhymfFtgZKuBvXxoSIAdrvS2UbHjoMT2TjIEddq6Z13pcve7A03BAouw0x8sW8G4txdgfiSwpQ==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.29.4", + "@microsoft/api-extractor-model": "7.29.8", "@microsoft/tsdoc": "~0.15.0", "@microsoft/tsdoc-config": "~0.17.0", - "@rushstack/node-core-library": "5.5.1", + "@rushstack/node-core-library": "5.9.0", "@rushstack/rig-package": "0.5.3", - "@rushstack/terminal": "0.13.3", - "@rushstack/ts-command-line": "4.22.3", + "@rushstack/terminal": "0.14.2", + "@rushstack/ts-command-line": "4.23.0", "lodash": "~4.17.15", "minimatch": "~3.0.3", "resolve": "~1.22.1", @@ -7411,14 +7346,14 @@ } }, "@microsoft/api-extractor-model": { - "version": "7.29.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.29.4.tgz", - "integrity": "sha512-LHOMxmT8/tU1IiiiHOdHFF83Qsi+V8d0kLfscG4EvQE9cafiR8blOYr8SfkQKWB1wgEilQgXJX3MIA4vetDLZw==", + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.29.8.tgz", + "integrity": "sha512-t3Z/xcO6TRbMcnKGVMs4uMzv/gd5j0NhMiJIGjD4cJMeFJ1Hf8wnLSx37vxlRlL0GWlGJhnFgxvnaL6JlS+73g==", "dev": true, "requires": { "@microsoft/tsdoc": "~0.15.0", "@microsoft/tsdoc-config": "~0.17.0", - "@rushstack/node-core-library": "5.5.1" + "@rushstack/node-core-library": "5.9.0" } }, "@microsoft/tsdoc": { @@ -7669,9 +7604,9 @@ "optional": true }, "@rushstack/node-core-library": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.5.1.tgz", - "integrity": "sha512-ZutW56qIzH8xIOlfyaLQJFx+8IBqdbVCZdnj+XT1MorQ1JqqxHse8vbCpEM+2MjsrqcbxcgDIbfggB1ZSQ2A3g==", + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.9.0.tgz", + "integrity": "sha512-MMsshEWkTbXqxqFxD4gcIUWQOCeBChlGczdZbHfqmNZQFLHB3yWxDFSMHFUdu2/OB9NUk7Awn5qRL+rws4HQNg==", "dev": true, "requires": { "ajv": "~8.13.0", @@ -7727,22 +7662,22 @@ } }, "@rushstack/terminal": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.13.3.tgz", - "integrity": "sha512-fc3zjXOw8E0pXS5t9vTiIPx9gHA0fIdTXsu9mT4WbH+P3mYvnrX0iAQ5a6NvyK1+CqYWBTw/wVNx7SDJkI+WYQ==", + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.14.2.tgz", + "integrity": "sha512-2fC1wqu1VCExKC0/L+0noVcFQEXEnoBOtCIex1TOjBzEDWcw8KzJjjj7aTP6mLxepG0XIyn9OufeFb6SFsa+sg==", "dev": true, "requires": { - "@rushstack/node-core-library": "5.5.1", + "@rushstack/node-core-library": "5.9.0", "supports-color": "~8.1.1" } }, "@rushstack/ts-command-line": { - "version": "4.22.3", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.22.3.tgz", - "integrity": "sha512-edMpWB3QhFFZ4KtSzS8WNjBgR4PXPPOVrOHMbb7kNpmQ1UFS9HdVtjCXg1H5fG+xYAbeE+TMPcVPUyX2p84STA==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.0.tgz", + "integrity": "sha512-jYREBtsxduPV6ptNq8jOKp9+yx0ld1Tb/Tkdnlj8gTjazl1sF3DwX2VbluyYrNd0meWIL0bNeer7WDf5tKFjaQ==", "dev": true, "requires": { - "@rushstack/terminal": "0.13.3", + "@rushstack/terminal": "0.14.2", "@types/argparse": "1.0.38", "argparse": "~1.0.9", "string-argv": "~0.3.1" @@ -8084,50 +8019,44 @@ } }, "@volar/language-core": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.3.4.tgz", - "integrity": "sha512-wXBhY11qG6pCDAqDnbBRFIDSIwbqkWI7no+lj5+L7IlA7HRIjRP7YQLGzT0LF4lS6eHkMSsclXqy9DwYJasZTQ==", + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.10.tgz", + "integrity": "sha512-hG3Z13+nJmGaT+fnQzAkS0hjJRa2FCeqZt6Bd+oGNhUkQ+mTFsDETg5rqUTxyzIh5pSOGY7FHCWUS8G82AzLCA==", "dev": true, "requires": { - "@volar/source-map": "2.3.4" + "@volar/source-map": "2.4.10" } }, "@volar/source-map": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.3.4.tgz", - "integrity": "sha512-C+t63nwcblqLIVTYXaVi/+gC8NukDaDIQI72J3R7aXGvtgaVB16c+J8Iz7/VfOy7kjYv7lf5GhBny6ACw9fTGQ==", + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.10.tgz", + "integrity": "sha512-OCV+b5ihV0RF3A7vEvNyHPi4G4kFa6ukPmyVocmqm5QzOd8r5yAtiNvaPEjl8dNvgC/lj4JPryeeHLdXd62rWA==", "dev": true }, "@volar/typescript": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.3.4.tgz", - "integrity": "sha512-acCvt7dZECyKcvO5geNybmrqOsu9u8n5XP1rfiYsOLYGPxvHRav9BVmEdRyZ3vvY6mNyQ1wLL5Hday4IShe17w==", + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.10.tgz", + "integrity": "sha512-F8ZtBMhSXyYKuBfGpYwqA5rsONnOwAVvjyE7KPYJ7wgZqo2roASqNWUnianOomJX5u1cxeRooHV59N0PhvEOgw==", "dev": true, "requires": { - "@volar/language-core": "2.3.4", + "@volar/language-core": "2.4.10", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "@vue/compiler-core": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.37.tgz", - "integrity": "sha512-ZDDT/KiLKuCRXyzWecNzC5vTcubGz4LECAtfGPENpo0nrmqJHwuWtRLxk/Sb9RAKtR9iFflFycbkjkY+W/PZUQ==", + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.12.tgz", + "integrity": "sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw==", "dev": true, "requires": { - "@babel/parser": "^7.24.7", - "@vue/shared": "3.4.37", - "entities": "^5.0.0", + "@babel/parser": "^7.25.3", + "@vue/shared": "3.5.12", + "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.0" }, "dependencies": { - "entities": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-5.0.0.tgz", - "integrity": "sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA==", - "dev": true - }, "estree-walker": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", @@ -8137,13 +8066,13 @@ } }, "@vue/compiler-dom": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.37.tgz", - "integrity": "sha512-rIiSmL3YrntvgYV84rekAtU/xfogMUJIclUMeIKEtVBFngOL3IeZHhsH3UaFEgB5iFGpj6IW+8YuM/2Up+vVag==", + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.12.tgz", + "integrity": "sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg==", "dev": true, "requires": { - "@vue/compiler-core": "3.4.37", - "@vue/shared": "3.4.37" + "@vue/compiler-core": "3.5.12", + "@vue/shared": "3.5.12" } }, "@vue/compiler-vue2": { @@ -8157,12 +8086,12 @@ } }, "@vue/language-core": { - "version": "2.0.29", - "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-2.0.29.tgz", - "integrity": "sha512-o2qz9JPjhdoVj8D2+9bDXbaI4q2uZTHQA/dbyZT4Bj1FR9viZxDJnLcKVHfxdn6wsOzRgpqIzJEEmSSvgMvDTQ==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-2.1.6.tgz", + "integrity": "sha512-MW569cSky9R/ooKMh6xa2g1D0AtRKbL56k83dzus/bx//RDJk24RHWkMzbAlXjMdDNyxAaagKPRquBIxkxlCkg==", "dev": true, "requires": { - "@volar/language-core": "~2.4.0-alpha.18", + "@volar/language-core": "~2.4.1", "@vue/compiler-dom": "^3.4.0", "@vue/compiler-vue2": "^2.7.16", "@vue/shared": "^3.4.0", @@ -8170,29 +8099,12 @@ "minimatch": "^9.0.3", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1" - }, - "dependencies": { - "@volar/language-core": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.0-alpha.18.tgz", - "integrity": "sha512-JAYeJvYQQROmVRtSBIczaPjP3DX4QW1fOqW1Ebs0d3Y3EwSNRglz03dSv0Dm61dzd0Yx3WgTW3hndDnTQqgmyg==", - "dev": true, - "requires": { - "@volar/source-map": "2.4.0-alpha.18" - } - }, - "@volar/source-map": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.0-alpha.18.tgz", - "integrity": "sha512-MTeCV9MUwwsH0sNFiZwKtFrrVZUK6p8ioZs3xFzHc2cvDXHWlYN3bChdQtwKX+FY2HG6H3CfAu1pKijolzIQ8g==", - "dev": true - } } }, "@vue/shared": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.37.tgz", - "integrity": "sha512-nIh8P2fc3DflG8+5Uw8PT/1i17ccFn0xxN/5oE9RfV5SVnd7G0XEFRwakrnNFE/jlS95fpGXDVG5zDETS26nmg==", + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.12.tgz", + "integrity": "sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg==", "dev": true }, "@webassemblyjs/ast": { @@ -9082,14 +8994,6 @@ "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" - }, - "dependencies": { - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - } } }, "fs.realpath": { @@ -9278,9 +9182,9 @@ "dev": true }, "is-core-module": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz", - "integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", "dev": true, "requires": { "hasown": "^2.0.2" @@ -10203,6 +10107,15 @@ "yargs": "^17.5.1" } }, + "rollup-preserve-directives": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/rollup-preserve-directives/-/rollup-preserve-directives-1.1.2.tgz", + "integrity": "sha512-OOaYh4zO0Dcd/eVWGB8H69CgTiohl+jJqc2TLtjLENVIQaV2rxO3OW6RILzCQOdDvPT+/rzwRp+97OXhem895Q==", + "dev": true, + "requires": { + "magic-string": "^0.30.5" + } + }, "rrweb-cssom": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", @@ -10821,6 +10734,12 @@ "unist-util-is": "^6.0.0" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -10906,21 +10825,20 @@ } }, "vite-plugin-dts": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-4.1.1.tgz", - "integrity": "sha512-SxYXwJQbAZ1IMtGEcOuzzZtDWCdcV2JkU7esvpPA8E5tIWVcJB42rZwN9EdULicWGLfaXrUgPIGVSidXBTae2Q==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-4.3.0.tgz", + "integrity": "sha512-LkBJh9IbLwL6/rxh0C1/bOurDrIEmRE7joC+jFdOEEciAFPbpEKOLSAr5nNh5R7CJ45cMbksTrFfy52szzC5eA==", "dev": true, "requires": { - "@microsoft/api-extractor": "7.47.4", + "@microsoft/api-extractor": "^7.47.11", "@rollup/pluginutils": "^5.1.0", - "@volar/typescript": "^2.3.4", - "@vue/language-core": "2.0.29", + "@volar/typescript": "^2.4.4", + "@vue/language-core": "2.1.6", "compare-versions": "^6.1.1", "debug": "^4.3.6", "kolorist": "^1.8.0", "local-pkg": "^0.5.0", - "magic-string": "^0.30.11", - "vue-tsc": "2.0.29" + "magic-string": "^0.30.11" } }, "vite-plugin-progress": { @@ -10967,45 +10885,6 @@ "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==", "dev": true }, - "vue-tsc": { - "version": "2.0.29", - "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-2.0.29.tgz", - "integrity": "sha512-MHhsfyxO3mYShZCGYNziSbc63x7cQ5g9kvijV7dRe1TTXBRLxXyL0FnXWpUF1xII2mJ86mwYpYsUmMwkmerq7Q==", - "dev": true, - "requires": { - "@volar/typescript": "~2.4.0-alpha.18", - "@vue/language-core": "2.0.29", - "semver": "^7.5.4" - }, - "dependencies": { - "@volar/language-core": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.0-alpha.18.tgz", - "integrity": "sha512-JAYeJvYQQROmVRtSBIczaPjP3DX4QW1fOqW1Ebs0d3Y3EwSNRglz03dSv0Dm61dzd0Yx3WgTW3hndDnTQqgmyg==", - "dev": true, - "requires": { - "@volar/source-map": "2.4.0-alpha.18" - } - }, - "@volar/source-map": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.0-alpha.18.tgz", - "integrity": "sha512-MTeCV9MUwwsH0sNFiZwKtFrrVZUK6p8ioZs3xFzHc2cvDXHWlYN3bChdQtwKX+FY2HG6H3CfAu1pKijolzIQ8g==", - "dev": true - }, - "@volar/typescript": { - "version": "2.4.0-alpha.18", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.0-alpha.18.tgz", - "integrity": "sha512-sXh5Y8sqGUkgxpMWUGvRXggxYHAVxg0Pa1C42lQZuPDrW6vHJPR0VCK8Sr7WJsAW530HuNQT/ZIskmXtxjybMQ==", - "dev": true, - "requires": { - "@volar/language-core": "2.4.0-alpha.18", - "path-browserify": "^1.0.1", - "vscode-uri": "^3.0.8" - } - } - } - }, "w3c-xmlserializer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", diff --git a/package.json b/package.json index 7fbc77d..0afe187 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,12 @@ "copyfiles": "^2.4.1", "jsdom": "^25.0.1", "rollup-plugin-visualizer": "^5.12.0", + "rollup-preserve-directives": "^1.1.2", "tslib": "^2.8.0", "typedoc": "^0.26.10", "typescript": "^5.6.3", "vite": "^5.4.10", - "vite-plugin-dts": "^4.1.1", + "vite-plugin-dts": "^4.3.0", "vite-plugin-progress": "^0.0.7", "vitest": "^2.1.3" }, diff --git a/packages/core/src/child.ts b/packages/core/src/child.ts index 37af589..ff2bdab 100644 --- a/packages/core/src/child.ts +++ b/packages/core/src/child.ts @@ -1,11 +1,13 @@ -import { deferWhenWindowIsLoaded, getBoundingRectHeight, isInIframe } from "~/common"; +import { deferWhenWindowIsLoaded, getBoundingRectHeight, isBrowser, isInIframe } from "~/common"; import type { IframeResizeEventData } from "./type"; -if (isInIframe()) { - initializeChildListener(); -} +initializeChildListener(); function initializeChildListener() { + if (!isBrowser() || !isInIframe()) { + return; + } + deferWhenWindowIsLoaded(window, () => { const resizeObserverCallback = () => { const data: IframeResizeEventData = { diff --git a/packages/core/src/common.ts b/packages/core/src/common.ts index 4bce48a..7808fd4 100644 --- a/packages/core/src/common.ts +++ b/packages/core/src/common.ts @@ -1,6 +1,8 @@ import type { Settings } from "~/type"; -export const isInIframe = () => window && window.self !== window.top; +export const isBrowser = () => typeof window !== "undefined"; + +export const isInIframe = () => window.self !== window.top; export const isHtmlIframeElement = (element: Element): element is HTMLIFrameElement => element instanceof HTMLIFrameElement; diff --git a/packages/core/src/parent.ts b/packages/core/src/parent.ts index e9f934a..c4dc947 100644 --- a/packages/core/src/parent.ts +++ b/packages/core/src/parent.ts @@ -3,6 +3,7 @@ import { extractIframeOrigin, getBoundingRectHeight, getDefaultSettings, + isBrowser, isHtmlIframeElement, isIframeSameOrigin, removeUndefinedProperties, @@ -12,10 +13,13 @@ import type { IframeResizeEvent, InitializeFunction, InteractionState, ResizeCon type RegisteredElement = { iframe: HTMLIFrameElement; settings: Settings; interactionState: InteractionState }; -const resizeObserver = createResizeObserver(); +const resizeObserver: ResizeObserver | null = isBrowser() ? createResizeObserver() : null; let registeredElements: Array = []; const initialize: InitializeFunction = (clientSettings, selector) => { + if (!isBrowser()) { + return []; + } const finalSettings = { ...getDefaultSettings(), ...removeUndefinedProperties(clientSettings ?? {}) }; const iframes = resolveIframesToRegister(selector); const allowedOrigins = registerIframesAllowOrigins(finalSettings, iframes); @@ -108,31 +112,26 @@ function addCrossOriginChildResizeListener(registeredElement: RegisteredElement, return () => window.removeEventListener("message", handleIframeResizedMessage); } -function addSameOriginChildResizeListener(registeredElement: RegisteredElement) { - const { iframe } = registeredElement; +function addSameOriginChildResizeListener({ iframe }: RegisteredElement) { const startListener = () => { const contentBody = iframe.contentDocument?.body; if (!contentBody) { - console.error("Unable to observe the iframe content document body"); return; } - - resizeObserver.observe(contentBody); + resizeObserver?.observe(contentBody); }; deferWhenSameOriginIframeIsLoaded(iframe, startListener); return () => { if (iframe.contentDocument?.body) { - resizeObserver.unobserve(iframe.contentDocument.body); + resizeObserver?.unobserve(iframe.contentDocument.body); } iframe.removeEventListener("load", startListener); }; } -function addInteractionListeners(registeredElement: RegisteredElement) { - const { iframe, interactionState } = registeredElement; - +function addInteractionListeners({ iframe, interactionState }: RegisteredElement) { const onMouseEnter = () => { interactionState.isHovered = true; }; diff --git a/packages/core/src/type.d.ts b/packages/core/src/type.d.ts index 3008bec..93d1f93 100644 --- a/packages/core/src/type.d.ts +++ b/packages/core/src/type.d.ts @@ -1,11 +1,5 @@ -interface Window { - iframeResizer: { - initialize: InitializeFunction; - }; -} - /** - * Automatically resizes the selected iframes. + * Automatically resize the selected iframes when their inner content grows. * @param settings The settings for the selected iframes. The default settings properties are picked if empty. * @param selector The selector for the iframe(s) or the HTMLIFrameElement to be resized. If empty, all document iframe elements will be selected. * @returns A result array, which can be used to clean up the listeners if you often remove iframes from the document. diff --git a/packages/core/test/ssr.test.ts b/packages/core/test/ssr.test.ts new file mode 100644 index 0000000..00ab5db --- /dev/null +++ b/packages/core/test/ssr.test.ts @@ -0,0 +1,10 @@ +// @vitest-environment node + +import { expect, test } from "vitest"; +import { initialize, initializeChildListener } from "../src"; + +test("API functions shouldn't throw error when executed on unsupported environments with no window (SSR, Node..)", () => { + expect(typeof window).toBe("undefined"); + expect(initialize).not.toThrow(); + expect(initializeChildListener).not.toThrow(); +}); diff --git a/packages/core/vite.config.ts b/packages/core/vite.config.ts index c9cf0ef..33d03ad 100644 --- a/packages/core/vite.config.ts +++ b/packages/core/vite.config.ts @@ -9,6 +9,7 @@ export default defineConfig((env) => ({ dts({ entryRoot: "src", copyDtsFiles: true, + rollupTypes: true, tsconfigPath: path.join(__dirname, "tsconfig.json"), }), ], diff --git a/packages/react/src/components/index.tsx b/packages/react/src/components/index.tsx index 541c453..0eced24 100644 --- a/packages/react/src/components/index.tsx +++ b/packages/react/src/components/index.tsx @@ -1,3 +1,5 @@ +"use client"; + import { type Settings, initialize } from "@open-iframe-resizer/core"; import { type IframeHTMLAttributes, useEffect, useRef } from "react"; diff --git a/packages/react/vite.config.ts b/packages/react/vite.config.ts index c64fe04..ec41ff5 100644 --- a/packages/react/vite.config.ts +++ b/packages/react/vite.config.ts @@ -1,5 +1,6 @@ import * as path from "node:path"; import react from "@vitejs/plugin-react"; +import preserveDirectives from "rollup-preserve-directives"; import dts from "vite-plugin-dts"; import { defineConfig } from "vitest/config"; @@ -7,9 +8,11 @@ const formattedName = "open-iframe-resizer-react"; export default defineConfig((env) => ({ plugins: [ + preserveDirectives(), react(), dts({ insertTypesEntry: true, + rollupTypes: true, }), ], build: {