-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from lann/unstable
Include unstable features in published packages
- Loading branch information
Showing
7 changed files
with
252 additions
and
167 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
use wasm_pkg_core::{config::Config as WkgConfig, lock::LockFile}; | ||
use wit_component::DecodedWasm; | ||
use wit_parser::Stability; | ||
|
||
mod common; | ||
|
||
|
@@ -28,7 +29,7 @@ async fn test_build_wit() { | |
); | ||
assert_eq!( | ||
version.unwrap().to_string(), | ||
"0.2.0", | ||
"0.2.3", | ||
"Should have the correct version" | ||
); | ||
|
||
|
@@ -53,18 +54,31 @@ async fn test_build_wit() { | |
_ => panic!("Should be a package"), | ||
}; | ||
|
||
let name = resolve | ||
.package_names | ||
.iter() | ||
.find_map(|(name, id)| (pkg_id == *id).then_some(name)) | ||
.expect("Should be able to find the package name"); | ||
let package = resolve | ||
.packages | ||
.get(pkg_id) | ||
.expect("Should contain decoded package"); | ||
|
||
assert_eq!( | ||
name.to_string(), | ||
"wasi:[email protected].0", | ||
package.name.to_string(), | ||
"wasi:[email protected].3", | ||
"Should have the correct package name" | ||
); | ||
|
||
// @unstable items are retained | ||
let types_id = package | ||
.interfaces | ||
.get("types") | ||
.expect("wasi:http should have a types interface"); | ||
let send_informational = resolve.interfaces[*types_id] | ||
.functions | ||
.get("[method]response-outparam.send-informational") | ||
.expect("Should have send-informational method"); | ||
assert!( | ||
matches!(send_informational.stability, Stability::Unstable { .. }), | ||
"response-outparam.send-informational should be unstable" | ||
); | ||
|
||
assert!( | ||
resolve.package_direct_deps(pkg_id).count() > 0, | ||
"Should have direct dependencies embedded" | ||
|
@@ -85,8 +99,8 @@ async fn test_bad_dep_failure() { | |
.await | ||
.expect("Should be able to read the world file"); | ||
let str_world = str_world.replace( | ||
"import wasi:cli/[email protected].0;", | ||
"import totally:not/[email protected].0;", | ||
"import wasi:cli/[email protected].3;", | ||
"import totally:not/[email protected].3;", | ||
); | ||
tokio::fs::write(world_file, str_world) | ||
.await | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 29 additions & 11 deletions
40
crates/wasm-pkg-core/tests/fixtures/wasi-http/wit/proxy.wit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,50 @@ | ||
package wasi:http@0.2.0; | ||
package wasi:http@0.2.3; | ||
|
||
/// The `wasi:http/proxy` world captures a widely-implementable intersection of | ||
/// hosts that includes HTTP forward and reverse proxies. Components targeting | ||
/// this world may concurrently stream in and out any number of incoming and | ||
/// outgoing HTTP requests. | ||
world proxy { | ||
/// The `wasi:http/imports` world imports all the APIs for HTTP proxies. | ||
/// It is intended to be `include`d in other worlds. | ||
@since(version = 0.2.0) | ||
world imports { | ||
/// HTTP proxies have access to time and randomness. | ||
include wasi:clocks/imports@0.2.0; | ||
import wasi:random/random@0.2.0; | ||
@since(version = 0.2.0) | ||
import wasi:clocks/monotonic-clock@0.2.3; | ||
@since(version = 0.2.0) | ||
import wasi:clocks/wall-clock@0.2.3; | ||
@since(version = 0.2.0) | ||
import wasi:random/random@0.2.3; | ||
|
||
/// Proxies have standard output and error streams which are expected to | ||
/// terminate in a developer-facing console provided by the host. | ||
import wasi:cli/stdout@0.2.0; | ||
import wasi:cli/stderr@0.2.0; | ||
@since(version = 0.2.0) | ||
import wasi:cli/stdout@0.2.3; | ||
@since(version = 0.2.0) | ||
import wasi:cli/stderr@0.2.3; | ||
|
||
/// TODO: this is a temporary workaround until component tooling is able to | ||
/// gracefully handle the absence of stdin. Hosts must return an eof stream | ||
/// for this import, which is what wasi-libc + tooling will do automatically | ||
/// when this import is properly removed. | ||
import wasi:cli/stdin@0.2.0; | ||
@since(version = 0.2.0) | ||
import wasi:cli/stdin@0.2.3; | ||
|
||
/// This is the default handler to use when user code simply wants to make an | ||
/// HTTP request (e.g., via `fetch()`). | ||
@since(version = 0.2.0) | ||
import outgoing-handler; | ||
} | ||
|
||
/// The `wasi:http/proxy` world captures a widely-implementable intersection of | ||
/// hosts that includes HTTP forward and reverse proxies. Components targeting | ||
/// this world may concurrently stream in and out any number of incoming and | ||
/// outgoing HTTP requests. | ||
@since(version = 0.2.0) | ||
world proxy { | ||
@since(version = 0.2.0) | ||
include imports; | ||
|
||
/// The host delivers incoming HTTP requests to a component by calling the | ||
/// `handle` function of this exported interface. A host may arbitrarily reuse | ||
/// or not reuse component instance when delivering incoming HTTP requests and | ||
/// thus a component must be able to handle 0..N calls to `handle`. | ||
@since(version = 0.2.0) | ||
export incoming-handler; | ||
} |
Oops, something went wrong.