Skip to content

Commit

Permalink
fix: rollup dts
Browse files Browse the repository at this point in the history
  • Loading branch information
zzmp committed May 5, 2022
1 parent d051eba commit c6b1eb7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist"
],
"type": "module",
"types": "dist/dts/index.d.ts",
"types": "dist/index.d.ts",
"main": "dist/cjs/index.cjs",
"module": "dist/index.js",
"exports": {
Expand All @@ -34,9 +34,9 @@
"i18n:compile": "yarn i18n:extract && lingui compile",
"i18n:pseudo": "lingui extract --locale pseudo && lingui compile",
"prepare": "yarn contracts:compile && yarn i18n:compile",
"prepublishOnly": "tsc && yarn build",
"prepublishOnly": "yarn build",
"start": "cosmos",
"build": "rollup --config --failAfterWarnings",
"build": "tsc && rollup --config --failAfterWarnings",
"release": "semantic-release",
"lint": "eslint .",
"test": "jest"
Expand Down Expand Up @@ -182,6 +182,7 @@
"react-test-renderer": "^18.0.0",
"redux": "^4.1.2",
"rollup": "^2.63.0",
"rollup-plugin-dts": "^4.2.1",
"rollup-plugin-multi-input": "^1.3.1",
"rollup-plugin-node-externals": "^3.1.2",
"rollup-plugin-scss": "^3.0.0",
Expand Down
11 changes: 10 additions & 1 deletion rollup.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const commonjs = require('@rollup/plugin-commonjs')
const json = require('@rollup/plugin-json')
const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve')
const replace = require('@rollup/plugin-replace')
const { default: dts } = require('rollup-plugin-dts')
const url = require('@rollup/plugin-url')
const svgr = require('@svgr/rollup')
const { default: multi } = require('rollup-plugin-multi-input')
Expand Down Expand Up @@ -89,6 +90,14 @@ const cjs = {
watch: false,
}

const types = {
input: 'dts/index.d.ts',
output: { file: 'dist/index.d.ts' },
external: (source) => source.endsWith('.scss'),
plugins: [dts({ compilerOptions: { baseUrl: 'dts' } })],
watch: false,
}

const locales = {
input: 'src/locales/*.js',
output: [
Expand Down Expand Up @@ -117,7 +126,7 @@ const assets = [
},
]

const config = [esm, cjs, locales]
const config = [esm, cjs, types, locales]
config.config = { ...esm, output: { ...esm.output, sourcemap: true } }
config.assets = assets
module.exports = config
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"allowSyntheticDefaultImports": true,
"baseUrl": "src",
"declaration": true,
"declarationDir": "dist/dts",
"declarationDir": "dts",
"downlevelIteration": true,
"emitDeclarationOnly": true,
"esModuleInterop": true,
Expand Down
18 changes: 17 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8653,6 +8653,13 @@ magic-string@^0.25.7:
dependencies:
sourcemap-codec "^1.4.4"

magic-string@^0.26.1:
version "0.26.1"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.1.tgz#ba9b651354fa9512474199acecf9c6dbe93f97fd"
integrity sha512-ndThHmvgtieXe8J/VGPjG+Apu7v7ItcD5mhEIvOscWjPF/ccOiLxHaSuCAS2G+3x4GKsAbT8u7zdyamupui8Tg==
dependencies:
sourcemap-codec "^1.4.8"

make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
Expand Down Expand Up @@ -10781,6 +10788,15 @@ rimraf@~2.4.0:
dependencies:
glob "^6.0.1"

rollup-plugin-dts@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-4.2.1.tgz#c17968a0f7c5ae70a9e0ab37e715f3ef63da01c7"
integrity sha512-eaxQZNUJ5iQcxNGlpJ1CUgG4OSVqWjDZ3nNSWBIoGrpcote2aNphSe1RJOaSYkb8dwn3o+rYm1vvld/5z3EGSQ==
dependencies:
magic-string "^0.26.1"
optionalDependencies:
"@babel/code-frame" "^7.16.7"

rollup-plugin-multi-input@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-multi-input/-/rollup-plugin-multi-input-1.3.1.tgz#07b903b618c005871fea1bd0c4efae7d1aac4fa1"
Expand Down Expand Up @@ -11220,7 +11236,7 @@ source-map@~0.8.0-beta.0:
dependencies:
whatwg-url "^7.0.0"

sourcemap-codec@^1.4.4:
sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8:
version "1.4.8"
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==
Expand Down

1 comment on commit c6b1eb7

@vercel
Copy link

@vercel vercel bot commented on c6b1eb7 May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

widgets – ./

widgets-seven-tau.vercel.app
widgets-uniswap.vercel.app
widgets-git-main-uniswap.vercel.app

Please sign in to comment.