mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
fix(core): consistent extension source resolution (#19615)
Currently the resolution for extension sources is different depending on whether `include_js_files_for_snapshotting` is enabled. If sources are embedded it uses `include_str!()` which is module-relative. If sources are read at runtime paths are joined to `CARGO_MANIFEST_DIR` and are package-relative. This makes them both package-relative. Fixes `cargo run -p deno_runtime --example extension_with_esm --features include_js_files_for_snapshotting`.
This commit is contained in:
parent
09af1a5fef
commit
55362452a8
4 changed files with 24 additions and 6 deletions
13
.github/workflows/ci.generate.ts
vendored
13
.github/workflows/ci.generate.ts
vendored
|
@ -697,7 +697,7 @@ const ci = {
|
||||||
{
|
{
|
||||||
name: "Test debug (fast)",
|
name: "Test debug (fast)",
|
||||||
if: [
|
if: [
|
||||||
"matrix.job == 'test' && matrix.profile == 'debug' && ",
|
"matrix.job == 'test' && matrix.profile == 'debug' &&",
|
||||||
"!startsWith(matrix.os, 'ubuntu')",
|
"!startsWith(matrix.os, 'ubuntu')",
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
run: [
|
run: [
|
||||||
|
@ -708,6 +708,17 @@ const ci = {
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
env: { CARGO_PROFILE_DEV_DEBUG: 0 },
|
env: { CARGO_PROFILE_DEV_DEBUG: 0 },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Test examples debug",
|
||||||
|
if: "matrix.job == 'test' && matrix.profile == 'debug'",
|
||||||
|
run: [
|
||||||
|
// Only regression tests here for now.
|
||||||
|
// Regression test for https://github.com/denoland/deno/pull/19615.
|
||||||
|
"cargo run -p deno_runtime --example extension_with_esm",
|
||||||
|
"cargo run -p deno_runtime --example extension_with_esm --features include_js_files_for_snapshotting",
|
||||||
|
].join("\n"),
|
||||||
|
env: { CARGO_PROFILE_DEV_DEBUG: 0 },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Test release",
|
name: "Test release",
|
||||||
if: [
|
if: [
|
||||||
|
|
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
|
@ -435,6 +435,13 @@ jobs:
|
||||||
cargo test --locked --test '*'
|
cargo test --locked --test '*'
|
||||||
env:
|
env:
|
||||||
CARGO_PROFILE_DEV_DEBUG: 0
|
CARGO_PROFILE_DEV_DEBUG: 0
|
||||||
|
- name: Test examples debug
|
||||||
|
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (matrix.job == ''test'' && matrix.profile == ''debug'')'
|
||||||
|
run: |-
|
||||||
|
cargo run -p deno_runtime --example extension_with_esm
|
||||||
|
cargo run -p deno_runtime --example extension_with_esm --features include_js_files_for_snapshotting
|
||||||
|
env:
|
||||||
|
CARGO_PROFILE_DEV_DEBUG: 0
|
||||||
- name: Test release
|
- name: Test release
|
||||||
if: |-
|
if: |-
|
||||||
!(github.event_name == 'pull_request' && matrix.skip_pr) && (matrix.job == 'test' && matrix.profile == 'release' &&
|
!(github.event_name == 'pull_request' && matrix.skip_pr) && (matrix.job == 'test' && matrix.profile == 'release' &&
|
||||||
|
|
|
@ -622,8 +622,8 @@ macro_rules! include_js_files {
|
||||||
$($crate::ExtensionFileSource {
|
$($crate::ExtensionFileSource {
|
||||||
specifier: concat!("ext:", stringify!($name), "/", $file),
|
specifier: concat!("ext:", stringify!($name), "/", $file),
|
||||||
code: $crate::ExtensionFileSourceCode::IncludedInBinary(
|
code: $crate::ExtensionFileSourceCode::IncludedInBinary(
|
||||||
include_str!(concat!($dir, "/", $file)
|
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/", $dir, "/", $file))
|
||||||
)),
|
),
|
||||||
},)+
|
},)+
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@ -633,7 +633,7 @@ macro_rules! include_js_files {
|
||||||
$($crate::ExtensionFileSource {
|
$($crate::ExtensionFileSource {
|
||||||
specifier: concat!("ext:", stringify!($name), "/", $file),
|
specifier: concat!("ext:", stringify!($name), "/", $file),
|
||||||
code: $crate::ExtensionFileSourceCode::IncludedInBinary(
|
code: $crate::ExtensionFileSourceCode::IncludedInBinary(
|
||||||
include_str!($file)
|
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/", $file))
|
||||||
),
|
),
|
||||||
},)+
|
},)+
|
||||||
]
|
]
|
||||||
|
|
|
@ -13,7 +13,7 @@ use deno_runtime::worker::WorkerOptions;
|
||||||
deno_core::extension!(
|
deno_core::extension!(
|
||||||
hello_runtime,
|
hello_runtime,
|
||||||
esm_entry_point = "ext:hello_runtime/bootstrap.js",
|
esm_entry_point = "ext:hello_runtime/bootstrap.js",
|
||||||
esm = ["bootstrap.js"]
|
esm = [dir "examples/extension_with_esm", "bootstrap.js"]
|
||||||
);
|
);
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|
Loading…
Reference in a new issue