diff --git a/.gitignore b/.gitignore index f1fa5b8..79786ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules generated -dist \ No newline at end of file +dist +.vscode \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb6e0e..a7dddc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## Next +## 0.0.2 (2025-11-20) + +- Improve support for quoted strings in the local portion of an email +- Export the `mailbox` function by default +- Return a discriminated union instead of a success object or array of error strings +- Automate generating the example code used in the README +- Add explicit license + ## 0.0.1 (2025-09-23) - Document how it's used and why there won't be many updates diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d0d0295 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Spencer Van Wessem Scorcelletti + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 2c0a414..50bdd29 100644 --- a/README.md +++ b/README.md @@ -11,67 +11,151 @@ Also: ⚠️ THIS LIBRARY IS NOT ABANDONED ⚠️ -While there are few commits and not much activity, sometimes things are just done and work. +At some point in the future it may seem like this project is abandoned, but it's not. While there _may_ be few commits or not much activity, the code from this project is almost entirely derived from the email [rfc](https://www.rfc-editor.org/rfc/rfc5322#section-3.4) spec, and it therefore benefits from all the very mature work that has gone into those efforts. Examples: ```ts -import { mailbox } from './src' - -/** - * { local: 'bob', domain: 'example.com' } - */ -mailbox('bob@example.com') - -/** - * { name: undefined, local: 'bob', domain: 'example.com', addr: 'bob@example.com' } - */ -mailbox('') - -/** - { - name: 'Bruce Springsteen', - local: 'bruce', - domain: 'springsteen.com', - addr: 'bruce@springsteen.com' - } - */ -mailbox('Bruce Springsteen ') - - -/** - { - name: 'Bruce "The Boss" Springsteen', - local: 'bruce', - domain: 'springsteen.com', - addr: 'bruce@springsteen.com' - } - */ -mailbox('Bruce "The Boss" Springsteen ') +import mailbox from 'typescript-mailbox-parser' + +// { +// "ok": true, +// "local": "bob", +// "domain": "example.com", +// "addr": "bob@example.com" +// } +console.log(mailbox('')) + +// { +// "ok": true, +// "name": "Bob Hope", +// "local": "bob", +// "domain": "example.com", +// "addr": "bob@example.com" +// } +console.log(mailbox('Bob Hope ')) + +// { +// "ok": true, +// "name": "Bob Hope", +// "local": "bob", +// "domain": "example.com", +// "addr": "bob@example.com" +// } +console.log(mailbox('"Bob Hope" ')) + +// { +// "ok": true, +// "name": "Bruce \"The Boss\" Springsteen", +// "local": "bruce", +// "domain": "example.com", +// "addr": "bruce@example.com" +// } +console.log(mailbox('Bruce "The Boss" Springsteen ')) + +// { +// "ok": true, +// "local": "bob", +// "domain": "example", +// "addr": "bob@example" +// } +console.log(mailbox('bob@example')) + +// { +// "ok": true, +// "local": "BOB", +// "domain": "example", +// "addr": "BOB@example" +// } +console.log(mailbox('BOB@example')) + +// { +// "ok": true, +// "local": "bob", +// "domain": "EXAMPLE", +// "addr": "bob@EXAMPLE" +// } +console.log(mailbox('bob@EXAMPLE')) + +// { +// "ok": true, +// "local": "a.b.c", +// "domain": "d.e.f.g", +// "addr": "a.b.c@d.e.f.g" +// } +console.log(mailbox('a.b.c@d.e.f.g')) + +// { +// "ok": true, +// "local": "\"site.local.test:1111\"", +// "domain": "example.com", +// "addr": "\"site.local.test:1111\"@example.com" +// } +console.log(mailbox('"site.local.test:1111"@example.com')) + +// { +// "ok": true, +// "local": "\"hello, world\"", +// "domain": "example.com", +// "addr": "\"hello, world\"@example.com" +// } +console.log(mailbox('"hello, world"@example.com')) + +// { +// "ok": false, +// "errors": [ +// "{\"pos\":{\"overallPos\":11,\"line\":1,\"offset\":11},\"expmatches\":[{\"kind\":\"RegexMatch\",\"literal\":\"[A-Za-z0-9!#$%&\\\\x27\\\\*\\\\+\\\\-\\\\/=?^_\\\\`{|}~]\",\"negated\":false},{\"kind\":\"RegexMatch\",\"literal\":\"\\\\x20\",\"negated\":false},{\"kind\":\"RegexMatch\",\"literal\":\"\\\\x09\",\"negated\":false},{\"kind\":\"RegexMatch\",\"literal\":\"\\\\r\\\\n\",\"negated\":false},{\"kind\":\"RegexMatch\",\"literal\":\"\\\\(\",\"negated\":false},{\"kind\":\"RegexMatch\",\"literal\":\"\\\\x22\",\"negated\":false},{\"kind\":\"RegexMatch\",\"literal\":\"<\",\"negated\":false}]}" +// ] +// } +console.log(mailbox('foo bar baz')) ``` ## Installation and Usage To install `npm install typescript-mailbox-parser` -Then to use it you just need to import it and call the `mailbox` function on a string. If successful it will return an object representing the parts of the email address (mailbox). +Then to use it you just need to import it and call the `mailbox` function on a string. ```ts -import { mailbox } from 'typescript-mailbox-parser' +import mailbox from 'typescript-mailbox-parser' const email = mailbox('hello@example.com') ``` -If the string supplied is not a valid email address (mailbox), then it will return an array of error strings. +It returns the following type ```ts -import { mailbox } from 'typescript-mailbox-parser' +type MailboxParseResult = + | { ok: false; errors: string[] } + | { ok: true; addr: string; name?: string; local: string; domain: string } +``` + +In other words, if successful it will return an object representing the parts of the email address (mailbox): + +```ts +import mailbox from 'typescript-mailbox-parser' + +// { +// ok: true, +// name: 'Bruce "The Boss" Springsteen', +// local: 'bruce', +// domain: 'example.com', +// addr: 'bruce@example.com' +// } +console.log(mailbox('Bruce "The Boss" Springsteen ')) +``` + +If unsuccessful it will return an object with an `errors` field containing an array of error messages as strings: -/** - [ - '{"pos":{"overallPos":11,"line":1,"offset":11},"expmatches":[{"kind":"RegexMatch","literal":"[A-Za-z0-9!#$%&\\\\x27\\\\*\\\\+\\\\-\\\\/=?^_\\\\`{|}~]","negated":false},{"kind":"RegexMatch","literal":"\\\\x20","negated":false},{"kind":"RegexMatch","literal":"\\\\x09","negated":false},{"kind":"RegexMatch","literal":"\\\\r\\\\n","negated":false},{"kind":"RegexMatch","literal":"\\\\(","negated":false},{"kind":"RegexMatch","literal":"\\\\x22","negated":false},{"kind":"RegexMatch","literal":"<","negated":false}]}' - ] - */ +```ts +import mailbox from 'typescript-mailbox-parser' + +// { +// ok: false, +// errors: [ +// '{"pos":{"overallPos":11,"line":1,"offset":11},"expmatches":[{"kind":"RegexMatch","literal":"[A-Za-z0-9!#$%&\\\\x27\\\\*\\\\+\\\\-\\\\/=?^_\\\\`{|}~]","negated":false},{"kind":"RegexMatch","literal":"\\\\x20","negated":false},{"kind":"RegexMatch","literal":"\\\\x09","negated":false},{"kind":"RegexMatch","literal":"\\\\r\\\\n","negated":false},{"kind":"RegexMatch","literal":"\\\\(","negated":false},{"kind":"RegexMatch","literal":"\\\\x22","negated":false},{"kind":"RegexMatch","literal":"<","negated":false}]}' +// ] +// } const email = mailbox('foo bar baz') ``` @@ -79,7 +163,7 @@ For development ```sh # run tests -npm run test +npm test # build the parser from the grammar npm run build:parser @@ -90,10 +174,13 @@ npm run build:compile # combine build:parser and build:compile npm run build:all +# generate the examples used in the README +npm run docs:examples + # run formatter npm run fmt ``` ## Notes -This _should_ in theory work with 100% accuracy, as the logic is based off the [rfc5322](https://www.rfc-editor.org/rfc/rfc5322) specification... however mistakes can always be made. Please file an issue if there are any bugs. \ No newline at end of file +This _should_ in theory work with 100% accuracy, as the logic is based off the [rfc5322](https://www.rfc-editor.org/rfc/rfc5322) specification. Please file an issue if there are any bugs. \ No newline at end of file diff --git a/example.ts b/example.ts deleted file mode 100644 index 6c0d9db..0000000 --- a/example.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { mailbox } from './src' - -/** - * { local: 'bob', domain: 'example.com', addr: 'bob@example.com' } - */ -console.log(mailbox('bob@example.com')) - -/** - { - name: undefined, - local: 'bob', - domain: 'example.com', - addr: 'bob@example.com' - } - */ -console.log(mailbox('')) - -/** - { - name: 'Bruce Springsteen', - local: 'bruce', - domain: 'springsteen.com', - addr: 'bruce@springsteen.com' - } - */ -console.log(mailbox('Bruce Springsteen ')) - -/** - { - name: 'Bruce "The Boss" Springsteen', - local: 'bruce', - domain: 'springsteen.com', - addr: 'bruce@springsteen.com' - } - */ -console.log(mailbox('Bruce "The Boss" Springsteen ')) - -/** - [ - '{"pos":{"overallPos":11,"line":1,"offset":11},"expmatches":[{"kind":"RegexMatch","literal":"[A-Za-z0-9!#$%&\\\\x27\\\\*\\\\+\\\\-\\\\/=?^_\\\\`{|}~]","negated":false},{"kind":"RegexMatch","literal":"\\\\x20","negated":false},{"kind":"RegexMatch","literal":"\\\\x09","negated":false},{"kind":"RegexMatch","literal":"\\\\r\\\\n","negated":false},{"kind":"RegexMatch","literal":"\\\\(","negated":false},{"kind":"RegexMatch","literal":"\\\\x22","negated":false},{"kind":"RegexMatch","literal":"<","negated":false}]}' - ] - */ -console.log(mailbox('foo bar baz')) diff --git a/examples.ts b/examples.ts new file mode 100644 index 0000000..2e27167 --- /dev/null +++ b/examples.ts @@ -0,0 +1,31 @@ +import mailbox from './dist' +import vm from 'node:vm' + +const sandbox = { mailbox, console } +vm.createContext(sandbox) + +const examples = [ + `mailbox('')`, + `mailbox('Bob Hope ')`, + `mailbox('"Bob Hope" ')`, + `mailbox('Bruce "The Boss" Springsteen ')`, + `mailbox('bob@example')`, + `mailbox('BOB@example')`, + `mailbox('bob@EXAMPLE')`, + `mailbox('a.b.c@d.e.f.g')`, + `mailbox('"site.local.test:1111"@example.com')`, + `mailbox('"hello, world"@example.com')`, + `mailbox('foo bar baz')`, +] + +for (const e of examples) { + const result = vm.runInContext(e, sandbox) + // Print the result as a commented block + const commented = JSON.stringify(result, null, 2) + .split('\n') + .map((line) => `// ${line}`) + .join('\n') + + console.log(commented) + console.log(`console.log(${e})\n`) +} diff --git a/package-lock.json b/package-lock.json index a69c1f2..e8b6cb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "devDependencies": { "@esbuild/darwin-arm64": "^0.25.10", + "@types/node": "^24.10.1", "prettier": "^3.6.2", "tspeg": "^3.3.2", "tsup": "^8.5.0", @@ -787,6 +788,16 @@ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, "node_modules/acorn": { "version": "8.15.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", @@ -1976,6 +1987,13 @@ "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", "dev": true }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, "node_modules/webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", @@ -2572,6 +2590,15 @@ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true }, + "@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "requires": { + "undici-types": "~7.16.0" + } + }, "acorn": { "version": "8.15.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", @@ -3382,6 +3409,12 @@ "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", "dev": true }, + "undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true + }, "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", diff --git a/package.json b/package.json index 429135b..ae84e5a 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,21 @@ { "name": "typescript-mailbox-parser", - "version": "0.0.1", + "version": "0.0.2", "description": "Reliably get the display name, local, and domain parts of an email address", "main": "dist/index.js", "module": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist", - "README.md" + "README.md", + "LICENSE" ], "scripts": { "test": "npx tsx test/tests.ts", + "docs:examples": "npx tsx examples.ts", "fmt": "prettier --write \"**/*.{json,ts}\"", "build:parser": "npx tspeg mailbox-computed.peg generated/parser.ts", - "build:compile": "npx tsup src/index.ts --dts --clean --format esm,cjs", + "build:compile": "npx tsup", "build:all": "npx npm run build:parser && npx npm run build:compile" }, "keywords": [ @@ -31,16 +33,15 @@ "typescript", "ts" ], - "author": "", + "author": "Spencer Van Wessem Scorcelletti", "license": "MIT", - "packageManager": "pnpm@10.6.2", "devDependencies": { "@esbuild/darwin-arm64": "^0.25.10", + "@types/node": "^24.10.1", "prettier": "^3.6.2", "tspeg": "^3.3.2", "tsup": "^8.5.0", "tsx": "^4.20.5", - "typescript": "^5.9.2", - "typescript-mailbox-parser": "file:typescript-mailbox-parser-0.0.1.tgz" + "typescript": "^5.9.2" } } diff --git a/src/index.ts b/src/index.ts index 0ffcee0..4b72dbd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,14 +24,18 @@ import { word, } from '../generated/parser' -export function mailbox( - mb: string, -): string[] | { addr: string; name?: string; local: string; domain: string } { +export type MailboxParseResult = + | { ok: false; errors: string[] } + | { ok: true; addr: string; name?: string; local: string; domain: string } + +export default function mailbox(mb: string): MailboxParseResult { const mailbox = parse(mb) - if (mailbox.errs.length > 0) return mailbox.errs.map((e) => JSON.stringify(e)) + if (mailbox.errs.length > 0) + return { ok: false, errors: mailbox.errs.map((e) => JSON.stringify(e)) } else { const parts = mailbox_2_parts(mailbox.ast!) return { + ok: true, ...parts, addr: `${parts.local}@${parts.domain}`, } @@ -91,7 +95,7 @@ function local_part_2_str(input: local_part): string { if (input.kind == ASTKinds.dot_atom) { return dot_atom_2_str(input) } else if (input.kind == ASTKinds.quoted_string) { - return input.chars.join('') + return quoted_string_2_str(input, true) } else if (input.kind == ASTKinds.obs_local_part) { return obs_local_part_2_str(input) } else { diff --git a/test/tests.ts b/test/tests.ts index bcd7bb1..218175d 100644 --- a/test/tests.ts +++ b/test/tests.ts @@ -1,4 +1,4 @@ -import { mailbox } from 'typescript-mailbox-parser' +import mailbox from '../dist' /** These tests should cover most of what's important. However, they don't cover the 'obsolete' parts of the spec. One day more testing should be done to target that directly. It's not a big concern though because the obsolete part of the spec only applies to emails from the punchcard days. @@ -29,19 +29,19 @@ function deepEqual(a: any, b: any): boolean { return true } -type Pass = Exclude, string[]> +type Pass = Exclude, { errors: string[] }> type Fail = Exclude, Pass> -function test_pos({ +function test({ actual, expect, label, }: { - actual: Fail | Pass - expect: Pass + actual: Pass | Fail + expect: Pass | Fail label: string }) { - if (Array.isArray(actual)) { + if (actual.ok !== expect.ok) { throw new Error( `Test failed, errors: \n\n${JSON.stringify(actual, null, 2)}`, ) @@ -58,21 +58,32 @@ function test_pos({ if (label) console.log(`'${label}' passed`) } -test_pos({ +test({ actual: mailbox('bob@example.com'), - expect: { addr: 'bob@example.com', local: 'bob', domain: 'example.com' }, + expect: { + ok: true, + addr: 'bob@example.com', + local: 'bob', + domain: 'example.com', + }, label: 'bob@example.com', }) -test_pos({ +test({ actual: mailbox(''), - expect: { addr: 'bob@example.com', local: 'bob', domain: 'example.com' }, + expect: { + ok: true, + addr: 'bob@example.com', + local: 'bob', + domain: 'example.com', + }, label: '', }) -test_pos({ +test({ actual: mailbox('Bob Hope '), expect: { + ok: true, addr: 'bob@example.com', local: 'bob', domain: 'example.com', @@ -81,9 +92,10 @@ test_pos({ label: 'Bob Hope ', }) -test_pos({ +test({ actual: mailbox('"Bob Hope" '), expect: { + ok: true, addr: 'bob@example.com', local: 'bob', domain: 'example.com', @@ -92,9 +104,10 @@ test_pos({ label: '"Bob Hope" ', }) -test_pos({ +test({ actual: mailbox('Bruce "The Boss" Springsteen '), expect: { + ok: true, addr: 'bruce@example.com', local: 'bruce', domain: 'example.com', @@ -103,26 +116,67 @@ test_pos({ label: 'Bruce "The Boss" Springsteen ', }) -test_pos({ +console.log(mailbox('Bruce "The Boss" Springsteen ')) + +test({ actual: mailbox('bob@example'), - expect: { addr: 'bob@example', local: 'bob', domain: 'example' }, + expect: { ok: true, addr: 'bob@example', local: 'bob', domain: 'example' }, label: 'bob@example', }) -test_pos({ +test({ actual: mailbox('BOB@example'), - expect: { addr: 'BOB@example', local: 'BOB', domain: 'example' }, + expect: { ok: true, addr: 'BOB@example', local: 'BOB', domain: 'example' }, label: 'BOB@example', }) -test_pos({ +test({ actual: mailbox('bob@EXAMPLE'), - expect: { addr: 'bob@EXAMPLE', local: 'bob', domain: 'EXAMPLE' }, + expect: { ok: true, addr: 'bob@EXAMPLE', local: 'bob', domain: 'EXAMPLE' }, label: 'bob@EXAMPLE', }) -test_pos({ +test({ actual: mailbox('a.b.c@d.e.f.g'), - expect: { addr: 'a.b.c@d.e.f.g', local: 'a.b.c', domain: 'd.e.f.g' }, + expect: { + ok: true, + addr: 'a.b.c@d.e.f.g', + local: 'a.b.c', + domain: 'd.e.f.g', + }, label: 'a.b.c@d.e.f.g', }) + +test({ + actual: mailbox('"site.local.test:1111"@example.com'), + expect: { + ok: true, + addr: '"site.local.test:1111"@example.com', + local: '"site.local.test:1111"', + domain: 'example.com', + }, + label: 'quoted with illegal characters', +}) + +test({ + actual: mailbox('"hello, world"@example.com'), + expect: { + ok: true, + addr: '"hello, world"@example.com', + local: '"hello, world"', + domain: 'example.com', + }, + label: 'quoted with illegal characters 2', +}) + +test({ + actual: mailbox('foo bar baz'), + expect: { + ok: false, + errors: [ + '{"pos":{"overallPos":11,"line":1,"offset":11},"expmatches":[{"kind":"RegexMatch","literal":"[A-Za-z0-9!#$%&\\\\x27\\\\*\\\\+\\\\-\\\\/=?^_\\\\`{|}~]","negated":false},{"kind":"RegexMatch","literal":"\\\\x20","negated":false},{"kind":"RegexMatch","literal":"\\\\x09","negated":false},{"kind":"RegexMatch","literal":"\\\\r\\\\n","negated":false},{"kind":"RegexMatch","literal":"\\\\(","negated":false},{"kind":"RegexMatch","literal":"\\\\x22","negated":false},{"kind":"RegexMatch","literal":"<","negated":false}]}', + ], + }, + label: 'Invalid mailbox should fail to parse', +}) +console.log(mailbox('foo bar baz')) diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..811d1aa --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'tsup' + +export default defineConfig({ + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + dts: true, + clean: true, + banner: { + js: '/*! typescript-mailbox-parser | MIT License | (c) 2025 Spencer Van Wessem Scorcelletti */', + }, +}) diff --git a/typescript-mailbox-parser-0.0.1.tgz b/typescript-mailbox-parser-0.0.1.tgz deleted file mode 100644 index 32470bc..0000000 Binary files a/typescript-mailbox-parser-0.0.1.tgz and /dev/null differ