diff --git a/core/Cargo.toml b/core/Cargo.toml index e3c98a5d5511c8..706684ddf88dec 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -23,8 +23,8 @@ rusty_v8 = "0.3.8" serde_json = "1.0.48" url = "2.1.1" # dispatch json stuff -serde = { version = "1.0.102", features = ["derive"] } -serde_derive = "1.0.102" +serde = { version = "1.0.104", features = ["derive"] } +serde_derive = "1.0.104" tokio = { version = "0.2.13", optional = true } [[example]] diff --git a/core/dispatch_json.rs b/core/dispatch_json.rs index 80da82bfb09f9d..cbf3198f1ad1d6 100644 --- a/core/dispatch_json.rs +++ b/core/dispatch_json.rs @@ -73,7 +73,7 @@ trait InternalError { /// Error message as string value. fn msg(&self) -> String; /// Make InternalJsonError from this object - fn to_internal_error(&self) -> FinalJsonError { + fn to_final_json_error(&self) -> FinalJsonError { let kind = match self.kind() { JsonErrorKind::Kind(k) => { assert!(k != 0, "kind = 0 is reserved for UnKind"); @@ -167,7 +167,7 @@ where Ok(args) => args, Err(e) => { let buf = - serialize_result(None, Err(InternalError::to_internal_error(&e))); + serialize_result(None, Err(InternalError::to_final_json_error(&e))); return CoreOp::Sync(buf); } }; @@ -175,7 +175,7 @@ where let is_sync = promise_id.is_none(); let result = serde_json::from_slice(control) - .map_err(|e| e.to_internal_error()) + .map_err(|e| e.to_final_json_error()) .and_then(|args| d(args, zero_copy).map_err(FinalJsonError::from)); // Convert to CoreOp diff --git a/core/dispatch_json.ts b/core/dispatch_json.ts index e3fa95b0131a84..358f4e9a6c122d 100644 --- a/core/dispatch_json.ts +++ b/core/dispatch_json.ts @@ -77,14 +77,16 @@ interface JsonResponse { promiseId?: number; // Only present in async messages. } +const core = Deno["core"]; + function decode(ui8: Uint8Array): JsonResponse { - const s = Deno["core"].decode(ui8); + const s = core.decode(ui8); return JSON.parse(s) as JsonResponse; } function encode(args: object): Uint8Array { const s = JSON.stringify(args); - return Deno["core"].encode(s); + return core.encode(s); } abstract class DispatchJsonOp { @@ -176,8 +178,8 @@ abstract class DispatchJsonOp { export class DispatchJsonCoreOp extends DispatchJsonOp { constructor(private readonly opId: number, errorFactory: ErrorFactory) { - super((c, zc) => Deno["core"].dispatch(this.opId, c, zc), errorFactory); - Deno["core"].setAsyncHandler(this.opId, resUi8 => this.handleAsync(resUi8)); + super((c, zc) => core.dispatch(this.opId, c, zc), errorFactory); + core.setAsyncHandler(this.opId, resUi8 => this.handleAsync(resUi8)); } } diff --git a/deno_typescript/ops.rs b/deno_typescript/ops.rs index 022eee00e32846..7efcfb895e7f45 100644 --- a/deno_typescript/ops.rs +++ b/deno_typescript/ops.rs @@ -76,6 +76,7 @@ pub fn op_load_module(s: &mut TSState, v: Value) -> Result { let path_prefix = s.extern_crate_modules.get(crate_name).unwrap(); let path = std::path::Path::new(path_prefix).join(&module_url.path()[1..]); + println!("cargo:rerun-if-changed={}", path.display()); ( module_specifier.as_str().to_string(), std::fs::read_to_string(&path)?,