mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
refactor: use deno_cache_dir crate (#20092)
Uses https://github.com/denoland/deno_cache/pull/26
This commit is contained in:
parent
a037ed77a2
commit
05f838a57c
16 changed files with 221 additions and 1946 deletions
175
Cargo.lock
generated
175
Cargo.lock
generated
|
@ -174,9 +174,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.70"
|
version = "1.0.72"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
|
checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
|
@ -207,7 +207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c"
|
checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
@ -219,7 +219,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed"
|
checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ checksum = "c704e2f6ee1a98223f5a7629a6ef0f3decb3b552ed282889dc957edff98ce1e6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"swc_macros_common",
|
"swc_macros_common",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -268,7 +268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965"
|
checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -279,8 +279,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
|
checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -302,7 +302,7 @@ checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error",
|
"proc-macro-error",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -725,7 +725,7 @@ version = "0.1.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
|
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -807,6 +807,7 @@ dependencies = [
|
||||||
"data-url",
|
"data-url",
|
||||||
"deno_ast",
|
"deno_ast",
|
||||||
"deno_bench_util",
|
"deno_bench_util",
|
||||||
|
"deno_cache_dir",
|
||||||
"deno_core",
|
"deno_core",
|
||||||
"deno_doc",
|
"deno_doc",
|
||||||
"deno_emit",
|
"deno_emit",
|
||||||
|
@ -889,7 +890,7 @@ checksum = "3c65c2ffdafc1564565200967edc4851c7b55422d3913466688907efd05ea26f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deno-proc-macro-rules-macros",
|
"deno-proc-macro-rules-macros",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -900,8 +901,8 @@ checksum = "3047b312b7451e3190865713a4dd6e1f821aed614ada219766ebc3024a690435"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -968,6 +969,25 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "deno_cache_dir"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4cd2de39c0d15e801f5968334998336c159ac7e335f8acddd781982777195152"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"deno_media_type",
|
||||||
|
"indexmap 2.0.0",
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"parking_lot 0.12.1",
|
||||||
|
"ring",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"url",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_console"
|
name = "deno_console"
|
||||||
version = "0.114.0"
|
version = "0.114.0"
|
||||||
|
@ -1359,12 +1379,12 @@ dependencies = [
|
||||||
"pmutil 0.6.1",
|
"pmutil 0.6.1",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"regex",
|
"regex",
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1575,7 +1595,7 @@ checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"rustc_version 0.4.0",
|
"rustc_version 0.4.0",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -1623,7 +1643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886"
|
checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1759,7 +1779,7 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"proc-macro-error",
|
"proc-macro-error",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1880,7 +1900,7 @@ checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2068,7 +2088,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "479cde5eb168cf5a056dd98f311cbfab7494c216394e4fb9eba0336827a8db93"
|
checksum = "479cde5eb168cf5a056dd98f311cbfab7494c216394e4fb9eba0336827a8db93"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2206,8 +2226,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2644,6 +2664,7 @@ checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.14.0",
|
"hashbrown 0.14.0",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2723,7 +2744,7 @@ dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2829,7 +2850,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8edfc11b8f56ce85e207e62ea21557cfa09bb24a8f6b04ae181b086ff8611c22"
|
checksum = "8edfc11b8f56ce85e207e62ea21557cfa09bb24a8f6b04ae181b086ff8611c22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"regex",
|
"regex",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -3162,7 +3183,7 @@ name = "napi_sym"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
|
@ -3331,9 +3352,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.17.1"
|
version = "1.18.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "opaque-debug"
|
name = "opaque-debug"
|
||||||
|
@ -3594,7 +3615,7 @@ dependencies = [
|
||||||
"phf_shared",
|
"phf_shared",
|
||||||
"proc-macro-hack",
|
"proc-macro-hack",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3623,7 +3644,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
|
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3684,7 +3705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004"
|
checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3695,8 +3716,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6"
|
checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3762,7 +3783,7 @@ checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error-attr",
|
"proc-macro-error-attr",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
@ -3774,7 +3795,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3862,9 +3883,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.28"
|
version = "1.0.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
|
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
]
|
]
|
||||||
|
@ -4214,7 +4235,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "107c3d5d7f370ac09efa62a78375f94d94b8a33c61d8c278b96683fb4dbf2d8d"
|
checksum = "107c3d5d7f370ac09efa62a78375f94d94b8a33c61d8c278b96683fb4dbf2d8d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4378,9 +4399,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.157"
|
version = "1.0.183"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "707de5fcf5df2b5788fca98dd7eab490bc2fd9b7ef1404defc462833b83f25ca"
|
checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
@ -4406,22 +4427,22 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.157"
|
version = "1.0.183"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78997f4555c22a7971214540c4a661291970619afd56de19f77e0de86296e1e5"
|
checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.94"
|
version = "1.0.104"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea"
|
checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 1.9.2",
|
"indexmap 2.0.0",
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -4434,7 +4455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca"
|
checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4677,7 +4698,7 @@ dependencies = [
|
||||||
"phf_generator",
|
"phf_generator",
|
||||||
"phf_shared",
|
"phf_shared",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4688,7 +4709,7 @@ checksum = "0090512bdfee4b56d82480d66c0fd8a6f53f0fe0f97e075e949b252acdd482e0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"swc_macros_common",
|
"swc_macros_common",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -4716,9 +4737,9 @@ checksum = "6069ca09d878a33f883cc06aaa9718ede171841d3832450354410b718b097232"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4820,7 +4841,7 @@ checksum = "7dadb9998d4f5fc36ef558ed5a092579441579ee8c6fcce84a5228cca9df4004"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"swc_macros_common",
|
"swc_macros_common",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -4869,7 +4890,7 @@ checksum = "bf4ee0caee1018808d94ecd09490cb7affd3d504b19aa11c49238f5fc4b54901"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"swc_macros_common",
|
"swc_macros_common",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -4965,7 +4986,7 @@ checksum = "984d5ac69b681fc5438f9abf82b0fda34fe04e119bc75f8213b7e01128c7c9a2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"swc_macros_common",
|
"swc_macros_common",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -5096,7 +5117,7 @@ checksum = "0c20468634668c2bbab581947bb8c75c97158d5a6959f4ba33df20983b20b4f6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5133,7 +5154,7 @@ checksum = "3e582c3e3c2269238524923781df5be49e011dbe29cf7683a2215d600a562ea6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5156,7 +5177,7 @@ dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"pmutil 0.5.3",
|
"pmutil 0.5.3",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"swc_macros_common",
|
"swc_macros_common",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
@ -5179,18 +5200,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.22"
|
version = "2.0.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616"
|
checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5201,7 +5222,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
|
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"unicode-xid 0.2.4",
|
"unicode-xid 0.2.4",
|
||||||
]
|
]
|
||||||
|
@ -5309,22 +5330,22 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.40"
|
version = "1.0.44"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
|
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.40"
|
version = "1.0.44"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -5406,8 +5427,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 2.0.22",
|
"syn 2.0.28",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -5545,7 +5566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ebd99eec668d0a450c177acbc4d05e0d0d13b1f8d3db13cd706c52cbec4ac04"
|
checksum = "7ebd99eec668d0a450c177acbc4d05e0d0d13b1f8d3db13cd706c52cbec4ac04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5574,7 +5595,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5927,7 +5948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff"
|
checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -5989,7 +6010,7 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
@ -6012,7 +6033,7 @@ version = "0.2.84"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
|
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6023,7 +6044,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
|
@ -6377,7 +6398,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c"
|
checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.66",
|
"proc-macro2 1.0.66",
|
||||||
"quote 1.0.28",
|
"quote 1.0.32",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
|
@ -46,6 +46,7 @@ winres.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_graph", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_graph", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
||||||
|
deno_cache_dir = "=0.5.0"
|
||||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||||
deno_doc = "=0.64.0"
|
deno_doc = "=0.64.0"
|
||||||
deno_emit = "=0.25.0"
|
deno_emit = "=0.25.0"
|
||||||
|
|
2
cli/cache/disk_cache.rs
vendored
2
cli/cache/disk_cache.rs
vendored
|
@ -1,9 +1,9 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use super::http_cache::url_to_filename;
|
|
||||||
use super::CACHE_PERM;
|
use super::CACHE_PERM;
|
||||||
use crate::util::fs::atomic_write_file;
|
use crate::util::fs::atomic_write_file;
|
||||||
|
|
||||||
|
use deno_cache_dir::url_to_filename;
|
||||||
use deno_core::url::Host;
|
use deno_core::url::Host;
|
||||||
use deno_core::url::Url;
|
use deno_core::url::Url;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
|
42
cli/cache/http_cache/common.rs
vendored
42
cli/cache/http_cache/common.rs
vendored
|
@ -1,42 +0,0 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
||||||
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
use deno_core::url::Url;
|
|
||||||
|
|
||||||
pub fn base_url_to_filename_parts(
|
|
||||||
url: &Url,
|
|
||||||
port_separator: &str,
|
|
||||||
) -> Option<Vec<String>> {
|
|
||||||
let mut out = Vec::with_capacity(2);
|
|
||||||
|
|
||||||
let scheme = url.scheme();
|
|
||||||
out.push(scheme.to_string());
|
|
||||||
|
|
||||||
match scheme {
|
|
||||||
"http" | "https" => {
|
|
||||||
let host = url.host_str().unwrap();
|
|
||||||
let host_port = match url.port() {
|
|
||||||
// underscores are not allowed in domains, so adding one here is fine
|
|
||||||
Some(port) => format!("{host}{port_separator}{port}"),
|
|
||||||
None => host.to_string(),
|
|
||||||
};
|
|
||||||
out.push(host_port);
|
|
||||||
}
|
|
||||||
"data" | "blob" => (),
|
|
||||||
scheme => {
|
|
||||||
log::debug!("Don't know how to create cache name for scheme: {}", scheme);
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Some(out)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn read_file_bytes(path: &Path) -> std::io::Result<Option<Vec<u8>>> {
|
|
||||||
match std::fs::read(path) {
|
|
||||||
Ok(s) => Ok(Some(s)),
|
|
||||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),
|
|
||||||
Err(err) => Err(err),
|
|
||||||
}
|
|
||||||
}
|
|
296
cli/cache/http_cache/global.rs
vendored
296
cli/cache/http_cache/global.rs
vendored
|
@ -1,296 +0,0 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
||||||
|
|
||||||
use std::io;
|
|
||||||
use std::path::Path;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::time::SystemTime;
|
|
||||||
|
|
||||||
use deno_core::error::AnyError;
|
|
||||||
use deno_core::serde_json;
|
|
||||||
use deno_core::url::Url;
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
use crate::cache::CACHE_PERM;
|
|
||||||
use crate::http_util::HeadersMap;
|
|
||||||
use crate::util;
|
|
||||||
use crate::util::fs::atomic_write_file;
|
|
||||||
|
|
||||||
use super::common::base_url_to_filename_parts;
|
|
||||||
use super::common::read_file_bytes;
|
|
||||||
use super::CachedUrlMetadata;
|
|
||||||
use super::HttpCache;
|
|
||||||
use super::HttpCacheItemKey;
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
#[error("Can't convert url (\"{}\") to filename.", .url)]
|
|
||||||
pub struct UrlToFilenameConversionError {
|
|
||||||
pub(super) url: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Turn provided `url` into a hashed filename.
|
|
||||||
/// URLs can contain a lot of characters that cannot be used
|
|
||||||
/// in filenames (like "?", "#", ":"), so in order to cache
|
|
||||||
/// them properly they are deterministically hashed into ASCII
|
|
||||||
/// strings.
|
|
||||||
pub fn url_to_filename(
|
|
||||||
url: &Url,
|
|
||||||
) -> Result<PathBuf, UrlToFilenameConversionError> {
|
|
||||||
let Some(mut cache_filename) = base_url_to_filename(url) else {
|
|
||||||
return Err(UrlToFilenameConversionError { url: url.to_string() });
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut rest_str = url.path().to_string();
|
|
||||||
if let Some(query) = url.query() {
|
|
||||||
rest_str.push('?');
|
|
||||||
rest_str.push_str(query);
|
|
||||||
}
|
|
||||||
// NOTE: fragment is omitted on purpose - it's not taken into
|
|
||||||
// account when caching - it denotes parts of webpage, which
|
|
||||||
// in case of static resources doesn't make much sense
|
|
||||||
let hashed_filename = util::checksum::gen(&[rest_str.as_bytes()]);
|
|
||||||
cache_filename.push(hashed_filename);
|
|
||||||
Ok(cache_filename)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turn base of url (scheme, hostname, port) into a valid filename.
|
|
||||||
/// This method replaces port part with a special string token (because
|
|
||||||
/// ":" cannot be used in filename on some platforms).
|
|
||||||
/// Ex: $DENO_DIR/deps/https/deno.land/
|
|
||||||
fn base_url_to_filename(url: &Url) -> Option<PathBuf> {
|
|
||||||
base_url_to_filename_parts(url, "_PORT").map(|parts| {
|
|
||||||
let mut out = PathBuf::new();
|
|
||||||
for part in parts {
|
|
||||||
out.push(part);
|
|
||||||
}
|
|
||||||
out
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct GlobalHttpCache(PathBuf);
|
|
||||||
|
|
||||||
impl GlobalHttpCache {
|
|
||||||
pub fn new(path: PathBuf) -> Self {
|
|
||||||
assert!(path.is_absolute());
|
|
||||||
Self(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated to discourage using this as where the file is stored and
|
|
||||||
// how it's stored should be an implementation detail of the cache.
|
|
||||||
#[deprecated(note = "Should only be used for deno info.")]
|
|
||||||
pub fn get_global_cache_location(&self) -> &PathBuf {
|
|
||||||
&self.0
|
|
||||||
}
|
|
||||||
|
|
||||||
// DEPRECATED: Where the file is stored and how it's stored should be an implementation
|
|
||||||
// detail of the cache.
|
|
||||||
#[deprecated(note = "Do not assume the cache will be stored at a file path.")]
|
|
||||||
pub fn get_global_cache_filepath(
|
|
||||||
&self,
|
|
||||||
url: &Url,
|
|
||||||
) -> Result<PathBuf, AnyError> {
|
|
||||||
Ok(self.0.join(url_to_filename(url)?))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_cache_filepath(&self, url: &Url) -> Result<PathBuf, AnyError> {
|
|
||||||
Ok(self.0.join(url_to_filename(url)?))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn key_file_path<'a>(&self, key: &'a HttpCacheItemKey) -> &'a PathBuf {
|
|
||||||
// The key file path is always set for the global cache because
|
|
||||||
// the file will always exist, unlike the local cache, which won't
|
|
||||||
// have this for redirects.
|
|
||||||
key.file_path.as_ref().unwrap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HttpCache for GlobalHttpCache {
|
|
||||||
fn cache_item_key<'a>(
|
|
||||||
&self,
|
|
||||||
url: &'a Url,
|
|
||||||
) -> Result<HttpCacheItemKey<'a>, AnyError> {
|
|
||||||
Ok(HttpCacheItemKey {
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
is_local_key: false,
|
|
||||||
url,
|
|
||||||
file_path: Some(self.get_cache_filepath(url)?),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn contains(&self, url: &Url) -> bool {
|
|
||||||
let Ok(cache_filepath) = self.get_cache_filepath(url) else {
|
|
||||||
return false
|
|
||||||
};
|
|
||||||
cache_filepath.is_file()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_modified_time(
|
|
||||||
&self,
|
|
||||||
key: &HttpCacheItemKey,
|
|
||||||
) -> Result<Option<SystemTime>, AnyError> {
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
debug_assert!(!key.is_local_key);
|
|
||||||
|
|
||||||
match std::fs::metadata(self.key_file_path(key)) {
|
|
||||||
Ok(metadata) => Ok(Some(metadata.modified()?)),
|
|
||||||
Err(err) if err.kind() == io::ErrorKind::NotFound => Ok(None),
|
|
||||||
Err(err) => Err(err.into()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn set(
|
|
||||||
&self,
|
|
||||||
url: &Url,
|
|
||||||
headers: HeadersMap,
|
|
||||||
content: &[u8],
|
|
||||||
) -> Result<(), AnyError> {
|
|
||||||
let cache_filepath = self.get_cache_filepath(url)?;
|
|
||||||
// Cache content
|
|
||||||
atomic_write_file(&cache_filepath, content, CACHE_PERM)?;
|
|
||||||
|
|
||||||
let metadata = CachedUrlMetadata {
|
|
||||||
time: SystemTime::now(),
|
|
||||||
url: url.to_string(),
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
write_metadata(&cache_filepath, &metadata)?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_file_bytes(
|
|
||||||
&self,
|
|
||||||
key: &HttpCacheItemKey,
|
|
||||||
) -> Result<Option<Vec<u8>>, AnyError> {
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
debug_assert!(!key.is_local_key);
|
|
||||||
|
|
||||||
Ok(read_file_bytes(self.key_file_path(key))?)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_metadata(
|
|
||||||
&self,
|
|
||||||
key: &HttpCacheItemKey,
|
|
||||||
) -> Result<Option<CachedUrlMetadata>, AnyError> {
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
debug_assert!(!key.is_local_key);
|
|
||||||
|
|
||||||
match read_metadata(self.key_file_path(key))? {
|
|
||||||
Some(metadata) => Ok(Some(metadata)),
|
|
||||||
None => Ok(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_metadata(path: &Path) -> Result<Option<CachedUrlMetadata>, AnyError> {
|
|
||||||
let path = path.with_extension("metadata.json");
|
|
||||||
match read_file_bytes(&path)? {
|
|
||||||
Some(metadata) => Ok(Some(serde_json::from_slice(&metadata)?)),
|
|
||||||
None => Ok(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn write_metadata(
|
|
||||||
path: &Path,
|
|
||||||
meta_data: &CachedUrlMetadata,
|
|
||||||
) -> Result<(), AnyError> {
|
|
||||||
let path = path.with_extension("metadata.json");
|
|
||||||
let json = serde_json::to_string_pretty(meta_data)?;
|
|
||||||
atomic_write_file(&path, json, CACHE_PERM)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod test {
|
|
||||||
use super::*;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use test_util::TempDir;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_url_to_filename() {
|
|
||||||
let test_cases = [
|
|
||||||
("https://deno.land/x/foo.ts", "https/deno.land/2c0a064891b9e3fbe386f5d4a833bce5076543f5404613656042107213a7bbc8"),
|
|
||||||
(
|
|
||||||
"https://deno.land:8080/x/foo.ts",
|
|
||||||
"https/deno.land_PORT8080/2c0a064891b9e3fbe386f5d4a833bce5076543f5404613656042107213a7bbc8",
|
|
||||||
),
|
|
||||||
("https://deno.land/", "https/deno.land/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1"),
|
|
||||||
(
|
|
||||||
"https://deno.land/?asdf=qwer",
|
|
||||||
"https/deno.land/e4edd1f433165141015db6a823094e6bd8f24dd16fe33f2abd99d34a0a21a3c0",
|
|
||||||
),
|
|
||||||
// should be the same as case above, fragment (#qwer) is ignored
|
|
||||||
// when hashing
|
|
||||||
(
|
|
||||||
"https://deno.land/?asdf=qwer#qwer",
|
|
||||||
"https/deno.land/e4edd1f433165141015db6a823094e6bd8f24dd16fe33f2abd99d34a0a21a3c0",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=",
|
|
||||||
"data/c21c7fc382b2b0553dc0864aa81a3acacfb7b3d1285ab5ae76da6abec213fb37",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"data:text/plain,Hello%2C%20Deno!",
|
|
||||||
"data/967374e3561d6741234131e342bf5c6848b70b13758adfe23ee1a813a8131818",
|
|
||||||
)
|
|
||||||
];
|
|
||||||
|
|
||||||
for (url, expected) in test_cases.iter() {
|
|
||||||
let u = Url::parse(url).unwrap();
|
|
||||||
let p = url_to_filename(&u).unwrap();
|
|
||||||
assert_eq!(p, PathBuf::from(expected));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_create_cache() {
|
|
||||||
let dir = TempDir::new();
|
|
||||||
let cache_path = dir.path().join("foobar");
|
|
||||||
// HttpCache should be created lazily on first use:
|
|
||||||
// when zipping up a local project with no external dependencies
|
|
||||||
// "$DENO_DIR/deps" is empty. When unzipping such project
|
|
||||||
// "$DENO_DIR/deps" might not get restored and in situation
|
|
||||||
// when directory is owned by root we might not be able
|
|
||||||
// to create that directory. However if it's not needed it
|
|
||||||
// doesn't make sense to return error in such specific scenarios.
|
|
||||||
// For more details check issue:
|
|
||||||
// https://github.com/denoland/deno/issues/5688
|
|
||||||
let cache = GlobalHttpCache::new(cache_path.to_path_buf());
|
|
||||||
assert!(!cache.0.exists());
|
|
||||||
let url = Url::parse("http://example.com/foo/bar.js").unwrap();
|
|
||||||
cache
|
|
||||||
.set(&url, HeadersMap::new(), b"hello world")
|
|
||||||
.expect("Failed to add to cache");
|
|
||||||
assert!(cache_path.is_dir());
|
|
||||||
assert!(cache.get_cache_filepath(&url).unwrap().is_file());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_get_set() {
|
|
||||||
let dir = TempDir::new();
|
|
||||||
let cache = GlobalHttpCache::new(dir.path().to_path_buf());
|
|
||||||
let url = Url::parse("https://deno.land/x/welcome.ts").unwrap();
|
|
||||||
let mut headers = HashMap::new();
|
|
||||||
headers.insert(
|
|
||||||
"content-type".to_string(),
|
|
||||||
"application/javascript".to_string(),
|
|
||||||
);
|
|
||||||
headers.insert("etag".to_string(), "as5625rqdsfb".to_string());
|
|
||||||
let content = b"Hello world";
|
|
||||||
let r = cache.set(&url, headers, content);
|
|
||||||
eprintln!("result {r:?}");
|
|
||||||
assert!(r.is_ok());
|
|
||||||
let key = cache.cache_item_key(&url).unwrap();
|
|
||||||
let content =
|
|
||||||
String::from_utf8(cache.read_file_bytes(&key).unwrap().unwrap()).unwrap();
|
|
||||||
let headers = cache.read_metadata(&key).unwrap().unwrap().headers;
|
|
||||||
assert_eq!(content, "Hello world");
|
|
||||||
assert_eq!(
|
|
||||||
headers.get("content-type").unwrap(),
|
|
||||||
"application/javascript"
|
|
||||||
);
|
|
||||||
assert_eq!(headers.get("etag").unwrap(), "as5625rqdsfb");
|
|
||||||
assert_eq!(headers.get("foobar"), None);
|
|
||||||
}
|
|
||||||
}
|
|
1425
cli/cache/http_cache/local.rs
vendored
1425
cli/cache/http_cache/local.rs
vendored
File diff suppressed because it is too large
Load diff
77
cli/cache/http_cache/mod.rs
vendored
77
cli/cache/http_cache/mod.rs
vendored
|
@ -1,77 +0,0 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
||||||
|
|
||||||
use deno_core::error::AnyError;
|
|
||||||
use deno_core::serde::Deserialize;
|
|
||||||
use deno_core::serde::Serialize;
|
|
||||||
use deno_core::url::Url;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::time::SystemTime;
|
|
||||||
|
|
||||||
use crate::http_util::HeadersMap;
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
mod global;
|
|
||||||
mod local;
|
|
||||||
|
|
||||||
pub use global::url_to_filename;
|
|
||||||
pub use global::GlobalHttpCache;
|
|
||||||
pub use local::LocalHttpCache;
|
|
||||||
pub use local::LocalLspHttpCache;
|
|
||||||
|
|
||||||
/// Cached metadata about a url.
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
|
||||||
pub struct CachedUrlMetadata {
|
|
||||||
pub headers: HeadersMap,
|
|
||||||
pub url: String,
|
|
||||||
#[serde(default = "SystemTime::now", rename = "now")]
|
|
||||||
pub time: SystemTime,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CachedUrlMetadata {
|
|
||||||
pub fn is_redirect(&self) -> bool {
|
|
||||||
self.headers.contains_key("location")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Computed cache key, which can help reduce the work of computing the cache key multiple times.
|
|
||||||
pub struct HttpCacheItemKey<'a> {
|
|
||||||
// The key is specific to the implementation of HttpCache,
|
|
||||||
// so keep these private to the module. For example, the
|
|
||||||
// fact that these may be stored in a file is an implementation
|
|
||||||
// detail.
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
pub(super) is_local_key: bool,
|
|
||||||
pub(super) url: &'a Url,
|
|
||||||
/// This will be set all the time for the global cache, but it
|
|
||||||
/// won't ever be set for the local cache because that also needs
|
|
||||||
/// header information to determine the final path.
|
|
||||||
pub(super) file_path: Option<PathBuf>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait HttpCache: Send + Sync + std::fmt::Debug {
|
|
||||||
/// A pre-computed key for looking up items in the cache.
|
|
||||||
fn cache_item_key<'a>(
|
|
||||||
&self,
|
|
||||||
url: &'a Url,
|
|
||||||
) -> Result<HttpCacheItemKey<'a>, AnyError>;
|
|
||||||
|
|
||||||
fn contains(&self, url: &Url) -> bool;
|
|
||||||
fn set(
|
|
||||||
&self,
|
|
||||||
url: &Url,
|
|
||||||
headers: HeadersMap,
|
|
||||||
content: &[u8],
|
|
||||||
) -> Result<(), AnyError>;
|
|
||||||
fn read_modified_time(
|
|
||||||
&self,
|
|
||||||
key: &HttpCacheItemKey,
|
|
||||||
) -> Result<Option<SystemTime>, AnyError>;
|
|
||||||
fn read_file_bytes(
|
|
||||||
&self,
|
|
||||||
key: &HttpCacheItemKey,
|
|
||||||
) -> Result<Option<Vec<u8>>, AnyError>;
|
|
||||||
fn read_metadata(
|
|
||||||
&self,
|
|
||||||
key: &HttpCacheItemKey,
|
|
||||||
) -> Result<Option<CachedUrlMetadata>, AnyError>;
|
|
||||||
}
|
|
55
cli/cache/mod.rs
vendored
55
cli/cache/mod.rs
vendored
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use crate::errors::get_error_class_name;
|
use crate::errors::get_error_class_name;
|
||||||
use crate::file_fetcher::FileFetcher;
|
use crate::file_fetcher::FileFetcher;
|
||||||
|
use crate::util::fs::atomic_write_file;
|
||||||
|
|
||||||
use deno_core::futures;
|
use deno_core::futures;
|
||||||
use deno_core::futures::FutureExt;
|
use deno_core::futures::FutureExt;
|
||||||
|
@ -12,8 +13,10 @@ use deno_graph::source::LoadResponse;
|
||||||
use deno_graph::source::Loader;
|
use deno_graph::source::Loader;
|
||||||
use deno_runtime::permissions::PermissionsContainer;
|
use deno_runtime::permissions::PermissionsContainer;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::time::SystemTime;
|
||||||
|
|
||||||
mod cache_db;
|
mod cache_db;
|
||||||
mod caches;
|
mod caches;
|
||||||
|
@ -22,7 +25,6 @@ mod common;
|
||||||
mod deno_dir;
|
mod deno_dir;
|
||||||
mod disk_cache;
|
mod disk_cache;
|
||||||
mod emit;
|
mod emit;
|
||||||
mod http_cache;
|
|
||||||
mod incremental;
|
mod incremental;
|
||||||
mod node;
|
mod node;
|
||||||
mod parsed_source;
|
mod parsed_source;
|
||||||
|
@ -34,11 +36,6 @@ pub use deno_dir::DenoDir;
|
||||||
pub use deno_dir::DenoDirProvider;
|
pub use deno_dir::DenoDirProvider;
|
||||||
pub use disk_cache::DiskCache;
|
pub use disk_cache::DiskCache;
|
||||||
pub use emit::EmitCache;
|
pub use emit::EmitCache;
|
||||||
pub use http_cache::CachedUrlMetadata;
|
|
||||||
pub use http_cache::GlobalHttpCache;
|
|
||||||
pub use http_cache::HttpCache;
|
|
||||||
pub use http_cache::LocalHttpCache;
|
|
||||||
pub use http_cache::LocalLspHttpCache;
|
|
||||||
pub use incremental::IncrementalCache;
|
pub use incremental::IncrementalCache;
|
||||||
pub use node::NodeAnalysisCache;
|
pub use node::NodeAnalysisCache;
|
||||||
pub use parsed_source::ParsedSourceCache;
|
pub use parsed_source::ParsedSourceCache;
|
||||||
|
@ -46,6 +43,52 @@ pub use parsed_source::ParsedSourceCache;
|
||||||
/// Permissions used to save a file in the disk caches.
|
/// Permissions used to save a file in the disk caches.
|
||||||
pub const CACHE_PERM: u32 = 0o644;
|
pub const CACHE_PERM: u32 = 0o644;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct RealDenoCacheEnv;
|
||||||
|
|
||||||
|
impl deno_cache_dir::DenoCacheEnv for RealDenoCacheEnv {
|
||||||
|
fn read_file_bytes(&self, path: &Path) -> std::io::Result<Option<Vec<u8>>> {
|
||||||
|
match std::fs::read(path) {
|
||||||
|
Ok(s) => Ok(Some(s)),
|
||||||
|
Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),
|
||||||
|
Err(err) => Err(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn atomic_write_file(
|
||||||
|
&self,
|
||||||
|
path: &Path,
|
||||||
|
bytes: &[u8],
|
||||||
|
) -> std::io::Result<()> {
|
||||||
|
atomic_write_file(path, bytes, CACHE_PERM)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn modified(&self, path: &Path) -> std::io::Result<Option<SystemTime>> {
|
||||||
|
match std::fs::metadata(path) {
|
||||||
|
Ok(metadata) => Ok(Some(
|
||||||
|
metadata.modified().unwrap_or_else(|_| SystemTime::now()),
|
||||||
|
)),
|
||||||
|
Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),
|
||||||
|
Err(err) => Err(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_file(&self, path: &Path) -> bool {
|
||||||
|
path.is_file()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn time_now(&self) -> SystemTime {
|
||||||
|
SystemTime::now()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type GlobalHttpCache = deno_cache_dir::GlobalHttpCache<RealDenoCacheEnv>;
|
||||||
|
pub type LocalHttpCache = deno_cache_dir::LocalHttpCache<RealDenoCacheEnv>;
|
||||||
|
pub type LocalLspHttpCache =
|
||||||
|
deno_cache_dir::LocalLspHttpCache<RealDenoCacheEnv>;
|
||||||
|
pub use deno_cache_dir::CachedUrlMetadata;
|
||||||
|
pub use deno_cache_dir::HttpCache;
|
||||||
|
|
||||||
/// A "wrapper" for the FileFetcher and DiskCache for the Deno CLI that provides
|
/// A "wrapper" for the FileFetcher and DiskCache for the Deno CLI that provides
|
||||||
/// a concise interface to the DENO_DIR when building module graphs.
|
/// a concise interface to the DENO_DIR when building module graphs.
|
||||||
pub struct FetchCacher {
|
pub struct FetchCacher {
|
||||||
|
|
|
@ -241,6 +241,7 @@ impl CliFactory {
|
||||||
self.services.global_http_cache.get_or_try_init(|| {
|
self.services.global_http_cache.get_or_try_init(|| {
|
||||||
Ok(Arc::new(GlobalHttpCache::new(
|
Ok(Arc::new(GlobalHttpCache::new(
|
||||||
self.deno_dir()?.deps_folder_path(),
|
self.deno_dir()?.deps_folder_path(),
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
)))
|
)))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -696,6 +696,7 @@ async fn fetch_once<'a>(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::cache::GlobalHttpCache;
|
use crate::cache::GlobalHttpCache;
|
||||||
|
use crate::cache::RealDenoCacheEnv;
|
||||||
use crate::http_util::HttpClient;
|
use crate::http_util::HttpClient;
|
||||||
use crate::version;
|
use crate::version;
|
||||||
|
|
||||||
|
@ -727,7 +728,7 @@ mod tests {
|
||||||
let location = temp_dir.path().join("deps").to_path_buf();
|
let location = temp_dir.path().join("deps").to_path_buf();
|
||||||
let blob_store: Arc<BlobStore> = Default::default();
|
let blob_store: Arc<BlobStore> = Default::default();
|
||||||
let file_fetcher = FileFetcher::new(
|
let file_fetcher = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location)),
|
Arc::new(GlobalHttpCache::new(location, RealDenoCacheEnv)),
|
||||||
cache_setting,
|
cache_setting,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1173,7 +1174,10 @@ mod tests {
|
||||||
// invocation and indicates to "cache bust".
|
// invocation and indicates to "cache bust".
|
||||||
let location = temp_dir.path().join("deps").to_path_buf();
|
let location = temp_dir.path().join("deps").to_path_buf();
|
||||||
let file_fetcher = FileFetcher::new(
|
let file_fetcher = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location)),
|
Arc::new(GlobalHttpCache::new(
|
||||||
|
location,
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
)),
|
||||||
CacheSetting::ReloadAll,
|
CacheSetting::ReloadAll,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1202,7 +1206,10 @@ mod tests {
|
||||||
|
|
||||||
let file_modified_01 = {
|
let file_modified_01 = {
|
||||||
let file_fetcher = FileFetcher::new(
|
let file_fetcher = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location.clone())),
|
Arc::new(GlobalHttpCache::new(
|
||||||
|
location.clone(),
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
)),
|
||||||
CacheSetting::Use,
|
CacheSetting::Use,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1231,7 +1238,10 @@ mod tests {
|
||||||
|
|
||||||
let file_modified_02 = {
|
let file_modified_02 = {
|
||||||
let file_fetcher = FileFetcher::new(
|
let file_fetcher = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location)),
|
Arc::new(GlobalHttpCache::new(
|
||||||
|
location,
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
)),
|
||||||
CacheSetting::Use,
|
CacheSetting::Use,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1362,7 +1372,10 @@ mod tests {
|
||||||
|
|
||||||
let metadata_file_modified_01 = {
|
let metadata_file_modified_01 = {
|
||||||
let file_fetcher = FileFetcher::new(
|
let file_fetcher = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location.clone())),
|
Arc::new(GlobalHttpCache::new(
|
||||||
|
location.clone(),
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
)),
|
||||||
CacheSetting::Use,
|
CacheSetting::Use,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1394,7 +1407,10 @@ mod tests {
|
||||||
|
|
||||||
let metadata_file_modified_02 = {
|
let metadata_file_modified_02 = {
|
||||||
let file_fetcher = FileFetcher::new(
|
let file_fetcher = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location)),
|
Arc::new(GlobalHttpCache::new(
|
||||||
|
location,
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
)),
|
||||||
CacheSetting::Use,
|
CacheSetting::Use,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1496,7 +1512,10 @@ mod tests {
|
||||||
let temp_dir = TempDir::new();
|
let temp_dir = TempDir::new();
|
||||||
let location = temp_dir.path().join("deps").to_path_buf();
|
let location = temp_dir.path().join("deps").to_path_buf();
|
||||||
let file_fetcher = FileFetcher::new(
|
let file_fetcher = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location)),
|
Arc::new(GlobalHttpCache::new(
|
||||||
|
location,
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
)),
|
||||||
CacheSetting::Use,
|
CacheSetting::Use,
|
||||||
false,
|
false,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1521,7 +1540,7 @@ mod tests {
|
||||||
let temp_dir = TempDir::new();
|
let temp_dir = TempDir::new();
|
||||||
let location = temp_dir.path().join("deps").to_path_buf();
|
let location = temp_dir.path().join("deps").to_path_buf();
|
||||||
let file_fetcher_01 = FileFetcher::new(
|
let file_fetcher_01 = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location.clone())),
|
Arc::new(GlobalHttpCache::new(location.clone(), RealDenoCacheEnv)),
|
||||||
CacheSetting::Only,
|
CacheSetting::Only,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
@ -1529,7 +1548,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
let file_fetcher_02 = FileFetcher::new(
|
let file_fetcher_02 = FileFetcher::new(
|
||||||
Arc::new(GlobalHttpCache::new(location)),
|
Arc::new(GlobalHttpCache::new(location, RealDenoCacheEnv)),
|
||||||
CacheSetting::Use,
|
CacheSetting::Use,
|
||||||
true,
|
true,
|
||||||
Arc::new(HttpClient::new(None, None)),
|
Arc::new(HttpClient::new(None, None)),
|
||||||
|
|
|
@ -520,14 +520,20 @@ mod tests {
|
||||||
source_fixtures: &[(&str, &str)],
|
source_fixtures: &[(&str, &str)],
|
||||||
location: &Path,
|
location: &Path,
|
||||||
) -> Documents {
|
) -> Documents {
|
||||||
let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
|
let cache = Arc::new(GlobalHttpCache::new(
|
||||||
|
location.to_path_buf(),
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
));
|
||||||
let mut documents = Documents::new(cache);
|
let mut documents = Documents::new(cache);
|
||||||
for (specifier, source, version, language_id) in fixtures {
|
for (specifier, source, version, language_id) in fixtures {
|
||||||
let specifier =
|
let specifier =
|
||||||
resolve_url(specifier).expect("failed to create specifier");
|
resolve_url(specifier).expect("failed to create specifier");
|
||||||
documents.open(specifier, *version, *language_id, (*source).into());
|
documents.open(specifier, *version, *language_id, (*source).into());
|
||||||
}
|
}
|
||||||
let http_cache = GlobalHttpCache::new(location.to_path_buf());
|
let http_cache = GlobalHttpCache::new(
|
||||||
|
location.to_path_buf(),
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
);
|
||||||
for (specifier, source) in source_fixtures {
|
for (specifier, source) in source_fixtures {
|
||||||
let specifier =
|
let specifier =
|
||||||
resolve_url(specifier).expect("failed to create specifier");
|
resolve_url(specifier).expect("failed to create specifier");
|
||||||
|
|
|
@ -1331,6 +1331,7 @@ fn generate_deno_diagnostics(
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::cache::GlobalHttpCache;
|
use crate::cache::GlobalHttpCache;
|
||||||
|
use crate::cache::RealDenoCacheEnv;
|
||||||
use crate::lsp::config::ConfigSnapshot;
|
use crate::lsp::config::ConfigSnapshot;
|
||||||
use crate::lsp::config::Settings;
|
use crate::lsp::config::Settings;
|
||||||
use crate::lsp::config::SpecifierSettings;
|
use crate::lsp::config::SpecifierSettings;
|
||||||
|
@ -1349,7 +1350,10 @@ mod tests {
|
||||||
location: &Path,
|
location: &Path,
|
||||||
maybe_import_map: Option<(&str, &str)>,
|
maybe_import_map: Option<(&str, &str)>,
|
||||||
) -> StateSnapshot {
|
) -> StateSnapshot {
|
||||||
let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
|
let cache = Arc::new(GlobalHttpCache::new(
|
||||||
|
location.to_path_buf(),
|
||||||
|
RealDenoCacheEnv,
|
||||||
|
));
|
||||||
let mut documents = Documents::new(cache);
|
let mut documents = Documents::new(cache);
|
||||||
for (specifier, source, version, language_id) in fixtures {
|
for (specifier, source, version, language_id) in fixtures {
|
||||||
let specifier =
|
let specifier =
|
||||||
|
@ -1374,7 +1378,7 @@ mod tests {
|
||||||
maybe_import_map,
|
maybe_import_map,
|
||||||
assets: Default::default(),
|
assets: Default::default(),
|
||||||
cache_metadata: cache::CacheMetadata::new(Arc::new(
|
cache_metadata: cache::CacheMetadata::new(Arc::new(
|
||||||
GlobalHttpCache::new(location.to_path_buf()),
|
GlobalHttpCache::new(location.to_path_buf(), RealDenoCacheEnv),
|
||||||
)),
|
)),
|
||||||
maybe_node_resolver: None,
|
maybe_node_resolver: None,
|
||||||
maybe_npm_resolver: None,
|
maybe_npm_resolver: None,
|
||||||
|
@ -1424,7 +1428,8 @@ let c: number = "a";
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
let snapshot = Arc::new(snapshot);
|
let snapshot = Arc::new(snapshot);
|
||||||
let cache = Arc::new(GlobalHttpCache::new(cache_location));
|
let cache =
|
||||||
|
Arc::new(GlobalHttpCache::new(cache_location, RealDenoCacheEnv));
|
||||||
let ts_server = TsServer::new(Default::default(), cache);
|
let ts_server = TsServer::new(Default::default(), cache);
|
||||||
|
|
||||||
// test enabled
|
// test enabled
|
||||||
|
@ -1517,7 +1522,8 @@ let c: number = "a";
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
let snapshot = Arc::new(snapshot);
|
let snapshot = Arc::new(snapshot);
|
||||||
let cache = Arc::new(GlobalHttpCache::new(cache_location));
|
let cache =
|
||||||
|
Arc::new(GlobalHttpCache::new(cache_location, RealDenoCacheEnv));
|
||||||
let ts_server = TsServer::new(Default::default(), cache);
|
let ts_server = TsServer::new(Default::default(), cache);
|
||||||
|
|
||||||
let config = mock_config();
|
let config = mock_config();
|
||||||
|
|
|
@ -1851,6 +1851,7 @@ fn sort_and_remove_non_leaf_dirs(mut dirs: Vec<PathBuf>) -> Vec<PathBuf> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::cache::GlobalHttpCache;
|
use crate::cache::GlobalHttpCache;
|
||||||
|
use crate::cache::RealDenoCacheEnv;
|
||||||
use crate::npm::NpmResolution;
|
use crate::npm::NpmResolution;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -1861,7 +1862,10 @@ mod tests {
|
||||||
|
|
||||||
fn setup(temp_dir: &TempDir) -> (Documents, PathRef) {
|
fn setup(temp_dir: &TempDir) -> (Documents, PathRef) {
|
||||||
let location = temp_dir.path().join("deps");
|
let location = temp_dir.path().join("deps");
|
||||||
let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
|
let cache = Arc::new(GlobalHttpCache::new(
|
||||||
|
location.to_path_buf(),
|
||||||
|
RealDenoCacheEnv,
|
||||||
|
));
|
||||||
let documents = Documents::new(cache);
|
let documents = Documents::new(cache);
|
||||||
(documents, location)
|
(documents, location)
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,10 @@ impl Inner {
|
||||||
http_client.clone(),
|
http_client.clone(),
|
||||||
);
|
);
|
||||||
let location = dir.deps_folder_path();
|
let location = dir.deps_folder_path();
|
||||||
let deps_http_cache = Arc::new(GlobalHttpCache::new(location));
|
let deps_http_cache = Arc::new(GlobalHttpCache::new(
|
||||||
|
location,
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
));
|
||||||
let documents = Documents::new(deps_http_cache.clone());
|
let documents = Documents::new(deps_http_cache.clone());
|
||||||
let cache_metadata = cache::CacheMetadata::new(deps_http_cache.clone());
|
let cache_metadata = cache::CacheMetadata::new(deps_http_cache.clone());
|
||||||
let performance = Arc::new(Performance::default());
|
let performance = Arc::new(Performance::default());
|
||||||
|
@ -904,7 +907,10 @@ impl Inner {
|
||||||
);
|
);
|
||||||
self.module_registries_location = module_registries_location;
|
self.module_registries_location = module_registries_location;
|
||||||
// update the cache path
|
// update the cache path
|
||||||
let global_cache = Arc::new(GlobalHttpCache::new(dir.deps_folder_path()));
|
let global_cache = Arc::new(GlobalHttpCache::new(
|
||||||
|
dir.deps_folder_path(),
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
));
|
||||||
let maybe_local_cache =
|
let maybe_local_cache =
|
||||||
self.config.maybe_vendor_dir_path().map(|local_path| {
|
self.config.maybe_vendor_dir_path().map(|local_path| {
|
||||||
Arc::new(LocalLspHttpCache::new(local_path, global_cache.clone()))
|
Arc::new(LocalLspHttpCache::new(local_path, global_cache.clone()))
|
||||||
|
|
|
@ -422,7 +422,10 @@ pub struct ModuleRegistry {
|
||||||
impl ModuleRegistry {
|
impl ModuleRegistry {
|
||||||
pub fn new(location: PathBuf, http_client: Arc<HttpClient>) -> Self {
|
pub fn new(location: PathBuf, http_client: Arc<HttpClient>) -> Self {
|
||||||
// the http cache should always be the global one for registry completions
|
// the http cache should always be the global one for registry completions
|
||||||
let http_cache = Arc::new(GlobalHttpCache::new(location));
|
let http_cache = Arc::new(GlobalHttpCache::new(
|
||||||
|
location,
|
||||||
|
crate::cache::RealDenoCacheEnv,
|
||||||
|
));
|
||||||
let mut file_fetcher = FileFetcher::new(
|
let mut file_fetcher = FileFetcher::new(
|
||||||
http_cache.clone(),
|
http_cache.clone(),
|
||||||
CacheSetting::RespectHeaders,
|
CacheSetting::RespectHeaders,
|
||||||
|
|
|
@ -3915,6 +3915,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::cache::GlobalHttpCache;
|
use crate::cache::GlobalHttpCache;
|
||||||
use crate::cache::HttpCache;
|
use crate::cache::HttpCache;
|
||||||
|
use crate::cache::RealDenoCacheEnv;
|
||||||
use crate::http_util::HeadersMap;
|
use crate::http_util::HeadersMap;
|
||||||
use crate::lsp::cache::CacheMetadata;
|
use crate::lsp::cache::CacheMetadata;
|
||||||
use crate::lsp::config::WorkspaceSettings;
|
use crate::lsp::config::WorkspaceSettings;
|
||||||
|
@ -3931,7 +3932,10 @@ mod tests {
|
||||||
fixtures: &[(&str, &str, i32, LanguageId)],
|
fixtures: &[(&str, &str, i32, LanguageId)],
|
||||||
location: &Path,
|
location: &Path,
|
||||||
) -> StateSnapshot {
|
) -> StateSnapshot {
|
||||||
let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
|
let cache = Arc::new(GlobalHttpCache::new(
|
||||||
|
location.to_path_buf(),
|
||||||
|
RealDenoCacheEnv,
|
||||||
|
));
|
||||||
let mut documents = Documents::new(cache.clone());
|
let mut documents = Documents::new(cache.clone());
|
||||||
for (specifier, source, version, language_id) in fixtures {
|
for (specifier, source, version, language_id) in fixtures {
|
||||||
let specifier =
|
let specifier =
|
||||||
|
@ -3960,7 +3964,8 @@ mod tests {
|
||||||
sources: &[(&str, &str, i32, LanguageId)],
|
sources: &[(&str, &str, i32, LanguageId)],
|
||||||
) -> (JsRuntime, Arc<StateSnapshot>, PathBuf) {
|
) -> (JsRuntime, Arc<StateSnapshot>, PathBuf) {
|
||||||
let location = temp_dir.path().join("deps").to_path_buf();
|
let location = temp_dir.path().join("deps").to_path_buf();
|
||||||
let cache = Arc::new(GlobalHttpCache::new(location.clone()));
|
let cache =
|
||||||
|
Arc::new(GlobalHttpCache::new(location.clone(), RealDenoCacheEnv));
|
||||||
let state_snapshot = Arc::new(mock_state_snapshot(sources, &location));
|
let state_snapshot = Arc::new(mock_state_snapshot(sources, &location));
|
||||||
let mut runtime = js_runtime(Default::default(), cache);
|
let mut runtime = js_runtime(Default::default(), cache);
|
||||||
start(&mut runtime, debug).unwrap();
|
start(&mut runtime, debug).unwrap();
|
||||||
|
@ -4440,7 +4445,7 @@ mod tests {
|
||||||
LanguageId::TypeScript,
|
LanguageId::TypeScript,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
let cache = Arc::new(GlobalHttpCache::new(location));
|
let cache = Arc::new(GlobalHttpCache::new(location, RealDenoCacheEnv));
|
||||||
let specifier_dep =
|
let specifier_dep =
|
||||||
resolve_url("https://deno.land/x/example/a.ts").unwrap();
|
resolve_url("https://deno.land/x/example/a.ts").unwrap();
|
||||||
cache
|
cache
|
||||||
|
|
Loading…
Reference in a new issue