oxc-debolb 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. oxc_debolb-0.1.0/.github/workflows/CI.yml +136 -0
  2. oxc_debolb-0.1.0/.gitignore +9 -0
  3. oxc_debolb-0.1.0/.idea/.gitignore +8 -0
  4. oxc_debolb-0.1.0/.idea/misc.xml +6 -0
  5. oxc_debolb-0.1.0/.idea/modules.xml +8 -0
  6. oxc_debolb-0.1.0/.idea/swc_debolb.iml +20 -0
  7. oxc_debolb-0.1.0/.idea/vcs.xml +6 -0
  8. oxc_debolb-0.1.0/AGENTS.md +34 -0
  9. oxc_debolb-0.1.0/Cargo.lock +874 -0
  10. oxc_debolb-0.1.0/Cargo.toml +41 -0
  11. oxc_debolb-0.1.0/LICENSE +201 -0
  12. oxc_debolb-0.1.0/PKG-INFO +95 -0
  13. oxc_debolb-0.1.0/README.md +72 -0
  14. oxc_debolb-0.1.0/_check_equiv.py +45 -0
  15. oxc_debolb-0.1.0/akm_ast.js +1711 -0
  16. oxc_debolb-0.1.0/akm_result.js +18905 -0
  17. oxc_debolb-0.1.0/code.js +1 -0
  18. oxc_debolb-0.1.0/example.py +32 -0
  19. oxc_debolb-0.1.0/examples/const_calc_smoke.rs +36 -0
  20. oxc_debolb-0.1.0/examples/debug_decrypt_collect.rs +84 -0
  21. oxc_debolb-0.1.0/examples/debug_restore_single.rs +25 -0
  22. oxc_debolb-0.1.0/examples/debug_sequence.rs +28 -0
  23. oxc_debolb-0.1.0/examples/dump_postpass.rs +12 -0
  24. oxc_debolb-0.1.0/examples/parse_codegen.rs +39 -0
  25. oxc_debolb-0.1.0/examples/probe_traverse.rs +45 -0
  26. oxc_debolb-0.1.0/package-lock.json +215 -0
  27. oxc_debolb-0.1.0/package.json +9 -0
  28. oxc_debolb-0.1.0/pyproject.toml +35 -0
  29. oxc_debolb-0.1.0/python/oxc_debolb/__init__.py +5 -0
  30. oxc_debolb-0.1.0/python/oxc_debolb/akm_pipeline.py +148 -0
  31. oxc_debolb-0.1.0/python/oxc_debolb/akm_runtime.py +317 -0
  32. oxc_debolb-0.1.0/python/oxc_debolb/cli.py +47 -0
  33. oxc_debolb-0.1.0/python/oxc_debolb/js_engine.py +16 -0
  34. oxc_debolb-0.1.0/python/oxc_debolb/pipeline.py +139 -0
  35. oxc_debolb-0.1.0/python/oxc_debolb/runtime.py +470 -0
  36. oxc_debolb-0.1.0/sbsd_ast.js +1156 -0
  37. oxc_debolb-0.1.0/sbsd_ok.js +11438 -0
  38. oxc_debolb-0.1.0/src/eval.rs +335 -0
  39. oxc_debolb-0.1.0/src/hash.rs +91 -0
  40. oxc_debolb-0.1.0/src/lib.rs +114 -0
  41. oxc_debolb-0.1.0/src/parser_utils.rs +57 -0
  42. oxc_debolb-0.1.0/src/transforms/akm_runtime_arrays.rs +355 -0
  43. oxc_debolb-0.1.0/src/transforms/akm_runtime_getters.rs +197 -0
  44. oxc_debolb-0.1.0/src/transforms/const_calculate.rs +305 -0
  45. oxc_debolb-0.1.0/src/transforms/decrypt_apply.rs +372 -0
  46. oxc_debolb-0.1.0/src/transforms/decrypt_collector.rs +2693 -0
  47. oxc_debolb-0.1.0/src/transforms/format_check.rs +437 -0
  48. oxc_debolb-0.1.0/src/transforms/mod.rs +10 -0
  49. oxc_debolb-0.1.0/src/transforms/remove_useless.rs +229 -0
  50. oxc_debolb-0.1.0/src/transforms/resolve_sequence.rs +323 -0
  51. oxc_debolb-0.1.0/src/transforms/restore_single.rs +417 -0
  52. oxc_debolb-0.1.0/src/transforms/typeof_clean.rs +322 -0
  53. oxc_debolb-0.1.0/test_code.js +1 -0
  54. oxc_debolb-0.1.0/test_code.js.fc +19115 -0
  55. oxc_debolb-0.1.0/test_code.out.js +28718 -0
  56. oxc_debolb-0.1.0/test_code2.js +1 -0
  57. oxc_debolb-0.1.0/test_code2.out.js +15903 -0
  58. oxc_debolb-0.1.0/test_code3.js +1 -0
  59. oxc_debolb-0.1.0/test_code3.out.js +17176 -0
  60. oxc_debolb-0.1.0/test_code_.js +13899 -0
  61. oxc_debolb-0.1.0/test_code_.js.fc +19115 -0
  62. oxc_debolb-0.1.0/test_code_.out.js +16154 -0
@@ -0,0 +1,136 @@
1
+ name: CI
2
+
3
+ # Build abi3 (cp39+) wheels for Linux / Windows / macOS and an sdist, then
4
+ # publish to PyPI when a version tag (v*) is pushed.
5
+ #
6
+ # Publishing reads the API token from the GitHub repository secret
7
+ # `PYPI_API_TOKEN` (Settings → Secrets and variables → Actions → New secret).
8
+ # The token is NEVER stored in this file. Trusted Publishing (OIDC) is the
9
+ # recommended alternative — see the notes at the bottom of this file.
10
+
11
+ on:
12
+ push:
13
+ branches: [main, master]
14
+ tags: ["v*"]
15
+ pull_request:
16
+ workflow_dispatch:
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ jobs:
22
+ linux:
23
+ runs-on: ubuntu-latest
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ target: [x86_64, aarch64]
28
+ manylinux: [auto, musllinux_1_2]
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: actions/setup-python@v5
32
+ with:
33
+ python-version: "3.12"
34
+ - name: Build wheels
35
+ uses: PyO3/maturin-action@v1
36
+ with:
37
+ target: ${{ matrix.target }}
38
+ # abi3-py39 → one wheel covers CPython 3.9+. manylinux: auto picks a
39
+ # broadly-compatible glibc baseline; musllinux_1_2 covers Alpine /
40
+ # musl distros; aarch64 is cross-built via QEMU under the hood.
41
+ args: --release --out dist
42
+ sccache: "true"
43
+ manylinux: ${{ matrix.manylinux }}
44
+ - uses: actions/upload-artifact@v4
45
+ with:
46
+ name: wheels-linux-${{ matrix.target }}-${{ matrix.manylinux }}
47
+ path: dist
48
+
49
+ windows:
50
+ runs-on: windows-latest
51
+ strategy:
52
+ fail-fast: false
53
+ matrix:
54
+ target: [x64]
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+ - uses: actions/setup-python@v5
58
+ with:
59
+ python-version: "3.12"
60
+ architecture: ${{ matrix.target }}
61
+ - name: Build wheels
62
+ uses: PyO3/maturin-action@v1
63
+ with:
64
+ target: ${{ matrix.target }}
65
+ args: --release --out dist
66
+ sccache: "true"
67
+ - uses: actions/upload-artifact@v4
68
+ with:
69
+ name: wheels-windows-${{ matrix.target }}
70
+ path: dist
71
+
72
+ macos:
73
+ runs-on: macos-14 # Apple Silicon; cross-builds x86_64 too
74
+ strategy:
75
+ fail-fast: false
76
+ matrix:
77
+ target: [aarch64, x86_64]
78
+ steps:
79
+ - uses: actions/checkout@v4
80
+ - uses: actions/setup-python@v5
81
+ with:
82
+ python-version: "3.12"
83
+ - name: Build wheels
84
+ uses: PyO3/maturin-action@v1
85
+ with:
86
+ target: ${{ matrix.target }}
87
+ args: --release --out dist
88
+ sccache: "true"
89
+ - uses: actions/upload-artifact@v4
90
+ with:
91
+ name: wheels-macos-${{ matrix.target }}
92
+ path: dist
93
+
94
+ sdist:
95
+ runs-on: ubuntu-latest
96
+ steps:
97
+ - uses: actions/checkout@v4
98
+ - name: Build sdist
99
+ uses: PyO3/maturin-action@v1
100
+ with:
101
+ command: sdist
102
+ args: --out dist
103
+ - uses: actions/upload-artifact@v4
104
+ with:
105
+ name: wheels-sdist
106
+ path: dist
107
+
108
+ release:
109
+ name: Publish to PyPI
110
+ runs-on: ubuntu-latest
111
+ needs: [linux, windows, macos, sdist]
112
+ environment: pypi
113
+ steps:
114
+ - uses: actions/download-artifact@v4
115
+ with:
116
+ pattern: wheels-*
117
+ merge-multiple: true
118
+ path: dist
119
+ - name: Publish to PyPI
120
+ uses: PyO3/maturin-action@v1
121
+ env:
122
+ MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
123
+ with:
124
+ command: upload
125
+ args: --non-interactive --skip-existing dist/*
126
+
127
+ # ── Recommended: Trusted Publishing (OIDC) instead of a long-lived token ──
128
+ # 1. On PyPI: project → Settings → Publishing → add a GitHub Actions publisher
129
+ # (owner/repo = your repo, workflow = CI.yml, environment = pypi).
130
+ # 2. Replace the "Publish to PyPI" step above with:
131
+ # permissions:
132
+ # id-token: write # add at the job level
133
+ # - uses: actions/download-artifact@v4
134
+ # with: { pattern: wheels-*, merge-multiple: true, path: dist }
135
+ # - uses: pypa/gh-action-pypi-publish@release/v1
136
+ # No PYPI_API_TOKEN secret is then needed.
@@ -0,0 +1,9 @@
1
+ /target/
2
+ __pycache__/
3
+ *.pyc
4
+ .venv/
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ node_modules
9
+ .idea
@@ -0,0 +1,8 @@
1
+ # 默认忽略的文件
2
+ /shelf/
3
+ /workspace.xml
4
+ # 基于编辑器的 HTTP 客户端请求
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="jscore" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/swc_debolb.iml" filepath="$PROJECT_DIR$/.idea/swc_debolb.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="EMPTY_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="Python" name="Python facet">
5
+ <configuration sdkName="jscore" />
6
+ </facet>
7
+ </component>
8
+ <component name="NewModuleRootManager">
9
+ <content url="file://$MODULE_DIR$">
10
+ <sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
11
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
12
+ <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
13
+ <sourceFolder url="file://$MODULE_DIR$/python" isTestSource="false" />
14
+ <excludeFolder url="file://$MODULE_DIR$/target" />
15
+ </content>
16
+ <orderEntry type="inheritedJdk" />
17
+ <orderEntry type="sourceFolder" forTests="false" />
18
+ <orderEntry type="library" name="jscore interpreter library" level="application" />
19
+ </component>
20
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,34 @@
1
+ # Repository Guidelines
2
+
3
+ ## Project Structure & Module Organization
4
+
5
+ This repository builds `oxc_debolb`, a Rust + Python JavaScript deobfuscation tool. Core Rust code lives in `src/`; transformation passes are under `src/transforms/`, with helpers in `parser_utils.rs`, `hash.rs`, and `eval.rs`. Python package code lives in `python/oxc_debolb/`; `pipeline.py` coordinates the flow, `runtime.py` handles JavaScript execution, and `cli.py` provides `python -m oxc_debolb.cli`. Rust examples are in `examples/`. Python reference utilities are in `tests/`; `_bench/` contains performance probes. Root-level `test_code*.js`, `*.out.js`, and `sbsd_*.js` files are fixtures or generated outputs.
6
+
7
+ ## Build, Test, and Development Commands
8
+
9
+ - `cargo build`: compile the Rust crate and PyO3 library.
10
+ - `cargo build --release`: build optimized artifacts.
11
+ - `cargo test`: run Rust unit tests, including hash and evaluator checks.
12
+ - `cargo fmt`: format Rust code before submitting changes.
13
+ - `maturin develop`: install the Python extension into the active virtual environment.
14
+ - `python -m oxc_debolb.cli input.js output.js`: run the Python CLI.
15
+ - `python example.py`: run the local fixture example.
16
+ - `cargo run --example const_calc_smoke`: run a focused Rust example.
17
+
18
+ Run `npm install` only when Babel dependencies from `package.json` are missing.
19
+
20
+ ## Coding Style & Naming Conventions
21
+
22
+ Use Rust 2021 idioms and keep modules small, pass-oriented, and named in `snake_case`. Format Rust with `cargo fmt`; avoid broad rewrites of AST passes. Python uses 4-space indentation, type hints where useful, and `snake_case` functions. Keep generated fixtures separate from source changes unless intentional.
23
+
24
+ ## Testing Guidelines
25
+
26
+ Add Rust unit tests near the implementation in `mod tests` blocks when changing parser, hash, eval, or transform behavior. Use `cargo test` as the default validation. `tests/dzd_oracle.py` generates reference hash values through `iv8`; it is a support script, not a normal test runner. For end-to-end checks, run `maturin develop`, then `python example.py` or the CLI.
27
+
28
+ ## Commit & Pull Request Guidelines
29
+
30
+ This repository currently has no Git commit history, so no existing convention can be inferred. Use concise imperative subjects such as `fix sequence resolver edge case` or `add decrypt collector test`. Pull requests should describe the affected transform or Python pipeline step, list commands run, and note regenerated fixture outputs. Include before/after snippets only when tests do not make behavior clear.
31
+
32
+ ## Agent-Specific Instructions
33
+
34
+ Do not edit `target/`, `node_modules/`, or generated archive/output artifacts unless asked. Preserve large JavaScript fixtures unless they are directly part of the task, and keep changes scoped to the relevant Rust pass or Python pipeline layer.