libmime 5.3.6 → 5.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.3.7](https://github.com/nodemailer/libmime/compare/v5.3.6...v5.3.7) (2025-06-26)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * performance issue on large inputs to decodeFlowed() ([#25](https://github.com/nodemailer/libmime/issues/25)) ([c893811](https://github.com/nodemailer/libmime/commit/c8938111e212996f0809253eb195ef56778fc4dd))
9
+ * replace .npmignore with files=[] in package.json ([#22](https://github.com/nodemailer/libmime/issues/22)) ([0ae2a1f](https://github.com/nodemailer/libmime/commit/0ae2a1fd830a73a1cdcee295bca94ebfe4a3c051))
10
+
3
11
  ## [5.3.6](https://github.com/nodemailer/libmime/compare/v5.3.5...v5.3.6) (2024-11-29)
4
12
 
5
13
 
package/lib/libmime.js CHANGED
@@ -54,28 +54,42 @@ class Libmime {
54
54
  decodeFlowed(str, delSp) {
55
55
  str = (str || '').toString();
56
56
 
57
- return (
58
- str
59
- .split(/\r?\n/)
60
- // remove soft linebreaks
61
- // soft linebreaks are added after space symbols
62
- .reduce((previousValue, currentValue) => {
63
- if (/ $/.test(previousValue) && !/(^|\n)-- $/.test(previousValue)) {
64
- if (delSp) {
65
- // delsp adds space to text to be able to fold it
66
- // these spaces can be removed once the text is unfolded
67
- return previousValue.slice(0, -1) + currentValue;
68
- } else {
69
- return previousValue + currentValue;
70
- }
71
- } else {
72
- return previousValue + '\n' + currentValue;
73
- }
74
- })
75
- // remove whitespace stuffing
76
- // http://tools.ietf.org/html/rfc3676#section-4.4
77
- .replace(/^ /gm, '')
78
- );
57
+ let lines = str.split(/\r?\n/);
58
+
59
+ let result = [],
60
+ buffer = null;
61
+
62
+ // remove soft linebreaks
63
+ // soft linebreaks are added after space symbols
64
+ for (let i = 0; i < lines.length; i++) {
65
+ let line = lines[i];
66
+
67
+ let isSoftBreak = buffer !== null && / $/.test(buffer) && !/(^|\n)-- $/.test(buffer);
68
+
69
+ if (isSoftBreak) {
70
+ if (delSp) {
71
+ // delsp adds space to text to be able to fold it
72
+ // these spaces can be removed once the text is unfolded
73
+ buffer = buffer.slice(0, -1) + line;
74
+ } else {
75
+ buffer += line;
76
+ }
77
+ } else {
78
+ if (buffer !== null) {
79
+ result.push(buffer);
80
+ }
81
+
82
+ buffer = line;
83
+ }
84
+ }
85
+
86
+ if (buffer) {
87
+ result.push(buffer);
88
+ }
89
+
90
+ // remove whitespace stuffing
91
+ // http://tools.ietf.org/html/rfc3676#section-4.4
92
+ return result.join('\n').replace(/^ /gm, '');
79
93
  }
80
94
 
81
95
  /**
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "libmime",
3
3
  "description": "Encode and decode quoted printable and base64 strings",
4
- "version": "5.3.6",
4
+ "version": "5.3.7",
5
5
  "main": "lib/libmime.js",
6
+ "files": [
7
+ "lib",
8
+ "CHANGELOG.md"
9
+ ],
6
10
  "homepage": "https://github.com/nodemailer/libmime",
7
11
  "repository": {
8
12
  "type": "git",
@@ -28,11 +32,11 @@
28
32
  "devDependencies": {
29
33
  "chai": "4.4.1",
30
34
  "eslint-config-nodemailer": "1.2.0",
31
- "eslint-config-prettier": "9.1.0",
35
+ "eslint-config-prettier": "10.1.5",
32
36
  "grunt": "1.6.1",
33
37
  "grunt-cli": "1.5.0",
34
38
  "grunt-eslint": "24.3.0",
35
39
  "grunt-mocha-test": "0.13.3",
36
- "mocha": "10.8.2"
40
+ "mocha": "11.7.1"
37
41
  }
38
42
  }
package/.eslintrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "rules": {
3
- "indent": 0,
4
- "no-prototype-builtins": 0
5
- },
6
- "extends": "nodemailer"
7
- }
package/.gitattributes DELETED
@@ -1 +0,0 @@
1
- *.js text eol=lf
@@ -1,4 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [andris9] # enable once enrolled
4
- custom: ['https://www.paypal.me/nodemailer']
@@ -1,37 +0,0 @@
1
- on:
2
- push:
3
- branches:
4
- - master
5
-
6
- permissions:
7
- contents: write
8
- pull-requests: write
9
- id-token: write
10
-
11
- name: release
12
- jobs:
13
- release-please:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: google-github-actions/release-please-action@v3
17
- id: release
18
- with:
19
- release-type: node
20
- package-name: ${{vars.NPM_MODULE_NAME}}
21
- pull-request-title-pattern: 'chore${scope}: release ${version} [skip-ci]'
22
- # The logic below handles the npm publication:
23
- - uses: actions/checkout@v4
24
- # these if statements ensure that a publication only occurs when
25
- # a new release is created:
26
- if: ${{ steps.release.outputs.release_created }}
27
- - uses: actions/setup-node@v4
28
- with:
29
- node-version: 20
30
- registry-url: 'https://registry.npmjs.org'
31
- if: ${{ steps.release.outputs.release_created }}
32
- - run: npm ci
33
- if: ${{ steps.release.outputs.release_created }}
34
- - run: npm publish --provenance --access public
35
- env:
36
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
37
- if: ${{ steps.release.outputs.release_created }}
@@ -1,21 +0,0 @@
1
- name: Run tests
2
-
3
- on:
4
- push:
5
- pull_request:
6
-
7
- jobs:
8
- test:
9
- strategy:
10
- matrix:
11
- node: [16.x, 18.x, 20.x, 21.x]
12
- os: [ubuntu-latest]
13
- runs-on: ${{ matrix.os }}
14
- steps:
15
- - uses: actions/checkout@v2
16
- - name: Use Node.js ${{ matrix.node }}
17
- uses: actions/setup-node@v4
18
- with:
19
- node-version: ${{ matrix.node }}
20
- - run: npm install
21
- - run: npm test
package/.ncurc.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- upgrade: true,
3
- reject: [
4
- // 5x is esm only
5
- 'chai',
6
- // api changes in newer eslint
7
- 'grunt-eslint'
8
- ]
9
- };
package/.prettierrc.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- printWidth: 160,
3
- tabWidth: 4,
4
- singleQuote: true,
5
- endOfLine: 'lf',
6
- trailingComma: 'none',
7
- arrowParens: 'avoid'
8
- };