diff --git a/.github/workflows/ci-test-win.yml b/.github/workflows/ci-test-win.yml deleted file mode 100644 index b474422..0000000 --- a/.github/workflows/ci-test-win.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Plugin Tests - Windows - -on: [ push, pull_request ] - -jobs: - - ci-test-win: - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ windows-latest ] - node-version: [12.x, 14.x] - fail-fast: false - - steps: - - uses: actions/checkout@v2 - name: Checkout Plugin - with: - fetch-depth: 1 - - - uses: actions/setup-node@v1 - name: Use Node.js ${{ matrix.node-version }} - with: - node-version: ${{ matrix.node-version }} - - - name: npm install and test - run: | - npm install - npm run test - - env: - CI: true diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml deleted file mode 100644 index 3ab1c58..0000000 --- a/.github/workflows/ci-test.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Plugin Tests - -on: [ push, pull_request ] - -jobs: - - ci-test: - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ ubuntu-latest ] - node-version: [10.x, 12.x, 14.x] - fail-fast: false - - steps: - - uses: actions/checkout@v2 - name: Checkout Plugin - with: - fetch-depth: 1 - - - uses: actions/setup-node@v1 - name: Use Node.js ${{ matrix.node-version }} - with: - node-version: ${{ matrix.node-version }} - - - name: npm install - run: npm install - - - name: Run test suite - run: npm run test - - env: - CI: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..36a57de --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: [ push ] + +env: + CI: true + +jobs: + + lint: + uses: haraka/.github/.github/workflows/lint.yml@master + + test: + needs: [ lint, get-lts ] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + node-version: ${{ fromJson(needs.get-lts.outputs.active) }} + fail-fast: false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + name: Node ${{ matrix.node-version }} on ${{ matrix.os }} + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + + get-lts: + runs-on: ubuntu-latest + steps: + - id: get + uses: msimerson/node-lts-versions@v1 + outputs: + active: ${{ steps.get.outputs.active }} + lts: ${{ steps.get.outputs.lts }} + min: ${{ steps.get.outputs.min }} \ No newline at end of file diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..3627451 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,14 @@ +name: CodeQL + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '18 7 * * 4' + +jobs: + codeql: + uses: haraka/.github/.github/workflows/codeql.yml@master diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index c7f4f63..782bfef 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -10,15 +10,15 @@ jobs: steps: - - uses: actions/checkout@master + - uses: actions/checkout@v3 name: Checkout Plugin with: fetch-depth: 1 - - name: Use Node.js 12 + - name: Use Node.js 14 uses: actions/setup-node@master with: - node-version: 12.x + node-version: 14 - name: install, run run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 8bbc18f..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Lint - -on: [ push, pull_request ] - -jobs: - - lint: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [ 12.x ] - - steps: - - uses: actions/checkout@v2 - name: Checkout Plugin - with: - fetch-depth: 1 - - - uses: actions/setup-node@v1 - name: Use Node.js ${{ matrix.node-version }} - with: - node-version: ${{ matrix.node-version }} - - - name: npm install - run: npm install - - - name: Lint using eslint - run: npm run lint - - env: - CI: true \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e81c15f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,16 @@ +name: publish + +on: + push: + branches: + - master + paths: + - package.json + +env: + CI: true + +jobs: + publish: + uses: haraka/.github/.github/workflows/publish.yml@master + secrets: inherit diff --git a/.gitignore b/.gitignore index 2111e60..fa16d4b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,5 +29,3 @@ node_modules package-lock.json -# Generated from grammar.ne -grammar.js \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a8e94cb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".release"] + path = .release + url = git@github.com:msimerson/.release.git diff --git a/.npmignore b/.npmignore index a530f47..307d8d3 100644 --- a/.npmignore +++ b/.npmignore @@ -11,5 +11,4 @@ build/Release node_modules .lock-wscript package-lock.json -grammar.js .eslintrc.yaml diff --git a/.release b/.release new file mode 160000 index 0000000..0890e94 --- /dev/null +++ b/.release @@ -0,0 +1 @@ +Subproject commit 0890e945e4e061c96c7b2ab45017525904c17728 diff --git a/Changes.md b/Changes.md index 9d13569..546becc 100644 --- a/Changes.md +++ b/Changes.md @@ -65,3 +65,4 @@ ### 1.0.0 - 2016-12-08 - replaced null host or user values with empty strings +[2.1.0]: https://github.com/haraka/node-address-rfc2821/releases/tag/2.1.0 diff --git a/README.md b/README.md index 9249afe..b5ddd39 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ [![Build Status][ci-img]][ci-url] -[![WinCI status][win-ci-img]][win-ci-url] -[![Dependencies][dep-img]][dep-url] [![Coverage Status][cov-img]][cov-url] @@ -8,8 +6,7 @@ Parser for RFC-821/RFC-2821/RFC-5321 (envelope) format email addresses (Mailbox and Path). -This module parses email addresses from the SMTP envelope. These are the -portions immediately following the SMTP verbs `MAIL FROM:` and `RCPT TO:`. RFC-5321 email addesses look like this: +This module parses email addresses from the SMTP envelope. These are the portions immediately following the SMTP verbs `MAIL FROM:` and `RCPT TO:`. RFC-5321 email addesses look like this: ```` <> // null @@ -91,11 +88,7 @@ License This module is MIT licensed. -[ci-img]: https://github.com/haraka/node-address-rfc2821/workflows/Test%20Coverage/badge.svg -[ci-url]: https://github.com/haraka/node-address-rfc2821/actions?query=workflow%3A%22Test+Coverage%22 -[dep-img]: https://david-dm.org/haraka/node-address-rfc2821.svg -[dep-url]: https://david-dm.org/haraka/node-address-rfc2821 +[ci-img]: https://github.com/haraka/node-address-rfc2821/actions/workflows/ci.yml/badge.svg +[ci-url]: https://github.com/haraka/node-address-rfc2821/actions/workflows/ci.yml [cov-img]: https://codecov.io/github/haraka/node-address-rfc2821/coverage.svg?branch=master [cov-url]: https://codecov.io/github/haraka/node-address-rfc2821?branch=master -[win-ci-img]: https://github.com/haraka/node-address-rfc2821/workflows/Plugin%20Tests%20-%20Windows/badge.svg -[win-ci-url]: https://github.com/haraka/node-address-rfc2821/actions?query=workflow%3A%22Plugin+Tests+-+Windows%22 diff --git a/grammar.js b/grammar.js new file mode 100644 index 0000000..1fbb8f4 --- /dev/null +++ b/grammar.js @@ -0,0 +1,172 @@ +// Generated automatically by nearley, version 2.20.1 +// http://github.com/Hardmath123/nearley +(function () { +function id(x) { return x[0]; } + +// from https://github.com/jonathantneal/array-flat-polyfill +if (!Array.prototype.flat) { + Object.defineProperty(Array.prototype, 'flat', { + configurable: true, + value: function flat () { + var depth = isNaN(arguments[0]) ? 1 : Number(arguments[0]); + + return depth ? Array.prototype.reduce.call(this, function (acc, cur) { + if (Array.isArray(cur)) { + acc.push.apply(acc, flat.call(cur, depth - 1)); + } else { + acc.push(cur); + } + + return acc; + }, []) : Array.prototype.slice.call(this); + }, + writable: true + }); +} + +function flat_string(d) { + if (d) { + if (Array.isArray(d)) + return d.flat(Infinity).join(""); + return d; + } + return ""; +} +var grammar = { + Lexer: undefined, + ParserRules: [ + {"name": "main", "symbols": ["Mailbox"]}, + {"name": "main", "symbols": ["Path"]}, + {"name": "Reverse_path", "symbols": ["Path"]}, + {"name": "Reverse_path$string$1", "symbols": [{"literal":"<"}, {"literal":">"}], "postprocess": function joiner(d) {return d.join('');}}, + {"name": "Reverse_path", "symbols": ["Reverse_path$string$1"]}, + {"name": "Forward_path", "symbols": ["Path"]}, + {"name": "Path$ebnf$1$subexpression$1", "symbols": ["A_d_l", {"literal":":"}]}, + {"name": "Path$ebnf$1", "symbols": ["Path$ebnf$1$subexpression$1"], "postprocess": id}, + {"name": "Path$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, + {"name": "Path", "symbols": [{"literal":"<"}, "Path$ebnf$1", "Mailbox", {"literal":">"}], "postprocess": function(d) { return d[2]; }}, + {"name": "A_d_l$ebnf$1", "symbols": []}, + {"name": "A_d_l$ebnf$1$subexpression$1", "symbols": [{"literal":","}, "At_domain"]}, + {"name": "A_d_l$ebnf$1", "symbols": ["A_d_l$ebnf$1", "A_d_l$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "A_d_l", "symbols": ["At_domain", "A_d_l$ebnf$1"]}, + {"name": "At_domain", "symbols": [{"literal":"@"}, "Domain"]}, + {"name": "Domain$ebnf$1", "symbols": []}, + {"name": "Domain$ebnf$1$subexpression$1", "symbols": [{"literal":"."}, "sub_domain"]}, + {"name": "Domain$ebnf$1", "symbols": ["Domain$ebnf$1", "Domain$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "Domain", "symbols": ["sub_domain", "Domain$ebnf$1"]}, + {"name": "sub_domain", "symbols": ["U_label"]}, + {"name": "Let_dig", "symbols": ["ALPHA_DIGIT"], "postprocess": id}, + {"name": "Ldh_str$ebnf$1", "symbols": []}, + {"name": "Ldh_str$ebnf$1", "symbols": ["Ldh_str$ebnf$1", "ALPHA_DIG_DASH"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "Ldh_str", "symbols": ["Ldh_str$ebnf$1", "Let_dig"]}, + {"name": "U_Let_dig", "symbols": ["ALPHA_DIGIT_U"], "postprocess": id}, + {"name": "U_Ldh_str$ebnf$1", "symbols": []}, + {"name": "U_Ldh_str$ebnf$1", "symbols": ["U_Ldh_str$ebnf$1", "ALPHA_DIG_DASH_U"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "U_Ldh_str", "symbols": ["U_Ldh_str$ebnf$1", "U_Let_dig"]}, + {"name": "U_label$ebnf$1$subexpression$1", "symbols": ["U_Ldh_str"]}, + {"name": "U_label$ebnf$1", "symbols": ["U_label$ebnf$1$subexpression$1"], "postprocess": id}, + {"name": "U_label$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, + {"name": "U_label", "symbols": ["U_Let_dig", "U_label$ebnf$1"]}, + {"name": "address_literal$subexpression$1", "symbols": ["IPv4_address_literal"]}, + {"name": "address_literal$subexpression$1", "symbols": ["IPv6_address_literal"]}, + {"name": "address_literal$subexpression$1", "symbols": ["General_address_literal"]}, + {"name": "address_literal", "symbols": [{"literal":"["}, "address_literal$subexpression$1", {"literal":"]"}]}, + {"name": "non_local_part", "symbols": ["Domain"]}, + {"name": "non_local_part", "symbols": ["address_literal"]}, + {"name": "Mailbox", "symbols": ["Local_part", {"literal":"@"}, "non_local_part"], "postprocess": + function(d) { + return { local_part: flat_string(d[0]), domain: flat_string(d[2]), }; + } + }, + {"name": "Local_part", "symbols": ["Dot_string"]}, + {"name": "Local_part", "symbols": ["Quoted_string"]}, + {"name": "Dot_string$ebnf$1", "symbols": []}, + {"name": "Dot_string$ebnf$1$subexpression$1", "symbols": [{"literal":"."}, "Atom"]}, + {"name": "Dot_string$ebnf$1", "symbols": ["Dot_string$ebnf$1", "Dot_string$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "Dot_string", "symbols": ["Atom", "Dot_string$ebnf$1"]}, + {"name": "Atom$ebnf$1", "symbols": [/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/]}, + {"name": "Atom$ebnf$1", "symbols": ["Atom$ebnf$1", /[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "Atom", "symbols": ["Atom$ebnf$1"]}, + {"name": "Quoted_string$ebnf$1", "symbols": []}, + {"name": "Quoted_string$ebnf$1", "symbols": ["Quoted_string$ebnf$1", "QcontentSMTP"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "Quoted_string", "symbols": ["DQUOTE", "Quoted_string$ebnf$1", "DQUOTE"]}, + {"name": "QcontentSMTP", "symbols": ["qtextSMTP"]}, + {"name": "QcontentSMTP", "symbols": ["quoted_pairSMTP"]}, + {"name": "quoted_pairSMTP", "symbols": [{"literal":"\\"}, /[\x20-\x7e]/]}, + {"name": "qtextSMTP", "symbols": [/[\x20-\x21\x23-\x5b\x5d-\x7e\u0080-\uFFFF]/], "postprocess": id}, + {"name": "IPv4_address_literal$macrocall$2", "symbols": [{"literal":"."}, "Snum"]}, + {"name": "IPv4_address_literal$macrocall$1", "symbols": ["IPv4_address_literal$macrocall$2", "IPv4_address_literal$macrocall$2", "IPv4_address_literal$macrocall$2"]}, + {"name": "IPv4_address_literal", "symbols": ["Snum", "IPv4_address_literal$macrocall$1"]}, + {"name": "IPv6_address_literal$subexpression$1", "symbols": [/[iI]/, /[pP]/, /[vV]/, {"literal":"6"}, {"literal":":"}], "postprocess": function(d) {return d.join(""); }}, + {"name": "IPv6_address_literal", "symbols": ["IPv6_address_literal$subexpression$1", "IPv6_addr"]}, + {"name": "General_address_literal$ebnf$1", "symbols": ["dcontent"]}, + {"name": "General_address_literal$ebnf$1", "symbols": ["General_address_literal$ebnf$1", "dcontent"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, + {"name": "General_address_literal", "symbols": ["Standardized_tag", {"literal":":"}, "General_address_literal$ebnf$1"]}, + {"name": "Standardized_tag", "symbols": ["Ldh_str"]}, + {"name": "dcontent", "symbols": [/[\x21-\x5a\x5e-\x7e]/], "postprocess": id}, + {"name": "Snum", "symbols": ["DIGIT"]}, + {"name": "Snum$subexpression$1", "symbols": [/[1-9]/, "DIGIT"]}, + {"name": "Snum", "symbols": ["Snum$subexpression$1"]}, + {"name": "Snum$subexpression$2", "symbols": [{"literal":"1"}, "DIGIT", "DIGIT"]}, + {"name": "Snum", "symbols": ["Snum$subexpression$2"]}, + {"name": "Snum$subexpression$3", "symbols": [{"literal":"2"}, /[0-4]/, "DIGIT"]}, + {"name": "Snum", "symbols": ["Snum$subexpression$3"]}, + {"name": "Snum$subexpression$4", "symbols": [{"literal":"2"}, {"literal":"5"}, /[0-5]/]}, + {"name": "Snum", "symbols": ["Snum$subexpression$4"]}, + {"name": "IPv6_addr", "symbols": ["IPv6_full"]}, + {"name": "IPv6_addr", "symbols": ["IPv6_comp"]}, + {"name": "IPv6_addr", "symbols": ["IPv6v4_full"]}, + {"name": "IPv6_addr", "symbols": ["IPv6v4_comp"]}, + {"name": "IPv6_hex", "symbols": ["HEXDIG"]}, + {"name": "IPv6_hex$subexpression$1", "symbols": ["HEXDIG", "HEXDIG"]}, + {"name": "IPv6_hex", "symbols": ["IPv6_hex$subexpression$1"]}, + {"name": "IPv6_hex$subexpression$2", "symbols": ["HEXDIG", "HEXDIG", "HEXDIG"]}, + {"name": "IPv6_hex", "symbols": ["IPv6_hex$subexpression$2"]}, + {"name": "IPv6_hex$subexpression$3", "symbols": ["HEXDIG", "HEXDIG", "HEXDIG", "HEXDIG"]}, + {"name": "IPv6_hex", "symbols": ["IPv6_hex$subexpression$3"]}, + {"name": "IPv6_full$macrocall$2", "symbols": [{"literal":":"}, "IPv6_hex"]}, + {"name": "IPv6_full$macrocall$1", "symbols": ["IPv6_full$macrocall$2", "IPv6_full$macrocall$2", "IPv6_full$macrocall$2", "IPv6_full$macrocall$2", "IPv6_full$macrocall$2", "IPv6_full$macrocall$2", "IPv6_full$macrocall$2"]}, + {"name": "IPv6_full", "symbols": ["IPv6_hex", "IPv6_full$macrocall$1"]}, + {"name": "IPv6_comp$ebnf$1$subexpression$1$macrocall$2", "symbols": [{"literal":":"}, "IPv6_hex"]}, + {"name": "IPv6_comp$ebnf$1$subexpression$1$macrocall$1", "symbols": ["IPv6_comp$ebnf$1$subexpression$1$macrocall$2", "IPv6_comp$ebnf$1$subexpression$1$macrocall$2", "IPv6_comp$ebnf$1$subexpression$1$macrocall$2", "IPv6_comp$ebnf$1$subexpression$1$macrocall$2", "IPv6_comp$ebnf$1$subexpression$1$macrocall$2"]}, + {"name": "IPv6_comp$ebnf$1$subexpression$1", "symbols": ["IPv6_hex", "IPv6_comp$ebnf$1$subexpression$1$macrocall$1"]}, + {"name": "IPv6_comp$ebnf$1", "symbols": ["IPv6_comp$ebnf$1$subexpression$1"], "postprocess": id}, + {"name": "IPv6_comp$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, + {"name": "IPv6_comp$string$1", "symbols": [{"literal":":"}, {"literal":":"}], "postprocess": function joiner(d) {return d.join('');}}, + {"name": "IPv6_comp$ebnf$2$subexpression$1$macrocall$2", "symbols": [{"literal":":"}, "IPv6_hex"]}, + {"name": "IPv6_comp$ebnf$2$subexpression$1$macrocall$1", "symbols": ["IPv6_comp$ebnf$2$subexpression$1$macrocall$2", "IPv6_comp$ebnf$2$subexpression$1$macrocall$2", "IPv6_comp$ebnf$2$subexpression$1$macrocall$2", "IPv6_comp$ebnf$2$subexpression$1$macrocall$2", "IPv6_comp$ebnf$2$subexpression$1$macrocall$2"]}, + {"name": "IPv6_comp$ebnf$2$subexpression$1", "symbols": ["IPv6_hex", "IPv6_comp$ebnf$2$subexpression$1$macrocall$1"]}, + {"name": "IPv6_comp$ebnf$2", "symbols": ["IPv6_comp$ebnf$2$subexpression$1"], "postprocess": id}, + {"name": "IPv6_comp$ebnf$2", "symbols": [], "postprocess": function(d) {return null;}}, + {"name": "IPv6_comp", "symbols": ["IPv6_comp$ebnf$1", "IPv6_comp$string$1", "IPv6_comp$ebnf$2"]}, + {"name": "IPv6v4_full$macrocall$2", "symbols": [{"literal":":"}, "IPv6_hex"]}, + {"name": "IPv6v4_full$macrocall$1", "symbols": ["IPv6v4_full$macrocall$2", "IPv6v4_full$macrocall$2", "IPv6v4_full$macrocall$2", "IPv6v4_full$macrocall$2", "IPv6v4_full$macrocall$2"]}, + {"name": "IPv6v4_full", "symbols": ["IPv6_hex", "IPv6v4_full$macrocall$1", {"literal":":"}, "IPv4_address_literal"]}, + {"name": "IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2", "symbols": [{"literal":":"}, "IPv6_hex"]}, + {"name": "IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1", "symbols": ["IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2", "IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2", "IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2"]}, + {"name": "IPv6v4_comp$ebnf$1$subexpression$1", "symbols": ["IPv6_hex", "IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1"]}, + {"name": "IPv6v4_comp$ebnf$1", "symbols": ["IPv6v4_comp$ebnf$1$subexpression$1"], "postprocess": id}, + {"name": "IPv6v4_comp$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, + {"name": "IPv6v4_comp$string$1", "symbols": [{"literal":":"}, {"literal":":"}], "postprocess": function joiner(d) {return d.join('');}}, + {"name": "IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2", "symbols": [{"literal":":"}, "IPv6_hex"]}, + {"name": "IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1", "symbols": ["IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2", "IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2", "IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2"]}, + {"name": "IPv6v4_comp$ebnf$2$subexpression$1", "symbols": ["IPv6_hex", "IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1", {"literal":":"}]}, + {"name": "IPv6v4_comp$ebnf$2", "symbols": ["IPv6v4_comp$ebnf$2$subexpression$1"], "postprocess": id}, + {"name": "IPv6v4_comp$ebnf$2", "symbols": [], "postprocess": function(d) {return null;}}, + {"name": "IPv6v4_comp", "symbols": ["IPv6v4_comp$ebnf$1", "IPv6v4_comp$string$1", "IPv6v4_comp$ebnf$2", "IPv4_address_literal"]}, + {"name": "DIGIT", "symbols": [/[0-9]/], "postprocess": id}, + {"name": "ALPHA_DIGIT_U", "symbols": [/[0-9A-Za-z\u0080-\uFFFF]/], "postprocess": id}, + {"name": "ALPHA_DIGIT", "symbols": [/[0-9A-Za-z]/], "postprocess": id}, + {"name": "ALPHA_DIG_DASH", "symbols": [/[-0-9A-Za-z]/], "postprocess": id}, + {"name": "ALPHA_DIG_DASH_U", "symbols": [/[-0-9A-Za-z\u0080-\uFFFF]/], "postprocess": id}, + {"name": "HEXDIG", "symbols": [/[0-9A-Fa-f]/], "postprocess": id}, + {"name": "DQUOTE", "symbols": [{"literal":"\""}], "postprocess": id} +] + , ParserStart: "main" +} +if (typeof module !== 'undefined'&& typeof module.exports !== 'undefined') { + module.exports = grammar; +} else { + window.grammar = grammar; +} +})(); diff --git a/package.json b/package.json index 448bdc6..b32570e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "address-rfc2821", - "version": "2.0.1", + "version": "2.1.0", "description": "RFC-5321 (Envelope) email address parser", "author": { "name": "The Haraka Team", @@ -30,8 +30,9 @@ "cover": "NODE_ENV=cov npx nyc --reporter=lcovonly npm run test", "lint": "npx eslint index.js test/*.js", "lintfix": "npx eslint --fix index.js test/*.js", - "postinstall": "npx -p nearley nearleyc grammar.ne -o grammar.js", - "test": "npx mocha" + "prepack": "npm run grammar", + "test": "npx mocha", + "versions": "npx dependency-version-checker check" }, "repository": { "type": "git", @@ -40,11 +41,11 @@ "devDependencies": { "eslint": "*", "eslint-plugin-haraka": "*", - "mocha": "*" + "mocha": "*", + "nearley": "^2.20.1" }, "license": "MIT", "dependencies": { - "nearley": "^2.20.1", - "punycode": "^2.1.0" + "punycode": "^2.3.0" } }