Skip to content

Commit 8c2111c

Browse files
Bump expensify-common to 2.0.10 (Expensify#360)
Co-authored-by: Tomek Zawadzki <[email protected]>
1 parent e4cfc6f commit 8c2111c

File tree

7 files changed

+345
-231
lines changed

7 files changed

+345
-231
lines changed

example/ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,12 +1111,12 @@ PODS:
11111111
- React-jsi (= 0.73.4)
11121112
- React-logger (= 0.73.4)
11131113
- React-perflogger (= 0.73.4)
1114-
- RNLiveMarkdown (0.1.54):
1114+
- RNLiveMarkdown (0.1.79):
11151115
- glog
11161116
- RCT-Folly (= 2022.05.16.00)
11171117
- React-Core
1118-
- RNLiveMarkdown/common (= 0.1.54)
1119-
- RNLiveMarkdown/common (0.1.54):
1118+
- RNLiveMarkdown/common (= 0.1.79)
1119+
- RNLiveMarkdown/common (0.1.79):
11201120
- glog
11211121
- RCT-Folly (= 2022.05.16.00)
11221122
- React-Core
@@ -1376,7 +1376,7 @@ SPEC CHECKSUMS:
13761376
React-runtimescheduler: ed48e5faac6751e66ee1261c4bd01643b436f112
13771377
React-utils: 6e5ad394416482ae21831050928ae27348f83487
13781378
ReactCommon: 840a955d37b7f3358554d819446bffcf624b2522
1379-
RNLiveMarkdown: 2f6f838a2089bd7337020a82800cb0c05c48c5d9
1379+
RNLiveMarkdown: a4ddf419a109cd3f916db22ee19f8b8293b4f7e4
13801380
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
13811381
Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70
13821382

parser/babel.config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["module:@react-native/babel-preset"]
3+
}

parser/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// @ts-expect-error - to review how it's implemented in ExpensiMark
21
// eslint-disable-next-line import/no-unresolved
3-
import {ExpensiMark} from 'expensify-common/lib/ExpensiMark';
2+
import ExpensiMark from 'expensify-common/dist/ExpensiMark';
43
import _ from 'underscore';
54

65
type MarkdownType = 'bold' | 'italic' | 'strikethrough' | 'emoji' | 'mention-here' | 'mention-user' | 'mention-report' | 'link' | 'code' | 'pre' | 'blockquote' | 'h1' | 'syntax';
@@ -14,7 +13,7 @@ type Token = ['TEXT' | 'HTML', string];
1413
type StackItem = {tag: string; children: Array<StackItem | string>};
1514

1615
function parseMarkdownToHTML(markdown: string): string {
17-
const parser = ExpensiMark;
16+
const parser = new ExpensiMark();
1817
const html = parser.replace(markdown, {
1918
shouldKeepRawInput: true,
2019
});
@@ -155,10 +154,9 @@ function parseTreeToTextAndRanges(tree: StackItem): [string, Range[]] {
155154
appendSyntax('# ');
156155
addChildrenWithStyle(node, 'h1');
157156
} else if (node.tag.startsWith('<pre')) {
158-
const content = _.unescape(node.tag.match(/data-code-raw="([^"]*)"/)![1]!); // always present
159-
160157
appendSyntax('```');
161-
addChildrenWithStyle(content, 'pre');
158+
const content = node.children.join('').replaceAll('&#32;', ' ');
159+
addChildrenWithStyle(`\n${content}`, 'pre');
162160
appendSyntax('```');
163161
} else if (node.tag.startsWith('<a href="')) {
164162
const rawHref = node.tag.match(/href="([^"]*)"/)![1]!; // always present

parser/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@
66
"main": "index.js",
77
"scripts": {
88
"test": "jest",
9-
"build": "esbuild index.ts --bundle --minify --outfile=react-native-live-markdown-parser.js",
10-
"run": "node react-native-live-markdown-parser.js",
11-
"postinstall": "patch-package"
9+
"build": "esbuild index.ts --bundle --outfile=build/index.esbuild.js && babel build/index.esbuild.js --out-file build/index.babel.js && esbuild build/index.babel.js --bundle --minify --outfile=react-native-live-markdown-parser.js && rm -rf build",
10+
"run": "node react-native-live-markdown-parser.js"
1211
},
1312
"author": "",
1413
"license": "ISC",
1514
"devDependencies": {
15+
"@babel/cli": "^7.24.7",
16+
"@babel/core": "^7.24.7",
17+
"@react-native/babel-preset": "0.73.21",
1618
"@types/underscore": "^1.11.15",
1719
"esbuild": "0.19.4",
1820
"esbuild-plugin-tsc": "^0.4.0",
1921
"jest": "^29.7.0",
2022
"typescript": "^5.3.3"
2123
},
2224
"dependencies": {
23-
"expensify-common": "Expensify/expensify-common#a018512b1e0fce4d4b5a61c00ca826b8887007ad",
24-
"patch-package": "^8.0.0",
25+
"expensify-common": "2.0.10",
2526
"underscore": "^1.13.6"
2627
}
2728
}

parser/patches/expensify-common+1.0.0.patch

Lines changed: 0 additions & 178 deletions
This file was deleted.

parser/react-native-live-markdown-parser.js

Lines changed: 33 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)