mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
fix(vendor): ignore import map in output directory instead of erroring (#14998)
This commit is contained in:
parent
d5ef14eca6
commit
e46584a75a
5 changed files with 135 additions and 70 deletions
|
@ -44,6 +44,14 @@ use crate::file_fetcher::CacheSetting;
|
|||
use crate::lockfile::Lockfile;
|
||||
use crate::version;
|
||||
|
||||
/// Overrides for the options below that when set will
|
||||
/// use these values over the values derived from the
|
||||
/// CLI flags or config file.
|
||||
#[derive(Default)]
|
||||
struct CliOptionOverrides {
|
||||
import_map_specifier: Option<Option<ModuleSpecifier>>,
|
||||
}
|
||||
|
||||
/// Holds the common options used by many sub commands
|
||||
/// and provides some helper function for creating common objects.
|
||||
pub struct CliOptions {
|
||||
|
@ -51,6 +59,7 @@ pub struct CliOptions {
|
|||
// application need not concern itself with, so keep these private
|
||||
flags: Flags,
|
||||
maybe_config_file: Option<ConfigFile>,
|
||||
overrides: CliOptionOverrides,
|
||||
}
|
||||
|
||||
impl CliOptions {
|
||||
|
@ -72,6 +81,7 @@ impl CliOptions {
|
|||
Ok(Self {
|
||||
maybe_config_file,
|
||||
flags,
|
||||
overrides: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -113,13 +123,21 @@ impl CliOptions {
|
|||
|
||||
/// Based on an optional command line import map path and an optional
|
||||
/// configuration file, return a resolved module specifier to an import map.
|
||||
pub fn resolve_import_map_path(
|
||||
pub fn resolve_import_map_specifier(
|
||||
&self,
|
||||
) -> Result<Option<ModuleSpecifier>, AnyError> {
|
||||
resolve_import_map_specifier(
|
||||
self.flags.import_map_path.as_deref(),
|
||||
self.maybe_config_file.as_ref(),
|
||||
)
|
||||
match self.overrides.import_map_specifier.clone() {
|
||||
Some(path) => Ok(path),
|
||||
None => resolve_import_map_specifier(
|
||||
self.flags.import_map_path.as_deref(),
|
||||
self.maybe_config_file.as_ref(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
/// Overrides the import map specifier to use.
|
||||
pub fn set_import_map_specifier(&mut self, path: Option<ModuleSpecifier>) {
|
||||
self.overrides.import_map_specifier = Some(path);
|
||||
}
|
||||
|
||||
pub fn resolve_root_cert_store(&self) -> Result<RootCertStore, AnyError> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue