Skip to content

Commit 3748308

Browse files
committed
Merge branch 'main' into @tomekzaw/android-improve-remove-spans
2 parents 5440a12 + 5695408 commit 3748308

File tree

99 files changed

+32765
-25352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+32765
-25352
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
**/node_modules/*
2-
parser/react-native-live-markdown-parser.js
32

43
# any js file inside android and ios folders
54
**/android/**/*.js

.github/OSBotify-private-key.asc.gpg

-3.85 KB
Binary file not shown.

.github/workflows/build-android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
java-version: 17
4545

4646
- name: Install node_modules
47-
run: yarn install --immutable
47+
run: npm ci
4848

4949
- name: Build app
5050
working-directory: example/android

.github/workflows/build-ios.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ jobs:
4343
path: |
4444
node_modules
4545
example/node_modules
46-
key: build-ios-node-modules-${{ matrix.react-native-architecture }}-${{ hashFiles('yarn.lock') }}
46+
key: build-ios-node-modules-${{ matrix.react-native-architecture }}-${{ hashFiles('package-lock.json') }}
4747
restore-keys: build-ios-node-modules-${{ matrix.react-native-architecture }}-
4848

4949
- name: Install node_modules
50-
run: yarn install --immutable
50+
run: npm ci
5151

5252
- name: Restore Pods from cache
5353
uses: actions/cache@v4
@@ -56,7 +56,7 @@ jobs:
5656
example/ios/Pods
5757
~/Library/Caches/CocoaPods
5858
~/.cocoapods
59-
key: build-ios-pods-${{ matrix.react-native-architecture }}-${{ hashFiles('example/node_modules/react-native/package.json') }}
59+
key: build-ios-pods-${{ matrix.react-native-architecture }}-${{ hashFiles('node_modules/react-native/package.json') }}
6060
restore-keys: build-ios-pods-${{ matrix.react-native-architecture }}-
6161

6262
- name: Install Pods
@@ -75,7 +75,7 @@ jobs:
7575
uses: actions/cache@v4
7676
with:
7777
path: ~/Library/Developer/Xcode/DerivedData
78-
key: build-ios-derived-data-${{ matrix.react-native-architecture }}-${{ hashFiles('example/node_modules/react-native/package.json') }}
78+
key: build-ios-derived-data-${{ matrix.react-native-architecture }}-${{ hashFiles('node_modules/react-native/package.json') }}
7979
restore-keys: build-ios-derived-data-${{ matrix.react-native-architecture }}-
8080

8181
- name: Build app

.github/workflows/build-web.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/checkout@v4
2929

3030
- name: Install node_modules
31-
run: yarn install --immutable
31+
run: npm ci
3232

3333
- name: Build app
3434
working-directory: WebExample

.github/workflows/check.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,19 @@ jobs:
2525
node-version: 18
2626

2727
- name: Install node_modules
28-
run: yarn install --immutable
29-
30-
- name: Verify there's no parser diff
31-
working-directory: parser
32-
run: |
33-
yarn build
34-
if ! git diff --name-only --exit-code; then
35-
# shellcheck disable=SC2016
36-
echo 'Error: Parser diff detected! Please run `cd parser && yarn build` and commit the changes.'
37-
exit 1
38-
fi
28+
run: npm ci
3929

4030
- name: Typecheck library
41-
run: yarn tsc --project tsconfig.json --noEmit
42-
43-
- name: Typecheck parser
44-
run: yarn tsc --project parser/tsconfig.json --noEmit
31+
run: npm run typecheck -- --project tsconfig.json
4532

4633
- name: Typecheck example app
47-
run: yarn tsc --project example/tsconfig.json --noEmit
34+
run: npm run typecheck -- --project example/tsconfig.json
4835

4936
- name: Typecheck WebExample app
50-
run: yarn tsc --project WebExample/tsconfig.json --noEmit
37+
run: npm run typecheck -- --project WebExample/tsconfig.json
5138

5239
- name: Lint
53-
run: yarn lint
40+
run: npm run lint
5441

5542
- name: Test
56-
run: yarn test
43+
run: npm run test

.github/workflows/lint.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
name: Lint JavaScript
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize]
4+
pull_request:
5+
types: [opened, synchronize]
66

77
jobs:
8-
lint:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v2
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
1212

13-
- uses: actions/cache@v2
14-
with:
15-
path: ~/.yarn
16-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
17-
restore-keys: |
18-
${{ runner.os }}-yarn-
13+
- uses: actions/cache@v2
14+
with:
15+
path: ~/.npm
16+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
17+
restore-keys: |
18+
${{ runner.os }}-npm-
1919
20-
- name: Setup Node
21-
uses: actions/setup-node@v1
22-
with:
23-
node-version: "16.x"
20+
- name: Setup Node
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: '16.x'
2424

25-
- name: Install node_modules
26-
run: yarn install --immutable
25+
- name: Install node_modules
26+
run: npm ci
2727

28-
- name: Verify there's no Prettier diff
29-
run: |
30-
yarn lint --fix --quiet
31-
if ! git diff --name-only --exit-code; then
32-
# shellcheck disable=SC2016
33-
echo 'Error: Prettier diff detected! Please run `yarn lint --fix` and commit the changes.'
34-
exit 1
35-
fi
28+
- name: Verify there's no Prettier diff
29+
run: |
30+
npm run lint -- --fix --quiet
31+
if ! git diff --name-only --exit-code; then
32+
# shellcheck disable=SC2016
33+
echo 'Error: Prettier diff detected! Please run `npm run lint -- --fix` and commit the changes.'
34+
exit 1
35+
fi

.github/workflows/publish.yml

Lines changed: 10 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,18 @@
11
name: Publish package to npmjs
22

3-
# This workflow runs when code is pushed to `main` (i.e: when a pull request is merged)
43
on:
5-
push:
6-
branches: [main]
4+
push:
5+
branches: [main]
76

8-
# Ensure that only once instance of this workflow executes at a time.
7+
# Ensure that only one instance of this workflow executes at a time.
98
# If multiple PRs are merged in quick succession, there will only ever be one publish workflow running and one pending.
109
concurrency: ${{ github.workflow }}
1110

1211
jobs:
13-
version:
14-
runs-on: ubuntu-latest
15-
16-
# OSBotify will update the version on `main`, so this check is important to prevent an infinite loop
17-
if: ${{ github.actor != 'OSBotify' }}
18-
19-
steps:
20-
- uses: actions/checkout@v4
21-
with:
22-
ref: main
23-
# The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify
24-
# This is a workaround to allow pushes to a protected branch
25-
token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}
26-
27-
- name: Decrypt & Import OSBotify GPG key
28-
run: |
29-
cd .github
30-
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output OSBotify-private-key.asc OSBotify-private-key.asc.gpg
31-
gpg --import OSBotify-private-key.asc
32-
env:
33-
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
34-
35-
- name: Set up git for OSBotify
36-
run: |
37-
git config --global user.signingkey AEE1036472A782AB
38-
git config --global commit.gpgsign true
39-
git config --global user.name OSBotify
40-
git config --global user.email infra+osbotify@expensify.com
41-
42-
- uses: actions/setup-node@v4
43-
with:
44-
node-version-file: '.nvmrc'
45-
registry-url: 'https://registry.npmjs.org'
46-
47-
- name: Install yarn packages
48-
run: yarn install --immutable
49-
50-
- name: Update npm version
51-
run: yarn version patch
52-
53-
- name: Set new version in GitHub ENV
54-
run: echo "NEW_VERSION=$(jq '.version' package.json)" >> $GITHUB_ENV
55-
56-
- name: Commit version bump
57-
run: git commit -am "Bump version to ${{ env.NEW_VERSION }}"
58-
59-
- name: Tag version bump
60-
run: git tag ${{ env.NEW_VERSION }}
61-
62-
- name: Push branch and publish tags
63-
run: git push --set-upstream origin main && git push --tags
64-
65-
- name: Build package
66-
run: yarn pack
67-
68-
- name: Publish to npm
69-
run: npm publish --access public
70-
env:
71-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12+
publish:
13+
# os-botify[bot] will update the version on `main`, so this check is important to prevent an infinite loop
14+
if: ${{ github.actor != 'os-botify[bot]' }}
15+
uses: Expensify/GitHub-Actions/.github/workflows/npmPublish.yml@main
16+
secrets: inherit
17+
with:
18+
should_run_pack: true

.github/workflows/web-e2e-test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
test:
2121
if: github.repository == 'Expensify/react-native-live-markdown'
2222
runs-on: ubuntu-latest
23-
defaults:
24-
run:
25-
working-directory: ./WebExample
2623

2724
concurrency:
2825
group: web-e2e-test-${{ github.ref }}
@@ -37,7 +34,7 @@ jobs:
3734
node-version: 18
3835

3936
- name: Install node_modules
40-
run: yarn install --immutable
37+
run: npm ci
4138

4239
- name: Install browsers
4340
run: npx playwright install --with-deps
@@ -46,4 +43,5 @@ jobs:
4643
run: npx playwright install-deps
4744

4845
- name: Run Playwright tests
49-
run: yarn test
46+
run: npm run test
47+
working-directory: WebExample

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,4 @@ android/keystores/debug.keystore
7878
lib/
7979

8080
# react-native-live-markdown
81-
android/src/main/assets/react-native-live-markdown-parser.js
8281
.build_complete
83-
84-
# GitHub GPG Keys
85-
.github/OSBotify-private-key.asc
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
diff --git a/lib/index.js b/lib/index.js
2+
index 3a44c851c4895f74db30360befb509d232055c56..2f7809ba105f32aa3d9620c1be3f14c93e589185 100644
3+
--- a/lib/index.js
4+
+++ b/lib/index.js
5+
@@ -1,2 +1,3 @@
6+
+"worklet";
7+
"use strict";var __assign=this&&this.__assign||function(){__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};return __assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:true});var named_references_1=require("./named-references");var numeric_unicode_map_1=require("./numeric-unicode-map");var surrogate_pairs_1=require("./surrogate-pairs");var allNamedReferences=__assign(__assign({},named_references_1.namedReferences),{all:named_references_1.namedReferences.html5});function replaceUsingRegExp(macroText,macroRegExp,macroReplacer){macroRegExp.lastIndex=0;var replaceMatch=macroRegExp.exec(macroText);var replaceResult;if(replaceMatch){replaceResult="";var replaceLastIndex=0;do{if(replaceLastIndex!==replaceMatch.index){replaceResult+=macroText.substring(replaceLastIndex,replaceMatch.index)}var replaceInput=replaceMatch[0];replaceResult+=macroReplacer(replaceInput);replaceLastIndex=replaceMatch.index+replaceInput.length}while(replaceMatch=macroRegExp.exec(macroText));if(replaceLastIndex!==macroText.length){replaceResult+=macroText.substring(replaceLastIndex)}}else{replaceResult=macroText}return replaceResult}var encodeRegExps={specialChars:/[<>'"&]/g,nonAscii:/[<>'"&\u0080-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintable:/[<>'"&\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintableOnly:/[\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,extensive:/[\x01-\x0c\x0e-\x1f\x21-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7d\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g};var defaultEncodeOptions={mode:"specialChars",level:"all",numeric:"decimal"};function encode(text,_a){var _b=_a===void 0?defaultEncodeOptions:_a,_c=_b.mode,mode=_c===void 0?"specialChars":_c,_d=_b.numeric,numeric=_d===void 0?"decimal":_d,_e=_b.level,level=_e===void 0?"all":_e;if(!text){return""}var encodeRegExp=encodeRegExps[mode];var references=allNamedReferences[level].characters;var isHex=numeric==="hexadecimal";return replaceUsingRegExp(text,encodeRegExp,(function(input){var result=references[input];if(!result){var code=input.length>1?surrogate_pairs_1.getCodePoint(input,0):input.charCodeAt(0);result=(isHex?"&#x"+code.toString(16):"&#"+code)+";"}return result}))}exports.encode=encode;var defaultDecodeOptions={scope:"body",level:"all"};var strict=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g;var attribute=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g;var baseDecodeRegExps={xml:{strict:strict,attribute:attribute,body:named_references_1.bodyRegExps.xml},html4:{strict:strict,attribute:attribute,body:named_references_1.bodyRegExps.html4},html5:{strict:strict,attribute:attribute,body:named_references_1.bodyRegExps.html5}};var decodeRegExps=__assign(__assign({},baseDecodeRegExps),{all:baseDecodeRegExps.html5});var fromCharCode=String.fromCharCode;var outOfBoundsChar=fromCharCode(65533);var defaultDecodeEntityOptions={level:"all"};function getDecodedEntity(entity,references,isAttribute,isStrict){var decodeResult=entity;var decodeEntityLastChar=entity[entity.length-1];if(isAttribute&&decodeEntityLastChar==="="){decodeResult=entity}else if(isStrict&&decodeEntityLastChar!==";"){decodeResult=entity}else{var decodeResultByReference=references[entity];if(decodeResultByReference){decodeResult=decodeResultByReference}else if(entity[0]==="&"&&entity[1]==="#"){var decodeSecondChar=entity[2];var decodeCode=decodeSecondChar=="x"||decodeSecondChar=="X"?parseInt(entity.substr(3),16):parseInt(entity.substr(2));decodeResult=decodeCode>=1114111?outOfBoundsChar:decodeCode>65535?surrogate_pairs_1.fromCodePoint(decodeCode):fromCharCode(numeric_unicode_map_1.numericUnicodeMap[decodeCode]||decodeCode)}}return decodeResult}function decodeEntity(entity,_a){var _b=(_a===void 0?defaultDecodeEntityOptions:_a).level,level=_b===void 0?"all":_b;if(!entity){return""}return getDecodedEntity(entity,allNamedReferences[level].entities,false,false)}exports.decodeEntity=decodeEntity;function decode(text,_a){var _b=_a===void 0?defaultDecodeOptions:_a,_c=_b.level,level=_c===void 0?"all":_c,_d=_b.scope,scope=_d===void 0?level==="xml"?"strict":"body":_d;if(!text){return""}var decodeRegExp=decodeRegExps[level][scope];var references=allNamedReferences[level].entities;var isAttribute=scope==="attribute";var isStrict=scope==="strict";return replaceUsingRegExp(text,decodeRegExp,(function(entity){return getDecodedEntity(entity,references,isAttribute,isStrict)}))}exports.decode=decode;
8+
//# sourceMappingURL=./index.js.map
9+
\ No newline at end of file

0 commit comments

Comments
 (0)