Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: rustscript-compat-frontends
- uses: actions/checkout@v4
with:
repository: rustscript-lang/rustscript
path: rustscript
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Format check
working-directory: rustscript-compat-frontends
run: cargo fmt --all -- --check
- name: Clippy
working-directory: rustscript-compat-frontends
run: cargo clippy --all-targets -- -D warnings
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Tests
working-directory: rustscript-compat-frontends
run: cargo test --workspace
run: cargo test --workspace -- --test-threads=1
- name: CLI smoke
working-directory: rustscript-compat-frontends
run: |
cargo run --bin pd-vm-compat-run -- examples/example.js
cargo run --bin pd-vm-compat-run -- examples/example.lua
Expand All @@ -54,19 +44,11 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
path: rustscript-compat-frontends
- uses: actions/checkout@v4
with:
repository: rustscript-lang/rustscript
path: rustscript
- uses: dtolnay/rust-toolchain@stable
- name: Build pd-vm-compat-run
working-directory: rustscript-compat-frontends
run: cargo build --bin pd-vm-compat-run --release
- name: Stage pd-vm-compat-run artifact
shell: bash
working-directory: rustscript-compat-frontends
run: |
mkdir -p dist
suffix=""
Expand All @@ -75,9 +57,9 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: pd-vm-compat-run-${{ runner.os }}-${{ runner.arch }}
path: rustscript-compat-frontends/dist/*
path: dist/*
- name: Upload pd-vm-compat-run release asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: rustscript-compat-frontends/dist/*
files: dist/*
22 changes: 13 additions & 9 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
contents: read
env:
PACKAGE_ORDER: pd-vm-compat-frontends
PD_VM_VERSION: ${{ inputs.pd_vm_version || '0.22.2' }}
PD_VM_VERSION: ${{ inputs.pd_vm_version || '0.1.0' }}
PD_EDGE_ABI_VERSION: ${{ inputs.pd_edge_abi_version || '0.1.1' }}
WORKSPACE_VERSION_OVERRIDES: rustscript-compat-frontends=${{ inputs.version }} rustscript=${{ inputs.pd_vm_version || '0.22.2' }} pd-edge=${{ inputs.pd_edge_abi_version || '0.1.1' }}
WORKSPACE_VERSION_OVERRIDES: rustscript-compat-frontends=${{ inputs.version }} rustscript=${{ inputs.pd_vm_version || '0.1.0' }} pd-edge=${{ inputs.pd_edge_abi_version || '0.1.1' }}
steps:
- name: Checkout compatibility frontends
uses: actions/checkout@v4
Expand Down Expand Up @@ -72,8 +72,8 @@ jobs:

version = os.environ['PUBLISH_VERSION']
dep_versions = {
'pd-vm': os.environ.get('PD_VM_VERSION') or '0.22.2',
'pd-host-function': os.environ.get('PD_VM_VERSION') or '0.22.2',
'pd-vm': os.environ.get('PD_VM_VERSION') or '0.1.0',
'pd-host-function': os.environ.get('PD_VM_VERSION') or '0.1.0',
'pd-edge-abi': os.environ.get('PD_EDGE_ABI_VERSION') or '0.1.1',
}
workspace_versions = {}
Expand All @@ -97,19 +97,23 @@ jobs:
if section in ('[workspace.package]', '[package]') and stripped.startswith('version = '):
line = re.sub(r'version\s*=\s*"[^"]*"', f'version = "{manifest_version}"', line)
match = dep_re.match(line)
if match and 'path' in match.group(3):
if match and ('path' in match.group(3) or 'git' in match.group(3)):
prefix, key, body, suffix = match.groups()
package_match = re.search(r'package\s*=\s*"([^"]+)"', body)
dep_name = package_match.group(1) if package_match else key
dep_version = dep_versions.get(dep_name)
if dep_version:
body = re.sub(r'\s*,?\s*git\s*=\s*"[^"]*"', '', body)
body = re.sub(r'\s*,?\s*rev\s*=\s*"[^"]*"', '', body)
body = re.sub(r'\s*,?\s*path\s*=\s*"[^"]*"', '', body)
if re.search(r'version\s*=\s*"[^"]*"', body):
body = re.sub(r'version\s*=\s*"[^"]*"', f'version = "{dep_version}"', body)
else:
body = body.rstrip()
if body and not body.endswith(','):
body += ','
body += f' version = "{dep_version}"'
body = body.strip().strip(',')
if body:
body = f'version = "{dep_version}", {body}'
else:
body = f'version = "{dep_version}"'
line = prefix + body + suffix
out.append(line)
path.write_text('\n'.join(out) + '\n')
Expand Down
33 changes: 16 additions & 17 deletions Cargo.lock

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

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ name = "pd-vm-compat-run"
path = "src/bin/pd-vm-compat-run.rs"

[dependencies]
pd-vm = { path = "../rustscript", version = ">=0.1.0" }

[dev-dependencies]
pd-vm = { path = "../rustscript", version = ">=0.1.0" }
pd-vm = { git = "https://github.com/rustscript-lang/rustscript", rev = "b1d6cffede77f49410bf63525f30b9a46b02dc01" }
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ JavaScript and Lua compatibility frontends for `pd-vm`.

This crate owns the compatibility-language pieces that are intentionally outside the core `rustscript` repository:

- JavaScript parser dialect configuration and lowering rewrites
- JavaScript parser dialect, span-preserving parser compatibility fold for file-module `alias.member()` calls, and IR lowering onto qualified `alias::member` names
- Lua parser/lowering helpers
- JavaScript and Lua import scanning / import stripping for source-file loading
- compatibility frontend tests and fixtures

## Usage

```toml
pd-vm = "0.22.2"
pd-vm = "0.1.0"
pd-vm-compat-frontends = "0.1.0"
```

Expand Down Expand Up @@ -44,7 +44,7 @@ Core RustScript (`.rss`) remains in the `pd-vm` crate.
## Development

```bash
cargo test --workspace
cargo test --workspace
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
```
Loading
Loading