@20minutes/draft-convert 3.0.3 → 3.1.1

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.
Files changed (42) hide show
  1. package/README.md +2 -3
  2. package/esm/blockEntities.js +62 -65
  3. package/esm/blockInlineStyles.js +69 -92
  4. package/esm/convertFromHTML.js +447 -481
  5. package/esm/convertToHTML.js +81 -102
  6. package/esm/default/defaultBlockHTML.js +33 -30
  7. package/esm/default/defaultInlineHTML.js +16 -16
  8. package/esm/encodeBlock.js +38 -42
  9. package/esm/index.js +4 -4
  10. package/esm/util/accumulateFunction.js +7 -9
  11. package/esm/util/blockTypeObjectFunction.js +7 -9
  12. package/esm/util/getBlockTags.js +20 -20
  13. package/esm/util/getElementHTML.js +25 -29
  14. package/esm/util/getElementTagLength.js +15 -17
  15. package/esm/util/getNestedBlockTags.js +21 -26
  16. package/esm/util/parseHTML.js +15 -15
  17. package/esm/util/rangeSort.js +6 -6
  18. package/esm/util/splitReactElement.js +27 -13
  19. package/esm/util/styleObjectFunction.js +6 -8
  20. package/esm/util/updateMutation.js +57 -47
  21. package/lib/blockEntities.js +74 -69
  22. package/lib/blockInlineStyles.js +81 -96
  23. package/lib/convertFromHTML.js +502 -487
  24. package/lib/convertToHTML.js +134 -106
  25. package/lib/default/defaultBlockHTML.js +47 -35
  26. package/lib/default/defaultInlineHTML.js +29 -21
  27. package/lib/encodeBlock.js +50 -46
  28. package/lib/index.js +25 -23
  29. package/lib/util/accumulateFunction.js +13 -11
  30. package/lib/util/blockTypeObjectFunction.js +13 -11
  31. package/lib/util/getBlockTags.js +35 -27
  32. package/lib/util/getElementHTML.js +40 -36
  33. package/lib/util/getElementTagLength.js +28 -22
  34. package/lib/util/getNestedBlockTags.js +35 -32
  35. package/lib/util/parseHTML.js +22 -18
  36. package/lib/util/rangeSort.js +13 -9
  37. package/lib/util/splitReactElement.js +42 -19
  38. package/lib/util/styleObjectFunction.js +12 -10
  39. package/lib/util/updateMutation.js +64 -51
  40. package/package.json +25 -28
  41. package/dist/draft-convert.js +0 -440
  42. package/dist/draft-convert.min.js +0 -1
package/package.json CHANGED
@@ -1,25 +1,30 @@
1
1
  {
2
2
  "name": "@20minutes/draft-convert",
3
- "version": "3.0.3",
3
+ "version": "3.1.1",
4
4
  "description": "Extensibly serialize & deserialize Draft.js ContentState",
5
5
  "main": "lib/index.js",
6
6
  "types": "types/index.d.ts",
7
7
  "module": "esm/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./types/index.d.ts",
11
+ "require": "./lib/index.js",
12
+ "import": "./esm/index.js"
13
+ }
14
+ },
8
15
  "repository": "20minutes/draft-convert",
9
16
  "scripts": {
10
- "build": "yarn build:cjs && yarn build:esm && yarn build:umd",
11
- "build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir lib",
12
- "build:esm": "cross-env BABEL_ENV=esm babel src --out-dir esm",
13
- "build:umd": "wp",
17
+ "build": "yarn build:cjs && yarn build:esm",
18
+ "build:cjs": "swc src -d lib --config-file .swcrc.cjs --strip-leading-paths --delete-dir-on-start",
19
+ "build:esm": "swc src -d esm --config-file .swcrc.esm --strip-leading-paths --delete-dir-on-start",
14
20
  "test": "jest",
15
21
  "test:watch": "jest --watch",
16
- "clean": "rimraf ./dist ./lib ./esm",
17
- "build-and-test": "yarn clean && yarn build && yarn test",
22
+ "clean": "rimraf ./lib ./esm",
23
+ "build-and-test": "yarn clean && yarn test",
18
24
  "lint": "eslint src/ test/"
19
25
  },
20
26
  "files": [
21
27
  "types",
22
- "dist",
23
28
  "lib",
24
29
  "esm"
25
30
  ],
@@ -31,44 +36,36 @@
31
36
  ],
32
37
  "author": "bbriggs@hubspot.com",
33
38
  "license": "Apache-2.0",
39
+ "engines": {
40
+ "node": ">=22"
41
+ },
34
42
  "peerDependencies": {
35
43
  "draft-js": ">=0.7.0",
36
44
  "react": "^15.0.2 || ^16.0.0-rc || ^16.0.0 || ^17.0.0 || ^18.0.0",
37
45
  "react-dom": "^15.0.2 || ^16.0.0-rc || ^16.0.0 || ^17.0.0 || ^18.0.0"
38
46
  },
39
47
  "dependencies": {
40
- "@babel/runtime": "^7.28.4",
41
- "immutable": "~3.7.4",
48
+ "immutable": "~5.1.4",
42
49
  "invariant": "^2.2.1"
43
50
  },
44
51
  "devDependencies": {
45
- "@20minutes/eslint-config": "^1.2.7",
46
- "@babel/cli": "^7.28.3",
47
- "@babel/core": "^7.28.5",
48
- "@babel/eslint-parser": "^7.28.5",
49
- "@babel/plugin-transform-runtime": "^7.28.5",
50
- "@babel/preset-env": "^7.28.5",
51
- "@babel/preset-react": "^7.28.5",
52
- "babel-eslint": "^10.0.2",
53
- "babel-jest": "^30.2.0",
54
- "babel-loader": "^10.0.0",
55
- "cross-env": "^10.1.0",
52
+ "@20minutes/eslint-config": "^2.0.0",
53
+ "@swc/cli": "^0.8.0",
54
+ "@swc/core": "^1.9.2",
55
+ "@swc/jest": "^0.2.36",
56
56
  "draft-js": "^0.11.7",
57
- "eslint": "^8.57.0",
58
- "eslint-config-airbnb": "^19.0.4",
57
+ "eslint": "^9.0.0",
59
58
  "eslint-config-prettier": "^10.1.8",
60
- "eslint-plugin-babel": "^5.3.1",
61
59
  "eslint-plugin-import": "^2.32.0",
62
- "eslint-plugin-jsx-a11y": "^6.10.2",
63
60
  "eslint-plugin-prettier": "^5.5.4",
64
61
  "eslint-plugin-react": "7.37.5",
62
+ "eslint-plugin-react-hooks": "^7.0.1",
65
63
  "jest": "^30.2.0",
66
64
  "jest-environment-jsdom": "^30.2.0",
67
65
  "prettier": "^3.6.2",
68
66
  "react": "^18.0.0",
69
67
  "react-dom": "^18.0.0",
70
- "rimraf": "6.1.2",
71
- "webpack": "^5.103.0",
72
- "webpack-nano": "^1.1.1"
68
+ "rimraf": "6.1.3",
69
+ "tsx": "^4.21.0"
73
70
  }
74
71
  }