Skip to content

Commit 7384905

Browse files
committed
refactor: wip
1 parent 12fd5ca commit 7384905

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/utils/src/lib/execute-process.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ export function executeProcess(cfg: ProcessConfig): Promise<ProcessResult> {
162162
const worker = () =>
163163
new Promise<ProcessResult>((resolve, reject) => {
164164
const spawnedProcess = spawn(command, args ?? [], {
165-
// shell:true tells Windows to use shell command for spawning a child process
165+
// shell is only needed on Windows to spawn child processes correctly
166166
// https://stackoverflow.com/questions/60386867/node-spawn-child-process-not-working-in-windows
167-
shell: true,
167+
// Using shell conditionally avoids Node.js DEP0190 deprecation warning
168+
shell: process.platform === 'win32',
168169
windowsHide: true,
169170
...options,
170171
}) as ChildProcessByStdio<Writable, Readable, Readable>;

packages/utils/src/lib/import-module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ type JitiOptions = Exclude<Parameters<typeof createJitiSource>[1], undefined>;
1111

1212
/**
1313
* Known packages that must be loaded natively (not transformed by jiti).
14-
* These packages rely on import.meta.url being a real file:// URL.
14+
* These packages rely on import.meta.url being a real file:// URL,
15+
* or have critical import side effects that must execute in order.
1516
* When jiti transforms modules, import.meta.url becomes 'about:blank',
1617
* causing errors in packages that use new URL(..., import.meta.url).
1718
*/
1819
export const JITI_NATIVE_MODULES = [
1920
//'@vitest/eslint-plugin',
2021
//'@code-pushup/eslint-config',
2122
//'lighthouse',
23+
'axe-core', // Has side effects that require window/document globals at import time
24+
'jsdom', // Needed for axe-core polyfill - must execute its side effects before axe-core loads
2225
] as const;
2326

2427
export type ImportModuleOptions = JitiOptions & {

0 commit comments

Comments
 (0)