File tree Expand file tree Collapse file tree 9 files changed +509
-53
lines changed Expand file tree Collapse file tree 9 files changed +509
-53
lines changed Original file line number Diff line number Diff line change 6262 "vite-node" : " ^2.1.4 || ^3.1.2" ,
6363 "web-ext-run" : " ^0.2.4"
6464 },
65+ "peerDependencies" : {
66+ "eslint" : " ^8.57.0 || ^9.0.0"
67+ },
68+ "peerDependenciesMeta" : {
69+ "eslint" : {
70+ "optional" : true
71+ }
72+ },
6573 "devDependencies" : {
6674 "@aklinker1/check" : " ^2.1.0" ,
6775 "@faker-js/faker" : " ^10.0.0" ,
7078 "@types/node" : " ^20.17.6" ,
7179 "@types/normalize-path" : " ^3.0.2" ,
7280 "@types/prompts" : " ^2.4.9" ,
81+ "eslint" : " ^9.38.0" ,
7382 "extract-zip" : " ^2.0.1" ,
7483 "happy-dom" : " ^18.0.1" ,
7584 "lodash.merge" : " ^4.6.2" ,
8089 "vitest" : " ^3.2.4" ,
8190 "vitest-plugin-random-seed" : " ^1.1.1"
8291 },
83- "peerDependenciesMeta" : {},
8492 "repository" : {
8593 "type" : " git" ,
8694 "url" : " git+https://github.com/wxt-dev/wxt.git"
Original file line number Diff line number Diff line change 11import { ResolvedConfig } from '../../../../types' ;
2- import * as vite from 'vite' ;
2+ import type * as vite from 'vite' ;
33import { normalizePath } from '../../../utils/paths' ;
44import { removeMainFunctionCode } from '../../../utils/transform' ;
55import { resolve } from 'node:path' ;
Original file line number Diff line number Diff line change @@ -536,17 +536,10 @@ async function getUnimportEslintOptions(
536536 * Returns the path to `node_modules/wxt`.
537537 */
538538function resolveWxtModuleDir ( ) {
539- // TODO: Drop the __filename expression once we're fully running in ESM
540- // (see https://github.com/wxt-dev/wxt/issues/277)
541- const importer =
542- typeof __filename === 'string'
543- ? pathToFileURL ( __filename ) . href
544- : import . meta. url ;
545-
546539 // TODO: Switch to import.meta.resolve() once the parent argument is unflagged
547540 // (e.g. --experimental-import-meta-resolve) and all Node.js versions we support
548541 // have it.
549- const url = esmResolve ( 'wxt' , importer ) ;
542+ const url = esmResolve ( 'wxt' , import . meta . url ) ;
550543
551544 // esmResolve() returns the "wxt/dist/index.mjs" file, not the package's root
552545 // directory, which we want to return from this function.
Original file line number Diff line number Diff line change 1- import { ExtensionRunner } from '../../types' ;
2- import { createWslRunner } from './wsl' ;
3- import { createWebExtRunner } from './web-ext' ;
4- import { createSafariRunner } from './safari' ;
5- import { createManualRunner } from './manual' ;
1+ import type { ExtensionRunner } from '../../types' ;
62import { isWsl } from '../utils/wsl' ;
73import { wxt } from '../wxt' ;
4+ import { createManualRunner } from './manual' ;
5+ import { createSafariRunner } from './safari' ;
6+ import { createWebExtRunner } from './web-ext' ;
7+ import { createWslRunner } from './wsl' ;
88
99export async function createExtensionRunner ( ) : Promise < ExtensionRunner > {
1010 if ( wxt . config . browser === 'safari' ) return createSafariRunner ( ) ;
1111
12- if ( await isWsl ( ) ) return createWslRunner ( ) ;
12+ if ( isWsl ( ) ) return createWslRunner ( ) ;
1313 if ( wxt . config . runnerConfig . config ?. disabled ) return createManualRunner ( ) ;
1414
1515 return createWebExtRunner ( ) ;
Original file line number Diff line number Diff line change 11export async function getEslintVersion ( ) : Promise < string [ ] > {
22 try {
3- const require = ( await import ( 'node:module' ) ) . default . createRequire (
4- import . meta. url ,
5- ) ;
6- const { ESLint } = require ( 'eslint' ) ;
3+ const { ESLint } = await import ( 'eslint' ) ;
74 return ESLint . version ?. split ( '.' ) ?? [ ] ;
85 } catch {
96 // Return an empty version when there's an error importing ESLint
Original file line number Diff line number Diff line change 1+ // TODO: Someone smarter than me should just mock this module instead.
2+ import isWsl_ from 'is-wsl' ;
3+
14/**
25 * Returns true when running on WSL or WSL2.
36 */
4- export async function isWsl ( ) : Promise < boolean > {
5- const { default : isWsl } = await import ( 'is-wsl' ) ; // ESM only, requires dynamic import
6- return isWsl ;
7+ export function isWsl ( ) : boolean {
8+ return isWsl_ ;
79}
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ export function addImportPreset(
171171 if ( ! wxt . config . imports ) return ;
172172
173173 wxt . config . imports . presets ??= [ ] ;
174- // De-dupelicate built-in named presets
174+ // De-duplicate built-in named presets
175175 if ( wxt . config . imports . presets . includes ( preset ) ) return ;
176176
177177 wxt . config . imports . presets . push ( preset ) ;
You can’t perform that action at this time.
0 commit comments