Upload 150 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- .github/workflows/main.yml +226 -0
- .github/workflows/wpt_diff_epoch.yml +345 -0
- .gitignore +19 -0
- .prettierignore +6 -0
- .zed/settings.json +9 -0
- CONTRIBUTOR_LICENSING.md +33 -0
- INTERCEPTION_PROXY_BIBLE.md +1 -0
- LICENSE +661 -0
- README.md +51 -10
- assets/scramjet.png +3 -0
- ci/buildstatic.sh +14 -0
- codespace-basic-setup.sh +14 -0
- documentation/README.md +0 -0
- eslint.config.mjs +67 -0
- lib/index.cjs +7 -0
- lib/index.d.ts +22 -0
- package.json +72 -0
- playwright.config.ts +52 -0
- pnpm-lock.yaml +0 -0
- pnpm-workspace.yaml +5 -0
- prettier.config.js +11 -0
- rewriter/Cargo.lock +1985 -0
- rewriter/Cargo.toml +20 -0
- rewriter/html/Cargo.toml +16 -0
- rewriter/html/src/changes.rs +154 -0
- rewriter/html/src/lib.rs +142 -0
- rewriter/html/src/rule.rs +40 -0
- rewriter/html/src/visitor.rs +365 -0
- rewriter/js/Cargo.toml +17 -0
- rewriter/js/src/cfg.rs +38 -0
- rewriter/js/src/changes.rs +215 -0
- rewriter/js/src/lib.rs +174 -0
- rewriter/js/src/rewrite.rs +152 -0
- rewriter/js/src/visitor.rs +313 -0
- rewriter/native/Cargo.toml +23 -0
- rewriter/native/flamegraph.svg +3 -0
- rewriter/native/sample/discord.js +0 -0
- rewriter/native/sample/google.js +0 -0
- rewriter/native/src/main.rs +180 -0
- rewriter/native/src/rewriter.rs +154 -0
- rewriter/native/src/test_runner.rs +110 -0
- rewriter/native/test.html +8 -0
- rewriter/native/test.js +36 -0
- rewriter/native/tests/0-sanity.js +5 -0
- rewriter/native/tests/1-destructure.js +3 -0
- rewriter/native/tests/2-function-default.js +6 -0
- rewriter/native/tests/3-shadow-globals.js +7 -0
- rewriter/native/tests/eval-overridden-globals.js.disabled +8 -0
- rewriter/native/tests/for-assignment.js.disabled +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
assets/scramjet.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
rewriter/native/flamegraph.svg filter=lfs diff=lfs merge=lfs -text
|
.github/workflows/main.yml
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: CI
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
paths-ignore:
|
6 |
+
- ".github/workflows/**"
|
7 |
+
pull_request:
|
8 |
+
paths-ignore:
|
9 |
+
- ".github/workflows/**"
|
10 |
+
workflow_dispatch:
|
11 |
+
|
12 |
+
concurrency:
|
13 |
+
group: ${{ github.workflow }}-${{ github.ref }}
|
14 |
+
cancel-in-progress: true
|
15 |
+
|
16 |
+
jobs:
|
17 |
+
build:
|
18 |
+
name: Build Scramjet
|
19 |
+
runs-on: ubuntu-latest
|
20 |
+
|
21 |
+
steps:
|
22 |
+
- name: Checkout code
|
23 |
+
uses: actions/checkout@v4
|
24 |
+
|
25 |
+
- name: Setup pnpm
|
26 |
+
uses: pnpm/action-setup@v4
|
27 |
+
with:
|
28 |
+
version: latest
|
29 |
+
|
30 |
+
- name: Setup Node.js
|
31 |
+
uses: actions/setup-node@v4
|
32 |
+
with:
|
33 |
+
node-version: "22"
|
34 |
+
cache: "pnpm"
|
35 |
+
|
36 |
+
- name: Install pnpm dependencies
|
37 |
+
run: pnpm install
|
38 |
+
|
39 |
+
- name: Cache Rust dependencies
|
40 |
+
uses: Swatinem/rust-cache@v2
|
41 |
+
with:
|
42 |
+
workspaces: "rewriter"
|
43 |
+
cache-all-crates: true
|
44 |
+
|
45 |
+
- name: Install wbg
|
46 |
+
uses: jetli/[email protected]
|
47 |
+
with:
|
48 |
+
version: "0.2.100"
|
49 |
+
|
50 |
+
- name: Setup Binaryen
|
51 |
+
uses: Aandreba/[email protected]
|
52 |
+
with:
|
53 |
+
token: ${{ github.token }}
|
54 |
+
|
55 |
+
- name: Setup wasm-snip
|
56 |
+
run: "cargo install --git https://github.com/r58playz/wasm-snip"
|
57 |
+
|
58 |
+
- name: Pack Scramjet
|
59 |
+
run: pnpm pack
|
60 |
+
|
61 |
+
- name: Upload Artifact (pnpm pack)
|
62 |
+
uses: actions/upload-artifact@v4
|
63 |
+
with:
|
64 |
+
name: packaged-scramjet
|
65 |
+
path: mercuryworkshop-scramjet-*.tgz
|
66 |
+
|
67 |
+
- name: Upload Artifact (dist)
|
68 |
+
uses: actions/upload-artifact@v4
|
69 |
+
with:
|
70 |
+
name: scramjet
|
71 |
+
path: |
|
72 |
+
dist/*.js
|
73 |
+
dist/*.js.map
|
74 |
+
dist/*.wasm
|
75 |
+
tests:
|
76 |
+
name: Run Scramjet Tests
|
77 |
+
runs-on: ubuntu-latest
|
78 |
+
needs: build
|
79 |
+
steps:
|
80 |
+
- name: Checkout code
|
81 |
+
uses: actions/checkout@v4
|
82 |
+
|
83 |
+
- name: Setup pnpm
|
84 |
+
uses: pnpm/action-setup@v4
|
85 |
+
with:
|
86 |
+
version: latest
|
87 |
+
|
88 |
+
- name: Setup Node.js
|
89 |
+
uses: actions/setup-node@v4
|
90 |
+
with:
|
91 |
+
node-version: "22"
|
92 |
+
cache: "pnpm"
|
93 |
+
|
94 |
+
- name: Install dependencies
|
95 |
+
run: pnpm install
|
96 |
+
|
97 |
+
- name: Get artifacts
|
98 |
+
uses: actions/download-artifact@v4
|
99 |
+
with:
|
100 |
+
name: scramjet
|
101 |
+
path: dist
|
102 |
+
|
103 |
+
- name: Install Playwright Browsers
|
104 |
+
run: npx playwright install --with-deps
|
105 |
+
|
106 |
+
- name: Run Playwright tests
|
107 |
+
run: pnpm test
|
108 |
+
|
109 |
+
upload:
|
110 |
+
name: Upload release
|
111 |
+
runs-on: ubuntu-latest
|
112 |
+
needs: [build, tests]
|
113 |
+
permissions: write-all
|
114 |
+
if: github.ref == 'refs/heads/main'
|
115 |
+
|
116 |
+
steps:
|
117 |
+
- name: Delete old release and tag
|
118 |
+
uses: dev-drprasad/[email protected]
|
119 |
+
with:
|
120 |
+
delete_release: true
|
121 |
+
tag_name: latest
|
122 |
+
github_token: ${{ github.token }}
|
123 |
+
|
124 |
+
- name: Get artifacts
|
125 |
+
uses: actions/download-artifact@v4
|
126 |
+
with:
|
127 |
+
name: packaged-scramjet
|
128 |
+
path: .
|
129 |
+
|
130 |
+
- name: Release to GitHub
|
131 |
+
uses: ncipollo/release-action@v1
|
132 |
+
with:
|
133 |
+
name: Continuous Build
|
134 |
+
tag: latest
|
135 |
+
commit: main
|
136 |
+
body: "${{ github.event.head_commit.url }} ${{ github.event.head_commit.message }}"
|
137 |
+
artifacts: "mercuryworkshop-scramjet-*.tgz"
|
138 |
+
prerelease: true
|
139 |
+
|
140 |
+
publish:
|
141 |
+
name: Publish Scramjet to NPM
|
142 |
+
runs-on: ubuntu-latest
|
143 |
+
needs: [build, tests]
|
144 |
+
if: false
|
145 |
+
permissions: write-all
|
146 |
+
steps:
|
147 |
+
- name: Setup Node.js
|
148 |
+
uses: actions/setup-node@v4
|
149 |
+
with:
|
150 |
+
node-version: "22"
|
151 |
+
registry-url: "https://registry.npmjs.org"
|
152 |
+
|
153 |
+
- name: Get artifacts
|
154 |
+
uses: actions/download-artifact@v4
|
155 |
+
with:
|
156 |
+
name: packaged-scramjet
|
157 |
+
path: .
|
158 |
+
|
159 |
+
- name: Extract package
|
160 |
+
run: tar xvf mercuryworkshop-scramjet-*.tgz package --strip-components=1
|
161 |
+
|
162 |
+
- name: Check the version
|
163 |
+
id: check
|
164 |
+
run: |
|
165 |
+
CURRENT_VERSION=$(jq -r .version package.json)
|
166 |
+
echo "Current version: $CURRENT_VERSION"
|
167 |
+
LATEST_VERSION=$(npm view @mercuryworkshop/scramjet version || echo "0.0.0")
|
168 |
+
echo "Latest NPM version: $LATEST_VERSION"
|
169 |
+
|
170 |
+
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ];
|
171 |
+
then
|
172 |
+
echo "Version changed"
|
173 |
+
echo "version_changed=true" >> $GITHUB_OUTPUT
|
174 |
+
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
175 |
+
else
|
176 |
+
echo "Version not changed"
|
177 |
+
echo "version_changed=false" >> $GITHUB_OUTPUT
|
178 |
+
fi
|
179 |
+
|
180 |
+
- name: Publish
|
181 |
+
if: steps.check.outputs.version_changed == 'true'
|
182 |
+
run: npm publish --access public --no-git-checks
|
183 |
+
env:
|
184 |
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
185 |
+
|
186 |
+
pages:
|
187 |
+
name: Upload to Github Pages
|
188 |
+
runs-on: ubuntu-latest
|
189 |
+
needs: [build, tests]
|
190 |
+
permissions: write-all
|
191 |
+
if: github.ref == 'refs/heads/main'
|
192 |
+
steps:
|
193 |
+
- name: Checkout code
|
194 |
+
uses: actions/checkout@v4
|
195 |
+
|
196 |
+
- name: Setup pnpm
|
197 |
+
uses: pnpm/action-setup@v4
|
198 |
+
with:
|
199 |
+
version: latest
|
200 |
+
|
201 |
+
- name: Setup Node.js
|
202 |
+
uses: actions/setup-node@v4
|
203 |
+
with:
|
204 |
+
node-version: "22"
|
205 |
+
cache: "pnpm"
|
206 |
+
|
207 |
+
- name: Install dependencies
|
208 |
+
run: pnpm install
|
209 |
+
|
210 |
+
- name: Get artifacts
|
211 |
+
uses: actions/download-artifact@v4
|
212 |
+
with:
|
213 |
+
name: scramjet
|
214 |
+
path: dist
|
215 |
+
|
216 |
+
- name: build statics
|
217 |
+
run: bash ./ci/buildstatic.sh
|
218 |
+
|
219 |
+
- name: upload pages artifact
|
220 |
+
uses: actions/upload-pages-artifact@v3
|
221 |
+
with:
|
222 |
+
path: "./staticbuild"
|
223 |
+
|
224 |
+
- name: deploy to github
|
225 |
+
id: deployment
|
226 |
+
uses: actions/deploy-pages@v4
|
.github/workflows/wpt_diff_epoch.yml
ADDED
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: WPT Test Results
|
2 |
+
|
3 |
+
on:
|
4 |
+
schedule:
|
5 |
+
# Every night at 0:30 UTC
|
6 |
+
- cron: "30 0 * * *"
|
7 |
+
workflow_dispatch:
|
8 |
+
inputs:
|
9 |
+
shard_count:
|
10 |
+
description: "Number of shards to run"
|
11 |
+
required: false
|
12 |
+
default: "2"
|
13 |
+
type: string
|
14 |
+
max_tests:
|
15 |
+
description: "Maximum total number of tests (divided across shards)"
|
16 |
+
required: false
|
17 |
+
default: ""
|
18 |
+
type: string
|
19 |
+
skip_combiner:
|
20 |
+
description: "Skip the report combination step"
|
21 |
+
required: false
|
22 |
+
default: false
|
23 |
+
type: boolean
|
24 |
+
|
25 |
+
jobs:
|
26 |
+
check-changes:
|
27 |
+
name: Check for changes
|
28 |
+
runs-on: ubuntu-latest
|
29 |
+
outputs:
|
30 |
+
should-run: ${{ steps.check.outputs.should-run }}
|
31 |
+
|
32 |
+
steps:
|
33 |
+
- name: Checkout
|
34 |
+
uses: actions/checkout@v4
|
35 |
+
with:
|
36 |
+
fetch-depth: 2
|
37 |
+
|
38 |
+
- name: Check for recent changes
|
39 |
+
id: check
|
40 |
+
run: |
|
41 |
+
# Check if there were any commits in the last day
|
42 |
+
SCRAMJET_CHANGED=$(git log --since="24 hours ago" --oneline | wc -l)
|
43 |
+
|
44 |
+
# Check WPT-diff repo
|
45 |
+
git clone --shallow-since="24 hours ago" https://github.com/MercuryWorkshop/WPT-diff.git wpt-diff-check
|
46 |
+
cd wpt-diff-check
|
47 |
+
WPTDIFF_CHANGED=$(git log --since="24 hours ago" --oneline | wc -l)
|
48 |
+
cd ..
|
49 |
+
|
50 |
+
# Check WPT upstream
|
51 |
+
# They are always committing (it must be the final hours of the world when they don't)
|
52 |
+
git clone --shallow-since="24 hours ago" https://github.com/web-platform-tests/wpt.git wpt-check
|
53 |
+
cd wpt-check
|
54 |
+
WPT_CHANGED=$(git log --since="24 hours ago" --oneline | wc -l)
|
55 |
+
cd ..
|
56 |
+
|
57 |
+
# Run tests if any repo has changes or if manually triggered
|
58 |
+
if [ "$SCRAMJET_CHANGED" -gt 0 ] || [ "$WPTDIFF_CHANGED" -gt 0 ] || [ "$WPT_CHANGED" -gt 0 ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
59 |
+
echo "should-run=true" >> "$GITHUB_OUTPUT"
|
60 |
+
echo "Changes detected or manually triggered (will run tests)"
|
61 |
+
else
|
62 |
+
echo "should-run=false" >> "$GITHUB_OUTPUT"
|
63 |
+
echo "No changes detected (skipping tests)"
|
64 |
+
fi
|
65 |
+
|
66 |
+
build-scramjet:
|
67 |
+
name: Build Scramjet
|
68 |
+
runs-on: ubuntu-latest
|
69 |
+
needs: check-changes
|
70 |
+
if: needs.check-changes.outputs.should-run == 'true'
|
71 |
+
|
72 |
+
steps:
|
73 |
+
- name: Checkout
|
74 |
+
uses: actions/checkout@v4
|
75 |
+
|
76 |
+
- name: Setup pnpm
|
77 |
+
uses: pnpm/action-setup@v4
|
78 |
+
with:
|
79 |
+
version: latest
|
80 |
+
|
81 |
+
- name: Setup Node.js
|
82 |
+
uses: actions/setup-node@v4
|
83 |
+
with:
|
84 |
+
node-version: 22
|
85 |
+
cache: pnpm
|
86 |
+
|
87 |
+
- name: Install dependencies
|
88 |
+
run: pnpm install
|
89 |
+
|
90 |
+
- name: Cache Rust dependencies
|
91 |
+
uses: Swatinem/rust-cache@v2
|
92 |
+
with:
|
93 |
+
workspaces: "rewriter"
|
94 |
+
cache-all-crates: true
|
95 |
+
env-vars: "CARGO CC CFLAGS CXX CMAKE RUST WASM_BINDGEN"
|
96 |
+
cache-targets: true
|
97 |
+
cache-bin: true
|
98 |
+
|
99 |
+
- name: Setup Rust toolchain
|
100 |
+
run: |
|
101 |
+
cd rewriter
|
102 |
+
rustup show
|
103 |
+
|
104 |
+
- name: Install wbg
|
105 |
+
uses: jetli/[email protected]
|
106 |
+
with:
|
107 |
+
version: 0.2.100
|
108 |
+
|
109 |
+
- name: Setup binaryen
|
110 |
+
uses: Aandreba/[email protected]
|
111 |
+
with:
|
112 |
+
token: ${{ github.token }}
|
113 |
+
|
114 |
+
- name: Install wasm-snip
|
115 |
+
run: cargo install --git https://github.com/r58playz/wasm-snip
|
116 |
+
|
117 |
+
- name: Pack Scramjet
|
118 |
+
run: pnpm pack
|
119 |
+
|
120 |
+
- name: Upload artifact (pnpm pack)
|
121 |
+
uses: actions/upload-artifact@v4
|
122 |
+
with:
|
123 |
+
name: packaged-scramjet
|
124 |
+
path: mercuryworkshop-scramjet-*.tgz
|
125 |
+
|
126 |
+
- name: Upload artifact (dist)
|
127 |
+
uses: actions/upload-artifact@v4
|
128 |
+
with:
|
129 |
+
name: scramjet-dist
|
130 |
+
path: |
|
131 |
+
dist/*.js
|
132 |
+
dist/*.js.map
|
133 |
+
dist/*.wasm
|
134 |
+
|
135 |
+
generate-matrix:
|
136 |
+
name: Generate shard matrix
|
137 |
+
runs-on: ubuntu-latest
|
138 |
+
needs: check-changes
|
139 |
+
if: needs.check-changes.outputs.should-run == 'true'
|
140 |
+
outputs:
|
141 |
+
shards: ${{ steps.generate.outputs.shards }}
|
142 |
+
steps:
|
143 |
+
- name: Generate shard list
|
144 |
+
id: generate
|
145 |
+
run: |
|
146 |
+
SHARD_COUNT="${{ github.event.inputs.shard_count || '2' }}"
|
147 |
+
SHARDS=$(seq -s'", "' 1 $SHARD_COUNT)
|
148 |
+
echo "shards=[\"$SHARDS\"]" >> "$GITHUB_OUTPUT"
|
149 |
+
|
150 |
+
run-wpt-tests:
|
151 |
+
name: WPT tests (shard ${{ matrix.shard }})
|
152 |
+
runs-on: ubuntu-latest
|
153 |
+
needs: [build-scramjet, generate-matrix]
|
154 |
+
timeout-minutes: 350
|
155 |
+
strategy:
|
156 |
+
matrix:
|
157 |
+
shard: ${{ fromJson(needs.generate-matrix.outputs.shards) }}
|
158 |
+
fail-fast: false
|
159 |
+
|
160 |
+
steps:
|
161 |
+
- name: Checkout
|
162 |
+
uses: actions/checkout@v4
|
163 |
+
|
164 |
+
- name: Download build artifacts
|
165 |
+
uses: actions/download-artifact@v4
|
166 |
+
with:
|
167 |
+
name: scramjet-dist
|
168 |
+
path: dist
|
169 |
+
|
170 |
+
- name: Setup pnpm
|
171 |
+
uses: pnpm/action-setup@v4
|
172 |
+
with:
|
173 |
+
version: latest
|
174 |
+
|
175 |
+
- name: Setup Node.js
|
176 |
+
uses: actions/setup-node@v4
|
177 |
+
with:
|
178 |
+
node-version: latest
|
179 |
+
cache: pnpm
|
180 |
+
|
181 |
+
- name: Setup Python
|
182 |
+
uses: actions/setup-python@v5
|
183 |
+
with:
|
184 |
+
python-version: "3.x"
|
185 |
+
|
186 |
+
- name: Install dependencies
|
187 |
+
run: pnpm install
|
188 |
+
|
189 |
+
- name: Checkout WPT-diff
|
190 |
+
uses: actions/checkout@v4
|
191 |
+
with:
|
192 |
+
repository: MercuryWorkshop/WPT-diff
|
193 |
+
path: wpt-diff
|
194 |
+
|
195 |
+
- name: Checkout WPT
|
196 |
+
uses: actions/checkout@v4
|
197 |
+
with:
|
198 |
+
repository: web-platform-tests/wpt
|
199 |
+
ref: epochs/daily
|
200 |
+
path: wpt-diff/wpt
|
201 |
+
fetch-depth: 1
|
202 |
+
|
203 |
+
- name: Setup WPT hosts
|
204 |
+
run: |
|
205 |
+
cd wpt-diff/wpt
|
206 |
+
./wpt make-hosts-file | sudo tee -a /etc/hosts
|
207 |
+
|
208 |
+
- name: Restore Playwright browsers cache
|
209 |
+
id: playwright-cache
|
210 |
+
uses: actions/cache/restore@v4
|
211 |
+
with:
|
212 |
+
path: |
|
213 |
+
~/.cache/ms-playwright
|
214 |
+
~/Library/Caches/ms-playwright
|
215 |
+
C:\\Users\\runneradmin\\AppData\\Local\\ms-playwright
|
216 |
+
key: ${{ runner.os }}-playwright-${{ hashFiles('wpt-diff/pnpm-lock.yaml') }}
|
217 |
+
restore-keys: |
|
218 |
+
${{ runner.os }}-playwright-
|
219 |
+
|
220 |
+
- name: Restore Typia validators cache
|
221 |
+
id: typia-cache
|
222 |
+
uses: actions/cache/restore@v4
|
223 |
+
with:
|
224 |
+
path: wpt-diff/generatedValidators/
|
225 |
+
key: ${{ runner.os }}-typia-${{ hashFiles('wpt-diff/src/util/validators/**/*.ts', 'wpt-diff/types/**/*.ts', 'wpt-diff/tsconfig.json') }}
|
226 |
+
restore-keys: |
|
227 |
+
${{ runner.os }}-typia-
|
228 |
+
|
229 |
+
- name: Setup WPT-diff dependencies
|
230 |
+
run: |
|
231 |
+
cd wpt-diff
|
232 |
+
pnpm install
|
233 |
+
# Install Playwright browsers only if cache miss
|
234 |
+
if [ "${{ steps.playwright-cache.outputs.cache-hit }}" != 'true' ]; then
|
235 |
+
pnpm exec playwright install chromium
|
236 |
+
fi
|
237 |
+
# Generate validators only if cache miss
|
238 |
+
if [ "${{ steps.typia-cache.outputs.cache-hit }}" != 'true' ]; then
|
239 |
+
pnpm generate:validators
|
240 |
+
fi
|
241 |
+
|
242 |
+
- name: Save Playwright browsers cache
|
243 |
+
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
244 |
+
uses: actions/cache/save@v4
|
245 |
+
with:
|
246 |
+
path: |
|
247 |
+
~/.cache/ms-playwright
|
248 |
+
~/Library/Caches/ms-playwright
|
249 |
+
C:\\Users\\runneradmin\\AppData\\Local\\ms-playwright
|
250 |
+
key: ${{ runner.os }}-playwright-${{ hashFiles('wpt-diff/pnpm-lock.yaml') }}
|
251 |
+
|
252 |
+
- name: Save Typia validators cache
|
253 |
+
if: steps.typia-cache.outputs.cache-hit != 'true'
|
254 |
+
uses: actions/cache/save@v4
|
255 |
+
with:
|
256 |
+
path: wpt-diff/generatedValidators/
|
257 |
+
key: ${{ runner.os }}-typia-${{ hashFiles('wpt-diff/src/util/validators/**/*.ts', 'wpt-diff/types/**/*.ts', 'wpt-diff/tsconfig.json') }}
|
258 |
+
|
259 |
+
- name: Start Scramjet demo server
|
260 |
+
run: |
|
261 |
+
pnpm start &
|
262 |
+
DEMO_PID="$!"
|
263 |
+
echo "DEMO_PID=$DEMO_PID" >> "$GITHUB_ENV"
|
264 |
+
|
265 |
+
- name: Generate WPT-diff config
|
266 |
+
working-directory: wpt-diff
|
267 |
+
run: |
|
268 |
+
cat > config.toml << EOF
|
269 |
+
[debug]
|
270 |
+
debug = true
|
271 |
+
verbose = true
|
272 |
+
|
273 |
+
[wpt]
|
274 |
+
max_tests = "all"
|
275 |
+
under_proxy = true
|
276 |
+
|
277 |
+
[wpt.urls]
|
278 |
+
proxy_base_url = "http://localhost:1337/"
|
279 |
+
tests_base_url = "http://web-platform.test:8000"
|
280 |
+
api_base_url = "https://wpt.fyi"
|
281 |
+
EOF
|
282 |
+
|
283 |
+
- name: Start WPT server
|
284 |
+
working-directory: wpt-diff/wpt
|
285 |
+
run: |
|
286 |
+
./wpt serve --no-h2 &
|
287 |
+
echo "WPT_PID=$!" >> "$GITHUB_ENV"
|
288 |
+
|
289 |
+
- name: Install xvfb
|
290 |
+
run: sudo apt install -y xvfb
|
291 |
+
|
292 |
+
- name: Run WPT tests
|
293 |
+
working-directory: wpt-diff
|
294 |
+
env:
|
295 |
+
CI: true
|
296 |
+
SHARD_COUNT: ${{ github.event.inputs.shard_count || '2' }}
|
297 |
+
MAX_TESTS_ARG: ${{ github.event.inputs.max_tests != '' && format('--max-tests {0}', github.event.inputs.max_tests) || '' }}
|
298 |
+
run: |
|
299 |
+
xvfb-run --auto-servernum pnpm start --report "wpt-report.json" --output-failed "failed-tests.json" --shard "${{ matrix.shard }}" --total-shards "$SHARD_COUNT" $MAX_TESTS_ARG
|
300 |
+
|
301 |
+
- name: Stop Scramjet demo server
|
302 |
+
if: always()
|
303 |
+
run: |
|
304 |
+
if [ -n "$DEMO_PID" ]; then
|
305 |
+
kill "$DEMO_PID" || true
|
306 |
+
fi
|
307 |
+
|
308 |
+
- name: Stop WPT server
|
309 |
+
if: always()
|
310 |
+
run: |
|
311 |
+
if [ -n "$WPT_PID" ]; then
|
312 |
+
kill "$WPT_PID" || true
|
313 |
+
fi
|
314 |
+
|
315 |
+
- name: Upload test results
|
316 |
+
uses: actions/upload-artifact@v4
|
317 |
+
with:
|
318 |
+
name: wpt-test-results-shard-${{ matrix.shard }}
|
319 |
+
path: |
|
320 |
+
wpt-diff/wpt-report-diff.json
|
321 |
+
wpt-diff/wpt-report-proxy.json
|
322 |
+
wpt-diff/failed-tests.json
|
323 |
+
|
324 |
+
combine-and-upload-reports:
|
325 |
+
name: Combine and upload reports
|
326 |
+
needs: [build-scramjet, generate-matrix, run-wpt-tests]
|
327 |
+
if: ${{ !cancelled() && needs.run-wpt-tests.result != 'failure' && github.event.inputs.skip_combiner != 'true' }}
|
328 |
+
runs-on: ubuntu-latest
|
329 |
+
|
330 |
+
steps:
|
331 |
+
- name: Checkout WPT-diff
|
332 |
+
uses: actions/checkout@v4
|
333 |
+
with:
|
334 |
+
repository: MercuryWorkshop/WPT-diff
|
335 |
+
path: wpt-diff
|
336 |
+
|
337 |
+
- name: Combine reports and run regression check
|
338 |
+
uses: ./wpt-diff/
|
339 |
+
with:
|
340 |
+
location: wpt-diff
|
341 |
+
enable_regression_check: false
|
342 |
+
github_repository: MercuryWorkshop/WPT-diff
|
343 |
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
344 |
+
regression_check_workflow_name: "WPT Test Results"
|
345 |
+
artifact_name: wpt-test-reports
|
.gitignore
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_modules
|
2 |
+
dist
|
3 |
+
static/scramjet*
|
4 |
+
static/bare-mux.js
|
5 |
+
static/bare-client.js
|
6 |
+
static/curl-client.js
|
7 |
+
static/epoxy-client.js
|
8 |
+
static/bare-mux-worker.js
|
9 |
+
meta.json
|
10 |
+
rewriter/target
|
11 |
+
rewriter/wasm/out
|
12 |
+
static/wasm.js
|
13 |
+
rewriter/*.js
|
14 |
+
pnpm-lock.yaml
|
15 |
+
playwright-report
|
16 |
+
test-results
|
17 |
+
*.tgz
|
18 |
+
package-lock.json
|
19 |
+
rebuild.sh
|
.prettierignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pnpm-lock.yaml
|
2 |
+
README.md
|
3 |
+
tsconfig.json
|
4 |
+
tests/
|
5 |
+
dist/
|
6 |
+
rewriter/
|
.zed/settings.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"lsp": {
|
3 |
+
"biome": {
|
4 |
+
"enabled": false
|
5 |
+
}
|
6 |
+
},
|
7 |
+
"format_on_save": "on",
|
8 |
+
"formatter": "prettier"
|
9 |
+
}
|
CONTRIBUTOR_LICENSING.md
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# What is this / Why do we need it
|
2 |
+
|
3 |
+
Agreeing to these terms allows us (Mercury Workshop) to use the code you contribute to the project without restrictions.
|
4 |
+
|
5 |
+
This is necessary for us to use the software commercially and avoid frivolous legal complaints
|
6 |
+
|
7 |
+
This does **not** transfer ownership of your code to Mercury Workshop.
|
8 |
+
|
9 |
+
# Contributor License Agreement
|
10 |
+
|
11 |
+
In order to clarify the intellectual property license granted with Contributions from any person or entity, Mercury Workshop Inc must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Mercury Workshop; it does not change your rights to use your own Contributions for any other purpose.
|
12 |
+
|
13 |
+
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Mercury Workshop. Except for the license granted herein to Mercury Workshop and recipients of software distributed by Mercury Workshop, You reserve all right, title, and interest in and to Your Contributions.
|
14 |
+
|
15 |
+
# Definitions
|
16 |
+
|
17 |
+
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Mercury Workshop Inc. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
18 |
+
|
19 |
+
"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Mercury Workshop Inc for inclusion in, or documentation of, any of the products owned or managed by Mercury Workshop Inc (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Mercury Workshop Inc or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Mercury Workshop Inc for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
|
20 |
+
|
21 |
+
Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Mercury Workshop Inc and to recipients of software distributed by Mercury Workshop Inc a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
|
22 |
+
|
23 |
+
Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Mercury Workshop Inc and to recipients of software distributed by Mercury Workshop Inc a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
|
24 |
+
|
25 |
+
You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Mercury Workshop Inc, or that your employer has executed a separate Corporate CLA with Mercury Workshop Inc.
|
26 |
+
|
27 |
+
You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
|
28 |
+
|
29 |
+
You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
|
30 |
+
|
31 |
+
Should You wish to submit work that is not Your original creation, You may submit it to Mercury Workshop Inc separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
|
32 |
+
|
33 |
+
You agree to notify Mercury Workshop Inc of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
|
INTERCEPTION_PROXY_BIBLE.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# The Interception Proxy Bible
|
LICENSE
ADDED
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 19 November 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU Affero General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works, specifically designed to ensure
|
12 |
+
cooperation with the community in the case of network server software.
|
13 |
+
|
14 |
+
The licenses for most software and other practical works are designed
|
15 |
+
to take away your freedom to share and change the works. By contrast,
|
16 |
+
our General Public Licenses are intended to guarantee your freedom to
|
17 |
+
share and change all versions of a program--to make sure it remains free
|
18 |
+
software for all its users.
|
19 |
+
|
20 |
+
When we speak of free software, we are referring to freedom, not
|
21 |
+
price. Our General Public Licenses are designed to make sure that you
|
22 |
+
have the freedom to distribute copies of free software (and charge for
|
23 |
+
them if you wish), that you receive source code or can get it if you
|
24 |
+
want it, that you can change the software or use pieces of it in new
|
25 |
+
free programs, and that you know you can do these things.
|
26 |
+
|
27 |
+
Developers that use our General Public Licenses protect your rights
|
28 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
29 |
+
you this License which gives you legal permission to copy, distribute
|
30 |
+
and/or modify the software.
|
31 |
+
|
32 |
+
A secondary benefit of defending all users' freedom is that
|
33 |
+
improvements made in alternate versions of the program, if they
|
34 |
+
receive widespread use, become available for other developers to
|
35 |
+
incorporate. Many developers of free software are heartened and
|
36 |
+
encouraged by the resulting cooperation. However, in the case of
|
37 |
+
software used on network servers, this result may fail to come about.
|
38 |
+
The GNU General Public License permits making a modified version and
|
39 |
+
letting the public access it on a server without ever releasing its
|
40 |
+
source code to the public.
|
41 |
+
|
42 |
+
The GNU Affero General Public License is designed specifically to
|
43 |
+
ensure that, in such cases, the modified source code becomes available
|
44 |
+
to the community. It requires the operator of a network server to
|
45 |
+
provide the source code of the modified version running there to the
|
46 |
+
users of that server. Therefore, public use of a modified version, on
|
47 |
+
a publicly accessible server, gives the public access to the source
|
48 |
+
code of the modified version.
|
49 |
+
|
50 |
+
An older license, called the Affero General Public License and
|
51 |
+
published by Affero, was designed to accomplish similar goals. This is
|
52 |
+
a different license, not a version of the Affero GPL, but Affero has
|
53 |
+
released a new version of the Affero GPL which permits relicensing under
|
54 |
+
this license.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
TERMS AND CONDITIONS
|
60 |
+
|
61 |
+
0. Definitions.
|
62 |
+
|
63 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
64 |
+
|
65 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
66 |
+
works, such as semiconductor masks.
|
67 |
+
|
68 |
+
"The Program" refers to any copyrightable work licensed under this
|
69 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
70 |
+
"recipients" may be individuals or organizations.
|
71 |
+
|
72 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
73 |
+
in a fashion requiring copyright permission, other than the making of an
|
74 |
+
exact copy. The resulting work is called a "modified version" of the
|
75 |
+
earlier work or a work "based on" the earlier work.
|
76 |
+
|
77 |
+
A "covered work" means either the unmodified Program or a work based
|
78 |
+
on the Program.
|
79 |
+
|
80 |
+
To "propagate" a work means to do anything with it that, without
|
81 |
+
permission, would make you directly or secondarily liable for
|
82 |
+
infringement under applicable copyright law, except executing it on a
|
83 |
+
computer or modifying a private copy. Propagation includes copying,
|
84 |
+
distribution (with or without modification), making available to the
|
85 |
+
public, and in some countries other activities as well.
|
86 |
+
|
87 |
+
To "convey" a work means any kind of propagation that enables other
|
88 |
+
parties to make or receive copies. Mere interaction with a user through
|
89 |
+
a computer network, with no transfer of a copy, is not conveying.
|
90 |
+
|
91 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
92 |
+
to the extent that it includes a convenient and prominently visible
|
93 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
94 |
+
tells the user that there is no warranty for the work (except to the
|
95 |
+
extent that warranties are provided), that licensees may convey the
|
96 |
+
work under this License, and how to view a copy of this License. If
|
97 |
+
the interface presents a list of user commands or options, such as a
|
98 |
+
menu, a prominent item in the list meets this criterion.
|
99 |
+
|
100 |
+
1. Source Code.
|
101 |
+
|
102 |
+
The "source code" for a work means the preferred form of the work
|
103 |
+
for making modifications to it. "Object code" means any non-source
|
104 |
+
form of a work.
|
105 |
+
|
106 |
+
A "Standard Interface" means an interface that either is an official
|
107 |
+
standard defined by a recognized standards body, or, in the case of
|
108 |
+
interfaces specified for a particular programming language, one that
|
109 |
+
is widely used among developers working in that language.
|
110 |
+
|
111 |
+
The "System Libraries" of an executable work include anything, other
|
112 |
+
than the work as a whole, that (a) is included in the normal form of
|
113 |
+
packaging a Major Component, but which is not part of that Major
|
114 |
+
Component, and (b) serves only to enable use of the work with that
|
115 |
+
Major Component, or to implement a Standard Interface for which an
|
116 |
+
implementation is available to the public in source code form. A
|
117 |
+
"Major Component", in this context, means a major essential component
|
118 |
+
(kernel, window system, and so on) of the specific operating system
|
119 |
+
(if any) on which the executable work runs, or a compiler used to
|
120 |
+
produce the work, or an object code interpreter used to run it.
|
121 |
+
|
122 |
+
The "Corresponding Source" for a work in object code form means all
|
123 |
+
the source code needed to generate, install, and (for an executable
|
124 |
+
work) run the object code and to modify the work, including scripts to
|
125 |
+
control those activities. However, it does not include the work's
|
126 |
+
System Libraries, or general-purpose tools or generally available free
|
127 |
+
programs which are used unmodified in performing those activities but
|
128 |
+
which are not part of the work. For example, Corresponding Source
|
129 |
+
includes interface definition files associated with source files for
|
130 |
+
the work, and the source code for shared libraries and dynamically
|
131 |
+
linked subprograms that the work is specifically designed to require,
|
132 |
+
such as by intimate data communication or control flow between those
|
133 |
+
subprograms and other parts of the work.
|
134 |
+
|
135 |
+
The Corresponding Source need not include anything that users
|
136 |
+
can regenerate automatically from other parts of the Corresponding
|
137 |
+
Source.
|
138 |
+
|
139 |
+
The Corresponding Source for a work in source code form is that
|
140 |
+
same work.
|
141 |
+
|
142 |
+
2. Basic Permissions.
|
143 |
+
|
144 |
+
All rights granted under this License are granted for the term of
|
145 |
+
copyright on the Program, and are irrevocable provided the stated
|
146 |
+
conditions are met. This License explicitly affirms your unlimited
|
147 |
+
permission to run the unmodified Program. The output from running a
|
148 |
+
covered work is covered by this License only if the output, given its
|
149 |
+
content, constitutes a covered work. This License acknowledges your
|
150 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
151 |
+
|
152 |
+
You may make, run and propagate covered works that you do not
|
153 |
+
convey, without conditions so long as your license otherwise remains
|
154 |
+
in force. You may convey covered works to others for the sole purpose
|
155 |
+
of having them make modifications exclusively for you, or provide you
|
156 |
+
with facilities for running those works, provided that you comply with
|
157 |
+
the terms of this License in conveying all material for which you do
|
158 |
+
not control copyright. Those thus making or running the covered works
|
159 |
+
for you must do so exclusively on your behalf, under your direction
|
160 |
+
and control, on terms that prohibit them from making any copies of
|
161 |
+
your copyrighted material outside their relationship with you.
|
162 |
+
|
163 |
+
Conveying under any other circumstances is permitted solely under
|
164 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
165 |
+
makes it unnecessary.
|
166 |
+
|
167 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
168 |
+
|
169 |
+
No covered work shall be deemed part of an effective technological
|
170 |
+
measure under any applicable law fulfilling obligations under article
|
171 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
172 |
+
similar laws prohibiting or restricting circumvention of such
|
173 |
+
measures.
|
174 |
+
|
175 |
+
When you convey a covered work, you waive any legal power to forbid
|
176 |
+
circumvention of technological measures to the extent such circumvention
|
177 |
+
is effected by exercising rights under this License with respect to
|
178 |
+
the covered work, and you disclaim any intention to limit operation or
|
179 |
+
modification of the work as a means of enforcing, against the work's
|
180 |
+
users, your or third parties' legal rights to forbid circumvention of
|
181 |
+
technological measures.
|
182 |
+
|
183 |
+
4. Conveying Verbatim Copies.
|
184 |
+
|
185 |
+
You may convey verbatim copies of the Program's source code as you
|
186 |
+
receive it, in any medium, provided that you conspicuously and
|
187 |
+
appropriately publish on each copy an appropriate copyright notice;
|
188 |
+
keep intact all notices stating that this License and any
|
189 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
190 |
+
keep intact all notices of the absence of any warranty; and give all
|
191 |
+
recipients a copy of this License along with the Program.
|
192 |
+
|
193 |
+
You may charge any price or no price for each copy that you convey,
|
194 |
+
and you may offer support or warranty protection for a fee.
|
195 |
+
|
196 |
+
5. Conveying Modified Source Versions.
|
197 |
+
|
198 |
+
You may convey a work based on the Program, or the modifications to
|
199 |
+
produce it from the Program, in the form of source code under the
|
200 |
+
terms of section 4, provided that you also meet all of these conditions:
|
201 |
+
|
202 |
+
a) The work must carry prominent notices stating that you modified
|
203 |
+
it, and giving a relevant date.
|
204 |
+
|
205 |
+
b) The work must carry prominent notices stating that it is
|
206 |
+
released under this License and any conditions added under section
|
207 |
+
7. This requirement modifies the requirement in section 4 to
|
208 |
+
"keep intact all notices".
|
209 |
+
|
210 |
+
c) You must license the entire work, as a whole, under this
|
211 |
+
License to anyone who comes into possession of a copy. This
|
212 |
+
License will therefore apply, along with any applicable section 7
|
213 |
+
additional terms, to the whole of the work, and all its parts,
|
214 |
+
regardless of how they are packaged. This License gives no
|
215 |
+
permission to license the work in any other way, but it does not
|
216 |
+
invalidate such permission if you have separately received it.
|
217 |
+
|
218 |
+
d) If the work has interactive user interfaces, each must display
|
219 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
220 |
+
interfaces that do not display Appropriate Legal Notices, your
|
221 |
+
work need not make them do so.
|
222 |
+
|
223 |
+
A compilation of a covered work with other separate and independent
|
224 |
+
works, which are not by their nature extensions of the covered work,
|
225 |
+
and which are not combined with it such as to form a larger program,
|
226 |
+
in or on a volume of a storage or distribution medium, is called an
|
227 |
+
"aggregate" if the compilation and its resulting copyright are not
|
228 |
+
used to limit the access or legal rights of the compilation's users
|
229 |
+
beyond what the individual works permit. Inclusion of a covered work
|
230 |
+
in an aggregate does not cause this License to apply to the other
|
231 |
+
parts of the aggregate.
|
232 |
+
|
233 |
+
6. Conveying Non-Source Forms.
|
234 |
+
|
235 |
+
You may convey a covered work in object code form under the terms
|
236 |
+
of sections 4 and 5, provided that you also convey the
|
237 |
+
machine-readable Corresponding Source under the terms of this License,
|
238 |
+
in one of these ways:
|
239 |
+
|
240 |
+
a) Convey the object code in, or embodied in, a physical product
|
241 |
+
(including a physical distribution medium), accompanied by the
|
242 |
+
Corresponding Source fixed on a durable physical medium
|
243 |
+
customarily used for software interchange.
|
244 |
+
|
245 |
+
b) Convey the object code in, or embodied in, a physical product
|
246 |
+
(including a physical distribution medium), accompanied by a
|
247 |
+
written offer, valid for at least three years and valid for as
|
248 |
+
long as you offer spare parts or customer support for that product
|
249 |
+
model, to give anyone who possesses the object code either (1) a
|
250 |
+
copy of the Corresponding Source for all the software in the
|
251 |
+
product that is covered by this License, on a durable physical
|
252 |
+
medium customarily used for software interchange, for a price no
|
253 |
+
more than your reasonable cost of physically performing this
|
254 |
+
conveying of source, or (2) access to copy the
|
255 |
+
Corresponding Source from a network server at no charge.
|
256 |
+
|
257 |
+
c) Convey individual copies of the object code with a copy of the
|
258 |
+
written offer to provide the Corresponding Source. This
|
259 |
+
alternative is allowed only occasionally and noncommercially, and
|
260 |
+
only if you received the object code with such an offer, in accord
|
261 |
+
with subsection 6b.
|
262 |
+
|
263 |
+
d) Convey the object code by offering access from a designated
|
264 |
+
place (gratis or for a charge), and offer equivalent access to the
|
265 |
+
Corresponding Source in the same way through the same place at no
|
266 |
+
further charge. You need not require recipients to copy the
|
267 |
+
Corresponding Source along with the object code. If the place to
|
268 |
+
copy the object code is a network server, the Corresponding Source
|
269 |
+
may be on a different server (operated by you or a third party)
|
270 |
+
that supports equivalent copying facilities, provided you maintain
|
271 |
+
clear directions next to the object code saying where to find the
|
272 |
+
Corresponding Source. Regardless of what server hosts the
|
273 |
+
Corresponding Source, you remain obligated to ensure that it is
|
274 |
+
available for as long as needed to satisfy these requirements.
|
275 |
+
|
276 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
277 |
+
you inform other peers where the object code and Corresponding
|
278 |
+
Source of the work are being offered to the general public at no
|
279 |
+
charge under subsection 6d.
|
280 |
+
|
281 |
+
A separable portion of the object code, whose source code is excluded
|
282 |
+
from the Corresponding Source as a System Library, need not be
|
283 |
+
included in conveying the object code work.
|
284 |
+
|
285 |
+
A "User Product" is either (1) a "consumer product", which means any
|
286 |
+
tangible personal property which is normally used for personal, family,
|
287 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
288 |
+
into a dwelling. In determining whether a product is a consumer product,
|
289 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
290 |
+
product received by a particular user, "normally used" refers to a
|
291 |
+
typical or common use of that class of product, regardless of the status
|
292 |
+
of the particular user or of the way in which the particular user
|
293 |
+
actually uses, or expects or is expected to use, the product. A product
|
294 |
+
is a consumer product regardless of whether the product has substantial
|
295 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
296 |
+
the only significant mode of use of the product.
|
297 |
+
|
298 |
+
"Installation Information" for a User Product means any methods,
|
299 |
+
procedures, authorization keys, or other information required to install
|
300 |
+
and execute modified versions of a covered work in that User Product from
|
301 |
+
a modified version of its Corresponding Source. The information must
|
302 |
+
suffice to ensure that the continued functioning of the modified object
|
303 |
+
code is in no case prevented or interfered with solely because
|
304 |
+
modification has been made.
|
305 |
+
|
306 |
+
If you convey an object code work under this section in, or with, or
|
307 |
+
specifically for use in, a User Product, and the conveying occurs as
|
308 |
+
part of a transaction in which the right of possession and use of the
|
309 |
+
User Product is transferred to the recipient in perpetuity or for a
|
310 |
+
fixed term (regardless of how the transaction is characterized), the
|
311 |
+
Corresponding Source conveyed under this section must be accompanied
|
312 |
+
by the Installation Information. But this requirement does not apply
|
313 |
+
if neither you nor any third party retains the ability to install
|
314 |
+
modified object code on the User Product (for example, the work has
|
315 |
+
been installed in ROM).
|
316 |
+
|
317 |
+
The requirement to provide Installation Information does not include a
|
318 |
+
requirement to continue to provide support service, warranty, or updates
|
319 |
+
for a work that has been modified or installed by the recipient, or for
|
320 |
+
the User Product in which it has been modified or installed. Access to a
|
321 |
+
network may be denied when the modification itself materially and
|
322 |
+
adversely affects the operation of the network or violates the rules and
|
323 |
+
protocols for communication across the network.
|
324 |
+
|
325 |
+
Corresponding Source conveyed, and Installation Information provided,
|
326 |
+
in accord with this section must be in a format that is publicly
|
327 |
+
documented (and with an implementation available to the public in
|
328 |
+
source code form), and must require no special password or key for
|
329 |
+
unpacking, reading or copying.
|
330 |
+
|
331 |
+
7. Additional Terms.
|
332 |
+
|
333 |
+
"Additional permissions" are terms that supplement the terms of this
|
334 |
+
License by making exceptions from one or more of its conditions.
|
335 |
+
Additional permissions that are applicable to the entire Program shall
|
336 |
+
be treated as though they were included in this License, to the extent
|
337 |
+
that they are valid under applicable law. If additional permissions
|
338 |
+
apply only to part of the Program, that part may be used separately
|
339 |
+
under those permissions, but the entire Program remains governed by
|
340 |
+
this License without regard to the additional permissions.
|
341 |
+
|
342 |
+
When you convey a copy of a covered work, you may at your option
|
343 |
+
remove any additional permissions from that copy, or from any part of
|
344 |
+
it. (Additional permissions may be written to require their own
|
345 |
+
removal in certain cases when you modify the work.) You may place
|
346 |
+
additional permissions on material, added by you to a covered work,
|
347 |
+
for which you have or can give appropriate copyright permission.
|
348 |
+
|
349 |
+
Notwithstanding any other provision of this License, for material you
|
350 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
351 |
+
that material) supplement the terms of this License with terms:
|
352 |
+
|
353 |
+
a) Disclaiming warranty or limiting liability differently from the
|
354 |
+
terms of sections 15 and 16 of this License; or
|
355 |
+
|
356 |
+
b) Requiring preservation of specified reasonable legal notices or
|
357 |
+
author attributions in that material or in the Appropriate Legal
|
358 |
+
Notices displayed by works containing it; or
|
359 |
+
|
360 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
361 |
+
requiring that modified versions of such material be marked in
|
362 |
+
reasonable ways as different from the original version; or
|
363 |
+
|
364 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
365 |
+
authors of the material; or
|
366 |
+
|
367 |
+
e) Declining to grant rights under trademark law for use of some
|
368 |
+
trade names, trademarks, or service marks; or
|
369 |
+
|
370 |
+
f) Requiring indemnification of licensors and authors of that
|
371 |
+
material by anyone who conveys the material (or modified versions of
|
372 |
+
it) with contractual assumptions of liability to the recipient, for
|
373 |
+
any liability that these contractual assumptions directly impose on
|
374 |
+
those licensors and authors.
|
375 |
+
|
376 |
+
All other non-permissive additional terms are considered "further
|
377 |
+
restrictions" within the meaning of section 10. If the Program as you
|
378 |
+
received it, or any part of it, contains a notice stating that it is
|
379 |
+
governed by this License along with a term that is a further
|
380 |
+
restriction, you may remove that term. If a license document contains
|
381 |
+
a further restriction but permits relicensing or conveying under this
|
382 |
+
License, you may add to a covered work material governed by the terms
|
383 |
+
of that license document, provided that the further restriction does
|
384 |
+
not survive such relicensing or conveying.
|
385 |
+
|
386 |
+
If you add terms to a covered work in accord with this section, you
|
387 |
+
must place, in the relevant source files, a statement of the
|
388 |
+
additional terms that apply to those files, or a notice indicating
|
389 |
+
where to find the applicable terms.
|
390 |
+
|
391 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
392 |
+
form of a separately written license, or stated as exceptions;
|
393 |
+
the above requirements apply either way.
|
394 |
+
|
395 |
+
8. Termination.
|
396 |
+
|
397 |
+
You may not propagate or modify a covered work except as expressly
|
398 |
+
provided under this License. Any attempt otherwise to propagate or
|
399 |
+
modify it is void, and will automatically terminate your rights under
|
400 |
+
this License (including any patent licenses granted under the third
|
401 |
+
paragraph of section 11).
|
402 |
+
|
403 |
+
However, if you cease all violation of this License, then your
|
404 |
+
license from a particular copyright holder is reinstated (a)
|
405 |
+
provisionally, unless and until the copyright holder explicitly and
|
406 |
+
finally terminates your license, and (b) permanently, if the copyright
|
407 |
+
holder fails to notify you of the violation by some reasonable means
|
408 |
+
prior to 60 days after the cessation.
|
409 |
+
|
410 |
+
Moreover, your license from a particular copyright holder is
|
411 |
+
reinstated permanently if the copyright holder notifies you of the
|
412 |
+
violation by some reasonable means, this is the first time you have
|
413 |
+
received notice of violation of this License (for any work) from that
|
414 |
+
copyright holder, and you cure the violation prior to 30 days after
|
415 |
+
your receipt of the notice.
|
416 |
+
|
417 |
+
Termination of your rights under this section does not terminate the
|
418 |
+
licenses of parties who have received copies or rights from you under
|
419 |
+
this License. If your rights have been terminated and not permanently
|
420 |
+
reinstated, you do not qualify to receive new licenses for the same
|
421 |
+
material under section 10.
|
422 |
+
|
423 |
+
9. Acceptance Not Required for Having Copies.
|
424 |
+
|
425 |
+
You are not required to accept this License in order to receive or
|
426 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
427 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
428 |
+
to receive a copy likewise does not require acceptance. However,
|
429 |
+
nothing other than this License grants you permission to propagate or
|
430 |
+
modify any covered work. These actions infringe copyright if you do
|
431 |
+
not accept this License. Therefore, by modifying or propagating a
|
432 |
+
covered work, you indicate your acceptance of this License to do so.
|
433 |
+
|
434 |
+
10. Automatic Licensing of Downstream Recipients.
|
435 |
+
|
436 |
+
Each time you convey a covered work, the recipient automatically
|
437 |
+
receives a license from the original licensors, to run, modify and
|
438 |
+
propagate that work, subject to this License. You are not responsible
|
439 |
+
for enforcing compliance by third parties with this License.
|
440 |
+
|
441 |
+
An "entity transaction" is a transaction transferring control of an
|
442 |
+
organization, or substantially all assets of one, or subdividing an
|
443 |
+
organization, or merging organizations. If propagation of a covered
|
444 |
+
work results from an entity transaction, each party to that
|
445 |
+
transaction who receives a copy of the work also receives whatever
|
446 |
+
licenses to the work the party's predecessor in interest had or could
|
447 |
+
give under the previous paragraph, plus a right to possession of the
|
448 |
+
Corresponding Source of the work from the predecessor in interest, if
|
449 |
+
the predecessor has it or can get it with reasonable efforts.
|
450 |
+
|
451 |
+
You may not impose any further restrictions on the exercise of the
|
452 |
+
rights granted or affirmed under this License. For example, you may
|
453 |
+
not impose a license fee, royalty, or other charge for exercise of
|
454 |
+
rights granted under this License, and you may not initiate litigation
|
455 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
456 |
+
any patent claim is infringed by making, using, selling, offering for
|
457 |
+
sale, or importing the Program or any portion of it.
|
458 |
+
|
459 |
+
11. Patents.
|
460 |
+
|
461 |
+
A "contributor" is a copyright holder who authorizes use under this
|
462 |
+
License of the Program or a work on which the Program is based. The
|
463 |
+
work thus licensed is called the contributor's "contributor version".
|
464 |
+
|
465 |
+
A contributor's "essential patent claims" are all patent claims
|
466 |
+
owned or controlled by the contributor, whether already acquired or
|
467 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
468 |
+
by this License, of making, using, or selling its contributor version,
|
469 |
+
but do not include claims that would be infringed only as a
|
470 |
+
consequence of further modification of the contributor version. For
|
471 |
+
purposes of this definition, "control" includes the right to grant
|
472 |
+
patent sublicenses in a manner consistent with the requirements of
|
473 |
+
this License.
|
474 |
+
|
475 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
476 |
+
patent license under the contributor's essential patent claims, to
|
477 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
478 |
+
propagate the contents of its contributor version.
|
479 |
+
|
480 |
+
In the following three paragraphs, a "patent license" is any express
|
481 |
+
agreement or commitment, however denominated, not to enforce a patent
|
482 |
+
(such as an express permission to practice a patent or covenant not to
|
483 |
+
sue for patent infringement). To "grant" such a patent license to a
|
484 |
+
party means to make such an agreement or commitment not to enforce a
|
485 |
+
patent against the party.
|
486 |
+
|
487 |
+
If you convey a covered work, knowingly relying on a patent license,
|
488 |
+
and the Corresponding Source of the work is not available for anyone
|
489 |
+
to copy, free of charge and under the terms of this License, through a
|
490 |
+
publicly available network server or other readily accessible means,
|
491 |
+
then you must either (1) cause the Corresponding Source to be so
|
492 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
493 |
+
patent license for this particular work, or (3) arrange, in a manner
|
494 |
+
consistent with the requirements of this License, to extend the patent
|
495 |
+
license to downstream recipients. "Knowingly relying" means you have
|
496 |
+
actual knowledge that, but for the patent license, your conveying the
|
497 |
+
covered work in a country, or your recipient's use of the covered work
|
498 |
+
in a country, would infringe one or more identifiable patents in that
|
499 |
+
country that you have reason to believe are valid.
|
500 |
+
|
501 |
+
If, pursuant to or in connection with a single transaction or
|
502 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
503 |
+
covered work, and grant a patent license to some of the parties
|
504 |
+
receiving the covered work authorizing them to use, propagate, modify
|
505 |
+
or convey a specific copy of the covered work, then the patent license
|
506 |
+
you grant is automatically extended to all recipients of the covered
|
507 |
+
work and works based on it.
|
508 |
+
|
509 |
+
A patent license is "discriminatory" if it does not include within
|
510 |
+
the scope of its coverage, prohibits the exercise of, or is
|
511 |
+
conditioned on the non-exercise of one or more of the rights that are
|
512 |
+
specifically granted under this License. You may not convey a covered
|
513 |
+
work if you are a party to an arrangement with a third party that is
|
514 |
+
in the business of distributing software, under which you make payment
|
515 |
+
to the third party based on the extent of your activity of conveying
|
516 |
+
the work, and under which the third party grants, to any of the
|
517 |
+
parties who would receive the covered work from you, a discriminatory
|
518 |
+
patent license (a) in connection with copies of the covered work
|
519 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
520 |
+
for and in connection with specific products or compilations that
|
521 |
+
contain the covered work, unless you entered into that arrangement,
|
522 |
+
or that patent license was granted, prior to 28 March 2007.
|
523 |
+
|
524 |
+
Nothing in this License shall be construed as excluding or limiting
|
525 |
+
any implied license or other defenses to infringement that may
|
526 |
+
otherwise be available to you under applicable patent law.
|
527 |
+
|
528 |
+
12. No Surrender of Others' Freedom.
|
529 |
+
|
530 |
+
If conditions are imposed on you (whether by court order, agreement or
|
531 |
+
otherwise) that contradict the conditions of this License, they do not
|
532 |
+
excuse you from the conditions of this License. If you cannot convey a
|
533 |
+
covered work so as to satisfy simultaneously your obligations under this
|
534 |
+
License and any other pertinent obligations, then as a consequence you may
|
535 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
536 |
+
to collect a royalty for further conveying from those to whom you convey
|
537 |
+
the Program, the only way you could satisfy both those terms and this
|
538 |
+
License would be to refrain entirely from conveying the Program.
|
539 |
+
|
540 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
541 |
+
|
542 |
+
Notwithstanding any other provision of this License, if you modify the
|
543 |
+
Program, your modified version must prominently offer all users
|
544 |
+
interacting with it remotely through a computer network (if your version
|
545 |
+
supports such interaction) an opportunity to receive the Corresponding
|
546 |
+
Source of your version by providing access to the Corresponding Source
|
547 |
+
from a network server at no charge, through some standard or customary
|
548 |
+
means of facilitating copying of software. This Corresponding Source
|
549 |
+
shall include the Corresponding Source for any work covered by version 3
|
550 |
+
of the GNU General Public License that is incorporated pursuant to the
|
551 |
+
following paragraph.
|
552 |
+
|
553 |
+
Notwithstanding any other provision of this License, you have
|
554 |
+
permission to link or combine any covered work with a work licensed
|
555 |
+
under version 3 of the GNU General Public License into a single
|
556 |
+
combined work, and to convey the resulting work. The terms of this
|
557 |
+
License will continue to apply to the part which is the covered work,
|
558 |
+
but the work with which it is combined will remain governed by version
|
559 |
+
3 of the GNU General Public License.
|
560 |
+
|
561 |
+
14. Revised Versions of this License.
|
562 |
+
|
563 |
+
The Free Software Foundation may publish revised and/or new versions of
|
564 |
+
the GNU Affero General Public License from time to time. Such new versions
|
565 |
+
will be similar in spirit to the present version, but may differ in detail to
|
566 |
+
address new problems or concerns.
|
567 |
+
|
568 |
+
Each version is given a distinguishing version number. If the
|
569 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
570 |
+
Public License "or any later version" applies to it, you have the
|
571 |
+
option of following the terms and conditions either of that numbered
|
572 |
+
version or of any later version published by the Free Software
|
573 |
+
Foundation. If the Program does not specify a version number of the
|
574 |
+
GNU Affero General Public License, you may choose any version ever published
|
575 |
+
by the Free Software Foundation.
|
576 |
+
|
577 |
+
If the Program specifies that a proxy can decide which future
|
578 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
579 |
+
public statement of acceptance of a version permanently authorizes you
|
580 |
+
to choose that version for the Program.
|
581 |
+
|
582 |
+
Later license versions may give you additional or different
|
583 |
+
permissions. However, no additional obligations are imposed on any
|
584 |
+
author or copyright holder as a result of your choosing to follow a
|
585 |
+
later version.
|
586 |
+
|
587 |
+
15. Disclaimer of Warranty.
|
588 |
+
|
589 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
590 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
591 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
592 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
593 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
594 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
595 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
596 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
597 |
+
|
598 |
+
16. Limitation of Liability.
|
599 |
+
|
600 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
601 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
602 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
603 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
604 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
605 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
606 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
607 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
608 |
+
SUCH DAMAGES.
|
609 |
+
|
610 |
+
17. Interpretation of Sections 15 and 16.
|
611 |
+
|
612 |
+
If the disclaimer of warranty and limitation of liability provided
|
613 |
+
above cannot be given local legal effect according to their terms,
|
614 |
+
reviewing courts shall apply local law that most closely approximates
|
615 |
+
an absolute waiver of all civil liability in connection with the
|
616 |
+
Program, unless a warranty or assumption of liability accompanies a
|
617 |
+
copy of the Program in return for a fee.
|
618 |
+
|
619 |
+
END OF TERMS AND CONDITIONS
|
620 |
+
|
621 |
+
How to Apply These Terms to Your New Programs
|
622 |
+
|
623 |
+
If you develop a new program, and you want it to be of the greatest
|
624 |
+
possible use to the public, the best way to achieve this is to make it
|
625 |
+
free software which everyone can redistribute and change under these terms.
|
626 |
+
|
627 |
+
To do so, attach the following notices to the program. It is safest
|
628 |
+
to attach them to the start of each source file to most effectively
|
629 |
+
state the exclusion of warranty; and each file should have at least
|
630 |
+
the "copyright" line and a pointer to where the full notice is found.
|
631 |
+
|
632 |
+
<one line to give the program's name and a brief idea of what it does.>
|
633 |
+
Copyright (C) <year> <name of author>
|
634 |
+
|
635 |
+
This program is free software: you can redistribute it and/or modify
|
636 |
+
it under the terms of the GNU Affero General Public License as published by
|
637 |
+
the Free Software Foundation, either version 3 of the License, or
|
638 |
+
(at your option) any later version.
|
639 |
+
|
640 |
+
This program is distributed in the hope that it will be useful,
|
641 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
642 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
643 |
+
GNU Affero General Public License for more details.
|
644 |
+
|
645 |
+
You should have received a copy of the GNU Affero General Public License
|
646 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
647 |
+
|
648 |
+
Also add information on how to contact you by electronic and paper mail.
|
649 |
+
|
650 |
+
If your software can interact with users remotely through a computer
|
651 |
+
network, you should also make sure that it provides a way for users to
|
652 |
+
get its source. For example, if your program is a web application, its
|
653 |
+
interface could display a "Source" link that leads users to an archive
|
654 |
+
of the code. There are many ways you could offer source, and different
|
655 |
+
solutions will be better for different programs; see section 13 for the
|
656 |
+
specific requirements.
|
657 |
+
|
658 |
+
You should also get your employer (if you work as a programmer) or school,
|
659 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
660 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
661 |
+
<https://www.gnu.org/licenses/>.
|
README.md
CHANGED
@@ -1,10 +1,51 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div align="center">
|
2 |
+
<img src="assets/scramjet.png" height="200" />
|
3 |
+
</div>
|
4 |
+
|
5 |
+
---
|
6 |
+
|
7 |
+
> [!WARNING]
|
8 |
+
> Scramjet is not currently production ready, DO NOT USE THIS AS THE MAIN OPTION IN YOUR SITE.
|
9 |
+
|
10 |
+
<a href="https://www.npmjs.com/package/@mercuryworkshop/scramjet"><img src="https://img.shields.io/npm/v/@mercuryworkshop/scramjet.svg?maxAge=3600" alt="npm version" /></a>
|
11 |
+
|
12 |
+
Scramjet is an experimental interception based web proxy that aims to be the successor to Ultraviolet. It is designed with security, developer friendliness, and performance in mind. Scramjet strives to have a clean, organized codebase to improve maintainability. Scramjet is made to evade internet censorship and bypass arbitrary web browser restrictions.
|
13 |
+
|
14 |
+
## Supported Sites
|
15 |
+
|
16 |
+
Some of the popular websites that Scramjet supports include:
|
17 |
+
|
18 |
+
- [Google](https://google.com)
|
19 |
+
- [Youtube](https://www.youtube.com)
|
20 |
+
- [Spotify](https://spotify.com)
|
21 |
+
- [Discord](https://discord.com)
|
22 |
+
- [Reddit](https://reddit.com)
|
23 |
+
- [GeForce NOW](https://play.geforcenow.com/)
|
24 |
+
- [now.gg](https://now.gg)
|
25 |
+
|
26 |
+
## Development
|
27 |
+
|
28 |
+
### Dependencies
|
29 |
+
|
30 |
+
- Recent versions of `node.js` and `pnpm`
|
31 |
+
- `rustup`
|
32 |
+
- `wasm-bindgen`
|
33 |
+
- [Binaryen's `wasm-opt`](https://github.com/WebAssembly/binaryen)
|
34 |
+
- [this `wasm-snip` fork](https://github.com/r58Playz/wasm-snip)
|
35 |
+
|
36 |
+
#### Building
|
37 |
+
|
38 |
+
- Clone the repository with `git clone --recursive https://github.com/MercuryWorkshop/scramjet`
|
39 |
+
- Install the dependencies with `pnpm i`
|
40 |
+
- Build the rewriter with `pnpm rewriter:build`
|
41 |
+
- Build Scramjet with `pnpm build`
|
42 |
+
|
43 |
+
### Running Scramjet Locally
|
44 |
+
|
45 |
+
You can run the Scramjet dev server with the command
|
46 |
+
|
47 |
+
```sh
|
48 |
+
pnpm dev
|
49 |
+
```
|
50 |
+
|
51 |
+
Scramjet should now be running at `localhost:1337` and should rebuild upon a file being changed (excluding the rewriter).
|
assets/scramjet.png
ADDED
![]() |
Git LFS Details
|
ci/buildstatic.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
DST=staticbuild
|
3 |
+
|
4 |
+
rm -rf $DST
|
5 |
+
mkdir -p $DST
|
6 |
+
|
7 |
+
cp -r node_modules/@mercuryworkshop/bare-mux/dist/ $DST/baremux
|
8 |
+
cp -r node_modules/@mercuryworkshop/epoxy-transport/dist/ $DST/epoxy
|
9 |
+
cp -r node_modules/@mercuryworkshop/libcurl-transport/dist/ $DST/libcurl
|
10 |
+
cp -r assets/ $DST/assets
|
11 |
+
cp -r dist/ $DST/scram
|
12 |
+
cp -r static/* $DST
|
13 |
+
|
14 |
+
echo 'let _CONFIG = { wispurl: "wss://anura.pro/", bareurl: "https://aluu.xyz/bare/" }' > $DST/config.js
|
codespace-basic-setup.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
2 |
+
source "$HOME/.cargo/env" # to import rustup in current shell
|
3 |
+
pnpm i
|
4 |
+
cargo install wasm-bindgen-cli
|
5 |
+
VER=$(curl --silent -qI https://github.com/WebAssembly/binaryen/releases/latest | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}'); \
|
6 |
+
curl -LO https://github.com/WebAssembly/binaryen/releases/download/$VER/binaryen-${VER}-x86_64-linux.tar.gz
|
7 |
+
tar xvf binaryen-${VER}-x86_64-linux.tar.gz
|
8 |
+
rm -rf binaryen-${VER}-x86_64-linux.tar.gz
|
9 |
+
mv binaryen-${VER}/bin/* ~/.local/bin
|
10 |
+
mv binaryen-${VER}/lib/* ~/.local/lib
|
11 |
+
rm -rf binaryen-${VER}
|
12 |
+
cargo install --git https://github.com/r58playz/wasm-snip
|
13 |
+
pnpm rewriter:build
|
14 |
+
pnpm build
|
documentation/README.md
ADDED
File without changes
|
eslint.config.mjs
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
2 |
+
import tsParser from "@typescript-eslint/parser";
|
3 |
+
import path from "node:path";
|
4 |
+
import { fileURLToPath } from "node:url";
|
5 |
+
import js from "@eslint/js";
|
6 |
+
import { FlatCompat } from "@eslint/eslintrc";
|
7 |
+
|
8 |
+
const __filename = fileURLToPath(import.meta.url);
|
9 |
+
const __dirname = path.dirname(__filename);
|
10 |
+
const compat = new FlatCompat({
|
11 |
+
baseDirectory: __dirname,
|
12 |
+
recommendedConfig: js.configs.recommended,
|
13 |
+
allConfig: js.configs.all,
|
14 |
+
});
|
15 |
+
|
16 |
+
export default [
|
17 |
+
...compat
|
18 |
+
.extends("eslint:recommended", "plugin:@typescript-eslint/recommended")
|
19 |
+
.map((config) => ({
|
20 |
+
...config,
|
21 |
+
files: ["**/*.ts"],
|
22 |
+
})),
|
23 |
+
{
|
24 |
+
ignores: ["dist", "rewriter"],
|
25 |
+
},
|
26 |
+
{
|
27 |
+
files: ["**/*.ts"],
|
28 |
+
plugins: {
|
29 |
+
"@typescript-eslint": typescriptEslint,
|
30 |
+
},
|
31 |
+
|
32 |
+
languageOptions: {
|
33 |
+
parser: tsParser,
|
34 |
+
},
|
35 |
+
|
36 |
+
rules: {
|
37 |
+
"no-await-in-loop": "warn",
|
38 |
+
"no-unused-labels": "warn",
|
39 |
+
quotes: ["error", "double"],
|
40 |
+
"getter-return": "error",
|
41 |
+
"newline-before-return": "error",
|
42 |
+
"no-multiple-empty-lines": "error",
|
43 |
+
"no-var": "error",
|
44 |
+
"no-this-before-super": "warn",
|
45 |
+
"no-useless-return": "error",
|
46 |
+
"no-shadow": "error",
|
47 |
+
"prefer-const": "warn",
|
48 |
+
"no-unreachable": "warn",
|
49 |
+
"no-undef": "off",
|
50 |
+
"no-empty": "off",
|
51 |
+
"no-debugger": "off",
|
52 |
+
"no-shadow": "off",
|
53 |
+
"@typescript-eslint/no-explicit-any": "off",
|
54 |
+
"@typescript-eslint/ban-ts-comment": "off",
|
55 |
+
"@typescript-eslint/ban-types": "off",
|
56 |
+
"@typescript-eslint/no-require-imports": "off",
|
57 |
+
"@typescript-eslint/no-unused-vars": [
|
58 |
+
"warn",
|
59 |
+
{
|
60 |
+
argsIgnorePattern: "^_",
|
61 |
+
varsIgnorePattern: "^_",
|
62 |
+
caughtErrorsIgnorePattern: "^_",
|
63 |
+
},
|
64 |
+
],
|
65 |
+
},
|
66 |
+
},
|
67 |
+
];
|
lib/index.cjs
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
|
3 |
+
const { resolve } = require("node:path");
|
4 |
+
|
5 |
+
const scramjetPath = resolve(__dirname, "..", "dist");
|
6 |
+
|
7 |
+
exports.scramjetPath = scramjetPath;
|
lib/index.d.ts
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
declare const scramjetPath: string;
|
2 |
+
|
3 |
+
import * as controller from "../dist/types/controller/index.ts";
|
4 |
+
import * as worker from "../dist/types/worker/index.ts";
|
5 |
+
import * as types from "../dist/types/types.ts";
|
6 |
+
import * as frame from "../dist/types/controller/frame.ts";
|
7 |
+
|
8 |
+
declare global {
|
9 |
+
function $scramjetLoadController(): typeof controller;
|
10 |
+
function $scramjetLoadWorker(): typeof worker;
|
11 |
+
function $scramjetLoadClient(config: ScramjetConfig);
|
12 |
+
type ScramjetController = controller.ScramjetController;
|
13 |
+
type ScramjetFrame = frame.ScramjetFrame;
|
14 |
+
|
15 |
+
type ScramjetConfig = types.ScramjetConfig;
|
16 |
+
type ScramjetInitConfig = types.ScramjetInitConfig;
|
17 |
+
var $scramjetVersion: {
|
18 |
+
build: string;
|
19 |
+
version: string;
|
20 |
+
};
|
21 |
+
}
|
22 |
+
export { scramjetPath };
|
package.json
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@mercuryworkshop/scramjet",
|
3 |
+
"version": "1.0.2-dev",
|
4 |
+
"description": "An experimental web proxy that aims to be the successor to Ultraviolet",
|
5 |
+
"main": "./lib/index.cjs",
|
6 |
+
"types": "./lib/index.d.js",
|
7 |
+
"type": "module",
|
8 |
+
"repository": {
|
9 |
+
"type": "git",
|
10 |
+
"url": "https://github.com/MercuryWorkshop/scramjet"
|
11 |
+
},
|
12 |
+
"scripts": {
|
13 |
+
"build": "rspack build --mode production",
|
14 |
+
"rewriter:build": "cd rewriter/wasm/ && bash build.sh && cd ../../",
|
15 |
+
"dev": "node server.js",
|
16 |
+
"dev:debug": "DEBUG=1 node server.js",
|
17 |
+
"prepack": "RELEASE=1 npm run rewriter:build && tsc && npm run build",
|
18 |
+
"pub": "npm publish --no-git-checks --access public",
|
19 |
+
"format": "prettier --write .",
|
20 |
+
"lint": "eslint ./src/",
|
21 |
+
"lint:fix": "eslint ./src/ --fix",
|
22 |
+
"test": "npx playwright test",
|
23 |
+
"preinstall": "npx only-allow pnpm"
|
24 |
+
},
|
25 |
+
"files": [
|
26 |
+
"dist/*.js",
|
27 |
+
"dist/*.js.map",
|
28 |
+
"dist/*.wasm",
|
29 |
+
"lib"
|
30 |
+
],
|
31 |
+
"keywords": [],
|
32 |
+
"author": "",
|
33 |
+
"license": "MIT",
|
34 |
+
"devDependencies": {
|
35 |
+
"@eslint/eslintrc": "^3.3.1",
|
36 |
+
"@eslint/js": "^9.30.0",
|
37 |
+
"@estruyf/github-actions-reporter": "^1.10.0",
|
38 |
+
"@fastify/static": "^8.2.0",
|
39 |
+
"@mercuryworkshop/bare-as-module3": "^2.2.5",
|
40 |
+
"@mercuryworkshop/epoxy-transport": "^2.1.27",
|
41 |
+
"@mercuryworkshop/libcurl-transport": "^1.5.0",
|
42 |
+
"@mercuryworkshop/wisp-js": "^0.3.3",
|
43 |
+
"@nebula-services/bare-server-node": "^2.0.4",
|
44 |
+
"@playwright/test": "^1.53.1",
|
45 |
+
"@rsdoctor/rspack-plugin": "^1.1.5",
|
46 |
+
"@rspack/cli": "^1.4.8",
|
47 |
+
"@rspack/core": "^1.4.8",
|
48 |
+
"@types/eslint": "^9.6.1",
|
49 |
+
"@types/estree": "^1.0.8",
|
50 |
+
"@types/node": "^24.0.6",
|
51 |
+
"@types/serviceworker": "^0.0.139",
|
52 |
+
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
53 |
+
"@typescript-eslint/parser": "^8.35.0",
|
54 |
+
"dotenv": "^17.0.0",
|
55 |
+
"eslint": "^9.30.0",
|
56 |
+
"fastify": "^5.4.0",
|
57 |
+
"playwright": "^1.53.1",
|
58 |
+
"prettier": "^3.6.2",
|
59 |
+
"ts-checker-rspack-plugin": "^1.1.4",
|
60 |
+
"tslib": "^2.8.1",
|
61 |
+
"typescript": "^5.8.3"
|
62 |
+
},
|
63 |
+
"dependencies": {
|
64 |
+
"@mercuryworkshop/bare-mux": "^2.1.7",
|
65 |
+
"dom-serializer": "^2.0.0",
|
66 |
+
"domhandler": "^5.0.3",
|
67 |
+
"domutils": "^3.2.2",
|
68 |
+
"htmlparser2": "10.0.0",
|
69 |
+
"parse-domain": "^8.2.2",
|
70 |
+
"set-cookie-parser": "^2.7.1"
|
71 |
+
}
|
72 |
+
}
|
playwright.config.ts
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { defineConfig, devices } from "@playwright/test";
|
2 |
+
import type { GitHubActionOptions } from "@estruyf/github-actions-reporter";
|
3 |
+
|
4 |
+
/**
|
5 |
+
* See https://playwright.dev/docs/test-configuration.
|
6 |
+
*/
|
7 |
+
export default defineConfig({
|
8 |
+
testDir: "./tests",
|
9 |
+
fullyParallel: true,
|
10 |
+
forbidOnly: !!process.env.CI,
|
11 |
+
retries: 2,
|
12 |
+
reporter: process.env.CI
|
13 |
+
? [
|
14 |
+
[
|
15 |
+
"@estruyf/github-actions-reporter",
|
16 |
+
{
|
17 |
+
title: "Test summary",
|
18 |
+
useDetails: true,
|
19 |
+
showError: true,
|
20 |
+
} as GitHubActionOptions,
|
21 |
+
],
|
22 |
+
["github"],
|
23 |
+
]
|
24 |
+
: "html",
|
25 |
+
timeout: 20000,
|
26 |
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
27 |
+
use: {
|
28 |
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
29 |
+
trace: "on-first-retry",
|
30 |
+
actionTimeout: 10000,
|
31 |
+
baseURL: "http://localhost:1337",
|
32 |
+
},
|
33 |
+
|
34 |
+
/* Configure projects for major browsers */
|
35 |
+
projects: [
|
36 |
+
{
|
37 |
+
name: "chromium",
|
38 |
+
use: { ...devices["Desktop Chrome"] },
|
39 |
+
},
|
40 |
+
// {
|
41 |
+
// name: "firefox",
|
42 |
+
// use: { ...devices["Desktop Firefox"] },
|
43 |
+
// },
|
44 |
+
],
|
45 |
+
|
46 |
+
/* Run your local dev server before starting the tests */
|
47 |
+
webServer: {
|
48 |
+
command: "pnpm run dev",
|
49 |
+
url: "http://127.0.0.1:1337",
|
50 |
+
reuseExistingServer: false,
|
51 |
+
},
|
52 |
+
});
|
pnpm-lock.yaml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pnpm-workspace.yaml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ignoredBuiltDependencies:
|
2 |
+
- bufferutil
|
3 |
+
|
4 |
+
packages:
|
5 |
+
- "./"
|
prettier.config.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @type {import("prettier").Config}
|
3 |
+
*/
|
4 |
+
const config = {
|
5 |
+
trailingComma: "es5",
|
6 |
+
useTabs: true,
|
7 |
+
semi: true,
|
8 |
+
singleQuote: false,
|
9 |
+
};
|
10 |
+
|
11 |
+
export default config;
|
rewriter/Cargo.lock
ADDED
@@ -0,0 +1,1985 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file is automatically @generated by Cargo.
|
2 |
+
# It is not intended for manual editing.
|
3 |
+
version = 4
|
4 |
+
|
5 |
+
[[package]]
|
6 |
+
name = "allocator-api2"
|
7 |
+
version = "0.2.21"
|
8 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9 |
+
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
10 |
+
|
11 |
+
[[package]]
|
12 |
+
name = "anstream"
|
13 |
+
version = "0.6.19"
|
14 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
15 |
+
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
|
16 |
+
dependencies = [
|
17 |
+
"anstyle",
|
18 |
+
"anstyle-parse",
|
19 |
+
"anstyle-query",
|
20 |
+
"anstyle-wincon",
|
21 |
+
"colorchoice",
|
22 |
+
"is_terminal_polyfill",
|
23 |
+
"utf8parse",
|
24 |
+
]
|
25 |
+
|
26 |
+
[[package]]
|
27 |
+
name = "anstyle"
|
28 |
+
version = "1.0.11"
|
29 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
30 |
+
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
|
31 |
+
|
32 |
+
[[package]]
|
33 |
+
name = "anstyle-parse"
|
34 |
+
version = "0.2.7"
|
35 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
36 |
+
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
37 |
+
dependencies = [
|
38 |
+
"utf8parse",
|
39 |
+
]
|
40 |
+
|
41 |
+
[[package]]
|
42 |
+
name = "anstyle-query"
|
43 |
+
version = "1.1.3"
|
44 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
45 |
+
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
|
46 |
+
dependencies = [
|
47 |
+
"windows-sys",
|
48 |
+
]
|
49 |
+
|
50 |
+
[[package]]
|
51 |
+
name = "anstyle-wincon"
|
52 |
+
version = "3.0.9"
|
53 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
54 |
+
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
|
55 |
+
dependencies = [
|
56 |
+
"anstyle",
|
57 |
+
"once_cell_polyfill",
|
58 |
+
"windows-sys",
|
59 |
+
]
|
60 |
+
|
61 |
+
[[package]]
|
62 |
+
name = "anyhow"
|
63 |
+
version = "1.0.98"
|
64 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
65 |
+
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
66 |
+
|
67 |
+
[[package]]
|
68 |
+
name = "arrayvec"
|
69 |
+
version = "0.7.6"
|
70 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
71 |
+
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
72 |
+
|
73 |
+
[[package]]
|
74 |
+
name = "autocfg"
|
75 |
+
version = "1.5.0"
|
76 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
77 |
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
78 |
+
|
79 |
+
[[package]]
|
80 |
+
name = "bitflags"
|
81 |
+
version = "2.9.1"
|
82 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
83 |
+
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
84 |
+
|
85 |
+
[[package]]
|
86 |
+
name = "boa_ast"
|
87 |
+
version = "0.20.0"
|
88 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
89 |
+
checksum = "2c340fe0f0b267787095cbe35240c6786ff19da63ec7b69367ba338eace8169b"
|
90 |
+
dependencies = [
|
91 |
+
"bitflags",
|
92 |
+
"boa_interner",
|
93 |
+
"boa_macros",
|
94 |
+
"boa_string",
|
95 |
+
"indexmap",
|
96 |
+
"num-bigint",
|
97 |
+
"rustc-hash",
|
98 |
+
]
|
99 |
+
|
100 |
+
[[package]]
|
101 |
+
name = "boa_engine"
|
102 |
+
version = "0.20.0"
|
103 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
104 |
+
checksum = "f620c3f06f51e65c0504ddf04978be1b814ac6586f0b45f6019801ab5efd37f9"
|
105 |
+
dependencies = [
|
106 |
+
"arrayvec",
|
107 |
+
"bitflags",
|
108 |
+
"boa_ast",
|
109 |
+
"boa_gc",
|
110 |
+
"boa_interner",
|
111 |
+
"boa_macros",
|
112 |
+
"boa_parser",
|
113 |
+
"boa_profiler",
|
114 |
+
"boa_string",
|
115 |
+
"bytemuck",
|
116 |
+
"cfg-if",
|
117 |
+
"dashmap",
|
118 |
+
"fast-float2",
|
119 |
+
"hashbrown 0.15.4",
|
120 |
+
"icu_normalizer 1.5.0",
|
121 |
+
"indexmap",
|
122 |
+
"intrusive-collections",
|
123 |
+
"itertools",
|
124 |
+
"num-bigint",
|
125 |
+
"num-integer",
|
126 |
+
"num-traits",
|
127 |
+
"num_enum",
|
128 |
+
"once_cell",
|
129 |
+
"pollster",
|
130 |
+
"portable-atomic",
|
131 |
+
"rand",
|
132 |
+
"regress",
|
133 |
+
"rustc-hash",
|
134 |
+
"ryu-js",
|
135 |
+
"serde",
|
136 |
+
"serde_json",
|
137 |
+
"sptr",
|
138 |
+
"static_assertions",
|
139 |
+
"tap",
|
140 |
+
"thin-vec",
|
141 |
+
"thiserror",
|
142 |
+
"time",
|
143 |
+
]
|
144 |
+
|
145 |
+
[[package]]
|
146 |
+
name = "boa_gc"
|
147 |
+
version = "0.20.0"
|
148 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
149 |
+
checksum = "2425c0b7720d42d73eaa6a883fbb77a5c920da8694964a3d79a67597ac55cce2"
|
150 |
+
dependencies = [
|
151 |
+
"boa_macros",
|
152 |
+
"boa_profiler",
|
153 |
+
"boa_string",
|
154 |
+
"hashbrown 0.15.4",
|
155 |
+
"thin-vec",
|
156 |
+
]
|
157 |
+
|
158 |
+
[[package]]
|
159 |
+
name = "boa_interner"
|
160 |
+
version = "0.20.0"
|
161 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
162 |
+
checksum = "42407a3b724cfaecde8f7d4af566df4b56af32a2f11f0956f5570bb974e7f749"
|
163 |
+
dependencies = [
|
164 |
+
"boa_gc",
|
165 |
+
"boa_macros",
|
166 |
+
"hashbrown 0.15.4",
|
167 |
+
"indexmap",
|
168 |
+
"once_cell",
|
169 |
+
"phf 0.11.3",
|
170 |
+
"rustc-hash",
|
171 |
+
"static_assertions",
|
172 |
+
]
|
173 |
+
|
174 |
+
[[package]]
|
175 |
+
name = "boa_macros"
|
176 |
+
version = "0.20.0"
|
177 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
178 |
+
checksum = "9fd3f870829131332587f607a7ff909f1af5fc523fd1b192db55fbbdf52e8d3c"
|
179 |
+
dependencies = [
|
180 |
+
"proc-macro2",
|
181 |
+
"quote",
|
182 |
+
"syn",
|
183 |
+
"synstructure",
|
184 |
+
]
|
185 |
+
|
186 |
+
[[package]]
|
187 |
+
name = "boa_parser"
|
188 |
+
version = "0.20.0"
|
189 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
190 |
+
checksum = "9cc142dac798cdc6e2dbccfddeb50f36d2523bb977a976e19bdb3ae19b740804"
|
191 |
+
dependencies = [
|
192 |
+
"bitflags",
|
193 |
+
"boa_ast",
|
194 |
+
"boa_interner",
|
195 |
+
"boa_macros",
|
196 |
+
"boa_profiler",
|
197 |
+
"fast-float2",
|
198 |
+
"icu_properties 1.5.1",
|
199 |
+
"num-bigint",
|
200 |
+
"num-traits",
|
201 |
+
"regress",
|
202 |
+
"rustc-hash",
|
203 |
+
]
|
204 |
+
|
205 |
+
[[package]]
|
206 |
+
name = "boa_profiler"
|
207 |
+
version = "0.20.0"
|
208 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
209 |
+
checksum = "4064908e7cdf9b6317179e9b04dcb27f1510c1c144aeab4d0394014f37a0f922"
|
210 |
+
|
211 |
+
[[package]]
|
212 |
+
name = "boa_string"
|
213 |
+
version = "0.20.0"
|
214 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
215 |
+
checksum = "7debc13fbf7997bf38bf8e9b20f1ad5e2a7d27a900e1f6039fe244ce30f589b5"
|
216 |
+
dependencies = [
|
217 |
+
"fast-float2",
|
218 |
+
"paste",
|
219 |
+
"rustc-hash",
|
220 |
+
"sptr",
|
221 |
+
"static_assertions",
|
222 |
+
]
|
223 |
+
|
224 |
+
[[package]]
|
225 |
+
name = "bumpalo"
|
226 |
+
version = "3.19.0"
|
227 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
228 |
+
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
229 |
+
dependencies = [
|
230 |
+
"allocator-api2",
|
231 |
+
]
|
232 |
+
|
233 |
+
[[package]]
|
234 |
+
name = "bytemuck"
|
235 |
+
version = "1.23.1"
|
236 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
237 |
+
checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422"
|
238 |
+
dependencies = [
|
239 |
+
"bytemuck_derive",
|
240 |
+
]
|
241 |
+
|
242 |
+
[[package]]
|
243 |
+
name = "bytemuck_derive"
|
244 |
+
version = "1.9.3"
|
245 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
246 |
+
checksum = "7ecc273b49b3205b83d648f0690daa588925572cc5063745bfe547fe7ec8e1a1"
|
247 |
+
dependencies = [
|
248 |
+
"proc-macro2",
|
249 |
+
"quote",
|
250 |
+
"syn",
|
251 |
+
]
|
252 |
+
|
253 |
+
[[package]]
|
254 |
+
name = "bytes"
|
255 |
+
version = "1.10.1"
|
256 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
257 |
+
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
258 |
+
|
259 |
+
[[package]]
|
260 |
+
name = "castaway"
|
261 |
+
version = "0.2.4"
|
262 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
263 |
+
checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"
|
264 |
+
dependencies = [
|
265 |
+
"rustversion",
|
266 |
+
]
|
267 |
+
|
268 |
+
[[package]]
|
269 |
+
name = "cfg-if"
|
270 |
+
version = "1.0.1"
|
271 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
272 |
+
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
273 |
+
|
274 |
+
[[package]]
|
275 |
+
name = "clap"
|
276 |
+
version = "4.5.41"
|
277 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
278 |
+
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
|
279 |
+
dependencies = [
|
280 |
+
"clap_builder",
|
281 |
+
"clap_derive",
|
282 |
+
]
|
283 |
+
|
284 |
+
[[package]]
|
285 |
+
name = "clap_builder"
|
286 |
+
version = "4.5.41"
|
287 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
288 |
+
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
|
289 |
+
dependencies = [
|
290 |
+
"anstream",
|
291 |
+
"anstyle",
|
292 |
+
"clap_lex",
|
293 |
+
"strsim",
|
294 |
+
]
|
295 |
+
|
296 |
+
[[package]]
|
297 |
+
name = "clap_derive"
|
298 |
+
version = "4.5.41"
|
299 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
300 |
+
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
|
301 |
+
dependencies = [
|
302 |
+
"heck",
|
303 |
+
"proc-macro2",
|
304 |
+
"quote",
|
305 |
+
"syn",
|
306 |
+
]
|
307 |
+
|
308 |
+
[[package]]
|
309 |
+
name = "clap_lex"
|
310 |
+
version = "0.7.5"
|
311 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
312 |
+
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
|
313 |
+
|
314 |
+
[[package]]
|
315 |
+
name = "colorchoice"
|
316 |
+
version = "1.0.4"
|
317 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
318 |
+
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
319 |
+
|
320 |
+
[[package]]
|
321 |
+
name = "compact_str"
|
322 |
+
version = "0.9.0"
|
323 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
324 |
+
checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a"
|
325 |
+
dependencies = [
|
326 |
+
"castaway",
|
327 |
+
"cfg-if",
|
328 |
+
"itoa",
|
329 |
+
"rustversion",
|
330 |
+
"ryu",
|
331 |
+
"static_assertions",
|
332 |
+
]
|
333 |
+
|
334 |
+
[[package]]
|
335 |
+
name = "cow-utils"
|
336 |
+
version = "0.1.3"
|
337 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
338 |
+
checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79"
|
339 |
+
|
340 |
+
[[package]]
|
341 |
+
name = "crossbeam-utils"
|
342 |
+
version = "0.8.21"
|
343 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
344 |
+
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
345 |
+
|
346 |
+
[[package]]
|
347 |
+
name = "dashmap"
|
348 |
+
version = "6.1.0"
|
349 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
350 |
+
checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
|
351 |
+
dependencies = [
|
352 |
+
"cfg-if",
|
353 |
+
"crossbeam-utils",
|
354 |
+
"hashbrown 0.14.5",
|
355 |
+
"lock_api",
|
356 |
+
"once_cell",
|
357 |
+
"parking_lot_core",
|
358 |
+
]
|
359 |
+
|
360 |
+
[[package]]
|
361 |
+
name = "deranged"
|
362 |
+
version = "0.4.0"
|
363 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
364 |
+
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
|
365 |
+
dependencies = [
|
366 |
+
"powerfmt",
|
367 |
+
]
|
368 |
+
|
369 |
+
[[package]]
|
370 |
+
name = "displaydoc"
|
371 |
+
version = "0.2.5"
|
372 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
373 |
+
checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
374 |
+
dependencies = [
|
375 |
+
"proc-macro2",
|
376 |
+
"quote",
|
377 |
+
"syn",
|
378 |
+
]
|
379 |
+
|
380 |
+
[[package]]
|
381 |
+
name = "either"
|
382 |
+
version = "1.15.0"
|
383 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
384 |
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
385 |
+
|
386 |
+
[[package]]
|
387 |
+
name = "equivalent"
|
388 |
+
version = "1.0.2"
|
389 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
390 |
+
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
391 |
+
|
392 |
+
[[package]]
|
393 |
+
name = "fast-float2"
|
394 |
+
version = "0.2.3"
|
395 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
396 |
+
checksum = "f8eb564c5c7423d25c886fb561d1e4ee69f72354d16918afa32c08811f6b6a55"
|
397 |
+
|
398 |
+
[[package]]
|
399 |
+
name = "fastrand"
|
400 |
+
version = "2.3.0"
|
401 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
402 |
+
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
403 |
+
|
404 |
+
[[package]]
|
405 |
+
name = "foldhash"
|
406 |
+
version = "0.1.5"
|
407 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
408 |
+
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
409 |
+
|
410 |
+
[[package]]
|
411 |
+
name = "form_urlencoded"
|
412 |
+
version = "1.2.1"
|
413 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
414 |
+
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
|
415 |
+
dependencies = [
|
416 |
+
"percent-encoding",
|
417 |
+
]
|
418 |
+
|
419 |
+
[[package]]
|
420 |
+
name = "getrandom"
|
421 |
+
version = "0.2.16"
|
422 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
423 |
+
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
424 |
+
dependencies = [
|
425 |
+
"cfg-if",
|
426 |
+
"libc",
|
427 |
+
"wasi",
|
428 |
+
]
|
429 |
+
|
430 |
+
[[package]]
|
431 |
+
name = "hashbrown"
|
432 |
+
version = "0.14.5"
|
433 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
434 |
+
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
435 |
+
|
436 |
+
[[package]]
|
437 |
+
name = "hashbrown"
|
438 |
+
version = "0.15.4"
|
439 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
440 |
+
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
441 |
+
dependencies = [
|
442 |
+
"allocator-api2",
|
443 |
+
"equivalent",
|
444 |
+
"foldhash",
|
445 |
+
]
|
446 |
+
|
447 |
+
[[package]]
|
448 |
+
name = "heck"
|
449 |
+
version = "0.5.0"
|
450 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
451 |
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
452 |
+
|
453 |
+
[[package]]
|
454 |
+
name = "html"
|
455 |
+
version = "0.1.0"
|
456 |
+
dependencies = [
|
457 |
+
"oxc",
|
458 |
+
"thiserror",
|
459 |
+
"tl",
|
460 |
+
"transform",
|
461 |
+
]
|
462 |
+
|
463 |
+
[[package]]
|
464 |
+
name = "icu_collections"
|
465 |
+
version = "1.5.0"
|
466 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
467 |
+
checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526"
|
468 |
+
dependencies = [
|
469 |
+
"displaydoc",
|
470 |
+
"yoke 0.7.5",
|
471 |
+
"zerofrom",
|
472 |
+
"zerovec 0.10.4",
|
473 |
+
]
|
474 |
+
|
475 |
+
[[package]]
|
476 |
+
name = "icu_collections"
|
477 |
+
version = "2.0.0"
|
478 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
479 |
+
checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47"
|
480 |
+
dependencies = [
|
481 |
+
"displaydoc",
|
482 |
+
"potential_utf",
|
483 |
+
"yoke 0.8.0",
|
484 |
+
"zerofrom",
|
485 |
+
"zerovec 0.11.2",
|
486 |
+
]
|
487 |
+
|
488 |
+
[[package]]
|
489 |
+
name = "icu_locale_core"
|
490 |
+
version = "2.0.0"
|
491 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
492 |
+
checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a"
|
493 |
+
dependencies = [
|
494 |
+
"displaydoc",
|
495 |
+
"litemap 0.8.0",
|
496 |
+
"tinystr 0.8.1",
|
497 |
+
"writeable 0.6.1",
|
498 |
+
"zerovec 0.11.2",
|
499 |
+
]
|
500 |
+
|
501 |
+
[[package]]
|
502 |
+
name = "icu_locid"
|
503 |
+
version = "1.5.0"
|
504 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
505 |
+
checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637"
|
506 |
+
dependencies = [
|
507 |
+
"displaydoc",
|
508 |
+
"litemap 0.7.5",
|
509 |
+
"tinystr 0.7.6",
|
510 |
+
"writeable 0.5.5",
|
511 |
+
"zerovec 0.10.4",
|
512 |
+
]
|
513 |
+
|
514 |
+
[[package]]
|
515 |
+
name = "icu_locid_transform"
|
516 |
+
version = "1.5.0"
|
517 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
518 |
+
checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e"
|
519 |
+
dependencies = [
|
520 |
+
"displaydoc",
|
521 |
+
"icu_locid",
|
522 |
+
"icu_locid_transform_data",
|
523 |
+
"icu_provider 1.5.0",
|
524 |
+
"tinystr 0.7.6",
|
525 |
+
"zerovec 0.10.4",
|
526 |
+
]
|
527 |
+
|
528 |
+
[[package]]
|
529 |
+
name = "icu_locid_transform_data"
|
530 |
+
version = "1.5.1"
|
531 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
532 |
+
checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d"
|
533 |
+
|
534 |
+
[[package]]
|
535 |
+
name = "icu_normalizer"
|
536 |
+
version = "1.5.0"
|
537 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
538 |
+
checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f"
|
539 |
+
dependencies = [
|
540 |
+
"displaydoc",
|
541 |
+
"icu_collections 1.5.0",
|
542 |
+
"icu_normalizer_data 1.5.1",
|
543 |
+
"icu_properties 1.5.1",
|
544 |
+
"icu_provider 1.5.0",
|
545 |
+
"smallvec",
|
546 |
+
"utf16_iter",
|
547 |
+
"utf8_iter",
|
548 |
+
"write16",
|
549 |
+
"zerovec 0.10.4",
|
550 |
+
]
|
551 |
+
|
552 |
+
[[package]]
|
553 |
+
name = "icu_normalizer"
|
554 |
+
version = "2.0.0"
|
555 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
556 |
+
checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979"
|
557 |
+
dependencies = [
|
558 |
+
"displaydoc",
|
559 |
+
"icu_collections 2.0.0",
|
560 |
+
"icu_normalizer_data 2.0.0",
|
561 |
+
"icu_properties 2.0.1",
|
562 |
+
"icu_provider 2.0.0",
|
563 |
+
"smallvec",
|
564 |
+
"zerovec 0.11.2",
|
565 |
+
]
|
566 |
+
|
567 |
+
[[package]]
|
568 |
+
name = "icu_normalizer_data"
|
569 |
+
version = "1.5.1"
|
570 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
571 |
+
checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7"
|
572 |
+
|
573 |
+
[[package]]
|
574 |
+
name = "icu_normalizer_data"
|
575 |
+
version = "2.0.0"
|
576 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
577 |
+
checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3"
|
578 |
+
|
579 |
+
[[package]]
|
580 |
+
name = "icu_properties"
|
581 |
+
version = "1.5.1"
|
582 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
583 |
+
checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5"
|
584 |
+
dependencies = [
|
585 |
+
"displaydoc",
|
586 |
+
"icu_collections 1.5.0",
|
587 |
+
"icu_locid_transform",
|
588 |
+
"icu_properties_data 1.5.1",
|
589 |
+
"icu_provider 1.5.0",
|
590 |
+
"tinystr 0.7.6",
|
591 |
+
"zerovec 0.10.4",
|
592 |
+
]
|
593 |
+
|
594 |
+
[[package]]
|
595 |
+
name = "icu_properties"
|
596 |
+
version = "2.0.1"
|
597 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
598 |
+
checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b"
|
599 |
+
dependencies = [
|
600 |
+
"displaydoc",
|
601 |
+
"icu_collections 2.0.0",
|
602 |
+
"icu_locale_core",
|
603 |
+
"icu_properties_data 2.0.1",
|
604 |
+
"icu_provider 2.0.0",
|
605 |
+
"potential_utf",
|
606 |
+
"zerotrie",
|
607 |
+
"zerovec 0.11.2",
|
608 |
+
]
|
609 |
+
|
610 |
+
[[package]]
|
611 |
+
name = "icu_properties_data"
|
612 |
+
version = "1.5.1"
|
613 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
614 |
+
checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2"
|
615 |
+
|
616 |
+
[[package]]
|
617 |
+
name = "icu_properties_data"
|
618 |
+
version = "2.0.1"
|
619 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
620 |
+
checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632"
|
621 |
+
|
622 |
+
[[package]]
|
623 |
+
name = "icu_provider"
|
624 |
+
version = "1.5.0"
|
625 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
626 |
+
checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9"
|
627 |
+
dependencies = [
|
628 |
+
"displaydoc",
|
629 |
+
"icu_locid",
|
630 |
+
"icu_provider_macros",
|
631 |
+
"stable_deref_trait",
|
632 |
+
"tinystr 0.7.6",
|
633 |
+
"writeable 0.5.5",
|
634 |
+
"yoke 0.7.5",
|
635 |
+
"zerofrom",
|
636 |
+
"zerovec 0.10.4",
|
637 |
+
]
|
638 |
+
|
639 |
+
[[package]]
|
640 |
+
name = "icu_provider"
|
641 |
+
version = "2.0.0"
|
642 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
643 |
+
checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af"
|
644 |
+
dependencies = [
|
645 |
+
"displaydoc",
|
646 |
+
"icu_locale_core",
|
647 |
+
"stable_deref_trait",
|
648 |
+
"tinystr 0.8.1",
|
649 |
+
"writeable 0.6.1",
|
650 |
+
"yoke 0.8.0",
|
651 |
+
"zerofrom",
|
652 |
+
"zerotrie",
|
653 |
+
"zerovec 0.11.2",
|
654 |
+
]
|
655 |
+
|
656 |
+
[[package]]
|
657 |
+
name = "icu_provider_macros"
|
658 |
+
version = "1.5.0"
|
659 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
660 |
+
checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
|
661 |
+
dependencies = [
|
662 |
+
"proc-macro2",
|
663 |
+
"quote",
|
664 |
+
"syn",
|
665 |
+
]
|
666 |
+
|
667 |
+
[[package]]
|
668 |
+
name = "idna"
|
669 |
+
version = "1.0.3"
|
670 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
671 |
+
checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
|
672 |
+
dependencies = [
|
673 |
+
"idna_adapter",
|
674 |
+
"smallvec",
|
675 |
+
"utf8_iter",
|
676 |
+
]
|
677 |
+
|
678 |
+
[[package]]
|
679 |
+
name = "idna_adapter"
|
680 |
+
version = "1.2.1"
|
681 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
682 |
+
checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
|
683 |
+
dependencies = [
|
684 |
+
"icu_normalizer 2.0.0",
|
685 |
+
"icu_properties 2.0.1",
|
686 |
+
]
|
687 |
+
|
688 |
+
[[package]]
|
689 |
+
name = "indexmap"
|
690 |
+
version = "2.10.0"
|
691 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
692 |
+
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
693 |
+
dependencies = [
|
694 |
+
"equivalent",
|
695 |
+
"hashbrown 0.15.4",
|
696 |
+
]
|
697 |
+
|
698 |
+
[[package]]
|
699 |
+
name = "intrusive-collections"
|
700 |
+
version = "0.9.7"
|
701 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
702 |
+
checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86"
|
703 |
+
dependencies = [
|
704 |
+
"memoffset",
|
705 |
+
]
|
706 |
+
|
707 |
+
[[package]]
|
708 |
+
name = "is_terminal_polyfill"
|
709 |
+
version = "1.70.1"
|
710 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
711 |
+
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
712 |
+
|
713 |
+
[[package]]
|
714 |
+
name = "itertools"
|
715 |
+
version = "0.13.0"
|
716 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
717 |
+
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
718 |
+
dependencies = [
|
719 |
+
"either",
|
720 |
+
]
|
721 |
+
|
722 |
+
[[package]]
|
723 |
+
name = "itoa"
|
724 |
+
version = "1.0.15"
|
725 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
726 |
+
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
727 |
+
|
728 |
+
[[package]]
|
729 |
+
name = "js"
|
730 |
+
version = "0.1.0"
|
731 |
+
dependencies = [
|
732 |
+
"oxc",
|
733 |
+
"smallvec",
|
734 |
+
"thiserror",
|
735 |
+
"transform",
|
736 |
+
]
|
737 |
+
|
738 |
+
[[package]]
|
739 |
+
name = "js-sys"
|
740 |
+
version = "0.3.77"
|
741 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
742 |
+
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
|
743 |
+
dependencies = [
|
744 |
+
"once_cell",
|
745 |
+
"wasm-bindgen",
|
746 |
+
]
|
747 |
+
|
748 |
+
[[package]]
|
749 |
+
name = "libc"
|
750 |
+
version = "0.2.174"
|
751 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
752 |
+
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
753 |
+
|
754 |
+
[[package]]
|
755 |
+
name = "litemap"
|
756 |
+
version = "0.7.5"
|
757 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
758 |
+
checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856"
|
759 |
+
|
760 |
+
[[package]]
|
761 |
+
name = "litemap"
|
762 |
+
version = "0.8.0"
|
763 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
764 |
+
checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
|
765 |
+
|
766 |
+
[[package]]
|
767 |
+
name = "lock_api"
|
768 |
+
version = "0.4.13"
|
769 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
770 |
+
checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
|
771 |
+
dependencies = [
|
772 |
+
"autocfg",
|
773 |
+
"scopeguard",
|
774 |
+
]
|
775 |
+
|
776 |
+
[[package]]
|
777 |
+
name = "log"
|
778 |
+
version = "0.4.27"
|
779 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
780 |
+
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
781 |
+
|
782 |
+
[[package]]
|
783 |
+
name = "memchr"
|
784 |
+
version = "2.7.5"
|
785 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
786 |
+
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
787 |
+
|
788 |
+
[[package]]
|
789 |
+
name = "memoffset"
|
790 |
+
version = "0.9.1"
|
791 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
792 |
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
793 |
+
dependencies = [
|
794 |
+
"autocfg",
|
795 |
+
]
|
796 |
+
|
797 |
+
[[package]]
|
798 |
+
name = "native"
|
799 |
+
version = "0.1.0"
|
800 |
+
dependencies = [
|
801 |
+
"anyhow",
|
802 |
+
"boa_engine",
|
803 |
+
"bytes",
|
804 |
+
"clap",
|
805 |
+
"html",
|
806 |
+
"js",
|
807 |
+
"oxc",
|
808 |
+
"url",
|
809 |
+
"urlencoding",
|
810 |
+
]
|
811 |
+
|
812 |
+
[[package]]
|
813 |
+
name = "nonmax"
|
814 |
+
version = "0.5.5"
|
815 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
816 |
+
checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51"
|
817 |
+
|
818 |
+
[[package]]
|
819 |
+
name = "num-bigint"
|
820 |
+
version = "0.4.6"
|
821 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
822 |
+
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
|
823 |
+
dependencies = [
|
824 |
+
"num-integer",
|
825 |
+
"num-traits",
|
826 |
+
"serde",
|
827 |
+
]
|
828 |
+
|
829 |
+
[[package]]
|
830 |
+
name = "num-conv"
|
831 |
+
version = "0.1.0"
|
832 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
833 |
+
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
834 |
+
|
835 |
+
[[package]]
|
836 |
+
name = "num-integer"
|
837 |
+
version = "0.1.46"
|
838 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
839 |
+
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
840 |
+
dependencies = [
|
841 |
+
"num-traits",
|
842 |
+
]
|
843 |
+
|
844 |
+
[[package]]
|
845 |
+
name = "num-traits"
|
846 |
+
version = "0.2.19"
|
847 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
848 |
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
849 |
+
dependencies = [
|
850 |
+
"autocfg",
|
851 |
+
]
|
852 |
+
|
853 |
+
[[package]]
|
854 |
+
name = "num_enum"
|
855 |
+
version = "0.7.4"
|
856 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
857 |
+
checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a"
|
858 |
+
dependencies = [
|
859 |
+
"num_enum_derive",
|
860 |
+
"rustversion",
|
861 |
+
]
|
862 |
+
|
863 |
+
[[package]]
|
864 |
+
name = "num_enum_derive"
|
865 |
+
version = "0.7.4"
|
866 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
867 |
+
checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d"
|
868 |
+
dependencies = [
|
869 |
+
"proc-macro-crate",
|
870 |
+
"proc-macro2",
|
871 |
+
"quote",
|
872 |
+
"syn",
|
873 |
+
]
|
874 |
+
|
875 |
+
[[package]]
|
876 |
+
name = "num_threads"
|
877 |
+
version = "0.1.7"
|
878 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
879 |
+
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
880 |
+
dependencies = [
|
881 |
+
"libc",
|
882 |
+
]
|
883 |
+
|
884 |
+
[[package]]
|
885 |
+
name = "once_cell"
|
886 |
+
version = "1.21.3"
|
887 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
888 |
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
889 |
+
|
890 |
+
[[package]]
|
891 |
+
name = "once_cell_polyfill"
|
892 |
+
version = "1.70.1"
|
893 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
894 |
+
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
|
895 |
+
|
896 |
+
[[package]]
|
897 |
+
name = "owo-colors"
|
898 |
+
version = "4.2.2"
|
899 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
900 |
+
checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e"
|
901 |
+
|
902 |
+
[[package]]
|
903 |
+
name = "oxc"
|
904 |
+
version = "0.77.2"
|
905 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
906 |
+
checksum = "bfccc6414285e600887e8803dbe5dfc3124014ca37b462cecb93554e88a18956"
|
907 |
+
dependencies = [
|
908 |
+
"oxc_allocator",
|
909 |
+
"oxc_ast",
|
910 |
+
"oxc_ast_visit",
|
911 |
+
"oxc_diagnostics",
|
912 |
+
"oxc_parser",
|
913 |
+
"oxc_regular_expression",
|
914 |
+
"oxc_span",
|
915 |
+
"oxc_syntax",
|
916 |
+
]
|
917 |
+
|
918 |
+
[[package]]
|
919 |
+
name = "oxc-miette"
|
920 |
+
version = "2.3.1"
|
921 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
922 |
+
checksum = "00cb1a49ec377f62606cbf047794efd37d668dbcbcefaeb5bf43f89b3c391418"
|
923 |
+
dependencies = [
|
924 |
+
"cfg-if",
|
925 |
+
"owo-colors",
|
926 |
+
"oxc-miette-derive",
|
927 |
+
"textwrap",
|
928 |
+
"thiserror",
|
929 |
+
"unicode-width",
|
930 |
+
]
|
931 |
+
|
932 |
+
[[package]]
|
933 |
+
name = "oxc-miette-derive"
|
934 |
+
version = "2.3.1"
|
935 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
936 |
+
checksum = "1739910e9871fe8d6e311f80fb2793756335aec97b0f985e778cbf4bc5cf574f"
|
937 |
+
dependencies = [
|
938 |
+
"proc-macro2",
|
939 |
+
"quote",
|
940 |
+
"syn",
|
941 |
+
]
|
942 |
+
|
943 |
+
[[package]]
|
944 |
+
name = "oxc_allocator"
|
945 |
+
version = "0.77.2"
|
946 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
947 |
+
checksum = "dfb26c85f75534d78b8df75f4fc5cae640eab5f7390138533f9875ea77675c32"
|
948 |
+
dependencies = [
|
949 |
+
"allocator-api2",
|
950 |
+
"bumpalo",
|
951 |
+
"hashbrown 0.15.4",
|
952 |
+
"oxc_data_structures",
|
953 |
+
"rustc-hash",
|
954 |
+
]
|
955 |
+
|
956 |
+
[[package]]
|
957 |
+
name = "oxc_ast"
|
958 |
+
version = "0.77.2"
|
959 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
960 |
+
checksum = "b60080112103b0620b4df671cc6cb5e2d15da0acdde576339fc1883944649e50"
|
961 |
+
dependencies = [
|
962 |
+
"bitflags",
|
963 |
+
"oxc_allocator",
|
964 |
+
"oxc_ast_macros",
|
965 |
+
"oxc_data_structures",
|
966 |
+
"oxc_estree",
|
967 |
+
"oxc_regular_expression",
|
968 |
+
"oxc_span",
|
969 |
+
"oxc_syntax",
|
970 |
+
]
|
971 |
+
|
972 |
+
[[package]]
|
973 |
+
name = "oxc_ast_macros"
|
974 |
+
version = "0.77.2"
|
975 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
976 |
+
checksum = "86846e9f2b68e12a3579ade0e5504307238d9ca3214b6ac71f7f2aaf455854f4"
|
977 |
+
dependencies = [
|
978 |
+
"phf 0.12.1",
|
979 |
+
"proc-macro2",
|
980 |
+
"quote",
|
981 |
+
"syn",
|
982 |
+
]
|
983 |
+
|
984 |
+
[[package]]
|
985 |
+
name = "oxc_ast_visit"
|
986 |
+
version = "0.77.2"
|
987 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
988 |
+
checksum = "c349ec8e729a1756b99cdb3b3908680ba683967956a8c6e4cdb913f965812cdf"
|
989 |
+
dependencies = [
|
990 |
+
"oxc_allocator",
|
991 |
+
"oxc_ast",
|
992 |
+
"oxc_span",
|
993 |
+
"oxc_syntax",
|
994 |
+
]
|
995 |
+
|
996 |
+
[[package]]
|
997 |
+
name = "oxc_data_structures"
|
998 |
+
version = "0.77.2"
|
999 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1000 |
+
checksum = "885299e00807d2b0d7b3202417eeed7a31da4d0e8444da8d0d7cb2918fdcd9ff"
|
1001 |
+
dependencies = [
|
1002 |
+
"rustversion",
|
1003 |
+
]
|
1004 |
+
|
1005 |
+
[[package]]
|
1006 |
+
name = "oxc_diagnostics"
|
1007 |
+
version = "0.77.2"
|
1008 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1009 |
+
checksum = "0aeede4e14e19c6ecd6d07b0ffa6ee06fa8154a3ac28e9286a70eed3c459ffef"
|
1010 |
+
dependencies = [
|
1011 |
+
"cow-utils",
|
1012 |
+
"oxc-miette",
|
1013 |
+
"percent-encoding",
|
1014 |
+
]
|
1015 |
+
|
1016 |
+
[[package]]
|
1017 |
+
name = "oxc_ecmascript"
|
1018 |
+
version = "0.77.2"
|
1019 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1020 |
+
checksum = "9561e986b4b73093c0ef263fb827cf3e1ff39f9888d9fc28ba87a895a12b2002"
|
1021 |
+
dependencies = [
|
1022 |
+
"num-bigint",
|
1023 |
+
"num-traits",
|
1024 |
+
"oxc_ast",
|
1025 |
+
"oxc_span",
|
1026 |
+
"oxc_syntax",
|
1027 |
+
]
|
1028 |
+
|
1029 |
+
[[package]]
|
1030 |
+
name = "oxc_estree"
|
1031 |
+
version = "0.77.2"
|
1032 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1033 |
+
checksum = "371761605f9a865c60b2f122745e4938c7d626151806a29ee37faa402351ffa4"
|
1034 |
+
|
1035 |
+
[[package]]
|
1036 |
+
name = "oxc_index"
|
1037 |
+
version = "3.0.0"
|
1038 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1039 |
+
checksum = "2fa07b0cfa997730afed43705766ef27792873fdf5215b1391949fec678d2392"
|
1040 |
+
|
1041 |
+
[[package]]
|
1042 |
+
name = "oxc_parser"
|
1043 |
+
version = "0.77.2"
|
1044 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1045 |
+
checksum = "47dddf9d1b84967778895d456199da6bec068d4df333736bc044566741770e02"
|
1046 |
+
dependencies = [
|
1047 |
+
"bitflags",
|
1048 |
+
"cow-utils",
|
1049 |
+
"memchr",
|
1050 |
+
"num-bigint",
|
1051 |
+
"num-traits",
|
1052 |
+
"oxc_allocator",
|
1053 |
+
"oxc_ast",
|
1054 |
+
"oxc_data_structures",
|
1055 |
+
"oxc_diagnostics",
|
1056 |
+
"oxc_ecmascript",
|
1057 |
+
"oxc_regular_expression",
|
1058 |
+
"oxc_span",
|
1059 |
+
"oxc_syntax",
|
1060 |
+
"rustc-hash",
|
1061 |
+
"seq-macro",
|
1062 |
+
]
|
1063 |
+
|
1064 |
+
[[package]]
|
1065 |
+
name = "oxc_regular_expression"
|
1066 |
+
version = "0.77.2"
|
1067 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1068 |
+
checksum = "fc5e8f0ebe3a5ccf4ccf46584ff2b3cd99ffb7775cfcf4eb0d198a2cb61cf5e1"
|
1069 |
+
dependencies = [
|
1070 |
+
"bitflags",
|
1071 |
+
"oxc_allocator",
|
1072 |
+
"oxc_ast_macros",
|
1073 |
+
"oxc_diagnostics",
|
1074 |
+
"oxc_span",
|
1075 |
+
"phf 0.12.1",
|
1076 |
+
"rustc-hash",
|
1077 |
+
"unicode-id-start",
|
1078 |
+
]
|
1079 |
+
|
1080 |
+
[[package]]
|
1081 |
+
name = "oxc_span"
|
1082 |
+
version = "0.77.2"
|
1083 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1084 |
+
checksum = "76c222febafebcf7efb6b57bc326f2b22ef941530f7520fa085e2b9f1bf3c8ef"
|
1085 |
+
dependencies = [
|
1086 |
+
"compact_str",
|
1087 |
+
"oxc-miette",
|
1088 |
+
"oxc_allocator",
|
1089 |
+
"oxc_ast_macros",
|
1090 |
+
"oxc_estree",
|
1091 |
+
]
|
1092 |
+
|
1093 |
+
[[package]]
|
1094 |
+
name = "oxc_syntax"
|
1095 |
+
version = "0.77.2"
|
1096 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1097 |
+
checksum = "4edbfffc422a4b5579ef51f7b562b098bf087022fa4a8d92d1afe3d7c7abc738"
|
1098 |
+
dependencies = [
|
1099 |
+
"bitflags",
|
1100 |
+
"cow-utils",
|
1101 |
+
"nonmax",
|
1102 |
+
"oxc_allocator",
|
1103 |
+
"oxc_ast_macros",
|
1104 |
+
"oxc_data_structures",
|
1105 |
+
"oxc_estree",
|
1106 |
+
"oxc_index",
|
1107 |
+
"oxc_span",
|
1108 |
+
"phf 0.12.1",
|
1109 |
+
"rustc-hash",
|
1110 |
+
"ryu-js",
|
1111 |
+
"unicode-id-start",
|
1112 |
+
]
|
1113 |
+
|
1114 |
+
[[package]]
|
1115 |
+
name = "parking_lot_core"
|
1116 |
+
version = "0.9.11"
|
1117 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1118 |
+
checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
|
1119 |
+
dependencies = [
|
1120 |
+
"cfg-if",
|
1121 |
+
"libc",
|
1122 |
+
"redox_syscall",
|
1123 |
+
"smallvec",
|
1124 |
+
"windows-targets",
|
1125 |
+
]
|
1126 |
+
|
1127 |
+
[[package]]
|
1128 |
+
name = "paste"
|
1129 |
+
version = "1.0.15"
|
1130 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1131 |
+
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
1132 |
+
|
1133 |
+
[[package]]
|
1134 |
+
name = "percent-encoding"
|
1135 |
+
version = "2.3.1"
|
1136 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1137 |
+
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
1138 |
+
|
1139 |
+
[[package]]
|
1140 |
+
name = "phf"
|
1141 |
+
version = "0.11.3"
|
1142 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1143 |
+
checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
|
1144 |
+
dependencies = [
|
1145 |
+
"phf_macros 0.11.3",
|
1146 |
+
"phf_shared 0.11.3",
|
1147 |
+
]
|
1148 |
+
|
1149 |
+
[[package]]
|
1150 |
+
name = "phf"
|
1151 |
+
version = "0.12.1"
|
1152 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1153 |
+
checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7"
|
1154 |
+
dependencies = [
|
1155 |
+
"phf_macros 0.12.1",
|
1156 |
+
"phf_shared 0.12.1",
|
1157 |
+
"serde",
|
1158 |
+
]
|
1159 |
+
|
1160 |
+
[[package]]
|
1161 |
+
name = "phf_generator"
|
1162 |
+
version = "0.11.3"
|
1163 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1164 |
+
checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
|
1165 |
+
dependencies = [
|
1166 |
+
"phf_shared 0.11.3",
|
1167 |
+
"rand",
|
1168 |
+
]
|
1169 |
+
|
1170 |
+
[[package]]
|
1171 |
+
name = "phf_generator"
|
1172 |
+
version = "0.12.1"
|
1173 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1174 |
+
checksum = "2cbb1126afed61dd6368748dae63b1ee7dc480191c6262a3b4ff1e29d86a6c5b"
|
1175 |
+
dependencies = [
|
1176 |
+
"fastrand",
|
1177 |
+
"phf_shared 0.12.1",
|
1178 |
+
]
|
1179 |
+
|
1180 |
+
[[package]]
|
1181 |
+
name = "phf_macros"
|
1182 |
+
version = "0.11.3"
|
1183 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1184 |
+
checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
|
1185 |
+
dependencies = [
|
1186 |
+
"phf_generator 0.11.3",
|
1187 |
+
"phf_shared 0.11.3",
|
1188 |
+
"proc-macro2",
|
1189 |
+
"quote",
|
1190 |
+
"syn",
|
1191 |
+
]
|
1192 |
+
|
1193 |
+
[[package]]
|
1194 |
+
name = "phf_macros"
|
1195 |
+
version = "0.12.1"
|
1196 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1197 |
+
checksum = "d713258393a82f091ead52047ca779d37e5766226d009de21696c4e667044368"
|
1198 |
+
dependencies = [
|
1199 |
+
"phf_generator 0.12.1",
|
1200 |
+
"phf_shared 0.12.1",
|
1201 |
+
"proc-macro2",
|
1202 |
+
"quote",
|
1203 |
+
"syn",
|
1204 |
+
]
|
1205 |
+
|
1206 |
+
[[package]]
|
1207 |
+
name = "phf_shared"
|
1208 |
+
version = "0.11.3"
|
1209 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1210 |
+
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
|
1211 |
+
dependencies = [
|
1212 |
+
"siphasher",
|
1213 |
+
]
|
1214 |
+
|
1215 |
+
[[package]]
|
1216 |
+
name = "phf_shared"
|
1217 |
+
version = "0.12.1"
|
1218 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1219 |
+
checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981"
|
1220 |
+
dependencies = [
|
1221 |
+
"siphasher",
|
1222 |
+
]
|
1223 |
+
|
1224 |
+
[[package]]
|
1225 |
+
name = "pollster"
|
1226 |
+
version = "0.4.0"
|
1227 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1228 |
+
checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"
|
1229 |
+
|
1230 |
+
[[package]]
|
1231 |
+
name = "portable-atomic"
|
1232 |
+
version = "1.11.1"
|
1233 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1234 |
+
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
1235 |
+
|
1236 |
+
[[package]]
|
1237 |
+
name = "potential_utf"
|
1238 |
+
version = "0.1.2"
|
1239 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1240 |
+
checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585"
|
1241 |
+
dependencies = [
|
1242 |
+
"zerovec 0.11.2",
|
1243 |
+
]
|
1244 |
+
|
1245 |
+
[[package]]
|
1246 |
+
name = "powerfmt"
|
1247 |
+
version = "0.2.0"
|
1248 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1249 |
+
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
1250 |
+
|
1251 |
+
[[package]]
|
1252 |
+
name = "ppv-lite86"
|
1253 |
+
version = "0.2.21"
|
1254 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1255 |
+
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
1256 |
+
dependencies = [
|
1257 |
+
"zerocopy",
|
1258 |
+
]
|
1259 |
+
|
1260 |
+
[[package]]
|
1261 |
+
name = "proc-macro-crate"
|
1262 |
+
version = "3.3.0"
|
1263 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1264 |
+
checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35"
|
1265 |
+
dependencies = [
|
1266 |
+
"toml_edit",
|
1267 |
+
]
|
1268 |
+
|
1269 |
+
[[package]]
|
1270 |
+
name = "proc-macro2"
|
1271 |
+
version = "1.0.95"
|
1272 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1273 |
+
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
1274 |
+
dependencies = [
|
1275 |
+
"unicode-ident",
|
1276 |
+
]
|
1277 |
+
|
1278 |
+
[[package]]
|
1279 |
+
name = "quote"
|
1280 |
+
version = "1.0.40"
|
1281 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1282 |
+
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
1283 |
+
dependencies = [
|
1284 |
+
"proc-macro2",
|
1285 |
+
]
|
1286 |
+
|
1287 |
+
[[package]]
|
1288 |
+
name = "rand"
|
1289 |
+
version = "0.8.5"
|
1290 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1291 |
+
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
1292 |
+
dependencies = [
|
1293 |
+
"libc",
|
1294 |
+
"rand_chacha",
|
1295 |
+
"rand_core",
|
1296 |
+
]
|
1297 |
+
|
1298 |
+
[[package]]
|
1299 |
+
name = "rand_chacha"
|
1300 |
+
version = "0.3.1"
|
1301 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1302 |
+
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
1303 |
+
dependencies = [
|
1304 |
+
"ppv-lite86",
|
1305 |
+
"rand_core",
|
1306 |
+
]
|
1307 |
+
|
1308 |
+
[[package]]
|
1309 |
+
name = "rand_core"
|
1310 |
+
version = "0.6.4"
|
1311 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1312 |
+
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
1313 |
+
dependencies = [
|
1314 |
+
"getrandom",
|
1315 |
+
]
|
1316 |
+
|
1317 |
+
[[package]]
|
1318 |
+
name = "redox_syscall"
|
1319 |
+
version = "0.5.13"
|
1320 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1321 |
+
checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6"
|
1322 |
+
dependencies = [
|
1323 |
+
"bitflags",
|
1324 |
+
]
|
1325 |
+
|
1326 |
+
[[package]]
|
1327 |
+
name = "regress"
|
1328 |
+
version = "0.10.4"
|
1329 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1330 |
+
checksum = "145bb27393fe455dd64d6cbc8d059adfa392590a45eadf079c01b11857e7b010"
|
1331 |
+
dependencies = [
|
1332 |
+
"hashbrown 0.15.4",
|
1333 |
+
"memchr",
|
1334 |
+
]
|
1335 |
+
|
1336 |
+
[[package]]
|
1337 |
+
name = "rustc-hash"
|
1338 |
+
version = "2.1.1"
|
1339 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1340 |
+
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
1341 |
+
|
1342 |
+
[[package]]
|
1343 |
+
name = "rustversion"
|
1344 |
+
version = "1.0.21"
|
1345 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1346 |
+
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
1347 |
+
|
1348 |
+
[[package]]
|
1349 |
+
name = "ryu"
|
1350 |
+
version = "1.0.20"
|
1351 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1352 |
+
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
1353 |
+
|
1354 |
+
[[package]]
|
1355 |
+
name = "ryu-js"
|
1356 |
+
version = "1.0.2"
|
1357 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1358 |
+
checksum = "dd29631678d6fb0903b69223673e122c32e9ae559d0960a38d574695ebc0ea15"
|
1359 |
+
|
1360 |
+
[[package]]
|
1361 |
+
name = "scopeguard"
|
1362 |
+
version = "1.2.0"
|
1363 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1364 |
+
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
1365 |
+
|
1366 |
+
[[package]]
|
1367 |
+
name = "seq-macro"
|
1368 |
+
version = "0.3.6"
|
1369 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1370 |
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
1371 |
+
|
1372 |
+
[[package]]
|
1373 |
+
name = "serde"
|
1374 |
+
version = "1.0.219"
|
1375 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1376 |
+
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
1377 |
+
dependencies = [
|
1378 |
+
"serde_derive",
|
1379 |
+
]
|
1380 |
+
|
1381 |
+
[[package]]
|
1382 |
+
name = "serde_derive"
|
1383 |
+
version = "1.0.219"
|
1384 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1385 |
+
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
1386 |
+
dependencies = [
|
1387 |
+
"proc-macro2",
|
1388 |
+
"quote",
|
1389 |
+
"syn",
|
1390 |
+
]
|
1391 |
+
|
1392 |
+
[[package]]
|
1393 |
+
name = "serde_json"
|
1394 |
+
version = "1.0.141"
|
1395 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1396 |
+
checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
|
1397 |
+
dependencies = [
|
1398 |
+
"itoa",
|
1399 |
+
"memchr",
|
1400 |
+
"ryu",
|
1401 |
+
"serde",
|
1402 |
+
]
|
1403 |
+
|
1404 |
+
[[package]]
|
1405 |
+
name = "siphasher"
|
1406 |
+
version = "1.0.1"
|
1407 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1408 |
+
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
1409 |
+
|
1410 |
+
[[package]]
|
1411 |
+
name = "smallvec"
|
1412 |
+
version = "1.15.1"
|
1413 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1414 |
+
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
1415 |
+
|
1416 |
+
[[package]]
|
1417 |
+
name = "smawk"
|
1418 |
+
version = "0.3.2"
|
1419 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1420 |
+
checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
|
1421 |
+
|
1422 |
+
[[package]]
|
1423 |
+
name = "sptr"
|
1424 |
+
version = "0.3.2"
|
1425 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1426 |
+
checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a"
|
1427 |
+
|
1428 |
+
[[package]]
|
1429 |
+
name = "stable_deref_trait"
|
1430 |
+
version = "1.2.0"
|
1431 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1432 |
+
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
1433 |
+
|
1434 |
+
[[package]]
|
1435 |
+
name = "static_assertions"
|
1436 |
+
version = "1.1.0"
|
1437 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1438 |
+
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
1439 |
+
|
1440 |
+
[[package]]
|
1441 |
+
name = "strsim"
|
1442 |
+
version = "0.11.1"
|
1443 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1444 |
+
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
1445 |
+
|
1446 |
+
[[package]]
|
1447 |
+
name = "syn"
|
1448 |
+
version = "2.0.104"
|
1449 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1450 |
+
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
1451 |
+
dependencies = [
|
1452 |
+
"proc-macro2",
|
1453 |
+
"quote",
|
1454 |
+
"unicode-ident",
|
1455 |
+
]
|
1456 |
+
|
1457 |
+
[[package]]
|
1458 |
+
name = "synstructure"
|
1459 |
+
version = "0.13.2"
|
1460 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1461 |
+
checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
1462 |
+
dependencies = [
|
1463 |
+
"proc-macro2",
|
1464 |
+
"quote",
|
1465 |
+
"syn",
|
1466 |
+
]
|
1467 |
+
|
1468 |
+
[[package]]
|
1469 |
+
name = "tap"
|
1470 |
+
version = "1.0.1"
|
1471 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1472 |
+
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
1473 |
+
|
1474 |
+
[[package]]
|
1475 |
+
name = "textwrap"
|
1476 |
+
version = "0.16.2"
|
1477 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1478 |
+
checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057"
|
1479 |
+
dependencies = [
|
1480 |
+
"smawk",
|
1481 |
+
"unicode-linebreak",
|
1482 |
+
"unicode-width",
|
1483 |
+
]
|
1484 |
+
|
1485 |
+
[[package]]
|
1486 |
+
name = "thin-vec"
|
1487 |
+
version = "0.2.14"
|
1488 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1489 |
+
checksum = "144f754d318415ac792f9d69fc87abbbfc043ce2ef041c60f16ad828f638717d"
|
1490 |
+
|
1491 |
+
[[package]]
|
1492 |
+
name = "thiserror"
|
1493 |
+
version = "2.0.12"
|
1494 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1495 |
+
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
1496 |
+
dependencies = [
|
1497 |
+
"thiserror-impl",
|
1498 |
+
]
|
1499 |
+
|
1500 |
+
[[package]]
|
1501 |
+
name = "thiserror-impl"
|
1502 |
+
version = "2.0.12"
|
1503 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1504 |
+
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
1505 |
+
dependencies = [
|
1506 |
+
"proc-macro2",
|
1507 |
+
"quote",
|
1508 |
+
"syn",
|
1509 |
+
]
|
1510 |
+
|
1511 |
+
[[package]]
|
1512 |
+
name = "time"
|
1513 |
+
version = "0.3.41"
|
1514 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1515 |
+
checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
|
1516 |
+
dependencies = [
|
1517 |
+
"deranged",
|
1518 |
+
"itoa",
|
1519 |
+
"js-sys",
|
1520 |
+
"libc",
|
1521 |
+
"num-conv",
|
1522 |
+
"num_threads",
|
1523 |
+
"powerfmt",
|
1524 |
+
"serde",
|
1525 |
+
"time-core",
|
1526 |
+
"time-macros",
|
1527 |
+
]
|
1528 |
+
|
1529 |
+
[[package]]
|
1530 |
+
name = "time-core"
|
1531 |
+
version = "0.1.4"
|
1532 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1533 |
+
checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
|
1534 |
+
|
1535 |
+
[[package]]
|
1536 |
+
name = "time-macros"
|
1537 |
+
version = "0.2.22"
|
1538 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1539 |
+
checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49"
|
1540 |
+
dependencies = [
|
1541 |
+
"num-conv",
|
1542 |
+
"time-core",
|
1543 |
+
]
|
1544 |
+
|
1545 |
+
[[package]]
|
1546 |
+
name = "tinystr"
|
1547 |
+
version = "0.7.6"
|
1548 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1549 |
+
checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f"
|
1550 |
+
dependencies = [
|
1551 |
+
"displaydoc",
|
1552 |
+
"zerovec 0.10.4",
|
1553 |
+
]
|
1554 |
+
|
1555 |
+
[[package]]
|
1556 |
+
name = "tinystr"
|
1557 |
+
version = "0.8.1"
|
1558 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1559 |
+
checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b"
|
1560 |
+
dependencies = [
|
1561 |
+
"displaydoc",
|
1562 |
+
"zerovec 0.11.2",
|
1563 |
+
]
|
1564 |
+
|
1565 |
+
[[package]]
|
1566 |
+
name = "tl"
|
1567 |
+
version = "0.7.8"
|
1568 |
+
source = "git+https://github.com/r58playz/tl#3d1785832995f6d37ee53c42dbe79f6c8ddf2e39"
|
1569 |
+
|
1570 |
+
[[package]]
|
1571 |
+
name = "toml_datetime"
|
1572 |
+
version = "0.6.11"
|
1573 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1574 |
+
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
1575 |
+
|
1576 |
+
[[package]]
|
1577 |
+
name = "toml_edit"
|
1578 |
+
version = "0.22.27"
|
1579 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1580 |
+
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
1581 |
+
dependencies = [
|
1582 |
+
"indexmap",
|
1583 |
+
"toml_datetime",
|
1584 |
+
"winnow",
|
1585 |
+
]
|
1586 |
+
|
1587 |
+
[[package]]
|
1588 |
+
name = "transform"
|
1589 |
+
version = "0.1.0"
|
1590 |
+
dependencies = [
|
1591 |
+
"itoa",
|
1592 |
+
"oxc",
|
1593 |
+
"smallvec",
|
1594 |
+
"thiserror",
|
1595 |
+
]
|
1596 |
+
|
1597 |
+
[[package]]
|
1598 |
+
name = "unicode-id-start"
|
1599 |
+
version = "1.3.1"
|
1600 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1601 |
+
checksum = "2f322b60f6b9736017344fa0635d64be2f458fbc04eef65f6be22976dd1ffd5b"
|
1602 |
+
|
1603 |
+
[[package]]
|
1604 |
+
name = "unicode-ident"
|
1605 |
+
version = "1.0.18"
|
1606 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1607 |
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
1608 |
+
|
1609 |
+
[[package]]
|
1610 |
+
name = "unicode-linebreak"
|
1611 |
+
version = "0.1.5"
|
1612 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1613 |
+
checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
|
1614 |
+
|
1615 |
+
[[package]]
|
1616 |
+
name = "unicode-width"
|
1617 |
+
version = "0.2.1"
|
1618 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1619 |
+
checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
|
1620 |
+
|
1621 |
+
[[package]]
|
1622 |
+
name = "url"
|
1623 |
+
version = "2.5.4"
|
1624 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1625 |
+
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
|
1626 |
+
dependencies = [
|
1627 |
+
"form_urlencoded",
|
1628 |
+
"idna",
|
1629 |
+
"percent-encoding",
|
1630 |
+
]
|
1631 |
+
|
1632 |
+
[[package]]
|
1633 |
+
name = "urlencoding"
|
1634 |
+
version = "2.1.3"
|
1635 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1636 |
+
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
1637 |
+
|
1638 |
+
[[package]]
|
1639 |
+
name = "utf16_iter"
|
1640 |
+
version = "1.0.5"
|
1641 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1642 |
+
checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
|
1643 |
+
|
1644 |
+
[[package]]
|
1645 |
+
name = "utf8_iter"
|
1646 |
+
version = "1.0.4"
|
1647 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1648 |
+
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
1649 |
+
|
1650 |
+
[[package]]
|
1651 |
+
name = "utf8parse"
|
1652 |
+
version = "0.2.2"
|
1653 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1654 |
+
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
1655 |
+
|
1656 |
+
[[package]]
|
1657 |
+
name = "wasi"
|
1658 |
+
version = "0.11.1+wasi-snapshot-preview1"
|
1659 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1660 |
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
1661 |
+
|
1662 |
+
[[package]]
|
1663 |
+
name = "wasm"
|
1664 |
+
version = "0.1.0"
|
1665 |
+
dependencies = [
|
1666 |
+
"html",
|
1667 |
+
"js",
|
1668 |
+
"js-sys",
|
1669 |
+
"oxc",
|
1670 |
+
"thiserror",
|
1671 |
+
"wasm-bindgen",
|
1672 |
+
"web-sys",
|
1673 |
+
]
|
1674 |
+
|
1675 |
+
[[package]]
|
1676 |
+
name = "wasm-bindgen"
|
1677 |
+
version = "0.2.100"
|
1678 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1679 |
+
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
|
1680 |
+
dependencies = [
|
1681 |
+
"cfg-if",
|
1682 |
+
"once_cell",
|
1683 |
+
"rustversion",
|
1684 |
+
"wasm-bindgen-macro",
|
1685 |
+
]
|
1686 |
+
|
1687 |
+
[[package]]
|
1688 |
+
name = "wasm-bindgen-backend"
|
1689 |
+
version = "0.2.100"
|
1690 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1691 |
+
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
|
1692 |
+
dependencies = [
|
1693 |
+
"bumpalo",
|
1694 |
+
"log",
|
1695 |
+
"proc-macro2",
|
1696 |
+
"quote",
|
1697 |
+
"syn",
|
1698 |
+
"wasm-bindgen-shared",
|
1699 |
+
]
|
1700 |
+
|
1701 |
+
[[package]]
|
1702 |
+
name = "wasm-bindgen-macro"
|
1703 |
+
version = "0.2.100"
|
1704 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1705 |
+
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
|
1706 |
+
dependencies = [
|
1707 |
+
"quote",
|
1708 |
+
"wasm-bindgen-macro-support",
|
1709 |
+
]
|
1710 |
+
|
1711 |
+
[[package]]
|
1712 |
+
name = "wasm-bindgen-macro-support"
|
1713 |
+
version = "0.2.100"
|
1714 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1715 |
+
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
1716 |
+
dependencies = [
|
1717 |
+
"proc-macro2",
|
1718 |
+
"quote",
|
1719 |
+
"syn",
|
1720 |
+
"wasm-bindgen-backend",
|
1721 |
+
"wasm-bindgen-shared",
|
1722 |
+
]
|
1723 |
+
|
1724 |
+
[[package]]
|
1725 |
+
name = "wasm-bindgen-shared"
|
1726 |
+
version = "0.2.100"
|
1727 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1728 |
+
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
|
1729 |
+
dependencies = [
|
1730 |
+
"unicode-ident",
|
1731 |
+
]
|
1732 |
+
|
1733 |
+
[[package]]
|
1734 |
+
name = "web-sys"
|
1735 |
+
version = "0.3.77"
|
1736 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1737 |
+
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
|
1738 |
+
dependencies = [
|
1739 |
+
"js-sys",
|
1740 |
+
"wasm-bindgen",
|
1741 |
+
]
|
1742 |
+
|
1743 |
+
[[package]]
|
1744 |
+
name = "windows-sys"
|
1745 |
+
version = "0.59.0"
|
1746 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1747 |
+
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
1748 |
+
dependencies = [
|
1749 |
+
"windows-targets",
|
1750 |
+
]
|
1751 |
+
|
1752 |
+
[[package]]
|
1753 |
+
name = "windows-targets"
|
1754 |
+
version = "0.52.6"
|
1755 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1756 |
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
1757 |
+
dependencies = [
|
1758 |
+
"windows_aarch64_gnullvm",
|
1759 |
+
"windows_aarch64_msvc",
|
1760 |
+
"windows_i686_gnu",
|
1761 |
+
"windows_i686_gnullvm",
|
1762 |
+
"windows_i686_msvc",
|
1763 |
+
"windows_x86_64_gnu",
|
1764 |
+
"windows_x86_64_gnullvm",
|
1765 |
+
"windows_x86_64_msvc",
|
1766 |
+
]
|
1767 |
+
|
1768 |
+
[[package]]
|
1769 |
+
name = "windows_aarch64_gnullvm"
|
1770 |
+
version = "0.52.6"
|
1771 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1772 |
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
1773 |
+
|
1774 |
+
[[package]]
|
1775 |
+
name = "windows_aarch64_msvc"
|
1776 |
+
version = "0.52.6"
|
1777 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1778 |
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
1779 |
+
|
1780 |
+
[[package]]
|
1781 |
+
name = "windows_i686_gnu"
|
1782 |
+
version = "0.52.6"
|
1783 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1784 |
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
1785 |
+
|
1786 |
+
[[package]]
|
1787 |
+
name = "windows_i686_gnullvm"
|
1788 |
+
version = "0.52.6"
|
1789 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1790 |
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
1791 |
+
|
1792 |
+
[[package]]
|
1793 |
+
name = "windows_i686_msvc"
|
1794 |
+
version = "0.52.6"
|
1795 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1796 |
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
1797 |
+
|
1798 |
+
[[package]]
|
1799 |
+
name = "windows_x86_64_gnu"
|
1800 |
+
version = "0.52.6"
|
1801 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1802 |
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
1803 |
+
|
1804 |
+
[[package]]
|
1805 |
+
name = "windows_x86_64_gnullvm"
|
1806 |
+
version = "0.52.6"
|
1807 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1808 |
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
1809 |
+
|
1810 |
+
[[package]]
|
1811 |
+
name = "windows_x86_64_msvc"
|
1812 |
+
version = "0.52.6"
|
1813 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1814 |
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
1815 |
+
|
1816 |
+
[[package]]
|
1817 |
+
name = "winnow"
|
1818 |
+
version = "0.7.12"
|
1819 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1820 |
+
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
|
1821 |
+
dependencies = [
|
1822 |
+
"memchr",
|
1823 |
+
]
|
1824 |
+
|
1825 |
+
[[package]]
|
1826 |
+
name = "write16"
|
1827 |
+
version = "1.0.0"
|
1828 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1829 |
+
checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936"
|
1830 |
+
|
1831 |
+
[[package]]
|
1832 |
+
name = "writeable"
|
1833 |
+
version = "0.5.5"
|
1834 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1835 |
+
checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
|
1836 |
+
|
1837 |
+
[[package]]
|
1838 |
+
name = "writeable"
|
1839 |
+
version = "0.6.1"
|
1840 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1841 |
+
checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
|
1842 |
+
|
1843 |
+
[[package]]
|
1844 |
+
name = "yoke"
|
1845 |
+
version = "0.7.5"
|
1846 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1847 |
+
checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
|
1848 |
+
dependencies = [
|
1849 |
+
"serde",
|
1850 |
+
"stable_deref_trait",
|
1851 |
+
"yoke-derive 0.7.5",
|
1852 |
+
"zerofrom",
|
1853 |
+
]
|
1854 |
+
|
1855 |
+
[[package]]
|
1856 |
+
name = "yoke"
|
1857 |
+
version = "0.8.0"
|
1858 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1859 |
+
checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc"
|
1860 |
+
dependencies = [
|
1861 |
+
"serde",
|
1862 |
+
"stable_deref_trait",
|
1863 |
+
"yoke-derive 0.8.0",
|
1864 |
+
"zerofrom",
|
1865 |
+
]
|
1866 |
+
|
1867 |
+
[[package]]
|
1868 |
+
name = "yoke-derive"
|
1869 |
+
version = "0.7.5"
|
1870 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1871 |
+
checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
|
1872 |
+
dependencies = [
|
1873 |
+
"proc-macro2",
|
1874 |
+
"quote",
|
1875 |
+
"syn",
|
1876 |
+
"synstructure",
|
1877 |
+
]
|
1878 |
+
|
1879 |
+
[[package]]
|
1880 |
+
name = "yoke-derive"
|
1881 |
+
version = "0.8.0"
|
1882 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1883 |
+
checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6"
|
1884 |
+
dependencies = [
|
1885 |
+
"proc-macro2",
|
1886 |
+
"quote",
|
1887 |
+
"syn",
|
1888 |
+
"synstructure",
|
1889 |
+
]
|
1890 |
+
|
1891 |
+
[[package]]
|
1892 |
+
name = "zerocopy"
|
1893 |
+
version = "0.8.26"
|
1894 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1895 |
+
checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
|
1896 |
+
dependencies = [
|
1897 |
+
"zerocopy-derive",
|
1898 |
+
]
|
1899 |
+
|
1900 |
+
[[package]]
|
1901 |
+
name = "zerocopy-derive"
|
1902 |
+
version = "0.8.26"
|
1903 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1904 |
+
checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
|
1905 |
+
dependencies = [
|
1906 |
+
"proc-macro2",
|
1907 |
+
"quote",
|
1908 |
+
"syn",
|
1909 |
+
]
|
1910 |
+
|
1911 |
+
[[package]]
|
1912 |
+
name = "zerofrom"
|
1913 |
+
version = "0.1.6"
|
1914 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1915 |
+
checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
|
1916 |
+
dependencies = [
|
1917 |
+
"zerofrom-derive",
|
1918 |
+
]
|
1919 |
+
|
1920 |
+
[[package]]
|
1921 |
+
name = "zerofrom-derive"
|
1922 |
+
version = "0.1.6"
|
1923 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1924 |
+
checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
1925 |
+
dependencies = [
|
1926 |
+
"proc-macro2",
|
1927 |
+
"quote",
|
1928 |
+
"syn",
|
1929 |
+
"synstructure",
|
1930 |
+
]
|
1931 |
+
|
1932 |
+
[[package]]
|
1933 |
+
name = "zerotrie"
|
1934 |
+
version = "0.2.2"
|
1935 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1936 |
+
checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595"
|
1937 |
+
dependencies = [
|
1938 |
+
"displaydoc",
|
1939 |
+
"yoke 0.8.0",
|
1940 |
+
"zerofrom",
|
1941 |
+
]
|
1942 |
+
|
1943 |
+
[[package]]
|
1944 |
+
name = "zerovec"
|
1945 |
+
version = "0.10.4"
|
1946 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1947 |
+
checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079"
|
1948 |
+
dependencies = [
|
1949 |
+
"yoke 0.7.5",
|
1950 |
+
"zerofrom",
|
1951 |
+
"zerovec-derive 0.10.3",
|
1952 |
+
]
|
1953 |
+
|
1954 |
+
[[package]]
|
1955 |
+
name = "zerovec"
|
1956 |
+
version = "0.11.2"
|
1957 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1958 |
+
checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428"
|
1959 |
+
dependencies = [
|
1960 |
+
"yoke 0.8.0",
|
1961 |
+
"zerofrom",
|
1962 |
+
"zerovec-derive 0.11.1",
|
1963 |
+
]
|
1964 |
+
|
1965 |
+
[[package]]
|
1966 |
+
name = "zerovec-derive"
|
1967 |
+
version = "0.10.3"
|
1968 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1969 |
+
checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
|
1970 |
+
dependencies = [
|
1971 |
+
"proc-macro2",
|
1972 |
+
"quote",
|
1973 |
+
"syn",
|
1974 |
+
]
|
1975 |
+
|
1976 |
+
[[package]]
|
1977 |
+
name = "zerovec-derive"
|
1978 |
+
version = "0.11.1"
|
1979 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1980 |
+
checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f"
|
1981 |
+
dependencies = [
|
1982 |
+
"proc-macro2",
|
1983 |
+
"quote",
|
1984 |
+
"syn",
|
1985 |
+
]
|
rewriter/Cargo.toml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[workspace]
|
2 |
+
members = ["transform", "js", "html", "native", "wasm"]
|
3 |
+
resolver = "2"
|
4 |
+
|
5 |
+
[profile.release]
|
6 |
+
opt-level = 3
|
7 |
+
debug = true
|
8 |
+
lto = true
|
9 |
+
codegen-units = 1
|
10 |
+
panic = "abort"
|
11 |
+
|
12 |
+
[workspace.dependencies]
|
13 |
+
oxc = { version = "0.77.2", features = ["ast_visit"] }
|
14 |
+
|
15 |
+
[workspace.lints.clippy]
|
16 |
+
pedantic = { level = "warn", priority = -1 }
|
17 |
+
struct-excessive-bools = "allow"
|
18 |
+
missing-errors-doc = "allow"
|
19 |
+
cast-possible-truncation = "allow"
|
20 |
+
must-use-candidate = "allow"
|
rewriter/html/Cargo.toml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[package]
|
2 |
+
name = "html"
|
3 |
+
version = "0.1.0"
|
4 |
+
edition = "2024"
|
5 |
+
|
6 |
+
[dependencies]
|
7 |
+
oxc = { workspace = true }
|
8 |
+
thiserror = "2.0.12"
|
9 |
+
tl = { git = "https://github.com/r58playz/tl" }
|
10 |
+
transform = { version = "0.1.0", path = "../transform" }
|
11 |
+
|
12 |
+
[lints]
|
13 |
+
workspace = true
|
14 |
+
|
15 |
+
[features]
|
16 |
+
debug = ["transform/debug"]
|
rewriter/html/src/changes.rs
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use oxc::{allocator::Allocator, span::Span};
|
2 |
+
use transform::{
|
3 |
+
TransformResult, Transformer,
|
4 |
+
transform::{Transform, TransformLL},
|
5 |
+
transforms,
|
6 |
+
};
|
7 |
+
|
8 |
+
use crate::RewriterError;
|
9 |
+
|
10 |
+
#[derive(PartialEq, Eq)]
|
11 |
+
enum HtmlRewriteType<'alloc: 'data, 'data> {
|
12 |
+
AddScramAttr { key: &'data str, val: &'data str },
|
13 |
+
ReplaceAttr { new: &'alloc str },
|
14 |
+
ReplaceText { new: &'alloc str },
|
15 |
+
InsertText { text: &'alloc str },
|
16 |
+
RemoveText,
|
17 |
+
}
|
18 |
+
|
19 |
+
#[derive(PartialEq, Eq)]
|
20 |
+
pub struct HtmlRewrite<'alloc: 'data, 'data> {
|
21 |
+
span: Span,
|
22 |
+
ty: HtmlRewriteType<'alloc, 'data>,
|
23 |
+
}
|
24 |
+
|
25 |
+
impl<'alloc: 'data, 'data> HtmlRewrite<'alloc, 'data> {
|
26 |
+
pub fn add_scram_attr(after: Span, key: &'data str, val: &'data str) -> Self {
|
27 |
+
Self {
|
28 |
+
span: Span::new(after.end, after.end),
|
29 |
+
ty: HtmlRewriteType::AddScramAttr { key, val },
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
pub fn replace_attr(val: Span, new: &'alloc str) -> Self {
|
34 |
+
Self {
|
35 |
+
span: val,
|
36 |
+
ty: HtmlRewriteType::ReplaceAttr { new },
|
37 |
+
}
|
38 |
+
}
|
39 |
+
pub fn remove_attr(data: &'data str, key: Span, value: Span) -> Self {
|
40 |
+
let end = if Self::attr_is_quoted(data, value) {
|
41 |
+
value.end + 1
|
42 |
+
} else {
|
43 |
+
value.end
|
44 |
+
};
|
45 |
+
|
46 |
+
Self {
|
47 |
+
span: Span::new(key.start, end),
|
48 |
+
ty: HtmlRewriteType::RemoveText,
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
pub fn replace(node: Span, text: &'alloc str) -> Self {
|
53 |
+
Self {
|
54 |
+
span: node,
|
55 |
+
ty: HtmlRewriteType::ReplaceText { new: text },
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
pub fn insert_text(after: Span, text: &'alloc str) -> Self {
|
60 |
+
Self {
|
61 |
+
span: Span::new(after.end, after.end),
|
62 |
+
ty: HtmlRewriteType::InsertText { text },
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
pub fn remove_node(node: Span) -> Self {
|
67 |
+
Self {
|
68 |
+
span: node,
|
69 |
+
ty: HtmlRewriteType::RemoveText,
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
fn attr_is_quoted(data: &str, attr: Span) -> bool {
|
74 |
+
data.get((attr.start - 1) as usize..attr.start as usize)
|
75 |
+
.is_some_and(|x| x == "\'" || x == "\"")
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
impl<'alloc: 'data, 'data> Transform<'data> for HtmlRewrite<'alloc, 'data> {
|
80 |
+
type ToLowLevelData = &'data str;
|
81 |
+
|
82 |
+
fn span(&self) -> Span {
|
83 |
+
self.span
|
84 |
+
}
|
85 |
+
|
86 |
+
fn into_low_level(self, data: &Self::ToLowLevelData, _offset: i32) -> TransformLL<'data> {
|
87 |
+
let data = *data;
|
88 |
+
match self.ty {
|
89 |
+
HtmlRewriteType::AddScramAttr { key, val } => {
|
90 |
+
TransformLL::insert(transforms![" scramjet-attr-", key, "=\"", val, "\""])
|
91 |
+
}
|
92 |
+
HtmlRewriteType::ReplaceAttr { new } => {
|
93 |
+
TransformLL::replace(if Self::attr_is_quoted(data, self.span) {
|
94 |
+
transforms![new]
|
95 |
+
} else {
|
96 |
+
transforms!["\"", new, "\""]
|
97 |
+
})
|
98 |
+
}
|
99 |
+
HtmlRewriteType::ReplaceText { new } => TransformLL::replace(transforms![new]),
|
100 |
+
HtmlRewriteType::InsertText { text } => TransformLL::insert(transforms![text]),
|
101 |
+
HtmlRewriteType::RemoveText => TransformLL::replace(transforms![]),
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
impl PartialOrd for HtmlRewrite<'_, '_> {
|
107 |
+
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
108 |
+
Some(self.cmp(other))
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
impl Ord for HtmlRewrite<'_, '_> {
|
113 |
+
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
114 |
+
self.span.start.cmp(&other.span.start)
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
pub(crate) struct HtmlChanges<'alloc: 'data, 'data> {
|
119 |
+
inner: Transformer<'alloc, 'data, HtmlRewrite<'alloc, 'data>>,
|
120 |
+
}
|
121 |
+
|
122 |
+
impl<'alloc: 'data, 'data> HtmlChanges<'alloc, 'data> {
|
123 |
+
#[inline]
|
124 |
+
pub fn new() -> Self {
|
125 |
+
Self {
|
126 |
+
inner: Transformer::new(),
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
#[inline]
|
131 |
+
pub fn add(&mut self, rewrite: HtmlRewrite<'alloc, 'data>) {
|
132 |
+
self.inner.add(std::iter::once(rewrite));
|
133 |
+
}
|
134 |
+
|
135 |
+
#[inline]
|
136 |
+
pub fn set_alloc(&mut self, alloc: &'alloc Allocator) -> Result<(), RewriterError> {
|
137 |
+
Ok(self.inner.set_alloc(alloc)?)
|
138 |
+
}
|
139 |
+
|
140 |
+
#[inline]
|
141 |
+
pub fn take_alloc(&mut self) -> Result<(), RewriterError> {
|
142 |
+
Ok(self.inner.take_alloc()?)
|
143 |
+
}
|
144 |
+
|
145 |
+
#[inline]
|
146 |
+
pub fn empty(&self) -> bool {
|
147 |
+
self.inner.empty()
|
148 |
+
}
|
149 |
+
|
150 |
+
#[inline]
|
151 |
+
pub fn perform(&mut self, html: &'data str) -> Result<TransformResult<'alloc>, RewriterError> {
|
152 |
+
Ok(self.inner.perform(html, &html, false)?)
|
153 |
+
}
|
154 |
+
}
|
rewriter/html/src/lib.rs
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::{cell::RefCell, error::Error, num::TryFromIntError};
|
2 |
+
|
3 |
+
use changes::HtmlChanges;
|
4 |
+
use oxc::allocator::Allocator;
|
5 |
+
use rule::RewriteRule;
|
6 |
+
use thiserror::Error;
|
7 |
+
use tl::ParserOptions;
|
8 |
+
use visitor::Visitor;
|
9 |
+
|
10 |
+
mod changes;
|
11 |
+
pub mod rule;
|
12 |
+
mod visitor;
|
13 |
+
|
14 |
+
pub use visitor::{VisitorExternalTool, VisitorExternalToolCallback};
|
15 |
+
|
16 |
+
#[derive(Debug, Error)]
|
17 |
+
pub enum RewriterError {
|
18 |
+
#[error("tl: {0}")]
|
19 |
+
Tl(#[from] tl::ParseError),
|
20 |
+
#[error("transformer: {0}")]
|
21 |
+
Transformer(#[from] transform::TransformError),
|
22 |
+
|
23 |
+
#[error("rewrite function: {0}")]
|
24 |
+
Rewrite(Box<dyn Error + Sync + Send>),
|
25 |
+
#[error("external tool function: {0}")]
|
26 |
+
ExternalTool(Box<dyn Error + Sync + Send>),
|
27 |
+
#[error("external tool didn't return anything")]
|
28 |
+
ExternalToolEmpty,
|
29 |
+
|
30 |
+
#[error("Not utf8")]
|
31 |
+
NotUtf8,
|
32 |
+
#[error("usize too big")]
|
33 |
+
ConversionFailed(#[from] TryFromIntError),
|
34 |
+
#[error("Already rewriting")]
|
35 |
+
AlreadyRewriting,
|
36 |
+
#[error("Not rewriting")]
|
37 |
+
NotRewriting,
|
38 |
+
#[error("Changes left over")]
|
39 |
+
Leftover,
|
40 |
+
}
|
41 |
+
|
42 |
+
pub struct Rewriter<T> {
|
43 |
+
rules: Vec<RewriteRule<T>>,
|
44 |
+
external_tool: VisitorExternalToolCallback<T>,
|
45 |
+
|
46 |
+
changes: RefCell<Option<HtmlChanges<'static, 'static>>>,
|
47 |
+
}
|
48 |
+
|
49 |
+
impl<T> Rewriter<T> {
|
50 |
+
pub fn new(
|
51 |
+
rules: Vec<RewriteRule<T>>,
|
52 |
+
external_tool: VisitorExternalToolCallback<T>,
|
53 |
+
) -> Result<Self, RewriterError> {
|
54 |
+
Ok(Self {
|
55 |
+
rules,
|
56 |
+
external_tool,
|
57 |
+
changes: RefCell::new(Some(HtmlChanges::new())),
|
58 |
+
})
|
59 |
+
}
|
60 |
+
|
61 |
+
fn take_changes<'alloc: 'data, 'data>(
|
62 |
+
&'data self,
|
63 |
+
alloc: &'alloc Allocator,
|
64 |
+
) -> Result<HtmlChanges<'alloc, 'data>, RewriterError> {
|
65 |
+
let mut slot = self
|
66 |
+
.changes
|
67 |
+
.try_borrow_mut()
|
68 |
+
.map_err(|_| RewriterError::AlreadyRewriting)?;
|
69 |
+
|
70 |
+
slot.take()
|
71 |
+
.ok_or(RewriterError::AlreadyRewriting)
|
72 |
+
.and_then(|x| {
|
73 |
+
let mut x = unsafe {
|
74 |
+
std::mem::transmute::<HtmlChanges<'static, 'static>, HtmlChanges<'alloc, 'data>>(
|
75 |
+
x,
|
76 |
+
)
|
77 |
+
};
|
78 |
+
x.set_alloc(alloc)?;
|
79 |
+
Ok(x)
|
80 |
+
})
|
81 |
+
}
|
82 |
+
|
83 |
+
fn put_changes<'alloc: 'data, 'data>(
|
84 |
+
&'data self,
|
85 |
+
mut changes: HtmlChanges<'alloc, 'data>,
|
86 |
+
) -> Result<(), RewriterError> {
|
87 |
+
if !changes.empty() {
|
88 |
+
return Err(RewriterError::Leftover);
|
89 |
+
}
|
90 |
+
|
91 |
+
let mut slot = self
|
92 |
+
.changes
|
93 |
+
.try_borrow_mut()
|
94 |
+
.map_err(|_| RewriterError::AlreadyRewriting)?;
|
95 |
+
|
96 |
+
if slot.is_some() {
|
97 |
+
Err(RewriterError::NotRewriting)
|
98 |
+
} else {
|
99 |
+
changes.take_alloc()?;
|
100 |
+
|
101 |
+
let changes = unsafe {
|
102 |
+
std::mem::transmute::<HtmlChanges<'alloc, 'data>, HtmlChanges<'static, 'static>>(
|
103 |
+
changes,
|
104 |
+
)
|
105 |
+
};
|
106 |
+
|
107 |
+
slot.replace(changes);
|
108 |
+
|
109 |
+
Ok(())
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
pub fn rewrite<'alloc: 'data, 'data>(
|
114 |
+
&'data self,
|
115 |
+
alloc: &'alloc Allocator,
|
116 |
+
html: &'data str,
|
117 |
+
data: &T,
|
118 |
+
from_top: bool,
|
119 |
+
) -> Result<oxc::allocator::Vec<'alloc, u8>, RewriterError> {
|
120 |
+
let tree = tl::parse(html, ParserOptions::default())?;
|
121 |
+
|
122 |
+
let mut changes = self.take_changes(alloc)?;
|
123 |
+
|
124 |
+
let visitor = Visitor {
|
125 |
+
alloc,
|
126 |
+
rules: &self.rules,
|
127 |
+
external_tool_func: &self.external_tool,
|
128 |
+
rule_data: data,
|
129 |
+
|
130 |
+
data: html,
|
131 |
+
tree,
|
132 |
+
from_top,
|
133 |
+
};
|
134 |
+
visitor.rewrite(&mut changes)?;
|
135 |
+
|
136 |
+
let res = changes.perform(html)?;
|
137 |
+
|
138 |
+
self.put_changes(changes)?;
|
139 |
+
|
140 |
+
Ok(res.source)
|
141 |
+
}
|
142 |
+
}
|
rewriter/html/src/rule.rs
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::{
|
2 |
+
collections::{HashMap, HashSet},
|
3 |
+
error::Error,
|
4 |
+
};
|
5 |
+
|
6 |
+
use oxc::allocator::Allocator;
|
7 |
+
|
8 |
+
pub type RewriteRuleCallback<T> = Box<
|
9 |
+
dyn for<'alloc, 'data> Fn(
|
10 |
+
&'alloc Allocator,
|
11 |
+
&'data str,
|
12 |
+
&'data T,
|
13 |
+
) -> Result<Option<&'alloc str>, Box<dyn Error + Sync + Send>>,
|
14 |
+
>;
|
15 |
+
|
16 |
+
pub struct RewriteRule<T> {
|
17 |
+
pub attrs: HashMap<String, Option<HashSet<String>>>,
|
18 |
+
pub func: RewriteRuleCallback<T>,
|
19 |
+
}
|
20 |
+
|
21 |
+
#[macro_export]
|
22 |
+
macro_rules! attrmap {
|
23 |
+
({
|
24 |
+
$($attr:literal: [$($el:literal),*]),*
|
25 |
+
}) => {
|
26 |
+
{
|
27 |
+
let mut map = std::collections::HashMap::<String, Option<std::collections::HashSet<String>>>::new();
|
28 |
+
$(
|
29 |
+
{
|
30 |
+
let mut vec = std::collections::HashSet::new();
|
31 |
+
$(
|
32 |
+
vec.insert($el.to_string());
|
33 |
+
)*
|
34 |
+
map.insert($attr.to_string(), Some(vec));
|
35 |
+
}
|
36 |
+
)*
|
37 |
+
map
|
38 |
+
}
|
39 |
+
};
|
40 |
+
}
|
rewriter/html/src/visitor.rs
ADDED
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::error::Error;
|
2 |
+
|
3 |
+
use oxc::{
|
4 |
+
allocator::{Allocator, StringBuilder},
|
5 |
+
span::Span,
|
6 |
+
};
|
7 |
+
use tl::{Bytes, HTMLTag, Node, NodeHandle, VDom};
|
8 |
+
|
9 |
+
use crate::{
|
10 |
+
HtmlChanges, RewriterError,
|
11 |
+
changes::HtmlRewrite,
|
12 |
+
rule::{RewriteRule, RewriteRuleCallback},
|
13 |
+
};
|
14 |
+
|
15 |
+
const EVENT_ATTRIBUTES: [&str; 100] = [
|
16 |
+
"onbeforexrselect",
|
17 |
+
"onabort",
|
18 |
+
"onbeforeinput",
|
19 |
+
"onbeforematch",
|
20 |
+
"onbeforetoggle",
|
21 |
+
"onblur",
|
22 |
+
"oncancel",
|
23 |
+
"oncanplay",
|
24 |
+
"oncanplaythrough",
|
25 |
+
"onchange",
|
26 |
+
"onclick",
|
27 |
+
"onclose",
|
28 |
+
"oncontentvisibilityautostatechange",
|
29 |
+
"oncontextlost",
|
30 |
+
"oncontextmenu",
|
31 |
+
"oncontextrestored",
|
32 |
+
"oncuechange",
|
33 |
+
"ondblclick",
|
34 |
+
"ondrag",
|
35 |
+
"ondragend",
|
36 |
+
"ondragenter",
|
37 |
+
"ondragleave",
|
38 |
+
"ondragover",
|
39 |
+
"ondragstart",
|
40 |
+
"ondrop",
|
41 |
+
"ondurationchange",
|
42 |
+
"onemptied",
|
43 |
+
"onended",
|
44 |
+
"onerror",
|
45 |
+
"onfocus",
|
46 |
+
"onformdata",
|
47 |
+
"oninput",
|
48 |
+
"oninvalid",
|
49 |
+
"onkeydown",
|
50 |
+
"onkeypress",
|
51 |
+
"onkeyup",
|
52 |
+
"onload",
|
53 |
+
"onloadeddata",
|
54 |
+
"onloadedmetadata",
|
55 |
+
"onloadstart",
|
56 |
+
"onmousedown",
|
57 |
+
"onmouseenter",
|
58 |
+
"onmouseleave",
|
59 |
+
"onmousemove",
|
60 |
+
"onmouseout",
|
61 |
+
"onmouseover",
|
62 |
+
"onmouseup",
|
63 |
+
"onmousewheel",
|
64 |
+
"onpause",
|
65 |
+
"onplay",
|
66 |
+
"onplaying",
|
67 |
+
"onprogress",
|
68 |
+
"onratechange",
|
69 |
+
"onreset",
|
70 |
+
"onresize",
|
71 |
+
"onscroll",
|
72 |
+
"onsecuritypolicyviolation",
|
73 |
+
"onseeked",
|
74 |
+
"onseeking",
|
75 |
+
"onselect",
|
76 |
+
"onslotchange",
|
77 |
+
"onstalled",
|
78 |
+
"onsubmit",
|
79 |
+
"onsuspend",
|
80 |
+
"ontimeupdate",
|
81 |
+
"ontoggle",
|
82 |
+
"onvolumechange",
|
83 |
+
"onwaiting",
|
84 |
+
"onwebkitanimationend",
|
85 |
+
"onwebkitanimationiteration",
|
86 |
+
"onwebkitanimationstart",
|
87 |
+
"onwebkittransitionend",
|
88 |
+
"onwheel",
|
89 |
+
"onauxclick",
|
90 |
+
"ongotpointercapture",
|
91 |
+
"onlostpointercapture",
|
92 |
+
"onpointerdown",
|
93 |
+
"onpointermove",
|
94 |
+
"onpointerrawupdate",
|
95 |
+
"onpointerup",
|
96 |
+
"onpointercancel",
|
97 |
+
"onpointerover",
|
98 |
+
"onpointerout",
|
99 |
+
"onpointerenter",
|
100 |
+
"onpointerleave",
|
101 |
+
"onselectstart",
|
102 |
+
"onselectionchange",
|
103 |
+
"onanimationend",
|
104 |
+
"onanimationiteration",
|
105 |
+
"onanimationstart",
|
106 |
+
"ontransitionrun",
|
107 |
+
"ontransitionstart",
|
108 |
+
"ontransitionend",
|
109 |
+
"ontransitioncancel",
|
110 |
+
"oncopy",
|
111 |
+
"oncut",
|
112 |
+
"onpaste",
|
113 |
+
"onscrollend",
|
114 |
+
"onscrollsnapchange",
|
115 |
+
"onscrollsnapchanging",
|
116 |
+
];
|
117 |
+
|
118 |
+
pub type VisitorExternalToolCallback<T> = Box<
|
119 |
+
dyn for<'alloc, 'data> Fn(
|
120 |
+
&'alloc Allocator,
|
121 |
+
VisitorExternalTool<'data>,
|
122 |
+
&'data T,
|
123 |
+
) -> Result<Option<&'alloc str>, Box<dyn Error + Sync + Send>>,
|
124 |
+
>;
|
125 |
+
|
126 |
+
pub struct Visitor<'alloc: 'data, 'data, T> {
|
127 |
+
pub alloc: &'alloc Allocator,
|
128 |
+
pub rules: &'data [RewriteRule<T>],
|
129 |
+
pub external_tool_func: &'data VisitorExternalToolCallback<T>,
|
130 |
+
pub rule_data: &'data T,
|
131 |
+
|
132 |
+
pub data: &'data str,
|
133 |
+
pub tree: VDom<'data>,
|
134 |
+
pub from_top: bool,
|
135 |
+
}
|
136 |
+
|
137 |
+
pub enum VisitorExternalTool<'data> {
|
138 |
+
SetMetaBase(&'data str),
|
139 |
+
Base64(&'data str),
|
140 |
+
RewriteInlineScript { code: &'data str, module: bool },
|
141 |
+
RewriteJsAttr { attr: &'data str, code: &'data str },
|
142 |
+
RewriteHttpEquivContent(&'data str),
|
143 |
+
RewriteCss(&'data str),
|
144 |
+
GetScriptText { found_head: bool },
|
145 |
+
Log(&'data str),
|
146 |
+
}
|
147 |
+
|
148 |
+
impl<'alloc, 'data, T> Visitor<'alloc, 'data, T> {
|
149 |
+
fn boundaries(&self, tag: &HTMLTag<'data>) -> Result<Span, RewriterError> {
|
150 |
+
let (start, end) = tag.boundaries(self.tree.parser());
|
151 |
+
let end = end + 1;
|
152 |
+
Ok(Span::new(start.try_into()?, end.try_into()?))
|
153 |
+
}
|
154 |
+
|
155 |
+
fn calculate_bounds(&self, raw: &Bytes<'data>) -> Result<Span, RewriterError> {
|
156 |
+
let input = self.data.as_ptr();
|
157 |
+
let start = raw.as_ptr();
|
158 |
+
let offset = start as usize - input as usize;
|
159 |
+
let end = offset + raw.as_bytes().len();
|
160 |
+
|
161 |
+
Ok(Span::new(offset.try_into()?, end.try_into()?))
|
162 |
+
}
|
163 |
+
|
164 |
+
fn get(&'data self, handle: NodeHandle) -> &'data Node<'data> {
|
165 |
+
unsafe { handle.get(self.tree.parser()).unwrap_unchecked() }
|
166 |
+
}
|
167 |
+
|
168 |
+
fn check_rules(&self, name: &str, attr: &str) -> Option<&RewriteRuleCallback<T>> {
|
169 |
+
self.rules
|
170 |
+
.iter()
|
171 |
+
.find(|x| {
|
172 |
+
x.attrs.get(attr).is_some_and(|x| {
|
173 |
+
x.as_ref()
|
174 |
+
.is_none_or(|x| x.contains(name) || x.contains("*"))
|
175 |
+
})
|
176 |
+
})
|
177 |
+
.map(|x| &x.func)
|
178 |
+
}
|
179 |
+
|
180 |
+
fn match_script_type(ty: Option<&str>) -> bool {
|
181 |
+
ty.is_none_or(|x| {
|
182 |
+
matches!(
|
183 |
+
x,
|
184 |
+
"application/javascript" | "text/javascript" | "module" | "importmap",
|
185 |
+
)
|
186 |
+
})
|
187 |
+
}
|
188 |
+
|
189 |
+
fn external_tool(
|
190 |
+
&self,
|
191 |
+
tool: VisitorExternalTool<'data>,
|
192 |
+
) -> Result<Option<&'alloc str>, RewriterError> {
|
193 |
+
(self.external_tool_func)(self.alloc, tool, self.rule_data)
|
194 |
+
.map_err(RewriterError::ExternalTool)
|
195 |
+
}
|
196 |
+
|
197 |
+
fn external_tool_val(
|
198 |
+
&self,
|
199 |
+
tool: VisitorExternalTool<'data>,
|
200 |
+
) -> Result<&'alloc str, RewriterError> {
|
201 |
+
self.external_tool(tool)?
|
202 |
+
.ok_or(RewriterError::ExternalToolEmpty)
|
203 |
+
}
|
204 |
+
|
205 |
+
#[expect(clippy::too_many_lines)]
|
206 |
+
pub fn rewrite(
|
207 |
+
&'data self,
|
208 |
+
changes: &mut HtmlChanges<'alloc, 'data>,
|
209 |
+
) -> Result<(), RewriterError> {
|
210 |
+
let mut head = None;
|
211 |
+
|
212 |
+
for node in self.tree.nodes() {
|
213 |
+
if let Node::Tag(tag) = node {
|
214 |
+
let name = tag.name().try_as_utf8_str().ok_or(RewriterError::NotUtf8)?;
|
215 |
+
|
216 |
+
if name == "head" && head.is_none() {
|
217 |
+
head.replace(tag);
|
218 |
+
}
|
219 |
+
|
220 |
+
if name == "base"
|
221 |
+
&& let Some(Some(val)) = tag.attributes().get(&"href".into())
|
222 |
+
{
|
223 |
+
self.external_tool(VisitorExternalTool::SetMetaBase(
|
224 |
+
val.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?,
|
225 |
+
))?;
|
226 |
+
}
|
227 |
+
|
228 |
+
for (k, v) in tag.attributes().iter() {
|
229 |
+
let attr = k.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?;
|
230 |
+
|
231 |
+
if let Some(cb) = self.check_rules(name, attr)
|
232 |
+
&& let Some(v) = v
|
233 |
+
{
|
234 |
+
let value = v.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?;
|
235 |
+
let change = (cb)(self.alloc, value, self.rule_data)
|
236 |
+
.map_err(RewriterError::Rewrite)?;
|
237 |
+
|
238 |
+
let bounds = self.calculate_bounds(v)?;
|
239 |
+
|
240 |
+
if let Some(change) = change {
|
241 |
+
let change = if name == "script"
|
242 |
+
&& attr == "src" && let Some(Some(ty)) =
|
243 |
+
tag.attributes().get(&"type".into())
|
244 |
+
&& ty.try_as_utf8_str().ok_or(RewriterError::NotUtf8)? == "module"
|
245 |
+
{
|
246 |
+
self.alloc.alloc_concat_strs_array([change, "?type=module"])
|
247 |
+
} else {
|
248 |
+
change
|
249 |
+
};
|
250 |
+
|
251 |
+
changes.add(HtmlRewrite::replace_attr(bounds, change));
|
252 |
+
} else {
|
253 |
+
let key = self.calculate_bounds(k)?;
|
254 |
+
changes.add(HtmlRewrite::remove_attr(self.data, key, bounds));
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
if EVENT_ATTRIBUTES.contains(&attr)
|
259 |
+
&& let Some(v) = v
|
260 |
+
{
|
261 |
+
let value = v.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?;
|
262 |
+
let bounds = self.calculate_bounds(v)?;
|
263 |
+
let rewritten =
|
264 |
+
self.external_tool_val(VisitorExternalTool::RewriteJsAttr {
|
265 |
+
attr,
|
266 |
+
code: value,
|
267 |
+
})?;
|
268 |
+
|
269 |
+
changes.add(HtmlRewrite::replace_attr(bounds, rewritten));
|
270 |
+
changes.add(HtmlRewrite::add_scram_attr(bounds, attr, value));
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
if name == "style"
|
275 |
+
&& let Some(child) = tag.children().top().get(0)
|
276 |
+
&& let Node::Raw(child) = self.get(*child)
|
277 |
+
{
|
278 |
+
let rewritten = self.external_tool_val(VisitorExternalTool::RewriteCss(
|
279 |
+
child.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?,
|
280 |
+
))?;
|
281 |
+
|
282 |
+
changes.add(HtmlRewrite::replace(
|
283 |
+
self.calculate_bounds(child)?,
|
284 |
+
rewritten,
|
285 |
+
));
|
286 |
+
}
|
287 |
+
|
288 |
+
if name == "script"
|
289 |
+
&& let ty = tag
|
290 |
+
.attributes()
|
291 |
+
.get(&"type".into())
|
292 |
+
.and_then(|x| x.as_ref())
|
293 |
+
.map(|x| x.try_as_utf8_str().ok_or(RewriterError::NotUtf8))
|
294 |
+
.transpose()? && Self::match_script_type(ty)
|
295 |
+
&& tag.attributes().get(&"src".into()).is_none()
|
296 |
+
{
|
297 |
+
let child = tag.inner_html();
|
298 |
+
let code = child.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?;
|
299 |
+
let module = ty.is_some_and(|x| x == "module");
|
300 |
+
|
301 |
+
let b64 = self.external_tool_val(VisitorExternalTool::Base64(code))?;
|
302 |
+
let rewritten =
|
303 |
+
self.external_tool_val(VisitorExternalTool::RewriteInlineScript {
|
304 |
+
code,
|
305 |
+
module,
|
306 |
+
})?;
|
307 |
+
|
308 |
+
changes.add(HtmlRewrite::add_scram_attr(
|
309 |
+
self.calculate_bounds(tag.name())?,
|
310 |
+
"script-source-src",
|
311 |
+
b64,
|
312 |
+
));
|
313 |
+
changes.add(HtmlRewrite::replace(
|
314 |
+
self.calculate_bounds(child)?,
|
315 |
+
rewritten,
|
316 |
+
));
|
317 |
+
}
|
318 |
+
|
319 |
+
if name == "meta"
|
320 |
+
&& let Some(Some(eqiv)) = tag.attributes().get(&"http-equiv".into())
|
321 |
+
{
|
322 |
+
let mut val = StringBuilder::from_str_in(
|
323 |
+
eqiv.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?,
|
324 |
+
self.alloc,
|
325 |
+
);
|
326 |
+
val.as_mut_str().make_ascii_lowercase();
|
327 |
+
|
328 |
+
if val == "content-security-policy" {
|
329 |
+
changes.add(HtmlRewrite::remove_node(self.boundaries(tag)?));
|
330 |
+
} else if val == "refresh"
|
331 |
+
&& let Some(Some(content)) = tag.attributes().get(&"content".into())
|
332 |
+
{
|
333 |
+
let val = content.try_as_utf8_str().ok_or(RewriterError::NotUtf8)?;
|
334 |
+
let rewritten = self
|
335 |
+
.external_tool_val(VisitorExternalTool::RewriteHttpEquivContent(val))?;
|
336 |
+
changes.add(HtmlRewrite::replace_attr(
|
337 |
+
self.calculate_bounds(content)?,
|
338 |
+
rewritten,
|
339 |
+
));
|
340 |
+
}
|
341 |
+
}
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
if self.from_top {
|
346 |
+
let (head_span, head_text) = if let Some(head) = head {
|
347 |
+
let outer = self.boundaries(head)?;
|
348 |
+
let inner = self.calculate_bounds(head.inner_html())?;
|
349 |
+
|
350 |
+
let start = Span::new(outer.start, inner.start);
|
351 |
+
let text = self
|
352 |
+
.external_tool_val(VisitorExternalTool::GetScriptText { found_head: true })?;
|
353 |
+
(start, text)
|
354 |
+
} else {
|
355 |
+
let text = self
|
356 |
+
.external_tool_val(VisitorExternalTool::GetScriptText { found_head: false })?;
|
357 |
+
(Span::new(0, 0), text)
|
358 |
+
};
|
359 |
+
|
360 |
+
changes.add(HtmlRewrite::insert_text(head_span, head_text));
|
361 |
+
}
|
362 |
+
|
363 |
+
Ok(())
|
364 |
+
}
|
365 |
+
}
|
rewriter/js/Cargo.toml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[package]
|
2 |
+
name = "js"
|
3 |
+
version = "0.1.0"
|
4 |
+
edition = "2024"
|
5 |
+
|
6 |
+
[lints]
|
7 |
+
workspace = true
|
8 |
+
|
9 |
+
[dependencies]
|
10 |
+
oxc = { workspace = true }
|
11 |
+
smallvec = "1.15.0"
|
12 |
+
thiserror = "2.0.12"
|
13 |
+
transform = { version = "0.1.0", path = "../transform" }
|
14 |
+
|
15 |
+
[features]
|
16 |
+
default = ["debug"]
|
17 |
+
debug = ["transform/debug"]
|
rewriter/js/src/cfg.rs
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::error::Error;
|
2 |
+
|
3 |
+
use oxc::allocator::StringBuilder;
|
4 |
+
|
5 |
+
pub trait UrlRewriter {
|
6 |
+
fn rewrite(
|
7 |
+
&self,
|
8 |
+
cfg: &Config,
|
9 |
+
flags: &Flags,
|
10 |
+
url: &str,
|
11 |
+
builder: &mut StringBuilder,
|
12 |
+
module: bool,
|
13 |
+
) -> Result<(), Box<dyn Error + Sync + Send>>;
|
14 |
+
}
|
15 |
+
|
16 |
+
pub struct Config {
|
17 |
+
pub prefix: String,
|
18 |
+
|
19 |
+
pub wrapfn: String,
|
20 |
+
pub wrapthisfn: String,
|
21 |
+
pub importfn: String,
|
22 |
+
pub rewritefn: String,
|
23 |
+
pub setrealmfn: String,
|
24 |
+
pub metafn: String,
|
25 |
+
pub pushsourcemapfn: String,
|
26 |
+
}
|
27 |
+
|
28 |
+
#[derive(Debug)]
|
29 |
+
pub struct Flags {
|
30 |
+
pub base: String,
|
31 |
+
pub sourcetag: String,
|
32 |
+
|
33 |
+
pub is_module: bool,
|
34 |
+
pub capture_errors: bool,
|
35 |
+
pub scramitize: bool,
|
36 |
+
pub do_sourcemaps: bool,
|
37 |
+
pub strict_rewrites: bool,
|
38 |
+
}
|
rewriter/js/src/changes.rs
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::cmp::Ordering;
|
2 |
+
|
3 |
+
use oxc::{
|
4 |
+
allocator::Allocator,
|
5 |
+
ast::ast::AssignmentOperator,
|
6 |
+
span::{Atom, Span},
|
7 |
+
};
|
8 |
+
use transform::{
|
9 |
+
TransformResult, Transformer,
|
10 |
+
transform::{Transform, TransformLL},
|
11 |
+
transforms,
|
12 |
+
};
|
13 |
+
|
14 |
+
use crate::{
|
15 |
+
RewriterError,
|
16 |
+
cfg::{Config, Flags},
|
17 |
+
rewrite::Rewrite,
|
18 |
+
};
|
19 |
+
|
20 |
+
// const STRICTCHECKER: &str = "(function(a){arguments[0]=false;return a})(true)";
|
21 |
+
const STRICTCHECKER: &str = "(function(){return!this;})()";
|
22 |
+
|
23 |
+
macro_rules! change {
|
24 |
+
($span:expr, $($ty:tt)*) => {
|
25 |
+
$crate::changes::JsChange::new($span, $crate::changes::JsChangeType::$($ty)*)
|
26 |
+
};
|
27 |
+
}
|
28 |
+
pub(crate) use change;
|
29 |
+
|
30 |
+
#[derive(Debug, PartialEq, Eq)]
|
31 |
+
pub enum JsChangeType<'alloc: 'data, 'data> {
|
32 |
+
/// insert `${cfg.wrapfn}(`
|
33 |
+
WrapFnLeft { wrap: bool },
|
34 |
+
/// insert `,strictchecker)`
|
35 |
+
WrapFnRight { wrap: bool },
|
36 |
+
/// insert `${cfg.setrealmfn}({}).`
|
37 |
+
SetRealmFn,
|
38 |
+
/// insert `${cfg.wrapthis}(`
|
39 |
+
WrapThisFn,
|
40 |
+
/// insert `$scramerr(ident);`
|
41 |
+
ScramErrFn { ident: Atom<'data> },
|
42 |
+
/// insert `$scramitize(`
|
43 |
+
ScramitizeFn,
|
44 |
+
/// insert `eval(${cfg.rewritefn}(`
|
45 |
+
EvalRewriteFn,
|
46 |
+
/// insert `: ${cfg.wrapfn}(ident)`
|
47 |
+
ShorthandObj { ident: Atom<'data> },
|
48 |
+
/// insert scramtag
|
49 |
+
SourceTag,
|
50 |
+
|
51 |
+
/// replace span with `${cfg.importfn}`
|
52 |
+
ImportFn,
|
53 |
+
/// replace span with `${cfg.metafn}("${cfg.base}")`
|
54 |
+
MetaFn,
|
55 |
+
/// replace span with `((t)=>$scramjet$tryset(${name},"${op}",t)||(${name}${op}t))(`
|
56 |
+
AssignmentLeft {
|
57 |
+
name: Atom<'data>,
|
58 |
+
op: AssignmentOperator,
|
59 |
+
},
|
60 |
+
|
61 |
+
/// insert `)`
|
62 |
+
ClosingParen { semi: bool, replace: bool },
|
63 |
+
|
64 |
+
/// replace span with text
|
65 |
+
Replace { text: &'alloc str },
|
66 |
+
/// replace span with ""
|
67 |
+
Delete,
|
68 |
+
}
|
69 |
+
|
70 |
+
#[derive(Debug, PartialEq, Eq)]
|
71 |
+
pub struct JsChange<'alloc: 'data, 'data> {
|
72 |
+
pub span: Span,
|
73 |
+
pub ty: JsChangeType<'alloc, 'data>,
|
74 |
+
}
|
75 |
+
|
76 |
+
impl<'alloc: 'data, 'data> JsChange<'alloc, 'data> {
|
77 |
+
pub fn new(span: Span, ty: JsChangeType<'alloc, 'data>) -> Self {
|
78 |
+
Self { span, ty }
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
impl<'alloc: 'data, 'data> Transform<'data> for JsChange<'alloc, 'data> {
|
83 |
+
type ToLowLevelData = (&'data Config, &'data Flags);
|
84 |
+
|
85 |
+
fn span(&self) -> Span {
|
86 |
+
self.span
|
87 |
+
}
|
88 |
+
|
89 |
+
fn into_low_level(
|
90 |
+
self,
|
91 |
+
(cfg, flags): &Self::ToLowLevelData,
|
92 |
+
offset: i32,
|
93 |
+
) -> TransformLL<'data> {
|
94 |
+
use JsChangeType as Ty;
|
95 |
+
use TransformLL as LL;
|
96 |
+
match self.ty {
|
97 |
+
Ty::WrapFnLeft { wrap } => LL::insert(if wrap {
|
98 |
+
transforms!["(", &cfg.wrapfn, "("]
|
99 |
+
} else {
|
100 |
+
transforms![&cfg.wrapfn, "("]
|
101 |
+
}),
|
102 |
+
Ty::WrapFnRight { wrap } => LL::insert(if wrap {
|
103 |
+
transforms![",", STRICTCHECKER, "))"]
|
104 |
+
} else {
|
105 |
+
transforms![",", STRICTCHECKER, ")"]
|
106 |
+
}),
|
107 |
+
Ty::SetRealmFn => LL::insert(transforms![&cfg.setrealmfn, "({})."]),
|
108 |
+
Ty::WrapThisFn => LL::insert(transforms![&cfg.wrapthisfn, "("]),
|
109 |
+
Ty::ScramErrFn { ident } => LL::insert(transforms!["$scramerr(", ident, ");"]),
|
110 |
+
Ty::ScramitizeFn => LL::insert(transforms![" $scramitize("]),
|
111 |
+
Ty::EvalRewriteFn => LL::replace(transforms!["eval(", &cfg.rewritefn, "("]),
|
112 |
+
Ty::ShorthandObj { ident } => {
|
113 |
+
LL::insert(transforms![":", &cfg.wrapfn, "(", ident, ")"])
|
114 |
+
}
|
115 |
+
Ty::SourceTag => LL::insert(transforms![
|
116 |
+
"/*scramtag ",
|
117 |
+
self.span.start.wrapping_add_signed(offset),
|
118 |
+
" ",
|
119 |
+
&flags.sourcetag,
|
120 |
+
"*/"
|
121 |
+
]),
|
122 |
+
Ty::ImportFn => LL::replace(transforms![&cfg.importfn, "(\"", &flags.base, "\","]),
|
123 |
+
Ty::MetaFn => LL::replace(transforms![&cfg.metafn, "(\"", &flags.base, "\")"]),
|
124 |
+
Ty::AssignmentLeft { name, op } => LL::replace(transforms![
|
125 |
+
"((t)=>$scramjet$tryset(",
|
126 |
+
name,
|
127 |
+
",\"",
|
128 |
+
op,
|
129 |
+
"\",t)||(",
|
130 |
+
name,
|
131 |
+
op,
|
132 |
+
"t))("
|
133 |
+
]),
|
134 |
+
Ty::ClosingParen { semi, replace } => {
|
135 |
+
let vec = if semi {
|
136 |
+
transforms![");"]
|
137 |
+
} else {
|
138 |
+
transforms![")"]
|
139 |
+
};
|
140 |
+
|
141 |
+
if replace {
|
142 |
+
LL::replace(vec)
|
143 |
+
} else {
|
144 |
+
LL::insert(vec)
|
145 |
+
}
|
146 |
+
}
|
147 |
+
Ty::Replace { text } => LL::replace(transforms![text]),
|
148 |
+
Ty::Delete => LL::replace(transforms![]),
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
impl PartialOrd for JsChange<'_, '_> {
|
154 |
+
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
155 |
+
Some(self.cmp(other))
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
impl Ord for JsChange<'_, '_> {
|
160 |
+
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
161 |
+
use JsChangeType as Ty;
|
162 |
+
|
163 |
+
match self.span.start.cmp(&other.span.start) {
|
164 |
+
Ordering::Equal => match (&self.ty, &other.ty) {
|
165 |
+
(Ty::ScramErrFn { .. }, _) => Ordering::Less,
|
166 |
+
(_, Ty::ScramErrFn { .. }) => Ordering::Greater,
|
167 |
+
_ => Ordering::Equal,
|
168 |
+
},
|
169 |
+
x => x,
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
pub(crate) struct JsChanges<'alloc: 'data, 'data> {
|
175 |
+
inner: Transformer<'alloc, 'data, JsChange<'alloc, 'data>>,
|
176 |
+
}
|
177 |
+
|
178 |
+
impl<'alloc: 'data, 'data> JsChanges<'alloc, 'data> {
|
179 |
+
#[inline]
|
180 |
+
pub fn new() -> Self {
|
181 |
+
Self {
|
182 |
+
inner: Transformer::new(),
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
#[inline]
|
187 |
+
pub fn add(&mut self, rewrite: Rewrite<'alloc, 'data>) {
|
188 |
+
self.inner.add(rewrite.into_inner());
|
189 |
+
}
|
190 |
+
|
191 |
+
#[inline]
|
192 |
+
pub fn set_alloc(&mut self, alloc: &'alloc Allocator) -> Result<(), RewriterError> {
|
193 |
+
Ok(self.inner.set_alloc(alloc)?)
|
194 |
+
}
|
195 |
+
|
196 |
+
#[inline]
|
197 |
+
pub fn take_alloc(&mut self) -> Result<(), RewriterError> {
|
198 |
+
Ok(self.inner.take_alloc()?)
|
199 |
+
}
|
200 |
+
|
201 |
+
#[inline]
|
202 |
+
pub fn empty(&self) -> bool {
|
203 |
+
self.inner.empty()
|
204 |
+
}
|
205 |
+
|
206 |
+
#[inline]
|
207 |
+
pub fn perform(
|
208 |
+
&mut self,
|
209 |
+
js: &'data str,
|
210 |
+
cfg: &'data Config,
|
211 |
+
flags: &'data Flags,
|
212 |
+
) -> Result<TransformResult<'alloc>, RewriterError> {
|
213 |
+
Ok(self.inner.perform(js, &(cfg, flags), true)?)
|
214 |
+
}
|
215 |
+
}
|
rewriter/js/src/lib.rs
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::cell::RefCell;
|
2 |
+
|
3 |
+
use oxc::{
|
4 |
+
allocator::{Allocator, Vec},
|
5 |
+
ast_visit::Visit,
|
6 |
+
diagnostics::OxcDiagnostic,
|
7 |
+
parser::{ParseOptions, Parser},
|
8 |
+
span::SourceType,
|
9 |
+
};
|
10 |
+
use thiserror::Error;
|
11 |
+
|
12 |
+
pub mod cfg;
|
13 |
+
mod changes;
|
14 |
+
mod rewrite;
|
15 |
+
mod visitor;
|
16 |
+
|
17 |
+
use cfg::{Config, Flags, UrlRewriter};
|
18 |
+
use changes::JsChanges;
|
19 |
+
use visitor::Visitor;
|
20 |
+
|
21 |
+
#[derive(Error, Debug)]
|
22 |
+
pub enum RewriterError {
|
23 |
+
#[error("transformer error: {0}")]
|
24 |
+
Transformer(#[from] transform::TransformError),
|
25 |
+
#[error("url rewriter error: {0}")]
|
26 |
+
Url(Box<dyn std::error::Error + Sync + Send>),
|
27 |
+
#[error("formatting error: {0}")]
|
28 |
+
Formatting(#[from] std::fmt::Error),
|
29 |
+
|
30 |
+
#[error("oxc panicked in parser: {0}")]
|
31 |
+
OxcPanicked(String),
|
32 |
+
#[error("Already rewriting")]
|
33 |
+
AlreadyRewriting,
|
34 |
+
#[error("Not rewriting")]
|
35 |
+
NotRewriting,
|
36 |
+
#[error("Changes left over")]
|
37 |
+
Leftover,
|
38 |
+
}
|
39 |
+
|
40 |
+
#[derive(Debug)]
|
41 |
+
pub struct RewriteResult<'alloc> {
|
42 |
+
pub js: Vec<'alloc, u8>,
|
43 |
+
pub sourcemap: Vec<'alloc, u8>,
|
44 |
+
|
45 |
+
pub errors: std::vec::Vec<OxcDiagnostic>,
|
46 |
+
pub flags: Flags,
|
47 |
+
}
|
48 |
+
|
49 |
+
pub struct Rewriter<E: UrlRewriter> {
|
50 |
+
cfg: Config,
|
51 |
+
url: E,
|
52 |
+
|
53 |
+
changes: RefCell<Option<JsChanges<'static, 'static>>>,
|
54 |
+
}
|
55 |
+
|
56 |
+
impl<E: UrlRewriter> Rewriter<E> {
|
57 |
+
fn take_changes<'alloc: 'data, 'data>(
|
58 |
+
&'data self,
|
59 |
+
alloc: &'alloc Allocator,
|
60 |
+
) -> Result<JsChanges<'alloc, 'data>, RewriterError> {
|
61 |
+
let mut slot = self
|
62 |
+
.changes
|
63 |
+
.try_borrow_mut()
|
64 |
+
.map_err(|_| RewriterError::AlreadyRewriting)?;
|
65 |
+
|
66 |
+
slot.take()
|
67 |
+
.ok_or(RewriterError::AlreadyRewriting)
|
68 |
+
.and_then(|x| {
|
69 |
+
let mut x = unsafe {
|
70 |
+
std::mem::transmute::<JsChanges<'static, 'static>, JsChanges<'alloc, 'data>>(x)
|
71 |
+
};
|
72 |
+
x.set_alloc(alloc)?;
|
73 |
+
Ok(x)
|
74 |
+
})
|
75 |
+
}
|
76 |
+
|
77 |
+
fn put_changes<'alloc: 'data, 'data>(
|
78 |
+
&'data self,
|
79 |
+
mut changes: JsChanges<'alloc, 'data>,
|
80 |
+
) -> Result<(), RewriterError> {
|
81 |
+
if !changes.empty() {
|
82 |
+
return Err(RewriterError::Leftover);
|
83 |
+
}
|
84 |
+
|
85 |
+
let mut slot = self
|
86 |
+
.changes
|
87 |
+
.try_borrow_mut()
|
88 |
+
.map_err(|_| RewriterError::AlreadyRewriting)?;
|
89 |
+
|
90 |
+
if slot.is_some() {
|
91 |
+
Err(RewriterError::NotRewriting)
|
92 |
+
} else {
|
93 |
+
changes.take_alloc()?;
|
94 |
+
|
95 |
+
let changes = unsafe {
|
96 |
+
std::mem::transmute::<JsChanges<'alloc, 'data>, JsChanges<'static, 'static>>(
|
97 |
+
changes,
|
98 |
+
)
|
99 |
+
};
|
100 |
+
|
101 |
+
slot.replace(changes);
|
102 |
+
|
103 |
+
Ok(())
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
pub fn new(cfg: Config, url_rewriter: E) -> Self {
|
108 |
+
Self {
|
109 |
+
cfg,
|
110 |
+
url: url_rewriter,
|
111 |
+
changes: RefCell::new(Some(JsChanges::new())),
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
pub fn rewrite<'alloc: 'data, 'data>(
|
116 |
+
&'data self,
|
117 |
+
alloc: &'alloc Allocator,
|
118 |
+
js: &'data str,
|
119 |
+
flags: Flags,
|
120 |
+
) -> Result<RewriteResult<'alloc>, RewriterError> {
|
121 |
+
let source_type = SourceType::unambiguous()
|
122 |
+
.with_javascript(true)
|
123 |
+
.with_module(flags.is_module)
|
124 |
+
.with_standard(true);
|
125 |
+
let parsed = Parser::new(alloc, js, source_type)
|
126 |
+
.with_options(ParseOptions {
|
127 |
+
allow_v8_intrinsics: true,
|
128 |
+
allow_return_outside_function: true,
|
129 |
+
..Default::default()
|
130 |
+
})
|
131 |
+
.parse();
|
132 |
+
|
133 |
+
if parsed.panicked {
|
134 |
+
use std::fmt::Write;
|
135 |
+
|
136 |
+
let mut errors = String::new();
|
137 |
+
for error in parsed.errors {
|
138 |
+
writeln!(errors, "{error}")?;
|
139 |
+
}
|
140 |
+
return Err(RewriterError::OxcPanicked(errors));
|
141 |
+
}
|
142 |
+
|
143 |
+
let jschanges = self.take_changes(alloc)?;
|
144 |
+
|
145 |
+
let mut visitor = Visitor {
|
146 |
+
alloc,
|
147 |
+
jschanges,
|
148 |
+
error: None,
|
149 |
+
|
150 |
+
config: &self.cfg,
|
151 |
+
rewriter: &self.url,
|
152 |
+
flags,
|
153 |
+
};
|
154 |
+
visitor.visit_program(&parsed.program);
|
155 |
+
if let Some(error) = visitor.error {
|
156 |
+
return Err(RewriterError::Url(error));
|
157 |
+
}
|
158 |
+
let mut jschanges = visitor.jschanges;
|
159 |
+
|
160 |
+
let changed = jschanges.perform(js, &self.cfg, &visitor.flags)?;
|
161 |
+
|
162 |
+
self.put_changes(jschanges)?;
|
163 |
+
|
164 |
+
let js: Vec<'alloc, u8> = changed.source;
|
165 |
+
let sourcemap: Vec<'alloc, u8> = changed.map;
|
166 |
+
|
167 |
+
Ok(RewriteResult {
|
168 |
+
js,
|
169 |
+
sourcemap,
|
170 |
+
errors: parsed.errors,
|
171 |
+
flags: visitor.flags,
|
172 |
+
})
|
173 |
+
}
|
174 |
+
}
|
rewriter/js/src/rewrite.rs
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use oxc::{
|
2 |
+
ast::ast::AssignmentOperator,
|
3 |
+
span::{Atom, Span},
|
4 |
+
};
|
5 |
+
use smallvec::{SmallVec, smallvec};
|
6 |
+
|
7 |
+
use crate::changes::{JsChange, change};
|
8 |
+
|
9 |
+
macro_rules! rewrite {
|
10 |
+
($span:expr, $($ty:tt)*) => {
|
11 |
+
$crate::rewrite::Rewrite::new($span, $crate::rewrite::RewriteType::$($ty)*)
|
12 |
+
};
|
13 |
+
}
|
14 |
+
pub(crate) use rewrite;
|
15 |
+
|
16 |
+
#[derive(Debug, PartialEq, Eq)]
|
17 |
+
pub(crate) enum RewriteType<'alloc: 'data, 'data> {
|
18 |
+
/// `(cfg.wrapfn(ident,strictchecker))` | `cfg.wrapfn(ident,strictchecker)`
|
19 |
+
WrapFn {
|
20 |
+
wrap: bool,
|
21 |
+
},
|
22 |
+
/// `cfg.setrealmfn({}).ident`
|
23 |
+
SetRealmFn,
|
24 |
+
/// `cfg.wrapthis(this)`
|
25 |
+
WrapThisFn,
|
26 |
+
/// `(cfg.importfn("cfg.base"))`
|
27 |
+
ImportFn,
|
28 |
+
/// `cfg.metafn("cfg.base")`
|
29 |
+
MetaFn,
|
30 |
+
|
31 |
+
// dead code only if debug is disabled
|
32 |
+
#[allow(dead_code)]
|
33 |
+
/// `$scramerr(name)`
|
34 |
+
ScramErr {
|
35 |
+
ident: Atom<'data>,
|
36 |
+
},
|
37 |
+
/// `$scramitize(span)`
|
38 |
+
Scramitize,
|
39 |
+
|
40 |
+
/// `eval(cfg.rewritefn(inner))`
|
41 |
+
Eval {
|
42 |
+
inner: Span,
|
43 |
+
},
|
44 |
+
/// `((t)=>$scramjet$tryset(name,"op",t)||(name op t))(rhs)`
|
45 |
+
Assignment {
|
46 |
+
name: Atom<'data>,
|
47 |
+
rhs: Span,
|
48 |
+
op: AssignmentOperator,
|
49 |
+
},
|
50 |
+
/// `ident,` -> `ident: cfg.wrapfn(ident),`
|
51 |
+
ShorthandObj {
|
52 |
+
name: Atom<'data>,
|
53 |
+
},
|
54 |
+
SourceTag,
|
55 |
+
|
56 |
+
// don't use for anything static, only use for stuff like rewriteurl
|
57 |
+
Replace {
|
58 |
+
text: &'alloc str,
|
59 |
+
},
|
60 |
+
Delete,
|
61 |
+
}
|
62 |
+
|
63 |
+
pub(crate) struct Rewrite<'alloc, 'data> {
|
64 |
+
span: Span,
|
65 |
+
ty: RewriteType<'alloc, 'data>,
|
66 |
+
}
|
67 |
+
|
68 |
+
impl<'alloc: 'data, 'data> Rewrite<'alloc, 'data> {
|
69 |
+
pub fn new(span: Span, ty: RewriteType<'alloc, 'data>) -> Self {
|
70 |
+
Self { span, ty }
|
71 |
+
}
|
72 |
+
|
73 |
+
pub fn into_inner(self) -> SmallVec<[JsChange<'alloc, 'data>; 2]> {
|
74 |
+
self.ty.into_inner(self.span)
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
impl<'alloc: 'data, 'data> RewriteType<'alloc, 'data> {
|
79 |
+
fn into_inner(self, span: Span) -> SmallVec<[JsChange<'alloc, 'data>; 2]> {
|
80 |
+
macro_rules! span {
|
81 |
+
(start) => {
|
82 |
+
Span::new(span.start, span.start)
|
83 |
+
};
|
84 |
+
(end) => {
|
85 |
+
Span::new(span.end, span.end)
|
86 |
+
};
|
87 |
+
($span1:ident $span2:ident start) => {
|
88 |
+
Span::new($span1.start, $span2.start)
|
89 |
+
};
|
90 |
+
($span1:ident $span2:ident end) => {
|
91 |
+
Span::new($span1.end, $span2.end)
|
92 |
+
};
|
93 |
+
}
|
94 |
+
|
95 |
+
match self {
|
96 |
+
Self::WrapFn { wrap } => smallvec![
|
97 |
+
change!(span!(start), WrapFnLeft { wrap }),
|
98 |
+
change!(span!(end), WrapFnRight { wrap }),
|
99 |
+
],
|
100 |
+
Self::SetRealmFn => smallvec![change!(span, SetRealmFn)],
|
101 |
+
Self::WrapThisFn => smallvec![
|
102 |
+
change!(span!(start), WrapThisFn),
|
103 |
+
change!(
|
104 |
+
span!(end),
|
105 |
+
ClosingParen {
|
106 |
+
semi: false,
|
107 |
+
replace: false
|
108 |
+
}
|
109 |
+
),
|
110 |
+
],
|
111 |
+
Self::ImportFn => smallvec![change!(span, ImportFn)],
|
112 |
+
Self::MetaFn => smallvec![change!(span, MetaFn)],
|
113 |
+
Self::ScramErr { ident } => smallvec![change!(span!(end), ScramErrFn { ident })],
|
114 |
+
Self::Scramitize => smallvec![
|
115 |
+
change!(span!(start), ScramitizeFn),
|
116 |
+
change!(
|
117 |
+
span!(end),
|
118 |
+
ClosingParen {
|
119 |
+
semi: false,
|
120 |
+
replace: false
|
121 |
+
}
|
122 |
+
)
|
123 |
+
],
|
124 |
+
Self::Eval { inner } => smallvec![
|
125 |
+
change!(span!(span inner start), EvalRewriteFn),
|
126 |
+
change!(
|
127 |
+
span!(inner span end),
|
128 |
+
ClosingParen {
|
129 |
+
semi: false,
|
130 |
+
replace: true
|
131 |
+
}
|
132 |
+
)
|
133 |
+
],
|
134 |
+
Self::Assignment { name, rhs, op } => smallvec![
|
135 |
+
change!(span!(span rhs start), AssignmentLeft { name, op }),
|
136 |
+
change!(
|
137 |
+
span!(rhs span end),
|
138 |
+
ClosingParen {
|
139 |
+
semi: false,
|
140 |
+
replace: true
|
141 |
+
}
|
142 |
+
)
|
143 |
+
],
|
144 |
+
Self::ShorthandObj { name } => {
|
145 |
+
smallvec![change!(span!(end), ShorthandObj { ident: name })]
|
146 |
+
}
|
147 |
+
Self::SourceTag => smallvec![change!(span, SourceTag)],
|
148 |
+
Self::Replace { text } => smallvec![change!(span, Replace { text })],
|
149 |
+
Self::Delete => smallvec![change!(span, Delete)],
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
rewriter/js/src/visitor.rs
ADDED
@@ -0,0 +1,313 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::error::Error;
|
2 |
+
|
3 |
+
use oxc::{
|
4 |
+
allocator::{Allocator, StringBuilder},
|
5 |
+
ast::ast::{
|
6 |
+
AssignmentExpression, AssignmentTarget, CallExpression, DebuggerStatement,
|
7 |
+
ExportAllDeclaration, ExportNamedDeclaration, Expression, FunctionBody,
|
8 |
+
IdentifierReference, ImportDeclaration, ImportExpression, MemberExpression, MetaProperty,
|
9 |
+
NewExpression, ObjectExpression, ObjectPropertyKind, ReturnStatement, StringLiteral,
|
10 |
+
ThisExpression, UnaryExpression, UnaryOperator, UpdateExpression,
|
11 |
+
},
|
12 |
+
ast_visit::{Visit, walk},
|
13 |
+
span::{Atom, GetSpan, Span},
|
14 |
+
};
|
15 |
+
|
16 |
+
use crate::{
|
17 |
+
cfg::{Config, Flags, UrlRewriter},
|
18 |
+
changes::JsChanges,
|
19 |
+
rewrite::rewrite,
|
20 |
+
};
|
21 |
+
|
22 |
+
// js MUST not be able to get a reference to any of these because sbx
|
23 |
+
//
|
24 |
+
// maybe move this out of this lib?
|
25 |
+
const UNSAFE_GLOBALS: &[&str] = &[
|
26 |
+
"window",
|
27 |
+
"self",
|
28 |
+
"globalThis",
|
29 |
+
"this",
|
30 |
+
"parent",
|
31 |
+
"top",
|
32 |
+
"location",
|
33 |
+
"document",
|
34 |
+
"eval",
|
35 |
+
"frames",
|
36 |
+
];
|
37 |
+
|
38 |
+
pub struct Visitor<'alloc, 'data, E>
|
39 |
+
where
|
40 |
+
E: UrlRewriter,
|
41 |
+
{
|
42 |
+
pub alloc: &'alloc Allocator,
|
43 |
+
pub jschanges: JsChanges<'alloc, 'data>,
|
44 |
+
pub error: Option<Box<dyn Error + Sync + Send>>,
|
45 |
+
|
46 |
+
pub config: &'data Config,
|
47 |
+
pub rewriter: &'data E,
|
48 |
+
pub flags: Flags,
|
49 |
+
}
|
50 |
+
|
51 |
+
impl<'data, E> Visitor<'_, 'data, E>
|
52 |
+
where
|
53 |
+
E: UrlRewriter,
|
54 |
+
{
|
55 |
+
fn rewrite_url(&mut self, url: &StringLiteral<'data>, module: bool) {
|
56 |
+
let mut builder = StringBuilder::from_str_in(&self.config.prefix, self.alloc);
|
57 |
+
if self.error.is_some() {
|
58 |
+
builder.push_str("__URL_REWRITER_ALREADY_ERRORED__");
|
59 |
+
} else if let Err(err) =
|
60 |
+
self.rewriter
|
61 |
+
.rewrite(self.config, &self.flags, &url.value, &mut builder, module)
|
62 |
+
{
|
63 |
+
self.error.replace(err);
|
64 |
+
builder.push_str("__URL_REWRITER_ERROR__");
|
65 |
+
}
|
66 |
+
let text = builder.into_str();
|
67 |
+
|
68 |
+
self.jschanges
|
69 |
+
.add(rewrite!(url.span.shrink(1), Replace { text }));
|
70 |
+
}
|
71 |
+
|
72 |
+
fn rewrite_ident(&mut self, name: &Atom, span: Span) {
|
73 |
+
if UNSAFE_GLOBALS.contains(&name.as_str()) {
|
74 |
+
self.jschanges.add(rewrite!(span, WrapFn { wrap: true }));
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
fn walk_member_expression(&mut self, it: &Expression) -> bool {
|
79 |
+
match it {
|
80 |
+
Expression::Identifier(s) => {
|
81 |
+
self.rewrite_ident(&s.name, s.span);
|
82 |
+
true
|
83 |
+
}
|
84 |
+
Expression::StaticMemberExpression(s) => self.walk_member_expression(&s.object),
|
85 |
+
Expression::ComputedMemberExpression(s) => self.walk_member_expression(&s.object),
|
86 |
+
_ => false,
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
fn scramitize(&mut self, span: Span) {
|
91 |
+
self.jschanges.add(rewrite!(span, Scramitize));
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
impl<'data, E> Visit<'data> for Visitor<'_, 'data, E>
|
96 |
+
where
|
97 |
+
E: UrlRewriter,
|
98 |
+
{
|
99 |
+
fn visit_identifier_reference(&mut self, it: &IdentifierReference) {
|
100 |
+
// if self.config.capture_errors {
|
101 |
+
// self.jschanges.insert(JsChange::GenericChange {
|
102 |
+
// span: it.span,
|
103 |
+
// text: format!(
|
104 |
+
// "{}({}, typeof arguments != 'undefined' && arguments)",
|
105 |
+
// self.config.wrapfn, it.name
|
106 |
+
// ),
|
107 |
+
// });
|
108 |
+
// } else {
|
109 |
+
//
|
110 |
+
if UNSAFE_GLOBALS.contains(&it.name.as_str()) {
|
111 |
+
self.jschanges
|
112 |
+
.add(rewrite!(it.span, WrapFn { wrap: false }));
|
113 |
+
}
|
114 |
+
// }
|
115 |
+
}
|
116 |
+
|
117 |
+
fn visit_new_expression(&mut self, it: &NewExpression<'data>) {
|
118 |
+
self.walk_member_expression(&it.callee);
|
119 |
+
walk::walk_arguments(self, &it.arguments);
|
120 |
+
}
|
121 |
+
|
122 |
+
fn visit_member_expression(&mut self, it: &MemberExpression<'data>) {
|
123 |
+
// TODO
|
124 |
+
// you could break this with ["postMessage"] etc
|
125 |
+
// however this code only exists because of recaptcha whatever
|
126 |
+
// and it would slow down js execution a lot
|
127 |
+
if let MemberExpression::StaticMemberExpression(s) = it {
|
128 |
+
if s.property.name == "postMessage" {
|
129 |
+
self.jschanges.add(rewrite!(s.property.span, SetRealmFn));
|
130 |
+
|
131 |
+
walk::walk_expression(self, &s.object);
|
132 |
+
return; // unwise to walk the rest of the tree
|
133 |
+
}
|
134 |
+
|
135 |
+
if !self.flags.strict_rewrites
|
136 |
+
&& !UNSAFE_GLOBALS.contains(&s.property.name.as_str())
|
137 |
+
&& let Expression::Identifier(_) | Expression::ThisExpression(_) = &s.object
|
138 |
+
{
|
139 |
+
// cull tree - this should be safe
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
|
143 |
+
if self.flags.scramitize
|
144 |
+
&& !matches!(s.object, Expression::MetaProperty(_) | Expression::Super(_))
|
145 |
+
{
|
146 |
+
self.scramitize(s.object.span());
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
walk::walk_member_expression(self, it);
|
151 |
+
}
|
152 |
+
fn visit_this_expression(&mut self, it: &ThisExpression) {
|
153 |
+
self.jschanges.add(rewrite!(it.span, WrapThisFn));
|
154 |
+
}
|
155 |
+
|
156 |
+
fn visit_debugger_statement(&mut self, it: &DebuggerStatement) {
|
157 |
+
// delete debugger statements entirely. some sites will spam debugger as an anti-debugging measure, and we don't want that!
|
158 |
+
self.jschanges.add(rewrite!(it.span, Delete));
|
159 |
+
}
|
160 |
+
|
161 |
+
// we can't overwrite window.eval in the normal way because that would make everything an
|
162 |
+
// indirect eval, which could break things. we handle that edge case here
|
163 |
+
fn visit_call_expression(&mut self, it: &CallExpression<'data>) {
|
164 |
+
if let Expression::Identifier(s) = &it.callee {
|
165 |
+
// if it's optional that actually makes it an indirect eval which is handled separately
|
166 |
+
if s.name == "eval" && !it.optional {
|
167 |
+
self.jschanges.add(rewrite!(
|
168 |
+
it.span,
|
169 |
+
Eval {
|
170 |
+
inner: Span::new(s.span.end + 1, it.span.end),
|
171 |
+
}
|
172 |
+
));
|
173 |
+
|
174 |
+
// then we walk the arguments, but not the callee, since we want it to resolve to
|
175 |
+
// the real eval
|
176 |
+
walk::walk_arguments(self, &it.arguments);
|
177 |
+
return;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
if self.flags.scramitize {
|
181 |
+
self.scramitize(it.span);
|
182 |
+
}
|
183 |
+
walk::walk_call_expression(self, it);
|
184 |
+
}
|
185 |
+
|
186 |
+
fn visit_import_declaration(&mut self, it: &ImportDeclaration<'data>) {
|
187 |
+
self.rewrite_url(&it.source, true);
|
188 |
+
walk::walk_import_declaration(self, it);
|
189 |
+
}
|
190 |
+
fn visit_import_expression(&mut self, it: &ImportExpression<'data>) {
|
191 |
+
self.jschanges.add(rewrite!(
|
192 |
+
Span::new(it.span.start, it.span.start + 7),
|
193 |
+
ImportFn
|
194 |
+
));
|
195 |
+
walk::walk_import_expression(self, it);
|
196 |
+
}
|
197 |
+
|
198 |
+
fn visit_export_all_declaration(&mut self, it: &ExportAllDeclaration<'data>) {
|
199 |
+
self.rewrite_url(&it.source, true);
|
200 |
+
}
|
201 |
+
fn visit_export_named_declaration(&mut self, it: &ExportNamedDeclaration<'data>) {
|
202 |
+
if let Some(source) = &it.source {
|
203 |
+
self.rewrite_url(source, true);
|
204 |
+
}
|
205 |
+
// do not walk further, we don't want to rewrite the identifiers
|
206 |
+
}
|
207 |
+
|
208 |
+
#[cfg(feature = "debug")]
|
209 |
+
fn visit_try_statement(&mut self, it: &oxc::ast::ast::TryStatement<'data>) {
|
210 |
+
// for debugging we need to know what the error was
|
211 |
+
|
212 |
+
if self.flags.capture_errors
|
213 |
+
&& let Some(h) = &it.handler
|
214 |
+
&& let Some(name) = &h.param
|
215 |
+
&& let Some(ident) = name.pattern.get_identifier_name()
|
216 |
+
{
|
217 |
+
let start = h.body.span.start + 1;
|
218 |
+
self.jschanges
|
219 |
+
.add(rewrite!(Span::new(start, start), ScramErr { ident }));
|
220 |
+
}
|
221 |
+
|
222 |
+
walk::walk_try_statement(self, it);
|
223 |
+
}
|
224 |
+
|
225 |
+
fn visit_object_expression(&mut self, it: &ObjectExpression<'data>) {
|
226 |
+
for prop in &it.properties {
|
227 |
+
if let ObjectPropertyKind::ObjectProperty(p) = prop
|
228 |
+
&& let Expression::Identifier(s) = &p.value
|
229 |
+
&& UNSAFE_GLOBALS.contains(&s.name.to_string().as_str())
|
230 |
+
&& p.shorthand
|
231 |
+
{
|
232 |
+
self.jschanges
|
233 |
+
.add(rewrite!(s.span, ShorthandObj { name: s.name }));
|
234 |
+
return;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
walk::walk_object_expression(self, it);
|
239 |
+
}
|
240 |
+
|
241 |
+
fn visit_function_body(&mut self, it: &FunctionBody<'data>) {
|
242 |
+
// tag function for use in sourcemaps
|
243 |
+
if self.flags.do_sourcemaps {
|
244 |
+
self.jschanges
|
245 |
+
.add(rewrite!(Span::new(it.span.start, it.span.start), SourceTag));
|
246 |
+
}
|
247 |
+
walk::walk_function_body(self, it);
|
248 |
+
}
|
249 |
+
|
250 |
+
fn visit_return_statement(&mut self, it: &ReturnStatement<'data>) {
|
251 |
+
// if let Some(arg) = &it.argument {
|
252 |
+
// self.jschanges.insert(JsChange::GenericChange {
|
253 |
+
// span: Span::new(it.span.start + 6, it.span.start + 6),
|
254 |
+
// text: format!(" $scramdbg((()=>{{ try {{return arguments}} catch(_){{}} }})(),("),
|
255 |
+
// });
|
256 |
+
// self.jschanges.insert(JsChange::GenericChange {
|
257 |
+
// span: Span::new(expression_span(arg).end, expression_span(arg).end),
|
258 |
+
// text: format!("))"),
|
259 |
+
// });
|
260 |
+
// }
|
261 |
+
walk::walk_return_statement(self, it);
|
262 |
+
}
|
263 |
+
|
264 |
+
fn visit_unary_expression(&mut self, it: &UnaryExpression<'data>) {
|
265 |
+
if matches!(it.operator, UnaryOperator::Typeof) {
|
266 |
+
// don't walk to identifier rewrites since it won't matter
|
267 |
+
return;
|
268 |
+
}
|
269 |
+
walk::walk_unary_expression(self, it);
|
270 |
+
}
|
271 |
+
|
272 |
+
fn visit_update_expression(&mut self, _it: &UpdateExpression<'data>) {
|
273 |
+
// then no, don't walk it, we don't care
|
274 |
+
}
|
275 |
+
|
276 |
+
fn visit_meta_property(&mut self, it: &MetaProperty<'data>) {
|
277 |
+
if it.meta.name == "import" {
|
278 |
+
self.jschanges.add(rewrite!(it.span, MetaFn));
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
fn visit_assignment_expression(&mut self, it: &AssignmentExpression<'data>) {
|
283 |
+
match &it.left {
|
284 |
+
AssignmentTarget::AssignmentTargetIdentifier(s) => {
|
285 |
+
if ["location"].contains(&s.name.to_string().as_str()) {
|
286 |
+
self.jschanges.add(rewrite!(
|
287 |
+
it.span,
|
288 |
+
Assignment {
|
289 |
+
name: s.name,
|
290 |
+
rhs: it.right.span(),
|
291 |
+
op: it.operator,
|
292 |
+
}
|
293 |
+
));
|
294 |
+
|
295 |
+
// avoid walking rest of tree, i would need to figure out nested rewrites
|
296 |
+
// somehow
|
297 |
+
return;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
AssignmentTarget::ArrayAssignmentTarget(_) => {
|
301 |
+
// [location] = ["https://example.com"]
|
302 |
+
// this is such a ridiculously specific edge case. just ignore it
|
303 |
+
return;
|
304 |
+
}
|
305 |
+
_ => {
|
306 |
+
// only walk the left side if it isn't an identifier, we can't replace the
|
307 |
+
// identifier with a function obviously
|
308 |
+
walk::walk_assignment_target(self, &it.left);
|
309 |
+
}
|
310 |
+
}
|
311 |
+
walk::walk_expression(self, &it.right);
|
312 |
+
}
|
313 |
+
}
|
rewriter/native/Cargo.toml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[package]
|
2 |
+
name = "native"
|
3 |
+
version = "0.1.0"
|
4 |
+
edition = "2024"
|
5 |
+
|
6 |
+
[lints]
|
7 |
+
workspace = true
|
8 |
+
|
9 |
+
[dependencies]
|
10 |
+
anyhow = "1.0.97"
|
11 |
+
bytes = "1.10.1"
|
12 |
+
oxc = { workspace = true }
|
13 |
+
js = { version = "0.1.0", path = "../js", default-features = false }
|
14 |
+
url = "2.5.4"
|
15 |
+
urlencoding = "2.1.3"
|
16 |
+
clap = { version = "4.5.39", features = ["cargo", "derive"] }
|
17 |
+
html = { version = "0.1.0", path = "../html" }
|
18 |
+
|
19 |
+
[features]
|
20 |
+
debug = ["js/debug"]
|
21 |
+
|
22 |
+
[dev-dependencies]
|
23 |
+
boa_engine = "0.20.0"
|
rewriter/native/flamegraph.svg
ADDED
|
Git LFS Details
|
rewriter/native/sample/discord.js
ADDED
The diff for this file is too large to render.
See raw diff
|
|
rewriter/native/sample/google.js
ADDED
The diff for this file is too large to render.
See raw diff
|
|
rewriter/native/src/main.rs
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::{
|
2 |
+
env,
|
3 |
+
ffi::OsString,
|
4 |
+
fs,
|
5 |
+
path::PathBuf,
|
6 |
+
sync::Arc,
|
7 |
+
time::{Duration, Instant},
|
8 |
+
};
|
9 |
+
|
10 |
+
use anyhow::{Context, Result};
|
11 |
+
use clap::Parser;
|
12 |
+
use html::{Rewriter, attrmap, rule::RewriteRule};
|
13 |
+
use oxc::{
|
14 |
+
allocator::{Allocator, StringBuilder},
|
15 |
+
diagnostics::NamedSource,
|
16 |
+
};
|
17 |
+
use rewriter::NativeRewriter;
|
18 |
+
|
19 |
+
mod rewriter;
|
20 |
+
mod test_runner;
|
21 |
+
|
22 |
+
#[derive(Parser)]
|
23 |
+
pub struct RewriterOptions {
|
24 |
+
#[clap(long, default_value = "/scrammedjet/")]
|
25 |
+
prefix: String,
|
26 |
+
#[clap(long, default_value = "$wrap")]
|
27 |
+
wrapfn: String,
|
28 |
+
#[clap(long, default_value = "$gwrap")]
|
29 |
+
wrapthisfn: String,
|
30 |
+
#[clap(long, default_value = "$import")]
|
31 |
+
importfn: String,
|
32 |
+
#[clap(long, default_value = "$rewrite")]
|
33 |
+
rewritefn: String,
|
34 |
+
#[clap(long, default_value = "$meta")]
|
35 |
+
metafn: String,
|
36 |
+
#[clap(long, default_value = "$setrealm")]
|
37 |
+
setrealmfn: String,
|
38 |
+
#[clap(long, default_value = "$pushsourcemap")]
|
39 |
+
pushsourcemapfn: String,
|
40 |
+
|
41 |
+
#[clap(long, default_value = "https://google.com/glorngle/si.js")]
|
42 |
+
base: String,
|
43 |
+
#[clap(long, default_value = "glongle1")]
|
44 |
+
sourcetag: String,
|
45 |
+
|
46 |
+
#[clap(long, default_value_t = false)]
|
47 |
+
is_module: bool,
|
48 |
+
#[clap(long, default_value_t = false)]
|
49 |
+
capture_errors: bool,
|
50 |
+
#[clap(long, default_value_t = false)]
|
51 |
+
do_sourcemaps: bool,
|
52 |
+
#[clap(long, default_value_t = false)]
|
53 |
+
scramitize: bool,
|
54 |
+
#[clap(long, default_value_t = false)]
|
55 |
+
strict_rewrites: bool,
|
56 |
+
}
|
57 |
+
|
58 |
+
impl Default for RewriterOptions {
|
59 |
+
fn default() -> Self {
|
60 |
+
Self::parse_from(std::iter::empty::<OsString>())
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
#[derive(Parser)]
|
65 |
+
#[command(version = clap::crate_version!())]
|
66 |
+
pub enum Cli {
|
67 |
+
/// Rewrite a file
|
68 |
+
Rewrite {
|
69 |
+
file: PathBuf,
|
70 |
+
#[clap(flatten)]
|
71 |
+
config: RewriterOptions,
|
72 |
+
},
|
73 |
+
/// Rewrite a file multiple times for flamegraphing
|
74 |
+
Bench {
|
75 |
+
file: PathBuf,
|
76 |
+
iterations: u32,
|
77 |
+
#[clap(flatten)]
|
78 |
+
config: RewriterOptions,
|
79 |
+
},
|
80 |
+
Html {
|
81 |
+
file: PathBuf,
|
82 |
+
},
|
83 |
+
}
|
84 |
+
|
85 |
+
fn main() -> Result<()> {
|
86 |
+
let args = Cli::parse();
|
87 |
+
|
88 |
+
match args {
|
89 |
+
Cli::Rewrite { file, config } => {
|
90 |
+
let mut rewriter = NativeRewriter::new(&config);
|
91 |
+
|
92 |
+
let data = fs::read_to_string(file).context("failed to read file")?;
|
93 |
+
|
94 |
+
let res = rewriter.rewrite(&data, &config)?;
|
95 |
+
|
96 |
+
let source =
|
97 |
+
Arc::new(NamedSource::new(data.clone(), config.base).with_language("javascript"));
|
98 |
+
|
99 |
+
println!(
|
100 |
+
"rewritten:\n{}",
|
101 |
+
str::from_utf8(&res.js).context("failed to parse rewritten js")?
|
102 |
+
);
|
103 |
+
|
104 |
+
let unrewritten = NativeRewriter::unrewrite(&res);
|
105 |
+
|
106 |
+
eprintln!("errors:");
|
107 |
+
for err in res.errors {
|
108 |
+
eprintln!("{}", err.with_source_code(source.clone()));
|
109 |
+
}
|
110 |
+
|
111 |
+
rewriter.reset();
|
112 |
+
|
113 |
+
println!(
|
114 |
+
"unrewritten matches orig: {}",
|
115 |
+
data.as_bytes() == unrewritten.as_slice()
|
116 |
+
);
|
117 |
+
}
|
118 |
+
Cli::Bench {
|
119 |
+
file,
|
120 |
+
iterations,
|
121 |
+
config,
|
122 |
+
} => {
|
123 |
+
let mut rewriter = NativeRewriter::new(&config);
|
124 |
+
|
125 |
+
let data = fs::read_to_string(file).context("failed to read file")?;
|
126 |
+
let mut duration = Duration::from_secs(0);
|
127 |
+
|
128 |
+
let cnt = iterations * 100;
|
129 |
+
|
130 |
+
for x in 1..=cnt {
|
131 |
+
let before = Instant::now();
|
132 |
+
rewriter
|
133 |
+
.rewrite(&data, &config)
|
134 |
+
.context("failed to rewrite")?;
|
135 |
+
let after = Instant::now();
|
136 |
+
|
137 |
+
rewriter.reset();
|
138 |
+
|
139 |
+
duration += after - before;
|
140 |
+
|
141 |
+
if x % 100 == 0 {
|
142 |
+
println!("{x}...");
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
println!("iterations: {cnt}");
|
147 |
+
println!("total time: {duration:?}");
|
148 |
+
println!("avg time: {:?}", duration / cnt);
|
149 |
+
}
|
150 |
+
Cli::Html { file } => {
|
151 |
+
let data = fs::read_to_string(file).context("failed to read file")?;
|
152 |
+
|
153 |
+
let mut alloc = Allocator::new();
|
154 |
+
|
155 |
+
let rules = vec![RewriteRule {
|
156 |
+
attrs: attrmap!({
|
157 |
+
"href": ["a", "link"]
|
158 |
+
}),
|
159 |
+
func: Box::new(|alloc, x, ()| {
|
160 |
+
let mut build = StringBuilder::from_str_in(x, alloc);
|
161 |
+
build.push_str(" :3");
|
162 |
+
Ok(Some(build.into_str()))
|
163 |
+
}),
|
164 |
+
}];
|
165 |
+
|
166 |
+
let rewriter = Rewriter::new(
|
167 |
+
rules,
|
168 |
+
Box::new(|_, _, ()| Ok(Some("__EXTERNAL_TOOL_VAL__"))),
|
169 |
+
)?;
|
170 |
+
|
171 |
+
let ret = rewriter.rewrite(&alloc, &data, &(), true)?;
|
172 |
+
|
173 |
+
println!("{}", str::from_utf8(&ret)?);
|
174 |
+
|
175 |
+
alloc.reset();
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
Ok(())
|
180 |
+
}
|
rewriter/native/src/rewriter.rs
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::{error::Error, str::FromStr};
|
2 |
+
|
3 |
+
use anyhow::{Context, Result};
|
4 |
+
use bytes::Buf;
|
5 |
+
use js::{
|
6 |
+
RewriteResult, Rewriter,
|
7 |
+
cfg::{Config, Flags, UrlRewriter},
|
8 |
+
};
|
9 |
+
use oxc::allocator::{Allocator, StringBuilder};
|
10 |
+
use url::Url;
|
11 |
+
use urlencoding::encode;
|
12 |
+
|
13 |
+
use crate::RewriterOptions;
|
14 |
+
|
15 |
+
struct NativeUrlRewriter;
|
16 |
+
|
17 |
+
impl UrlRewriter for NativeUrlRewriter {
|
18 |
+
fn rewrite(
|
19 |
+
&self,
|
20 |
+
_cfg: &Config,
|
21 |
+
flags: &Flags,
|
22 |
+
url: &str,
|
23 |
+
builder: &mut StringBuilder,
|
24 |
+
_module: bool,
|
25 |
+
) -> Result<(), Box<dyn Error + Sync + Send>> {
|
26 |
+
let base = Url::from_str(&flags.base)?;
|
27 |
+
builder.push_str(encode(base.join(url)?.as_str()).as_ref());
|
28 |
+
|
29 |
+
Ok(())
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
#[derive(Debug)]
|
34 |
+
enum RewriteType<'a> {
|
35 |
+
Insert { pos: u32, size: u32 },
|
36 |
+
Replace { start: u32, end: u32, str: &'a [u8] },
|
37 |
+
}
|
38 |
+
|
39 |
+
pub struct NativeRewriter {
|
40 |
+
alloc: Allocator,
|
41 |
+
rewriter: Rewriter<NativeUrlRewriter>,
|
42 |
+
}
|
43 |
+
|
44 |
+
impl NativeRewriter {
|
45 |
+
#[allow(dead_code)]
|
46 |
+
pub fn default() -> Self {
|
47 |
+
Self::new(&RewriterOptions::default())
|
48 |
+
}
|
49 |
+
|
50 |
+
pub fn new(cfg: &RewriterOptions) -> Self {
|
51 |
+
let rewriter = Rewriter::new(
|
52 |
+
Config {
|
53 |
+
prefix: cfg.prefix.clone(),
|
54 |
+
wrapfn: cfg.wrapfn.clone(),
|
55 |
+
wrapthisfn: cfg.wrapthisfn.clone(),
|
56 |
+
importfn: cfg.importfn.clone(),
|
57 |
+
rewritefn: cfg.rewritefn.clone(),
|
58 |
+
metafn: cfg.metafn.clone(),
|
59 |
+
setrealmfn: cfg.setrealmfn.clone(),
|
60 |
+
pushsourcemapfn: cfg.pushsourcemapfn.clone(),
|
61 |
+
},
|
62 |
+
NativeUrlRewriter,
|
63 |
+
);
|
64 |
+
|
65 |
+
Self {
|
66 |
+
alloc: Allocator::new(),
|
67 |
+
rewriter,
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
#[allow(dead_code)]
|
72 |
+
pub fn rewrite_default(&self, data: &str) -> Result<RewriteResult<'_>> {
|
73 |
+
self.rewrite(data, &RewriterOptions::default())
|
74 |
+
}
|
75 |
+
|
76 |
+
pub fn rewrite(&self, data: &str, cfg: &RewriterOptions) -> Result<RewriteResult<'_>> {
|
77 |
+
self.rewriter
|
78 |
+
.rewrite(
|
79 |
+
&self.alloc,
|
80 |
+
data,
|
81 |
+
Flags {
|
82 |
+
base: cfg.base.clone(),
|
83 |
+
sourcetag: cfg.sourcetag.clone(),
|
84 |
+
|
85 |
+
is_module: cfg.is_module,
|
86 |
+
|
87 |
+
capture_errors: cfg.capture_errors,
|
88 |
+
do_sourcemaps: cfg.do_sourcemaps,
|
89 |
+
scramitize: cfg.scramitize,
|
90 |
+
strict_rewrites: cfg.strict_rewrites,
|
91 |
+
},
|
92 |
+
)
|
93 |
+
.context("failed to rewrite file")
|
94 |
+
}
|
95 |
+
pub fn reset(&mut self) {
|
96 |
+
self.alloc.reset();
|
97 |
+
}
|
98 |
+
|
99 |
+
pub fn unrewrite(res: &RewriteResult) -> Vec<u8> {
|
100 |
+
let js = res.js.as_slice();
|
101 |
+
let mut map = res.sourcemap.as_slice();
|
102 |
+
let rewrite_cnt = map.get_u32_le();
|
103 |
+
let mut rewrites = Vec::with_capacity(rewrite_cnt as usize);
|
104 |
+
|
105 |
+
for x in 0..rewrite_cnt {
|
106 |
+
let pos = map.get_u32_le();
|
107 |
+
let size = map.get_u32_le();
|
108 |
+
|
109 |
+
let ty = map.get_u8();
|
110 |
+
if ty == 0 {
|
111 |
+
rewrites.push(RewriteType::Insert { pos, size });
|
112 |
+
} else if ty == 1 {
|
113 |
+
let len = map.get_u32_le();
|
114 |
+
|
115 |
+
let (str, new) = map.split_at(len as usize);
|
116 |
+
map = new;
|
117 |
+
|
118 |
+
rewrites.push(RewriteType::Replace {
|
119 |
+
start: pos,
|
120 |
+
end: pos + size,
|
121 |
+
str,
|
122 |
+
});
|
123 |
+
} else {
|
124 |
+
panic!(
|
125 |
+
"{x} {ty} {:X?} {:#?}",
|
126 |
+
&map[0..10],
|
127 |
+
&rewrites.last_chunk::<3>()
|
128 |
+
)
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
let mut out = Vec::with_capacity(res.js.len());
|
133 |
+
|
134 |
+
let mut cursor: u32 = 0;
|
135 |
+
|
136 |
+
for rewrite in rewrites {
|
137 |
+
match rewrite {
|
138 |
+
RewriteType::Insert { pos, size } => {
|
139 |
+
out.extend_from_slice(&js[cursor as usize..pos as usize]);
|
140 |
+
cursor = pos + size;
|
141 |
+
}
|
142 |
+
RewriteType::Replace { start, end, str } => {
|
143 |
+
out.extend_from_slice(&js[cursor as usize..start as usize]);
|
144 |
+
out.extend_from_slice(&str);
|
145 |
+
cursor = end;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
out.extend_from_slice(&js[cursor as usize..]);
|
151 |
+
|
152 |
+
out.to_vec()
|
153 |
+
}
|
154 |
+
}
|
rewriter/native/src/test_runner.rs
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#[cfg(test)]
|
2 |
+
mod test {
|
3 |
+
use std::fs;
|
4 |
+
|
5 |
+
use crate::rewriter::NativeRewriter;
|
6 |
+
use boa_engine::{
|
7 |
+
Context, NativeFunction, Source, js_str, js_string,
|
8 |
+
object::ObjectInitializer,
|
9 |
+
property::{Attribute, PropertyDescriptorBuilder},
|
10 |
+
};
|
11 |
+
|
12 |
+
fn create_context() -> Context {
|
13 |
+
let mut context = Context::default();
|
14 |
+
|
15 |
+
let window = ObjectInitializer::new(&mut context).build();
|
16 |
+
context
|
17 |
+
.register_global_property(js_str!("window"), window, Attribute::READONLY)
|
18 |
+
.unwrap();
|
19 |
+
context
|
20 |
+
.global_object()
|
21 |
+
.define_property_or_throw(
|
22 |
+
js_str!("location"),
|
23 |
+
PropertyDescriptorBuilder::new()
|
24 |
+
.get(
|
25 |
+
NativeFunction::from_copy_closure(|_, _, _| Ok(js_str!("location").into()))
|
26 |
+
.to_js_function(context.realm()),
|
27 |
+
)
|
28 |
+
.set(
|
29 |
+
NativeFunction::from_copy_closure(|_, _, _| {
|
30 |
+
panic!("fail: window.location got set")
|
31 |
+
})
|
32 |
+
.to_js_function(context.realm()),
|
33 |
+
)
|
34 |
+
.build(),
|
35 |
+
&mut context,
|
36 |
+
)
|
37 |
+
.unwrap();
|
38 |
+
|
39 |
+
context
|
40 |
+
.register_global_callable(
|
41 |
+
js_string!("fail"),
|
42 |
+
0,
|
43 |
+
NativeFunction::from_copy_closure(|_, _, _| {
|
44 |
+
panic!("fail");
|
45 |
+
}),
|
46 |
+
)
|
47 |
+
.unwrap();
|
48 |
+
|
49 |
+
context
|
50 |
+
.eval(Source::from_bytes(
|
51 |
+
br#"
|
52 |
+
function $wrap(val) {
|
53 |
+
if (val === window || val === "location" || val === globalThis) return "";
|
54 |
+
|
55 |
+
return val;
|
56 |
+
}
|
57 |
+
|
58 |
+
const $gwrap = $wrap;
|
59 |
+
|
60 |
+
function $scramitize(val) { return val }
|
61 |
+
|
62 |
+
function assert(val) {
|
63 |
+
if (!val) fail();
|
64 |
+
}
|
65 |
+
|
66 |
+
function check(val) {
|
67 |
+
if (val === window || val === "location") fail();
|
68 |
+
}
|
69 |
+
"#,
|
70 |
+
))
|
71 |
+
.unwrap();
|
72 |
+
|
73 |
+
context
|
74 |
+
}
|
75 |
+
|
76 |
+
#[test]
|
77 |
+
fn google() {
|
78 |
+
let source_text = include_str!("../sample/google.js");
|
79 |
+
|
80 |
+
let rewriter = NativeRewriter::default();
|
81 |
+
rewriter.rewrite_default(source_text).unwrap();
|
82 |
+
}
|
83 |
+
|
84 |
+
#[test]
|
85 |
+
fn rewrite_tests() {
|
86 |
+
let files = fs::read_dir("./tests").unwrap();
|
87 |
+
|
88 |
+
let mut rewriter = NativeRewriter::default();
|
89 |
+
|
90 |
+
for file in files.map(|x| x.unwrap()) {
|
91 |
+
if !file.path().extension().unwrap().eq_ignore_ascii_case("js") {
|
92 |
+
continue;
|
93 |
+
}
|
94 |
+
|
95 |
+
let content = fs::read_to_string(file.path()).unwrap();
|
96 |
+
|
97 |
+
let rewritten = rewriter.rewrite_default(&content).unwrap();
|
98 |
+
println!("{}", std::str::from_utf8(&rewritten.js).unwrap());
|
99 |
+
|
100 |
+
let mut ctx = create_context();
|
101 |
+
|
102 |
+
ctx.eval(Source::from_bytes(rewritten.js.as_slice()))
|
103 |
+
.unwrap();
|
104 |
+
|
105 |
+
println!("PASS");
|
106 |
+
|
107 |
+
rewriter.reset();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
rewriter/native/test.html
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<head a=b>:3:3:3:3;#:</head>
|
2 |
+
|
3 |
+
<a href="goog" onclick=glorngle>test</a>
|
4 |
+
<script type=module src=glorngle.js></script>
|
5 |
+
<meta http-equiv=content-security-policy />
|
6 |
+
<script>
|
7 |
+
glorngle.js();
|
8 |
+
</script>
|
rewriter/native/test.js
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
window.location.href = "http://example.com";
|
2 |
+
|
3 |
+
console.log(top.window.aaa);
|
4 |
+
consle.log(globalThis["win" + "dow"]);
|
5 |
+
|
6 |
+
globalThis.eval("..");
|
7 |
+
|
8 |
+
let ref = { b: this.top.window, c: globalThis["win" + "dow"] };
|
9 |
+
|
10 |
+
|
11 |
+
export default ref;
|
12 |
+
|
13 |
+
export { ref };
|
14 |
+
|
15 |
+
|
16 |
+
export { ref as default };
|
17 |
+
|
18 |
+
export { S } from "module";
|
19 |
+
export * from "module";
|
20 |
+
import sd from "d"
|
21 |
+
|
22 |
+
location += "http://example.com";
|
23 |
+
|
24 |
+
function f() { return import("x") }
|
25 |
+
|
26 |
+
|
27 |
+
let window = (1, window);
|
28 |
+
|
29 |
+
let x = new this.Abc();
|
30 |
+
|
31 |
+
try{}catch(e){this.a.log()};
|
32 |
+
|
33 |
+
await import("test")
|
34 |
+
|
35 |
+
|
36 |
+
import{c as d,u as g,a as l,r as i,b,d as m,g as p,e as h,f as v,h as k}from"./1e3cB0WW.js";
|
rewriter/native/tests/0-sanity.js
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
check(window);
|
2 |
+
check(this);
|
3 |
+
check(globalThis);
|
4 |
+
check(location);
|
5 |
+
check(globalThis["win" + "dow"])
|
rewriter/native/tests/1-destructure.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
const { location: x } = globalThis;
|
2 |
+
|
3 |
+
check(x);
|
rewriter/native/tests/2-function-default.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function f(g = globalThis, l = location) {
|
2 |
+
check(g);
|
3 |
+
check(l);
|
4 |
+
}
|
5 |
+
|
6 |
+
f();
|
rewriter/native/tests/3-shadow-globals.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
function f(location, globalThis) {
|
3 |
+
assert(location === 1)
|
4 |
+
assert(globalThis === 2)
|
5 |
+
}
|
6 |
+
|
7 |
+
f(1, 2);
|
rewriter/native/tests/eval-overridden-globals.js.disabled
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
let reached = false
|
3 |
+
let eval = (t) => t === "location = 1" && (reached = true)
|
4 |
+
|
5 |
+
// testing to make sure this doesn't get rewritten
|
6 |
+
eval("location = 1")
|
7 |
+
|
8 |
+
if (!reached) fail();
|
rewriter/native/tests/for-assignment.js.disabled
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
for (location of ["https://google.com"]) {
|
2 |
+
//
|
3 |
+
}
|