diff --git a/CMakeLists.txt b/CMakeLists.txt index f34e3b39..23b2ddac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,15 +6,15 @@ if (DEFINED ENV{HOST_API}) if (EXISTS ${HOST_API}) cmake_path(ABSOLUTE_PATH HOST_API) else () - set(HOST_API ${CMAKE_CURRENT_SOURCE_DIR}/host-apis/$ENV{HOST_API}) + set(HOST_API ${CMAKE_CURRENT_SOURCE_DIR}/src/host-apis/$ENV{HOST_API}) endif() if (NOT EXISTS ${HOST_API}) message(FATAL_ERROR "Host API `$ENV{HOST_API}` not found. The HOST_API environment \ - variable must be the name of a host API implementation provided in the `host-apis` \ + variable must be the name of a host API implementation provided in the `src/host-apis` \ folder of StarlingMonkey, or be an absolute path pointing to custom host API implementation.") endif() else() - set(HOST_API ${CMAKE_CURRENT_SOURCE_DIR}/host-apis/wasi-0.2.0) + set(HOST_API ${CMAKE_CURRENT_SOURCE_DIR}/src/host-apis/wasi-0.2.0) endif() message(STATUS "Using host API: ${HOST_API}") @@ -37,9 +37,9 @@ include("openssl") include("${HOST_API}/host_api.cmake") include("build-crates") -add_library(extension_api INTERFACE include/extension-api.h runtime/encode.h runtime/decode.h) +add_library(extension_api INTERFACE src/include/extension-api.h src/runtime/encode.h src/runtime/decode.h) target_link_libraries(extension_api INTERFACE rust-url spidermonkey) -target_include_directories(extension_api INTERFACE include deps/include runtime) +target_include_directories(extension_api INTERFACE src/include deps/include src/runtime) include("builtins") @@ -49,14 +49,14 @@ if (ENABLE_WPT) endif() add_executable(starling-raw.wasm - runtime/js.cpp - runtime/allocator.cpp - runtime/encode.cpp - runtime/decode.cpp - runtime/engine.cpp - runtime/event_loop.cpp - runtime/builtin.cpp - runtime/script_loader.cpp + src/runtime/js.cpp + src/runtime/allocator.cpp + src/runtime/encode.cpp + src/runtime/decode.cpp + src/runtime/engine.cpp + src/runtime/event_loop.cpp + src/runtime/builtin.cpp + src/runtime/script_loader.cpp ) option(USE_WASM_OPT "use wasm-opt to optimize the StarlingMonkey binary" ON) @@ -112,10 +112,13 @@ endif() set(RUNTIME_FILE "starling-raw.wasm") set(ADAPTER_FILE "preview1-adapter.wasm") -configure_file("componentize.sh" "${CMAKE_CURRENT_BINARY_DIR}/componentize.sh" @ONLY) + +configure_file("scripts/componentize.sh" "${CMAKE_CURRENT_BINARY_DIR}/componentize.sh" @ONLY) + if(EXISTS ${ADAPTER}) configure_file(${ADAPTER} "${CMAKE_CURRENT_BINARY_DIR}/${ADAPTER_FILE}" COPYONLY) endif() + configure_file(spin.toml spin.toml COPYONLY) function(componentize OUTPUT) diff --git a/justfile b/Justfile similarity index 100% rename from justfile rename to Justfile diff --git a/README.md b/README.md index 3b8e4de7..d506c98c 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug 3. Build the runtime -Building the runtime is done in two phases: first, cmake is used to build a raw version as a WebAssembly core module. Then, that module is turned into a [WebAssembly Component](https://component-model.bytecodealliance.org/) using the `componentize.sh` script. +Building the runtime is done in two phases: first, cmake is used to build a raw version as a WebAssembly core module. Then, that module is turned into a [WebAssembly Component](https://component-model.bytecodealliance.org/) using `scripts/componentize.sh`. The following command will build the `starling-raw.wasm` runtime module in the `cmake-build-release` directory: ```bash @@ -71,7 +71,7 @@ Then, the `starling-raw.wasm` module can be turned into a component with the fol ```bash cd cmake-build-release -./componentize.sh -o starling.wasm +./scripts/componentize.sh -o starling.wasm ``` The resulting runtime can be used to load and evaluate JS code dynamically: @@ -86,7 +86,7 @@ Alternatively, a JS file can be provided during componentization: ```bash cd cmake-build-release -./componentize.sh index.js -o starling.wasm +./scripts/componentize.sh index.js -o starling.wasm ``` This way, the JS file will be loaded during componentization, and the top-level code will be executed, and can e.g. register a handler for the `fetch` event to serve HTTP requests. @@ -115,13 +115,13 @@ Then visit http://0.0.0.0:8080/timers, or any test name and filter of the form ` 5. Using the runtime with other JS applications -The build directory contains a shell script `componentize.sh` that can be used to create components from JS applications. `componentize.sh` takes a single argument, the path to the JS application, and creates a component with a name of the form `[input-file-name].wasm` in the current working directory. +The build directory contains a shell script `scripts/componentize.sh` that can be used to create components from JS applications. `componentize.sh` takes a single argument, the path to the JS application, and creates a component with a name of the form `[input-file-name].wasm` in the current working directory. For example, the following command is equivalent to the `cmake` invocation from step 5, and will create the component `cmake-build-release/smoke.wasm`: ```bash cd cmake-build-release -./componentize.sh ../tests/smoke.js +./scripts/componentize.sh ../tests/smoke.js ``` ### Web Platform Tests diff --git a/cmake/add_builtin.cmake b/cmake/add_builtin.cmake index c750c3ec..62d9abaa 100644 --- a/cmake/add_builtin.cmake +++ b/cmake/add_builtin.cmake @@ -7,7 +7,8 @@ function(add_builtin) list(GET ARGN 0 SRC) cmake_path(GET SRC STEM NAME) cmake_path(GET SRC PARENT_PATH DIR) - string(REPLACE "/" "::" NS ${DIR}) + string(REPLACE "src/" "" NS ${DIR}) + string(REPLACE "/" "::" NS ${NS}) set(NS ${NS}::${NAME}) set(DEFAULT_ENABLE ON) else() diff --git a/cmake/builtins.cmake b/cmake/builtins.cmake index 16cc09f1..d9261943 100644 --- a/cmake/builtins.cmake +++ b/cmake/builtins.cmake @@ -1,7 +1,7 @@ if(CMAKE_SCRIPT_MODE_FILE) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") else() - add_library(builtins STATIC builtins/install_builtins.cpp) + add_library(builtins STATIC src/builtins/install_builtins.cpp) target_include_directories(builtins PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(builtins PRIVATE extension_api) endif() @@ -13,86 +13,87 @@ file(WRITE ${INSTALL_BUILTINS} "// This file is generated by CMake\n") # These builtins are always enabled. -add_builtin(builtins/web/global_self.cpp) -add_builtin(builtins/web/queue-microtask.cpp) -add_builtin(builtins/web/structured-clone.cpp) -add_builtin(builtins/web/base64.cpp) -add_builtin(builtins/web/blob.cpp) +add_builtin(src/builtins/web/global_self.cpp) +add_builtin(src/builtins/web/queue-microtask.cpp) +add_builtin(src/builtins/web/structured-clone.cpp) +add_builtin(src/builtins/web/base64.cpp) +add_builtin(src/builtins/web/blob.cpp) + add_builtin( builtins::web::dom_exception SRC - builtins/web/dom-exception.cpp + src/builtins/web/dom-exception.cpp INCLUDE_DIRS - runtime) + src/runtime) add_builtin( builtins::web::url SRC - builtins/web/url.cpp + src/builtins/web/url.cpp INCLUDE_DIRS - runtime) + src/runtime) -add_builtin(builtins/web/console.cpp) +add_builtin(src/builtins/web/console.cpp) -add_builtin(builtins/web/performance.cpp) +add_builtin(src/builtins/web/performance.cpp) add_builtin( builtins::web::timers SRC - builtins/web/timers.cpp + src/builtins/web/timers.cpp INCLUDE_DIRS - runtime) + src/runtime) -add_builtin(builtins/web/worker-location.cpp) +add_builtin(src/builtins/web/worker-location.cpp) add_builtin( builtins::web::text-codec SRC - builtins/web/text-codec/text-codec.cpp - builtins/web/text-codec/text-decoder.cpp - builtins/web/text-codec/text-encoder.cpp + src/builtins/web/text-codec/text-codec.cpp + src/builtins/web/text-codec/text-decoder.cpp + src/builtins/web/text-codec/text-encoder.cpp INCLUDE_DIRS - runtime) + src/runtime) add_builtin( builtins::web::streams SRC - builtins/web/streams/compression-stream.cpp - builtins/web/streams/decompression-stream.cpp - builtins/web/streams/native-stream-sink.cpp - builtins/web/streams/native-stream-source.cpp - builtins/web/streams/streams.cpp - builtins/web/streams/transform-stream.cpp - builtins/web/streams/transform-stream-default-controller.cpp + src/builtins/web/streams/compression-stream.cpp + src/builtins/web/streams/decompression-stream.cpp + src/builtins/web/streams/native-stream-sink.cpp + src/builtins/web/streams/native-stream-source.cpp + src/builtins/web/streams/streams.cpp + src/builtins/web/streams/transform-stream.cpp + src/builtins/web/streams/transform-stream-default-controller.cpp INCLUDE_DIRS - runtime) + src/runtime) add_builtin( builtins::web::fetch SRC - builtins/web/fetch/fetch-api.cpp - builtins/web/fetch/headers.cpp - builtins/web/fetch/request-response.cpp) + src/builtins/web/fetch/fetch-api.cpp + src/builtins/web/fetch/headers.cpp + src/builtins/web/fetch/request-response.cpp) add_builtin( builtins::web::fetch::fetch_event SRC - builtins/web/fetch/fetch_event.cpp + src/builtins/web/fetch/fetch_event.cpp DEPENDENCIES - host_api) + host_api) add_builtin( builtins::web::crypto SRC - builtins/web/crypto/crypto.cpp - builtins/web/crypto/crypto-algorithm.cpp - builtins/web/crypto/crypto-key.cpp - builtins/web/crypto/crypto-key-ec-components.cpp - builtins/web/crypto/crypto-key-rsa-components.cpp - builtins/web/crypto/json-web-key.cpp - builtins/web/crypto/subtle-crypto.cpp + src/builtins/web/crypto/crypto.cpp + src/builtins/web/crypto/crypto-algorithm.cpp + src/builtins/web/crypto/crypto-key.cpp + src/builtins/web/crypto/crypto-key-ec-components.cpp + src/builtins/web/crypto/crypto-key-rsa-components.cpp + src/builtins/web/crypto/json-web-key.cpp + src/builtins/web/crypto/subtle-crypto.cpp DEPENDENCIES OpenSSL::Crypto fmt INCLUDE_DIRS - runtime) + src/runtime) diff --git a/componentize.sh b/scripts/componentize.sh similarity index 100% rename from componentize.sh rename to scripts/componentize.sh diff --git a/builtins/install_builtins.cpp b/src/builtins/install_builtins.cpp similarity index 100% rename from builtins/install_builtins.cpp rename to src/builtins/install_builtins.cpp diff --git a/builtins/web/base64.cpp b/src/builtins/web/base64.cpp similarity index 100% rename from builtins/web/base64.cpp rename to src/builtins/web/base64.cpp diff --git a/builtins/web/base64.h b/src/builtins/web/base64.h similarity index 100% rename from builtins/web/base64.h rename to src/builtins/web/base64.h diff --git a/builtins/web/blob.cpp b/src/builtins/web/blob.cpp similarity index 100% rename from builtins/web/blob.cpp rename to src/builtins/web/blob.cpp diff --git a/builtins/web/blob.h b/src/builtins/web/blob.h similarity index 100% rename from builtins/web/blob.h rename to src/builtins/web/blob.h diff --git a/builtins/web/console.cpp b/src/builtins/web/console.cpp similarity index 100% rename from builtins/web/console.cpp rename to src/builtins/web/console.cpp diff --git a/builtins/web/console.h b/src/builtins/web/console.h similarity index 100% rename from builtins/web/console.h rename to src/builtins/web/console.h diff --git a/builtins/web/crypto/crypto-algorithm.cpp b/src/builtins/web/crypto/crypto-algorithm.cpp similarity index 100% rename from builtins/web/crypto/crypto-algorithm.cpp rename to src/builtins/web/crypto/crypto-algorithm.cpp diff --git a/builtins/web/crypto/crypto-algorithm.h b/src/builtins/web/crypto/crypto-algorithm.h similarity index 100% rename from builtins/web/crypto/crypto-algorithm.h rename to src/builtins/web/crypto/crypto-algorithm.h diff --git a/builtins/web/crypto/crypto-key-ec-components.cpp b/src/builtins/web/crypto/crypto-key-ec-components.cpp similarity index 100% rename from builtins/web/crypto/crypto-key-ec-components.cpp rename to src/builtins/web/crypto/crypto-key-ec-components.cpp diff --git a/builtins/web/crypto/crypto-key-ec-components.h b/src/builtins/web/crypto/crypto-key-ec-components.h similarity index 100% rename from builtins/web/crypto/crypto-key-ec-components.h rename to src/builtins/web/crypto/crypto-key-ec-components.h diff --git a/builtins/web/crypto/crypto-key-rsa-components.cpp b/src/builtins/web/crypto/crypto-key-rsa-components.cpp similarity index 100% rename from builtins/web/crypto/crypto-key-rsa-components.cpp rename to src/builtins/web/crypto/crypto-key-rsa-components.cpp diff --git a/builtins/web/crypto/crypto-key-rsa-components.h b/src/builtins/web/crypto/crypto-key-rsa-components.h similarity index 100% rename from builtins/web/crypto/crypto-key-rsa-components.h rename to src/builtins/web/crypto/crypto-key-rsa-components.h diff --git a/builtins/web/crypto/crypto-key.cpp b/src/builtins/web/crypto/crypto-key.cpp similarity index 100% rename from builtins/web/crypto/crypto-key.cpp rename to src/builtins/web/crypto/crypto-key.cpp diff --git a/builtins/web/crypto/crypto-key.h b/src/builtins/web/crypto/crypto-key.h similarity index 100% rename from builtins/web/crypto/crypto-key.h rename to src/builtins/web/crypto/crypto-key.h diff --git a/builtins/web/crypto/crypto.cpp b/src/builtins/web/crypto/crypto.cpp similarity index 100% rename from builtins/web/crypto/crypto.cpp rename to src/builtins/web/crypto/crypto.cpp diff --git a/builtins/web/crypto/crypto.h b/src/builtins/web/crypto/crypto.h similarity index 100% rename from builtins/web/crypto/crypto.h rename to src/builtins/web/crypto/crypto.h diff --git a/builtins/web/crypto/json-web-key.cpp b/src/builtins/web/crypto/json-web-key.cpp similarity index 100% rename from builtins/web/crypto/json-web-key.cpp rename to src/builtins/web/crypto/json-web-key.cpp diff --git a/builtins/web/crypto/json-web-key.h b/src/builtins/web/crypto/json-web-key.h similarity index 100% rename from builtins/web/crypto/json-web-key.h rename to src/builtins/web/crypto/json-web-key.h diff --git a/builtins/web/crypto/subtle-crypto.cpp b/src/builtins/web/crypto/subtle-crypto.cpp similarity index 100% rename from builtins/web/crypto/subtle-crypto.cpp rename to src/builtins/web/crypto/subtle-crypto.cpp diff --git a/builtins/web/crypto/subtle-crypto.h b/src/builtins/web/crypto/subtle-crypto.h similarity index 100% rename from builtins/web/crypto/subtle-crypto.h rename to src/builtins/web/crypto/subtle-crypto.h diff --git a/builtins/web/dom-exception.cpp b/src/builtins/web/dom-exception.cpp similarity index 100% rename from builtins/web/dom-exception.cpp rename to src/builtins/web/dom-exception.cpp diff --git a/builtins/web/dom-exception.h b/src/builtins/web/dom-exception.h similarity index 100% rename from builtins/web/dom-exception.h rename to src/builtins/web/dom-exception.h diff --git a/builtins/web/fetch/fetch-api.cpp b/src/builtins/web/fetch/fetch-api.cpp similarity index 100% rename from builtins/web/fetch/fetch-api.cpp rename to src/builtins/web/fetch/fetch-api.cpp diff --git a/builtins/web/fetch/fetch-api.h b/src/builtins/web/fetch/fetch-api.h similarity index 100% rename from builtins/web/fetch/fetch-api.h rename to src/builtins/web/fetch/fetch-api.h diff --git a/builtins/web/fetch/fetch-errors.h b/src/builtins/web/fetch/fetch-errors.h similarity index 100% rename from builtins/web/fetch/fetch-errors.h rename to src/builtins/web/fetch/fetch-errors.h diff --git a/builtins/web/fetch/fetch_event.cpp b/src/builtins/web/fetch/fetch_event.cpp similarity index 100% rename from builtins/web/fetch/fetch_event.cpp rename to src/builtins/web/fetch/fetch_event.cpp diff --git a/builtins/web/fetch/fetch_event.h b/src/builtins/web/fetch/fetch_event.h similarity index 100% rename from builtins/web/fetch/fetch_event.h rename to src/builtins/web/fetch/fetch_event.h diff --git a/builtins/web/fetch/headers.cpp b/src/builtins/web/fetch/headers.cpp similarity index 100% rename from builtins/web/fetch/headers.cpp rename to src/builtins/web/fetch/headers.cpp diff --git a/builtins/web/fetch/headers.h b/src/builtins/web/fetch/headers.h similarity index 100% rename from builtins/web/fetch/headers.h rename to src/builtins/web/fetch/headers.h diff --git a/builtins/web/fetch/request-response.cpp b/src/builtins/web/fetch/request-response.cpp similarity index 100% rename from builtins/web/fetch/request-response.cpp rename to src/builtins/web/fetch/request-response.cpp diff --git a/builtins/web/fetch/request-response.h b/src/builtins/web/fetch/request-response.h similarity index 100% rename from builtins/web/fetch/request-response.h rename to src/builtins/web/fetch/request-response.h diff --git a/builtins/web/global_self.cpp b/src/builtins/web/global_self.cpp similarity index 100% rename from builtins/web/global_self.cpp rename to src/builtins/web/global_self.cpp diff --git a/builtins/web/global_self.h b/src/builtins/web/global_self.h similarity index 100% rename from builtins/web/global_self.h rename to src/builtins/web/global_self.h diff --git a/builtins/web/performance.cpp b/src/builtins/web/performance.cpp similarity index 100% rename from builtins/web/performance.cpp rename to src/builtins/web/performance.cpp diff --git a/builtins/web/performance.h b/src/builtins/web/performance.h similarity index 100% rename from builtins/web/performance.h rename to src/builtins/web/performance.h diff --git a/builtins/web/queue-microtask.cpp b/src/builtins/web/queue-microtask.cpp similarity index 100% rename from builtins/web/queue-microtask.cpp rename to src/builtins/web/queue-microtask.cpp diff --git a/builtins/web/queue-microtask.h b/src/builtins/web/queue-microtask.h similarity index 100% rename from builtins/web/queue-microtask.h rename to src/builtins/web/queue-microtask.h diff --git a/builtins/web/streams/compression-stream.cpp b/src/builtins/web/streams/compression-stream.cpp similarity index 100% rename from builtins/web/streams/compression-stream.cpp rename to src/builtins/web/streams/compression-stream.cpp diff --git a/builtins/web/streams/compression-stream.h b/src/builtins/web/streams/compression-stream.h similarity index 100% rename from builtins/web/streams/compression-stream.h rename to src/builtins/web/streams/compression-stream.h diff --git a/builtins/web/streams/decompression-stream.cpp b/src/builtins/web/streams/decompression-stream.cpp similarity index 100% rename from builtins/web/streams/decompression-stream.cpp rename to src/builtins/web/streams/decompression-stream.cpp diff --git a/builtins/web/streams/decompression-stream.h b/src/builtins/web/streams/decompression-stream.h similarity index 100% rename from builtins/web/streams/decompression-stream.h rename to src/builtins/web/streams/decompression-stream.h diff --git a/builtins/web/streams/native-stream-sink.cpp b/src/builtins/web/streams/native-stream-sink.cpp similarity index 100% rename from builtins/web/streams/native-stream-sink.cpp rename to src/builtins/web/streams/native-stream-sink.cpp diff --git a/builtins/web/streams/native-stream-sink.h b/src/builtins/web/streams/native-stream-sink.h similarity index 100% rename from builtins/web/streams/native-stream-sink.h rename to src/builtins/web/streams/native-stream-sink.h diff --git a/builtins/web/streams/native-stream-source.cpp b/src/builtins/web/streams/native-stream-source.cpp similarity index 100% rename from builtins/web/streams/native-stream-source.cpp rename to src/builtins/web/streams/native-stream-source.cpp diff --git a/builtins/web/streams/native-stream-source.h b/src/builtins/web/streams/native-stream-source.h similarity index 100% rename from builtins/web/streams/native-stream-source.h rename to src/builtins/web/streams/native-stream-source.h diff --git a/builtins/web/streams/stream-errors.h b/src/builtins/web/streams/stream-errors.h similarity index 100% rename from builtins/web/streams/stream-errors.h rename to src/builtins/web/streams/stream-errors.h diff --git a/builtins/web/streams/streams.cpp b/src/builtins/web/streams/streams.cpp similarity index 100% rename from builtins/web/streams/streams.cpp rename to src/builtins/web/streams/streams.cpp diff --git a/builtins/web/streams/streams.h b/src/builtins/web/streams/streams.h similarity index 100% rename from builtins/web/streams/streams.h rename to src/builtins/web/streams/streams.h diff --git a/builtins/web/streams/transform-stream-default-controller.cpp b/src/builtins/web/streams/transform-stream-default-controller.cpp similarity index 100% rename from builtins/web/streams/transform-stream-default-controller.cpp rename to src/builtins/web/streams/transform-stream-default-controller.cpp diff --git a/builtins/web/streams/transform-stream-default-controller.h b/src/builtins/web/streams/transform-stream-default-controller.h similarity index 100% rename from builtins/web/streams/transform-stream-default-controller.h rename to src/builtins/web/streams/transform-stream-default-controller.h diff --git a/builtins/web/streams/transform-stream.cpp b/src/builtins/web/streams/transform-stream.cpp similarity index 100% rename from builtins/web/streams/transform-stream.cpp rename to src/builtins/web/streams/transform-stream.cpp diff --git a/builtins/web/streams/transform-stream.h b/src/builtins/web/streams/transform-stream.h similarity index 100% rename from builtins/web/streams/transform-stream.h rename to src/builtins/web/streams/transform-stream.h diff --git a/builtins/web/structured-clone.cpp b/src/builtins/web/structured-clone.cpp similarity index 100% rename from builtins/web/structured-clone.cpp rename to src/builtins/web/structured-clone.cpp diff --git a/builtins/web/structured-clone.h b/src/builtins/web/structured-clone.h similarity index 100% rename from builtins/web/structured-clone.h rename to src/builtins/web/structured-clone.h diff --git a/builtins/web/text-codec/text-codec-errors.h b/src/builtins/web/text-codec/text-codec-errors.h similarity index 100% rename from builtins/web/text-codec/text-codec-errors.h rename to src/builtins/web/text-codec/text-codec-errors.h diff --git a/builtins/web/text-codec/text-codec.cpp b/src/builtins/web/text-codec/text-codec.cpp similarity index 100% rename from builtins/web/text-codec/text-codec.cpp rename to src/builtins/web/text-codec/text-codec.cpp diff --git a/builtins/web/text-codec/text-codec.h b/src/builtins/web/text-codec/text-codec.h similarity index 100% rename from builtins/web/text-codec/text-codec.h rename to src/builtins/web/text-codec/text-codec.h diff --git a/builtins/web/text-codec/text-decoder.cpp b/src/builtins/web/text-codec/text-decoder.cpp similarity index 100% rename from builtins/web/text-codec/text-decoder.cpp rename to src/builtins/web/text-codec/text-decoder.cpp diff --git a/builtins/web/text-codec/text-decoder.h b/src/builtins/web/text-codec/text-decoder.h similarity index 100% rename from builtins/web/text-codec/text-decoder.h rename to src/builtins/web/text-codec/text-decoder.h diff --git a/builtins/web/text-codec/text-encoder.cpp b/src/builtins/web/text-codec/text-encoder.cpp similarity index 100% rename from builtins/web/text-codec/text-encoder.cpp rename to src/builtins/web/text-codec/text-encoder.cpp diff --git a/builtins/web/text-codec/text-encoder.h b/src/builtins/web/text-codec/text-encoder.h similarity index 100% rename from builtins/web/text-codec/text-encoder.h rename to src/builtins/web/text-codec/text-encoder.h diff --git a/builtins/web/timers.cpp b/src/builtins/web/timers.cpp similarity index 100% rename from builtins/web/timers.cpp rename to src/builtins/web/timers.cpp diff --git a/builtins/web/timers.h b/src/builtins/web/timers.h similarity index 100% rename from builtins/web/timers.h rename to src/builtins/web/timers.h diff --git a/builtins/web/url.cpp b/src/builtins/web/url.cpp similarity index 100% rename from builtins/web/url.cpp rename to src/builtins/web/url.cpp diff --git a/builtins/web/url.h b/src/builtins/web/url.h similarity index 100% rename from builtins/web/url.h rename to src/builtins/web/url.h diff --git a/builtins/web/worker-location.cpp b/src/builtins/web/worker-location.cpp similarity index 100% rename from builtins/web/worker-location.cpp rename to src/builtins/web/worker-location.cpp diff --git a/builtins/web/worker-location.h b/src/builtins/web/worker-location.h similarity index 100% rename from builtins/web/worker-location.h rename to src/builtins/web/worker-location.h diff --git a/host-apis/wasi-0.2.0/bindings/bindings.c b/src/host-apis/wasi-0.2.0/bindings/bindings.c similarity index 100% rename from host-apis/wasi-0.2.0/bindings/bindings.c rename to src/host-apis/wasi-0.2.0/bindings/bindings.c diff --git a/host-apis/wasi-0.2.0/bindings/bindings.h b/src/host-apis/wasi-0.2.0/bindings/bindings.h similarity index 100% rename from host-apis/wasi-0.2.0/bindings/bindings.h rename to src/host-apis/wasi-0.2.0/bindings/bindings.h diff --git a/host-apis/wasi-0.2.0/bindings/bindings_component_type.o b/src/host-apis/wasi-0.2.0/bindings/bindings_component_type.o similarity index 100% rename from host-apis/wasi-0.2.0/bindings/bindings_component_type.o rename to src/host-apis/wasi-0.2.0/bindings/bindings_component_type.o diff --git a/host-apis/wasi-0.2.0/handles.h b/src/host-apis/wasi-0.2.0/handles.h similarity index 100% rename from host-apis/wasi-0.2.0/handles.h rename to src/host-apis/wasi-0.2.0/handles.h diff --git a/host-apis/wasi-0.2.0/host_api.cmake b/src/host-apis/wasi-0.2.0/host_api.cmake similarity index 82% rename from host-apis/wasi-0.2.0/host_api.cmake rename to src/host-apis/wasi-0.2.0/host_api.cmake index 82b0e323..4647e7e4 100644 --- a/host-apis/wasi-0.2.0/host_api.cmake +++ b/src/host-apis/wasi-0.2.0/host_api.cmake @@ -3,11 +3,11 @@ add_library(host_api STATIC ${HOST_API}/host_call.cpp ${HOST_API}/bindings/bindings.c ${HOST_API}/bindings/bindings_component_type.o - ${CMAKE_CURRENT_SOURCE_DIR}/include/host_api.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/include/host_api.h ) target_link_libraries(host_api PRIVATE spidermonkey) -target_include_directories(host_api PRIVATE include) +target_include_directories(host_api PRIVATE src/include) target_include_directories(host_api PRIVATE ${HOST_API}) target_include_directories(host_api PUBLIC ${HOST_API}/include) diff --git a/host-apis/wasi-0.2.0/host_api.cpp b/src/host-apis/wasi-0.2.0/host_api.cpp similarity index 100% rename from host-apis/wasi-0.2.0/host_api.cpp rename to src/host-apis/wasi-0.2.0/host_api.cpp diff --git a/host-apis/wasi-0.2.0/host_call.cpp b/src/host-apis/wasi-0.2.0/host_call.cpp similarity index 100% rename from host-apis/wasi-0.2.0/host_call.cpp rename to src/host-apis/wasi-0.2.0/host_call.cpp diff --git a/host-apis/wasi-0.2.0/include/exports.h b/src/host-apis/wasi-0.2.0/include/exports.h similarity index 100% rename from host-apis/wasi-0.2.0/include/exports.h rename to src/host-apis/wasi-0.2.0/include/exports.h diff --git a/host-apis/wasi-0.2.0/preview1-adapter-debug/wasi_snapshot_preview1.wasm b/src/host-apis/wasi-0.2.0/preview1-adapter-debug/wasi_snapshot_preview1.wasm similarity index 100% rename from host-apis/wasi-0.2.0/preview1-adapter-debug/wasi_snapshot_preview1.wasm rename to src/host-apis/wasi-0.2.0/preview1-adapter-debug/wasi_snapshot_preview1.wasm diff --git a/host-apis/wasi-0.2.0/preview1-adapter-release/wasi_snapshot_preview1.wasm b/src/host-apis/wasi-0.2.0/preview1-adapter-release/wasi_snapshot_preview1.wasm similarity index 100% rename from host-apis/wasi-0.2.0/preview1-adapter-release/wasi_snapshot_preview1.wasm rename to src/host-apis/wasi-0.2.0/preview1-adapter-release/wasi_snapshot_preview1.wasm diff --git a/host-apis/wasi-0.2.0/wit/command-extended.wit b/src/host-apis/wasi-0.2.0/wit/command-extended.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/command-extended.wit rename to src/host-apis/wasi-0.2.0/wit/command-extended.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/cli/command.wit b/src/host-apis/wasi-0.2.0/wit/deps/cli/command.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/cli/command.wit rename to src/host-apis/wasi-0.2.0/wit/deps/cli/command.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/cli/environment.wit b/src/host-apis/wasi-0.2.0/wit/deps/cli/environment.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/cli/environment.wit rename to src/host-apis/wasi-0.2.0/wit/deps/cli/environment.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/cli/exit.wit b/src/host-apis/wasi-0.2.0/wit/deps/cli/exit.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/cli/exit.wit rename to src/host-apis/wasi-0.2.0/wit/deps/cli/exit.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/cli/imports.wit b/src/host-apis/wasi-0.2.0/wit/deps/cli/imports.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/cli/imports.wit rename to src/host-apis/wasi-0.2.0/wit/deps/cli/imports.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/cli/run.wit b/src/host-apis/wasi-0.2.0/wit/deps/cli/run.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/cli/run.wit rename to src/host-apis/wasi-0.2.0/wit/deps/cli/run.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/cli/stdio.wit b/src/host-apis/wasi-0.2.0/wit/deps/cli/stdio.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/cli/stdio.wit rename to src/host-apis/wasi-0.2.0/wit/deps/cli/stdio.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/cli/terminal.wit b/src/host-apis/wasi-0.2.0/wit/deps/cli/terminal.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/cli/terminal.wit rename to src/host-apis/wasi-0.2.0/wit/deps/cli/terminal.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/clocks/monotonic-clock.wit b/src/host-apis/wasi-0.2.0/wit/deps/clocks/monotonic-clock.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/clocks/monotonic-clock.wit rename to src/host-apis/wasi-0.2.0/wit/deps/clocks/monotonic-clock.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/clocks/wall-clock.wit b/src/host-apis/wasi-0.2.0/wit/deps/clocks/wall-clock.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/clocks/wall-clock.wit rename to src/host-apis/wasi-0.2.0/wit/deps/clocks/wall-clock.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/clocks/world.wit b/src/host-apis/wasi-0.2.0/wit/deps/clocks/world.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/clocks/world.wit rename to src/host-apis/wasi-0.2.0/wit/deps/clocks/world.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/filesystem/preopens.wit b/src/host-apis/wasi-0.2.0/wit/deps/filesystem/preopens.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/filesystem/preopens.wit rename to src/host-apis/wasi-0.2.0/wit/deps/filesystem/preopens.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/filesystem/types.wit b/src/host-apis/wasi-0.2.0/wit/deps/filesystem/types.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/filesystem/types.wit rename to src/host-apis/wasi-0.2.0/wit/deps/filesystem/types.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/filesystem/world.wit b/src/host-apis/wasi-0.2.0/wit/deps/filesystem/world.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/filesystem/world.wit rename to src/host-apis/wasi-0.2.0/wit/deps/filesystem/world.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/http/handler.wit b/src/host-apis/wasi-0.2.0/wit/deps/http/handler.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/http/handler.wit rename to src/host-apis/wasi-0.2.0/wit/deps/http/handler.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/http/proxy.wit b/src/host-apis/wasi-0.2.0/wit/deps/http/proxy.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/http/proxy.wit rename to src/host-apis/wasi-0.2.0/wit/deps/http/proxy.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/http/types.wit b/src/host-apis/wasi-0.2.0/wit/deps/http/types.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/http/types.wit rename to src/host-apis/wasi-0.2.0/wit/deps/http/types.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/io/error.wit b/src/host-apis/wasi-0.2.0/wit/deps/io/error.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/io/error.wit rename to src/host-apis/wasi-0.2.0/wit/deps/io/error.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/io/poll.wit b/src/host-apis/wasi-0.2.0/wit/deps/io/poll.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/io/poll.wit rename to src/host-apis/wasi-0.2.0/wit/deps/io/poll.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/io/streams.wit b/src/host-apis/wasi-0.2.0/wit/deps/io/streams.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/io/streams.wit rename to src/host-apis/wasi-0.2.0/wit/deps/io/streams.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/io/world.wit b/src/host-apis/wasi-0.2.0/wit/deps/io/world.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/io/world.wit rename to src/host-apis/wasi-0.2.0/wit/deps/io/world.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/random/insecure-seed.wit b/src/host-apis/wasi-0.2.0/wit/deps/random/insecure-seed.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/random/insecure-seed.wit rename to src/host-apis/wasi-0.2.0/wit/deps/random/insecure-seed.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/random/insecure.wit b/src/host-apis/wasi-0.2.0/wit/deps/random/insecure.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/random/insecure.wit rename to src/host-apis/wasi-0.2.0/wit/deps/random/insecure.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/random/random.wit b/src/host-apis/wasi-0.2.0/wit/deps/random/random.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/random/random.wit rename to src/host-apis/wasi-0.2.0/wit/deps/random/random.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/random/world.wit b/src/host-apis/wasi-0.2.0/wit/deps/random/world.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/random/world.wit rename to src/host-apis/wasi-0.2.0/wit/deps/random/world.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/instance-network.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/instance-network.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/instance-network.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/instance-network.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/ip-name-lookup.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/ip-name-lookup.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/ip-name-lookup.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/ip-name-lookup.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/network.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/network.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/network.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/network.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/tcp-create-socket.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/tcp-create-socket.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/tcp-create-socket.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/tcp-create-socket.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/tcp.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/tcp.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/tcp.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/tcp.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/udp-create-socket.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/udp-create-socket.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/udp-create-socket.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/udp-create-socket.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/udp.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/udp.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/udp.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/udp.wit diff --git a/host-apis/wasi-0.2.0/wit/deps/sockets/world.wit b/src/host-apis/wasi-0.2.0/wit/deps/sockets/world.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/deps/sockets/world.wit rename to src/host-apis/wasi-0.2.0/wit/deps/sockets/world.wit diff --git a/host-apis/wasi-0.2.0/wit/main.wit b/src/host-apis/wasi-0.2.0/wit/main.wit similarity index 100% rename from host-apis/wasi-0.2.0/wit/main.wit rename to src/host-apis/wasi-0.2.0/wit/main.wit diff --git a/include/builtin.h b/src/include/builtin.h similarity index 100% rename from include/builtin.h rename to src/include/builtin.h diff --git a/include/config-parser.h b/src/include/config-parser.h similarity index 100% rename from include/config-parser.h rename to src/include/config-parser.h diff --git a/include/errors.h b/src/include/errors.h similarity index 100% rename from include/errors.h rename to src/include/errors.h diff --git a/include/extension-api.h b/src/include/extension-api.h similarity index 100% rename from include/extension-api.h rename to src/include/extension-api.h diff --git a/include/host_api.h b/src/include/host_api.h similarity index 99% rename from include/host_api.h rename to src/include/host_api.h index 5b9c3152..72c4baa7 100644 --- a/include/host_api.h +++ b/src/include/host_api.h @@ -10,7 +10,7 @@ #include #include -#include "../crates/rust-url/rust-url.h" +#include "../../crates/rust-url/rust-url.h" #include "extension-api.h" #include "js/TypeDecls.h" diff --git a/runtime/allocator.cpp b/src/runtime/allocator.cpp similarity index 100% rename from runtime/allocator.cpp rename to src/runtime/allocator.cpp diff --git a/runtime/allocator.h b/src/runtime/allocator.h similarity index 100% rename from runtime/allocator.h rename to src/runtime/allocator.h diff --git a/runtime/builtin.cpp b/src/runtime/builtin.cpp similarity index 100% rename from runtime/builtin.cpp rename to src/runtime/builtin.cpp diff --git a/runtime/decode.cpp b/src/runtime/decode.cpp similarity index 100% rename from runtime/decode.cpp rename to src/runtime/decode.cpp diff --git a/runtime/decode.h b/src/runtime/decode.h similarity index 100% rename from runtime/decode.h rename to src/runtime/decode.h diff --git a/runtime/encode.cpp b/src/runtime/encode.cpp similarity index 100% rename from runtime/encode.cpp rename to src/runtime/encode.cpp diff --git a/runtime/encode.h b/src/runtime/encode.h similarity index 100% rename from runtime/encode.h rename to src/runtime/encode.h diff --git a/runtime/engine.cpp b/src/runtime/engine.cpp similarity index 100% rename from runtime/engine.cpp rename to src/runtime/engine.cpp diff --git a/runtime/event_loop.cpp b/src/runtime/event_loop.cpp similarity index 100% rename from runtime/event_loop.cpp rename to src/runtime/event_loop.cpp diff --git a/runtime/event_loop.h b/src/runtime/event_loop.h similarity index 100% rename from runtime/event_loop.h rename to src/runtime/event_loop.h diff --git a/runtime/js.cpp b/src/runtime/js.cpp similarity index 100% rename from runtime/js.cpp rename to src/runtime/js.cpp diff --git a/runtime/script_loader.cpp b/src/runtime/script_loader.cpp similarity index 100% rename from runtime/script_loader.cpp rename to src/runtime/script_loader.cpp diff --git a/runtime/script_loader.h b/src/runtime/script_loader.h similarity index 100% rename from runtime/script_loader.h rename to src/runtime/script_loader.h diff --git a/runtime/sequence.hpp b/src/runtime/sequence.hpp similarity index 100% rename from runtime/sequence.hpp rename to src/runtime/sequence.hpp diff --git a/tests/wpt-harness/build-wpt-runtime.sh b/tests/wpt-harness/build-wpt-runtime.sh index 01f4c916..7d7d50bc 100755 --- a/tests/wpt-harness/build-wpt-runtime.sh +++ b/tests/wpt-harness/build-wpt-runtime.sh @@ -18,4 +18,4 @@ inputs=( ) cat "${inputs[@]}" > wpt-test-runner.js -./componentize.sh $componentize_flags --verbose --legacy-script wpt-test-runner.js wpt-runtime.wasm +./scripts/componentize.sh $componentize_flags --verbose --legacy-script wpt-test-runner.js wpt-runtime.wasm diff --git a/tests/wpt-harness/wpt.cmake b/tests/wpt-harness/wpt.cmake index b5361597..9b867a60 100644 --- a/tests/wpt-harness/wpt.cmake +++ b/tests/wpt-harness/wpt.cmake @@ -23,13 +23,13 @@ endif() add_builtin(wpt_support SRC "${CMAKE_CURRENT_LIST_DIR}/wpt_builtins.cpp" - INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/builtins/web/") + INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/builtins/web/") add_custom_command( OUTPUT wpt-runtime.wasm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E env PATH=${WASM_TOOLS_DIR}:${WIZER_DIR}:$ENV{PATH} env "COMPONENTIZE_FLAGS=${COMPONENTIZE_FLAGS}" WPT_ROOT=${WPT_ROOT} ${CMAKE_CURRENT_SOURCE_DIR}/tests/wpt-harness/build-wpt-runtime.sh - DEPENDS starling-raw.wasm componentize.sh tests/wpt-harness/build-wpt-runtime.sh tests/wpt-harness/pre-harness.js tests/wpt-harness/post-harness.js + DEPENDS starling-raw.wasm scripts/componentize.sh tests/wpt-harness/build-wpt-runtime.sh tests/wpt-harness/pre-harness.js tests/wpt-harness/post-harness.js VERBATIM )