Skip to content

Commit

Permalink
feat: 支持将样式编译成二进制文件
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Nov 28, 2024
1 parent 7f2ab36 commit 8d53ada
Show file tree
Hide file tree
Showing 9 changed files with 1,711 additions and 17 deletions.
68 changes: 67 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,70 @@
{
"rust-analyzer.showUnlinkedFileNotification": false,
"editor.tabSize": 2
"editor.tabSize": 2,
"files.associations": {
"string": "cpp",
"istream": "cpp",
"locale": "cpp",
"tuple": "cpp",
"vector": "cpp",
"__bit_reference": "cpp",
"__config": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__verbose_abort": "cpp",
"any": "cpp",
"array": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"execution": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"limits": "cpp",
"list": "cpp",
"map": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"regex": "cpp",
"set": "cpp",
"span": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string_view": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"valarray": "cpp",
"variant": "cpp",
"algorithm": "cpp"
}
}
55 changes: 44 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ style = "0.1.0"
pcre2 = "0.2.6"
regex = "1.10.3"
swc_core = { version = "0.90.24", features = ["__common", "ecma_transforms_typescript", "ecma_ast", "ecma_plugin_transform", "ecma_utils", "ecma_parser", "ecma_visit", "ecma_codegen", "__testing_transform"]}
flatbuffers = "24.3.25"

[build-dependencies]
napi-build = "2.0.1"
Expand Down
50 changes: 50 additions & 0 deletions flatbuffers/stylesheet.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
namespace Styles;

table String {
value:string;
}

table Integer {
value:uint32;
}

union Value {
String,
Integer,
Object
}

table KeyValue {
key:string;
value:Value;
}

table Object {
fields:[KeyValue];
}

table DeclarationTuple {
property_id:uint8;
value:Value;
}

table Selector {
string_value:string;
integer_value:uint32;
is_string:bool;
}

table Style {
declarations:[DeclarationTuple];
media:uint32;
selector:[Selector];
}

table StyleSheet {
fonts:[string];
keyframes:[string];
medias:[string];
styles:[Style];
}

root_type StyleSheet;
Loading

0 comments on commit 8d53ada

Please # to comment.