MCPcopy
hub / github.com/less/less.js / loadPlugin

Function loadPlugin

packages/less/lib/less-node/plugin-loader.js:27–53  ·  view source on GitHub ↗
(filename, basePath, context, environment, fileManager)

Source from the content-addressed store, hash-verified

25
26PluginLoader.prototype = Object.assign(new AbstractPluginLoader(), {
27 loadPlugin(filename, basePath, context, environment, fileManager) {
28 const prefix = filename.slice(0, 1);
29 const explicit = prefix === '.' || prefix === '/' || filename.slice(-3).toLowerCase() === '.js';
30 if (!explicit) {
31 context.prefixes = ['less-plugin-', ''];
32 }
33
34 if (context.syncImport) {
35 return fileManager.loadFileSync(filename, basePath, context, environment);
36 }
37
38 return new Promise((fulfill, reject) => {
39 fileManager.loadFile(filename, basePath, context, environment).then(
40 data => {
41 try {
42 fulfill(data);
43 }
44 catch (e) {
45 console.log(e);
46 reject(e);
47 }
48 }
49 ).catch(err => {
50 reject(err);
51 });
52 });
53 },
54
55 loadPluginSync(filename, basePath, context, environment, fileManager) {
56 context.syncImport = true;

Callers

nothing calls this directly

Calls 2

loadFileSyncMethod · 0.80
loadFileMethod · 0.80

Tested by

no test coverage detected