react-native-codepad-lang-tsx 0.0.0-stage → 0.1.0

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.
@@ -0,0 +1,28 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "CodepadLangTsx"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+ s.platforms = { :ios => "17.0" }
13
+ s.source = { :git => "https://github.com/SectionTN/react-native-codepad.git", :tag => "v#{s.version}" }
14
+
15
+ s.source_files = ["ios/*.{h,swift}", "grammar/tsx/src/parser.c", "grammar/tsx/src/scanner.c"]
16
+ s.public_header_files = "ios/*.h"
17
+ s.preserve_paths = "grammar/**/*"
18
+ s.compiler_flags = "-w"
19
+ s.pod_target_xcconfig = {
20
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/grammar/tsx/src\"",
21
+ "GCC_OPTIMIZATION_LEVEL" => "1",
22
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
23
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
24
+ "DEFINES_MODULE" => "YES",
25
+ }
26
+
27
+ s.dependency "Codepad"
28
+ end
package/README.md CHANGED
@@ -1,3 +1,81 @@
1
- # Temporary Holding Version
1
+ # react-native-codepad-lang-tsx
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Generated package. Do not edit by hand; run `yarn gen:languages` in the react-native-codepad repository.
4
+
5
+ Grammar: tree-sitter/tree-sitter-typescript at 75b3874edb2dc714fb1fd77a32013d0f8699989f. Queries: nvim-treesitter at e289100ff98969e118c702199d88b764ce9e7fdf.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ yarn add react-native-codepad react-native-codepad-lang-tsx
11
+ ```
12
+
13
+ Then pass `language="tsx"` to `CodeEditor`. Theme token keys this package produces:
14
+
15
+ ### tsx
16
+
17
+ - `attribute`
18
+ - `boolean`
19
+ - `character.special`
20
+ - `comment`
21
+ - `comment.documentation`
22
+ - `constant`
23
+ - `constant.builtin`
24
+ - `constructor`
25
+ - `function`
26
+ - `function.builtin`
27
+ - `function.call`
28
+ - `function.method`
29
+ - `function.method.call`
30
+ - `keyword`
31
+ - `keyword.conditional`
32
+ - `keyword.conditional.ternary`
33
+ - `keyword.coroutine`
34
+ - `keyword.directive`
35
+ - `keyword.exception`
36
+ - `keyword.function`
37
+ - `keyword.import`
38
+ - `keyword.modifier`
39
+ - `keyword.operator`
40
+ - `keyword.repeat`
41
+ - `keyword.return`
42
+ - `keyword.type`
43
+ - `label`
44
+ - `markup.heading`
45
+ - `markup.heading.1`
46
+ - `markup.heading.2`
47
+ - `markup.heading.3`
48
+ - `markup.heading.4`
49
+ - `markup.heading.5`
50
+ - `markup.heading.6`
51
+ - `markup.italic`
52
+ - `markup.link.label`
53
+ - `markup.raw`
54
+ - `markup.strikethrough`
55
+ - `markup.strong`
56
+ - `markup.underline`
57
+ - `module`
58
+ - `module.builtin`
59
+ - `none`
60
+ - `number`
61
+ - `operator`
62
+ - `punctuation.bracket`
63
+ - `punctuation.delimiter`
64
+ - `punctuation.special`
65
+ - `spell`
66
+ - `string`
67
+ - `string.escape`
68
+ - `string.regexp`
69
+ - `string.special.url`
70
+ - `tag`
71
+ - `tag.attribute`
72
+ - `tag.builtin`
73
+ - `tag.delimiter`
74
+ - `type`
75
+ - `type.builtin`
76
+ - `variable`
77
+ - `variable.builtin`
78
+ - `variable.member`
79
+ - `variable.parameter`
80
+
81
+ See the [languages guide](https://sectiontn.github.io/react-native-codepad/guides/languages/) for aliases, injections and themes.
@@ -0,0 +1,15 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ project(codepad_lang_tsx C)
3
+ set(GRAMMAR ${CMAKE_SOURCE_DIR}/../grammar)
4
+
5
+ add_library(codepad_lang_tsx SHARED
6
+ src/main/cpp/lang.c
7
+ ${GRAMMAR}/tsx/src/parser.c
8
+ ${GRAMMAR}/tsx/src/scanner.c
9
+ )
10
+
11
+ target_include_directories(codepad_lang_tsx PRIVATE ${GRAMMAR}/tsx/src)
12
+
13
+ # Parser tables are data. -O1 keeps large grammars from taking minutes to compile.
14
+ set_source_files_properties(${GRAMMAR}/tsx/src/parser.c PROPERTIES COMPILE_OPTIONS "-O1")
15
+ target_compile_options(codepad_lang_tsx PRIVATE -std=c11 -O2 -fvisibility=hidden -w)
@@ -0,0 +1,61 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+ dependencies {
7
+ classpath "com.android.tools.build:gradle:8.7.2"
8
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21"
9
+ }
10
+ }
11
+
12
+ apply plugin: "com.android.library"
13
+ if (project.extensions.findByName("kotlin") == null) {
14
+ apply plugin: "kotlin-android"
15
+ }
16
+ apply plugin: "com.facebook.react"
17
+
18
+ def safeExtGet(prop, fallback) {
19
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
20
+ }
21
+
22
+ def reactNativeArchitectures() {
23
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
24
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
25
+ }
26
+
27
+ android {
28
+ namespace "me.sectiontn.codepad.lang.tsx"
29
+ compileSdkVersion safeExtGet("compileSdkVersion", 36)
30
+
31
+ defaultConfig {
32
+ minSdkVersion safeExtGet("minSdkVersion", 24)
33
+ consumerProguardFiles "consumer-rules.pro"
34
+ externalNativeBuild {
35
+ cmake {
36
+ arguments "-DANDROID_STL=none", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
37
+ abiFilters(*reactNativeArchitectures())
38
+ }
39
+ }
40
+ }
41
+
42
+ if (rootProject.ext.has("ndkVersion")) {
43
+ ndkVersion rootProject.ext.ndkVersion
44
+ }
45
+
46
+ externalNativeBuild {
47
+ cmake {
48
+ path "CMakeLists.txt"
49
+ }
50
+ }
51
+
52
+ compileOptions {
53
+ sourceCompatibility JavaVersion.VERSION_17
54
+ targetCompatibility JavaVersion.VERSION_17
55
+ }
56
+ }
57
+
58
+ dependencies {
59
+ implementation "com.facebook.react:react-android"
60
+ implementation project(":react-native-codepad")
61
+ }
@@ -0,0 +1 @@
1
+ -keep class me.sectiontn.codepad.lang.tsx.TsxLanguage { *; }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,10 @@
1
+ #include <jni.h>
2
+ #include <stdint.h>
3
+
4
+ const void *tree_sitter_tsx(void);
5
+
6
+ JNIEXPORT jlong JNICALL Java_me_sectiontn_codepad_lang_tsx_TsxLanguage_nativeLanguage(JNIEnv *env, jobject thiz) {
7
+ (void) env;
8
+ (void) thiz;
9
+ return (jlong) (intptr_t) tree_sitter_tsx();
10
+ }
@@ -0,0 +1,13 @@
1
+ package me.sectiontn.codepad.lang.tsx
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfoProvider
7
+
8
+ // Empty package so React Native autolinking includes this Gradle module.
9
+ class CodepadLangTsxPackage : BaseReactPackage() {
10
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
11
+
12
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { HashMap() }
13
+ }