0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00

chore: fix deno_resolver non-sync build (#27824)

This commit is contained in:
David Sherret 2025-01-27 10:28:33 -05:00 committed by Bartek Iwańczuk
parent 6fe2341897
commit 0007b73552
No known key found for this signature in database
GPG key ID: 0C6BCDDC3B3AD750
6 changed files with 76 additions and 10 deletions

View file

@ -1097,6 +1097,26 @@ const ci = {
},
]),
},
wasm: {
name: "build wasm32",
needs: ["pre_build"],
if: "${{ needs.pre_build.outputs.skip_build != 'true' }}",
"runs-on": ubuntuX86Runner,
"timeout-minutes": 30,
steps: skipJobsIfPrAndMarkedSkip([
...cloneRepoStep,
installRustStep,
{
name: "Install wasm target",
run: "rustup target add wasm32-unknown-unknown",
},
{
name: "Cargo build",
// we want this crate to be wasm compatible
run: "cargo build --target wasm32-unknown-unknown -p deno_resolver",
},
]),
},
"publish-canary": {
name: "publish canary",
"runs-on": ubuntuX86Runner,

View file

@ -688,6 +688,33 @@ jobs:
!./target/*/*.zip
!./target/*/*.tar.gz
key: '37-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
wasm:
name: build wasm32
needs:
- pre_build
if: '${{ needs.pre_build.outputs.skip_build != ''true'' }}'
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Configure git
run: |-
git config --global core.symlinks true
git config --global fetch.parallel 32
if: '!(matrix.skip)'
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: false
if: '!(matrix.skip)'
- uses: dsherret/rust-toolchain-file@v1
if: '!(matrix.skip)'
- name: Install wasm target
run: rustup target add wasm32-unknown-unknown
if: '!(matrix.skip)'
- name: Cargo build
run: cargo build --target wasm32-unknown-unknown -p deno_resolver
if: '!(matrix.skip)'
publish-canary:
name: publish canary
runs-on: ubuntu-24.04

5
Cargo.lock generated
View file

@ -2215,9 +2215,9 @@ dependencies = [
[[package]]
name = "deno_package_json"
version = "0.4.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a850e68d99edecd4ff3426dd14a3d44a33a6b2175f54d85db7b42e4a3844ed0b"
checksum = "d07d26dbfcc01e636aef86f9baff7faf5338398e74d283d8fe01e39068f48049"
dependencies = [
"boxed_error",
"deno_error",
@ -5272,7 +5272,6 @@ dependencies = [
"serde_json",
"sys_traits",
"thiserror 2.0.3",
"tokio",
"url",
]

View file

@ -128,7 +128,7 @@ data-encoding = "2.3.3"
data-url = "=0.3.1"
deno_cache_dir = "=0.17.0"
deno_error = "=0.5.5"
deno_package_json = { version = "=0.4.1", default-features = false }
deno_package_json = { version = "=0.4.2", default-features = false }
deno_unsync = "0.4.2"
dlopen2 = "0.6.1"
ecb = "=0.1.2"

View file

@ -32,5 +32,4 @@ serde.workspace = true
serde_json.workspace = true
sys_traits.workspace = true
thiserror.workspace = true
tokio.workspace = true
url.workspace = true

View file

@ -14,12 +14,33 @@ use url::Url;
use crate::errors::ClosestPkgJsonError;
use crate::errors::PackageJsonLoadError;
#[allow(clippy::disallowed_types)]
pub type PackageJsonCacheRc = crate::sync::MaybeArc<
dyn deno_package_json::PackageJsonCache
pub trait NodePackageJsonCache:
deno_package_json::PackageJsonCache
+ std::fmt::Debug
+ crate::sync::MaybeSend
+ crate::sync::MaybeSync
{
fn as_deno_package_json_cache(
&self,
) -> &dyn deno_package_json::PackageJsonCache;
}
impl<T> NodePackageJsonCache for T
where
T: deno_package_json::PackageJsonCache
+ std::fmt::Debug
+ crate::sync::MaybeSend
+ crate::sync::MaybeSync,
>;
{
fn as_deno_package_json_cache(
&self,
) -> &dyn deno_package_json::PackageJsonCache {
self
}
}
#[allow(clippy::disallowed_types)]
pub type PackageJsonCacheRc = crate::sync::MaybeArc<dyn NodePackageJsonCache>;
thread_local! {
static CACHE: RefCell<HashMap<PathBuf, PackageJsonRc>> = RefCell::new(HashMap::new());
@ -93,7 +114,7 @@ impl<TSys: FsRead> PackageJsonResolver<TSys> {
self
.loader_cache
.as_deref()
.map(|cache| cache as &dyn deno_package_json::PackageJsonCache),
.map(|cache| cache.as_deno_package_json_cache()),
path,
);
match result {