Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update
  • Loading branch information
hyoban committed Mar 9, 2025
commit 11dff9259c270cf8988934e46cb4c5744f5acd86
15 changes: 1 addition & 14 deletions lib/util/customConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ try {
}

const CHECK_REFRESH_RATE = 1_000;
let previousConfig = null;
let lastCheck = null;
let mergedConfig = new Map();
let lastModifiedDate = new Map();
Expand Down Expand Up @@ -70,23 +69,11 @@ function loadConfig(config) {
}
}

function convertConfigToString(config) {
switch (typeof config) {
case 'string':
return config;
case 'object':
return JSON.stringify(config);
default:
return config.toString();
}
}

function resolve(twConfig) {
const newConfig = convertConfigToString(twConfig) !== convertConfigToString(previousConfig);
const newConfig = mergedConfig.get(twConfig) === undefined;
const now = Date.now();
const expired = now - lastCheck > CHECK_REFRESH_RATE;
if (newConfig || expired) {
previousConfig = twConfig;
lastCheck = now;
const userConfig = loadConfig(twConfig);
// userConfig is null when config file was not modified
Expand Down