Fix the "new" breaking of loading of plugins on Windows GitHub actions. (#4426)
This commit is contained in:
parent
8af2110858
commit
e0d004beec
|
|
@ -1,10 +1,12 @@
|
|||
import path from 'node:path';
|
||||
import { readdir as _readdir } from 'node:fs';
|
||||
import { promisify } from 'node:util';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
|
||||
import { importGlobalSilent } from 'import-global';
|
||||
const readdir = promisify(_readdir);
|
||||
const __dirname = path.dirname(import.meta.url);
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const defaultPlugins = new Set([
|
||||
'browsertime',
|
||||
|
|
@ -49,7 +51,7 @@ export async function parsePluginNames(options) {
|
|||
return pluginNames;
|
||||
};
|
||||
|
||||
const files = await readdir(new URL(pluginsDir));
|
||||
const files = await readdir(pluginsDir);
|
||||
|
||||
const builtins = files.map(name => path.basename(name, '.js'));
|
||||
// eslint-disable-next-line unicorn/no-array-callback-reference
|
||||
|
|
@ -60,9 +62,9 @@ export async function loadPlugins(pluginNames, options, context, queue) {
|
|||
const plugins = [];
|
||||
for (let name of pluginNames) {
|
||||
try {
|
||||
let { default: plugin } = await import(
|
||||
path.join(pluginsDir, name, 'index.js')
|
||||
);
|
||||
const pluginPath = path.join(pluginsDir, name, 'index.js');
|
||||
const pluginUrl = pathToFileURL(pluginPath).href;
|
||||
let { default: plugin } = await import(pluginUrl);
|
||||
let p = new plugin(options, context, queue);
|
||||
plugins.push(p);
|
||||
} catch (error_) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue