diff --git a/old/rollup.config.js b/old/rollup.config.js deleted file mode 100644 index e675a18041..0000000000 --- a/old/rollup.config.js +++ /dev/null @@ -1,106 +0,0 @@ -import babel from '@rollup/plugin-babel' -import terser from '@rollup/plugin-terser' -import size from 'rollup-plugin-size' -import externals from 'rollup-plugin-node-externals' -import resolve from '@rollup/plugin-node-resolve' -import commonJS from '@rollup/plugin-commonjs' -import visualizer from 'rollup-plugin-visualizer' -import replace from '@rollup/plugin-replace' -import { defineConfig } from 'rollup' - -const external = ['react', 'react-dom', 'react-query'] - -const globals = { - react: 'React', - 'react-dom': 'ReactDOM', - 'react-query': 'ReactQuery', -} - -const inputSrcs = [ - ['src/index.ts', 'ReactQuery', 'react-query'], - ['src/core/index.ts', 'ReactQueryCore', 'react-query-core'], - ['src/devtools/index.ts', 'ReactQueryDevtools', 'react-query-devtools'], - [ - 'src/persistQueryClient/index.ts', - 'ReactQueryPersistQueryClient', - 'persistQueryClient', - ], - [ - 'src/createWebStoragePersister/index.ts', - 'ReactQueryCreateWebStoragePersister', - 'createWebStoragePersister', - ], - [ - 'src/createAsyncStoragePersister/index.ts', - 'ReactQueryCreateAsyncStoragePersister', - 'createAsyncStoragePersister', - ], - [ - 'src/broadcastQueryClient-experimental/index.ts', - 'ReactQueryBroadcastQueryClientExperimental', - 'broadcastQueryClient-experimental', - ], -] - -const extensions = ['.js', '.jsx', '.es6', '.es', '.mjs', '.ts', '.tsx'] - -const babelConfig = { - extensions, - babelHelpers: 'bundled', -} -const resolveConfig = { extensions } - -const externalPeerDeps = () => - externals({ deps: false, devDeps: false, peerDeps: true }) - -export default inputSrcs - .map(([input, name, file]) => { - return defineConfig([ - { - input: input, - output: { - name, - file: `dist/${file}.development.js`, - format: 'umd', - sourcemap: true, - globals, - }, - external, - plugins: [ - externalPeerDeps(), - resolve(resolveConfig), - babel(babelConfig), - commonJS(), - ], - }, - { - input: input, - output: { - name, - file: `dist/${file}.production.min.js`, - format: 'umd', - sourcemap: true, - globals, - }, - external, - plugins: [ - replace({ - 'process.env.NODE_ENV': `"production"`, - delimiters: ['', ''], - preventAssignment: true, - }), - externalPeerDeps(), - resolve(resolveConfig), - babel(babelConfig), - commonJS(), - terser(), - size(), - visualizer({ - filename: 'stats-react.json', - json: true, - }), - ], - }, - ]) - }) - .flat() diff --git a/package.json b/package.json index 4b56a9c30c..0ee01170c7 100644 --- a/package.json +++ b/package.json @@ -80,10 +80,10 @@ "react-dom": "^18.2.0", "rimraf": "^4.1.2", "rollup": "^3.23.0", - "rollup-plugin-preserve-directives": "^0.1.1", - "rollup-plugin-size": "^0.2.0", + "rollup-plugin-preserve-directives": "^0.2.0", + "rollup-plugin-size": "^0.3.1", "rollup-plugin-visualizer": "^5.9.0", - "rollup-preset-solid": "^1.4.0", + "rollup-preset-solid": "^2.0.1", "semver": "^7.5.1", "solid-js": "^1.6.13", "stream-to-array": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc5f33414a..f5d1832d77 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -157,17 +157,17 @@ importers: specifier: ^3.23.0 version: 3.23.0 rollup-plugin-preserve-directives: - specifier: ^0.1.1 - version: 0.1.1(rollup@3.23.0) - rollup-plugin-size: specifier: ^0.2.0 - version: 0.2.2 + version: 0.2.0(rollup@3.23.0) + rollup-plugin-size: + specifier: ^0.3.1 + version: 0.3.1 rollup-plugin-visualizer: specifier: ^5.9.0 version: 5.9.0(rollup@3.23.0) rollup-preset-solid: - specifier: ^1.4.0 - version: 1.4.0 + specifier: ^2.0.1 + version: 2.0.1 semver: specifier: ^7.5.1 version: 7.5.1 @@ -3254,6 +3254,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-arm@0.15.18: + resolution: {integrity: sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm@0.17.14: resolution: {integrity: sha512-0CnlwnjDU8cks0yJLXfkaU/uoLyRf9VZJs4p1PskBr2AlAHeEsFEwJEo0of/Z3g+ilw5mpyDwThlxzNEIxOE4g==} engines: {node: '>=12'} @@ -3334,6 +3343,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-loong64@0.15.18: + resolution: {integrity: sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64@0.17.14: resolution: {integrity: sha512-vp15H+5NR6hubNgMluqqKza85HcGJgq7t6rMH7O3Y6ApiOWPkvW2AJfNojUQimfTp6OUrACUXfR4hmpcENXoMQ==} engines: {node: '>=12'} @@ -4871,23 +4889,6 @@ packages: engines: {node: '>=14'} dev: false - /@rollup/plugin-babel@5.3.1(@babel/core@7.21.8)(rollup@2.79.1): - resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==} - engines: {node: '>= 10.0.0'} - peerDependencies: - '@babel/core': ^7.0.0 - '@types/babel__core': ^7.1.9 - rollup: ^1.20.0||^2.0.0 - peerDependenciesMeta: - '@types/babel__core': - optional: true - dependencies: - '@babel/core': 7.21.8 - '@babel/helper-module-imports': 7.21.4 - '@rollup/pluginutils': 3.1.0(rollup@2.79.1) - rollup: 2.79.1 - dev: true - /@rollup/plugin-babel@6.0.3(@babel/core@7.21.8)(rollup@3.23.0): resolution: {integrity: sha512-fKImZKppa1A/gX73eg4JGo+8kQr/q1HBQaCGKECZ0v4YBBv3lFqi14+7xyApECzvkLTHCifx+7ntcrvtBIRcpg==} engines: {node: '>=14.0.0'} @@ -4994,6 +4995,19 @@ packages: rollup: 3.23.0 dev: true + /@rollup/plugin-terser@0.1.0(rollup@3.23.0): + resolution: {integrity: sha512-N2KK+qUfHX2hBzVzM41UWGLrEmcjVC37spC8R3c9mt3oEDFKh3N2e12/lLp9aVSt86veR0TQiCNQXrm8C6aiUQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.x || ^3.x + peerDependenciesMeta: + rollup: + optional: true + dependencies: + rollup: 3.23.0 + terser: 5.17.6 + dev: true + /@rollup/plugin-terser@0.4.3(rollup@3.23.0): resolution: {integrity: sha512-EF0oejTMtkyhrkwCdg0HJ0IpkcaVg1MMSf2olHb2Jp+1mnLM04OhjpJWGma4HobiDTF0WCyViWuvadyE9ch2XA==} engines: {node: '>=14.0.0'} @@ -6301,17 +6315,6 @@ packages: es-shim-unscopables: 1.0.0 dev: true - /array.prototype.reduce@1.0.5: - resolution: {integrity: sha512-kDdugMl7id9COE8R7MHF5jWk7Dqt/fs4Pv+JXoICnYwqpjjjbUurz6w5fT5IG6brLdJhv6/VoHB0H7oyIBXd+Q==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.21.2 - es-array-method-boxes-properly: 1.0.0 - is-string: 1.0.7 - dev: true - /array.prototype.tosorted@1.1.1: resolution: {integrity: sha512-pZYPXPRl2PqWcsUs6LOMn+1f1532nEoPTYowBtqLwAW+W8vSVhkIGnmOX1t/UQjD6YGI0vcD2B1U7ZFGQH9jnQ==} dependencies: @@ -6425,15 +6428,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /axios@0.19.2: - resolution: {integrity: sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==} - deprecated: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410 - dependencies: - follow-redirects: 1.5.10 - transitivePeerDependencies: - - supports-color - dev: true - /axios@0.24.0: resolution: {integrity: sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==} dependencies: @@ -6740,13 +6734,6 @@ packages: unload: 2.4.1 dev: false - /brotli-size@4.0.0: - resolution: {integrity: sha512-uA9fOtlTRC0iqKfzff1W34DXUA3GyVqbUaeo3Rw3d4gd1eavKVCETXrn3NzO74W+UVkG3UHu8WxUi+XvKI/huA==} - engines: {node: '>= 10.16.0'} - dependencies: - duplexer: 0.1.1 - dev: true - /browserslist@4.21.5: resolution: {integrity: sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -7008,6 +6995,11 @@ packages: ansi-styles: 4.3.0 supports-color: 7.2.0 + /chalk@5.2.0: + resolution: {integrity: sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + dev: true + /chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} dev: false @@ -7569,17 +7561,6 @@ packages: dependencies: ms: 2.0.0 - /debug@3.1.0: - resolution: {integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.0.0 - dev: true - /debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: @@ -7877,10 +7858,6 @@ packages: readable-stream: 2.3.7 dev: true - /duplexer@0.1.1: - resolution: {integrity: sha512-sxNZ+ljy+RA1maXoUReeqBBpBC6RLKmg5ewzV+x+mSETmWNoKdZN6vcQjpFROemza23hGFskJtFNoUWUaQ+R4Q==} - dev: true - /duplexer@0.1.2: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} dev: true @@ -7997,10 +7974,6 @@ packages: which-typed-array: 1.1.9 dev: true - /es-array-method-boxes-properly@1.0.0: - resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} - dev: true - /es-get-iterator@1.1.3: resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} dependencies: @@ -8058,6 +8031,15 @@ packages: requiresBuild: true optional: true + /esbuild-android-64@0.15.18: + resolution: {integrity: sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /esbuild-android-arm64@0.14.54: resolution: {integrity: sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==} engines: {node: '>=12'} @@ -8066,6 +8048,15 @@ packages: requiresBuild: true optional: true + /esbuild-android-arm64@0.15.18: + resolution: {integrity: sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /esbuild-darwin-64@0.14.54: resolution: {integrity: sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==} engines: {node: '>=12'} @@ -8074,6 +8065,15 @@ packages: requiresBuild: true optional: true + /esbuild-darwin-64@0.15.18: + resolution: {integrity: sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /esbuild-darwin-arm64@0.14.54: resolution: {integrity: sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==} engines: {node: '>=12'} @@ -8082,6 +8082,15 @@ packages: requiresBuild: true optional: true + /esbuild-darwin-arm64@0.15.18: + resolution: {integrity: sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /esbuild-freebsd-64@0.14.54: resolution: {integrity: sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==} engines: {node: '>=12'} @@ -8090,6 +8099,15 @@ packages: requiresBuild: true optional: true + /esbuild-freebsd-64@0.15.18: + resolution: {integrity: sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /esbuild-freebsd-arm64@0.14.54: resolution: {integrity: sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==} engines: {node: '>=12'} @@ -8098,6 +8116,15 @@ packages: requiresBuild: true optional: true + /esbuild-freebsd-arm64@0.15.18: + resolution: {integrity: sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-32@0.14.54: resolution: {integrity: sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==} engines: {node: '>=12'} @@ -8106,6 +8133,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-32@0.15.18: + resolution: {integrity: sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-64@0.14.54: resolution: {integrity: sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==} engines: {node: '>=12'} @@ -8114,6 +8150,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-64@0.15.18: + resolution: {integrity: sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-arm64@0.14.54: resolution: {integrity: sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==} engines: {node: '>=12'} @@ -8122,6 +8167,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-arm64@0.15.18: + resolution: {integrity: sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-arm@0.14.54: resolution: {integrity: sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==} engines: {node: '>=12'} @@ -8130,6 +8184,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-arm@0.15.18: + resolution: {integrity: sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-mips64le@0.14.54: resolution: {integrity: sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==} engines: {node: '>=12'} @@ -8138,6 +8201,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-mips64le@0.15.18: + resolution: {integrity: sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-ppc64le@0.14.54: resolution: {integrity: sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==} engines: {node: '>=12'} @@ -8146,6 +8218,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-ppc64le@0.15.18: + resolution: {integrity: sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-riscv64@0.14.54: resolution: {integrity: sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==} engines: {node: '>=12'} @@ -8154,6 +8235,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-riscv64@0.15.18: + resolution: {integrity: sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-s390x@0.14.54: resolution: {integrity: sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==} engines: {node: '>=12'} @@ -8162,6 +8252,15 @@ packages: requiresBuild: true optional: true + /esbuild-linux-s390x@0.15.18: + resolution: {integrity: sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-netbsd-64@0.14.54: resolution: {integrity: sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==} engines: {node: '>=12'} @@ -8170,6 +8269,15 @@ packages: requiresBuild: true optional: true + /esbuild-netbsd-64@0.15.18: + resolution: {integrity: sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /esbuild-openbsd-64@0.14.54: resolution: {integrity: sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==} engines: {node: '>=12'} @@ -8178,6 +8286,15 @@ packages: requiresBuild: true optional: true + /esbuild-openbsd-64@0.15.18: + resolution: {integrity: sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /esbuild-plugin-solid@0.4.2(esbuild@0.14.54)(solid-js@1.6.16): resolution: {integrity: sha512-T5GphLoud3RumjeNYO3K9WVjWDzVKG5evlS7hUEUI0n9tiCL+CnbvJh3SSwFi3xeeXpZRrnZc1gd6FWQsVobTg==} peerDependencies: @@ -8200,6 +8317,15 @@ packages: requiresBuild: true optional: true + /esbuild-sunos-64@0.15.18: + resolution: {integrity: sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-32@0.14.54: resolution: {integrity: sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==} engines: {node: '>=12'} @@ -8208,6 +8334,15 @@ packages: requiresBuild: true optional: true + /esbuild-windows-32@0.15.18: + resolution: {integrity: sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-64@0.14.54: resolution: {integrity: sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==} engines: {node: '>=12'} @@ -8216,6 +8351,15 @@ packages: requiresBuild: true optional: true + /esbuild-windows-64@0.15.18: + resolution: {integrity: sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-arm64@0.14.54: resolution: {integrity: sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==} engines: {node: '>=12'} @@ -8224,6 +8368,15 @@ packages: requiresBuild: true optional: true + /esbuild-windows-arm64@0.15.18: + resolution: {integrity: sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild@0.14.54: resolution: {integrity: sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==} engines: {node: '>=12'} @@ -8252,6 +8405,36 @@ packages: esbuild-windows-64: 0.14.54 esbuild-windows-arm64: 0.14.54 + /esbuild@0.15.18: + resolution: {integrity: sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.15.18 + '@esbuild/linux-loong64': 0.15.18 + esbuild-android-64: 0.15.18 + esbuild-android-arm64: 0.15.18 + esbuild-darwin-64: 0.15.18 + esbuild-darwin-arm64: 0.15.18 + esbuild-freebsd-64: 0.15.18 + esbuild-freebsd-arm64: 0.15.18 + esbuild-linux-32: 0.15.18 + esbuild-linux-64: 0.15.18 + esbuild-linux-arm: 0.15.18 + esbuild-linux-arm64: 0.15.18 + esbuild-linux-mips64le: 0.15.18 + esbuild-linux-ppc64le: 0.15.18 + esbuild-linux-riscv64: 0.15.18 + esbuild-linux-s390x: 0.15.18 + esbuild-netbsd-64: 0.15.18 + esbuild-openbsd-64: 0.15.18 + esbuild-sunos-64: 0.15.18 + esbuild-windows-32: 0.15.18 + esbuild-windows-64: 0.15.18 + esbuild-windows-arm64: 0.15.18 + dev: true + /esbuild@0.17.14: resolution: {integrity: sha512-vOO5XhmVj/1XQR9NQ1UPq6qvMYL7QFJU57J5fKBKBKxp17uDt5PgxFDb4A2nEiXhr1qQs4x0F5+66hVVw4ruNw==} engines: {node: '>=12'} @@ -9186,15 +9369,6 @@ packages: dependencies: debug: 4.3.4 - /follow-redirects@1.5.10: - resolution: {integrity: sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==} - engines: {node: '>=4.0'} - dependencies: - debug: 3.1.0 - transitivePeerDependencies: - - supports-color - dev: true - /fontfaceobserver@2.3.0: resolution: {integrity: sha512-6FPvD/IVyT4ZlNe7Wcn5Fb/4ChigpucKYSvD6a+0iMoLn2inpo711eyIcKjmDtE5XNcgAkSH9uN/nfAeZzHEfg==} dev: false @@ -9291,6 +9465,7 @@ packages: graceful-fs: 4.2.10 jsonfile: 4.0.0 universalify: 0.1.2 + dev: false /fs-extra@9.0.0: resolution: {integrity: sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==} @@ -9588,14 +9763,6 @@ packages: engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} dev: false - /gzip-size@5.1.1: - resolution: {integrity: sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA==} - engines: {node: '>=6'} - dependencies: - duplexer: 0.1.2 - pify: 4.0.1 - dev: true - /gzip-size@6.0.0: resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} engines: {node: '>=10'} @@ -10584,6 +10751,7 @@ packages: '@types/node': 18.13.0 merge-stream: 2.0.0 supports-color: 7.2.0 + dev: false /jest-worker@27.5.1: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} @@ -10859,6 +11027,7 @@ packages: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} optionalDependencies: graceful-fs: 4.2.10 + dev: false /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} @@ -12582,17 +12751,6 @@ packages: es-abstract: 1.21.2 dev: true - /object.getownpropertydescriptors@2.1.6: - resolution: {integrity: sha512-lq+61g26E/BgHv0ZTFgRvi7NMEPuAxLkFU7rukXjc/AlwH4Am5xXVnIXy3un1bg/JPbXHrixRkK1itUzzPiIjQ==} - engines: {node: '>= 0.8'} - dependencies: - array.prototype.reduce: 1.0.5 - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.21.2 - safe-array-concat: 1.0.0 - dev: true - /object.hasown@1.1.2: resolution: {integrity: sha512-B5UIT3J1W+WuWIU55h0mjlwaqxiE5vYENJXIXZ4VFe05pNYrkKuK0U/6aFcb0pKywYJh7IhfoqUfKVmrJJHZHw==} dependencies: @@ -13148,6 +13306,12 @@ packages: /pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} engines: {node: '>=6'} + dev: false + + /pretty-bytes@6.1.0: + resolution: {integrity: sha512-Rk753HI8f4uivXi4ZCIYdhmG1V+WKzvRMg/X+M42a6t7D07RcmopXJMDNk6N++7Bl75URRGsb40ruvg7Hcp2wQ==} + engines: {node: ^14.13.1 || >=16.0.0} + dev: true /pretty-format@25.5.0: resolution: {integrity: sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==} @@ -14024,8 +14188,8 @@ packages: hasBin: true dev: true - /rollup-plugin-preserve-directives@0.1.1(rollup@3.23.0): - resolution: {integrity: sha512-htKdBt+0ONtxIx2nB10vmQwNn7xJrAKR+HL4rCiP972s6bVlFYaUBm3dXFGfD29Ur/LTOtSakmASi9EUdq/MPQ==} + /rollup-plugin-preserve-directives@0.2.0(rollup@3.23.0): + resolution: {integrity: sha512-KUwbBaFvD1zFIDNnOkR+u64sSod3m0l6q46/SzTOa4GTQ6hp6w0FRr2u7x99YkY9qhlna5panmTmuLWeJ/2KWw==} peerDependencies: rollup: 2.x || 3.x dependencies: @@ -14033,26 +14197,19 @@ packages: rollup: 3.23.0 dev: true - /rollup-plugin-size@0.2.2: - resolution: {integrity: sha512-XIQpfwp1dLXzr4qCopY5ZSEEPB3bgZLkGw2BB3+TXmfH2jxGSmuN/+sRxnA5MvJe+Z4atW0x0qTQz5EuTQy01Q==} - engines: {node: '>=10.0.0'} + /rollup-plugin-size@0.3.1: + resolution: {integrity: sha512-SAtpTAAJ0nFkISxLxYjDZX9Zqt34tAIil98R305ZM0GhTnnO6VYG0P5M+2IXKo/iNDdbpBcIfg1W06CLtk/vXA==} dependencies: - size-plugin-core: 0.0.7 + axios: 1.4.0 + chalk: 5.2.0 + ci-env: 1.17.0 + fs-extra: 11.1.1 + glob: 8.1.0 + minimatch: 5.1.6 + pretty-bytes: 6.1.0 + zlib: 1.0.5 transitivePeerDependencies: - - supports-color - dev: true - - /rollup-plugin-terser@7.0.2(rollup@2.79.1): - resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} - deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser - peerDependencies: - rollup: ^2.0.0 - dependencies: - '@babel/code-frame': 7.21.4 - jest-worker: 26.6.2 - rollup: 2.79.1 - serialize-javascript: 4.0.0 - terser: 5.17.6 + - debug dev: true /rollup-plugin-visualizer@5.9.0(rollup@3.23.0): @@ -14071,21 +14228,21 @@ packages: source-map: 0.7.4 yargs: 17.7.1 - /rollup-preset-solid@1.4.0: - resolution: {integrity: sha512-rjUH0dMkyHxkin1uBcdZX110DL/P0hppMWF0RAwJdl7ly9IH/N+jHxmnyf7OzkyI2pGUBO9Lr1NN8Me9TFKN6Q==} + /rollup-preset-solid@2.0.1: + resolution: {integrity: sha512-CPJn3SqADlIxhAW3jwZuAFRyZcz7HPeUAz4f+6BzulxHnK4v6tgoTbMvk8vEsfsvHwiTmX93KHIKdf79aTdVSA==} dependencies: '@babel/core': 7.21.8 '@babel/preset-env': 7.21.5(@babel/core@7.21.8) '@babel/preset-typescript': 7.21.5(@babel/core@7.21.8) - '@rollup/plugin-babel': 5.3.1(@babel/core@7.21.8)(rollup@2.79.1) - '@rollup/plugin-node-resolve': 13.3.0(rollup@2.79.1) + '@rollup/plugin-babel': 6.0.3(@babel/core@7.21.8)(rollup@3.23.0) + '@rollup/plugin-node-resolve': 15.0.2(rollup@3.23.0) + '@rollup/plugin-terser': 0.1.0(rollup@3.23.0) babel-preset-solid: 1.6.10(@babel/core@7.21.8) colorette: 2.0.20 - esbuild: 0.14.54 + esbuild: 0.15.18 merge-anything: 5.1.4 - rollup: 2.79.1 - rollup-plugin-terser: 7.0.2(rollup@2.79.1) - typescript: 4.8.4 + rollup: 3.23.0 + typescript: 4.9.5 transitivePeerDependencies: - '@types/babel__core' - supports-color @@ -14169,16 +14326,6 @@ packages: dependencies: mri: 1.2.0 - /safe-array-concat@1.0.0: - resolution: {integrity: sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==} - engines: {node: '>=0.4'} - dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.0 - has-symbols: 1.0.3 - isarray: 2.0.5 - dev: true - /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} @@ -14319,12 +14466,6 @@ packages: type-fest: 0.12.0 dev: false - /serialize-javascript@4.0.0: - resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==} - dependencies: - randombytes: 2.1.0 - dev: true - /serialize-javascript@6.0.1: resolution: {integrity: sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==} dependencies: @@ -14463,31 +14604,6 @@ packages: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: false - /size-plugin-core@0.0.7: - resolution: {integrity: sha512-vMX3AhK3hh5vxfOL5VgEIxUkcm0MFfiPsZ9LqZsZRH7iQ+erU669zYsx+WCF4EQ+nn11GYXL91U/sEvS1FnPug==} - dependencies: - brotli-size: 4.0.0 - chalk: 2.4.2 - fs-extra: 8.1.0 - glob: 7.2.3 - gzip-size: 5.1.1 - minimatch: 3.1.2 - pretty-bytes: 5.6.0 - size-plugin-store: 0.0.5 - util.promisify: 1.1.2 - transitivePeerDependencies: - - supports-color - dev: true - - /size-plugin-store@0.0.5: - resolution: {integrity: sha512-SIFBv0wMMMfdqg1Po8vem90OaXe2Cftfo0AiXYU9m9JxDhOd726K+0BfNcYyOmDyrH2uUM7zMlnU2OhbbsDv5Q==} - dependencies: - axios: 0.19.2 - ci-env: 1.17.0 - transitivePeerDependencies: - - supports-color - dev: true - /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -15733,8 +15849,8 @@ packages: is-typed-array: 1.1.10 dev: true - /typescript@4.8.4: - resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} + /typescript@4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} engines: {node: '>=4.2.0'} hasBin: true dev: true @@ -15844,6 +15960,7 @@ packages: /universalify@0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} + dev: false /universalify@0.2.0: resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} @@ -15943,18 +16060,6 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - /util.promisify@1.1.2: - resolution: {integrity: sha512-PBdZ03m1kBnQ5cjjO0ZvJMJS+QsbyIcFwi4hY4U76OQsCO9JrOYjbCFgIF76ccFg9xnJo7ZHPkqyj1GqmdS7MA==} - dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - for-each: 0.3.3 - has-proto: 1.0.1 - has-symbols: 1.0.3 - object.getownpropertydescriptors: 2.1.6 - safe-array-concat: 1.0.0 - dev: true - /util@0.12.5: resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} dependencies: @@ -16608,6 +16713,11 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + /zlib@1.0.5: + resolution: {integrity: sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w==} + engines: {node: '>=0.2.0'} + dev: true + /zod@3.21.4: resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==} dev: false diff --git a/project.json b/project.json index 210465cf01..94dd51a3c8 100644 --- a/project.json +++ b/project.json @@ -4,7 +4,7 @@ "sourceRoot": "./", "targets": { "rollup": { - "command": "rollup --config rollup.config.js", + "command": "rollup --config rollup.config.mjs", "outputs": [ "{workspaceRoot}/packages/*/build/**/*(.cjs|.mjs|.js)*", "{workspaceRoot}/packages/*/build/stats*", diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index ff9029888d..0000000000 --- a/rollup.config.js +++ /dev/null @@ -1,7 +0,0 @@ -require("ts-node").register({ - compilerOptions: { - esModuleInterop: true, - }, -}); - -module.exports = require("./rollup.config.ts"); diff --git a/rollup.config.mjs b/rollup.config.mjs new file mode 100644 index 0000000000..262579d167 --- /dev/null +++ b/rollup.config.mjs @@ -0,0 +1,525 @@ +// @ts-check + +import { resolve } from 'node:path' +import { fileURLToPath } from "node:url" +import { defineConfig } from 'rollup' +import { babel } from '@rollup/plugin-babel' +import terser from '@rollup/plugin-terser' +import size from 'rollup-plugin-size' +import { visualizer } from 'rollup-plugin-visualizer' +import replace from '@rollup/plugin-replace' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import commonJS from '@rollup/plugin-commonjs' +import withSolid from 'rollup-preset-solid' +import preserveDirectives from 'rollup-plugin-preserve-directives' + +const __dirname = fileURLToPath(new URL(".", import.meta.url)); + +/** + * @typedef {Object} Options + * @property {string | string[]} input - The input string or array of strings. + * @property {string} packageDir - The package directory. + * @property {import('rollup').RollupOptions['external']} external - The external options of Rollup. + * @property {string} jsName - The JavaScript name. + * @property {string} outputFile - The output file. + * @property {Record} globals - The globals record. + * @property {boolean} forceDevEnv - Flag indicating whether to force development environment. + * @property {boolean} forceBundle - Flag indicating whether to force bundling. + */ + +/** @param {'development' | 'production'} type */ +const forceEnvPlugin = (type) => + replace({ + 'process.env.NODE_ENV': `"${type}"`, + delimiters: ['', ''], + preventAssignment: true, + }) + +/** @param {'legacy' | 'modern'} type */ +const babelPlugin = (type) => + babel({ + configFile: resolve(__dirname, 'babel.config.js'), + browserslistConfigFile: type === 'modern' ? true : false, + targets: + type === 'modern' + ? '' + : { + chrome: '73', + firefox: '78', + edge: '79', + safari: '12', + ios: '12', + opera: '53', + }, + babelHelpers: 'bundled', + exclude: /node_modules/, + extensions: ['.ts', '.tsx', '.native.ts'], + }) + +/** + * @param {Object} opts - Options for building configurations. + * @param {string} opts.packageDir - The package directory. + * @param {string} opts.name - The name. + * @param {string} opts.jsName - The JavaScript name. + * @param {string} opts.outputFile - The output file. + * @param {string | string[]} opts.entryFile - The entry file or array of entry files. + * @param {Record} opts.globals - The globals record. + * @param {string[]} [opts.bundleUMDGlobals] - List of dependencies to bundle for UMD build. + * @param {boolean} [opts.forceDevEnv] - Flag indicating whether to force development environment. + * @param {boolean} [opts.forceBundle] - Flag indicating whether to force bundling. + * @param {boolean} [opts.skipUmdBuild] - Flag indicating whether to skip UMD build. + * @returns {import('rollup').RollupOptions[]} + */ +export function buildConfigs(opts) { + const firstEntry = resolve( + opts.packageDir, + Array.isArray(opts.entryFile) ? opts.entryFile[0] : opts.entryFile, + ) + const entries = Array.isArray(opts.entryFile) + ? opts.entryFile + : [opts.entryFile] + const input = entries.map((entry) => resolve(opts.packageDir, entry)) + const externalDeps = Object.keys(opts.globals) + + const bundleUMDGlobals = opts.bundleUMDGlobals || [] + const umdExternal = externalDeps.filter( + (external) => !bundleUMDGlobals.includes(external), + ) + + const external = (moduleName) => externalDeps.includes(moduleName) + + /** @type {Options} */ + const options = { + input, + jsName: opts.jsName, + outputFile: opts.outputFile, + packageDir: opts.packageDir, + external, + globals: opts.globals, + forceDevEnv: opts.forceDevEnv || false, + forceBundle: opts.forceBundle || false, + } + + let builds = [mjs(options), esm(options), cjs(options)] + + if (!opts.skipUmdBuild) { + builds = builds.concat([ + umdDev({ ...options, external: umdExternal, input: firstEntry }), + umdProd({ ...options, external: umdExternal, input: firstEntry }), + ]) + } + + return builds +} + +/** + * @param {Options} options - Options for building configurations. + * @returns {import('rollup').RollupOptions} + */ +function mjs({ + input, + packageDir, + external, + outputFile, + forceDevEnv, + forceBundle, +}) { + /** @type {import('rollup').OutputOptions} */ + const bundleOutput = { + format: 'esm', + file: `${packageDir}/build/lib/${outputFile}.mjs`, + sourcemap: true, + } + + /** @type {import('rollup').OutputOptions} */ + const normalOutput = { + format: 'esm', + dir: `${packageDir}/build/lib`, + sourcemap: true, + preserveModules: true, + entryFileNames: '[name].mjs', + } + + return { + // MJS + external, + input, + output: forceBundle ? bundleOutput : normalOutput, + plugins: [ + babelPlugin('modern'), + commonJS(), + nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), + forceDevEnv ? forceEnvPlugin('development') : undefined, + preserveDirectives(), + ], + } +} + +/** + * @param {Options} options - Options for building configurations. + * @returns {import('rollup').RollupOptions} + */ +function esm({ + input, + packageDir, + external, + outputFile, + forceDevEnv, + forceBundle, +}) { + /** @type {import('rollup').OutputOptions} */ + const bundleOutput = { + format: 'esm', + file: `${packageDir}/build/lib/${outputFile}.esm.js`, + sourcemap: true, + } + + /** @type {import('rollup').OutputOptions} */ + const normalOutput = { + format: 'esm', + dir: `${packageDir}/build/lib`, + sourcemap: true, + preserveModules: true, + entryFileNames: '[name].esm.js', + } + + return { + // ESM + external, + input, + output: forceBundle ? bundleOutput : normalOutput, + plugins: [ + babelPlugin('legacy'), + commonJS(), + nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), + forceDevEnv ? forceEnvPlugin('development') : undefined, + preserveDirectives(), + ], + } +} + +/** + * @param {Options} options - Options for building configurations. + * @returns {import('rollup').RollupOptions} + */ +function cjs({ + input, + external, + packageDir, + outputFile, + forceDevEnv, + forceBundle, +}) { + /** @type {import('rollup').OutputOptions} */ + const bundleOutput = { + format: 'cjs', + file: `${packageDir}/build/lib/${outputFile}.js`, + sourcemap: true, + exports: 'named', + } + + /** @type {import('rollup').OutputOptions} */ + const normalOutput = { + format: 'cjs', + dir: `${packageDir}/build/lib`, + sourcemap: true, + exports: 'named', + preserveModules: true, + entryFileNames: '[name].js', + } + + return { + // CJS + external, + input, + output: forceBundle ? bundleOutput : normalOutput, + plugins: [ + babelPlugin('legacy'), + commonJS(), + nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), + forceDevEnv ? forceEnvPlugin('development') : undefined, + preserveDirectives(), + ], + } +} + +/** + * @param {Options} options - Options for building configurations. + * @returns {import('rollup').RollupOptions} + */ +function umdDev({ + input, + external, + packageDir, + outputFile, + globals, + jsName, +}) { + return { + // UMD (Dev) + external, + input, + output: { + format: 'umd', + sourcemap: true, + file: `${packageDir}/build/umd/${outputFile}.development.js`, + name: jsName, + globals, + }, + plugins: [ + commonJS(), + babelPlugin('modern'), + nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), + forceEnvPlugin('development'), + ], + } +} + +/** + * @param {Options} options - Options for building configurations. + * @returns {import('rollup').RollupOptions} + */ +function umdProd({ + input, + external, + packageDir, + outputFile, + globals, + jsName, +}) { + return { + // UMD (Prod) + external, + input, + output: { + format: 'umd', + sourcemap: true, + file: `${packageDir}/build/umd/${outputFile}.production.js`, + name: jsName, + globals, + }, + plugins: [ + commonJS(), + babelPlugin('modern'), + nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), + forceEnvPlugin('production'), + terser({ + mangle: true, + compress: true, + }), + size({}), + visualizer({ + filename: `${packageDir}/build/stats-html.html`, + template: 'treemap', + gzipSize: true, + }), + visualizer({ + filename: `${packageDir}/build/stats.json`, + template: 'raw-data', + gzipSize: true, + }), + ], + } +} + +function createSolidQueryConfig() { + const packageDir = 'packages/solid-query' + const solidRollupOptions = /** @type {import('rollup').RollupOptions} */ (withSolid({ + input: `${packageDir}/src/index.ts`, + targets: ['esm', 'cjs', 'umd'], + external: ['@tanstack/query-core'], + })) + + const outputs = !solidRollupOptions.output + ? [] + : Array.isArray(solidRollupOptions.output) + ? solidRollupOptions.output + : [solidRollupOptions.output] + + outputs.forEach((output) => { + const format = output.format + if (format === 'umd') { + output.globals = { + 'solid-js/store': 'SolidStore', + 'solid-js/web': 'SolidWeb', + 'solid-js': 'Solid', + '@tanstack/query-core': 'QueryCore', + } + } + output.dir = `${packageDir}/build/${format}` + }) + + const plugins = /** @type {import('rollup').Plugin[]} */ (solidRollupOptions.plugins) + // Prevent types generation since it doesn't resolve the directory correctly + // Instead build:types will generate those types anyway + const filtered = plugins.filter((plugin) => plugin.name !== 'ts') + + solidRollupOptions.plugins = filtered + + return solidRollupOptions +} + +function createTanstackQueryDevtoolsConfig() { + const packageDir = 'packages/query-devtools' + const solidRollupOptions = /** @type {import('rollup').RollupOptions} */ (withSolid({ + input: `${packageDir}/src/index.tsx`, + targets: ['esm', 'cjs', 'umd'], + })) + + const outputs = !solidRollupOptions.output + ? [] + : Array.isArray(solidRollupOptions.output) + ? solidRollupOptions.output + : [solidRollupOptions.output] + + outputs.forEach((output) => { + const format = output.format + output.dir = `${packageDir}/build/${format}` + if (output.format === 'esm') { + output.dir = undefined + output.file = `${packageDir}/build/${format}/index.mjs` + } + }) + + solidRollupOptions.external = [] + + const plugins = /** @type {import('rollup').Plugin[]} */ (solidRollupOptions.plugins) + // Prevent types generation since it doesn't resolve the directory correctly + // Instead build:types will generate those types anyway + const filtered = plugins.filter((plugin) => plugin.name !== 'ts') + + solidRollupOptions.plugins = filtered + + return solidRollupOptions +} + +export default defineConfig([ + createTanstackQueryDevtoolsConfig(), + ...buildConfigs({ + name: 'query-core', + packageDir: 'packages/query-core', + jsName: 'QueryCore', + outputFile: 'index', + entryFile: ['src/index.ts'], + globals: {}, + }), + ...buildConfigs({ + name: 'query-persist-client-core', + packageDir: 'packages/query-persist-client-core', + jsName: 'QueryPersistClientCore', + outputFile: 'index', + entryFile: ['src/index.ts'], + globals: { + '@tanstack/query-core': 'QueryCore', + }, + }), + ...buildConfigs({ + name: 'query-async-storage-persister', + packageDir: 'packages/query-async-storage-persister', + jsName: 'QueryAsyncStoragePersister', + outputFile: 'index', + entryFile: 'src/index.ts', + globals: { + '@tanstack/query-persist-client-core': 'QueryPersistClientCore', + }, + }), + ...buildConfigs({ + name: 'query-broadcast-client-experimental', + packageDir: 'packages/query-broadcast-client-experimental', + jsName: 'QueryBroadcastClient', + outputFile: 'index', + entryFile: 'src/index.ts', + globals: { + '@tanstack/query-core': 'QueryCore', + 'broadcast-channel': 'BroadcastChannel', + }, + }), + ...buildConfigs({ + name: 'query-sync-storage-persister', + packageDir: 'packages/query-sync-storage-persister', + jsName: 'QuerySyncStoragePersister', + outputFile: 'index', + entryFile: 'src/index.ts', + globals: { + '@tanstack/query-persist-client-core': 'QueryPersistClientCore', + }, + }), + ...buildConfigs({ + name: 'react-query', + packageDir: 'packages/react-query', + jsName: 'ReactQuery', + outputFile: 'index', + entryFile: ['src/index.ts'], + globals: { + react: 'React', + 'react-dom': 'ReactDOM', + '@tanstack/query-core': 'QueryCore', + 'react-native': 'ReactNative', + }, + bundleUMDGlobals: ['@tanstack/query-core'], + }), + ...buildConfigs({ + name: 'react-query-devtools', + packageDir: 'packages/react-query-devtools', + jsName: 'ReactQueryDevtools', + outputFile: 'index', + entryFile: 'src/index.ts', + globals: { + react: 'React', + 'react-dom': 'ReactDOM', + '@tanstack/react-query': 'ReactQuery', + '@tanstack/query-devtools': 'TanstackQueryDevtools', + }, + bundleUMDGlobals: ['@tanstack/query-devtools'], + }), + ...buildConfigs({ + name: 'react-query-devtools-prod', + packageDir: 'packages/react-query-devtools', + jsName: 'ReactQueryDevtools', + outputFile: 'index.prod', + entryFile: 'src/index.ts', + globals: { + react: 'React', + 'react-dom': 'ReactDOM', + '@tanstack/react-query': 'ReactQuery', + '@tanstack/match-sorter-utils': 'MatchSorterUtils', + superjson: 'SuperJson', + }, + forceDevEnv: true, + forceBundle: true, + skipUmdBuild: true, + }), + ...buildConfigs({ + name: 'react-query-persist-client', + packageDir: 'packages/react-query-persist-client', + jsName: 'ReactQueryPersistClient', + outputFile: 'index', + entryFile: 'src/index.ts', + globals: { + react: 'React', + '@tanstack/query-persist-client-core': 'QueryPersistClientCore', + '@tanstack/react-query': 'ReactQuery', + }, + bundleUMDGlobals: ['@tanstack/query-persist-client-core'], + }), + createSolidQueryConfig(), + ...buildConfigs({ + name: 'vue-query', + packageDir: 'packages/vue-query', + jsName: 'VueQuery', + outputFile: 'index', + entryFile: 'src/index.ts', + globals: { + '@tanstack/query-core': 'QueryCore', + vue: 'Vue', + 'vue-demi': 'Vue', + '@tanstack/match-sorter-utils': 'MatchSorter', + '@vue/devtools-api': 'DevtoolsApi', + }, + bundleUMDGlobals: [ + '@tanstack/query-core', + '@tanstack/match-sorter-utils', + '@vue/devtools-api', + ], + }), +]) diff --git a/rollup.config.ts b/rollup.config.ts deleted file mode 100644 index 5b21e03de6..0000000000 --- a/rollup.config.ts +++ /dev/null @@ -1,518 +0,0 @@ -import type { OutputOptions, Plugin, RollupOptions } from 'rollup' -import babel from '@rollup/plugin-babel' -import terser from '@rollup/plugin-terser' -import size from 'rollup-plugin-size' -import visualizer from 'rollup-plugin-visualizer' -import replace from '@rollup/plugin-replace' -import nodeResolve from '@rollup/plugin-node-resolve' -import commonJS from '@rollup/plugin-commonjs' -import path from 'path' -import withSolid from 'rollup-preset-solid' -import preserveDirectives from 'rollup-plugin-preserve-directives' - -type Options = { - input: string | string[] - packageDir: string - external: RollupOptions['external'] - banner: string - jsName: string - outputFile: string - globals: Record - forceDevEnv: boolean - forceBundle: boolean -} - -const forceEnvPlugin = (type: 'development' | 'production') => - replace({ - 'process.env.NODE_ENV': `"${type}"`, - delimiters: ['', ''], - preventAssignment: true, - }) - -const babelPlugin = (type: 'legacy' | 'modern') => - babel({ - browserslistConfigFile: type === 'modern' ? true : false, - targets: - type === 'modern' - ? '' - : { - chrome: '73', - firefox: '78', - edge: '79', - safari: '12', - ios: '12', - opera: '53', - }, - babelHelpers: 'bundled', - exclude: /node_modules/, - extensions: ['.ts', '.tsx', '.native.ts'], - }) - -export default function rollup(options: RollupOptions): RollupOptions[] { - return [ - createTanstackQueryDevtoolsConfig(), - ...buildConfigs({ - name: 'query-core', - packageDir: 'packages/query-core', - jsName: 'QueryCore', - outputFile: 'index', - entryFile: ['src/index.ts'], - globals: {}, - }), - ...buildConfigs({ - name: 'query-persist-client-core', - packageDir: 'packages/query-persist-client-core', - jsName: 'QueryPersistClientCore', - outputFile: 'index', - entryFile: ['src/index.ts'], - globals: { - '@tanstack/query-core': 'QueryCore', - }, - }), - ...buildConfigs({ - name: 'query-async-storage-persister', - packageDir: 'packages/query-async-storage-persister', - jsName: 'QueryAsyncStoragePersister', - outputFile: 'index', - entryFile: 'src/index.ts', - globals: { - '@tanstack/query-persist-client-core': 'QueryPersistClientCore', - }, - }), - ...buildConfigs({ - name: 'query-broadcast-client-experimental', - packageDir: 'packages/query-broadcast-client-experimental', - jsName: 'QueryBroadcastClient', - outputFile: 'index', - entryFile: 'src/index.ts', - globals: { - '@tanstack/query-core': 'QueryCore', - 'broadcast-channel': 'BroadcastChannel', - }, - }), - ...buildConfigs({ - name: 'query-sync-storage-persister', - packageDir: 'packages/query-sync-storage-persister', - jsName: 'QuerySyncStoragePersister', - outputFile: 'index', - entryFile: 'src/index.ts', - globals: { - '@tanstack/query-persist-client-core': 'QueryPersistClientCore', - }, - }), - ...buildConfigs({ - name: 'react-query', - packageDir: 'packages/react-query', - jsName: 'ReactQuery', - outputFile: 'index', - entryFile: ['src/index.ts'], - globals: { - react: 'React', - 'react-dom': 'ReactDOM', - '@tanstack/query-core': 'QueryCore', - 'react-native': 'ReactNative', - }, - bundleUMDGlobals: ['@tanstack/query-core'], - }), - ...buildConfigs({ - name: 'react-query-devtools', - packageDir: 'packages/react-query-devtools', - jsName: 'ReactQueryDevtools', - outputFile: 'index', - entryFile: 'src/index.ts', - globals: { - react: 'React', - 'react-dom': 'ReactDOM', - '@tanstack/react-query': 'ReactQuery', - '@tanstack/query-devtools': 'TanstackQueryDevtools', - }, - bundleUMDGlobals: ['@tanstack/query-devtools'], - }), - ...buildConfigs({ - name: 'react-query-devtools-prod', - packageDir: 'packages/react-query-devtools', - jsName: 'ReactQueryDevtools', - outputFile: 'index.prod', - entryFile: 'src/index.ts', - globals: { - react: 'React', - 'react-dom': 'ReactDOM', - '@tanstack/react-query': 'ReactQuery', - '@tanstack/match-sorter-utils': 'MatchSorterUtils', - superjson: 'SuperJson', - }, - forceDevEnv: true, - forceBundle: true, - skipUmdBuild: true, - }), - ...buildConfigs({ - name: 'react-query-persist-client', - packageDir: 'packages/react-query-persist-client', - jsName: 'ReactQueryPersistClient', - outputFile: 'index', - entryFile: 'src/index.ts', - globals: { - react: 'React', - '@tanstack/query-persist-client-core': 'QueryPersistClientCore', - '@tanstack/react-query': 'ReactQuery', - }, - bundleUMDGlobals: ['@tanstack/query-persist-client-core'], - }), - createSolidQueryConfig(), - ...buildConfigs({ - name: 'vue-query', - packageDir: 'packages/vue-query', - jsName: 'VueQuery', - outputFile: 'index', - entryFile: 'src/index.ts', - globals: { - '@tanstack/query-core': 'QueryCore', - vue: 'Vue', - 'vue-demi': 'Vue', - '@tanstack/match-sorter-utils': 'MatchSorter', - '@vue/devtools-api': 'DevtoolsApi', - }, - bundleUMDGlobals: [ - '@tanstack/query-core', - '@tanstack/match-sorter-utils', - '@vue/devtools-api', - ], - }), - ] -} - -function buildConfigs(opts: { - packageDir: string - name: string - jsName: string - outputFile: string - entryFile: string | string[] - globals: Record - // This option allows to bundle specified dependencies for umd build - bundleUMDGlobals?: string[] - // Force prod env build - forceDevEnv?: boolean - forceBundle?: boolean - skipUmdBuild?: boolean -}): RollupOptions[] { - const firstEntry = path.resolve( - opts.packageDir, - Array.isArray(opts.entryFile) ? opts.entryFile[0] : opts.entryFile, - ) - const entries = Array.isArray(opts.entryFile) - ? opts.entryFile - : [opts.entryFile] - const input = entries.map((entry) => path.resolve(opts.packageDir, entry)) - const externalDeps = Object.keys(opts.globals) - - const bundleUMDGlobals = opts.bundleUMDGlobals || [] - const umdExternal = externalDeps.filter( - (external) => !bundleUMDGlobals.includes(external), - ) - - const external = (moduleName) => externalDeps.includes(moduleName) - const banner = '' //createBanner(opts.name) - - const options: Options = { - input, - jsName: opts.jsName, - outputFile: opts.outputFile, - packageDir: opts.packageDir, - external, - banner, - globals: opts.globals, - forceDevEnv: opts.forceDevEnv || false, - forceBundle: opts.forceBundle || false, - } - - let builds = [mjs(options), esm(options), cjs(options)] - - if (!opts.skipUmdBuild) { - builds = builds.concat([ - umdDev({ ...options, external: umdExternal, input: firstEntry }), - umdProd({ ...options, external: umdExternal, input: firstEntry }), - ]) - } - - return builds -} - -function mjs({ - input, - packageDir, - external, - banner, - outputFile, - forceDevEnv, - forceBundle, -}: Options): RollupOptions { - const bundleOutput: OutputOptions = { - format: 'esm', - file: `${packageDir}/build/lib/${outputFile}.mjs`, - sourcemap: true, - banner, - } - - const normalOutput: OutputOptions = { - format: 'esm', - dir: `${packageDir}/build/lib`, - sourcemap: true, - banner, - preserveModules: true, - entryFileNames: '[name].mjs', - } - - return { - // MJS - external, - input, - output: forceBundle ? bundleOutput : normalOutput, - plugins: [ - babelPlugin('modern'), - commonJS(), - nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), - forceDevEnv ? forceEnvPlugin('development') : undefined, - preserveDirectives(), - ], - } -} - -function esm({ - input, - packageDir, - external, - banner, - outputFile, - forceDevEnv, - forceBundle, -}: Options): RollupOptions { - const bundleOutput: OutputOptions = { - format: 'esm', - file: `${packageDir}/build/lib/${outputFile}.esm.js`, - sourcemap: true, - banner, - } - - const normalOutput: OutputOptions = { - format: 'esm', - dir: `${packageDir}/build/lib`, - sourcemap: true, - banner, - preserveModules: true, - entryFileNames: '[name].esm.js', - } - - return { - // ESM - external, - input, - output: forceBundle ? bundleOutput : normalOutput, - plugins: [ - babelPlugin('legacy'), - commonJS(), - nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), - forceDevEnv ? forceEnvPlugin('development') : undefined, - preserveDirectives(), - ], - } -} - -function cjs({ - input, - external, - packageDir, - banner, - outputFile, - forceDevEnv, - forceBundle, -}: Options): RollupOptions { - const bundleOutput: OutputOptions = { - format: 'cjs', - file: `${packageDir}/build/lib/${outputFile}.js`, - sourcemap: true, - exports: 'named', - banner, - } - - const normalOutput: OutputOptions = { - format: 'cjs', - dir: `${packageDir}/build/lib`, - sourcemap: true, - exports: 'named', - banner, - preserveModules: true, - entryFileNames: '[name].js', - } - - return { - // CJS - external, - input, - output: forceBundle ? bundleOutput : normalOutput, - plugins: [ - babelPlugin('legacy'), - commonJS(), - nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), - forceDevEnv ? forceEnvPlugin('development') : undefined, - preserveDirectives(), - ], - } -} - -function umdDev({ - input, - external, - packageDir, - outputFile, - globals, - banner, - jsName, -}: Options): RollupOptions { - return { - // UMD (Dev) - external, - input, - output: { - format: 'umd', - sourcemap: true, - file: `${packageDir}/build/umd/${outputFile}.development.js`, - name: jsName, - globals, - banner, - }, - plugins: [ - commonJS(), - babelPlugin('modern'), - nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), - forceEnvPlugin('development'), - ], - } -} - -function umdProd({ - input, - external, - packageDir, - outputFile, - globals, - banner, - jsName, -}: Options): RollupOptions { - return { - // UMD (Prod) - external, - input, - output: { - format: 'umd', - sourcemap: true, - file: `${packageDir}/build/umd/${outputFile}.production.js`, - name: jsName, - globals, - banner, - }, - plugins: [ - commonJS(), - babelPlugin('modern'), - nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }), - forceEnvPlugin('production'), - terser({ - mangle: true, - compress: true, - }), - size({}), - visualizer({ - filename: `${packageDir}/build/stats-html.html`, - gzipSize: true, - }), - visualizer({ - filename: `${packageDir}/build/stats.json`, - json: true, - gzipSize: true, - }), - ], - } -} - -function createBanner(libraryName: string) { - return `/** - * ${libraryName} - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */` -} - -function createSolidQueryConfig() { - const packageDir = 'packages/solid-query' - const solidRollupOptions = withSolid({ - input: `${packageDir}/src/index.ts`, - targets: ['esm', 'cjs', 'umd'], - external: ['@tanstack/query-core'], - }) as RollupOptions - - const outputs = !solidRollupOptions.output - ? [] - : Array.isArray(solidRollupOptions.output) - ? solidRollupOptions.output - : [solidRollupOptions.output] - - outputs.forEach((output) => { - const format = output.format - if (format === 'umd') { - output.globals = { - 'solid-js/store': 'SolidStore', - 'solid-js/web': 'SolidWeb', - 'solid-js': 'Solid', - '@tanstack/query-core': 'QueryCore', - } - } - output.dir = `${packageDir}/build/${format}` - }) - - const plugins = solidRollupOptions.plugins as Plugin[] - // Prevent types generation since it doesn't resolve the directory correctly - // Instead build:types will generate those types anyway - const filtered = plugins.filter((plugin) => plugin.name !== 'ts') - - solidRollupOptions.plugins = filtered - - return solidRollupOptions -} - -function createTanstackQueryDevtoolsConfig() { - const packageDir = 'packages/query-devtools' - const solidRollupOptions = withSolid({ - input: `${packageDir}/src/index.tsx`, - targets: ['esm', 'cjs', 'umd'], - }) as RollupOptions - - const outputs = !solidRollupOptions.output - ? [] - : Array.isArray(solidRollupOptions.output) - ? solidRollupOptions.output - : [solidRollupOptions.output] - - outputs.forEach((output) => { - const format = output.format - output.dir = `${packageDir}/build/${format}` - if (output.format === 'esm') { - output.dir = undefined - output.file = `${packageDir}/build/${format}/index.mjs` - } - }) - - solidRollupOptions.external = [] - - const plugins = solidRollupOptions.plugins as Plugin[] - // Prevent types generation since it doesn't resolve the directory correctly - // Instead build:types will generate those types anyway - const filtered = plugins.filter((plugin) => plugin.name !== 'ts') - - solidRollupOptions.plugins = filtered - - return solidRollupOptions -} diff --git a/tsconfig.base.json b/tsconfig.base.json index dd666899f4..a63d06e27d 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -46,5 +46,5 @@ "@tanstack/query-devtools": ["packages/query-devtools"] } }, - "include": [".eslintrc.cjs", "scripts"] + "include": [".eslintrc.cjs", "rollup.config.mjs", "scripts"] }