Skip to content

Commit

Permalink
Merge pull request #222 from wechat-miniprogram/feat-better-attribute…
Browse files Browse the repository at this point in the history
…-ast

feat: better WXML attribute AST
  • Loading branch information
LastLeaf authored Feb 19, 2025
2 parents 7e69769 + 97f1fdc commit aba6216
Show file tree
Hide file tree
Showing 7 changed files with 570 additions and 426 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: build-and-test
on:
push:
branches: ["master"]
pull_request:
branches:
- master
Expand All @@ -25,11 +26,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install
uses: pnpm/action-setup@v2
with:
version: latest
version: 9
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Setup wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
with:
version: 'v0.10.3'
version: 'v0.13.1'
- name: Build
run: |
pnpm -r run build
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ jobs:
uses: pnpm/action-setup@v2
with:
version: latest
- name: Setup node ${{ matrix.node-version }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 20
- name: Install
uses: pnpm/action-setup@v2
with:
version: latest
version: 9
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
Expand Down
8 changes: 6 additions & 2 deletions glass-easel-template-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"browser": "pkg/glass_easel_template_compiler.js",
"types": "pkg/glass_easel_template_compiler.d.ts",
"scripts": {
"build": "wasm-pack build --target bundler && rollup -o pkg/glass_easel_template_compiler_bg.cjs.js -f cjs pkg/glass_easel_template_compiler_bg.js"
}
"build": "wasm-pack build --target bundler && mv pkg/package.json pkg/package.json.orig && rollup -o pkg/glass_easel_template_compiler_bg.cjs.js -f cjs pkg/glass_easel_template_compiler_bg.js"
},
"sideEffects": [
"pkg/glass_easel_template_compiler.js",
"pkg/snippets/*"
]
}
13 changes: 0 additions & 13 deletions glass-easel-template-compiler/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@ use compact_str::CompactString;
use regex::{Captures, Regex};
use std::borrow::Cow;

pub(crate) fn escape_html_text(s: &str) -> Cow<'_, str> {
lazy_static! {
static ref REGEX: Regex = Regex::new("[<>\"&]").unwrap();
}
REGEX.replace_all(s, |caps: &Captures| match &caps[0] {
"<" => "&lt;".to_owned(),
">" => "&gt;".to_owned(),
"\"" => "&quot;".to_owned(),
"&" => "&amp;".to_owned(),
_ => unreachable!(),
})
}

pub(crate) fn escape_html_body(s: &str) -> Cow<'_, str> {
lazy_static! {
static ref REGEX: Regex = Regex::new("[<\"&]").unwrap();
Expand Down
Loading

0 comments on commit aba6216

Please sign in to comment.