Skip to content

Commit

Permalink
chore(deps): remove resolve (#5594)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Dec 24, 2024
1 parent 51dcd8d commit 1918cf4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
15 changes: 3 additions & 12 deletions lib/hexo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ import type { AssetGenerator, LocalsType, NodeJSLikeCallback, NormalPageGenerato
import type { AddSchemaTypeOptions } from 'warehouse/dist/types';
import type Schema from 'warehouse/dist/schema';

let resolveSync; // = require('resolve');

const libDir = dirname(__dirname);
const dbVersion = 1;

Expand Down Expand Up @@ -457,16 +455,9 @@ class Hexo extends EventEmitter {
// Try to resolve the plugin with the Node.js's built-in require.resolve.
return require.resolve(name, { paths: [basedir] });
} catch (err) {
try {
// There was an error (likely the node_modules is corrupt or from early version of npm)
// Use Hexo prior 6.0.0's behavior (resolve.sync) to resolve the plugin.
resolveSync = resolveSync || require('resolve').sync;
return resolveSync(name, { basedir });
} catch (err) {
// There was an error (likely the plugin wasn't found), so return a possibly
// non-existing path that a later part of the resolution process will check.
return join(basedir, 'node_modules', name);
}
// There was an error (likely the node_modules is corrupt or from early version of npm),
// so return a possibly non-existing path that a later part of the resolution process will check.
return join(basedir, 'node_modules', name);
}
}

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"nunjucks": "^3.2.3",
"picocolors": "^1.0.0",
"pretty-hrtime": "^1.0.3",
"resolve": "^1.22.0",
"strip-ansi": "^6.0.0",
"text-table": "^0.2.0",
"tildify": "^2.0.0",
Expand Down

0 comments on commit 1918cf4

Please sign in to comment.