From 19ed47d0e85f2dda08fc20cfce989717d6159749 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 15 Mar 2024 06:23:31 +0000 Subject: [PATCH 01/17] chore: upgraded tsup version to 8.0.0+ --- package.json | 2 +- pnpm-lock.yaml | 152 ++++++++++++++++++++++--------------------------- 2 files changed, 70 insertions(+), 84 deletions(-) diff --git a/package.json b/package.json index 720a259a116..a1c15365927 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "textlint": "^13.3.2", "textlint-rule-no-dead-link": "^5.1.2", "ts-generator": "^0.1.1", - "tsup": "^6.7.0", + "tsup": "^8.0.0", "tsx": "^4.7.0", "turbo": "^1.8.8", "typescript": "~5.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61071666809..2d050e3c5ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -138,8 +138,8 @@ importers: specifier: ^0.1.1 version: 0.1.1 tsup: - specifier: ^6.7.0 - version: 6.7.0(typescript@5.2.2) + specifier: ^8.0.0 + version: 8.0.2(typescript@5.2.2) tsx: specifier: ^4.7.0 version: 4.7.0 @@ -253,7 +253,7 @@ importers: version: 18.2.0(react@18.2.0) react-scripts: specifier: 5.0.1 - version: 5.0.1(@babel/plugin-syntax-flow@7.23.3)(@babel/plugin-transform-react-jsx@7.23.4)(esbuild@0.17.19)(eslint@8.54.0)(react@18.2.0)(typescript@5.2.2) + version: 5.0.1(@babel/plugin-syntax-flow@7.23.3)(@babel/plugin-transform-react-jsx@7.23.4)(esbuild@0.19.12)(eslint@8.54.0)(react@18.2.0)(typescript@5.2.2) typescript: specifier: ~5.2.2 version: 5.2.2 @@ -3626,7 +3626,6 @@ packages: cpu: [ppc64] os: [aix] requiresBuild: true - dev: true optional: true /@esbuild/android-arm64@0.17.19: @@ -3635,6 +3634,7 @@ packages: cpu: [arm64] os: [android] requiresBuild: true + dev: true optional: true /@esbuild/android-arm64@0.19.12: @@ -3643,7 +3643,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-arm64@0.19.3: @@ -3660,6 +3659,7 @@ packages: cpu: [arm] os: [android] requiresBuild: true + dev: true optional: true /@esbuild/android-arm@0.19.12: @@ -3668,7 +3668,6 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-arm@0.19.3: @@ -3685,6 +3684,7 @@ packages: cpu: [x64] os: [android] requiresBuild: true + dev: true optional: true /@esbuild/android-x64@0.19.12: @@ -3693,7 +3693,6 @@ packages: cpu: [x64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-x64@0.19.3: @@ -3710,6 +3709,7 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true + dev: true optional: true /@esbuild/darwin-arm64@0.19.12: @@ -3718,7 +3718,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/darwin-arm64@0.19.3: @@ -3735,6 +3734,7 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true + dev: true optional: true /@esbuild/darwin-x64@0.19.12: @@ -3743,7 +3743,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/darwin-x64@0.19.3: @@ -3760,6 +3759,7 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true + dev: true optional: true /@esbuild/freebsd-arm64@0.19.12: @@ -3768,7 +3768,6 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-arm64@0.19.3: @@ -3785,6 +3784,7 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true + dev: true optional: true /@esbuild/freebsd-x64@0.19.12: @@ -3793,7 +3793,6 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-x64@0.19.3: @@ -3810,6 +3809,7 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-arm64@0.19.12: @@ -3818,7 +3818,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm64@0.19.3: @@ -3835,6 +3834,7 @@ packages: cpu: [arm] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-arm@0.19.12: @@ -3843,7 +3843,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm@0.19.3: @@ -3860,6 +3859,7 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-ia32@0.19.12: @@ -3868,7 +3868,6 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ia32@0.19.3: @@ -3885,6 +3884,7 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-loong64@0.19.12: @@ -3893,7 +3893,6 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-loong64@0.19.3: @@ -3910,6 +3909,7 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-mips64el@0.19.12: @@ -3918,7 +3918,6 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-mips64el@0.19.3: @@ -3935,6 +3934,7 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-ppc64@0.19.12: @@ -3943,7 +3943,6 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ppc64@0.19.3: @@ -3960,6 +3959,7 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-riscv64@0.19.12: @@ -3968,7 +3968,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-riscv64@0.19.3: @@ -3985,6 +3984,7 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-s390x@0.19.12: @@ -3993,7 +3993,6 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-s390x@0.19.3: @@ -4010,6 +4009,7 @@ packages: cpu: [x64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-x64@0.19.12: @@ -4018,7 +4018,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-x64@0.19.3: @@ -4035,6 +4034,7 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true + dev: true optional: true /@esbuild/netbsd-x64@0.19.12: @@ -4043,7 +4043,6 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true - dev: true optional: true /@esbuild/netbsd-x64@0.19.3: @@ -4060,6 +4059,7 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true + dev: true optional: true /@esbuild/openbsd-x64@0.19.12: @@ -4068,7 +4068,6 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true - dev: true optional: true /@esbuild/openbsd-x64@0.19.3: @@ -4085,6 +4084,7 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true + dev: true optional: true /@esbuild/sunos-x64@0.19.12: @@ -4093,7 +4093,6 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true - dev: true optional: true /@esbuild/sunos-x64@0.19.3: @@ -4110,6 +4109,7 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true + dev: true optional: true /@esbuild/win32-arm64@0.19.12: @@ -4118,7 +4118,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-arm64@0.19.3: @@ -4135,6 +4134,7 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true + dev: true optional: true /@esbuild/win32-ia32@0.19.12: @@ -4143,7 +4143,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-ia32@0.19.3: @@ -4160,6 +4159,7 @@ packages: cpu: [x64] os: [win32] requiresBuild: true + dev: true optional: true /@esbuild/win32-x64@0.19.12: @@ -4168,7 +4168,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-x64@0.19.3: @@ -5813,7 +5812,7 @@ packages: react-refresh: 0.11.0 schema-utils: 3.3.0 source-map: 0.7.4 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) webpack-dev-server: 4.15.1(webpack@5.88.0) dev: false @@ -8812,7 +8811,7 @@ packages: loader-utils: 2.0.4 make-dir: 3.1.0 schema-utils: 2.7.1 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /babel-plugin-istanbul@6.1.1: @@ -9320,13 +9319,13 @@ packages: run-applescript: 5.0.0 dev: true - /bundle-require@4.0.1(esbuild@0.17.19): + /bundle-require@4.0.1(esbuild@0.19.12): resolution: {integrity: sha512-9NQkRHlNdNpDBGmLpngF3EFDcwodhMUuLz9PaWYciVcQF9SE4LFjM2DB/xV1Li5JiuDMv7ZUWuC3rGbqR0MAXQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} peerDependencies: esbuild: '>=0.17' dependencies: - esbuild: 0.17.19 + esbuild: 0.19.12 load-tsconfig: 0.2.5 dev: true @@ -10174,10 +10173,10 @@ packages: postcss-modules-values: 4.0.0(postcss@8.4.33) postcss-value-parser: 4.2.0 semver: 7.5.4 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false - /css-minimizer-webpack-plugin@3.4.1(esbuild@0.17.19)(webpack@5.88.0): + /css-minimizer-webpack-plugin@3.4.1(esbuild@0.19.12)(webpack@5.88.0): resolution: {integrity: sha512-1u6D71zeIfgngN2XNRJefc/hY7Ybsxd74Jm4qngIXyUEk7fss3VUzuHxLAq/R8NAba4QU9OUSaMZlbpRc7bM4Q==} engines: {node: '>= 12.13.0'} peerDependencies: @@ -10197,13 +10196,13 @@ packages: optional: true dependencies: cssnano: 5.1.15(postcss@8.4.33) - esbuild: 0.17.19 + esbuild: 0.19.12 jest-worker: 27.5.1 postcss: 8.4.33 schema-utils: 4.2.0 serialize-javascript: 6.0.1 source-map: 0.6.1 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /css-prefers-color-scheme@6.0.3(postcss@8.4.24): @@ -11190,6 +11189,7 @@ packages: '@esbuild/win32-arm64': 0.17.19 '@esbuild/win32-ia32': 0.17.19 '@esbuild/win32-x64': 0.17.19 + dev: true /esbuild@0.19.12: resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} @@ -11220,7 +11220,6 @@ packages: '@esbuild/win32-arm64': 0.19.12 '@esbuild/win32-ia32': 0.19.12 '@esbuild/win32-x64': 0.19.12 - dev: true /esbuild@0.19.3: resolution: {integrity: sha512-UlJ1qUUA2jL2nNib1JTSkifQTcYTroFqRjwCFW4QYEKEsixXD5Tik9xML7zh2gTxkYTBKGHNH9y7txMwVyPbjw==} @@ -11993,7 +11992,7 @@ packages: micromatch: 4.0.5 normalize-path: 3.0.0 schema-utils: 4.2.0 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /eslint@8.38.0: @@ -12525,7 +12524,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /filelist@1.0.4: @@ -12695,7 +12694,7 @@ packages: semver: 7.5.4 tapable: 1.1.3 typescript: 5.2.2 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /form-data-encoder@1.9.0: @@ -13089,7 +13088,7 @@ packages: array-union: 2.1.0 dir-glob: 3.0.1 fast-glob: 3.3.1 - ignore: 5.2.4 + ignore: 5.3.0 merge2: 1.4.1 slash: 3.0.0 @@ -13393,7 +13392,7 @@ packages: lodash: 4.17.21 pretty-error: 4.0.0 tapable: 2.2.1 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /htmlparser2@6.1.0: @@ -15848,7 +15847,7 @@ packages: webpack: ^5.0.0 dependencies: schema-utils: 4.2.0 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /minimalistic-assert@1.0.1: @@ -17339,22 +17338,6 @@ packages: postcss-value-parser: 4.2.0 dev: false - /postcss-load-config@3.1.4: - resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} - engines: {node: '>= 10'} - peerDependencies: - postcss: '>=8.0.9' - ts-node: '>=9.0.0' - peerDependenciesMeta: - postcss: - optional: true - ts-node: - optional: true - dependencies: - lilconfig: 2.1.0 - yaml: 1.10.2 - dev: true - /postcss-load-config@4.0.1(postcss@8.4.33): resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==} engines: {node: '>= 14'} @@ -17382,7 +17365,7 @@ packages: klona: 2.0.6 postcss: 8.4.24 semver: 7.5.4 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /postcss-logical@5.0.4(postcss@8.4.24): @@ -18275,7 +18258,7 @@ packages: strip-ansi: 6.0.1 text-table: 0.2.0 typescript: 5.2.2 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) transitivePeerDependencies: - eslint - supports-color @@ -18365,7 +18348,7 @@ packages: use-sidecar: 1.1.2(@types/react@18.2.9)(react@18.2.0) dev: false - /react-scripts@5.0.1(@babel/plugin-syntax-flow@7.23.3)(@babel/plugin-transform-react-jsx@7.23.4)(esbuild@0.17.19)(eslint@8.54.0)(react@18.2.0)(typescript@5.2.2): + /react-scripts@5.0.1(@babel/plugin-syntax-flow@7.23.3)(@babel/plugin-transform-react-jsx@7.23.4)(esbuild@0.19.12)(eslint@8.54.0)(react@18.2.0)(typescript@5.2.2): resolution: {integrity: sha512-8VAmEm/ZAwQzJ+GOMLbBsTdDKOpuZh7RPs0UymvBR2vRk4iZWCskjbFnxqjrzoIvlNNRZ3QJFx6/qDSi6zSnaQ==} engines: {node: '>=14.0.0'} hasBin: true @@ -18389,7 +18372,7 @@ packages: camelcase: 6.3.0 case-sensitive-paths-webpack-plugin: 2.4.0 css-loader: 6.8.1(webpack@5.88.0) - css-minimizer-webpack-plugin: 3.4.1(esbuild@0.17.19)(webpack@5.88.0) + css-minimizer-webpack-plugin: 3.4.1(esbuild@0.19.12)(webpack@5.88.0) dotenv: 10.0.0 dotenv-expand: 5.1.0 eslint: 8.54.0 @@ -18420,9 +18403,9 @@ packages: source-map-loader: 3.0.2(webpack@5.88.0) style-loader: 3.3.3(webpack@5.88.0) tailwindcss: 3.3.2 - terser-webpack-plugin: 5.3.9(esbuild@0.17.19)(webpack@5.88.0) + terser-webpack-plugin: 5.3.9(esbuild@0.19.12)(webpack@5.88.0) typescript: 5.2.2 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) webpack-dev-server: 4.15.1(webpack@5.88.0) webpack-manifest-plugin: 4.1.1(webpack@5.88.0) workbox-webpack-plugin: 6.6.0(webpack@5.88.0) @@ -19051,7 +19034,7 @@ packages: dependencies: klona: 2.0.6 neo-async: 2.6.2 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /sax@1.2.4: @@ -19467,7 +19450,7 @@ packages: abab: 2.0.6 iconv-lite: 0.6.3 source-map-js: 1.0.2 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /source-map-support@0.5.21: @@ -19848,7 +19831,7 @@ packages: peerDependencies: webpack: ^5.0.0 dependencies: - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /styled-jsx@5.1.1(@babel/core@7.23.3)(react@18.2.0): @@ -20088,7 +20071,7 @@ packages: supports-hyperlinks: 2.3.0 dev: false - /terser-webpack-plugin@5.3.9(esbuild@0.17.19)(webpack@5.88.0): + /terser-webpack-plugin@5.3.9(esbuild@0.19.12)(webpack@5.88.0): resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -20105,12 +20088,12 @@ packages: optional: true dependencies: '@jridgewell/trace-mapping': 0.3.18 - esbuild: 0.17.19 + esbuild: 0.19.12 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 terser: 5.18.2 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /terser@5.18.2: @@ -20455,15 +20438,18 @@ packages: /tslib@2.6.0: resolution: {integrity: sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==} - /tsup@6.7.0(typescript@5.2.2): - resolution: {integrity: sha512-L3o8hGkaHnu5TdJns+mCqFsDBo83bJ44rlK7e6VdanIvpea4ArPcU3swWGsLVbXak1PqQx/V+SSmFPujBK+zEQ==} - engines: {node: '>=14.18'} + /tsup@8.0.2(typescript@5.2.2): + resolution: {integrity: sha512-NY8xtQXdH7hDUAZwcQdY/Vzlw9johQsaqf7iwZ6g1DOUlFYQ5/AtVAjTvihhEyeRlGo4dLRVHtrRaL35M1daqQ==} + engines: {node: '>=18'} hasBin: true peerDependencies: + '@microsoft/api-extractor': ^7.36.0 '@swc/core': ^1 postcss: ^8.4.12 - typescript: '>=4.1.0' + typescript: '>=4.5.0' peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true '@swc/core': optional: true postcss: @@ -20471,17 +20457,17 @@ packages: typescript: optional: true dependencies: - bundle-require: 4.0.1(esbuild@0.17.19) + bundle-require: 4.0.1(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.5.3 debug: 4.3.4(supports-color@5.5.0) - esbuild: 0.17.19 + esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 3.1.4 + postcss-load-config: 4.0.1(postcss@8.4.33) resolve-from: 5.0.0 - rollup: 3.25.3 + rollup: 4.9.6 source-map: 0.8.0-beta.0 sucrase: 3.32.0 tree-kill: 1.2.2 @@ -21555,7 +21541,7 @@ packages: mime-types: 2.1.35 range-parser: 1.2.1 schema-utils: 4.2.0 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) dev: false /webpack-dev-server@4.15.1(webpack@5.88.0): @@ -21599,7 +21585,7 @@ packages: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) webpack-dev-middleware: 5.3.3(webpack@5.88.0) ws: 8.13.0 transitivePeerDependencies: @@ -21616,7 +21602,7 @@ packages: webpack: ^4.44.2 || ^5.47.0 dependencies: tapable: 2.2.1 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) webpack-sources: 2.3.1 dev: false @@ -21640,7 +21626,7 @@ packages: engines: {node: '>=10.13.0'} dev: false - /webpack@5.88.0(esbuild@0.17.19): + /webpack@5.88.0(esbuild@0.19.12): resolution: {integrity: sha512-O3jDhG5e44qIBSi/P6KpcCcH7HD+nYIHVBhdWFxcLOcIGN8zGo5nqF3BjyNCxIh4p1vFdNnreZv2h2KkoAw3lw==} engines: {node: '>=10.13.0'} hasBin: true @@ -21671,7 +21657,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.9(esbuild@0.17.19)(webpack@5.88.0) + terser-webpack-plugin: 5.3.9(esbuild@0.19.12)(webpack@5.88.0) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: @@ -21987,7 +21973,7 @@ packages: fast-json-stable-stringify: 2.1.0 pretty-bytes: 5.6.0 upath: 1.2.0 - webpack: 5.88.0(esbuild@0.17.19) + webpack: 5.88.0(esbuild@0.19.12) webpack-sources: 1.4.3 workbox-build: 6.6.0 transitivePeerDependencies: From 13333ed19bdf0688b96e05c23c409b9f57507091 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 15 Mar 2024 06:26:33 +0000 Subject: [PATCH 02/17] chore: removed types from abi-typegen package.json --- packages/abi-typegen/package.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/abi-typegen/package.json b/packages/abi-typegen/package.json index 4917b42c187..b2b4213afe3 100644 --- a/packages/abi-typegen/package.json +++ b/packages/abi-typegen/package.json @@ -8,25 +8,21 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./cli": { "require": "./dist/cli.js", - "import": "./dist/cli.mjs", - "types": "./dist/cli.d.ts" + "import": "./dist/cli.mjs" }, "./runTypegen": { "require": "./dist/runTypegen.js", - "import": "./dist/runTypegen.mjs", - "types": "./dist/runTypegen.d.ts" + "import": "./dist/runTypegen.mjs" } }, "typesVersions": { From 253e64b8961850688b96662ee11837cec0a3f324 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 15 Mar 2024 06:27:08 +0000 Subject: [PATCH 03/17] chore: refactored postbuild to use tsup and emit declarations --- packages/abi-typegen/package.json | 2 +- packages/abi-typegen/tsup.config.dts.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/abi-typegen/tsup.config.dts.ts diff --git a/packages/abi-typegen/package.json b/packages/abi-typegen/package.json index b2b4213afe3..a00c86a235c 100644 --- a/packages/abi-typegen/package.json +++ b/packages/abi-typegen/package.json @@ -42,7 +42,7 @@ "pretest": "pnpm build:forc", "build": "tsup", "build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/abi-typegen/tsup.config.dts.ts b/packages/abi-typegen/tsup.config.dts.ts new file mode 100644 index 00000000000..a687e896e04 --- /dev/null +++ b/packages/abi-typegen/tsup.config.dts.ts @@ -0,0 +1,13 @@ +import type { Options } from 'tsup'; + +import tsupDefaults from './tsup.config'; + +const configs: Options = { + ...tsupDefaults, + tsconfig: 'tsconfig.dts.json', + 'sourcemap': true, + 'dts': true, + clean: false +}; + +export default configs; From 94288d4f0ba876d1874f443cb85d9046aa863bad Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 15 Mar 2024 06:48:25 +0000 Subject: [PATCH 04/17] chore: refactored handlebars import to use the default export --- packages/abi-typegen/src/templates/renderHbsTemplate.ts | 6 +++--- packages/fuels/src/cli/templates/fuels.config.ts | 4 ++-- packages/fuels/src/cli/templates/index.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/abi-typegen/src/templates/renderHbsTemplate.ts b/packages/abi-typegen/src/templates/renderHbsTemplate.ts index 9848c0e879b..3738df617fb 100644 --- a/packages/abi-typegen/src/templates/renderHbsTemplate.ts +++ b/packages/abi-typegen/src/templates/renderHbsTemplate.ts @@ -1,5 +1,5 @@ import { versions } from '@fuel-ts/versions'; -import { compile } from 'handlebars'; +import Handlebars from 'handlebars'; import headerTemplate from './common/_header.hbs'; @@ -15,8 +15,8 @@ export function renderHbsTemplate(params: { template: string; data?: Record -import Handlebars, { compile } from 'handlebars'; +import Handlebars from 'handlebars'; import fuelsConfigTemplate from './fuels.config.hbs'; @@ -17,7 +17,7 @@ export function renderFuelsConfigTemplate(props: { useBuiltinFuelCore?: boolean; autoStartFuelCore?: boolean; }) { - const renderTemplate = compile(fuelsConfigTemplate, { + const renderTemplate = Handlebars.compile(fuelsConfigTemplate, { strict: true, noEscape: true, }); diff --git a/packages/fuels/src/cli/templates/index.ts b/packages/fuels/src/cli/templates/index.ts index 13fa8ab7c61..83a24c41c2c 100644 --- a/packages/fuels/src/cli/templates/index.ts +++ b/packages/fuels/src/cli/templates/index.ts @@ -3,12 +3,12 @@ // TODO: once abi-typegen implements a way to generate all types of sway // programs in a bundle file we don't need to create a index.ts file -import { compile } from 'handlebars'; +import Handlebars from 'handlebars'; import indexTemplate from './index.hbs'; export function renderIndexTemplate(paths: string[]) { - const renderTemplate = compile(indexTemplate, { + const renderTemplate = Handlebars.compile(indexTemplate, { strict: true, noEscape: true, }); From 75b0a18fcf2b3ea083b131c164054e50325d3393 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 18 Mar 2024 17:42:55 +0000 Subject: [PATCH 05/17] chore: linting --- packages/abi-typegen/tsup.config.dts.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/abi-typegen/tsup.config.dts.ts b/packages/abi-typegen/tsup.config.dts.ts index a687e896e04..893aad4e3cf 100644 --- a/packages/abi-typegen/tsup.config.dts.ts +++ b/packages/abi-typegen/tsup.config.dts.ts @@ -5,9 +5,9 @@ import tsupDefaults from './tsup.config'; const configs: Options = { ...tsupDefaults, tsconfig: 'tsconfig.dts.json', - 'sourcemap': true, - 'dts': true, - clean: false + sourcemap: true, + dts: true, + clean: false, }; export default configs; From c96c00bb0049ee9c8730bc60a13279ecd70b08eb Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 18 Mar 2024 17:49:37 +0000 Subject: [PATCH 06/17] chore: added changeset --- .changeset/friendly-cherries-divide.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/friendly-cherries-divide.md diff --git a/.changeset/friendly-cherries-divide.md b/.changeset/friendly-cherries-divide.md new file mode 100644 index 00000000000..2bd1ff54843 --- /dev/null +++ b/.changeset/friendly-cherries-divide.md @@ -0,0 +1,5 @@ +--- +"@fuel-ts/abi-typegen": minor +--- + +Added correct ESM types exports for abi-typegen From ec77c6f37539105e73b0425e617738e163b58c96 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 19 Mar 2024 13:17:10 +0000 Subject: [PATCH 07/17] feat: added tsupDts configurations --- internal/tsup/src/index.ts | 7 +++++++ packages/abi-typegen/tsup.config.dts.ts | 10 ++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/internal/tsup/src/index.ts b/internal/tsup/src/index.ts index 1bfac507d35..9163280caba 100644 --- a/internal/tsup/src/index.ts +++ b/internal/tsup/src/index.ts @@ -47,3 +47,10 @@ export const binAndCli: Options = { cli: 'src/cli.ts', }, }; + +export const tsupDtsDefaults: Options = { + tsconfig: 'tsconfig.dts.json', + sourcemap: true, + dts: true, + clean: false, +} \ No newline at end of file diff --git a/packages/abi-typegen/tsup.config.dts.ts b/packages/abi-typegen/tsup.config.dts.ts index 893aad4e3cf..4f99fd09972 100644 --- a/packages/abi-typegen/tsup.config.dts.ts +++ b/packages/abi-typegen/tsup.config.dts.ts @@ -1,13 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; import type { Options } from 'tsup'; -import tsupDefaults from './tsup.config'; +import tsupPkg from './tsup.config'; const configs: Options = { - ...tsupDefaults, - tsconfig: 'tsconfig.dts.json', - sourcemap: true, - dts: true, - clean: false, + ...tsupPkg, + ...tsupDtsDefaults }; export default configs; From 40d713f98c2cb7b5e2d19e1b7ec6673d69d3692e Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 19 Mar 2024 18:10:53 +0000 Subject: [PATCH 08/17] feat: emit typescript types via tsup --- internal/tsup/package.json | 4 +-- internal/tsup/tsconfig.dts.json | 9 +++++++ internal/tsup/tsup.config.dts.ts | 11 +++++++++ packages/abi-coder/package.json | 4 +-- packages/abi-coder/tsup.config.dts.ts | 11 +++++++++ packages/abi-typegen/package.json | 2 +- packages/account/package.json | 12 +++------ packages/account/tsup.config.dts.ts | 11 +++++++++ packages/address/package.json | 7 ++---- packages/address/tsup.config.dts.ts | 11 +++++++++ packages/contract/package.json | 4 +-- packages/contract/tsup.config.dts.ts | 11 +++++++++ packages/crypto/package.json | 4 +-- packages/crypto/tsup.config.dts.ts | 13 ++++++++++ packages/errors/package.json | 7 ++---- packages/errors/tsup.config.dts.ts | 11 +++++++++ packages/fuels/package.json | 9 +++---- packages/fuels/tsup.config.dts.ts | 11 +++++++++ packages/hasher/package.json | 4 +-- packages/hasher/tsup.config.dts.ts | 11 +++++++++ packages/interfaces/package.json | 4 +-- packages/interfaces/tsup.config.dts.ts | 11 +++++++++ packages/math/package.json | 7 ++---- packages/math/tsup.config.dts.ts | 11 +++++++++ packages/merkle/package.json | 4 +-- packages/merkle/tsup.config.dts.ts | 11 +++++++++ packages/program/package.json | 7 ++---- packages/program/tsup.config.dts.ts | 11 +++++++++ packages/script/package.json | 4 +-- packages/script/tsup.config.dts.ts | 11 +++++++++ packages/transactions/package.json | 7 ++---- packages/transactions/tsup.config.dts.ts | 11 +++++++++ packages/utils/package.json | 10 +++----- packages/utils/tsup.config.dts.ts | 11 +++++++++ packages/versions/package.json | 7 ++---- packages/versions/tsup.config.dts.ts | 11 +++++++++ scripts/postbuild.ts | 31 +++--------------------- 37 files changed, 232 insertions(+), 104 deletions(-) create mode 100644 internal/tsup/tsconfig.dts.json create mode 100644 internal/tsup/tsup.config.dts.ts create mode 100644 packages/abi-coder/tsup.config.dts.ts create mode 100644 packages/account/tsup.config.dts.ts create mode 100644 packages/address/tsup.config.dts.ts create mode 100644 packages/contract/tsup.config.dts.ts create mode 100644 packages/crypto/tsup.config.dts.ts create mode 100644 packages/errors/tsup.config.dts.ts create mode 100644 packages/fuels/tsup.config.dts.ts create mode 100644 packages/hasher/tsup.config.dts.ts create mode 100644 packages/interfaces/tsup.config.dts.ts create mode 100644 packages/math/tsup.config.dts.ts create mode 100644 packages/merkle/tsup.config.dts.ts create mode 100644 packages/program/tsup.config.dts.ts create mode 100644 packages/script/tsup.config.dts.ts create mode 100644 packages/transactions/tsup.config.dts.ts create mode 100644 packages/utils/tsup.config.dts.ts create mode 100644 packages/versions/tsup.config.dts.ts diff --git a/internal/tsup/package.json b/internal/tsup/package.json index 93b70cd98dc..2a1f6c24183 100644 --- a/internal/tsup/package.json +++ b/internal/tsup/package.json @@ -3,12 +3,10 @@ "name": "@internal/tsup", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/internal/tsup/tsconfig.dts.json b/internal/tsup/tsconfig.dts.json new file mode 100644 index 00000000000..ccca2ac1f3e --- /dev/null +++ b/internal/tsup/tsconfig.dts.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["src"], + "exclude": ["**/*.test.ts"] +} diff --git a/internal/tsup/tsup.config.dts.ts b/internal/tsup/tsup.config.dts.ts new file mode 100644 index 00000000000..57adb060c13 --- /dev/null +++ b/internal/tsup/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import type { Options } from 'tsup'; + +import { tsupDtsDefaults } from './src'; +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/abi-coder/package.json b/packages/abi-coder/package.json index a14cb34ad3b..02b9c66f9eb 100644 --- a/packages/abi-coder/package.json +++ b/packages/abi-coder/package.json @@ -5,15 +5,13 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/packages/abi-coder/tsup.config.dts.ts b/packages/abi-coder/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/abi-coder/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/abi-typegen/package.json b/packages/abi-typegen/package.json index a00c86a235c..b2b4213afe3 100644 --- a/packages/abi-typegen/package.json +++ b/packages/abi-typegen/package.json @@ -42,7 +42,7 @@ "pretest": "pnpm build:forc", "build": "tsup", "build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release", - "postbuild": "tsup --config tsup.config.dts.ts" + "postbuild": "tsx ../../scripts/postbuild.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/account/package.json b/packages/account/package.json index 3ba4e5492d5..517aa7ad658 100644 --- a/packages/account/package.json +++ b/packages/account/package.json @@ -5,25 +5,21 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./configs": { "require": "./dist/configs.js", - "import": "./dist/configs.mjs", - "types": "./dist/configs.d.ts" + "import": "./dist/configs.mjs" }, "./test-utils": { "require": "./dist/test-utils.js", - "import": "./dist/test-utils.mjs", - "types": "./dist/test-utils.d.ts" + "import": "./dist/test-utils.mjs" } }, "typesVersions": { @@ -32,7 +28,7 @@ "./dist/configs.d.ts" ], "test-utils": [ - "./dist/test-utils/index.d.ts" + "./dist/test-utils.d.ts" ] } }, diff --git a/packages/account/tsup.config.dts.ts b/packages/account/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/account/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/address/package.json b/packages/address/package.json index 767893daaf5..1ece0fdf1fa 100644 --- a/packages/address/package.json +++ b/packages/address/package.json @@ -5,20 +5,17 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./configs": { "require": "./dist/configs.js", - "import": "./dist/configs.mjs", - "types": "./dist/configs.d.ts" + "import": "./dist/configs.mjs" } }, "typesVersions": { diff --git a/packages/address/tsup.config.dts.ts b/packages/address/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/address/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/contract/package.json b/packages/contract/package.json index 11665824f57..eedbe34f813 100644 --- a/packages/contract/package.json +++ b/packages/contract/package.json @@ -5,15 +5,13 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/packages/contract/tsup.config.dts.ts b/packages/contract/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/contract/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 09e2fe01c84..2fa1135f534 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -5,7 +5,6 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, @@ -15,8 +14,7 @@ "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/packages/crypto/tsup.config.dts.ts b/packages/crypto/tsup.config.dts.ts new file mode 100644 index 00000000000..407a1dd8450 --- /dev/null +++ b/packages/crypto/tsup.config.dts.ts @@ -0,0 +1,13 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import { keystoreOptions } from './tsup.config'; + +const configs: Options[] = keystoreOptions.map( + (config) => ({ + ...config, + ...tsupDtsDefaults, + }) +) + +export default configs; diff --git a/packages/errors/package.json b/packages/errors/package.json index 0fa085b9f84..34790548903 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -5,20 +5,17 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./test-utils": { "require": "./dist/test-utils.js", - "import": "./dist/test-utils.mjs", - "types": "./dist/test-utils.d.ts" + "import": "./dist/test-utils.mjs" } }, "typesVersions": { diff --git a/packages/errors/tsup.config.dts.ts b/packages/errors/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/errors/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/fuels/package.json b/packages/fuels/package.json index 9e6ae218256..101ff11e4a7 100644 --- a/packages/fuels/package.json +++ b/packages/fuels/package.json @@ -8,20 +8,17 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./cli": { "require": "./dist/cli.js", - "import": "./dist/cli.mjs", - "types": "./dist/cli.d.ts" + "import": "./dist/cli.mjs" } }, "typesVersions": { @@ -36,7 +33,7 @@ ], "scripts": { "build": "tsup && pnpm vite build", - "postbuild": "tsc --emitDeclarationOnly -p tsconfig.dts.json", + "postbuild": "tsx ../../scripts/postbuild.ts", "prepublishOnly": "cp ../../README.md ./README.md" }, "license": "Apache-2.0", diff --git a/packages/fuels/tsup.config.dts.ts b/packages/fuels/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/fuels/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/hasher/package.json b/packages/hasher/package.json index 41c5b7c4926..28abb41e1d2 100644 --- a/packages/hasher/package.json +++ b/packages/hasher/package.json @@ -5,15 +5,13 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/packages/hasher/tsup.config.dts.ts b/packages/hasher/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/hasher/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/interfaces/package.json b/packages/interfaces/package.json index bb56a0d98aa..fb0d00b2e5f 100644 --- a/packages/interfaces/package.json +++ b/packages/interfaces/package.json @@ -5,15 +5,13 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/packages/interfaces/tsup.config.dts.ts b/packages/interfaces/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/interfaces/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/math/package.json b/packages/math/package.json index 5d210ea06f6..78fdba37c89 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -5,20 +5,17 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./configs": { "require": "./dist/configs.js", - "import": "./dist/configs.mjs", - "types": "./dist/configs.d.ts" + "import": "./dist/configs.mjs" } }, "typesVersions": { diff --git a/packages/math/tsup.config.dts.ts b/packages/math/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/math/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/merkle/package.json b/packages/merkle/package.json index a0ab6228959..ebc3dde81d2 100644 --- a/packages/merkle/package.json +++ b/packages/merkle/package.json @@ -5,15 +5,13 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/packages/merkle/tsup.config.dts.ts b/packages/merkle/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/merkle/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/program/package.json b/packages/program/package.json index 602ba4c057f..e7b0bd18904 100644 --- a/packages/program/package.json +++ b/packages/program/package.json @@ -5,20 +5,17 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./configs": { "require": "./dist/configs.js", - "import": "./dist/configs.mjs", - "types": "./dist/configs.d.ts" + "import": "./dist/configs.mjs" } }, "typesVersions": { diff --git a/packages/program/tsup.config.dts.ts b/packages/program/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/program/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/script/package.json b/packages/script/package.json index 4db4560d535..a7bf9849ca2 100644 --- a/packages/script/package.json +++ b/packages/script/package.json @@ -5,15 +5,13 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" } }, "files": [ diff --git a/packages/script/tsup.config.dts.ts b/packages/script/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/script/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/transactions/package.json b/packages/transactions/package.json index 395652f616c..e06dfe20a83 100644 --- a/packages/transactions/package.json +++ b/packages/transactions/package.json @@ -5,20 +5,17 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./configs": { "require": "./dist/configs.js", - "import": "./dist/configs.mjs", - "types": "./dist/configs.d.ts" + "import": "./dist/configs.mjs" } }, "typesVersions": { diff --git a/packages/transactions/tsup.config.dts.ts b/packages/transactions/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/transactions/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/utils/package.json b/packages/utils/package.json index 25a973c81d2..96f41130681 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -5,25 +5,21 @@ "author": "Fuel Labs (https://fuel.network/)", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./test-utils": { "require": "./dist/test-utils.js", - "import": "./dist/test-utils.mjs", - "types": "./dist/test-utils.d.ts" + "import": "./dist/test-utils.mjs" }, "./cli-utils": { "require": "./dist/cli-utils.js", - "import": "./dist/cli-utils.mjs", - "types": "./dist/cli-utils.d.ts" + "import": "./dist/cli-utils.mjs" } }, "typesVersions": { diff --git a/packages/utils/tsup.config.dts.ts b/packages/utils/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/utils/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/packages/versions/package.json b/packages/versions/package.json index c7d2fe4018b..7a7be9cadc8 100644 --- a/packages/versions/package.json +++ b/packages/versions/package.json @@ -8,20 +8,17 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", - "types": "dist/index.d.ts", "engines": { "node": "^18.18.2 || ^20.0.0" }, "exports": { ".": { "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs" }, "./cli": { "require": "./dist/cli.js", - "import": "./dist/cli.mjs", - "types": "./dist/cli.d.ts" + "import": "./dist/cli.mjs" } }, "typesVersions": { diff --git a/packages/versions/tsup.config.dts.ts b/packages/versions/tsup.config.dts.ts new file mode 100644 index 00000000000..4f99fd09972 --- /dev/null +++ b/packages/versions/tsup.config.dts.ts @@ -0,0 +1,11 @@ +import { tsupDtsDefaults } from '@internal/tsup'; +import type { Options } from 'tsup'; + +import tsupPkg from './tsup.config'; + +const configs: Options = { + ...tsupPkg, + ...tsupDtsDefaults +}; + +export default configs; diff --git a/scripts/postbuild.ts b/scripts/postbuild.ts index ff4556d2779..0eeadd5bf35 100644 --- a/scripts/postbuild.ts +++ b/scripts/postbuild.ts @@ -1,40 +1,15 @@ import { execSync } from 'child_process'; import { error } from 'console'; -import { existsSync, readFileSync, writeFileSync } from 'fs'; -import { join } from 'path'; + +const dtsTsupConfigFile = 'tsup.config.dts.ts'; /** * 1) Emit Declaration Maps */ try { - if (existsSync(join(process.cwd(), 'tsconfig.dts.json'))) { - execSync('tsc --emitDeclarationOnly -p tsconfig.dts.json', { stdio: 'inherit' }); - } else if (existsSync(join(process.cwd(), 'tsconfig.json'))) { - execSync('tsc --emitDeclarationOnly -p tsconfig.json', { stdio: 'inherit' }); - } + execSync(`tsup --config ${dtsTsupConfigFile}`, { stdio: 'inherit' }); } catch (err) { error(err.toString()); process.exit(1); } -/** - * 2) Injects secondary entry-points in main DTS file - */ -const cwd = process.cwd(); - -const dtsPath = join(cwd, 'dist', 'index.d.ts'); -let dtsContents = readFileSync(dtsPath, 'utf-8'); - -const pkgPath = join(cwd, 'package.json'); -const pkgJson = JSON.parse(readFileSync(pkgPath, 'utf-8')); - -Object.keys(pkgJson.exports) - .filter((k) => k !== '.') - .forEach((k) => { - const line = `import '${k}.js';`; - if (dtsContents.indexOf(line) < 0) { - dtsContents = `${line}\n${dtsContents}`; - } - }); - -writeFileSync(dtsPath, dtsContents); From 1b26c468764f6dda443523a14b5a6875faffa7e7 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Wed, 20 Mar 2024 10:01:12 +0000 Subject: [PATCH 09/17] chore: removed postbuild.ts --- internal/tsup/package.json | 2 +- packages/abi-coder/package.json | 2 +- packages/abi-typegen/package.json | 2 +- packages/account/package.json | 2 +- packages/address/package.json | 2 +- packages/contract/package.json | 2 +- packages/crypto/package.json | 2 +- packages/errors/package.json | 2 +- packages/fuels/package.json | 2 +- packages/hasher/package.json | 2 +- packages/interfaces/package.json | 2 +- packages/math/package.json | 2 +- packages/merkle/package.json | 2 +- packages/program/package.json | 2 +- packages/script/package.json | 2 +- packages/transactions/package.json | 2 +- packages/utils/package.json | 2 +- packages/versions/package.json | 2 +- scripts/postbuild.ts | 15 --------------- 19 files changed, 18 insertions(+), 33 deletions(-) delete mode 100644 scripts/postbuild.ts diff --git a/internal/tsup/package.json b/internal/tsup/package.json index 2a1f6c24183..e310c168f92 100644 --- a/internal/tsup/package.json +++ b/internal/tsup/package.json @@ -16,7 +16,7 @@ "preinstall": "pnpm build", "build": "tsup", "build:watch": "tsup --watch", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0" } diff --git a/packages/abi-coder/package.json b/packages/abi-coder/package.json index 02b9c66f9eb..e04c604a9a7 100644 --- a/packages/abi-coder/package.json +++ b/packages/abi-coder/package.json @@ -21,7 +21,7 @@ "pretest": "pnpm build:forc", "build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release", "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/abi-typegen/package.json b/packages/abi-typegen/package.json index b2b4213afe3..a00c86a235c 100644 --- a/packages/abi-typegen/package.json +++ b/packages/abi-typegen/package.json @@ -42,7 +42,7 @@ "pretest": "pnpm build:forc", "build": "tsup", "build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/account/package.json b/packages/account/package.json index 517aa7ad658..28973672947 100644 --- a/packages/account/package.json +++ b/packages/account/package.json @@ -40,7 +40,7 @@ "prebuild": "pnpm build:operations", "build:schema": "get-graphql-schema http://localhost:4000/graphql > src/providers/fuel-core-schema.graphql && prettier --write src/providers/fuel-core-schema.graphql", "build:operations": "pnpm graphql-codegen", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/address/package.json b/packages/address/package.json index 1ece0fdf1fa..f4a301a6d7c 100644 --- a/packages/address/package.json +++ b/packages/address/package.json @@ -30,7 +30,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/contract/package.json b/packages/contract/package.json index eedbe34f813..6b5773f8434 100644 --- a/packages/contract/package.json +++ b/packages/contract/package.json @@ -19,7 +19,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 2fa1135f534..430bd5bdf63 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -22,7 +22,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/errors/package.json b/packages/errors/package.json index 34790548903..7e768662638 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -30,7 +30,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/fuels/package.json b/packages/fuels/package.json index 101ff11e4a7..51f9a1cee10 100644 --- a/packages/fuels/package.json +++ b/packages/fuels/package.json @@ -33,7 +33,7 @@ ], "scripts": { "build": "tsup && pnpm vite build", - "postbuild": "tsx ../../scripts/postbuild.ts", + "postbuild": "tsup --config tsup.config.dts.ts", "prepublishOnly": "cp ../../README.md ./README.md" }, "license": "Apache-2.0", diff --git a/packages/hasher/package.json b/packages/hasher/package.json index 28abb41e1d2..4f02172cc3d 100644 --- a/packages/hasher/package.json +++ b/packages/hasher/package.json @@ -19,7 +19,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/interfaces/package.json b/packages/interfaces/package.json index fb0d00b2e5f..4b08ecaba57 100644 --- a/packages/interfaces/package.json +++ b/packages/interfaces/package.json @@ -19,7 +19,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0" } diff --git a/packages/math/package.json b/packages/math/package.json index 78fdba37c89..05a1d836ecf 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -30,7 +30,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/merkle/package.json b/packages/merkle/package.json index ebc3dde81d2..d0b65dd442a 100644 --- a/packages/merkle/package.json +++ b/packages/merkle/package.json @@ -19,7 +19,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/program/package.json b/packages/program/package.json index e7b0bd18904..1805ff7f8c8 100644 --- a/packages/program/package.json +++ b/packages/program/package.json @@ -30,7 +30,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/script/package.json b/packages/script/package.json index a7bf9849ca2..7f7afbd5440 100644 --- a/packages/script/package.json +++ b/packages/script/package.json @@ -21,7 +21,7 @@ "pretest": "pnpm build:forc", "build": "tsup", "build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/transactions/package.json b/packages/transactions/package.json index e06dfe20a83..97ec06179d3 100644 --- a/packages/transactions/package.json +++ b/packages/transactions/package.json @@ -30,7 +30,7 @@ ], "scripts": { "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/utils/package.json b/packages/utils/package.json index 96f41130681..87f43f9c7e0 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -39,7 +39,7 @@ "pretest": "pnpm build:forc", "build": "tsup", "build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/packages/versions/package.json b/packages/versions/package.json index 7a7be9cadc8..a74343428f3 100644 --- a/packages/versions/package.json +++ b/packages/versions/package.json @@ -34,7 +34,7 @@ "scripts": { "prebuild": "tsx ./scripts/rewriteVersions.ts", "build": "tsup", - "postbuild": "tsx ../../scripts/postbuild.ts" + "postbuild": "tsup --config tsup.config.dts.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/scripts/postbuild.ts b/scripts/postbuild.ts deleted file mode 100644 index 0eeadd5bf35..00000000000 --- a/scripts/postbuild.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { execSync } from 'child_process'; -import { error } from 'console'; - -const dtsTsupConfigFile = 'tsup.config.dts.ts'; - -/** - * 1) Emit Declaration Maps - */ -try { - execSync(`tsup --config ${dtsTsupConfigFile}`, { stdio: 'inherit' }); -} catch (err) { - error(err.toString()); - process.exit(1); -} - From 938a3150d356eecce5b385a66886710d62b336e9 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Wed, 20 Mar 2024 11:47:44 +0000 Subject: [PATCH 10/17] feat: added verify-package-distro command --- package.json | 1 + scripts/verify-package-distro.ts | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 scripts/verify-package-distro.ts diff --git a/package.json b/package.json index a1c15365927..8c7f34c6379 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "lint:package-jsons": "tsx ./scripts/lint-package-jsons", "prettier:check": "prettier --check packages", "prettier:format": "prettier --write packages", + "verify:package-distro": "tsx ./scripts/verify-package-distro", "changeset:publish": "changeset publish --no-git-tag", "changeset:next": "tsx ./scripts/changeset-next", "changeset:version-with-docs": "tsx ./scripts/changeset-version-with-docs", diff --git a/scripts/verify-package-distro.ts b/scripts/verify-package-distro.ts new file mode 100644 index 00000000000..39910207dad --- /dev/null +++ b/scripts/verify-package-distro.ts @@ -0,0 +1,50 @@ +import { execSync } from 'child_process'; +import { log, error } from 'console'; +import { readFileSync } from 'fs'; +import { globSync } from 'glob'; +import { dirname, join } from 'path'; + +/** + * Requires `@arethetypeswrong/cli` installed globally + * + * ```console + * npm i -g @arethetypeswrong/cli + * ``` + */ +interface PackageJson { + name: string; + private: boolean; + exports: Record +} + +/** + * Get only the package's with exports + */ +const packagesWithExports = globSync(`{packages,apps}/*/package.json`) + .map((path) => { + const pkgJson = JSON.parse(readFileSync(path, 'utf-8')) as PackageJson; + return { ...pkgJson, path: dirname(path) }; + }) + .filter((json) => !json.private && json.exports) + +let errorCode = 0; + +/** + * 1). Verify that each package can be packed and types are correct + */ +packagesWithExports.forEach((pkg) => { + try { + const result = execSync(`attw ${pkg.path} --pack`); + log(result.toString()); + } catch (e) { + error(`Error | Package export types`); + error(pkg.path) + error(e); + errorCode = 1; + } +}) + +process.exit(errorCode); \ No newline at end of file From 08be472424482d3211400c77291d4025bf067de7 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Wed, 20 Mar 2024 14:35:48 +0000 Subject: [PATCH 11/17] feat: added distribution node runner --- scripts/verify-package-distro.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/verify-package-distro.ts b/scripts/verify-package-distro.ts index 39910207dad..9e874b29258 100644 --- a/scripts/verify-package-distro.ts +++ b/scripts/verify-package-distro.ts @@ -47,4 +47,26 @@ packagesWithExports.forEach((pkg) => { } }) +/** + * 2). Verify that each package can be packed and types are correct + */ +Object + .values(packagesWithExports) + .flatMap(pkg => Object + .values(pkg.exports) + .flatMap((e) => [e.require, e.import]) + .map((entrypoint) => join(pkg.path, entrypoint)) + ) + .forEach(entrypoint => { + try { + execSync(`node ${entrypoint}`) + log(entrypoint) + } catch (e) { + error(`Error | Package export types`); + error(entrypoint) + error(e.toString()); + errorCode = 1; + } + }) + process.exit(errorCode); \ No newline at end of file From fb553ab767b9ada18671c38585234fcfc554a712 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 25 Mar 2024 11:35:03 +0000 Subject: [PATCH 12/17] chore: linting --- packages/abi-coder/tsup.config.dts.ts | 2 +- packages/abi-typegen/tsup.config.dts.ts | 2 +- packages/account/tsup.config.dts.ts | 2 +- packages/address/tsup.config.dts.ts | 2 +- packages/contract/tsup.config.dts.ts | 2 +- packages/crypto/tsup.config.dts.ts | 10 ++++------ packages/errors/tsup.config.dts.ts | 2 +- packages/fuels/tsup.config.dts.ts | 2 +- packages/hasher/tsup.config.dts.ts | 2 +- packages/interfaces/tsup.config.dts.ts | 2 +- packages/math/tsup.config.dts.ts | 2 +- packages/merkle/tsup.config.dts.ts | 2 +- packages/program/tsup.config.dts.ts | 2 +- packages/script/tsup.config.dts.ts | 2 +- packages/transactions/tsup.config.dts.ts | 2 +- packages/utils/tsup.config.dts.ts | 2 +- packages/versions/tsup.config.dts.ts | 2 +- 17 files changed, 20 insertions(+), 22 deletions(-) diff --git a/packages/abi-coder/tsup.config.dts.ts b/packages/abi-coder/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/abi-coder/tsup.config.dts.ts +++ b/packages/abi-coder/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/abi-typegen/tsup.config.dts.ts b/packages/abi-typegen/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/abi-typegen/tsup.config.dts.ts +++ b/packages/abi-typegen/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/account/tsup.config.dts.ts b/packages/account/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/account/tsup.config.dts.ts +++ b/packages/account/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/address/tsup.config.dts.ts b/packages/address/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/address/tsup.config.dts.ts +++ b/packages/address/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/contract/tsup.config.dts.ts b/packages/contract/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/contract/tsup.config.dts.ts +++ b/packages/contract/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/crypto/tsup.config.dts.ts b/packages/crypto/tsup.config.dts.ts index 407a1dd8450..d33ce4112bd 100644 --- a/packages/crypto/tsup.config.dts.ts +++ b/packages/crypto/tsup.config.dts.ts @@ -3,11 +3,9 @@ import type { Options } from 'tsup'; import { keystoreOptions } from './tsup.config'; -const configs: Options[] = keystoreOptions.map( - (config) => ({ - ...config, - ...tsupDtsDefaults, - }) -) +const configs: Options[] = keystoreOptions.map((config) => ({ + ...config, + ...tsupDtsDefaults, +})); export default configs; diff --git a/packages/errors/tsup.config.dts.ts b/packages/errors/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/errors/tsup.config.dts.ts +++ b/packages/errors/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/fuels/tsup.config.dts.ts b/packages/fuels/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/fuels/tsup.config.dts.ts +++ b/packages/fuels/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/hasher/tsup.config.dts.ts b/packages/hasher/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/hasher/tsup.config.dts.ts +++ b/packages/hasher/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/interfaces/tsup.config.dts.ts b/packages/interfaces/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/interfaces/tsup.config.dts.ts +++ b/packages/interfaces/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/math/tsup.config.dts.ts b/packages/math/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/math/tsup.config.dts.ts +++ b/packages/math/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/merkle/tsup.config.dts.ts b/packages/merkle/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/merkle/tsup.config.dts.ts +++ b/packages/merkle/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/program/tsup.config.dts.ts b/packages/program/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/program/tsup.config.dts.ts +++ b/packages/program/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/script/tsup.config.dts.ts b/packages/script/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/script/tsup.config.dts.ts +++ b/packages/script/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/transactions/tsup.config.dts.ts b/packages/transactions/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/transactions/tsup.config.dts.ts +++ b/packages/transactions/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/utils/tsup.config.dts.ts b/packages/utils/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/utils/tsup.config.dts.ts +++ b/packages/utils/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; diff --git a/packages/versions/tsup.config.dts.ts b/packages/versions/tsup.config.dts.ts index 4f99fd09972..ee8fa8bdc9d 100644 --- a/packages/versions/tsup.config.dts.ts +++ b/packages/versions/tsup.config.dts.ts @@ -5,7 +5,7 @@ import tsupPkg from './tsup.config'; const configs: Options = { ...tsupPkg, - ...tsupDtsDefaults + ...tsupDtsDefaults, }; export default configs; From f803e1da4542c729b01ebca0ef8749688e68a0bf Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 25 Mar 2024 12:14:15 +0000 Subject: [PATCH 13/17] chore: synced the changeset with PR title --- .changeset/friendly-cherries-divide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/friendly-cherries-divide.md b/.changeset/friendly-cherries-divide.md index 2bd1ff54843..e6d2b4cc3ab 100644 --- a/.changeset/friendly-cherries-divide.md +++ b/.changeset/friendly-cherries-divide.md @@ -2,4 +2,4 @@ "@fuel-ts/abi-typegen": minor --- -Added correct ESM types exports for abi-typegen +fix: ESM module types From 666e19a69d33ab8a8c9180383e4aca7f03de4d3f Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Thu, 4 Apr 2024 20:14:47 +0100 Subject: [PATCH 14/17] chore: publish preview pls --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 9b48fc2352a..34ad25146b1 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - if: false + # if: false permissions: write-all steps: - name: Checkout From 1c80bb413e81f86408f2828b132a2e0fb76619bd Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 5 Apr 2024 15:58:48 +0100 Subject: [PATCH 15/17] chore: fixed lint rule "@typescript-eslint/require-await" --- packages/account/src/providers/provider.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account/src/providers/provider.test.ts b/packages/account/src/providers/provider.test.ts index ebb0d5c92ab..9d8cddc3f1f 100644 --- a/packages/account/src/providers/provider.test.ts +++ b/packages/account/src/providers/provider.test.ts @@ -1173,7 +1173,7 @@ describe('Provider', () => { test('custom fetch works with requestMiddleware', async () => { let requestHeaders: HeadersInit | undefined; await Provider.create(FUEL_NETWORK_URL, { - fetch: async (url, requestInit) => { + fetch: (url, requestInit): Promise => { requestHeaders = requestInit?.headers; return fetch(url, requestInit); }, @@ -1192,7 +1192,7 @@ describe('Provider', () => { test('custom fetch works with timeout', async () => { const timeout = 500; const provider = await Provider.create(FUEL_NETWORK_URL, { - fetch: async (url, requestInit) => fetch(url, requestInit), + fetch: (url, requestInit): Promise => fetch(url, requestInit), timeout, }); vi.spyOn(global, 'fetch').mockImplementationOnce((...args: unknown[]) => From c9d44a75c3ab8de4708adf757041b3ce3a66678e Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 5 Apr 2024 15:59:52 +0100 Subject: [PATCH 16/17] fix: issue with normalize not identifying the constructor --- packages/account/src/providers/utils/json.ts | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/account/src/providers/utils/json.ts b/packages/account/src/providers/utils/json.ts index 0dd2ee54df9..1c52f4a899f 100644 --- a/packages/account/src/providers/utils/json.ts +++ b/packages/account/src/providers/utils/json.ts @@ -1,5 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable no-param-reassign */ +import { Address } from '@fuel-ts/address'; +import { BN } from '@fuel-ts/math' import { hexlify } from '@fuel-ts/utils'; import { clone } from 'ramda'; @@ -10,21 +12,23 @@ import { clone } from 'ramda'; /** @hidden */ function normalize(object: any) { Object.keys(object).forEach((key) => { - switch (object[key]?.constructor.name) { - case 'Uint8Array': - object[key] = hexlify(object[key]); + const obj = object[key]; + + switch (true) { + case obj instanceof BN: + object[key] = obj.toHex(); break; - case 'Array': - object[key] = normalize(object[key]); + case obj instanceof Address: + object[key] = obj.toB256(); break; - case 'BN': - object[key] = object[key].toHex(); + case obj instanceof Uint8Array: + object[key] = hexlify(obj); break; - case 'Address': - object[key] = object[key].toB256(); + case Array.isArray(obj): + object[key] = normalize(obj); break; - case 'Object': - object[key] = normalize(object[key]); + case obj instanceof Object: + object[key] = normalize(obj); break; default: break; From a8fac0c8cfcaea910db38e46ebd34a1bc28f6700 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 5 Apr 2024 16:01:47 +0100 Subject: [PATCH 17/17] chore: lint --- packages/account/src/providers/utils/json.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account/src/providers/utils/json.ts b/packages/account/src/providers/utils/json.ts index 1c52f4a899f..cfa837fed11 100644 --- a/packages/account/src/providers/utils/json.ts +++ b/packages/account/src/providers/utils/json.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable no-param-reassign */ import { Address } from '@fuel-ts/address'; -import { BN } from '@fuel-ts/math' +import { BN } from '@fuel-ts/math'; import { hexlify } from '@fuel-ts/utils'; import { clone } from 'ramda';