Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dsn-parser): v1 #496

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: v1
  • Loading branch information
belgattitude committed Jul 28, 2023
commit 66988c9a77a29a80c1dee089855e2e1ae4350d4f
8 changes: 8 additions & 0 deletions .changeset/gentle-donuts-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@httpx/dsn-parser': major
---

Minimum requirement bumped to node16 / es2019 / chrome90

The dsn-parser package can be transpiled if you need support in older
browsers. See your framework documentation for how to do this (ie [nextjs](https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages)).
7 changes: 7 additions & 0 deletions .changeset/sixty-parents-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@httpx/dsn-parser': patch
---

Reduce total bundle size from 1.30kb to 1.13kb mingzip

dsn-parser tree-shakes well, 1.13kb is the size of the full import.
5 changes: 5 additions & 0 deletions .changeset/tiny-toes-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@httpx/dsn-parser': major
---

Fix esm/cjs exported types thanks to arethetypeswrong and publint
10 changes: 8 additions & 2 deletions packages/dsn-parser/.size-limit.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
module.exports = [
{
name: 'JS',
name: 'JS (ESM)',
path: ['dist/index.mjs'],
limit: '1.39KB',
limit: '1.20KB',
},
{
name: 'JS (CJS)',
path: ['dist/index.cjs'],
limit: '1.20KB',
},

];
39 changes: 24 additions & 15 deletions packages/dsn-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@
"not op_mini all",
"node 14.17"
],
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"browser": "./dist/index.mjs",
"default": "./dist/index.js"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs"
},
"default": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
}
},
"./package.json": "./package.json"
},
Expand All @@ -45,14 +51,16 @@
],
"scripts": {
"?build-release": "When https://github.com/atlassian/changesets/issues/432 has a solution we can remove this trick",
"build": "yarn clean && yarn tsup",
"build-release": "yarn build",
"build": "run clean && yarn run tsup",
"build-release": "run build",
"build-doc": "run-s build-typedoc",
"build-typedoc": "rimraf ./docs/api && typedoc --plugin typedoc-plugin-markdown --out ./docs/api",
"check-dist": "run-s check-dist-esm check-dist-cjs",
"check-dist-cjs": "es-check --not './dist/*.map.js' -v es2020 './dist/**/*.js'",
"check-dist-esm": "es-check --not './dist/*.map.js' -v es2020 --module './dist/**/*.mjs'",
"check-pub": "publint --strict",
"check-dist-cjs": "es-check --not './dist/*.map.js' -v es2019 './dist/**/*.cjs'",
"check-dist-esm": "es-check --not './dist/*.map.js' -v es2019 --module './dist/**/*.mjs'",
"check-pub": "run-p check-pub-publint check-pub-attw",
"check-pub-publint": "publint --strict",
"check-pub-attw": "attw --pack",
"check-size": "size-limit",
"clean": "rimraf ./dist ./build ./coverage ./_release",
"dev": "tsup --watch",
Expand All @@ -66,6 +74,7 @@
"ci-coverage-upload": "../../.github/scripts/download/codecov -F httpx-dsn-parser-unit --dir ./coverage"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.7.0",
"@belgattitude/eslint-config-bases": "1.39.0",
"@size-limit/file": "8.2.6",
"@types/jest": "29.5.3",
Expand All @@ -79,16 +88,16 @@
"publint": "0.1.16",
"rimraf": "5.0.1",
"size-limit": "8.2.6",
"tslib": "2.6.1",
"tslib": "2.6.0",
"tsup": "7.1.0",
"typedoc": "0.24.8",
"typedoc-plugin-markdown": "3.15.4",
"typedoc-plugin-markdown": "3.15.3",
"typescript": "5.1.6",
"vite": "4.4.7",
"vite-tsconfig-paths": "4.2.0",
"vitest": "0.33.0"
},
"engines": {
"node": "^14.13.1 || >=16"
"node": ">=16"
}
}
7 changes: 6 additions & 1 deletion packages/dsn-parser/tsup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ export default defineConfig((options) => {
clean: true,
dts: true,
format: ['esm', 'cjs'],
outExtension({ format, pkgType, options }) {
return {
js: `.${format === 'cjs' ? 'cjs' : 'mjs'}`,
};
},
platform: 'browser',
target: ['es2017', 'chrome70', 'edge18', 'firefox70', 'node14'],
target: ['es2019', 'chrome90', 'firefox90', 'node16'],
tsconfig: './tsconfig.build.json',
sourcemap: !options.watch,
minify: !options.watch,
Expand Down
Loading