Former-commit-id: f584a38a72
This commit is contained in:
Jarred Sumner
2021-06-04 13:50:22 -07:00
parent 7626746904
commit ea2a4aa181
3 changed files with 9 additions and 10 deletions

View File

@@ -291,11 +291,11 @@ pub const Bundler = struct {
};
pub fn parse(bundler: *Bundler, allocator: *std.mem.Allocator, path: Fs.Path, loader: options.Loader, dirname_fd: StoredFileDescriptorType) ?ParseResult {
if (enableTracing) {
if (FeatureFlags.tracing) {
bundler.timer.start();
}
defer {
if (enableTracing) {
if (FeatureFlags.tracing) {
bundler.timer.stop();
bundler.elapsed += bundler.timer.elapsed;
}
@@ -616,7 +616,7 @@ pub const Bundler = struct {
);
}
if (enableTracing) {
if (FeatureFlags.tracing) {
Output.printError(
"\n---Tracing---\nResolve time: {d}\nParsing time: {d}\n---Tracing--\n\n",
.{

View File

@@ -38,14 +38,15 @@ pub const FeatureFlags = struct {
// This doesn't really seem to do anything for us
pub const disable_filesystem_cache = false and std.Target.current.os.tag == .macos;
// This doesn't really seem to do anything for us
pub const css_in_js_import_behavior = CSSModulePolyfill.facade;
pub const only_output_esm = true;
pub const jsx_runtime_is_cjs = true;
pub const cache_node_module_output_in_memory = true;
pub const bundle_node_modules = true;
pub const tracing = true;
pub const CSSModulePolyfill = enum {
// When you import a .css file and you reference the import in JavaScript
@@ -54,8 +55,6 @@ pub const FeatureFlags = struct {
};
};
pub const enableTracing = true;
pub const isDebug = std.builtin.Mode.Debug == std.builtin.mode;
pub const isTest = std.builtin.is_test;

View File

@@ -340,16 +340,16 @@ pub const Resolver = struct {
}
}
}
var tracing_start: i128 = if (enableTracing) 0 else undefined;
var tracing_start: i128 = if (FeatureFlags.tracing) 0 else undefined;
threadlocal var relative_abs_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
pub fn resolve(r: *Resolver, source_dir: string, import_path: string, kind: ast.ImportKind) !Result {
if (enableTracing) {
if (FeatureFlags.tracing) {
tracing_start = std.time.nanoTimestamp();
}
defer {
if (enableTracing) {
if (FeatureFlags.tracing) {
r.elapsed += std.time.nanoTimestamp() - tracing_start;
}
}