wxt 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js","../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js","../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js","../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js","../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js","../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js","../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js","../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js","../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js","../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js","../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js","../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js","../src/core/utils/getInternalConfig.ts","../src/core/utils/createFsCache.ts","../src/core/utils/fs.ts","../src/core/utils/entrypoints.ts","../src/core/utils/paths.ts","../src/core/vite-plugins/devHtmlPrerender.ts","../src/core/vite-plugins/devServerGlobals.ts","../src/core/utils/network.ts","../src/core/utils/promises.ts","../src/core/vite-plugins/download.ts","../src/core/vite-plugins/multipageMove.ts","../src/core/vite-plugins/unimport.ts","../src/core/utils/auto-imports.ts","../src/core/vite-plugins/virtualEntrypoint.ts","../src/core/vite-plugins/tsconfigPaths.ts","../src/core/vite-plugins/noopBackground.ts","../src/core/vite-plugins/cssEntrypoints.ts","../src/core/vite-plugins/bundleAnalysis.ts","../src/core/utils/globals.ts","../src/index.ts","../src/core/utils/arrays.ts","../src/core/utils/detectDevChanges.ts","../src/core/build/buildEntrypoints.ts","../src/core/utils/removeEmptyDirs.ts","../src/core/utils/public.ts","../src/core/build/findEntrypoints.ts","../src/core/utils/importEntrypointFile.ts","../src/core/utils/strings.ts","../src/core/build/generateTypesDir.ts","../src/core/utils/i18n.ts","../src/core/utils/manifest.ts","../src/core/utils/ContentSecurityPolicy.ts","../src/core/utils/content-scripts.ts","../src/core/utils/package.ts","../src/core/build.ts","../src/core/utils/groupEntrypoints.ts","../src/core/utils/formatDuration.ts","../src/core/log/printBuildSummary.ts","../src/core/log/printFileList.ts","../src/core/log/printTable.ts","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/index.js","../node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js","../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js","../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js","../node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js","../node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/error.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/main.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/realtime.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/signals.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/core.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/stdio.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/kill.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/pipe.js","../node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/stream.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/promise.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/command.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/verbose.js","../src/core/server.ts","../src/core/runners/wsl.ts","../src/core/runners/web-ext.ts","../src/core/runners/safari.ts","../src/core/runners/manual.ts","../src/core/utils/wsl.ts","../src/core/runners/index.ts","../src/core/clean.ts","../package.json","../src/core/utils/defineConfig.ts","../src/core/utils/defineRunnerConfig.ts"],"sourcesContent":["module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction checkPathExt (path, options) {\n var pathext = options.pathExt !== undefined ?\n options.pathExt : process.env.PATHEXT\n\n if (!pathext) {\n return true\n }\n\n pathext = pathext.split(';')\n if (pathext.indexOf('') !== -1) {\n return true\n }\n for (var i = 0; i < pathext.length; i++) {\n var p = pathext[i].toLowerCase()\n if (p && path.substr(-p.length).toLowerCase() === p) {\n return true\n }\n }\n return false\n}\n\nfunction checkStat (stat, path, options) {\n if (!stat.isSymbolicLink() && !stat.isFile()) {\n return false\n }\n return checkPathExt(path, options)\n}\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, path, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), path, options)\n}\n","module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), options)\n}\n\nfunction checkStat (stat, options) {\n return stat.isFile() && checkMode(stat, options)\n}\n\nfunction checkMode (stat, options) {\n var mod = stat.mode\n var uid = stat.uid\n var gid = stat.gid\n\n var myUid = options.uid !== undefined ?\n options.uid : process.getuid && process.getuid()\n var myGid = options.gid !== undefined ?\n options.gid : process.getgid && process.getgid()\n\n var u = parseInt('100', 8)\n var g = parseInt('010', 8)\n var o = parseInt('001', 8)\n var ug = u | g\n\n var ret = (mod & o) ||\n (mod & g) && gid === myGid ||\n (mod & u) && uid === myUid ||\n (mod & ug) && myUid === 0\n\n return ret\n}\n","var fs = require('fs')\nvar core\nif (process.platform === 'win32' || global.TESTING_WINDOWS) {\n core = require('./windows.js')\n} else {\n core = require('./mode.js')\n}\n\nmodule.exports = isexe\nisexe.sync = sync\n\nfunction isexe (path, options, cb) {\n if (typeof options === 'function') {\n cb = options\n options = {}\n }\n\n if (!cb) {\n if (typeof Promise !== 'function') {\n throw new TypeError('callback not provided')\n }\n\n return new Promise(function (resolve, reject) {\n isexe(path, options || {}, function (er, is) {\n if (er) {\n reject(er)\n } else {\n resolve(is)\n }\n })\n })\n }\n\n core(path, options || {}, function (er, is) {\n // ignore EACCES because that just means we aren't allowed to run it\n if (er) {\n if (er.code === 'EACCES' || options && options.ignoreErrors) {\n er = null\n is = false\n }\n }\n cb(er, is)\n })\n}\n\nfunction sync (path, options) {\n // my kingdom for a filtered catch\n try {\n return core.sync(path, options || {})\n } catch (er) {\n if (options && options.ignoreErrors || er.code === 'EACCES') {\n return false\n } else {\n throw er\n }\n }\n}\n","const isWindows = process.platform === 'win32' ||\n process.env.OSTYPE === 'cygwin' ||\n process.env.OSTYPE === 'msys'\n\nconst path = require('path')\nconst COLON = isWindows ? ';' : ':'\nconst isexe = require('isexe')\n\nconst getNotFoundError = (cmd) =>\n Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })\n\nconst getPathInfo = (cmd, opt) => {\n const colon = opt.colon || COLON\n\n // If it has a slash, then we don't bother searching the pathenv.\n // just check the file itself, and that's it.\n const pathEnv = cmd.match(/\\//) || isWindows && cmd.match(/\\\\/) ? ['']\n : (\n [\n // windows always checks the cwd first\n ...(isWindows ? [process.cwd()] : []),\n ...(opt.path || process.env.PATH ||\n /* istanbul ignore next: very unusual */ '').split(colon),\n ]\n )\n const pathExtExe = isWindows\n ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'\n : ''\n const pathExt = isWindows ? pathExtExe.split(colon) : ['']\n\n if (isWindows) {\n if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')\n pathExt.unshift('')\n }\n\n return {\n pathEnv,\n pathExt,\n pathExtExe,\n }\n}\n\nconst which = (cmd, opt, cb) => {\n if (typeof opt === 'function') {\n cb = opt\n opt = {}\n }\n if (!opt)\n opt = {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n const step = i => new Promise((resolve, reject) => {\n if (i === pathEnv.length)\n return opt.all && found.length ? resolve(found)\n : reject(getNotFoundError(cmd))\n\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n resolve(subStep(p, i, 0))\n })\n\n const subStep = (p, i, ii) => new Promise((resolve, reject) => {\n if (ii === pathExt.length)\n return resolve(step(i + 1))\n const ext = pathExt[ii]\n isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {\n if (!er && is) {\n if (opt.all)\n found.push(p + ext)\n else\n return resolve(p + ext)\n }\n return resolve(subStep(p, i, ii + 1))\n })\n })\n\n return cb ? step(0).then(res => cb(null, res), cb) : step(0)\n}\n\nconst whichSync = (cmd, opt) => {\n opt = opt || {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (let i = 0; i < pathEnv.length; i ++) {\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n for (let j = 0; j < pathExt.length; j ++) {\n const cur = p + pathExt[j]\n try {\n const is = isexe.sync(cur, { pathExt: pathExtExe })\n if (is) {\n if (opt.all)\n found.push(cur)\n else\n return cur\n }\n } catch (ex) {}\n }\n }\n\n if (opt.all && found.length)\n return found\n\n if (opt.nothrow)\n return null\n\n throw getNotFoundError(cmd)\n}\n\nmodule.exports = which\nwhich.sync = whichSync\n","'use strict';\n\nconst pathKey = (options = {}) => {\n\tconst environment = options.env || process.env;\n\tconst platform = options.platform || process.platform;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n};\n\nmodule.exports = pathKey;\n// TODO: Remove this for the next major release\nmodule.exports.default = pathKey;\n","'use strict';\n\nconst path = require('path');\nconst which = require('which');\nconst getPathKey = require('path-key');\n\nfunction resolveCommandAttempt(parsed, withoutPathExt) {\n const env = parsed.options.env || process.env;\n const cwd = process.cwd();\n const hasCustomCwd = parsed.options.cwd != null;\n // Worker threads do not have process.chdir()\n const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;\n\n // If a custom `cwd` was specified, we need to change the process cwd\n // because `which` will do stat calls but does not support a custom cwd\n if (shouldSwitchCwd) {\n try {\n process.chdir(parsed.options.cwd);\n } catch (err) {\n /* Empty */\n }\n }\n\n let resolved;\n\n try {\n resolved = which.sync(parsed.command, {\n path: env[getPathKey({ env })],\n pathExt: withoutPathExt ? path.delimiter : undefined,\n });\n } catch (e) {\n /* Empty */\n } finally {\n if (shouldSwitchCwd) {\n process.chdir(cwd);\n }\n }\n\n // If we successfully resolved, ensure that an absolute path is returned\n // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it\n if (resolved) {\n resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);\n }\n\n return resolved;\n}\n\nfunction resolveCommand(parsed) {\n return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);\n}\n\nmodule.exports = resolveCommand;\n","'use strict';\n\n// See http://www.robvanderwoude.com/escapechars.php\nconst metaCharsRegExp = /([()\\][%!^\"`<>&|;, *?])/g;\n\nfunction escapeCommand(arg) {\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n return arg;\n}\n\nfunction escapeArgument(arg, doubleEscapeMetaChars) {\n // Convert to string\n arg = `${arg}`;\n\n // Algorithm below is based on https://qntm.org/cmd\n\n // Sequence of backslashes followed by a double quote:\n // double up all the backslashes and escape the double quote\n arg = arg.replace(/(\\\\*)\"/g, '$1$1\\\\\"');\n\n // Sequence of backslashes followed by the end of the string\n // (which will become a double quote later):\n // double up all the backslashes\n arg = arg.replace(/(\\\\*)$/, '$1$1');\n\n // All other backslashes occur literally\n\n // Quote the whole thing:\n arg = `\"${arg}\"`;\n\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n // Double escape meta chars if necessary\n if (doubleEscapeMetaChars) {\n arg = arg.replace(metaCharsRegExp, '^$1');\n }\n\n return arg;\n}\n\nmodule.exports.command = escapeCommand;\nmodule.exports.argument = escapeArgument;\n","'use strict';\nmodule.exports = /^#!(.*)/;\n","'use strict';\nconst shebangRegex = require('shebang-regex');\n\nmodule.exports = (string = '') => {\n\tconst match = string.match(shebangRegex);\n\n\tif (!match) {\n\t\treturn null;\n\t}\n\n\tconst [path, argument] = match[0].replace(/#! ?/, '').split(' ');\n\tconst binary = path.split('/').pop();\n\n\tif (binary === 'env') {\n\t\treturn argument;\n\t}\n\n\treturn argument ? `${binary} ${argument}` : binary;\n};\n","'use strict';\n\nconst fs = require('fs');\nconst shebangCommand = require('shebang-command');\n\nfunction readShebang(command) {\n // Read the first 150 bytes from the file\n const size = 150;\n const buffer = Buffer.alloc(size);\n\n let fd;\n\n try {\n fd = fs.openSync(command, 'r');\n fs.readSync(fd, buffer, 0, size, 0);\n fs.closeSync(fd);\n } catch (e) { /* Empty */ }\n\n // Attempt to extract shebang (null is returned if not a shebang)\n return shebangCommand(buffer.toString());\n}\n\nmodule.exports = readShebang;\n","'use strict';\n\nconst path = require('path');\nconst resolveCommand = require('./util/resolveCommand');\nconst escape = require('./util/escape');\nconst readShebang = require('./util/readShebang');\n\nconst isWin = process.platform === 'win32';\nconst isExecutableRegExp = /\\.(?:com|exe)$/i;\nconst isCmdShimRegExp = /node_modules[\\\\/].bin[\\\\/][^\\\\/]+\\.cmd$/i;\n\nfunction detectShebang(parsed) {\n parsed.file = resolveCommand(parsed);\n\n const shebang = parsed.file && readShebang(parsed.file);\n\n if (shebang) {\n parsed.args.unshift(parsed.file);\n parsed.command = shebang;\n\n return resolveCommand(parsed);\n }\n\n return parsed.file;\n}\n\nfunction parseNonShell(parsed) {\n if (!isWin) {\n return parsed;\n }\n\n // Detect & add support for shebangs\n const commandFile = detectShebang(parsed);\n\n // We don't need a shell if the command filename is an executable\n const needsShell = !isExecutableRegExp.test(commandFile);\n\n // If a shell is required, use cmd.exe and take care of escaping everything correctly\n // Note that `forceShell` is an hidden option used only in tests\n if (parsed.options.forceShell || needsShell) {\n // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`\n // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument\n // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,\n // we need to double escape them\n const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);\n\n // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\\bar)\n // This is necessary otherwise it will always fail with ENOENT in those cases\n parsed.command = path.normalize(parsed.command);\n\n // Escape command & arguments\n parsed.command = escape.command(parsed.command);\n parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));\n\n const shellCommand = [parsed.command].concat(parsed.args).join(' ');\n\n parsed.args = ['/d', '/s', '/c', `\"${shellCommand}\"`];\n parsed.command = process.env.comspec || 'cmd.exe';\n parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped\n }\n\n return parsed;\n}\n\nfunction parse(command, args, options) {\n // Normalize arguments, similar to nodejs\n if (args && !Array.isArray(args)) {\n options = args;\n args = null;\n }\n\n args = args ? args.slice(0) : []; // Clone array to avoid changing the original\n options = Object.assign({}, options); // Clone object to avoid changing the original\n\n // Build our parsed object\n const parsed = {\n command,\n args,\n options,\n file: undefined,\n original: {\n command,\n args,\n },\n };\n\n // Delegate further parsing to shell or non-shell\n return options.shell ? parsed : parseNonShell(parsed);\n}\n\nmodule.exports = parse;\n","'use strict';\n\nconst isWin = process.platform === 'win32';\n\nfunction notFoundError(original, syscall) {\n return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {\n code: 'ENOENT',\n errno: 'ENOENT',\n syscall: `${syscall} ${original.command}`,\n path: original.command,\n spawnargs: original.args,\n });\n}\n\nfunction hookChildProcess(cp, parsed) {\n if (!isWin) {\n return;\n }\n\n const originalEmit = cp.emit;\n\n cp.emit = function (name, arg1) {\n // If emitting \"exit\" event and exit code is 1, we need to check if\n // the command exists and emit an \"error\" instead\n // See https://github.com/IndigoUnited/node-cross-spawn/issues/16\n if (name === 'exit') {\n const err = verifyENOENT(arg1, parsed, 'spawn');\n\n if (err) {\n return originalEmit.call(cp, 'error', err);\n }\n }\n\n return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params\n };\n}\n\nfunction verifyENOENT(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawn');\n }\n\n return null;\n}\n\nfunction verifyENOENTSync(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawnSync');\n }\n\n return null;\n}\n\nmodule.exports = {\n hookChildProcess,\n verifyENOENT,\n verifyENOENTSync,\n notFoundError,\n};\n","'use strict';\n\nconst cp = require('child_process');\nconst parse = require('./lib/parse');\nconst enoent = require('./lib/enoent');\n\nfunction spawn(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n\n // Hook into child process \"exit\" event to emit an error if the command\n // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n enoent.hookChildProcess(spawned, parsed);\n\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n\n // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\n\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n","// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\nmodule.exports = [\n 'SIGABRT',\n 'SIGALRM',\n 'SIGHUP',\n 'SIGINT',\n 'SIGTERM'\n]\n\nif (process.platform !== 'win32') {\n module.exports.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n module.exports.push(\n 'SIGIO',\n 'SIGPOLL',\n 'SIGPWR',\n 'SIGSTKFLT',\n 'SIGUNUSED'\n )\n}\n","// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nvar process = global.process\n\nconst processOk = function (process) {\n return process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n}\n\n// some kind of non-node environment, just no-op\n/* istanbul ignore if */\nif (!processOk(process)) {\n module.exports = function () {\n return function () {}\n }\n} else {\n var assert = require('assert')\n var signals = require('./signals.js')\n var isWin = /^win/i.test(process.platform)\n\n var EE = require('events')\n /* istanbul ignore if */\n if (typeof EE !== 'function') {\n EE = EE.EventEmitter\n }\n\n var emitter\n if (process.__signal_exit_emitter__) {\n emitter = process.__signal_exit_emitter__\n } else {\n emitter = process.__signal_exit_emitter__ = new EE()\n emitter.count = 0\n emitter.emitted = {}\n }\n\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (!emitter.infinite) {\n emitter.setMaxListeners(Infinity)\n emitter.infinite = true\n }\n\n module.exports = function (cb, opts) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return function () {}\n }\n assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')\n\n if (loaded === false) {\n load()\n }\n\n var ev = 'exit'\n if (opts && opts.alwaysLast) {\n ev = 'afterexit'\n }\n\n var remove = function () {\n emitter.removeListener(ev, cb)\n if (emitter.listeners('exit').length === 0 &&\n emitter.listeners('afterexit').length === 0) {\n unload()\n }\n }\n emitter.on(ev, cb)\n\n return remove\n }\n\n var unload = function unload () {\n if (!loaded || !processOk(global.process)) {\n return\n }\n loaded = false\n\n signals.forEach(function (sig) {\n try {\n process.removeListener(sig, sigListeners[sig])\n } catch (er) {}\n })\n process.emit = originalProcessEmit\n process.reallyExit = originalProcessReallyExit\n emitter.count -= 1\n }\n module.exports.unload = unload\n\n var emit = function emit (event, code, signal) {\n /* istanbul ignore if */\n if (emitter.emitted[event]) {\n return\n }\n emitter.emitted[event] = true\n emitter.emit(event, code, signal)\n }\n\n // { <signal>: <listener fn>, ... }\n var sigListeners = {}\n signals.forEach(function (sig) {\n sigListeners[sig] = function listener () {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n var listeners = process.listeners(sig)\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n /* istanbul ignore next */\n emit('afterexit', null, sig)\n /* istanbul ignore next */\n if (isWin && sig === 'SIGHUP') {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n sig = 'SIGINT'\n }\n /* istanbul ignore next */\n process.kill(process.pid, sig)\n }\n }\n })\n\n module.exports.signals = function () {\n return signals\n }\n\n var loaded = false\n\n var load = function load () {\n if (loaded || !processOk(global.process)) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n emitter.count += 1\n\n signals = signals.filter(function (sig) {\n try {\n process.on(sig, sigListeners[sig])\n return true\n } catch (er) {\n return false\n }\n })\n\n process.emit = processEmit\n process.reallyExit = processReallyExit\n }\n module.exports.load = load\n\n var originalProcessReallyExit = process.reallyExit\n var processReallyExit = function processReallyExit (code) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n process.exitCode = code || /* istanbul ignore next */ 0\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n originalProcessReallyExit.call(process, process.exitCode)\n }\n\n var originalProcessEmit = process.emit\n var processEmit = function processEmit (ev, arg) {\n if (ev === 'exit' && processOk(global.process)) {\n /* istanbul ignore else */\n if (arg !== undefined) {\n process.exitCode = arg\n }\n var ret = originalProcessEmit.apply(this, arguments)\n /* istanbul ignore next */\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n return ret\n } else {\n return originalProcessEmit.apply(this, arguments)\n }\n }\n}\n","'use strict';\nconst {PassThrough: PassThroughStream} = require('stream');\n\nmodule.exports = options => {\n\toptions = {...options};\n\n\tconst {array} = options;\n\tlet {encoding} = options;\n\tconst isBuffer = encoding === 'buffer';\n\tlet objectMode = false;\n\n\tif (array) {\n\t\tobjectMode = !(encoding || isBuffer);\n\t} else {\n\t\tencoding = encoding || 'utf8';\n\t}\n\n\tif (isBuffer) {\n\t\tencoding = null;\n\t}\n\n\tconst stream = new PassThroughStream({objectMode});\n\n\tif (encoding) {\n\t\tstream.setEncoding(encoding);\n\t}\n\n\tlet length = 0;\n\tconst chunks = [];\n\n\tstream.on('data', chunk => {\n\t\tchunks.push(chunk);\n\n\t\tif (objectMode) {\n\t\t\tlength = chunks.length;\n\t\t} else {\n\t\t\tlength += chunk.length;\n\t\t}\n\t});\n\n\tstream.getBufferedValue = () => {\n\t\tif (array) {\n\t\t\treturn chunks;\n\t\t}\n\n\t\treturn isBuffer ? Buffer.concat(chunks, length) : chunks.join('');\n\t};\n\n\tstream.getBufferedLength = () => length;\n\n\treturn stream;\n};\n","'use strict';\nconst {constants: BufferConstants} = require('buffer');\nconst stream = require('stream');\nconst {promisify} = require('util');\nconst bufferStream = require('./buffer-stream');\n\nconst streamPipelinePromisified = promisify(stream.pipeline);\n\nclass MaxBufferError extends Error {\n\tconstructor() {\n\t\tsuper('maxBuffer exceeded');\n\t\tthis.name = 'MaxBufferError';\n\t}\n}\n\nasync function getStream(inputStream, options) {\n\tif (!inputStream) {\n\t\tthrow new Error('Expected a stream');\n\t}\n\n\toptions = {\n\t\tmaxBuffer: Infinity,\n\t\t...options\n\t};\n\n\tconst {maxBuffer} = options;\n\tconst stream = bufferStream(options);\n\n\tawait new Promise((resolve, reject) => {\n\t\tconst rejectPromise = error => {\n\t\t\t// Don't retrieve an oversized buffer.\n\t\t\tif (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {\n\t\t\t\terror.bufferedData = stream.getBufferedValue();\n\t\t\t}\n\n\t\t\treject(error);\n\t\t};\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tawait streamPipelinePromisified(inputStream, stream);\n\t\t\t\tresolve();\n\t\t\t} catch (error) {\n\t\t\t\trejectPromise(error);\n\t\t\t}\n\t\t})();\n\n\t\tstream.on('data', () => {\n\t\t\tif (stream.getBufferedLength() > maxBuffer) {\n\t\t\t\trejectPromise(new MaxBufferError());\n\t\t\t}\n\t\t});\n\t});\n\n\treturn stream.getBufferedValue();\n}\n\nmodule.exports = getStream;\nmodule.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});\nmodule.exports.array = (stream, options) => getStream(stream, {...options, array: true});\nmodule.exports.MaxBufferError = MaxBufferError;\n","'use strict';\n\nconst { PassThrough } = require('stream');\n\nmodule.exports = function (/*streams...*/) {\n var sources = []\n var output = new PassThrough({objectMode: true})\n\n output.setMaxListeners(0)\n\n output.add = add\n output.isEmpty = isEmpty\n\n output.on('unpipe', remove)\n\n Array.prototype.slice.call(arguments).forEach(add)\n\n return output\n\n function add (source) {\n if (Array.isArray(source)) {\n source.forEach(add)\n return this\n }\n\n sources.push(source);\n source.once('end', remove.bind(null, source))\n source.once('error', output.emit.bind(output, 'error'))\n source.pipe(output, {end: false})\n return this\n }\n\n function isEmpty () {\n return sources.length == 0;\n }\n\n function remove (source) {\n sources = sources.filter(function (it) { return it !== source })\n if (!sources.length && output.readable) { output.end() }\n }\n}\n","import { loadConfig } from 'c12';\nimport {\n InlineConfig,\n InternalConfig,\n UserConfig,\n ConfigEnv,\n UserManifestFn,\n UserManifest,\n WxtViteConfig,\n ExtensionRunnerConfig,\n} from '../types';\nimport path from 'node:path';\nimport * as vite from 'vite';\nimport { createFsCache } from './createFsCache';\nimport consola, { LogLevels } from 'consola';\nimport * as plugins from '../vite-plugins';\nimport { getGlobals } from './globals';\n\n/**\n * Given an inline config, discover the config file if necessary, merge the results, resolve any\n * relative paths, and apply any defaults.\n *\n * Inline config always has priority over user config. Cli flags are passed as inline config if set.\n * If unset, undefined is passed in, letting this function decide default values.\n */\nexport async function getInternalConfig(\n inlineConfig: InlineConfig,\n command: 'build' | 'serve',\n): Promise<InternalConfig> {\n // Load user config\n\n let userConfig: UserConfig = {};\n let userConfigMetadata: InternalConfig['userConfigMetadata'] | undefined;\n if (inlineConfig.configFile !== false) {\n const { config: loadedConfig, ...metadata } = await loadConfig<UserConfig>({\n name: 'wxt',\n cwd: inlineConfig.root ?? process.cwd(),\n rcFile: false,\n });\n userConfig = loadedConfig ?? {};\n userConfigMetadata = metadata;\n }\n\n // Merge it into the inline config\n\n const mergedConfig = mergeInlineConfig(inlineConfig, userConfig);\n\n // Apply defaults to make internal config.\n\n const debug = mergedConfig.debug ?? false;\n const logger = mergedConfig.logger ?? consola;\n if (debug) logger.level = LogLevels.debug;\n\n const browser = mergedConfig.browser ?? 'chrome';\n const manifestVersion =\n mergedConfig.manifestVersion ??\n (browser === 'firefox' || browser === 'safari' ? 2 : 3);\n const mode =\n mergedConfig.mode ?? (command === 'build' ? 'production' : 'development');\n const env: ConfigEnv = { browser, command, manifestVersion, mode };\n\n const root = path.resolve(\n inlineConfig.root ?? userConfig.root ?? process.cwd(),\n );\n const wxtDir = path.resolve(root, '.wxt');\n const srcDir = path.resolve(root, mergedConfig.srcDir ?? root);\n const entrypointsDir = path.resolve(\n srcDir,\n mergedConfig.entrypointsDir ?? 'entrypoints',\n );\n const publicDir = path.resolve(srcDir, mergedConfig.publicDir ?? 'public');\n const typesDir = path.resolve(wxtDir, 'types');\n const outBaseDir = path.resolve(root, '.output');\n const outDir = path.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);\n\n const runnerConfig = await loadConfig<ExtensionRunnerConfig>({\n name: 'web-ext',\n cwd: root,\n globalRc: true,\n rcFile: '.webextrc',\n overrides: inlineConfig.runner,\n defaults: userConfig.runner,\n });\n\n const finalConfig: InternalConfig = {\n browser,\n command,\n debug,\n entrypointsDir,\n env,\n fsCache: createFsCache(wxtDir),\n imports: mergedConfig.imports ?? {},\n logger,\n manifest: await resolveManifestConfig(env, mergedConfig.manifest),\n manifestVersion,\n mode,\n outBaseDir,\n outDir,\n publicDir,\n root,\n runnerConfig,\n srcDir,\n typesDir,\n vite: () => ({}), // Real value added after this object is initialized.\n wxtDir,\n zip: resolveInternalZipConfig(root, mergedConfig),\n transformManifest(manifest) {\n userConfig.transformManifest?.(manifest);\n inlineConfig.transformManifest?.(manifest);\n },\n analysis: {\n enabled: mergedConfig.analysis?.enabled ?? false,\n template: mergedConfig.analysis?.template ?? 'treemap',\n },\n userConfigMetadata: userConfigMetadata ?? {},\n };\n\n finalConfig.vite = (env) =>\n resolveInternalViteConfig(env, mergedConfig, finalConfig);\n\n return finalConfig;\n}\n\nasync function resolveManifestConfig(\n env: ConfigEnv,\n manifest: UserManifest | Promise<UserManifest> | UserManifestFn | undefined,\n): Promise<UserManifest> {\n return await (typeof manifest === 'function'\n ? manifest(env)\n : manifest ?? {});\n}\n\n/**\n * Merge the inline config and user config. Inline config is given priority. Defaults are not applied here.\n */\nfunction mergeInlineConfig(\n inlineConfig: InlineConfig,\n userConfig: UserConfig,\n): InlineConfig {\n let imports: InlineConfig['imports'];\n if (inlineConfig.imports === false || userConfig.imports === false) {\n imports = false;\n } else if (userConfig.imports == null && inlineConfig.imports == null) {\n imports = undefined;\n } else {\n imports = vite.mergeConfig(\n userConfig.imports ?? {},\n inlineConfig.imports ?? {},\n );\n }\n const manifest: UserManifestFn = async (env) => {\n const user = await resolveManifestConfig(env, userConfig.manifest);\n const inline = await resolveManifestConfig(env, inlineConfig.manifest);\n return vite.mergeConfig(user, inline);\n };\n const viteConfig = async (env: ConfigEnv): Promise<WxtViteConfig> => {\n const user = await userConfig.vite?.(env);\n const inline = await inlineConfig.vite?.(env);\n return vite.mergeConfig(user ?? {}, inline ?? {});\n };\n const runner: InlineConfig['runner'] = vite.mergeConfig(\n userConfig.runner ?? {},\n inlineConfig.runner ?? {},\n );\n const zip: InlineConfig['zip'] = vite.mergeConfig(\n userConfig.zip ?? {},\n inlineConfig.zip ?? {},\n );\n\n return {\n root: inlineConfig.root ?? userConfig.root,\n browser: inlineConfig.browser ?? userConfig.browser,\n manifestVersion: inlineConfig.manifestVersion ?? userConfig.manifestVersion,\n configFile: inlineConfig.configFile,\n debug: inlineConfig.debug ?? userConfig.debug,\n entrypointsDir: inlineConfig.entrypointsDir ?? userConfig.entrypointsDir,\n imports,\n logger: inlineConfig.logger ?? userConfig.logger,\n manifest,\n mode: inlineConfig.mode ?? userConfig.mode,\n publicDir: inlineConfig.publicDir ?? userConfig.publicDir,\n runner,\n srcDir: inlineConfig.srcDir ?? userConfig.srcDir,\n vite: viteConfig,\n zip,\n analysis: {\n enabled: inlineConfig.analysis?.enabled ?? userConfig.analysis?.enabled,\n template:\n inlineConfig.analysis?.template ?? userConfig.analysis?.template,\n },\n };\n}\n\nfunction resolveInternalZipConfig(\n root: string,\n mergedConfig: InlineConfig,\n): InternalConfig['zip'] {\n return {\n sourcesTemplate: '{{name}}-{{version}}-sources.zip',\n artifactTemplate: '{{name}}-{{version}}-{{browser}}.zip',\n sourcesRoot: root,\n ...mergedConfig.zip,\n ignoredSources: [\n '**/node_modules',\n // WXT files\n '**/web-ext.config.ts',\n // Hidden files\n '**/.*',\n // Tests\n '**/__tests__/**',\n '**/*.+(test|spec).?(c|m)+(j|t)s?(x)',\n // From user\n ...(mergedConfig.zip?.ignoredSources ?? []),\n ],\n };\n}\n\nasync function resolveInternalViteConfig(\n env: ConfigEnv,\n mergedConfig: InlineConfig,\n finalConfig: InternalConfig,\n) {\n const internalVite: vite.InlineConfig =\n (await mergedConfig.vite?.(env)) ?? {};\n\n internalVite.root = finalConfig.root;\n internalVite.configFile = false;\n internalVite.logLevel = 'warn';\n internalVite.mode = env.mode;\n\n internalVite.build ??= {};\n internalVite.build.outDir = finalConfig.outDir;\n internalVite.build.emptyOutDir = false;\n\n internalVite.plugins ??= [];\n internalVite.plugins.push(plugins.download(finalConfig));\n internalVite.plugins.push(plugins.devHtmlPrerender(finalConfig));\n internalVite.plugins.push(plugins.unimport(finalConfig));\n internalVite.plugins.push(\n plugins.virtualEntrypoin('background', finalConfig),\n );\n internalVite.plugins.push(\n plugins.virtualEntrypoin('content-script', finalConfig),\n );\n internalVite.plugins.push(plugins.devServerGlobals(finalConfig));\n internalVite.plugins.push(plugins.tsconfigPaths(finalConfig));\n internalVite.plugins.push(plugins.noopBackground());\n if (finalConfig.analysis.enabled) {\n internalVite.plugins.push(plugins.bundleAnalysis());\n }\n\n internalVite.define ??= {};\n for (const global of getGlobals(finalConfig)) {\n internalVite.define[global.name] = JSON.stringify(global.value);\n }\n return internalVite;\n}\n","import fs, { ensureDir } from 'fs-extra';\nimport { FsCache } from '../types';\nimport { dirname, resolve } from 'path';\nimport { writeFileIfDifferent } from './fs';\n\n/**\n * A basic file system cache stored at `<srcDir>/.wxt/cache/<key>`. Just caches a string in a\n * file for the given key.\n *\n * @param srcDir Absolute path to source directory. See `InternalConfig.srcDir`\n */\nexport function createFsCache(wxtDir: string): FsCache {\n const getPath = (key: string) =>\n resolve(wxtDir, 'cache', encodeURIComponent(key));\n\n return {\n async set(key: string, value: string): Promise<void> {\n const path = getPath(key);\n await ensureDir(dirname(path));\n await writeFileIfDifferent(path, value);\n },\n async get(key: string): Promise<string | undefined> {\n const path = getPath(key);\n try {\n return await fs.readFile(path, 'utf-8');\n } catch {\n return undefined;\n }\n },\n };\n}\n","import fs from 'fs-extra';\n\n/**\n * Only write the contents to a file if it results in a change. This prevents unnecessary file\n * watchers from being triggered, like WXT's dev server or the TS language server in editors.\n *\n * @param file The file to write to.\n * @param newContents The new text content to write.\n */\nexport async function writeFileIfDifferent(\n file: string,\n newContents: string,\n): Promise<void> {\n const existingContents = await fs\n .readFile(file, 'utf-8')\n .catch(() => undefined);\n\n if (existingContents !== newContents) {\n await fs.writeFile(file, newContents);\n }\n}\n","import { Entrypoint, PerBrowserOption, TargetBrowser } from '../types';\nimport path, { relative, resolve } from 'node:path';\nimport { normalizePath } from './paths';\n\nexport function getEntrypointName(\n entrypointsDir: string,\n inputPath: string,\n // type: Entrypoint['type'],\n): string {\n const relativePath = path.relative(entrypointsDir, inputPath);\n // Grab the string up to the first . or / or \\\\\n const name = relativePath.split(/[\\.\\/\\\\]/, 2)[0];\n\n return name;\n}\n\nexport function getEntrypointOutputFile(\n entrypoint: Entrypoint,\n ext: string,\n): string {\n return resolve(entrypoint.outputDir, `${entrypoint.name}${ext}`);\n}\n\n/**\n * Return's the entrypoint's output path relative to the output directory. Used for paths in the\n * manifest and rollup's bundle.\n */\nexport function getEntrypointBundlePath(\n entrypoint: Entrypoint,\n outDir: string,\n ext: string,\n): string {\n return normalizePath(\n relative(outDir, getEntrypointOutputFile(entrypoint, ext)),\n );\n}\n\n/**\n * Given an entrypoint option, resolve it's value based on a target browser.\n */\nexport function resolvePerBrowserOption<T>(\n option: PerBrowserOption<T>,\n browser: TargetBrowser,\n): T {\n if (typeof option === 'object' && !Array.isArray(option))\n return (option as any)[browser];\n return option;\n}\n","import nodePath from 'node:path';\nimport * as vite from 'vite';\n\n/**\n * Converts system paths to normalized bundler path. On windows and unix, this returns paths with /\n * instead of \\.\n */\nexport function normalizePath(path: string): string {\n return vite.normalizePath(path);\n}\n\n/**\n * Given a normalized path, convert it to the system path style. On Windows, switch to \\, otherwise use /.\n */\nexport function unnormalizePath(path: string): string {\n return nodePath.normalize(path);\n}\n\nexport const CSS_EXTENSIONS = ['css', 'scss', 'sass', 'less', 'styl', 'stylus'];\n\n// .module.css files are not supported because these are global CSS files, so using CSS modules doesn't make sense.\nexport const CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join('|')})`;\n","import * as vite from 'vite';\nimport { InternalConfig } from '../types';\nimport { getEntrypointName } from '../utils/entrypoints';\nimport { parseHTML } from 'linkedom';\nimport { dirname, isAbsolute, relative, resolve } from 'path';\n\n/**\n * Pre-renders the HTML entrypoints when building the extension to connect to the dev server.\n */\nexport function devHtmlPrerender(config: InternalConfig): vite.Plugin {\n return {\n apply: 'build',\n name: 'wxt:dev-html-prerender',\n config() {\n return {\n resolve: {\n alias: {\n '@wxt/reload-html': resolve(\n config.root,\n 'node_modules/wxt/dist/virtual-modules/reload-html.js',\n ),\n },\n },\n };\n },\n async transform(html, id) {\n const server = config.server;\n if (config.command !== 'serve' || server == null || !id.endsWith('.html'))\n return;\n\n const originalUrl = `${server.origin}${id}`;\n const name = getEntrypointName(config.entrypointsDir, id);\n const url = `${server.origin}/${name}.html`;\n const serverHtml = await server.transformIndexHtml(\n url,\n html,\n originalUrl,\n );\n const { document } = parseHTML(serverHtml);\n\n const pointToDevServer = (querySelector: string, attr: string): void => {\n document.querySelectorAll(querySelector).forEach((element) => {\n const src = element.getAttribute(attr);\n if (!src) return;\n\n if (isAbsolute(src)) {\n element.setAttribute(attr, server.origin + src);\n } else if (src.startsWith('.')) {\n const abs = resolve(dirname(id), src);\n const pathname = relative(config.root, abs);\n element.setAttribute(attr, `${server.origin}/${pathname}`);\n }\n });\n };\n pointToDevServer('script[type=module]', 'src');\n pointToDevServer('link[rel=stylesheet]', 'href');\n\n // Add a script to add page reloading\n const reloader = document.createElement('script');\n reloader.src = '@wxt/reload-html';\n reloader.type = 'module';\n document.head.appendChild(reloader);\n\n const newHtml = document.toString();\n config.logger.debug('Transformed ' + id);\n config.logger.debug('Old HTML:\\n' + html);\n config.logger.debug('New HTML:\\n' + newHtml);\n return newHtml;\n },\n };\n}\n","import { Plugin } from 'vite';\nimport { InternalConfig } from '../types';\n\n/**\n * Defines global constants about the dev server. Helps scripts connect to the server's web socket.\n */\nexport function devServerGlobals(internalConfig: InternalConfig): Plugin {\n return {\n name: 'wxt:dev-server-globals',\n config() {\n if (internalConfig.server == null || internalConfig.command == 'build')\n return;\n\n return {\n define: {\n __DEV_SERVER_PROTOCOL__: JSON.stringify('ws:'),\n __DEV_SERVER_HOSTNAME__: JSON.stringify(\n internalConfig.server.hostname,\n ),\n __DEV_SERVER_PORT__: JSON.stringify(internalConfig.server.port),\n },\n };\n },\n };\n}\n","import dns from 'node:dns';\nimport { withTimeout } from './promises';\nimport { InternalConfig } from '../types';\n\nfunction isOffline(): Promise<boolean> {\n const isOffline = new Promise<boolean>((res) => {\n dns.resolve('google.com', (err) => {\n if (err == null) {\n res(false);\n } else {\n res(true);\n }\n });\n });\n return withTimeout(isOffline, 1e3).catch(() => true);\n}\n\nexport async function isOnline(): Promise<boolean> {\n const offline = await isOffline();\n return !offline;\n}\n\n/**\n * Fetches a URL with a simple GET request. Grabs it from cache if it doesn't exist, or throws an\n * error if it can't be resolved via the network or cache.\n */\nexport async function fetchCached(\n url: string,\n config: InternalConfig,\n): Promise<string> {\n let content: string = '';\n\n if (await isOnline()) {\n const res = await fetch(url);\n if (res.status < 300) {\n content = await res.text();\n await config.fsCache.set(url, content);\n } else {\n config.logger.debug(\n `Failed to download \"${url}\", falling back to cache...`,\n );\n }\n }\n\n if (!content) content = (await config.fsCache.get(url)) ?? '';\n if (!content)\n throw Error(\n `Offline and \"${url}\" has not been cached. Try again when online.`,\n );\n\n return content;\n}\n","/**\n * Add a timeout to a promise.\n */\nexport function withTimeout<T>(\n promise: Promise<T>,\n duration: number,\n): Promise<T> {\n return new Promise((res, rej) => {\n const timeout = setTimeout(() => {\n rej(`Promise timed out after ${duration}ms`);\n }, duration);\n promise\n .then(res)\n .catch(rej)\n .finally(() => clearTimeout(timeout));\n });\n}\n\n/**\n * @deprecated Don't use in production, just for testing and slowing things down.\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((res) => setTimeout(res, ms));\n}\n","import { Plugin } from 'vite';\nimport { InternalConfig } from '../types';\nimport { fetchCached } from '../utils/network';\n\n/**\n * Downloads any URL imports, like Google Analytics, into virtual modules so they are bundled with\n * the extension instead of depending on remote code at runtime.\n *\n * @example\n * import \"url:https://google-tagmanager.com/gtag?id=XYZ\";\n */\nexport function download(config: InternalConfig): Plugin {\n return {\n name: 'wxt:download',\n resolveId(id) {\n if (id.startsWith('url:')) return '\\0' + id;\n },\n async load(id) {\n if (!id.startsWith('\\0url:')) return;\n\n // Load file from network or cache\n const url = id.replace('\\0url:', '');\n return await fetchCached(url, config);\n },\n };\n}\n","import * as vite from 'vite';\nimport { Entrypoint, InternalConfig } from '../types';\nimport { dirname, extname, resolve } from 'node:path';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\nimport fs, { ensureDir } from 'fs-extra';\nimport { normalizePath } from '../utils/paths';\n\n/**\n * Ensures the HTML files output by a multipage build are in the correct location. This does two\n * things:\n *\n * 1. Moves the HMTL files to their final location at `<outDir>/<entrypoint.name>.html`.\n * 2. Updates the bundle so it summarizes the files correctly in the returned build output.\n *\n * Assets (JS and CSS) are output to the `<outDir>/assets` directory, and don't need to be modified.\n * HTML files access them via absolute URLs, so we don't need to update any import paths in the HTML\n * files either.\n *\n * THIS PLUGIN SHOULD ONLY BE APPLIED TO MULTIPAGE BUILDS. It should not be added to every build.\n */\nexport function multipageMove(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): vite.Plugin {\n return {\n name: 'wxt:multipage-move',\n async writeBundle(_, bundle) {\n for (const oldBundlePath in bundle) {\n // oldBundlePath = 'entrypoints/popup.html' or 'entrypoints/options/index.html'\n\n // Find a matching entrypoint - oldBundlePath is the same as end end of the input path.\n const entrypoint = entrypoints.find(\n (entry) => !!normalizePath(entry.inputPath).endsWith(oldBundlePath),\n );\n if (entrypoint == null) {\n config.logger.debug(\n `No entrypoint found for ${oldBundlePath}, leaving in chunks directory`,\n );\n continue;\n }\n\n // Get the new bundle path\n const newBundlePath = getEntrypointBundlePath(\n entrypoint,\n config.outDir,\n extname(oldBundlePath),\n );\n if (newBundlePath === oldBundlePath) {\n config.logger.debug(\n 'HTML file is already in the correct location',\n oldBundlePath,\n );\n continue;\n }\n\n // Move file and update bundle\n // Do this inside a mutex lock so it only runs one at a time for concurrent multipage builds\n const oldAbsPath = resolve(config.outDir, oldBundlePath);\n const newAbsPath = resolve(config.outDir, newBundlePath);\n await ensureDir(dirname(newAbsPath));\n await fs.move(oldAbsPath, newAbsPath, { overwrite: true });\n\n const renamedChunk = {\n ...bundle[oldBundlePath],\n fileName: newBundlePath,\n };\n delete bundle[oldBundlePath];\n bundle[newBundlePath] = renamedChunk;\n }\n },\n };\n}\n","import { createUnimport } from 'unimport';\nimport { InternalConfig } from '../types';\nimport { getUnimportOptions } from '../utils/auto-imports';\nimport * as vite from 'vite';\nimport { extname } from 'path';\n\nconst ENABLED_EXTENSIONS: Record<string, boolean | undefined> = {\n '.js': true,\n '.jsx': true,\n '.ts': true,\n '.tsx': true,\n '.vue': true,\n '.svelte': true,\n};\n\n/**\n * Inject any global imports defined by unimport\n */\nexport function unimport(config: InternalConfig): vite.PluginOption {\n const options = getUnimportOptions(config);\n if (options === false) return [];\n\n const unimport = createUnimport(options);\n\n return {\n name: 'wxt:unimport',\n async config() {\n await unimport.scanImportsFromDir(undefined, { cwd: config.srcDir });\n },\n async transform(code, id) {\n const ext = extname(id);\n if (ENABLED_EXTENSIONS[ext]) return unimport.injectImports(code, id);\n },\n };\n}\n","import { UnimportOptions } from 'unimport';\nimport { InternalConfig } from '../types';\nimport { mergeConfig } from 'vite';\n\nexport function getUnimportOptions(\n config: InternalConfig,\n): Partial<UnimportOptions | false> {\n if (config.imports === false) return false;\n\n const defaultOptions: Partial<UnimportOptions> = {\n debugLog: config.logger.debug,\n imports: [{ name: 'defineConfig', from: 'wxt' }],\n presets: [{ package: 'wxt/client' }, { package: 'wxt/browser' }],\n warn: config.logger.warn,\n dirs: ['components', 'composables', 'hooks', 'utils'],\n };\n\n return mergeConfig(\n defaultOptions,\n config.imports,\n ) as Partial<UnimportOptions>;\n}\n","import { Plugin } from 'vite';\nimport { Entrypoint, InternalConfig } from '../types';\nimport fs from 'fs-extra';\nimport { resolve } from 'path';\nimport { normalizePath } from '../utils/paths';\n\n/**\n * Wraps a user's entrypoint with a vitual version with additional logic.\n */\nexport function virtualEntrypoin(\n type: Entrypoint['type'],\n config: InternalConfig,\n): Plugin {\n const virtualId = `virtual:wxt-${type}?`;\n const resolvedVirtualId = `\\0${virtualId}`;\n\n return {\n name: `wxt:virtual-entrypoint`,\n resolveId(id) {\n // Id doesn't start with prefix, it looks like this:\n // /path/to/project/virtual:background?/path/to/project/entrypoints/background.ts\n const index = id.indexOf(virtualId);\n if (index === -1) return;\n\n const inputPath = normalizePath(id.substring(index + virtualId.length));\n return resolvedVirtualId + inputPath;\n },\n async load(id) {\n if (!id.startsWith(resolvedVirtualId)) return;\n\n const inputPath = id.replace(resolvedVirtualId, '');\n const template = await fs.readFile(\n resolve(\n config.root,\n `node_modules/wxt/dist/virtual-modules/${type}-entrypoint.js`,\n ),\n 'utf-8',\n );\n return template.replace(`virtual:user-${type}`, inputPath);\n },\n };\n}\n","import { InternalConfig } from '../types';\nimport * as vite from 'vite';\n\nexport function tsconfigPaths(config: InternalConfig): vite.Plugin {\n return {\n name: 'wxt:aliases',\n async config() {\n return {\n resolve: {\n alias: {\n '@@': config.root,\n '~~': config.root,\n '@': config.srcDir,\n '~': config.srcDir,\n },\n },\n };\n },\n };\n}\n","import { Plugin } from 'vite';\n\n/**\n * In dev mode, if there's not a background script listed, we need to add one.\n *\n * This define's a virtual module that is basically just a noop.\n */\nexport function noopBackground(): Plugin {\n const virtualModuleId = VIRTUAL_NOOP_BACKGROUND_MODULE_ID;\n const resolvedVirtualModuleId = '\\0' + virtualModuleId;\n return {\n name: 'wxt:noop-background',\n resolveId(id) {\n if (id === virtualModuleId) return resolvedVirtualModuleId;\n },\n load(id) {\n if (id === resolvedVirtualModuleId) {\n return `import { defineBackground } from 'wxt/client';\\nexport default defineBackground(() => void 0)`;\n }\n },\n };\n}\n\nexport const VIRTUAL_NOOP_BACKGROUND_MODULE_ID = 'virtual:user-background';\n","import * as vite from 'vite';\nimport { Entrypoint, InternalConfig } from '../types';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\n\n/**\n * Rename CSS entrypoint outputs to ensure a JS file is not generated, and that the CSS file is\n * placed in the correct place.\n *\n * It:\n * 1. Renames CSS files to their final paths\n * 2. Removes the JS file that get's output by lib mode\n *\n * THIS PLUGIN SHOULD ONLY BE APPLIED TO CSS LIB MODE BUILDS. It should not be added to every build.\n */\nexport function cssEntrypoints(\n entrypoint: Entrypoint,\n config: InternalConfig,\n): vite.Plugin {\n return {\n name: 'wxt:css-entrypoint',\n config() {\n return {\n build: {\n rollupOptions: {\n output: {\n assetFileNames: () =>\n getEntrypointBundlePath(entrypoint, config.outDir, '.css'),\n },\n },\n },\n };\n },\n generateBundle(_, bundle) {\n Object.keys(bundle).forEach((file) => {\n if (file.endsWith('.js')) delete bundle[file];\n });\n },\n };\n}\n","import * as vite from 'vite';\nimport { visualizer } from 'rollup-plugin-visualizer';\n\nlet increment = 0;\n\nexport function bundleAnalysis(): vite.Plugin {\n return visualizer({\n emitFile: true,\n template: 'raw-data',\n filename: `stats-${increment++}.json`,\n }) as vite.Plugin;\n}\n","import { InternalConfig } from '../types';\n\nexport function getGlobals(\n config: InternalConfig,\n): Array<{ name: string; value: any; type: string }> {\n return [\n {\n name: '__MANIFEST_VERSION__',\n value: config.manifestVersion,\n type: `2 | 3`,\n },\n {\n name: '__BROWSER__',\n value: config.browser,\n type: `string`,\n },\n {\n name: '__IS_CHROME__',\n value: config.browser === 'chrome',\n type: `boolean`,\n },\n {\n name: '__IS_FIREFOX__',\n value: config.browser === 'firefox',\n type: `boolean`,\n },\n {\n name: '__IS_SAFARI__',\n value: config.browser === 'safari',\n type: `boolean`,\n },\n {\n name: '__IS_EDGE__',\n value: config.browser === 'edge',\n type: `boolean`,\n },\n {\n name: '__IS_OPERA__',\n value: config.browser === 'opera',\n type: `boolean`,\n },\n {\n name: '__COMMAND__',\n value: config.command,\n type: `\"build\" | \"serve\"`,\n },\n ];\n}\n\nexport function getEntrypointGlobals(\n config: InternalConfig,\n entrypointName: string,\n) {\n return [\n {\n name: '__ENTRYPOINT__',\n value: entrypointName,\n type: `string`,\n },\n ];\n}\n","import { BuildOutput, WxtDevServer, InlineConfig } from './core/types';\nimport { getInternalConfig } from './core/utils/getInternalConfig';\nimport pc from 'picocolors';\nimport { detectDevChanges } from './core/utils/detectDevChanges';\nimport { Mutex } from 'async-mutex';\nimport { consola } from 'consola';\nimport { relative } from 'node:path';\nimport { getEntrypointOutputFile } from './core/utils/entrypoints';\nimport { buildInternal, rebuild } from './core/build';\nimport {\n getServerInfo,\n reloadContentScripts,\n reloadHtmlPages,\n setupServer,\n} from './core/server';\n\nexport * from './core/clean';\nexport { version } from '../package.json';\nexport * from './core/types/external';\nexport * from './core/utils/defineConfig';\nexport * from './core/utils/defineRunnerConfig';\n\n/**\n * Bundles the extension for production. Returns a promise of the build result.\n */\nexport async function build(config: InlineConfig): Promise<BuildOutput> {\n const internalConfig = await getInternalConfig(config, 'build');\n return await buildInternal(internalConfig);\n}\n\n/**\n * Creates a dev server, pre-builds all the files that need to exist to load the extension, and open\n * the browser with the extension installed.\n */\nexport async function createServer(\n config?: InlineConfig,\n): Promise<WxtDevServer> {\n const serverInfo = await getServerInfo();\n\n const getLatestInternalConfig = async () => {\n return getInternalConfig(\n {\n ...config,\n vite: () => serverInfo.viteServerConfig,\n },\n 'serve',\n );\n };\n\n let internalConfig = await getLatestInternalConfig();\n const server = await setupServer(serverInfo, internalConfig);\n internalConfig.server = server;\n\n const fileChangedMutex = new Mutex();\n const changeQueue: Array<[string, string]> = [];\n\n server.ws.on('wxt:background-initialized', () => {\n // Register content scripts for the first time since they're not listed in the manifest\n reloadContentScripts(server.currentOutput.steps, internalConfig, server);\n });\n\n server.watcher.on('all', async (event, path, _stats) => {\n // Here, \"path\" is a non-normalized path (ie: C:\\\\users\\\\... instead of C:/users/...)\n if (path.startsWith(internalConfig.outBaseDir)) return;\n changeQueue.push([event, path]);\n\n await fileChangedMutex.runExclusive(async () => {\n const fileChanges = changeQueue.splice(0, changeQueue.length);\n if (fileChanges.length === 0) return;\n\n const changes = detectDevChanges(fileChanges, server.currentOutput);\n if (changes.type === 'no-change') return;\n\n // Log the entrypoints that were effected\n internalConfig.logger.info(\n `Changed: ${Array.from(new Set(fileChanges.map((change) => change[1])))\n .map((file) => pc.dim(relative(internalConfig.root, file)))\n .join(', ')}`,\n );\n const rebuiltNames = changes.rebuildGroups\n .flat()\n .map((entry) => {\n return pc.cyan(\n relative(internalConfig.outDir, getEntrypointOutputFile(entry, '')),\n );\n })\n .join(pc.dim(', '));\n\n // Get latest config and Rebuild groups with changes\n internalConfig = await getLatestInternalConfig();\n internalConfig.server = server;\n const { output: newOutput } = await rebuild(\n internalConfig,\n // TODO: this excludes new entrypoints, so they're not built until the dev command is restarted\n changes.rebuildGroups,\n changes.cachedOutput,\n );\n server.currentOutput = newOutput;\n\n // Perform reloads\n switch (changes.type) {\n case 'extension-reload':\n server.reloadExtension();\n break;\n case 'html-reload':\n reloadHtmlPages(changes.rebuildGroups, server, internalConfig);\n break;\n case 'content-script-reload':\n reloadContentScripts(changes.changedSteps, internalConfig, server);\n break;\n }\n consola.success(`Reloaded: ${rebuiltNames}`);\n });\n });\n\n return server;\n}\n","/**\n * Checks if `predicate` returns truthy for all elements of the array.\n */\nexport function every<T>(\n array: T[],\n predicate: (item: T, index: number) => boolean,\n): boolean {\n for (let i = 0; i < array.length; i++)\n if (!predicate(array[i], i)) return false;\n return true;\n}\n","import { BuildOutput, BuildStepOutput, EntrypointGroup } from '../types';\nimport * as vite from 'vite';\nimport { every } from './arrays';\nimport { normalizePath } from './paths';\n\n/**\n * Compare the changed files vs the build output and determine what kind of reload needs to happen:\n *\n * - Do nothing\n * - CSS or JS file associated with an HTML page is changed - this is handled automatically by the\n * dev server\n * - Change isn't used by any of the entrypoints\n * - Reload Content script\n * - CSS or JS file associated with a content script\n * - Background script will be told to reload the content script\n * - Reload HTML file\n * - HTML file itself is saved - HMR doesn't handle this because the HTML pages are pre-rendered\n * - Chrome is OK reloading the page when the HTML file is changed without reloading the whole\n * extension. Not sure about firefox, this might need to change to an extension reload\n * - Reload extension\n * - Background script is changed\n * - Manifest is different\n * - Restart browser\n * - Config file changed (wxt.config.ts, .env, web-ext.config.ts, etc)\n */\nexport function detectDevChanges(\n changedFiles: [event: string, path: string][],\n currentOutput: BuildOutput | undefined,\n): DevModeChange {\n if (currentOutput == null) return { type: 'no-change' };\n\n const changedSteps = new Set(\n changedFiles.flatMap((changedFile) =>\n findEffectedSteps(changedFile, currentOutput),\n ),\n );\n if (changedSteps.size === 0) return { type: 'no-change' };\n\n const unchangedOutput: BuildOutput = {\n manifest: currentOutput.manifest,\n steps: [],\n publicAssets: [],\n };\n const changedOutput: BuildOutput = {\n manifest: currentOutput.manifest,\n steps: [],\n publicAssets: [],\n };\n\n for (const step of currentOutput.steps) {\n if (changedSteps.has(step)) {\n changedOutput.steps.push(step);\n } else {\n unchangedOutput.steps.push(step);\n }\n }\n for (const asset of currentOutput.publicAssets) {\n if (changedSteps.has(asset)) {\n changedOutput.publicAssets.push(asset);\n } else {\n unchangedOutput.publicAssets.push(asset);\n }\n }\n\n const isOnlyHtmlChanges =\n changedFiles.length > 0 &&\n every(changedFiles, ([_, file]) => file.endsWith('.html'));\n if (isOnlyHtmlChanges) {\n return {\n type: 'html-reload',\n cachedOutput: unchangedOutput,\n rebuildGroups: changedOutput.steps.map((step) => step.entrypoints),\n };\n }\n\n const isOnlyContentScripts =\n changedOutput.steps.length > 0 &&\n every(\n changedOutput.steps.flatMap((step) => step.entrypoints),\n (entry) => entry.type === 'content-script',\n );\n if (isOnlyContentScripts) {\n return {\n type: 'content-script-reload',\n cachedOutput: unchangedOutput,\n changedSteps: changedOutput.steps,\n rebuildGroups: changedOutput.steps.map((step) => step.entrypoints),\n };\n }\n\n return {\n type: 'extension-reload',\n cachedOutput: unchangedOutput,\n rebuildGroups: changedOutput.steps.map((step) => step.entrypoints),\n };\n}\n\n/**\n * For a single change, return all the step of the build output that were effected by it.\n */\nfunction findEffectedSteps(\n changedFile: [event: string, path: string],\n currentOutput: BuildOutput,\n): DetectedChange[] {\n const changes: DetectedChange[] = [];\n const changedPath = normalizePath(changedFile[1]);\n\n const isChunkEffected = (\n chunk: vite.Rollup.OutputChunk | vite.Rollup.OutputAsset,\n ): boolean =>\n // If it's an HTML file with the same path, is is effected because HTML files need to be pre-rendered\n // fileName is normalized, relative bundle path\n (chunk.type === 'asset' && changedPath.endsWith(chunk.fileName)) ||\n // If it's a chunk that depends on the changed file, it is effected\n // moduleIds are absolute, normalized paths\n (chunk.type === 'chunk' && chunk.moduleIds.includes(changedPath));\n\n for (const step of currentOutput.steps) {\n const effectedChunk = step.chunks.find((chunk) => isChunkEffected(chunk));\n if (effectedChunk) changes.push(step);\n }\n\n const effectedAsset = currentOutput.publicAssets.find((chunk) =>\n isChunkEffected(chunk),\n );\n if (effectedAsset) changes.push(effectedAsset);\n\n return changes;\n}\n\n/**\n * Contains information about what files changed, what needs rebuilt, and the type of reload that is\n * required.\n */\nexport type DevModeChange =\n | NoChange\n | HtmlReload\n | ExtensionReload\n | ContentScriptReload;\n// | BrowserRestart\n\ninterface NoChange {\n type: 'no-change';\n}\n\ninterface RebuildChange {\n /**\n * The list of entrypoints that need rebuilt.\n */\n rebuildGroups: EntrypointGroup[];\n /**\n * The previous output stripped of any files are going to change.\n */\n cachedOutput: BuildOutput;\n}\n\ninterface HtmlReload extends RebuildChange {\n type: 'html-reload';\n}\n\ninterface ExtensionReload extends RebuildChange {\n type: 'extension-reload';\n}\n\n// interface BrowserRestart extends RebuildChange {\n// type: 'browser-restart';\n// }\n\ninterface ContentScriptReload extends RebuildChange {\n type: 'content-script-reload';\n changedSteps: BuildStepOutput[];\n}\n\n/**\n * When figuring out what needs reloaded, this stores the step that was changed, or the public\n * directory asset that was changed. It doesn't know what type of change is required yet. Just an\n * intermediate type.\n */\ntype DetectedChange = BuildStepOutput | vite.Rollup.OutputAsset;\n","import * as vite from 'vite';\nimport {\n BuildOutput,\n BuildStepOutput,\n Entrypoint,\n EntrypointGroup,\n InternalConfig,\n} from '../types';\nimport * as wxtPlugins from '../vite-plugins';\nimport { removeEmptyDirs } from '../utils/removeEmptyDirs';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\nimport fs from 'fs-extra';\nimport { dirname, resolve } from 'path';\nimport { getPublicFiles } from '../utils/public';\nimport { getEntrypointGlobals } from '../utils/globals';\nimport type { Ora } from 'ora';\nimport pc from 'picocolors';\n\nexport async function buildEntrypoints(\n groups: EntrypointGroup[],\n config: InternalConfig,\n spinner: Ora,\n): Promise<Omit<BuildOutput, 'manifest'>> {\n const steps: BuildStepOutput[] = [];\n for (let i = 0; i < groups.length; i++) {\n const group = groups[i];\n\n spinner.text =\n pc.dim(`[${i + 1}/${groups.length}]`) +\n ` ${[group]\n .flat()\n .map((e) => e.name)\n .join(pc.dim(', '))}`;\n\n const step = Array.isArray(group)\n ? await buildMultipleEntrypoints(group, config)\n : await buildSingleEntrypoint(group, config);\n steps.push(step);\n }\n const publicAssets = await copyPublicDirectory(config);\n\n // Remove any empty directories from moving outputs around\n await removeEmptyDirs(config.outDir);\n\n return { publicAssets, steps };\n}\n\n/**\n * Use Vite's lib mode + IIFE format to bundle the entrypoint to a single file.\n */\nasync function buildSingleEntrypoint(\n entrypoint: Entrypoint,\n config: InternalConfig,\n): Promise<BuildStepOutput> {\n // Should this entrypoint be wrapped by the vite-plugins/virtualEntrypoint plugin?\n const isVirtual = ['background', 'content-script'].includes(entrypoint.type);\n const entry = isVirtual\n ? `virtual:wxt-${entrypoint.type}?${entrypoint.inputPath}`\n : entrypoint.inputPath;\n\n const plugins: NonNullable<vite.UserConfig['plugins']> = [];\n if (\n entrypoint.type === 'content-script-style' ||\n entrypoint.type === 'unlisted-style'\n ) {\n plugins.push(wxtPlugins.cssEntrypoints(entrypoint, config));\n }\n\n const libMode: vite.UserConfig = {\n plugins,\n build: {\n lib: {\n entry,\n formats: ['iife'],\n name: '_',\n fileName: entrypoint.name,\n },\n rollupOptions: {\n output: {\n // There's only a single output for this build, so we use the desired bundle path for the\n // entry output (like \"content-scripts/overlay.js\")\n entryFileNames: getEntrypointBundlePath(\n entrypoint,\n config.outDir,\n '.js',\n ),\n // Output content script CSS to `content-scripts/`, but all other scripts are written to\n // `assets/`.\n assetFileNames: ({ name }) => {\n if (entrypoint.type === 'content-script' && name?.endsWith('css')) {\n return `content-scripts/${entrypoint.name}.[ext]`;\n } else {\n return `assets/${entrypoint.name}.[ext]`;\n }\n },\n },\n },\n },\n define: {\n // See https://github.com/aklinker1/vite-plugin-web-extension/issues/96\n 'process.env.NODE_ENV': JSON.stringify(config.mode),\n },\n };\n for (const global of getEntrypointGlobals(config, entrypoint.name)) {\n libMode.define![global.name] = JSON.stringify(global.value);\n }\n const entryConfig = vite.mergeConfig(\n libMode,\n await config.vite(config.env),\n ) as vite.InlineConfig;\n\n const result = await vite.build(entryConfig);\n return {\n entrypoints: entrypoint,\n chunks: getBuildOutputChunks(result),\n };\n}\n\n/**\n * Use Vite's multipage build to bundle all the entrypoints in a single step.\n */\nasync function buildMultipleEntrypoints(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): Promise<BuildStepOutput> {\n const multiPage: vite.UserConfig = {\n plugins: [wxtPlugins.multipageMove(entrypoints, config)],\n build: {\n rollupOptions: {\n input: entrypoints.reduce<Record<string, string>>((input, entry) => {\n input[entry.name] = entry.inputPath;\n return input;\n }, {}),\n output: {\n // Include a hash to prevent conflicts\n chunkFileNames: 'chunks/[name]-[hash].js',\n // Include a hash to prevent conflicts\n entryFileNames: 'chunks/[name]-[hash].js',\n // We can't control the \"name\", so we need a hash to prevent conflicts\n assetFileNames: 'assets/[name]-[hash].[ext]',\n },\n },\n },\n define: {},\n };\n for (const global of getEntrypointGlobals(config, 'html')) {\n multiPage.define![global.name] = JSON.stringify(global.value);\n }\n\n const entryConfig = vite.mergeConfig(\n multiPage,\n await config.vite(config.env),\n ) as vite.UserConfig;\n\n const result = await vite.build(entryConfig);\n return {\n entrypoints,\n chunks: getBuildOutputChunks(result),\n };\n}\n\nfunction getBuildOutputChunks(\n result: Awaited<ReturnType<typeof vite.build>>,\n): BuildStepOutput['chunks'] {\n if ('on' in result) throw Error('wxt does not support vite watch mode.');\n if (Array.isArray(result)) return result.flatMap(({ output }) => output);\n return result.output;\n}\n\nasync function copyPublicDirectory(\n config: InternalConfig,\n): Promise<BuildOutput['publicAssets']> {\n const files = await getPublicFiles(config);\n if (files.length === 0) return [];\n\n const publicAssets: BuildOutput['publicAssets'] = [];\n for (const file of files) {\n const srcPath = resolve(config.publicDir, file);\n const outPath = resolve(config.outDir, file);\n\n await fs.ensureDir(dirname(outPath));\n await fs.copyFile(srcPath, outPath);\n publicAssets.push({\n type: 'asset',\n fileName: file,\n name: file,\n needsCodeReference: false,\n source: await fs.readFile(srcPath),\n });\n }\n\n return publicAssets;\n}\n","import fs from 'fs-extra';\nimport path from 'path';\n\nexport async function removeEmptyDirs(dir: string): Promise<void> {\n const files = await fs.readdir(dir);\n for (const file of files) {\n const filePath = path.join(dir, file);\n const stats = await fs.stat(filePath);\n if (stats.isDirectory()) {\n await removeEmptyDirs(filePath);\n }\n }\n\n try {\n await fs.rmdir(dir);\n } catch {\n // noop on failure - this means the directory was not empty.\n }\n}\n","import { InternalConfig } from '../types';\nimport fs from 'fs-extra';\nimport glob from 'fast-glob';\nimport { unnormalizePath } from './paths';\n\n/**\n * Get all the files in the project's public directory. Returned paths are relative to the\n * `config.publicDir`.\n */\nexport async function getPublicFiles(\n config: InternalConfig,\n): Promise<string[]> {\n if (!(await fs.exists(config.publicDir))) return [];\n\n const files = await glob('**/*', { cwd: config.publicDir });\n return files.map(unnormalizePath);\n}\n","import { relative, resolve } from 'path';\nimport {\n BackgroundEntrypoint,\n BackgroundScriptDefintition,\n BaseEntrypointOptions,\n ContentScriptDefinition,\n ContentScriptEntrypoint,\n Entrypoint,\n GenericEntrypoint,\n InternalConfig,\n OptionsEntrypoint,\n PopupEntrypoint,\n} from '../types';\nimport fs from 'fs-extra';\nimport { minimatch } from 'minimatch';\nimport { parseHTML } from 'linkedom';\nimport JSON5 from 'json5';\nimport { importEntrypointFile } from '../utils/importEntrypointFile';\nimport glob from 'fast-glob';\nimport {\n getEntrypointName,\n resolvePerBrowserOption,\n} from '../utils/entrypoints';\nimport { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '../vite-plugins/noopBackground';\nimport { CSS_EXTENSIONS_PATTERN } from '../utils/paths';\n\n/**\n * Return entrypoints and their configuration by looking through the project's files.\n */\nexport async function findEntrypoints(\n config: InternalConfig,\n): Promise<Entrypoint[]> {\n const relativePaths = await glob('**/*', {\n cwd: config.entrypointsDir,\n });\n // Ensure consistent output\n relativePaths.sort();\n\n const pathGlobs = Object.keys(PATH_GLOB_TO_TYPE_MAP);\n const existingNames: Record<string, Entrypoint | undefined> = {};\n\n const entrypoints: Entrypoint[] = [];\n let hasBackground = false;\n await Promise.all(\n relativePaths.map(async (relativePath) => {\n const path = resolve(config.entrypointsDir, relativePath);\n const matchingGlob = pathGlobs.find((glob) =>\n minimatch(relativePath, glob),\n );\n\n if (matchingGlob == null) {\n return config.logger.warn(\n `${relativePath} does not match any known entrypoint. Known entrypoints:\\n${JSON.stringify(\n PATH_GLOB_TO_TYPE_MAP,\n null,\n 2,\n )}`,\n );\n }\n\n const type = PATH_GLOB_TO_TYPE_MAP[matchingGlob];\n if (type === 'ignored') return;\n\n let entrypoint: Entrypoint;\n switch (type) {\n case 'popup':\n entrypoint = await getPopupEntrypoint(config, path);\n break;\n case 'options':\n entrypoint = await getOptionsEntrypoint(config, path);\n break;\n case 'background':\n entrypoint = await getBackgroundEntrypoint(config, path);\n hasBackground = true;\n break;\n case 'content-script':\n entrypoint = await getContentScriptEntrypoint(\n config,\n getEntrypointName(config.entrypointsDir, path),\n path,\n );\n break;\n case 'unlisted-page':\n entrypoint = await getUnlistedPageEntrypoint(config, path);\n break;\n case 'content-script-style':\n entrypoint = {\n type,\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: resolve(config.outDir, CONTENT_SCRIPT_OUT_DIR),\n options: {\n include: undefined,\n exclude: undefined,\n },\n };\n break;\n default:\n entrypoint = {\n type,\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: config.outDir,\n options: {\n include: undefined,\n exclude: undefined,\n },\n };\n }\n\n const withSameName = existingNames[entrypoint.name];\n if (withSameName) {\n throw Error(\n `Multiple entrypoints with the name \"${\n entrypoint.name\n }\" detected, but only one is allowed: ${[\n relative(config.root, withSameName.inputPath),\n relative(config.root, entrypoint.inputPath),\n ].join(', ')}`,\n );\n }\n entrypoints.push(entrypoint);\n existingNames[entrypoint.name] = entrypoint;\n }),\n );\n if (config.command === 'serve' && !hasBackground) {\n entrypoints.push(\n await getBackgroundEntrypoint(config, VIRTUAL_NOOP_BACKGROUND_MODULE_ID),\n );\n }\n\n config.logger.debug('All entrypoints:', entrypoints);\n const targetEntrypoints = entrypoints.filter((entry) => {\n const { include, exclude } = entry.options;\n if (include?.length && exclude?.length) {\n config.logger.warn(\n `The ${entry.name} entrypoint lists both include and exclude, but only one can be used per entrypoint. Entrypoint ignored.`,\n );\n return false;\n }\n if (exclude?.length && !include?.length) {\n return !exclude.includes(config.browser);\n }\n if (include?.length && !exclude?.length) {\n return include.includes(config.browser);\n }\n\n return true;\n });\n config.logger.debug(`${config.browser} entrypoints:`, targetEntrypoints);\n return targetEntrypoints;\n}\n\nfunction getHtmlBaseOptions(document: Document): BaseEntrypointOptions {\n const options: BaseEntrypointOptions = {};\n\n const includeContent = document\n .querySelector(\"meta[name='manifest.include']\")\n ?.getAttribute('content');\n if (includeContent) {\n options.include = JSON5.parse(includeContent);\n }\n\n const excludeContent = document\n .querySelector(\"meta[name='manifest.exclude']\")\n ?.getAttribute('content');\n if (excludeContent) {\n options.exclude = JSON5.parse(excludeContent);\n }\n\n return options;\n}\n\n/**\n * @param path Absolute path to the popup HTML file.\n * @param content String contents of the file at the path.\n */\nasync function getPopupEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<PopupEntrypoint> {\n const content = await fs.readFile(path, 'utf-8');\n const { document } = parseHTML(content);\n\n const options: PopupEntrypoint['options'] = getHtmlBaseOptions(document);\n\n const title = document.querySelector('title');\n if (title != null) options.defaultTitle = title.textContent ?? undefined;\n\n const defaultIconContent = document\n .querySelector(\"meta[name='manifest.default_icon']\")\n ?.getAttribute('content');\n if (defaultIconContent) {\n try {\n options.defaultIcon = JSON5.parse(defaultIconContent);\n } catch (err) {\n config.logger.fatal(\n `Failed to parse default_icon meta tag content as JSON5. content=${defaultIconContent}`,\n err,\n );\n }\n }\n\n const mv2KeyContent = document\n .querySelector(\"meta[name='manifest.type']\")\n ?.getAttribute('content');\n if (mv2KeyContent) {\n options.mv2Key =\n mv2KeyContent === 'page_action' ? 'page_action' : 'browser_action';\n }\n\n return {\n type: 'popup',\n name: 'popup',\n options,\n inputPath: path,\n outputDir: config.outDir,\n };\n}\n\n/**\n * @param path Absolute path to the options HTML file.\n * @param content String contents of the file at the path.\n */\nasync function getOptionsEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<OptionsEntrypoint> {\n const content = await fs.readFile(path, 'utf-8');\n const { document } = parseHTML(content);\n\n const options: OptionsEntrypoint['options'] = getHtmlBaseOptions(document);\n\n const openInTabContent = document\n .querySelector(\"meta[name='manifest.open_in_tab']\")\n ?.getAttribute('content');\n if (openInTabContent) {\n options.openInTab = openInTabContent === 'true';\n }\n\n const chromeStyleContent = document\n .querySelector(\"meta[name='manifest.chrome_style']\")\n ?.getAttribute('content');\n if (chromeStyleContent) {\n options.chromeStyle = chromeStyleContent === 'true';\n }\n\n const browserStyleContent = document\n .querySelector(\"meta[name='manifest.browser_style']\")\n ?.getAttribute('content');\n if (browserStyleContent) {\n options.browserStyle = browserStyleContent === 'true';\n }\n\n return {\n type: 'options',\n name: 'options',\n options,\n inputPath: path,\n outputDir: config.outDir,\n };\n}\n\n/**\n * @param path Absolute path to the HTML file.\n * @param content String contents of the file at the path.\n */\nasync function getUnlistedPageEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<GenericEntrypoint> {\n const content = await fs.readFile(path, 'utf-8');\n const { document } = parseHTML(content);\n\n return {\n type: 'unlisted-page',\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: config.outDir,\n options: getHtmlBaseOptions(document),\n };\n}\n\n/**\n * @param path Absolute path to the background's TS file.\n */\nasync function getBackgroundEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<BackgroundEntrypoint> {\n let options: Omit<BackgroundScriptDefintition, 'main'> = {};\n if (path !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {\n const defaultExport =\n await importEntrypointFile<BackgroundScriptDefintition>(path, config);\n if (defaultExport == null) {\n throw Error('Background script does not have a default export');\n }\n const { main: _, ...moduleOptions } = defaultExport;\n options = moduleOptions;\n }\n return {\n type: 'background',\n name: 'background',\n inputPath: path,\n outputDir: config.outDir,\n options: {\n ...options,\n type: resolvePerBrowserOption(options.type, config.browser),\n persistent: resolvePerBrowserOption(options.persistent, config.browser),\n },\n };\n}\n\n/**\n * @param path Absolute path to the content script's TS file.\n */\nasync function getContentScriptEntrypoint(\n config: InternalConfig,\n name: string,\n path: string,\n): Promise<ContentScriptEntrypoint> {\n const { main: _, ...options } =\n await importEntrypointFile<ContentScriptDefinition>(path, config);\n if (options == null) {\n throw Error(`Content script ${name} does not have a default export`);\n }\n return {\n type: 'content-script',\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: resolve(config.outDir, CONTENT_SCRIPT_OUT_DIR),\n options,\n };\n}\n\nconst PATH_GLOB_TO_TYPE_MAP: Record<string, Entrypoint['type'] | 'ignored'> = {\n 'sandbox.html': 'sandbox',\n 'sandbox/index.html': 'sandbox',\n '*.sandbox.html': 'sandbox',\n '*.sandbox/index.html': 'sandbox',\n\n 'bookmarks.html': 'bookmarks',\n 'bookmarks/index.html': 'bookmarks',\n\n 'history.html': 'history',\n 'history/index.html': 'history',\n\n 'newtab.html': 'newtab',\n 'newtab/index.html': 'newtab',\n\n 'sidepanel.html': 'sidepanel',\n 'sidepanel/index.html': 'sidepanel',\n '*.sidepanel.html': 'sidepanel',\n '*.sidepanel/index.html': 'sidepanel',\n\n 'devtools.html': 'devtools',\n 'devtools/index.html': 'devtools',\n\n 'background.ts': 'background',\n 'background/index.ts': 'background',\n [VIRTUAL_NOOP_BACKGROUND_MODULE_ID]: 'background',\n\n 'content.ts?(x)': 'content-script',\n 'content/index.ts?(x)': 'content-script',\n '*.content.ts?(x)': 'content-script',\n '*.content/index.ts?(x)': 'content-script',\n [`content.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n [`*.content.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n [`content/index.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n [`*.content/index.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n\n 'popup.html': 'popup',\n 'popup/index.html': 'popup',\n\n 'options.html': 'options',\n 'options/index.html': 'options',\n\n '*.html': 'unlisted-page',\n '*/index.html': 'unlisted-page',\n '*.ts': 'unlisted-script',\n '*/index.ts': 'unlisted-script',\n [`*.${CSS_EXTENSIONS_PATTERN}`]: 'unlisted-style',\n [`*/index.${CSS_EXTENSIONS_PATTERN}`]: 'unlisted-style',\n\n // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests\n '*/**': 'ignored',\n};\n\nconst CONTENT_SCRIPT_OUT_DIR = 'content-scripts';\n","import createJITI, { TransformOptions as JitiTransformOptions } from 'jiti';\nimport { InternalConfig } from '../types';\nimport { createUnimport } from 'unimport';\nimport fs from 'fs-extra';\nimport { resolve } from 'path';\nimport { getUnimportOptions } from './auto-imports';\nimport { removeProjectImportStatements } from './strings';\nimport { normalizePath } from './paths';\nimport { TransformOptions, transformSync } from 'esbuild';\n\n/**\n * Get the value from the default export of a `path`.\n *\n * It works by:\n *\n * 1. Reading the file text\n * 2. Stripping all imports from it via regex\n * 3. Auto-import only the client helper functions\n *\n * This prevents resolving imports of imports, speeding things up and preventing \"xxx is not\n * defined\" errors.\n *\n * Downside is that code cannot be executed outside of the main fucntion for the entrypoint,\n * otherwise you will see \"xxx is not defined\" errors for any imports used outside of main function.\n */\nexport async function importEntrypointFile<T>(\n path: string,\n config: InternalConfig,\n): Promise<T> {\n config.logger.debug('Loading file metadata:', path);\n // JITI & Babel uses normalized paths.\n const normalPath = normalizePath(path);\n\n const unimport = createUnimport({\n ...getUnimportOptions(config),\n // Only allow specific imports, not all from the project\n dirs: [],\n });\n await unimport.init();\n\n const text = await fs.readFile(path, 'utf-8');\n const textNoImports = removeProjectImportStatements(text);\n const { code } = await unimport.injectImports(textNoImports);\n config.logger.debug(\n ['Text:', text, 'No imports:', textNoImports, 'Code:', code].join('\\n'),\n );\n\n const jiti = createJITI(__filename, {\n cache: false,\n debug: config.debug,\n esmResolve: true,\n interopDefault: true,\n alias: {\n 'webextension-polyfill': resolve(\n config.root,\n 'node_modules/wxt/dist/virtual-modules/fake-browser.js',\n ),\n },\n extensions: ['.ts', '.tsx', '.cjs', '.js', '.mjs'],\n transform(opts) {\n const isEntrypoint = opts.filename === normalPath;\n return transformSync(\n // Use modified source code for entrypoints\n isEntrypoint ? code : opts.source,\n getEsbuildOptions(opts),\n );\n },\n });\n\n try {\n return await jiti(path);\n } catch (err) {\n config.logger.error(err);\n throw err;\n }\n}\n\nfunction getEsbuildOptions(opts: JitiTransformOptions): TransformOptions {\n const isJsx = opts.filename?.endsWith('x');\n return {\n format: 'cjs',\n loader: isJsx ? 'tsx' : 'ts',\n jsx: isJsx ? 'automatic' : undefined,\n };\n}\n","export function kebabCaseAlphanumeric(str: string): string {\n return str\n .toLowerCase()\n .replace(/[^a-z0-9-\\s]/g, '') // Remove all non-alphanumeric, non-hyphen characters\n .replace(/\\s+/g, '-'); // Replace spaces with hyphens\n}\n\n/**\n * Removes import statements from the top of a file. Keeps import.meta and inline, async `import()`\n * calls.\n */\nexport function removeImportStatements(text: string): string {\n return text.replace(\n /(import\\s?[{\\w][\\s\\S]*?from\\s?[\"'][\\s\\S]*?[\"'];?|import\\s?[\"'][\\s\\S]*?[\"'];?)/gm,\n '',\n );\n}\n\n/**\n * Removes imports, ensuring that some of WXT's client imports are present, so that entrypoints can be parsed if auto-imports are disabled.\n */\nexport function removeProjectImportStatements(text: string): string {\n const noImports = removeImportStatements(text);\n\n return `import { defineContentScript, defineBackground } from 'wxt/client';\n\n${noImports}`;\n}\n","import { UnimportOptions, createUnimport } from 'unimport';\nimport { Entrypoint, InternalConfig } from '../types';\nimport fs from 'fs-extra';\nimport { relative, resolve } from 'path';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\nimport { getUnimportOptions } from '../utils/auto-imports';\nimport { getEntrypointGlobals, getGlobals } from '../utils/globals';\nimport { getPublicFiles } from '../utils/public';\nimport { normalizePath } from '../utils/paths';\nimport path from 'node:path';\nimport { Message, parseI18nMessages } from '../utils/i18n';\nimport { writeFileIfDifferent } from '../utils/fs';\n\n/**\n * Generate and write all the files inside the `InternalConfig.typesDir` directory.\n */\nexport async function generateTypesDir(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): Promise<void> {\n await fs.ensureDir(config.typesDir);\n\n const references: string[] = [];\n\n const imports = getUnimportOptions(config);\n if (imports !== false) {\n references.push(await writeImportsDeclarationFile(config, imports));\n }\n\n references.push(await writePathsDeclarationFile(entrypoints, config));\n references.push(await writeI18nDeclarationFile(config));\n references.push(await writeGlobalsDeclarationFile(config));\n\n const mainReference = await writeMainDeclarationFile(references, config);\n await writeTsConfigFile(mainReference, config);\n}\n\nasync function writeImportsDeclarationFile(\n config: InternalConfig,\n unimportOptions: Partial<UnimportOptions>,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'imports.d.ts');\n const unimport = createUnimport(unimportOptions);\n\n // Load project imports into unimport memory so they are output via generateTypeDeclarations\n await unimport.scanImportsFromDir(undefined, { cwd: config.srcDir });\n\n await writeFileIfDifferent(\n filePath,\n ['// Generated by wxt', await unimport.generateTypeDeclarations()].join(\n '\\n',\n ) + '\\n',\n );\n\n return filePath;\n}\n\nasync function writePathsDeclarationFile(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'paths.d.ts');\n const unions = entrypoints\n .map((entry) =>\n getEntrypointBundlePath(\n entry,\n config.outDir,\n entry.inputPath.endsWith('.html') ? '.html' : '.js',\n ),\n )\n .concat(await getPublicFiles(config))\n .map(normalizePath)\n .map((path) => ` | \"/${path}\"`)\n .sort()\n .join('\\n');\n\n const template = `// Generated by wxt\nimport \"wxt/browser\";\n\ndeclare module \"wxt/browser\" {\n type PublicPath =\n{{ union }}\n export interface WxtRuntime extends Runtime.Static {\n getURL(path: PublicPath): string;\n }\n}\n`;\n\n await writeFileIfDifferent(\n filePath,\n template.replace('{{ union }}', unions || ' | never'),\n );\n\n return filePath;\n}\n\nasync function writeI18nDeclarationFile(\n config: InternalConfig,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'i18n.d.ts');\n const defaultLocale = config.manifest.default_locale;\n const template = `// Generated by wxt\nimport \"wxt/browser\";\n\ndeclare module \"wxt/browser\" {\n /**\n * See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage\n */\n interface GetMessageOptions {\n /**\n * See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage\n */\n escapeLt?: boolean\n }\n\n export interface WxtI18n extends I18n.Static {\n{{ overrides }}\n }\n}\n`;\n\n let messages: Message[];\n if (defaultLocale) {\n const defaultLocalePath = path.resolve(\n config.publicDir,\n '_locales',\n defaultLocale,\n 'messages.json',\n );\n const content = JSON.parse(await fs.readFile(defaultLocalePath, 'utf-8'));\n messages = parseI18nMessages(content);\n } else {\n messages = parseI18nMessages({});\n }\n\n const overrides = messages.map((message) => {\n return ` /**\n * ${message.description ?? 'No message description.'}\n * \n * \"${message.message}\"\n */\n getMessage(\n messageName: \"${message.name}\",\n substitutions?: string | string[],\n options?: GetMessageOptions,\n ): string;`;\n });\n await writeFileIfDifferent(\n filePath,\n template.replace('{{ overrides }}', overrides.join('\\n')),\n );\n\n return filePath;\n}\n\nasync function writeGlobalsDeclarationFile(\n config: InternalConfig,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'globals.d.ts');\n const globals = [...getGlobals(config), ...getEntrypointGlobals(config, '')];\n await writeFileIfDifferent(\n filePath,\n [\n '// Generated by wxt',\n 'export {}',\n 'declare global {',\n ...globals.map((global) => ` const ${global.name}: ${global.type};`),\n '}',\n ].join('\\n') + '\\n',\n );\n return filePath;\n}\n\nasync function writeMainDeclarationFile(\n references: string[],\n config: InternalConfig,\n): Promise<string> {\n const dir = config.wxtDir;\n const filePath = resolve(dir, 'wxt.d.ts');\n await writeFileIfDifferent(\n filePath,\n [\n '// Generated by wxt',\n `/// <reference types=\"vite/client\" />`,\n ...references.map(\n (ref) =>\n `/// <reference types=\"./${normalizePath(relative(dir, ref))}\" />`,\n ),\n ].join('\\n') + '\\n',\n );\n return filePath;\n}\n\nasync function writeTsConfigFile(\n mainReference: string,\n config: InternalConfig,\n) {\n const dir = config.wxtDir;\n const rootPath = normalizePath(relative(dir, config.root));\n const srcPath = normalizePath(relative(dir, config.srcDir));\n await writeFileIfDifferent(\n resolve(dir, 'tsconfig.json'),\n `{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"Bundler\",\n \"noEmit\": true,\n \"esModuleInterop\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"resolveJsonModule\": true,\n \"strict\": true,\n \"lib\": [\"DOM\", \"WebWorker\"],\n \"skipLibCheck\": true,\n \"paths\": {\n \"@\": [\"${srcPath}\"],\n \"@/*\": [\"${srcPath}/*\"],\n \"~\": [\"${srcPath}\"],\n \"~/*\": [\"${srcPath}/*\"],\n \"@@\": [\"${rootPath}\"],\n \"@@/*\": [\"${rootPath}/*\"],\n \"~~\": [\"${rootPath}\"],\n \"~~/*\": [\"${rootPath}/*\"]\n }\n },\n \"include\": [\n \"${normalizePath(relative(dir, config.root))}/**/*\",\n \"./${normalizePath(relative(dir, mainReference))}\"\n ],\n \"exclude\": [\"${normalizePath(relative(dir, config.outBaseDir))}\"]\n}`,\n );\n}\n","export interface Message {\n name: string;\n message: string;\n description?: string;\n}\n\nconst predefinedMessages = {\n '@@extension_id': {\n message: '<browser.runtime.id>',\n description:\n \"The extension or app ID; you might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.\\nNote: You can't use this message in a manifest file.\",\n },\n '@@ui_locale': {\n message: '<browser.i18n.getUiLocale()>',\n description: '',\n },\n '@@bidi_dir': {\n message: '<ltr|rtl>',\n description:\n 'The text direction for the current locale, either \"ltr\" for left-to-right languages such as English or \"rtl\" for right-to-left languages such as Japanese.',\n },\n '@@bidi_reversed_dir': {\n message: '<rtl|ltr>',\n description:\n 'If the @@bidi_dir is \"ltr\", then this is \"rtl\"; otherwise, it\\'s \"ltr\".',\n },\n '@@bidi_start_edge': {\n message: '<left|right>',\n description:\n 'If the @@bidi_dir is \"ltr\", then this is \"left\"; otherwise, it\\'s \"right\".',\n },\n '@@bidi_end_edge': {\n message: '<right|left>',\n description:\n 'If the @@bidi_dir is \"ltr\", then this is \"right\"; otherwise, it\\'s \"left\".',\n },\n};\n\n/**\n * Get a list of all messages and their metadata from JSON file contents.\n *\n * @param messagesJson The contents of a `_locales/en/messages.json` file.\n */\nexport function parseI18nMessages(messagesJson: object): Message[] {\n return Object.entries({\n ...predefinedMessages,\n ...messagesJson,\n }).map<Message>(([name, details]) => ({\n name,\n ...details,\n }));\n}\n","import { Entrypoint } from '../..';\nimport { Manifest } from 'webextension-polyfill';\nimport {\n BackgroundEntrypoint,\n BuildOutput,\n ContentScriptEntrypoint,\n InternalConfig,\n OptionsEntrypoint,\n PopupEntrypoint,\n} from '../types';\nimport fs from 'fs-extra';\nimport { resolve } from 'path';\nimport {\n getEntrypointBundlePath,\n resolvePerBrowserOption,\n} from './entrypoints';\nimport { ContentSecurityPolicy } from './ContentSecurityPolicy';\nimport {\n hashContentScriptOptions,\n mapWxtOptionsToContentScript,\n} from './content-scripts';\nimport { getPackageJson } from './package';\nimport { normalizePath } from './paths';\nimport { writeFileIfDifferent } from './fs';\nimport { produce } from 'immer';\nimport * as vite from 'vite';\n\n/**\n * Writes the manifest to the output directory and the build output.\n */\nexport async function writeManifest(\n manifest: Manifest.WebExtensionManifest,\n output: BuildOutput,\n config: InternalConfig,\n): Promise<void> {\n const str =\n config.mode === 'production'\n ? JSON.stringify(manifest)\n : JSON.stringify(manifest, null, 2);\n\n await fs.ensureDir(config.outDir);\n await writeFileIfDifferent(resolve(config.outDir, 'manifest.json'), str);\n\n output.publicAssets.unshift({\n type: 'asset',\n fileName: 'manifest.json',\n name: 'manifest',\n needsCodeReference: false,\n source: str,\n });\n}\n\n/**\n * Generates the manifest based on the config and entrypoints.\n */\nexport async function generateMainfest(\n entrypoints: Entrypoint[],\n buildOutput: Omit<BuildOutput, 'manifest'>,\n config: InternalConfig,\n): Promise<Manifest.WebExtensionManifest> {\n const pkg = await getPackageJson(config);\n\n const baseManifest: Manifest.WebExtensionManifest = {\n manifest_version: config.manifestVersion,\n name: pkg?.name,\n description: pkg?.description,\n version: pkg?.version && simplifyVersion(pkg.version),\n // Only add the version name to chromium and if the user hasn't specified a custom version.\n version_name:\n config.browser !== 'firefox' && !config.manifest.version\n ? pkg?.version\n : undefined,\n short_name: pkg?.shortName,\n icons: discoverIcons(buildOutput),\n };\n const userManifest = config.manifest;\n\n const manifest = vite.mergeConfig(\n baseManifest,\n userManifest,\n ) as Manifest.WebExtensionManifest;\n\n addEntrypoints(manifest, entrypoints, buildOutput, config);\n\n if (config.command === 'serve') addDevModeCsp(manifest, config);\n if (config.command === 'serve') addDevModePermissions(manifest, config);\n\n const finalManifest = produce(manifest, config.transformManifest);\n\n if (finalManifest.name == null)\n throw Error(\n \"Manifest 'name' is missing. Either:\\n1. Set the name in your <rootDir>/package.json\\n2. Set a name via the manifest option in your wxt.config.ts\",\n );\n if (finalManifest.version == null) {\n throw Error(\n \"Manifest 'version' is missing. Either:\\n1. Add a version in your <rootDir>/package.json\\n2. Pass the version via the manifest option in your wxt.config.ts\",\n );\n }\n\n return finalManifest;\n}\n\n/**\n * Removes suffixes from the version, like X.Y.Z-alpha1 (which brosers don't allow), so it's a\n * simple version number, like X or X.Y or X.Y.Z, which browsers allow.\n */\nfunction simplifyVersion(versionName: string): string {\n // Regex adapted from here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/version#version_format\n const version = /^((0|[1-9][0-9]{0,8})([.](0|[1-9][0-9]{0,8})){0,3}).*$/.exec(\n versionName,\n )?.[1];\n\n if (version == null)\n throw Error(\n `Cannot simplify package.json version \"${versionName}\" to a valid extension version, \"X.Y.Z\"`,\n );\n\n return version;\n}\n\nfunction addEntrypoints(\n manifest: Manifest.WebExtensionManifest,\n entrypoints: Entrypoint[],\n buildOutput: Omit<BuildOutput, 'manifest'>,\n config: InternalConfig,\n): void {\n const entriesByType = entrypoints.reduce<\n Partial<Record<Entrypoint['type'], Entrypoint[]>>\n >((map, entrypoint) => {\n map[entrypoint.type] ??= [];\n map[entrypoint.type]?.push(entrypoint);\n return map;\n }, {});\n\n const background = entriesByType['background']?.[0] as\n | BackgroundEntrypoint\n | undefined;\n const bookmarks = entriesByType['bookmarks']?.[0];\n const contentScripts = entriesByType['content-script'] as\n | ContentScriptEntrypoint[]\n | undefined;\n const devtools = entriesByType['devtools']?.[0];\n const history = entriesByType['history']?.[0];\n const newtab = entriesByType['newtab']?.[0];\n const options = entriesByType['options']?.[0] as\n | OptionsEntrypoint\n | undefined;\n const popup = entriesByType['popup']?.[0] as PopupEntrypoint | undefined;\n const sandboxes = entriesByType['sandbox'];\n const sidepanels = entriesByType['sidepanel'];\n\n if (background) {\n const script = getEntrypointBundlePath(background, config.outDir, '.js');\n if (manifest.manifest_version === 3) {\n manifest.background = {\n type: background.options.type,\n service_worker: script,\n };\n } else {\n manifest.background = {\n persistent: background.options.persistent,\n scripts: [script],\n };\n }\n }\n\n if (bookmarks) {\n if (config.browser === 'firefox') {\n config.logger.warn(\n 'Bookmarks are not supported by Firefox. chrome_url_overrides.bookmarks was not added to the manifest',\n );\n } else {\n manifest.chrome_url_overrides ??= {};\n // @ts-expect-error: bookmarks is untyped in webextension-polyfill, but supported by chrome\n manifest.chrome_url_overrides.bookmarks = getEntrypointBundlePath(\n bookmarks,\n config.outDir,\n '.html',\n );\n }\n }\n\n if (history) {\n if (config.browser === 'firefox') {\n config.logger.warn(\n 'Bookmarks are not supported by Firefox. chrome_url_overrides.history was not added to the manifest',\n );\n } else {\n manifest.chrome_url_overrides ??= {};\n // @ts-expect-error: history is untyped in webextension-polyfill, but supported by chrome\n manifest.chrome_url_overrides.history = getEntrypointBundlePath(\n history,\n config.outDir,\n '.html',\n );\n }\n }\n\n if (newtab) {\n manifest.chrome_url_overrides ??= {};\n manifest.chrome_url_overrides.newtab = getEntrypointBundlePath(\n newtab,\n config.outDir,\n '.html',\n );\n }\n\n if (popup) {\n const default_popup = getEntrypointBundlePath(\n popup,\n config.outDir,\n '.html',\n );\n const options: Manifest.ActionManifest = {\n default_icon: popup.options.defaultIcon,\n default_title: popup.options.defaultTitle,\n };\n if (manifest.manifest_version === 3) {\n manifest.action = {\n ...options,\n default_popup,\n };\n } else {\n manifest[popup.options.mv2Key ?? 'browser_action'] = {\n ...options,\n default_popup,\n };\n }\n }\n\n if (devtools) {\n manifest.devtools_page = getEntrypointBundlePath(\n devtools,\n config.outDir,\n '.html',\n );\n }\n\n if (options) {\n const page = getEntrypointBundlePath(options, config.outDir, '.html');\n manifest.options_ui = {\n open_in_tab: options.options.openInTab,\n browser_style:\n config.browser === 'firefox' ? options.options.browserStyle : undefined,\n chrome_style:\n config.browser !== 'firefox' ? options.options.chromeStyle : undefined,\n page,\n };\n }\n\n if (sandboxes?.length) {\n if (config.browser === 'firefox') {\n config.logger.warn(\n 'Sandboxed pages not supported by Firefox. sandbox.pages was not added to the manifest',\n );\n } else {\n // @ts-expect-error: sandbox not typed\n manifest.sandbox = {\n pages: sandboxes.map((entry) =>\n getEntrypointBundlePath(entry, config.outDir, '.html'),\n ),\n };\n }\n }\n\n if (sidepanels?.length) {\n const defaultSidepanel =\n sidepanels.find((entry) => entry.name === 'sidepanel') ?? sidepanels[0];\n const page = getEntrypointBundlePath(\n defaultSidepanel,\n config.outDir,\n '.html',\n );\n\n if (config.browser === 'firefox') {\n manifest.sidebar_action = {\n // TODO: Add options to side panel\n // ...defaultSidepanel.options,\n default_panel: page,\n };\n } else if (config.manifestVersion === 3) {\n // @ts-expect-error: Untyped\n manifest.side_panel = {\n default_path: page,\n };\n } else {\n config.logger.warn(\n 'Side panel not supported by Chromium using MV2. side_panel.default_path was not added to the manifest',\n );\n }\n }\n\n if (contentScripts?.length) {\n const cssMap = getContentScriptsCssMap(buildOutput, contentScripts);\n\n // Don't add content scripts to the manifest in dev mode for MV3 - they're managed and reloaded\n // at runtime\n if (config.command === 'serve' && config.manifestVersion === 3) {\n const hostPermissions = new Set<string>(manifest.host_permissions ?? []);\n contentScripts.forEach((script) => {\n const matches = resolvePerBrowserOption(\n script.options.matches,\n config.browser,\n );\n matches.forEach((matchPattern) => {\n hostPermissions.add(matchPattern);\n });\n });\n hostPermissions.forEach((permission) =>\n addHostPermission(manifest, permission),\n );\n } else {\n const hashToEntrypointsMap = contentScripts.reduce((map, script) => {\n const hash = hashContentScriptOptions(script.options);\n if (map.has(hash)) map.get(hash)?.push(script);\n else map.set(hash, [script]);\n return map;\n }, new Map<string, ContentScriptEntrypoint[]>());\n\n const newContentScripts = Array.from(hashToEntrypointsMap.entries()).map(\n ([, scripts]) => ({\n ...mapWxtOptionsToContentScript(scripts[0].options, config),\n // TOOD: Sorting css and js arrays here so we get consistent test results... but we\n // shouldn't have to. Where is the inconsistency coming from?\n css: getContentScriptCssFiles(scripts, cssMap)?.sort(),\n js: scripts\n .map((entry) =>\n getEntrypointBundlePath(entry, config.outDir, '.js'),\n )\n .sort(),\n }),\n );\n if (newContentScripts.length >= 0) {\n manifest.content_scripts ??= [];\n manifest.content_scripts.push(...newContentScripts);\n }\n }\n\n const contentScriptCssResources = getContentScriptCssWebAccessibleResources(\n config,\n contentScripts,\n cssMap,\n );\n if (contentScriptCssResources.length > 0) {\n manifest.web_accessible_resources ??= [];\n manifest.web_accessible_resources.push(...contentScriptCssResources);\n }\n }\n}\n\nfunction discoverIcons(\n buildOutput: Omit<BuildOutput, 'manifest'>,\n): Manifest.WebExtensionManifest['icons'] {\n const icons: [string, string][] = [];\n // prettier-ignore\n // #region snippet\n const iconRegex = [\n /^icon-([0-9]+)\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon-16.png\n /^icon-([0-9]+)x[0-9]+\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon-16x16.png\n /^icon@([0-9]+)w\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon@16w.png\n /^icon@([0-9]+)h\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon@16h.png\n /^icon@([0-9]+)\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon@16.png\n /^icon[\\/\\\\]([0-9]+)\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon/16.png\n /^icon[\\/\\\\]([0-9]+)x[0-9]+\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon/16x16.png\n ];\n // #endregion snippet\n\n buildOutput.publicAssets.forEach((asset) => {\n let size: string | undefined;\n for (const regex of iconRegex) {\n const match = asset.fileName.match(regex);\n if (match?.[1] != null) {\n size = match[1];\n break;\n }\n }\n if (size == null) return;\n\n icons.push([size, normalizePath(asset.fileName)]);\n });\n\n return icons.length > 0 ? Object.fromEntries(icons) : undefined;\n}\n\nfunction addDevModeCsp(\n manifest: Manifest.WebExtensionManifest,\n config: InternalConfig,\n): void {\n const permission = `http://${config.server?.hostname ?? ''}/*`;\n const allowedCsp = config.server?.origin ?? 'http://localhost:*';\n\n if (manifest.manifest_version === 3) {\n addHostPermission(manifest, permission);\n } else {\n addPermission(manifest, permission);\n }\n\n const csp = new ContentSecurityPolicy(\n manifest.manifest_version === 3\n ? // @ts-expect-error: extension_pages is not typed\n manifest.content_security_policy?.extension_pages ??\n \"script-src 'self' 'wasm-unsafe-eval'; object-src 'self';\" // default CSP for MV3\n : manifest.content_security_policy ??\n \"script-src 'self'; object-src 'self';\", // default CSP for MV2\n );\n\n if (config.server) csp.add('script-src', allowedCsp);\n\n if (manifest.manifest_version === 3) {\n manifest.content_security_policy ??= {};\n // @ts-expect-error: extension_pages is not typed\n manifest.content_security_policy.extension_pages = csp.toString();\n } else {\n manifest.content_security_policy = csp.toString();\n }\n}\n\nfunction addDevModePermissions(\n manifest: Manifest.WebExtensionManifest,\n config: InternalConfig,\n) {\n // For reloading the page\n addPermission(manifest, 'tabs');\n\n // For registering content scripts\n if (config.manifestVersion === 3) addPermission(manifest, 'scripting');\n}\n\n/**\n * Returns the bundle paths to CSS files associated with a list of content scripts, or undefined if\n * there is no associated CSS.\n */\nexport function getContentScriptCssFiles(\n contentScripts: ContentScriptEntrypoint[],\n contentScriptCssMap: Record<string, string | undefined>,\n): string[] | undefined {\n const css: string[] = [];\n\n contentScripts.forEach((script) => {\n if (\n script.options.cssInjectionMode === 'manual' ||\n script.options.cssInjectionMode === 'ui'\n )\n return;\n\n const cssFile = contentScriptCssMap[script.name];\n if (cssFile == null) return;\n\n if (cssFile) css.push(cssFile);\n });\n\n if (css.length > 0) return css;\n return undefined;\n}\n\n/**\n * Content scripts configured with `cssInjectionMode: \"ui\"` need to add their CSS files to web\n * accessible resources so they can be fetched as text and added to shadow roots that the UI is\n * added to.\n */\nexport function getContentScriptCssWebAccessibleResources(\n config: InternalConfig,\n contentScripts: ContentScriptEntrypoint[],\n contentScriptCssMap: Record<string, string | undefined>,\n): any[] {\n const resources: any[] = [];\n\n contentScripts.forEach((script) => {\n if (script.options.cssInjectionMode !== 'ui') return;\n\n const cssFile = contentScriptCssMap[script.name];\n if (cssFile == null) return;\n\n if (config.manifestVersion === 2) {\n resources.push(cssFile);\n } else {\n resources.push({\n resources: [cssFile],\n matches: script.options.matches,\n });\n }\n });\n\n return resources;\n}\n\n/**\n * Based on the build output, return a Record of each content script's name to it CSS file if the\n * script includes one.\n */\nexport function getContentScriptsCssMap(\n buildOutput: Omit<BuildOutput, 'manifest'>,\n scripts: ContentScriptEntrypoint[],\n) {\n const map: Record<string, string | undefined> = {};\n const allChunks = buildOutput.steps.flatMap((step) => step.chunks);\n scripts.forEach((script) => {\n const relatedCss = allChunks.find(\n (chunk) => chunk.fileName === `content-scripts/${script.name}.css`,\n );\n if (relatedCss != null) map[script.name] = relatedCss.fileName;\n });\n return map;\n}\n\nfunction addPermission(\n manifest: Manifest.WebExtensionManifest,\n permission: string,\n): void {\n manifest.permissions ??= [];\n if (manifest.permissions.includes(permission)) return;\n manifest.permissions.push(permission);\n}\n\nfunction addHostPermission(\n manifest: Manifest.WebExtensionManifest,\n hostPermission: string,\n): void {\n manifest.host_permissions ??= [];\n if (manifest.host_permissions.includes(hostPermission)) return;\n manifest.host_permissions.push(hostPermission);\n}\n","/**\n * Directive names that make up CSPs. There are more, this is all I need for the plugin.\n */\nexport type CspDirective = 'default-src' | 'script-src' | 'object-src';\n\nexport class ContentSecurityPolicy {\n private static DIRECTIVE_ORDER: Record<string, number | undefined> = {\n 'default-src': 0,\n 'script-src': 1,\n 'object-src': 2,\n };\n\n data: Record<string, string[]>;\n\n constructor(csp?: string) {\n if (csp) {\n const sections = csp.split(';').map((section) => section.trim());\n this.data = sections.reduce<Record<string, string[]>>((data, section) => {\n const [key, ...values] = section.split(' ').map((item) => item.trim());\n if (key) data[key] = values;\n return data;\n }, {});\n } else {\n this.data = {};\n }\n }\n\n /**\n * Ensure a set of values are listed under a directive.\n */\n add(directive: CspDirective, ...newValues: string[]): ContentSecurityPolicy {\n const values = this.data[directive] ?? [];\n newValues.forEach((newValue) => {\n if (!values.includes(newValue)) values.push(newValue);\n });\n this.data[directive] = values;\n return this;\n }\n\n toString(): string {\n const directives = Object.entries(this.data).sort(([l], [r]) => {\n const lo = ContentSecurityPolicy.DIRECTIVE_ORDER[l] ?? 2;\n const ro = ContentSecurityPolicy.DIRECTIVE_ORDER[r] ?? 2;\n return lo - ro;\n });\n return directives.map((entry) => entry.flat().join(' ')).join('; ') + ';';\n }\n}\n","import { Manifest } from 'webextension-polyfill';\nimport { ContentScriptEntrypoint, InternalConfig } from '../types';\nimport { resolvePerBrowserOption } from './entrypoints';\n\n/**\n * Returns a unique and consistent string hash based on a content scripts options.\n *\n * It is able to recognize default values,\n */\nexport function hashContentScriptOptions(\n options: ContentScriptEntrypoint['options'],\n): string {\n const withDefaults: ContentScriptEntrypoint['options'] = {\n excludeGlobs: [],\n excludeMatches: [],\n includeGlobs: [],\n matchAboutBlank: false,\n matchOriginAsFallback: false,\n runAt: 'document_idle',\n allFrames: false,\n world: 'ISOLATED',\n // TODO: strip undefined fields from options object to improve content script grouping.\n ...options,\n };\n return JSON.stringify(\n Object.entries(withDefaults)\n // Sort any arrays so their values are consistent\n .map<[string, unknown]>(([key, value]) => {\n if (Array.isArray(value)) return [key, value.sort()];\n else return [key, value];\n })\n // Sort all the fields alphabetically\n .sort((l, r) => l[0].localeCompare(r[0])),\n );\n}\n\nexport function mapWxtOptionsToContentScript(\n options: ContentScriptEntrypoint['options'],\n config: InternalConfig,\n): Omit<Manifest.ContentScript, 'js' | 'css'> {\n return {\n matches: resolvePerBrowserOption(options.matches, config.browser),\n all_frames: resolvePerBrowserOption(options.allFrames, config.browser),\n match_about_blank: resolvePerBrowserOption(\n options.matchAboutBlank,\n config.browser,\n ),\n exclude_globs: resolvePerBrowserOption(\n options.excludeGlobs,\n config.browser,\n ),\n exclude_matches: resolvePerBrowserOption(\n options.excludeMatches,\n config.browser,\n ),\n include_globs: resolvePerBrowserOption(\n options.includeGlobs,\n config.browser,\n ),\n run_at: resolvePerBrowserOption(options.runAt, config.browser),\n\n // @ts-expect-error: untyped chrome options\n match_origin_as_fallback: resolvePerBrowserOption(\n options.matchOriginAsFallback,\n config.browser,\n ),\n world: options.world,\n };\n}\n","import { resolve } from 'node:path';\nimport { InternalConfig } from '../types';\nimport fs from 'fs-extra';\n\n/**\n * Read the project's package.json.\n *\n * TODO: look in root and up directories until it's found\n */\nexport async function getPackageJson(\n config: InternalConfig,\n): Promise<Partial<Record<string, any>> | undefined> {\n const file = resolve(config.root, 'package.json');\n try {\n return await fs.readJson(file);\n } catch (err) {\n config.logger.debug(\n `Failed to read package.json at: ${file}. Returning undefined.`,\n );\n return {};\n }\n}\n","import { Manifest } from 'webextension-polyfill';\nimport { BuildOutput } from './types';\nimport { buildEntrypoints } from './build/buildEntrypoints';\nimport { findEntrypoints } from './build/findEntrypoints';\nimport { generateTypesDir } from './build/generateTypesDir';\nimport { InternalConfig, EntrypointGroup } from './types';\nimport { generateMainfest, writeManifest } from './utils/manifest';\nimport pc from 'picocolors';\nimport * as vite from 'vite';\nimport fs from 'fs-extra';\nimport { groupEntrypoints } from './utils/groupEntrypoints';\nimport { formatDuration } from './utils/formatDuration';\nimport { printBuildSummary } from './log/printBuildSummary';\nimport { execaCommand } from 'execa';\nimport glob from 'fast-glob';\nimport { unnormalizePath } from './utils/paths';\n\n/**\n * Builds the extension based on an internal config.\n *\n * This function:\n * 1. Cleans the output directory\n * 2. Executes the rebuild function with a blank previous output so everything is built (see\n * `rebuild` for more details)\n * 3. Prints the summary\n */\nexport async function buildInternal(\n config: InternalConfig,\n): Promise<BuildOutput> {\n const verb = config.command === 'serve' ? 'Pre-rendering' : 'Building';\n const target = `${config.browser}-mv${config.manifestVersion}`;\n config.logger.info(\n `${verb} ${pc.cyan(target)} for ${pc.cyan(config.mode)} with ${pc.green(\n `Vite ${vite.version}`,\n )}`,\n );\n const startTime = Date.now();\n\n // Cleanup\n await fs.rm(config.outDir, { recursive: true, force: true });\n await fs.ensureDir(config.outDir);\n\n const entrypoints = await findEntrypoints(config);\n config.logger.debug('Detected entrypoints:', entrypoints);\n const groups = groupEntrypoints(entrypoints);\n const { output } = await rebuild(config, groups, undefined);\n\n // Post-build\n await printBuildSummary(\n config.logger.success,\n `Built extension in ${formatDuration(Date.now() - startTime)}`,\n output,\n config,\n );\n\n if (config.analysis.enabled) {\n await combineAnalysisStats(config);\n config.logger.info(\n `Analysis complete:\\n ${pc.gray('└─')} ${pc.yellow('stats.html')}`,\n );\n }\n\n return output;\n}\n\n/**\n * Given a configuration, list of entrypoints, and an existing, partial output, build the\n * entrypoints and merge the new output with the existing output.\n *\n * This function will:\n * 1. Generate the .wxt directory's types\n * 2. Build the `entrypointGroups` (and copies public files)\n * 3. Generate the latest manifest for all entrypoints\n * 4. Write the new manifest to the file system\n */\nexport async function rebuild(\n config: InternalConfig,\n entrypointGroups: EntrypointGroup[],\n existingOutput: Omit<BuildOutput, 'manifest'> = {\n steps: [],\n publicAssets: [],\n },\n): Promise<{ output: BuildOutput; manifest: Manifest.WebExtensionManifest }> {\n const { default: ora } = await import('ora');\n const spinner = ora(`Preparing...`).start();\n\n // Update types directory with new files and types\n const allEntrypoints = await findEntrypoints(config);\n await generateTypesDir(allEntrypoints, config).catch((err) => {\n config.logger.warn('Failed to update .wxt directory:', err);\n // Throw the error if doing a regular build, don't for dev mode.\n if (config.command === 'build') throw err;\n });\n\n // Build and merge the outputs\n const newOutput = await buildEntrypoints(entrypointGroups, config, spinner);\n const mergedOutput: Omit<BuildOutput, 'manifest'> = {\n steps: [...existingOutput.steps, ...newOutput.steps],\n publicAssets: [...existingOutput.publicAssets, ...newOutput.publicAssets],\n };\n\n const newManifest = await generateMainfest(\n allEntrypoints,\n mergedOutput,\n config,\n );\n const finalOutput: BuildOutput = {\n manifest: newManifest,\n ...newOutput,\n };\n\n // Write manifest\n await writeManifest(newManifest, finalOutput, config);\n\n // Stop the spinner and remove it from the CLI output\n spinner.clear().stop();\n\n return {\n output: {\n manifest: newManifest,\n steps: [...existingOutput.steps, ...finalOutput.steps],\n publicAssets: [\n ...existingOutput.publicAssets,\n ...finalOutput.publicAssets,\n ],\n },\n manifest: newManifest,\n };\n}\n\nasync function combineAnalysisStats(config: InternalConfig): Promise<void> {\n const unixFiles = await glob(`stats-*.json`, {\n cwd: config.outDir,\n absolute: true,\n });\n const absolutePaths = unixFiles.map(unnormalizePath);\n\n await execaCommand(\n `rollup-plugin-visualizer ${absolutePaths.join(' ')} --template ${\n config.analysis.template\n }`,\n { cwd: config.root, stdio: 'inherit' },\n );\n}\n","import { Entrypoint } from '../..';\nimport { EntrypointGroup } from '../types';\n\n/**\n * Entrypoints can be build in groups. HTML pages can all be built together in a single step, while\n * content scripts must be build individually.\n *\n * This function returns the entrypoints put into these types of groups.\n */\nexport function groupEntrypoints(entrypoints: Entrypoint[]): EntrypointGroup[] {\n const groupIndexMap: Partial<Record<Group, number>> = {};\n const groups: EntrypointGroup[] = [];\n\n for (const entry of entrypoints) {\n const group = ENTRY_TYPE_TO_GROUP_MAP[entry.type];\n if (group === 'no-group') {\n groups.push(entry);\n } else {\n let groupIndex = groupIndexMap[group];\n if (groupIndex == null) {\n groupIndex = groups.push([]) - 1;\n groupIndexMap[group] = groupIndex;\n }\n (groups[groupIndex] as Entrypoint[]).push(entry);\n }\n }\n\n return groups;\n}\n\nconst ENTRY_TYPE_TO_GROUP_MAP: Record<Entrypoint['type'], Group> = {\n sandbox: 'sandbox-page',\n\n popup: 'extension-page',\n newtab: 'extension-page',\n history: 'extension-page',\n options: 'extension-page',\n devtools: 'extension-page',\n bookmarks: 'extension-page',\n sidepanel: 'extension-page',\n 'unlisted-page': 'extension-page',\n\n background: 'no-group',\n 'content-script': 'no-group',\n 'unlisted-script': 'no-group',\n 'unlisted-style': 'no-group',\n 'content-script-style': 'no-group',\n};\n\ntype Group = 'extension-page' | 'sandbox-page' | 'no-group';\n","export function formatDuration(duration: number): string {\n if (duration < 1e3) return `${duration} ms`;\n if (duration < 10e3) return `${(duration / 1e3).toFixed(3)} s`;\n if (duration < 60e3) return `${(duration / 1e3).toFixed(1)} s`;\n return `${(duration / 1e3).toFixed(0)} s`;\n}\n","import { resolve } from 'path';\nimport { BuildOutput, InternalConfig } from '../types';\nimport { printFileList } from './printFileList';\n\nexport async function printBuildSummary(\n log: (...args: any[]) => void,\n header: string,\n output: BuildOutput,\n config: InternalConfig,\n) {\n const chunks = [\n ...output.steps.flatMap((step) => step.chunks),\n ...output.publicAssets,\n ].sort((l, r) => {\n const lWeight = getChunkSortWeight(l.fileName);\n const rWeight = getChunkSortWeight(r.fileName);\n const diff = lWeight - rWeight;\n if (diff !== 0) return diff;\n return l.fileName.localeCompare(r.fileName);\n });\n\n const files = chunks.map((chunk) => resolve(config.outDir, chunk.fileName));\n await printFileList(log, header, config.outDir, files);\n}\n\nconst DEFAULT_SORT_WEIGHT = 100;\nconst CHUNK_SORT_WEIGHTS: Record<string, number> = {\n 'manifest.json': 0,\n '.html': 1,\n '.js.map': 2,\n '.js': 2,\n '.css': 3,\n};\nfunction getChunkSortWeight(filename: string) {\n return (\n Object.entries(CHUNK_SORT_WEIGHTS).find(([key]) =>\n filename.endsWith(key),\n )?.[1] ?? DEFAULT_SORT_WEIGHT\n );\n}\n","import path from 'node:path';\nimport pc from 'picocolors';\nimport fs from 'fs-extra';\nimport { filesize } from 'filesize';\nimport { printTable } from './printTable';\n\nexport async function printFileList(\n log: (message: string) => void,\n header: string,\n baseDir: string,\n files: string[],\n): Promise<void> {\n let totalSize = 0;\n\n const fileRows: string[][] = await Promise.all(\n files.map(async (file, i) => {\n const parts = [\n path.relative(process.cwd(), baseDir) + path.sep,\n path.relative(baseDir, file),\n ];\n const prefix = i === files.length - 1 ? ' └─' : ' ├─';\n const color = getChunkColor(file);\n const stats = await fs.lstat(file);\n totalSize += stats.size;\n const size = String(filesize(stats.size));\n return [\n `${pc.gray(prefix)} ${pc.dim(parts[0])}${color(parts[1])}`,\n pc.dim(size),\n ];\n }),\n );\n\n fileRows.push([`${pc.cyan('Σ Total size:')} ${String(filesize(totalSize))}`]);\n\n printTable(log, header, fileRows);\n}\n\nconst DEFAULT_COLOR = pc.blue;\nconst CHUNK_COLORS: Record<string, (text: string) => string> = {\n '.js.map': pc.gray,\n '.html': pc.green,\n '.css': pc.magenta,\n '.js': pc.cyan,\n '.zip': pc.yellow,\n};\nfunction getChunkColor(filename: string) {\n return (\n Object.entries(CHUNK_COLORS).find(([key]) => filename.endsWith(key))?.[1] ??\n DEFAULT_COLOR\n );\n}\n","export function printTable(\n log: (message: string) => void,\n header: string,\n rows: string[][],\n gap = 2,\n): void {\n if (rows.length === 0) return;\n\n const columnWidths = rows.reduce(\n (widths, row) => {\n for (let i = 0; i < Math.max(widths.length, row.length); i++) {\n widths[i] = Math.max(row[i]?.length ?? 0, widths[i] ?? 0);\n }\n return widths;\n },\n rows[0].map((column) => column.length),\n );\n\n let str = '';\n rows.forEach((row, i) => {\n row.forEach((col, j) => {\n str += col.padEnd(columnWidths[j], ' ');\n if (j !== row.length - 1) str += ''.padEnd(gap, ' ');\n });\n if (i !== rows.length - 1) str += '\\n';\n });\n\n log(`${header}\\n${str}`);\n}\n","import {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport childProcess from 'node:child_process';\nimport process from 'node:process';\nimport crossSpawn from 'cross-spawn';\nimport stripFinalNewline from 'strip-final-newline';\nimport {npmRunPathEnv} from 'npm-run-path';\nimport onetime from 'onetime';\nimport {makeError} from './lib/error.js';\nimport {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';\nimport {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';\nimport {addPipeMethods} from './lib/pipe.js';\nimport {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';\nimport {mergePromise, getSpawnedPromise} from './lib/promise.js';\nimport {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';\nimport {logCommand, verboseDefault} from './lib/verbose.js';\n\nconst DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;\n\nconst getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {\n\tconst env = extendEnv ? {...process.env, ...envOption} : envOption;\n\n\tif (preferLocal) {\n\t\treturn npmRunPathEnv({env, cwd: localDir, execPath});\n\t}\n\n\treturn env;\n};\n\nconst handleArguments = (file, args, options = {}) => {\n\tconst parsed = crossSpawn._parse(file, args, options);\n\tfile = parsed.command;\n\targs = parsed.args;\n\toptions = parsed.options;\n\n\toptions = {\n\t\tmaxBuffer: DEFAULT_MAX_BUFFER,\n\t\tbuffer: true,\n\t\tstripFinalNewline: true,\n\t\textendEnv: true,\n\t\tpreferLocal: false,\n\t\tlocalDir: options.cwd || process.cwd(),\n\t\texecPath: process.execPath,\n\t\tencoding: 'utf8',\n\t\treject: true,\n\t\tcleanup: true,\n\t\tall: false,\n\t\twindowsHide: true,\n\t\tverbose: verboseDefault,\n\t\t...options,\n\t};\n\n\toptions.env = getEnv(options);\n\n\toptions.stdio = normalizeStdio(options);\n\n\tif (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {\n\t\t// #116\n\t\targs.unshift('/q');\n\t}\n\n\treturn {file, args, options, parsed};\n};\n\nconst handleOutput = (options, value, error) => {\n\tif (typeof value !== 'string' && !Buffer.isBuffer(value)) {\n\t\t// When `execaSync()` errors, we normalize it to '' to mimic `execa()`\n\t\treturn error === undefined ? undefined : '';\n\t}\n\n\tif (options.stripFinalNewline) {\n\t\treturn stripFinalNewline(value);\n\t}\n\n\treturn value;\n};\n\nexport function execa(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tvalidateTimeout(parsed.options);\n\n\tlet spawned;\n\ttry {\n\t\tspawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);\n\t} catch (error) {\n\t\t// Ensure the returned error is always both a promise and a child process\n\t\tconst dummySpawned = new childProcess.ChildProcess();\n\t\tconst errorPromise = Promise.reject(makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t}));\n\t\tmergePromise(dummySpawned, errorPromise);\n\t\treturn dummySpawned;\n\t}\n\n\tconst spawnedPromise = getSpawnedPromise(spawned);\n\tconst timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);\n\tconst processDone = setExitHandler(spawned, parsed.options, timedPromise);\n\n\tconst context = {isCanceled: false};\n\n\tspawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));\n\tspawned.cancel = spawnedCancel.bind(null, spawned, context);\n\n\tconst handlePromise = async () => {\n\t\tconst [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);\n\t\tconst stdout = handleOutput(parsed.options, stdoutResult);\n\t\tconst stderr = handleOutput(parsed.options, stderrResult);\n\t\tconst all = handleOutput(parsed.options, allResult);\n\n\t\tif (error || exitCode !== 0 || signal !== null) {\n\t\t\tconst returnedError = makeError({\n\t\t\t\terror,\n\t\t\t\texitCode,\n\t\t\t\tsignal,\n\t\t\t\tstdout,\n\t\t\t\tstderr,\n\t\t\t\tall,\n\t\t\t\tcommand,\n\t\t\t\tescapedCommand,\n\t\t\t\tparsed,\n\t\t\t\ttimedOut,\n\t\t\t\tisCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),\n\t\t\t\tkilled: spawned.killed,\n\t\t\t});\n\n\t\t\tif (!parsed.options.reject) {\n\t\t\t\treturn returnedError;\n\t\t\t}\n\n\t\t\tthrow returnedError;\n\t\t}\n\n\t\treturn {\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\texitCode: 0,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\tall,\n\t\t\tfailed: false,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t};\n\t};\n\n\tconst handlePromiseOnce = onetime(handlePromise);\n\n\thandleInput(spawned, parsed.options);\n\n\tspawned.all = makeAllStream(spawned, parsed.options);\n\n\taddPipeMethods(spawned);\n\tmergePromise(spawned, handlePromiseOnce);\n\treturn spawned;\n}\n\nexport function execaSync(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tconst input = handleInputSync(parsed.options);\n\n\tlet result;\n\ttry {\n\t\tresult = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});\n\t} catch (error) {\n\t\tthrow makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t});\n\t}\n\n\tconst stdout = handleOutput(parsed.options, result.stdout, result.error);\n\tconst stderr = handleOutput(parsed.options, result.stderr, result.error);\n\n\tif (result.error || result.status !== 0 || result.signal !== null) {\n\t\tconst error = makeError({\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\terror: result.error,\n\t\t\tsignal: result.signal,\n\t\t\texitCode: result.status,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: result.error && result.error.code === 'ETIMEDOUT',\n\t\t\tisCanceled: false,\n\t\t\tkilled: result.signal !== null,\n\t\t});\n\n\t\tif (!parsed.options.reject) {\n\t\t\treturn error;\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tcommand,\n\t\tescapedCommand,\n\t\texitCode: 0,\n\t\tstdout,\n\t\tstderr,\n\t\tfailed: false,\n\t\ttimedOut: false,\n\t\tisCanceled: false,\n\t\tkilled: false,\n\t};\n}\n\nconst normalizeScriptStdin = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined\n\t? {stdin: 'inherit'}\n\t: {};\n\nconst normalizeScriptOptions = (options = {}) => ({\n\tpreferLocal: true,\n\t...normalizeScriptStdin(options),\n\t...options,\n});\n\nfunction create$(options) {\n\tfunction $(templatesOrOptions, ...expressions) {\n\t\tif (!Array.isArray(templatesOrOptions)) {\n\t\t\treturn create$({...options, ...templatesOrOptions});\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templatesOrOptions, expressions);\n\t\treturn execa(file, args, normalizeScriptOptions(options));\n\t}\n\n\t$.sync = (templates, ...expressions) => {\n\t\tif (!Array.isArray(templates)) {\n\t\t\tthrow new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templates, expressions);\n\t\treturn execaSync(file, args, normalizeScriptOptions(options));\n\t};\n\n\treturn $;\n}\n\nexport const $ = create$();\n\nexport function execaCommand(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execa(file, args, options);\n}\n\nexport function execaCommandSync(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execaSync(file, args, options);\n}\n\nexport function execaNode(scriptPath, args, options = {}) {\n\tif (args && !Array.isArray(args) && typeof args === 'object') {\n\t\toptions = args;\n\t\targs = [];\n\t}\n\n\tconst stdio = normalizeStdioNode(options);\n\tconst defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));\n\n\tconst {\n\t\tnodePath = process.execPath,\n\t\tnodeOptions = defaultExecArgv,\n\t} = options;\n\n\treturn execa(\n\t\tnodePath,\n\t\t[\n\t\t\t...nodeOptions,\n\t\t\tscriptPath,\n\t\t\t...(Array.isArray(args) ? args : []),\n\t\t],\n\t\t{\n\t\t\t...options,\n\t\t\tstdin: undefined,\n\t\t\tstdout: undefined,\n\t\t\tstderr: undefined,\n\t\t\tstdio,\n\t\t\tshell: false,\n\t\t},\n\t);\n}\n","export default function stripFinalNewline(input) {\n\tconst LF = typeof input === 'string' ? '\\n' : '\\n'.charCodeAt();\n\tconst CR = typeof input === 'string' ? '\\r' : '\\r'.charCodeAt();\n\n\tif (input[input.length - 1] === LF) {\n\t\tinput = input.slice(0, -1);\n\t}\n\n\tif (input[input.length - 1] === CR) {\n\t\tinput = input.slice(0, -1);\n\t}\n\n\treturn input;\n}\n","import process from 'node:process';\nimport path from 'node:path';\nimport url from 'node:url';\nimport pathKey from 'path-key';\n\nexport function npmRunPath(options = {}) {\n\tconst {\n\t\tcwd = process.cwd(),\n\t\tpath: path_ = process.env[pathKey()],\n\t\texecPath = process.execPath,\n\t} = options;\n\n\tlet previous;\n\tconst cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;\n\tlet cwdPath = path.resolve(cwdString);\n\tconst result = [];\n\n\twhile (previous !== cwdPath) {\n\t\tresult.push(path.join(cwdPath, 'node_modules/.bin'));\n\t\tprevious = cwdPath;\n\t\tcwdPath = path.resolve(cwdPath, '..');\n\t}\n\n\t// Ensure the running `node` binary is used.\n\tresult.push(path.resolve(cwdString, execPath, '..'));\n\n\treturn [...result, path_].join(path.delimiter);\n}\n\nexport function npmRunPathEnv({env = process.env, ...options} = {}) {\n\tenv = {...env};\n\n\tconst path = pathKey({env});\n\toptions.path = env[path];\n\tenv[path] = npmRunPath(options);\n\n\treturn env;\n}\n","export default function pathKey(options = {}) {\n\tconst {\n\t\tenv = process.env,\n\t\tplatform = process.platform\n\t} = options;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n}\n","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable &&\n\t\ttoDescriptor.enumerable === fromDescriptor.enumerable &&\n\t\ttoDescriptor.configurable === fromDescriptor.configurable &&\n\t\t(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tObject.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","import mimicFunction from 'mimic-fn';\n\nconst calledFunctions = new WeakMap();\n\nconst onetime = (function_, options = {}) => {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError('Expected a function');\n\t}\n\n\tlet returnValue;\n\tlet callCount = 0;\n\tconst functionName = function_.displayName || function_.name || '<anonymous>';\n\n\tconst onetime = function (...arguments_) {\n\t\tcalledFunctions.set(onetime, ++callCount);\n\n\t\tif (callCount === 1) {\n\t\t\treturnValue = function_.apply(this, arguments_);\n\t\t\tfunction_ = null;\n\t\t} else if (options.throw === true) {\n\t\t\tthrow new Error(`Function \\`${functionName}\\` can only be called once`);\n\t\t}\n\n\t\treturn returnValue;\n\t};\n\n\tmimicFunction(onetime, function_);\n\tcalledFunctions.set(onetime, callCount);\n\n\treturn onetime;\n};\n\nonetime.callCount = function_ => {\n\tif (!calledFunctions.has(function_)) {\n\t\tthrow new Error(`The given function \\`${function_.name}\\` is not wrapped by the \\`onetime\\` package`);\n\t}\n\n\treturn calledFunctions.get(function_);\n};\n\nexport default onetime;\n","import process from 'node:process';\nimport {signalsByName} from 'human-signals';\n\nconst getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {\n\tif (timedOut) {\n\t\treturn `timed out after ${timeout} milliseconds`;\n\t}\n\n\tif (isCanceled) {\n\t\treturn 'was canceled';\n\t}\n\n\tif (errorCode !== undefined) {\n\t\treturn `failed with ${errorCode}`;\n\t}\n\n\tif (signal !== undefined) {\n\t\treturn `was killed with ${signal} (${signalDescription})`;\n\t}\n\n\tif (exitCode !== undefined) {\n\t\treturn `failed with exit code ${exitCode}`;\n\t}\n\n\treturn 'failed';\n};\n\nexport const makeError = ({\n\tstdout,\n\tstderr,\n\tall,\n\terror,\n\tsignal,\n\texitCode,\n\tcommand,\n\tescapedCommand,\n\ttimedOut,\n\tisCanceled,\n\tkilled,\n\tparsed: {options: {timeout, cwd = process.cwd()}},\n}) => {\n\t// `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.\n\t// We normalize them to `undefined`\n\texitCode = exitCode === null ? undefined : exitCode;\n\tsignal = signal === null ? undefined : signal;\n\tconst signalDescription = signal === undefined ? undefined : signalsByName[signal].description;\n\n\tconst errorCode = error && error.code;\n\n\tconst prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});\n\tconst execaMessage = `Command ${prefix}: ${command}`;\n\tconst isError = Object.prototype.toString.call(error) === '[object Error]';\n\tconst shortMessage = isError ? `${execaMessage}\\n${error.message}` : execaMessage;\n\tconst message = [shortMessage, stderr, stdout].filter(Boolean).join('\\n');\n\n\tif (isError) {\n\t\terror.originalMessage = error.message;\n\t\terror.message = message;\n\t} else {\n\t\terror = new Error(message);\n\t}\n\n\terror.shortMessage = shortMessage;\n\terror.command = command;\n\terror.escapedCommand = escapedCommand;\n\terror.exitCode = exitCode;\n\terror.signal = signal;\n\terror.signalDescription = signalDescription;\n\terror.stdout = stdout;\n\terror.stderr = stderr;\n\terror.cwd = cwd;\n\n\tif (all !== undefined) {\n\t\terror.all = all;\n\t}\n\n\tif ('bufferedData' in error) {\n\t\tdelete error.bufferedData;\n\t}\n\n\terror.failed = true;\n\terror.timedOut = Boolean(timedOut);\n\terror.isCanceled = isCanceled;\n\terror.killed = killed && !timedOut;\n\n\treturn error;\n};\n","import{constants}from\"node:os\";\n\nimport{SIGRTMAX}from\"./realtime.js\";\nimport{getSignals}from\"./signals.js\";\n\n\n\nconst getSignalsByName=()=>{\nconst signals=getSignals();\nreturn Object.fromEntries(signals.map(getSignalByName));\n};\n\nconst getSignalByName=({\nname,\nnumber,\ndescription,\nsupported,\naction,\nforced,\nstandard\n})=>[name,{name,number,description,supported,action,forced,standard}];\n\nexport const signalsByName=getSignalsByName();\n\n\n\n\nconst getSignalsByNumber=()=>{\nconst signals=getSignals();\nconst length=SIGRTMAX+1;\nconst signalsA=Array.from({length},(value,number)=>\ngetSignalByNumber(number,signals));\n\nreturn Object.assign({},...signalsA);\n};\n\nconst getSignalByNumber=(number,signals)=>{\nconst signal=findSignalByNumber(number,signals);\n\nif(signal===undefined){\nreturn{};\n}\n\nconst{name,description,supported,action,forced,standard}=signal;\nreturn{\n[number]:{\nname,\nnumber,\ndescription,\nsupported,\naction,\nforced,\nstandard\n}\n};\n};\n\n\n\nconst findSignalByNumber=(number,signals)=>{\nconst signal=signals.find(({name})=>constants.signals[name]===number);\n\nif(signal!==undefined){\nreturn signal;\n}\n\nreturn signals.find((signalA)=>signalA.number===number);\n};\n\nexport const signalsByNumber=getSignalsByNumber();","\nexport const getRealtimeSignals=()=>{\nconst length=SIGRTMAX-SIGRTMIN+1;\nreturn Array.from({length},getRealtimeSignal);\n};\n\nconst getRealtimeSignal=(value,index)=>({\nname:`SIGRT${index+1}`,\nnumber:SIGRTMIN+index,\naction:\"terminate\",\ndescription:\"Application-specific signal (realtime)\",\nstandard:\"posix\"\n});\n\nconst SIGRTMIN=34;\nexport const SIGRTMAX=64;","import{constants}from\"node:os\";\n\nimport{SIGNALS}from\"./core.js\";\nimport{getRealtimeSignals}from\"./realtime.js\";\n\n\n\nexport const getSignals=()=>{\nconst realtimeSignals=getRealtimeSignals();\nconst signals=[...SIGNALS,...realtimeSignals].map(normalizeSignal);\nreturn signals;\n};\n\n\n\n\n\n\n\nconst normalizeSignal=({\nname,\nnumber:defaultNumber,\ndescription,\naction,\nforced=false,\nstandard\n})=>{\nconst{\nsignals:{[name]:constantSignal}\n}=constants;\nconst supported=constantSignal!==undefined;\nconst number=supported?constantSignal:defaultNumber;\nreturn{name,number,description,supported,action,forced,standard};\n};","\n\nexport const SIGNALS=[\n{\nname:\"SIGHUP\",\nnumber:1,\naction:\"terminate\",\ndescription:\"Terminal closed\",\nstandard:\"posix\"\n},\n{\nname:\"SIGINT\",\nnumber:2,\naction:\"terminate\",\ndescription:\"User interruption with CTRL-C\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGQUIT\",\nnumber:3,\naction:\"core\",\ndescription:\"User interruption with CTRL-\\\\\",\nstandard:\"posix\"\n},\n{\nname:\"SIGILL\",\nnumber:4,\naction:\"core\",\ndescription:\"Invalid machine instruction\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGTRAP\",\nnumber:5,\naction:\"core\",\ndescription:\"Debugger breakpoint\",\nstandard:\"posix\"\n},\n{\nname:\"SIGABRT\",\nnumber:6,\naction:\"core\",\ndescription:\"Aborted\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGIOT\",\nnumber:6,\naction:\"core\",\ndescription:\"Aborted\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGBUS\",\nnumber:7,\naction:\"core\",\ndescription:\n\"Bus error due to misaligned, non-existing address or paging error\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGEMT\",\nnumber:7,\naction:\"terminate\",\ndescription:\"Command should be emulated but is not implemented\",\nstandard:\"other\"\n},\n{\nname:\"SIGFPE\",\nnumber:8,\naction:\"core\",\ndescription:\"Floating point arithmetic error\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGKILL\",\nnumber:9,\naction:\"terminate\",\ndescription:\"Forced termination\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGUSR1\",\nnumber:10,\naction:\"terminate\",\ndescription:\"Application-specific signal\",\nstandard:\"posix\"\n},\n{\nname:\"SIGSEGV\",\nnumber:11,\naction:\"core\",\ndescription:\"Segmentation fault\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGUSR2\",\nnumber:12,\naction:\"terminate\",\ndescription:\"Application-specific signal\",\nstandard:\"posix\"\n},\n{\nname:\"SIGPIPE\",\nnumber:13,\naction:\"terminate\",\ndescription:\"Broken pipe or socket\",\nstandard:\"posix\"\n},\n{\nname:\"SIGALRM\",\nnumber:14,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"posix\"\n},\n{\nname:\"SIGTERM\",\nnumber:15,\naction:\"terminate\",\ndescription:\"Termination\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGSTKFLT\",\nnumber:16,\naction:\"terminate\",\ndescription:\"Stack is empty or overflowed\",\nstandard:\"other\"\n},\n{\nname:\"SIGCHLD\",\nnumber:17,\naction:\"ignore\",\ndescription:\"Child process terminated, paused or unpaused\",\nstandard:\"posix\"\n},\n{\nname:\"SIGCLD\",\nnumber:17,\naction:\"ignore\",\ndescription:\"Child process terminated, paused or unpaused\",\nstandard:\"other\"\n},\n{\nname:\"SIGCONT\",\nnumber:18,\naction:\"unpause\",\ndescription:\"Unpaused\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGSTOP\",\nnumber:19,\naction:\"pause\",\ndescription:\"Paused\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGTSTP\",\nnumber:20,\naction:\"pause\",\ndescription:\"Paused using CTRL-Z or \\\"suspend\\\"\",\nstandard:\"posix\"\n},\n{\nname:\"SIGTTIN\",\nnumber:21,\naction:\"pause\",\ndescription:\"Background process cannot read terminal input\",\nstandard:\"posix\"\n},\n{\nname:\"SIGBREAK\",\nnumber:21,\naction:\"terminate\",\ndescription:\"User interruption with CTRL-BREAK\",\nstandard:\"other\"\n},\n{\nname:\"SIGTTOU\",\nnumber:22,\naction:\"pause\",\ndescription:\"Background process cannot write to terminal output\",\nstandard:\"posix\"\n},\n{\nname:\"SIGURG\",\nnumber:23,\naction:\"ignore\",\ndescription:\"Socket received out-of-band data\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGXCPU\",\nnumber:24,\naction:\"core\",\ndescription:\"Process timed out\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGXFSZ\",\nnumber:25,\naction:\"core\",\ndescription:\"File too big\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGVTALRM\",\nnumber:26,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGPROF\",\nnumber:27,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGWINCH\",\nnumber:28,\naction:\"ignore\",\ndescription:\"Terminal window size changed\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGIO\",\nnumber:29,\naction:\"terminate\",\ndescription:\"I/O is available\",\nstandard:\"other\"\n},\n{\nname:\"SIGPOLL\",\nnumber:29,\naction:\"terminate\",\ndescription:\"Watched event\",\nstandard:\"other\"\n},\n{\nname:\"SIGINFO\",\nnumber:29,\naction:\"ignore\",\ndescription:\"Request for process information\",\nstandard:\"other\"\n},\n{\nname:\"SIGPWR\",\nnumber:30,\naction:\"terminate\",\ndescription:\"Device running out of power\",\nstandard:\"systemv\"\n},\n{\nname:\"SIGSYS\",\nnumber:31,\naction:\"core\",\ndescription:\"Invalid system call\",\nstandard:\"other\"\n},\n{\nname:\"SIGUNUSED\",\nnumber:31,\naction:\"terminate\",\ndescription:\"Invalid system call\",\nstandard:\"other\"\n}];","const aliases = ['stdin', 'stdout', 'stderr'];\n\nconst hasAlias = options => aliases.some(alias => options[alias] !== undefined);\n\nexport const normalizeStdio = options => {\n\tif (!options) {\n\t\treturn;\n\t}\n\n\tconst {stdio} = options;\n\n\tif (stdio === undefined) {\n\t\treturn aliases.map(alias => options[alias]);\n\t}\n\n\tif (hasAlias(options)) {\n\t\tthrow new Error(`It's not possible to provide \\`stdio\\` in combination with one of ${aliases.map(alias => `\\`${alias}\\``).join(', ')}`);\n\t}\n\n\tif (typeof stdio === 'string') {\n\t\treturn stdio;\n\t}\n\n\tif (!Array.isArray(stdio)) {\n\t\tthrow new TypeError(`Expected \\`stdio\\` to be of type \\`string\\` or \\`Array\\`, got \\`${typeof stdio}\\``);\n\t}\n\n\tconst length = Math.max(stdio.length, aliases.length);\n\treturn Array.from({length}, (value, index) => stdio[index]);\n};\n\n// `ipc` is pushed unless it is already present\nexport const normalizeStdioNode = options => {\n\tconst stdio = normalizeStdio(options);\n\n\tif (stdio === 'ipc') {\n\t\treturn 'ipc';\n\t}\n\n\tif (stdio === undefined || typeof stdio === 'string') {\n\t\treturn [stdio, stdio, stdio, 'ipc'];\n\t}\n\n\tif (stdio.includes('ipc')) {\n\t\treturn stdio;\n\t}\n\n\treturn [...stdio, 'ipc'];\n};\n","import os from 'node:os';\nimport onExit from 'signal-exit';\n\nconst DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;\n\n// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior\nexport const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {\n\tconst killResult = kill(signal);\n\tsetKillTimeout(kill, signal, options, killResult);\n\treturn killResult;\n};\n\nconst setKillTimeout = (kill, signal, options, killResult) => {\n\tif (!shouldForceKill(signal, options, killResult)) {\n\t\treturn;\n\t}\n\n\tconst timeout = getForceKillAfterTimeout(options);\n\tconst t = setTimeout(() => {\n\t\tkill('SIGKILL');\n\t}, timeout);\n\n\t// Guarded because there's no `.unref()` when `execa` is used in the renderer\n\t// process in Electron. This cannot be tested since we don't run tests in\n\t// Electron.\n\t// istanbul ignore else\n\tif (t.unref) {\n\t\tt.unref();\n\t}\n};\n\nconst shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;\n\nconst isSigterm = signal => signal === os.constants.signals.SIGTERM\n\t\t|| (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');\n\nconst getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {\n\tif (forceKillAfterTimeout === true) {\n\t\treturn DEFAULT_FORCE_KILL_TIMEOUT;\n\t}\n\n\tif (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {\n\t\tthrow new TypeError(`Expected the \\`forceKillAfterTimeout\\` option to be a non-negative integer, got \\`${forceKillAfterTimeout}\\` (${typeof forceKillAfterTimeout})`);\n\t}\n\n\treturn forceKillAfterTimeout;\n};\n\n// `childProcess.cancel()`\nexport const spawnedCancel = (spawned, context) => {\n\tconst killResult = spawned.kill();\n\n\tif (killResult) {\n\t\tcontext.isCanceled = true;\n\t}\n};\n\nconst timeoutKill = (spawned, signal, reject) => {\n\tspawned.kill(signal);\n\treject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));\n};\n\n// `timeout` option handling\nexport const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {\n\tif (timeout === 0 || timeout === undefined) {\n\t\treturn spawnedPromise;\n\t}\n\n\tlet timeoutId;\n\tconst timeoutPromise = new Promise((resolve, reject) => {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimeoutKill(spawned, killSignal, reject);\n\t\t}, timeout);\n\t});\n\n\tconst safeSpawnedPromise = spawnedPromise.finally(() => {\n\t\tclearTimeout(timeoutId);\n\t});\n\n\treturn Promise.race([timeoutPromise, safeSpawnedPromise]);\n};\n\nexport const validateTimeout = ({timeout}) => {\n\tif (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) {\n\t\tthrow new TypeError(`Expected the \\`timeout\\` option to be a non-negative integer, got \\`${timeout}\\` (${typeof timeout})`);\n\t}\n};\n\n// `cleanup` option handling\nexport const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {\n\tif (!cleanup || detached) {\n\t\treturn timedPromise;\n\t}\n\n\tconst removeExitHandler = onExit(() => {\n\t\tspawned.kill();\n\t});\n\n\treturn timedPromise.finally(() => {\n\t\tremoveExitHandler();\n\t});\n};\n","import {createWriteStream} from 'node:fs';\nimport {ChildProcess} from 'node:child_process';\nimport {isWritableStream} from 'is-stream';\n\nconst isExecaChildProcess = target => target instanceof ChildProcess && typeof target.then === 'function';\n\nconst pipeToTarget = (spawned, streamName, target) => {\n\tif (typeof target === 'string') {\n\t\tspawned[streamName].pipe(createWriteStream(target));\n\t\treturn spawned;\n\t}\n\n\tif (isWritableStream(target)) {\n\t\tspawned[streamName].pipe(target);\n\t\treturn spawned;\n\t}\n\n\tif (!isExecaChildProcess(target)) {\n\t\tthrow new TypeError('The second argument must be a string, a stream or an Execa child process.');\n\t}\n\n\tif (!isWritableStream(target.stdin)) {\n\t\tthrow new TypeError('The target child process\\'s stdin must be available.');\n\t}\n\n\tspawned[streamName].pipe(target.stdin);\n\treturn target;\n};\n\nexport const addPipeMethods = spawned => {\n\tif (spawned.stdout !== null) {\n\t\tspawned.pipeStdout = pipeToTarget.bind(undefined, spawned, 'stdout');\n\t}\n\n\tif (spawned.stderr !== null) {\n\t\tspawned.pipeStderr = pipeToTarget.bind(undefined, spawned, 'stderr');\n\t}\n\n\tif (spawned.all !== undefined) {\n\t\tspawned.pipeAll = pipeToTarget.bind(undefined, spawned, 'all');\n\t}\n};\n","export function isStream(stream) {\n\treturn stream !== null\n\t\t&& typeof stream === 'object'\n\t\t&& typeof stream.pipe === 'function';\n}\n\nexport function isWritableStream(stream) {\n\treturn isStream(stream)\n\t\t&& stream.writable !== false\n\t\t&& typeof stream._write === 'function'\n\t\t&& typeof stream._writableState === 'object';\n}\n\nexport function isReadableStream(stream) {\n\treturn isStream(stream)\n\t\t&& stream.readable !== false\n\t\t&& typeof stream._read === 'function'\n\t\t&& typeof stream._readableState === 'object';\n}\n\nexport function isDuplexStream(stream) {\n\treturn isWritableStream(stream)\n\t\t&& isReadableStream(stream);\n}\n\nexport function isTransformStream(stream) {\n\treturn isDuplexStream(stream)\n\t\t&& typeof stream._transform === 'function';\n}\n","import {createReadStream, readFileSync} from 'node:fs';\nimport {isStream} from 'is-stream';\nimport getStream from 'get-stream';\nimport mergeStream from 'merge-stream';\n\nconst validateInputOptions = input => {\n\tif (input !== undefined) {\n\t\tthrow new TypeError('The `input` and `inputFile` options cannot be both set.');\n\t}\n};\n\nconst getInputSync = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn readFileSync(inputFile);\n};\n\n// `input` and `inputFile` option in sync mode\nexport const handleInputSync = options => {\n\tconst input = getInputSync(options);\n\n\tif (isStream(input)) {\n\t\tthrow new TypeError('The `input` option cannot be a stream in sync mode');\n\t}\n\n\treturn input;\n};\n\nconst getInput = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn createReadStream(inputFile);\n};\n\n// `input` and `inputFile` option in async mode\nexport const handleInput = (spawned, options) => {\n\tconst input = getInput(options);\n\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\n\tif (isStream(input)) {\n\t\tinput.pipe(spawned.stdin);\n\t} else {\n\t\tspawned.stdin.end(input);\n\t}\n};\n\n// `all` interleaves `stdout` and `stderr`\nexport const makeAllStream = (spawned, {all}) => {\n\tif (!all || (!spawned.stdout && !spawned.stderr)) {\n\t\treturn;\n\t}\n\n\tconst mixed = mergeStream();\n\n\tif (spawned.stdout) {\n\t\tmixed.add(spawned.stdout);\n\t}\n\n\tif (spawned.stderr) {\n\t\tmixed.add(spawned.stderr);\n\t}\n\n\treturn mixed;\n};\n\n// On failure, `result.stdout|stderr|all` should contain the currently buffered stream\nconst getBufferedData = async (stream, streamPromise) => {\n\t// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve\n\tif (!stream || streamPromise === undefined) {\n\t\treturn;\n\t}\n\n\tstream.destroy();\n\n\ttry {\n\t\treturn await streamPromise;\n\t} catch (error) {\n\t\treturn error.bufferedData;\n\t}\n};\n\nconst getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {\n\tif (!stream || !buffer) {\n\t\treturn;\n\t}\n\n\tif (encoding) {\n\t\treturn getStream(stream, {encoding, maxBuffer});\n\t}\n\n\treturn getStream.buffer(stream, {maxBuffer});\n};\n\n// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)\nexport const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {\n\tconst stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});\n\tconst stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});\n\tconst allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});\n\n\ttry {\n\t\treturn await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);\n\t} catch (error) {\n\t\treturn Promise.all([\n\t\t\t{error, signal: error.signal, timedOut: error.timedOut},\n\t\t\tgetBufferedData(stdout, stdoutPromise),\n\t\t\tgetBufferedData(stderr, stderrPromise),\n\t\t\tgetBufferedData(all, allPromise),\n\t\t]);\n\t}\n};\n","// eslint-disable-next-line unicorn/prefer-top-level-await\nconst nativePromisePrototype = (async () => {})().constructor.prototype;\n\nconst descriptors = ['then', 'catch', 'finally'].map(property => [\n\tproperty,\n\tReflect.getOwnPropertyDescriptor(nativePromisePrototype, property),\n]);\n\n// The return value is a mixin of `childProcess` and `Promise`\nexport const mergePromise = (spawned, promise) => {\n\tfor (const [property, descriptor] of descriptors) {\n\t\t// Starting the main `promise` is deferred to avoid consuming streams\n\t\tconst value = typeof promise === 'function'\n\t\t\t? (...args) => Reflect.apply(descriptor.value, promise(), args)\n\t\t\t: descriptor.value.bind(promise);\n\n\t\tReflect.defineProperty(spawned, property, {...descriptor, value});\n\t}\n};\n\n// Use promises instead of `child_process` events\nexport const getSpawnedPromise = spawned => new Promise((resolve, reject) => {\n\tspawned.on('exit', (exitCode, signal) => {\n\t\tresolve({exitCode, signal});\n\t});\n\n\tspawned.on('error', error => {\n\t\treject(error);\n\t});\n\n\tif (spawned.stdin) {\n\t\tspawned.stdin.on('error', error => {\n\t\t\treject(error);\n\t\t});\n\t}\n});\n","import {Buffer} from 'node:buffer';\nimport {ChildProcess} from 'node:child_process';\n\nconst normalizeArgs = (file, args = []) => {\n\tif (!Array.isArray(args)) {\n\t\treturn [file];\n\t}\n\n\treturn [file, ...args];\n};\n\nconst NO_ESCAPE_REGEXP = /^[\\w.-]+$/;\nconst DOUBLE_QUOTES_REGEXP = /\"/g;\n\nconst escapeArg = arg => {\n\tif (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) {\n\t\treturn arg;\n\t}\n\n\treturn `\"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\\\\"')}\"`;\n};\n\nexport const joinCommand = (file, args) => normalizeArgs(file, args).join(' ');\n\nexport const getEscapedCommand = (file, args) => normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');\n\nconst SPACES_REGEXP = / +/g;\n\n// Handle `execaCommand()`\nexport const parseCommand = command => {\n\tconst tokens = [];\n\tfor (const token of command.trim().split(SPACES_REGEXP)) {\n\t\t// Allow spaces to be escaped by a backslash if not meant as a delimiter\n\t\tconst previousToken = tokens[tokens.length - 1];\n\t\tif (previousToken && previousToken.endsWith('\\\\')) {\n\t\t\t// Merge previous token with current one\n\t\t\ttokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;\n\t\t} else {\n\t\t\ttokens.push(token);\n\t\t}\n\t}\n\n\treturn tokens;\n};\n\nconst parseExpression = expression => {\n\tconst typeOfExpression = typeof expression;\n\n\tif (typeOfExpression === 'string') {\n\t\treturn expression;\n\t}\n\n\tif (typeOfExpression === 'number') {\n\t\treturn String(expression);\n\t}\n\n\tif (\n\t\ttypeOfExpression === 'object'\n\t\t&& expression !== null\n\t\t&& !(expression instanceof ChildProcess)\n\t\t&& 'stdout' in expression\n\t) {\n\t\tconst typeOfStdout = typeof expression.stdout;\n\n\t\tif (typeOfStdout === 'string') {\n\t\t\treturn expression.stdout;\n\t\t}\n\n\t\tif (Buffer.isBuffer(expression.stdout)) {\n\t\t\treturn expression.stdout.toString();\n\t\t}\n\n\t\tthrow new TypeError(`Unexpected \"${typeOfStdout}\" stdout in template expression`);\n\t}\n\n\tthrow new TypeError(`Unexpected \"${typeOfExpression}\" in template expression`);\n};\n\nconst concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0\n\t? [...tokens, ...nextTokens]\n\t: [\n\t\t...tokens.slice(0, -1),\n\t\t`${tokens[tokens.length - 1]}${nextTokens[0]}`,\n\t\t...nextTokens.slice(1),\n\t];\n\nconst parseTemplate = ({templates, expressions, tokens, index, template}) => {\n\tconst templateString = template ?? templates.raw[index];\n\tconst templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);\n\tconst newTokens = concatTokens(\n\t\ttokens,\n\t\ttemplateTokens,\n\t\ttemplateString.startsWith(' '),\n\t);\n\n\tif (index === expressions.length) {\n\t\treturn newTokens;\n\t}\n\n\tconst expression = expressions[index];\n\tconst expressionTokens = Array.isArray(expression)\n\t\t? expression.map(expression => parseExpression(expression))\n\t\t: [parseExpression(expression)];\n\treturn concatTokens(\n\t\tnewTokens,\n\t\texpressionTokens,\n\t\ttemplateString.endsWith(' '),\n\t);\n};\n\nexport const parseTemplates = (templates, expressions) => {\n\tlet tokens = [];\n\n\tfor (const [index, template] of templates.entries()) {\n\t\ttokens = parseTemplate({templates, expressions, tokens, index, template});\n\t}\n\n\treturn tokens;\n};\n\n","import {debuglog} from 'node:util';\nimport process from 'node:process';\n\nexport const verboseDefault = debuglog('execa').enabled;\n\nconst padField = (field, padding) => String(field).padStart(padding, '0');\n\nconst getTimestamp = () => {\n\tconst date = new Date();\n\treturn `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;\n};\n\nexport const logCommand = (escapedCommand, {verbose}) => {\n\tif (!verbose) {\n\t\treturn;\n\t}\n\n\tprocess.stderr.write(`[${getTimestamp()}] ${escapedCommand}\\n`);\n};\n","import {\n BuildStepOutput,\n EntrypointGroup,\n InternalConfig,\n WxtDevServer,\n} from './types';\nimport * as vite from 'vite';\nimport { Scripting } from 'webextension-polyfill';\nimport {\n getEntrypointBundlePath,\n resolvePerBrowserOption,\n} from './utils/entrypoints';\nimport {\n getContentScriptCssFiles,\n getContentScriptsCssMap,\n} from './utils/manifest';\nimport { buildInternal } from './build';\nimport { createExtensionRunner } from './runners';\n\nexport async function getServerInfo(): Promise<ServerInfo> {\n const { default: getPort, portNumbers } = await import('get-port');\n const port = await getPort({ port: portNumbers(3000, 3010) });\n const hostname = 'localhost';\n const origin = `http://${hostname}:${port}`;\n const serverConfig: vite.InlineConfig = {\n server: {\n origin,\n },\n };\n\n return {\n port,\n hostname,\n origin,\n viteServerConfig: serverConfig,\n };\n}\n\nexport async function setupServer(\n serverInfo: ServerInfo,\n config: InternalConfig,\n): Promise<WxtDevServer> {\n const runner = await createExtensionRunner(config);\n\n const viteServer = await vite.createServer(\n vite.mergeConfig(serverInfo, await config.vite(config.env)),\n );\n\n const start = async () => {\n await viteServer.listen(server.port);\n config.logger.success(`Started dev server @ ${serverInfo.origin}`);\n\n server.currentOutput = await buildInternal(config);\n await runner.openBrowser(config);\n };\n\n const reloadExtension = () => {\n viteServer.ws.send('wxt:reload-extension');\n };\n const reloadPage = (path: string) => {\n // Can't use Vite's built-in \"full-reload\" event because it doesn't like our paths, it expects\n // paths ending in \"/index.html\"\n viteServer.ws.send('wxt:reload-page', path);\n };\n const reloadContentScript = (\n contentScript: Omit<Scripting.RegisteredContentScript, 'id'>,\n ) => {\n viteServer.ws.send('wxt:reload-content-script', contentScript);\n };\n\n const server: WxtDevServer = {\n ...viteServer,\n start,\n currentOutput: {\n manifest: {\n manifest_version: 3,\n name: '',\n version: '',\n },\n publicAssets: [],\n steps: [],\n },\n port: serverInfo.port,\n hostname: serverInfo.hostname,\n origin: serverInfo.origin,\n reloadExtension,\n reloadPage,\n reloadContentScript,\n };\n\n return server;\n}\n\n/**\n * From the server, tell the client to reload content scripts from the provided build step outputs.\n */\nexport function reloadContentScripts(\n steps: BuildStepOutput[],\n config: InternalConfig,\n server: WxtDevServer,\n) {\n if (config.manifestVersion === 3) {\n steps.forEach((step) => {\n const entry = step.entrypoints;\n if (Array.isArray(entry) || entry.type !== 'content-script') return;\n\n const js = [getEntrypointBundlePath(entry, config.outDir, '.js')];\n const cssMap = getContentScriptsCssMap(server.currentOutput, [entry]);\n const css = getContentScriptCssFiles([entry], cssMap);\n\n server.reloadContentScript({\n allFrames: resolvePerBrowserOption(\n entry.options.allFrames,\n config.browser,\n ),\n excludeMatches: resolvePerBrowserOption(\n entry.options.excludeMatches,\n config.browser,\n ),\n matches: resolvePerBrowserOption(entry.options.matches, config.browser),\n runAt: resolvePerBrowserOption(entry.options.runAt, config.browser),\n // @ts-expect-error: Chrome accepts this, not typed in webextension-polyfill (https://developer.chrome.com/docs/extensions/reference/scripting/#type-RegisteredContentScript)\n world: resolvePerBrowserOption(entry.options.world, config.browser),\n js,\n css,\n });\n });\n } else {\n server.reloadExtension();\n }\n}\n\nexport function reloadHtmlPages(\n groups: EntrypointGroup[],\n server: WxtDevServer,\n config: InternalConfig,\n) {\n groups.flat().forEach((entry) => {\n const path = getEntrypointBundlePath(entry, config.outDir, '.html');\n server.reloadPage(path);\n });\n}\n\ninterface ServerInfo {\n port: number;\n hostname: string;\n origin: string;\n viteServerConfig: vite.InlineConfig;\n}\n","import { ExtensionRunner } from './extension-runner';\nimport { relative } from 'node:path';\n\n/**\n * The WSL runner just logs a warning message because `web-ext` doesn't work in WSL.\n */\nexport function createWslRunner(): ExtensionRunner {\n return {\n async openBrowser(config) {\n config.logger.warn(\n `Cannot open browser when using WSL. Load \"${relative(\n process.cwd(),\n config.outDir,\n )}\" as an unpacked extension manually`,\n );\n },\n async closeBrowser() {\n // noop\n },\n };\n}\n","import type { WebExtRunInstance } from 'web-ext-run';\nimport { ExtensionRunner } from './extension-runner';\n\n/**\n * Create an `ExtensionRunner` backed by `web-ext`.\n */\nexport function createWebExtRunner(): ExtensionRunner {\n let runner: WebExtRunInstance | undefined;\n\n return {\n async openBrowser(config) {\n config.logger.info('Opening browser...');\n\n // Use the plugin's logger instead of web-ext's built-in one.\n const webExtLogger = await import('web-ext-run/util/logger');\n webExtLogger.consoleStream.write = ({ level, msg, name }) => {\n if (level >= ERROR_LOG_LEVEL) config.logger.error(name, msg);\n if (level >= WARN_LOG_LEVEL) config.logger.warn(msg);\n };\n\n const wxtUserConfig = config.runnerConfig.config;\n const userConfig = {\n console: wxtUserConfig?.openConsole,\n devtools: wxtUserConfig?.openDevtools,\n startUrl: wxtUserConfig?.startUrls,\n ...(config.browser === 'firefox'\n ? {\n firefox: wxtUserConfig?.binaries?.firefox,\n firefoxProfile: wxtUserConfig?.firefoxProfile,\n prefs: wxtUserConfig?.firefoxPrefs,\n args: wxtUserConfig?.firefoxArgs,\n }\n : {\n chromiumBinary: wxtUserConfig?.binaries?.[config.browser],\n chromiumProfile: wxtUserConfig?.chromiumProfile,\n args: wxtUserConfig?.chromiumArgs,\n }),\n };\n\n const finalConfig = {\n ...userConfig,\n target: config.browser === 'firefox' ? 'firefox-desktop' : 'chromium',\n sourceDir: config.outDir,\n // WXT handles reloads, so disable auto-reload behaviors in web-ext\n noReload: true,\n noInput: true,\n };\n const options = {\n // Don't call `process.exit(0)` after starting web-ext\n shouldExitProgram: false,\n };\n config.logger.debug('web-ext config:', finalConfig);\n config.logger.debug('web-ext options:', options);\n\n const webExt = await import('web-ext-run');\n runner = await webExt.default.cmd.run(finalConfig, options);\n\n config.logger.success('Opened!');\n },\n\n async closeBrowser() {\n return await runner?.exit();\n },\n };\n}\n\n// https://github.com/mozilla/web-ext/blob/e37e60a2738478f512f1255c537133321f301771/src/util/logger.js#L12\nconst WARN_LOG_LEVEL = 40;\nconst ERROR_LOG_LEVEL = 50;\n","import { ExtensionRunner } from './extension-runner';\nimport { relative } from 'node:path';\n\n/**\n * The Safari runner just logs a warning message because `web-ext` doesn't work with Safari.\n */\nexport function createSafariRunner(): ExtensionRunner {\n return {\n async openBrowser(config) {\n config.logger.warn(\n `Cannot Safari using web-ext. Load \"${relative(\n process.cwd(),\n config.outDir,\n )}\" as an unpacked extension manually`,\n );\n },\n async closeBrowser() {\n // noop\n },\n };\n}\n","import { ExtensionRunner } from './extension-runner';\nimport { relative } from 'node:path';\n\n/**\n * The manual runner tells the user to load the unpacked extension manually.\n */\nexport function createManualRunner(): ExtensionRunner {\n return {\n async openBrowser(config) {\n config.logger.info(\n `Load \"${relative(\n process.cwd(),\n config.outDir,\n )}\" as an unpacked extension manually`,\n );\n },\n async closeBrowser() {\n // noop\n },\n };\n}\n","/**\n * Returns true when running on WSL or WSL2.\n */\nexport async function isWsl(): Promise<boolean> {\n const { default: isWsl } = await import('is-wsl'); // ESM only, requires dynamic import\n return isWsl;\n}\n","import { InternalConfig } from '../types';\nimport { ExtensionRunner } from './extension-runner';\nimport { createWslRunner } from './wsl';\nimport { createWebExtRunner } from './web-ext';\nimport { createSafariRunner } from './safari';\nimport { createManualRunner } from './manual';\nimport { isWsl } from '../utils/wsl';\n\nexport async function createExtensionRunner(\n config: InternalConfig,\n): Promise<ExtensionRunner> {\n if (config.browser === 'safari') return createSafariRunner();\n\n if (await isWsl()) return createWslRunner();\n if (config.runnerConfig.config?.disabled) return createManualRunner();\n\n return createWebExtRunner();\n}\n","import path from 'node:path';\nimport glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport { consola } from 'consola';\nimport pc from 'picocolors';\n\n/**\n * Remove generated/temp files from the directory.\n *\n * @param root The directory to look for generated/temp files in. Defaults to `process.cwd()`. Can be relative to `process.cwd()` or absolute.\n */\nexport async function clean(root = process.cwd()) {\n consola.info('Cleaning Project');\n\n const tempDirs = [\n 'node_modules/.vite',\n 'node_modules/.cache',\n '**/.wxt',\n '.output/*',\n ];\n consola.debug('Looking for:', tempDirs.map(pc.cyan).join(', '));\n const directories = await glob(tempDirs, {\n cwd: path.resolve(root),\n absolute: true,\n onlyDirectories: true,\n deep: 2,\n });\n if (directories.length === 0) {\n consola.debug('No generated files found.');\n return;\n }\n\n consola.debug(\n 'Found:',\n directories.map((dir) => pc.cyan(path.relative(root, dir))).join(', '),\n );\n for (const directory of directories) {\n await fs.rm(directory, { force: true, recursive: true });\n consola.debug('Deleted ' + pc.cyan(path.relative(root, directory)));\n }\n}\n","{\n \"name\": \"wxt\",\n \"type\": \"module\",\n \"version\": \"0.7.2\",\n \"description\": \"Next gen framework for developing web extensions\",\n \"engines\": {\n \"node\": \">=18.16.0\",\n \"pnpm\": \">=8\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/wxt-dev/wxt\"\n },\n \"homepage\": \"https://wxt.dev\",\n \"keywords\": [\n \"vite\",\n \"chrome\",\n \"web\",\n \"extension\",\n \"browser\",\n \"bundler\",\n \"framework\"\n ],\n \"author\": {\n \"name\": \"Aaron Klinker\",\n \"email\": \"aaronklinker1+wxt@gmail.com\"\n },\n \"license\": \"MIT\",\n \"files\": [\n \"bin\",\n \"dist\"\n ],\n \"bin\": \"./bin/wxt.cjs\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"require\": \"./dist/index.cjs\",\n \"import\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n },\n \"./client\": {\n \"import\": \"./dist/client.js\",\n \"types\": \"./dist/client.d.ts\"\n },\n \"./browser\": {\n \"import\": \"./dist/browser.js\",\n \"types\": \"./dist/browser.d.ts\"\n }\n },\n \"scripts\": {\n \"wxt\": \"tsx src/cli/index.ts\",\n \"build\": \"tsx scripts/build.ts\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --write .\",\n \"compile\": \"tsc --noEmit\",\n \"test\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage.enabled --coverage.exclude=e2e --coverage.exclude=src/testing\",\n \"prepare\": \"simple-git-hooks\",\n \"prepublish\": \"pnpm -s build\",\n \"docs:dev\": \"vitepress dev docs\",\n \"docs:build\": \"vitepress build docs\",\n \"docs:preview\": \"vitepress preview docs\",\n \"sync-releases\": \"pnpx changelogen@latest gh release\"\n },\n \"dependencies\": {\n \"@types/webextension-polyfill\": \"^0.10.1\",\n \"@webext-core/fake-browser\": \"^1.2.2\",\n \"@webext-core/isolated-element\": \"^1.0.4\",\n \"@webext-core/match-patterns\": \"^1.0.2\",\n \"async-mutex\": \"^0.4.0\",\n \"c12\": \"^1.4.2\",\n \"cac\": \"^6.7.14\",\n \"consola\": \"^3.2.3\",\n \"esbuild\": \"^0.19.4\",\n \"fast-glob\": \"^3.3.1\",\n \"filesize\": \"^10.0.8\",\n \"fs-extra\": \"^11.1.1\",\n \"get-port\": \"^7.0.0\",\n \"giget\": \"^1.1.2\",\n \"immer\": \"^10.0.2\",\n \"is-wsl\": \"^3.0.0\",\n \"jiti\": \"^1.19.1\",\n \"json5\": \"^2.2.3\",\n \"linkedom\": \"^0.15.1\",\n \"minimatch\": \"^9.0.3\",\n \"ora\": \"^7.0.1\",\n \"picocolors\": \"^1.0.0\",\n \"prompts\": \"^2.4.2\",\n \"rollup-plugin-visualizer\": \"^5.9.2\",\n \"unimport\": \"^3.1.0\",\n \"vite\": \"^4.4.7\",\n \"web-ext-run\": \"^0.1.0\",\n \"webextension-polyfill\": \"^0.10.0\",\n \"zip-dir\": \"^2.0.0\"\n },\n \"devDependencies\": {\n \"@faker-js/faker\": \"^8.0.2\",\n \"@types/fs-extra\": \"^11.0.1\",\n \"@types/lodash.merge\": \"^4.6.7\",\n \"@types/node\": \"^20.4.5\",\n \"@types/prompts\": \"^2.4.4\",\n \"@vitest/coverage-v8\": \"^0.34.1\",\n \"execa\": \"^7.2.0\",\n \"jsdom\": \"^22.1.0\",\n \"lint-staged\": \"^14.0.0\",\n \"lodash.merge\": \"^4.6.2\",\n \"npm-run-all\": \"^4.1.5\",\n \"prettier\": \"^3.0.1\",\n \"simple-git-hooks\": \"^2.9.0\",\n \"ts-morph\": \"^20.0.0\",\n \"tsup\": \"^7.1.0\",\n \"tsx\": \"^3.12.7\",\n \"typescript\": \"^5.2.2\",\n \"vitepress\": \"1.0.0-rc.10\",\n \"vitest\": \"^0.34.1\",\n \"vitest-mock-extended\": \"^1.1.4\",\n \"vue\": \"^3.3.4\",\n \"webextension-polyfill\": \"^0.10.0\"\n },\n \"peerDependencies\": {\n \"webextension-polyfill\": \">=0.10.0\"\n },\n \"packageManager\": \"pnpm@8.6.3\",\n \"simple-git-hooks\": {\n \"pre-commit\": \"pnpm lint-staged\"\n },\n \"lint-staged\": {\n \"*\": \"prettier --write\"\n },\n \"changelog\": {\n \"excludeAuthors\": [\n \"aaronklinker1@gmail.com\"\n ]\n },\n \"pnpm\": {\n \"peerDependencyRules\": {\n \"ignoreMissing\": [\n \"@algolia/client-search\",\n \"search-insights\"\n ]\n }\n }\n}\n","import { UserConfig } from '../types';\n\nexport function defineConfig(config: UserConfig): UserConfig {\n return config;\n}\n","import { ExtensionRunnerConfig } from '../types';\n\nexport function defineRunnerConfig(\n config: ExtensionRunnerConfig,\n): ExtensionRunnerConfig {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,WAAO,UAAU;AACjB,UAAM,OAAO;AAEb,QAAIA,OAAK,UAAQ,IAAI;AAErB,aAAS,aAAcC,OAAM,SAAS;AACpC,UAAI,UAAU,QAAQ,YAAY,SAChC,QAAQ,UAAU,QAAQ,IAAI;AAEhC,UAAI,CAAC,SAAS;AACZ,eAAO;AAAA,MACT;AAEA,gBAAU,QAAQ,MAAM,GAAG;AAC3B,UAAI,QAAQ,QAAQ,EAAE,MAAM,IAAI;AAC9B,eAAO;AAAA,MACT;AACA,eAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,YAAI,IAAI,QAAQ,CAAC,EAAE,YAAY;AAC/B,YAAI,KAAKA,MAAK,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,MAAM,GAAG;AACnD,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,aAAS,UAAW,MAAMA,OAAM,SAAS;AACvC,UAAI,CAAC,KAAK,eAAe,KAAK,CAAC,KAAK,OA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,SAAO;AACT;","names":["fs","path","fs","path","fs","path","resolve","path","resolve","pathKey","path","path","fs","path","process","unload","emit","load","processReallyExit","processEmit","getStream","stream","resolve","path","vite","fs","path","fs","resolve","normalizePath","path","resolve","normalizePath","dirname","relative","resolve","url","isOffline","url","url","dirname","resolve","fs","ensureDir","normalizePath","resolve","ensureDir","dirname","fs","extname","unimport","fs","resolve","normalizePath","fs","resolve","path","env","global","pc","normalizePath","consola","relative","vite","fs","path","fs","dirname","resolve","fs","fs","global","resolve","fs","dirname","relative","resolve","fs","parseHTML","createUnimport","fs","resolve","path","normalizePath","unimport","createUnimport","fs","resolve","glob","glob","path","resolve","relative","fs","parseHTML","createUnimport","fs","relative","resolve","path","fs","resolve","unimport","createUnimport","normalizePath","path","global","relative","fs","resolve","resolve","fs","vite","fs","resolve","version","options","normalizePath","pc","vite","fs","resolve","path","pc","fs","path","fs","pc","resolve","Buffer","path","process","process","path","process","path","onetime","process","constants","constants","process","resolve","onExit","mergeStream","getStream","resolve","Buffer","ChildProcess","expression","process","process","crossSpawn","path","Buffer","$","glob","pc","fs","glob","vite","relative","relative","relative","isWsl","path","path","glob","fs","consola","pc","version","build","createServer","path","pc","relative","consola"]}
1
+ {"version":3,"sources":["../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js","../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js","../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js","../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js","../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js","../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js","../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js","../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js","../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js","../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js","../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js","../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js","../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js","../src/core/utils/getInternalConfig.ts","../src/core/utils/createFsCache.ts","../src/core/utils/fs.ts","../src/core/utils/entrypoints.ts","../src/core/utils/paths.ts","../src/core/vite-plugins/devHtmlPrerender.ts","../src/core/vite-plugins/devServerGlobals.ts","../src/core/utils/network.ts","../src/core/utils/promises.ts","../src/core/vite-plugins/download.ts","../src/core/vite-plugins/multipageMove.ts","../src/core/vite-plugins/unimport.ts","../src/core/utils/auto-imports.ts","../src/core/vite-plugins/virtualEntrypoint.ts","../src/core/vite-plugins/tsconfigPaths.ts","../src/core/vite-plugins/noopBackground.ts","../src/core/vite-plugins/cssEntrypoints.ts","../src/core/vite-plugins/bundleAnalysis.ts","../src/core/utils/globals.ts","../src/index.ts","../src/core/utils/arrays.ts","../src/core/utils/detectDevChanges.ts","../src/core/build/buildEntrypoints.ts","../src/core/utils/removeEmptyDirs.ts","../src/core/utils/public.ts","../src/core/build/findEntrypoints.ts","../src/core/utils/importEntrypointFile.ts","../src/core/utils/strings.ts","../src/core/build/generateTypesDir.ts","../src/core/utils/i18n.ts","../src/core/utils/manifest.ts","../src/core/utils/ContentSecurityPolicy.ts","../src/core/utils/content-scripts.ts","../src/core/utils/package.ts","../src/core/build.ts","../src/core/utils/groupEntrypoints.ts","../src/core/utils/formatDuration.ts","../src/core/log/printBuildSummary.ts","../src/core/log/printFileList.ts","../src/core/log/printTable.ts","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/index.js","../node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js","../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js","../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js","../node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js","../node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/error.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/main.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/realtime.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/signals.js","../node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/core.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/stdio.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/kill.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/pipe.js","../node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/stream.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/promise.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/command.js","../node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/verbose.js","../src/core/server.ts","../src/core/runners/wsl.ts","../src/core/runners/web-ext.ts","../src/core/runners/safari.ts","../src/core/runners/manual.ts","../src/core/utils/wsl.ts","../src/core/runners/index.ts","../src/core/clean.ts","../package.json","../src/core/utils/defineConfig.ts","../src/core/utils/defineRunnerConfig.ts"],"sourcesContent":["module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction checkPathExt (path, options) {\n var pathext = options.pathExt !== undefined ?\n options.pathExt : process.env.PATHEXT\n\n if (!pathext) {\n return true\n }\n\n pathext = pathext.split(';')\n if (pathext.indexOf('') !== -1) {\n return true\n }\n for (var i = 0; i < pathext.length; i++) {\n var p = pathext[i].toLowerCase()\n if (p && path.substr(-p.length).toLowerCase() === p) {\n return true\n }\n }\n return false\n}\n\nfunction checkStat (stat, path, options) {\n if (!stat.isSymbolicLink() && !stat.isFile()) {\n return false\n }\n return checkPathExt(path, options)\n}\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, path, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), path, options)\n}\n","module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), options)\n}\n\nfunction checkStat (stat, options) {\n return stat.isFile() && checkMode(stat, options)\n}\n\nfunction checkMode (stat, options) {\n var mod = stat.mode\n var uid = stat.uid\n var gid = stat.gid\n\n var myUid = options.uid !== undefined ?\n options.uid : process.getuid && process.getuid()\n var myGid = options.gid !== undefined ?\n options.gid : process.getgid && process.getgid()\n\n var u = parseInt('100', 8)\n var g = parseInt('010', 8)\n var o = parseInt('001', 8)\n var ug = u | g\n\n var ret = (mod & o) ||\n (mod & g) && gid === myGid ||\n (mod & u) && uid === myUid ||\n (mod & ug) && myUid === 0\n\n return ret\n}\n","var fs = require('fs')\nvar core\nif (process.platform === 'win32' || global.TESTING_WINDOWS) {\n core = require('./windows.js')\n} else {\n core = require('./mode.js')\n}\n\nmodule.exports = isexe\nisexe.sync = sync\n\nfunction isexe (path, options, cb) {\n if (typeof options === 'function') {\n cb = options\n options = {}\n }\n\n if (!cb) {\n if (typeof Promise !== 'function') {\n throw new TypeError('callback not provided')\n }\n\n return new Promise(function (resolve, reject) {\n isexe(path, options || {}, function (er, is) {\n if (er) {\n reject(er)\n } else {\n resolve(is)\n }\n })\n })\n }\n\n core(path, options || {}, function (er, is) {\n // ignore EACCES because that just means we aren't allowed to run it\n if (er) {\n if (er.code === 'EACCES' || options && options.ignoreErrors) {\n er = null\n is = false\n }\n }\n cb(er, is)\n })\n}\n\nfunction sync (path, options) {\n // my kingdom for a filtered catch\n try {\n return core.sync(path, options || {})\n } catch (er) {\n if (options && options.ignoreErrors || er.code === 'EACCES') {\n return false\n } else {\n throw er\n }\n }\n}\n","const isWindows = process.platform === 'win32' ||\n process.env.OSTYPE === 'cygwin' ||\n process.env.OSTYPE === 'msys'\n\nconst path = require('path')\nconst COLON = isWindows ? ';' : ':'\nconst isexe = require('isexe')\n\nconst getNotFoundError = (cmd) =>\n Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })\n\nconst getPathInfo = (cmd, opt) => {\n const colon = opt.colon || COLON\n\n // If it has a slash, then we don't bother searching the pathenv.\n // just check the file itself, and that's it.\n const pathEnv = cmd.match(/\\//) || isWindows && cmd.match(/\\\\/) ? ['']\n : (\n [\n // windows always checks the cwd first\n ...(isWindows ? [process.cwd()] : []),\n ...(opt.path || process.env.PATH ||\n /* istanbul ignore next: very unusual */ '').split(colon),\n ]\n )\n const pathExtExe = isWindows\n ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'\n : ''\n const pathExt = isWindows ? pathExtExe.split(colon) : ['']\n\n if (isWindows) {\n if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')\n pathExt.unshift('')\n }\n\n return {\n pathEnv,\n pathExt,\n pathExtExe,\n }\n}\n\nconst which = (cmd, opt, cb) => {\n if (typeof opt === 'function') {\n cb = opt\n opt = {}\n }\n if (!opt)\n opt = {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n const step = i => new Promise((resolve, reject) => {\n if (i === pathEnv.length)\n return opt.all && found.length ? resolve(found)\n : reject(getNotFoundError(cmd))\n\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n resolve(subStep(p, i, 0))\n })\n\n const subStep = (p, i, ii) => new Promise((resolve, reject) => {\n if (ii === pathExt.length)\n return resolve(step(i + 1))\n const ext = pathExt[ii]\n isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {\n if (!er && is) {\n if (opt.all)\n found.push(p + ext)\n else\n return resolve(p + ext)\n }\n return resolve(subStep(p, i, ii + 1))\n })\n })\n\n return cb ? step(0).then(res => cb(null, res), cb) : step(0)\n}\n\nconst whichSync = (cmd, opt) => {\n opt = opt || {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (let i = 0; i < pathEnv.length; i ++) {\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n for (let j = 0; j < pathExt.length; j ++) {\n const cur = p + pathExt[j]\n try {\n const is = isexe.sync(cur, { pathExt: pathExtExe })\n if (is) {\n if (opt.all)\n found.push(cur)\n else\n return cur\n }\n } catch (ex) {}\n }\n }\n\n if (opt.all && found.length)\n return found\n\n if (opt.nothrow)\n return null\n\n throw getNotFoundError(cmd)\n}\n\nmodule.exports = which\nwhich.sync = whichSync\n","'use strict';\n\nconst pathKey = (options = {}) => {\n\tconst environment = options.env || process.env;\n\tconst platform = options.platform || process.platform;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n};\n\nmodule.exports = pathKey;\n// TODO: Remove this for the next major release\nmodule.exports.default = pathKey;\n","'use strict';\n\nconst path = require('path');\nconst which = require('which');\nconst getPathKey = require('path-key');\n\nfunction resolveCommandAttempt(parsed, withoutPathExt) {\n const env = parsed.options.env || process.env;\n const cwd = process.cwd();\n const hasCustomCwd = parsed.options.cwd != null;\n // Worker threads do not have process.chdir()\n const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;\n\n // If a custom `cwd` was specified, we need to change the process cwd\n // because `which` will do stat calls but does not support a custom cwd\n if (shouldSwitchCwd) {\n try {\n process.chdir(parsed.options.cwd);\n } catch (err) {\n /* Empty */\n }\n }\n\n let resolved;\n\n try {\n resolved = which.sync(parsed.command, {\n path: env[getPathKey({ env })],\n pathExt: withoutPathExt ? path.delimiter : undefined,\n });\n } catch (e) {\n /* Empty */\n } finally {\n if (shouldSwitchCwd) {\n process.chdir(cwd);\n }\n }\n\n // If we successfully resolved, ensure that an absolute path is returned\n // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it\n if (resolved) {\n resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);\n }\n\n return resolved;\n}\n\nfunction resolveCommand(parsed) {\n return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);\n}\n\nmodule.exports = resolveCommand;\n","'use strict';\n\n// See http://www.robvanderwoude.com/escapechars.php\nconst metaCharsRegExp = /([()\\][%!^\"`<>&|;, *?])/g;\n\nfunction escapeCommand(arg) {\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n return arg;\n}\n\nfunction escapeArgument(arg, doubleEscapeMetaChars) {\n // Convert to string\n arg = `${arg}`;\n\n // Algorithm below is based on https://qntm.org/cmd\n\n // Sequence of backslashes followed by a double quote:\n // double up all the backslashes and escape the double quote\n arg = arg.replace(/(\\\\*)\"/g, '$1$1\\\\\"');\n\n // Sequence of backslashes followed by the end of the string\n // (which will become a double quote later):\n // double up all the backslashes\n arg = arg.replace(/(\\\\*)$/, '$1$1');\n\n // All other backslashes occur literally\n\n // Quote the whole thing:\n arg = `\"${arg}\"`;\n\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n // Double escape meta chars if necessary\n if (doubleEscapeMetaChars) {\n arg = arg.replace(metaCharsRegExp, '^$1');\n }\n\n return arg;\n}\n\nmodule.exports.command = escapeCommand;\nmodule.exports.argument = escapeArgument;\n","'use strict';\nmodule.exports = /^#!(.*)/;\n","'use strict';\nconst shebangRegex = require('shebang-regex');\n\nmodule.exports = (string = '') => {\n\tconst match = string.match(shebangRegex);\n\n\tif (!match) {\n\t\treturn null;\n\t}\n\n\tconst [path, argument] = match[0].replace(/#! ?/, '').split(' ');\n\tconst binary = path.split('/').pop();\n\n\tif (binary === 'env') {\n\t\treturn argument;\n\t}\n\n\treturn argument ? `${binary} ${argument}` : binary;\n};\n","'use strict';\n\nconst fs = require('fs');\nconst shebangCommand = require('shebang-command');\n\nfunction readShebang(command) {\n // Read the first 150 bytes from the file\n const size = 150;\n const buffer = Buffer.alloc(size);\n\n let fd;\n\n try {\n fd = fs.openSync(command, 'r');\n fs.readSync(fd, buffer, 0, size, 0);\n fs.closeSync(fd);\n } catch (e) { /* Empty */ }\n\n // Attempt to extract shebang (null is returned if not a shebang)\n return shebangCommand(buffer.toString());\n}\n\nmodule.exports = readShebang;\n","'use strict';\n\nconst path = require('path');\nconst resolveCommand = require('./util/resolveCommand');\nconst escape = require('./util/escape');\nconst readShebang = require('./util/readShebang');\n\nconst isWin = process.platform === 'win32';\nconst isExecutableRegExp = /\\.(?:com|exe)$/i;\nconst isCmdShimRegExp = /node_modules[\\\\/].bin[\\\\/][^\\\\/]+\\.cmd$/i;\n\nfunction detectShebang(parsed) {\n parsed.file = resolveCommand(parsed);\n\n const shebang = parsed.file && readShebang(parsed.file);\n\n if (shebang) {\n parsed.args.unshift(parsed.file);\n parsed.command = shebang;\n\n return resolveCommand(parsed);\n }\n\n return parsed.file;\n}\n\nfunction parseNonShell(parsed) {\n if (!isWin) {\n return parsed;\n }\n\n // Detect & add support for shebangs\n const commandFile = detectShebang(parsed);\n\n // We don't need a shell if the command filename is an executable\n const needsShell = !isExecutableRegExp.test(commandFile);\n\n // If a shell is required, use cmd.exe and take care of escaping everything correctly\n // Note that `forceShell` is an hidden option used only in tests\n if (parsed.options.forceShell || needsShell) {\n // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`\n // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument\n // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,\n // we need to double escape them\n const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);\n\n // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\\bar)\n // This is necessary otherwise it will always fail with ENOENT in those cases\n parsed.command = path.normalize(parsed.command);\n\n // Escape command & arguments\n parsed.command = escape.command(parsed.command);\n parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));\n\n const shellCommand = [parsed.command].concat(parsed.args).join(' ');\n\n parsed.args = ['/d', '/s', '/c', `\"${shellCommand}\"`];\n parsed.command = process.env.comspec || 'cmd.exe';\n parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped\n }\n\n return parsed;\n}\n\nfunction parse(command, args, options) {\n // Normalize arguments, similar to nodejs\n if (args && !Array.isArray(args)) {\n options = args;\n args = null;\n }\n\n args = args ? args.slice(0) : []; // Clone array to avoid changing the original\n options = Object.assign({}, options); // Clone object to avoid changing the original\n\n // Build our parsed object\n const parsed = {\n command,\n args,\n options,\n file: undefined,\n original: {\n command,\n args,\n },\n };\n\n // Delegate further parsing to shell or non-shell\n return options.shell ? parsed : parseNonShell(parsed);\n}\n\nmodule.exports = parse;\n","'use strict';\n\nconst isWin = process.platform === 'win32';\n\nfunction notFoundError(original, syscall) {\n return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {\n code: 'ENOENT',\n errno: 'ENOENT',\n syscall: `${syscall} ${original.command}`,\n path: original.command,\n spawnargs: original.args,\n });\n}\n\nfunction hookChildProcess(cp, parsed) {\n if (!isWin) {\n return;\n }\n\n const originalEmit = cp.emit;\n\n cp.emit = function (name, arg1) {\n // If emitting \"exit\" event and exit code is 1, we need to check if\n // the command exists and emit an \"error\" instead\n // See https://github.com/IndigoUnited/node-cross-spawn/issues/16\n if (name === 'exit') {\n const err = verifyENOENT(arg1, parsed, 'spawn');\n\n if (err) {\n return originalEmit.call(cp, 'error', err);\n }\n }\n\n return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params\n };\n}\n\nfunction verifyENOENT(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawn');\n }\n\n return null;\n}\n\nfunction verifyENOENTSync(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawnSync');\n }\n\n return null;\n}\n\nmodule.exports = {\n hookChildProcess,\n verifyENOENT,\n verifyENOENTSync,\n notFoundError,\n};\n","'use strict';\n\nconst cp = require('child_process');\nconst parse = require('./lib/parse');\nconst enoent = require('./lib/enoent');\n\nfunction spawn(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n\n // Hook into child process \"exit\" event to emit an error if the command\n // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n enoent.hookChildProcess(spawned, parsed);\n\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n\n // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\n\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n","// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\nmodule.exports = [\n 'SIGABRT',\n 'SIGALRM',\n 'SIGHUP',\n 'SIGINT',\n 'SIGTERM'\n]\n\nif (process.platform !== 'win32') {\n module.exports.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n module.exports.push(\n 'SIGIO',\n 'SIGPOLL',\n 'SIGPWR',\n 'SIGSTKFLT',\n 'SIGUNUSED'\n )\n}\n","// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nvar process = global.process\n\nconst processOk = function (process) {\n return process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n}\n\n// some kind of non-node environment, just no-op\n/* istanbul ignore if */\nif (!processOk(process)) {\n module.exports = function () {\n return function () {}\n }\n} else {\n var assert = require('assert')\n var signals = require('./signals.js')\n var isWin = /^win/i.test(process.platform)\n\n var EE = require('events')\n /* istanbul ignore if */\n if (typeof EE !== 'function') {\n EE = EE.EventEmitter\n }\n\n var emitter\n if (process.__signal_exit_emitter__) {\n emitter = process.__signal_exit_emitter__\n } else {\n emitter = process.__signal_exit_emitter__ = new EE()\n emitter.count = 0\n emitter.emitted = {}\n }\n\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (!emitter.infinite) {\n emitter.setMaxListeners(Infinity)\n emitter.infinite = true\n }\n\n module.exports = function (cb, opts) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return function () {}\n }\n assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')\n\n if (loaded === false) {\n load()\n }\n\n var ev = 'exit'\n if (opts && opts.alwaysLast) {\n ev = 'afterexit'\n }\n\n var remove = function () {\n emitter.removeListener(ev, cb)\n if (emitter.listeners('exit').length === 0 &&\n emitter.listeners('afterexit').length === 0) {\n unload()\n }\n }\n emitter.on(ev, cb)\n\n return remove\n }\n\n var unload = function unload () {\n if (!loaded || !processOk(global.process)) {\n return\n }\n loaded = false\n\n signals.forEach(function (sig) {\n try {\n process.removeListener(sig, sigListeners[sig])\n } catch (er) {}\n })\n process.emit = originalProcessEmit\n process.reallyExit = originalProcessReallyExit\n emitter.count -= 1\n }\n module.exports.unload = unload\n\n var emit = function emit (event, code, signal) {\n /* istanbul ignore if */\n if (emitter.emitted[event]) {\n return\n }\n emitter.emitted[event] = true\n emitter.emit(event, code, signal)\n }\n\n // { <signal>: <listener fn>, ... }\n var sigListeners = {}\n signals.forEach(function (sig) {\n sigListeners[sig] = function listener () {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n var listeners = process.listeners(sig)\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n /* istanbul ignore next */\n emit('afterexit', null, sig)\n /* istanbul ignore next */\n if (isWin && sig === 'SIGHUP') {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n sig = 'SIGINT'\n }\n /* istanbul ignore next */\n process.kill(process.pid, sig)\n }\n }\n })\n\n module.exports.signals = function () {\n return signals\n }\n\n var loaded = false\n\n var load = function load () {\n if (loaded || !processOk(global.process)) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n emitter.count += 1\n\n signals = signals.filter(function (sig) {\n try {\n process.on(sig, sigListeners[sig])\n return true\n } catch (er) {\n return false\n }\n })\n\n process.emit = processEmit\n process.reallyExit = processReallyExit\n }\n module.exports.load = load\n\n var originalProcessReallyExit = process.reallyExit\n var processReallyExit = function processReallyExit (code) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n process.exitCode = code || /* istanbul ignore next */ 0\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n originalProcessReallyExit.call(process, process.exitCode)\n }\n\n var originalProcessEmit = process.emit\n var processEmit = function processEmit (ev, arg) {\n if (ev === 'exit' && processOk(global.process)) {\n /* istanbul ignore else */\n if (arg !== undefined) {\n process.exitCode = arg\n }\n var ret = originalProcessEmit.apply(this, arguments)\n /* istanbul ignore next */\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n return ret\n } else {\n return originalProcessEmit.apply(this, arguments)\n }\n }\n}\n","'use strict';\nconst {PassThrough: PassThroughStream} = require('stream');\n\nmodule.exports = options => {\n\toptions = {...options};\n\n\tconst {array} = options;\n\tlet {encoding} = options;\n\tconst isBuffer = encoding === 'buffer';\n\tlet objectMode = false;\n\n\tif (array) {\n\t\tobjectMode = !(encoding || isBuffer);\n\t} else {\n\t\tencoding = encoding || 'utf8';\n\t}\n\n\tif (isBuffer) {\n\t\tencoding = null;\n\t}\n\n\tconst stream = new PassThroughStream({objectMode});\n\n\tif (encoding) {\n\t\tstream.setEncoding(encoding);\n\t}\n\n\tlet length = 0;\n\tconst chunks = [];\n\n\tstream.on('data', chunk => {\n\t\tchunks.push(chunk);\n\n\t\tif (objectMode) {\n\t\t\tlength = chunks.length;\n\t\t} else {\n\t\t\tlength += chunk.length;\n\t\t}\n\t});\n\n\tstream.getBufferedValue = () => {\n\t\tif (array) {\n\t\t\treturn chunks;\n\t\t}\n\n\t\treturn isBuffer ? Buffer.concat(chunks, length) : chunks.join('');\n\t};\n\n\tstream.getBufferedLength = () => length;\n\n\treturn stream;\n};\n","'use strict';\nconst {constants: BufferConstants} = require('buffer');\nconst stream = require('stream');\nconst {promisify} = require('util');\nconst bufferStream = require('./buffer-stream');\n\nconst streamPipelinePromisified = promisify(stream.pipeline);\n\nclass MaxBufferError extends Error {\n\tconstructor() {\n\t\tsuper('maxBuffer exceeded');\n\t\tthis.name = 'MaxBufferError';\n\t}\n}\n\nasync function getStream(inputStream, options) {\n\tif (!inputStream) {\n\t\tthrow new Error('Expected a stream');\n\t}\n\n\toptions = {\n\t\tmaxBuffer: Infinity,\n\t\t...options\n\t};\n\n\tconst {maxBuffer} = options;\n\tconst stream = bufferStream(options);\n\n\tawait new Promise((resolve, reject) => {\n\t\tconst rejectPromise = error => {\n\t\t\t// Don't retrieve an oversized buffer.\n\t\t\tif (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {\n\t\t\t\terror.bufferedData = stream.getBufferedValue();\n\t\t\t}\n\n\t\t\treject(error);\n\t\t};\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tawait streamPipelinePromisified(inputStream, stream);\n\t\t\t\tresolve();\n\t\t\t} catch (error) {\n\t\t\t\trejectPromise(error);\n\t\t\t}\n\t\t})();\n\n\t\tstream.on('data', () => {\n\t\t\tif (stream.getBufferedLength() > maxBuffer) {\n\t\t\t\trejectPromise(new MaxBufferError());\n\t\t\t}\n\t\t});\n\t});\n\n\treturn stream.getBufferedValue();\n}\n\nmodule.exports = getStream;\nmodule.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});\nmodule.exports.array = (stream, options) => getStream(stream, {...options, array: true});\nmodule.exports.MaxBufferError = MaxBufferError;\n","'use strict';\n\nconst { PassThrough } = require('stream');\n\nmodule.exports = function (/*streams...*/) {\n var sources = []\n var output = new PassThrough({objectMode: true})\n\n output.setMaxListeners(0)\n\n output.add = add\n output.isEmpty = isEmpty\n\n output.on('unpipe', remove)\n\n Array.prototype.slice.call(arguments).forEach(add)\n\n return output\n\n function add (source) {\n if (Array.isArray(source)) {\n source.forEach(add)\n return this\n }\n\n sources.push(source);\n source.once('end', remove.bind(null, source))\n source.once('error', output.emit.bind(output, 'error'))\n source.pipe(output, {end: false})\n return this\n }\n\n function isEmpty () {\n return sources.length == 0;\n }\n\n function remove (source) {\n sources = sources.filter(function (it) { return it !== source })\n if (!sources.length && output.readable) { output.end() }\n }\n}\n","import { loadConfig } from 'c12';\nimport {\n InlineConfig,\n InternalConfig,\n UserConfig,\n ConfigEnv,\n UserManifestFn,\n UserManifest,\n WxtViteConfig,\n ExtensionRunnerConfig,\n} from '../types';\nimport path from 'node:path';\nimport * as vite from 'vite';\nimport { createFsCache } from './createFsCache';\nimport consola, { LogLevels } from 'consola';\nimport * as plugins from '../vite-plugins';\nimport { getGlobals } from './globals';\n\n/**\n * Given an inline config, discover the config file if necessary, merge the results, resolve any\n * relative paths, and apply any defaults.\n *\n * Inline config always has priority over user config. Cli flags are passed as inline config if set.\n * If unset, undefined is passed in, letting this function decide default values.\n */\nexport async function getInternalConfig(\n inlineConfig: InlineConfig,\n command: 'build' | 'serve',\n): Promise<InternalConfig> {\n // Load user config\n\n let userConfig: UserConfig = {};\n let userConfigMetadata: InternalConfig['userConfigMetadata'] | undefined;\n if (inlineConfig.configFile !== false) {\n const { config: loadedConfig, ...metadata } = await loadConfig<UserConfig>({\n name: 'wxt',\n cwd: inlineConfig.root ?? process.cwd(),\n rcFile: false,\n });\n userConfig = loadedConfig ?? {};\n userConfigMetadata = metadata;\n }\n\n // Merge it into the inline config\n\n const mergedConfig = mergeInlineConfig(inlineConfig, userConfig);\n\n // Apply defaults to make internal config.\n\n const debug = mergedConfig.debug ?? false;\n const logger = mergedConfig.logger ?? consola;\n if (debug) logger.level = LogLevels.debug;\n\n const browser = mergedConfig.browser ?? 'chrome';\n const manifestVersion =\n mergedConfig.manifestVersion ??\n (browser === 'firefox' || browser === 'safari' ? 2 : 3);\n const mode =\n mergedConfig.mode ?? (command === 'build' ? 'production' : 'development');\n const env: ConfigEnv = { browser, command, manifestVersion, mode };\n\n const root = path.resolve(\n inlineConfig.root ?? userConfig.root ?? process.cwd(),\n );\n const wxtDir = path.resolve(root, '.wxt');\n const srcDir = path.resolve(root, mergedConfig.srcDir ?? root);\n const entrypointsDir = path.resolve(\n srcDir,\n mergedConfig.entrypointsDir ?? 'entrypoints',\n );\n const publicDir = path.resolve(srcDir, mergedConfig.publicDir ?? 'public');\n const typesDir = path.resolve(wxtDir, 'types');\n const outBaseDir = path.resolve(root, '.output');\n const outDir = path.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);\n\n const runnerConfig = await loadConfig<ExtensionRunnerConfig>({\n name: 'web-ext',\n cwd: root,\n globalRc: true,\n rcFile: '.webextrc',\n overrides: inlineConfig.runner,\n defaults: userConfig.runner,\n });\n\n const finalConfig: InternalConfig = {\n browser,\n command,\n debug,\n entrypointsDir,\n env,\n fsCache: createFsCache(wxtDir),\n imports: mergedConfig.imports ?? {},\n logger,\n manifest: await resolveManifestConfig(env, mergedConfig.manifest),\n manifestVersion,\n mode,\n outBaseDir,\n outDir,\n publicDir,\n root,\n runnerConfig,\n srcDir,\n typesDir,\n vite: () => ({}), // Real value added after this object is initialized.\n wxtDir,\n zip: resolveInternalZipConfig(root, mergedConfig),\n transformManifest(manifest) {\n userConfig.transformManifest?.(manifest);\n inlineConfig.transformManifest?.(manifest);\n },\n analysis: {\n enabled: mergedConfig.analysis?.enabled ?? false,\n template: mergedConfig.analysis?.template ?? 'treemap',\n },\n userConfigMetadata: userConfigMetadata ?? {},\n };\n\n finalConfig.vite = (env) =>\n resolveInternalViteConfig(env, mergedConfig, finalConfig);\n\n return finalConfig;\n}\n\nasync function resolveManifestConfig(\n env: ConfigEnv,\n manifest: UserManifest | Promise<UserManifest> | UserManifestFn | undefined,\n): Promise<UserManifest> {\n return await (typeof manifest === 'function'\n ? manifest(env)\n : manifest ?? {});\n}\n\n/**\n * Merge the inline config and user config. Inline config is given priority. Defaults are not applied here.\n */\nfunction mergeInlineConfig(\n inlineConfig: InlineConfig,\n userConfig: UserConfig,\n): InlineConfig {\n let imports: InlineConfig['imports'];\n if (inlineConfig.imports === false || userConfig.imports === false) {\n imports = false;\n } else if (userConfig.imports == null && inlineConfig.imports == null) {\n imports = undefined;\n } else {\n imports = vite.mergeConfig(\n userConfig.imports ?? {},\n inlineConfig.imports ?? {},\n );\n }\n const manifest: UserManifestFn = async (env) => {\n const user = await resolveManifestConfig(env, userConfig.manifest);\n const inline = await resolveManifestConfig(env, inlineConfig.manifest);\n return vite.mergeConfig(user, inline);\n };\n const viteConfig = async (env: ConfigEnv): Promise<WxtViteConfig> => {\n const user = await userConfig.vite?.(env);\n const inline = await inlineConfig.vite?.(env);\n return vite.mergeConfig(user ?? {}, inline ?? {});\n };\n const runner: InlineConfig['runner'] = vite.mergeConfig(\n userConfig.runner ?? {},\n inlineConfig.runner ?? {},\n );\n const zip: InlineConfig['zip'] = vite.mergeConfig(\n userConfig.zip ?? {},\n inlineConfig.zip ?? {},\n );\n\n return {\n root: inlineConfig.root ?? userConfig.root,\n browser: inlineConfig.browser ?? userConfig.browser,\n manifestVersion: inlineConfig.manifestVersion ?? userConfig.manifestVersion,\n configFile: inlineConfig.configFile,\n debug: inlineConfig.debug ?? userConfig.debug,\n entrypointsDir: inlineConfig.entrypointsDir ?? userConfig.entrypointsDir,\n imports,\n logger: inlineConfig.logger ?? userConfig.logger,\n manifest,\n mode: inlineConfig.mode ?? userConfig.mode,\n publicDir: inlineConfig.publicDir ?? userConfig.publicDir,\n runner,\n srcDir: inlineConfig.srcDir ?? userConfig.srcDir,\n vite: viteConfig,\n zip,\n analysis: {\n enabled: inlineConfig.analysis?.enabled ?? userConfig.analysis?.enabled,\n template:\n inlineConfig.analysis?.template ?? userConfig.analysis?.template,\n },\n };\n}\n\nfunction resolveInternalZipConfig(\n root: string,\n mergedConfig: InlineConfig,\n): InternalConfig['zip'] {\n return {\n sourcesTemplate: '{{name}}-{{version}}-sources.zip',\n artifactTemplate: '{{name}}-{{version}}-{{browser}}.zip',\n sourcesRoot: root,\n ...mergedConfig.zip,\n ignoredSources: [\n '**/node_modules',\n // WXT files\n '**/web-ext.config.ts',\n // Hidden files\n '**/.*',\n // Tests\n '**/__tests__/**',\n '**/*.+(test|spec).?(c|m)+(j|t)s?(x)',\n // From user\n ...(mergedConfig.zip?.ignoredSources ?? []),\n ],\n };\n}\n\nasync function resolveInternalViteConfig(\n env: ConfigEnv,\n mergedConfig: InlineConfig,\n finalConfig: InternalConfig,\n) {\n const internalVite: vite.InlineConfig =\n (await mergedConfig.vite?.(env)) ?? {};\n\n internalVite.root = finalConfig.root;\n internalVite.configFile = false;\n internalVite.logLevel = 'warn';\n internalVite.mode = env.mode;\n\n internalVite.build ??= {};\n internalVite.build.outDir = finalConfig.outDir;\n internalVite.build.emptyOutDir = false;\n\n internalVite.plugins ??= [];\n internalVite.plugins.push(plugins.download(finalConfig));\n internalVite.plugins.push(plugins.devHtmlPrerender(finalConfig));\n internalVite.plugins.push(plugins.unimport(finalConfig));\n internalVite.plugins.push(\n plugins.virtualEntrypoin('background', finalConfig),\n );\n internalVite.plugins.push(\n plugins.virtualEntrypoin('content-script', finalConfig),\n );\n internalVite.plugins.push(plugins.devServerGlobals(finalConfig));\n internalVite.plugins.push(plugins.tsconfigPaths(finalConfig));\n internalVite.plugins.push(plugins.noopBackground());\n if (finalConfig.analysis.enabled) {\n internalVite.plugins.push(plugins.bundleAnalysis());\n }\n\n internalVite.define ??= {};\n for (const global of getGlobals(finalConfig)) {\n internalVite.define[global.name] = JSON.stringify(global.value);\n }\n return internalVite;\n}\n","import fs, { ensureDir } from 'fs-extra';\nimport { FsCache } from '../types';\nimport { dirname, resolve } from 'path';\nimport { writeFileIfDifferent } from './fs';\n\n/**\n * A basic file system cache stored at `<srcDir>/.wxt/cache/<key>`. Just caches a string in a\n * file for the given key.\n *\n * @param srcDir Absolute path to source directory. See `InternalConfig.srcDir`\n */\nexport function createFsCache(wxtDir: string): FsCache {\n const getPath = (key: string) =>\n resolve(wxtDir, 'cache', encodeURIComponent(key));\n\n return {\n async set(key: string, value: string): Promise<void> {\n const path = getPath(key);\n await ensureDir(dirname(path));\n await writeFileIfDifferent(path, value);\n },\n async get(key: string): Promise<string | undefined> {\n const path = getPath(key);\n try {\n return await fs.readFile(path, 'utf-8');\n } catch {\n return undefined;\n }\n },\n };\n}\n","import fs from 'fs-extra';\n\n/**\n * Only write the contents to a file if it results in a change. This prevents unnecessary file\n * watchers from being triggered, like WXT's dev server or the TS language server in editors.\n *\n * @param file The file to write to.\n * @param newContents The new text content to write.\n */\nexport async function writeFileIfDifferent(\n file: string,\n newContents: string,\n): Promise<void> {\n const existingContents = await fs\n .readFile(file, 'utf-8')\n .catch(() => undefined);\n\n if (existingContents !== newContents) {\n await fs.writeFile(file, newContents);\n }\n}\n","import { Entrypoint, PerBrowserOption, TargetBrowser } from '../types';\nimport path, { relative, resolve } from 'node:path';\nimport { normalizePath } from './paths';\n\nexport function getEntrypointName(\n entrypointsDir: string,\n inputPath: string,\n // type: Entrypoint['type'],\n): string {\n const relativePath = path.relative(entrypointsDir, inputPath);\n // Grab the string up to the first . or / or \\\\\n const name = relativePath.split(/[\\.\\/\\\\]/, 2)[0];\n\n return name;\n}\n\nexport function getEntrypointOutputFile(\n entrypoint: Entrypoint,\n ext: string,\n): string {\n return resolve(entrypoint.outputDir, `${entrypoint.name}${ext}`);\n}\n\n/**\n * Return's the entrypoint's output path relative to the output directory. Used for paths in the\n * manifest and rollup's bundle.\n */\nexport function getEntrypointBundlePath(\n entrypoint: Entrypoint,\n outDir: string,\n ext: string,\n): string {\n return normalizePath(\n relative(outDir, getEntrypointOutputFile(entrypoint, ext)),\n );\n}\n\n/**\n * Given an entrypoint option, resolve it's value based on a target browser.\n */\nexport function resolvePerBrowserOption<T>(\n option: PerBrowserOption<T>,\n browser: TargetBrowser,\n): T {\n if (typeof option === 'object' && !Array.isArray(option))\n return (option as any)[browser];\n return option;\n}\n","import nodePath from 'node:path';\nimport * as vite from 'vite';\n\n/**\n * Converts system paths to normalized bundler path. On windows and unix, this returns paths with /\n * instead of \\.\n */\nexport function normalizePath(path: string): string {\n return vite.normalizePath(path);\n}\n\n/**\n * Given a normalized path, convert it to the system path style. On Windows, switch to \\, otherwise use /.\n */\nexport function unnormalizePath(path: string): string {\n return nodePath.normalize(path);\n}\n\nexport const CSS_EXTENSIONS = ['css', 'scss', 'sass', 'less', 'styl', 'stylus'];\n\n// .module.css files are not supported because these are global CSS files, so using CSS modules doesn't make sense.\nexport const CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join('|')})`;\n","import * as vite from 'vite';\nimport { InternalConfig } from '../types';\nimport { getEntrypointName } from '../utils/entrypoints';\nimport { parseHTML } from 'linkedom';\nimport { dirname, isAbsolute, relative, resolve } from 'path';\n\n/**\n * Pre-renders the HTML entrypoints when building the extension to connect to the dev server.\n */\nexport function devHtmlPrerender(config: InternalConfig): vite.Plugin {\n return {\n apply: 'build',\n name: 'wxt:dev-html-prerender',\n config() {\n return {\n resolve: {\n alias: {\n '@wxt/reload-html': resolve(\n config.root,\n 'node_modules/wxt/dist/virtual-modules/reload-html.js',\n ),\n },\n },\n };\n },\n async transform(html, id) {\n const server = config.server;\n if (config.command !== 'serve' || server == null || !id.endsWith('.html'))\n return;\n\n const originalUrl = `${server.origin}${id}`;\n const name = getEntrypointName(config.entrypointsDir, id);\n const url = `${server.origin}/${name}.html`;\n const serverHtml = await server.transformIndexHtml(\n url,\n html,\n originalUrl,\n );\n const { document } = parseHTML(serverHtml);\n\n const pointToDevServer = (querySelector: string, attr: string): void => {\n document.querySelectorAll(querySelector).forEach((element) => {\n const src = element.getAttribute(attr);\n if (!src) return;\n\n if (isAbsolute(src)) {\n element.setAttribute(attr, server.origin + src);\n } else if (src.startsWith('.')) {\n const abs = resolve(dirname(id), src);\n const pathname = relative(config.root, abs);\n element.setAttribute(attr, `${server.origin}/${pathname}`);\n }\n });\n };\n pointToDevServer('script[type=module]', 'src');\n pointToDevServer('link[rel=stylesheet]', 'href');\n\n // Add a script to add page reloading\n const reloader = document.createElement('script');\n reloader.src = '@wxt/reload-html';\n reloader.type = 'module';\n document.head.appendChild(reloader);\n\n const newHtml = document.toString();\n config.logger.debug('Transformed ' + id);\n config.logger.debug('Old HTML:\\n' + html);\n config.logger.debug('New HTML:\\n' + newHtml);\n return newHtml;\n },\n };\n}\n","import { Plugin } from 'vite';\nimport { InternalConfig } from '../types';\n\n/**\n * Defines global constants about the dev server. Helps scripts connect to the server's web socket.\n */\nexport function devServerGlobals(internalConfig: InternalConfig): Plugin {\n return {\n name: 'wxt:dev-server-globals',\n config() {\n if (internalConfig.server == null || internalConfig.command == 'build')\n return;\n\n return {\n define: {\n __DEV_SERVER_PROTOCOL__: JSON.stringify('ws:'),\n __DEV_SERVER_HOSTNAME__: JSON.stringify(\n internalConfig.server.hostname,\n ),\n __DEV_SERVER_PORT__: JSON.stringify(internalConfig.server.port),\n },\n };\n },\n };\n}\n","import dns from 'node:dns';\nimport { withTimeout } from './promises';\nimport { InternalConfig } from '../types';\n\nfunction isOffline(): Promise<boolean> {\n const isOffline = new Promise<boolean>((res) => {\n dns.resolve('google.com', (err) => {\n if (err == null) {\n res(false);\n } else {\n res(true);\n }\n });\n });\n return withTimeout(isOffline, 1e3).catch(() => true);\n}\n\nexport async function isOnline(): Promise<boolean> {\n const offline = await isOffline();\n return !offline;\n}\n\n/**\n * Fetches a URL with a simple GET request. Grabs it from cache if it doesn't exist, or throws an\n * error if it can't be resolved via the network or cache.\n */\nexport async function fetchCached(\n url: string,\n config: InternalConfig,\n): Promise<string> {\n let content: string = '';\n\n if (await isOnline()) {\n const res = await fetch(url);\n if (res.status < 300) {\n content = await res.text();\n await config.fsCache.set(url, content);\n } else {\n config.logger.debug(\n `Failed to download \"${url}\", falling back to cache...`,\n );\n }\n }\n\n if (!content) content = (await config.fsCache.get(url)) ?? '';\n if (!content)\n throw Error(\n `Offline and \"${url}\" has not been cached. Try again when online.`,\n );\n\n return content;\n}\n","/**\n * Add a timeout to a promise.\n */\nexport function withTimeout<T>(\n promise: Promise<T>,\n duration: number,\n): Promise<T> {\n return new Promise((res, rej) => {\n const timeout = setTimeout(() => {\n rej(`Promise timed out after ${duration}ms`);\n }, duration);\n promise\n .then(res)\n .catch(rej)\n .finally(() => clearTimeout(timeout));\n });\n}\n\n/**\n * @deprecated Don't use in production, just for testing and slowing things down.\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((res) => setTimeout(res, ms));\n}\n","import { Plugin } from 'vite';\nimport { InternalConfig } from '../types';\nimport { fetchCached } from '../utils/network';\n\n/**\n * Downloads any URL imports, like Google Analytics, into virtual modules so they are bundled with\n * the extension instead of depending on remote code at runtime.\n *\n * @example\n * import \"url:https://google-tagmanager.com/gtag?id=XYZ\";\n */\nexport function download(config: InternalConfig): Plugin {\n return {\n name: 'wxt:download',\n resolveId(id) {\n if (id.startsWith('url:')) return '\\0' + id;\n },\n async load(id) {\n if (!id.startsWith('\\0url:')) return;\n\n // Load file from network or cache\n const url = id.replace('\\0url:', '');\n return await fetchCached(url, config);\n },\n };\n}\n","import * as vite from 'vite';\nimport { Entrypoint, InternalConfig } from '../types';\nimport { dirname, extname, resolve } from 'node:path';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\nimport fs, { ensureDir } from 'fs-extra';\nimport { normalizePath } from '../utils/paths';\n\n/**\n * Ensures the HTML files output by a multipage build are in the correct location. This does two\n * things:\n *\n * 1. Moves the HMTL files to their final location at `<outDir>/<entrypoint.name>.html`.\n * 2. Updates the bundle so it summarizes the files correctly in the returned build output.\n *\n * Assets (JS and CSS) are output to the `<outDir>/assets` directory, and don't need to be modified.\n * HTML files access them via absolute URLs, so we don't need to update any import paths in the HTML\n * files either.\n *\n * THIS PLUGIN SHOULD ONLY BE APPLIED TO MULTIPAGE BUILDS. It should not be added to every build.\n */\nexport function multipageMove(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): vite.Plugin {\n return {\n name: 'wxt:multipage-move',\n async writeBundle(_, bundle) {\n for (const oldBundlePath in bundle) {\n // oldBundlePath = 'entrypoints/popup.html' or 'entrypoints/options/index.html'\n\n // Find a matching entrypoint - oldBundlePath is the same as end end of the input path.\n const entrypoint = entrypoints.find(\n (entry) => !!normalizePath(entry.inputPath).endsWith(oldBundlePath),\n );\n if (entrypoint == null) {\n config.logger.debug(\n `No entrypoint found for ${oldBundlePath}, leaving in chunks directory`,\n );\n continue;\n }\n\n // Get the new bundle path\n const newBundlePath = getEntrypointBundlePath(\n entrypoint,\n config.outDir,\n extname(oldBundlePath),\n );\n if (newBundlePath === oldBundlePath) {\n config.logger.debug(\n 'HTML file is already in the correct location',\n oldBundlePath,\n );\n continue;\n }\n\n // Move file and update bundle\n // Do this inside a mutex lock so it only runs one at a time for concurrent multipage builds\n const oldAbsPath = resolve(config.outDir, oldBundlePath);\n const newAbsPath = resolve(config.outDir, newBundlePath);\n await ensureDir(dirname(newAbsPath));\n await fs.move(oldAbsPath, newAbsPath, { overwrite: true });\n\n const renamedChunk = {\n ...bundle[oldBundlePath],\n fileName: newBundlePath,\n };\n delete bundle[oldBundlePath];\n bundle[newBundlePath] = renamedChunk;\n }\n },\n };\n}\n","import { createUnimport } from 'unimport';\nimport { InternalConfig } from '../types';\nimport { getUnimportOptions } from '../utils/auto-imports';\nimport * as vite from 'vite';\nimport { extname } from 'path';\n\nconst ENABLED_EXTENSIONS: Record<string, boolean | undefined> = {\n '.js': true,\n '.jsx': true,\n '.ts': true,\n '.tsx': true,\n '.vue': true,\n '.svelte': true,\n};\n\n/**\n * Inject any global imports defined by unimport\n */\nexport function unimport(config: InternalConfig): vite.PluginOption {\n const options = getUnimportOptions(config);\n if (options === false) return [];\n\n const unimport = createUnimport(options);\n\n return {\n name: 'wxt:unimport',\n async config() {\n await unimport.scanImportsFromDir(undefined, { cwd: config.srcDir });\n },\n async transform(code, id) {\n const ext = extname(id);\n if (ENABLED_EXTENSIONS[ext]) return unimport.injectImports(code, id);\n },\n };\n}\n","import { UnimportOptions } from 'unimport';\nimport { InternalConfig } from '../types';\nimport { mergeConfig } from 'vite';\n\nexport function getUnimportOptions(\n config: InternalConfig,\n): Partial<UnimportOptions | false> {\n if (config.imports === false) return false;\n\n const defaultOptions: Partial<UnimportOptions> = {\n debugLog: config.logger.debug,\n imports: [{ name: 'defineConfig', from: 'wxt' }],\n presets: [{ package: 'wxt/client' }, { package: 'wxt/browser' }],\n warn: config.logger.warn,\n dirs: ['components', 'composables', 'hooks', 'utils'],\n };\n\n return mergeConfig(\n defaultOptions,\n config.imports,\n ) as Partial<UnimportOptions>;\n}\n","import { Plugin } from 'vite';\nimport { Entrypoint, InternalConfig } from '../types';\nimport fs from 'fs-extra';\nimport { resolve } from 'path';\nimport { normalizePath } from '../utils/paths';\n\n/**\n * Wraps a user's entrypoint with a vitual version with additional logic.\n */\nexport function virtualEntrypoin(\n type: Entrypoint['type'],\n config: InternalConfig,\n): Plugin {\n const virtualId = `virtual:wxt-${type}?`;\n const resolvedVirtualId = `\\0${virtualId}`;\n\n return {\n name: `wxt:virtual-entrypoint`,\n resolveId(id) {\n // Id doesn't start with prefix, it looks like this:\n // /path/to/project/virtual:background?/path/to/project/entrypoints/background.ts\n const index = id.indexOf(virtualId);\n if (index === -1) return;\n\n const inputPath = normalizePath(id.substring(index + virtualId.length));\n return resolvedVirtualId + inputPath;\n },\n async load(id) {\n if (!id.startsWith(resolvedVirtualId)) return;\n\n const inputPath = id.replace(resolvedVirtualId, '');\n const template = await fs.readFile(\n resolve(\n config.root,\n `node_modules/wxt/dist/virtual-modules/${type}-entrypoint.js`,\n ),\n 'utf-8',\n );\n return template.replace(`virtual:user-${type}`, inputPath);\n },\n };\n}\n","import { InternalConfig } from '../types';\nimport * as vite from 'vite';\n\nexport function tsconfigPaths(config: InternalConfig): vite.Plugin {\n return {\n name: 'wxt:aliases',\n async config() {\n return {\n resolve: {\n alias: {\n '@@': config.root,\n '~~': config.root,\n '@': config.srcDir,\n '~': config.srcDir,\n },\n },\n };\n },\n };\n}\n","import { Plugin } from 'vite';\n\n/**\n * In dev mode, if there's not a background script listed, we need to add one.\n *\n * This define's a virtual module that is basically just a noop.\n */\nexport function noopBackground(): Plugin {\n const virtualModuleId = VIRTUAL_NOOP_BACKGROUND_MODULE_ID;\n const resolvedVirtualModuleId = '\\0' + virtualModuleId;\n return {\n name: 'wxt:noop-background',\n resolveId(id) {\n if (id === virtualModuleId) return resolvedVirtualModuleId;\n },\n load(id) {\n if (id === resolvedVirtualModuleId) {\n return `import { defineBackground } from 'wxt/client';\\nexport default defineBackground(() => void 0)`;\n }\n },\n };\n}\n\nexport const VIRTUAL_NOOP_BACKGROUND_MODULE_ID = 'virtual:user-background';\n","import * as vite from 'vite';\nimport { Entrypoint, InternalConfig } from '../types';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\n\n/**\n * Rename CSS entrypoint outputs to ensure a JS file is not generated, and that the CSS file is\n * placed in the correct place.\n *\n * It:\n * 1. Renames CSS files to their final paths\n * 2. Removes the JS file that get's output by lib mode\n *\n * THIS PLUGIN SHOULD ONLY BE APPLIED TO CSS LIB MODE BUILDS. It should not be added to every build.\n */\nexport function cssEntrypoints(\n entrypoint: Entrypoint,\n config: InternalConfig,\n): vite.Plugin {\n return {\n name: 'wxt:css-entrypoint',\n config() {\n return {\n build: {\n rollupOptions: {\n output: {\n assetFileNames: () =>\n getEntrypointBundlePath(entrypoint, config.outDir, '.css'),\n },\n },\n },\n };\n },\n generateBundle(_, bundle) {\n Object.keys(bundle).forEach((file) => {\n if (file.endsWith('.js')) delete bundle[file];\n });\n },\n };\n}\n","import * as vite from 'vite';\nimport { visualizer } from 'rollup-plugin-visualizer';\n\nlet increment = 0;\n\nexport function bundleAnalysis(): vite.Plugin {\n return visualizer({\n emitFile: true,\n template: 'raw-data',\n filename: `stats-${increment++}.json`,\n }) as vite.Plugin;\n}\n","import { InternalConfig } from '../types';\n\nexport function getGlobals(\n config: InternalConfig,\n): Array<{ name: string; value: any; type: string }> {\n return [\n {\n name: '__MANIFEST_VERSION__',\n value: config.manifestVersion,\n type: `2 | 3`,\n },\n {\n name: '__BROWSER__',\n value: config.browser,\n type: `string`,\n },\n {\n name: '__IS_CHROME__',\n value: config.browser === 'chrome',\n type: `boolean`,\n },\n {\n name: '__IS_FIREFOX__',\n value: config.browser === 'firefox',\n type: `boolean`,\n },\n {\n name: '__IS_SAFARI__',\n value: config.browser === 'safari',\n type: `boolean`,\n },\n {\n name: '__IS_EDGE__',\n value: config.browser === 'edge',\n type: `boolean`,\n },\n {\n name: '__IS_OPERA__',\n value: config.browser === 'opera',\n type: `boolean`,\n },\n {\n name: '__COMMAND__',\n value: config.command,\n type: `\"build\" | \"serve\"`,\n },\n ];\n}\n\nexport function getEntrypointGlobals(\n config: InternalConfig,\n entrypointName: string,\n) {\n return [\n {\n name: '__ENTRYPOINT__',\n value: entrypointName,\n type: `string`,\n },\n ];\n}\n","import { BuildOutput, WxtDevServer, InlineConfig } from './core/types';\nimport { getInternalConfig } from './core/utils/getInternalConfig';\nimport pc from 'picocolors';\nimport { detectDevChanges } from './core/utils/detectDevChanges';\nimport { Mutex } from 'async-mutex';\nimport { consola } from 'consola';\nimport { relative } from 'node:path';\nimport { getEntrypointOutputFile } from './core/utils/entrypoints';\nimport { buildInternal, rebuild } from './core/build';\nimport {\n getServerInfo,\n reloadContentScripts,\n reloadHtmlPages,\n setupServer,\n} from './core/server';\n\nexport * from './core/clean';\nexport { version } from '../package.json';\nexport * from './core/types/external';\nexport * from './core/utils/defineConfig';\nexport * from './core/utils/defineRunnerConfig';\n\n/**\n * Bundles the extension for production. Returns a promise of the build result.\n */\nexport async function build(config: InlineConfig): Promise<BuildOutput> {\n const internalConfig = await getInternalConfig(config, 'build');\n return await buildInternal(internalConfig);\n}\n\n/**\n * Creates a dev server, pre-builds all the files that need to exist to load the extension, and open\n * the browser with the extension installed.\n */\nexport async function createServer(\n config?: InlineConfig,\n): Promise<WxtDevServer> {\n const serverInfo = await getServerInfo();\n\n const getLatestInternalConfig = async () => {\n return getInternalConfig(\n {\n ...config,\n vite: () => serverInfo.viteServerConfig,\n },\n 'serve',\n );\n };\n\n let internalConfig = await getLatestInternalConfig();\n const server = await setupServer(serverInfo, internalConfig);\n internalConfig.server = server;\n\n const fileChangedMutex = new Mutex();\n const changeQueue: Array<[string, string]> = [];\n\n server.ws.on('wxt:background-initialized', () => {\n // Register content scripts for the first time since they're not listed in the manifest\n reloadContentScripts(server.currentOutput.steps, internalConfig, server);\n });\n\n server.watcher.on('all', async (event, path, _stats) => {\n // Here, \"path\" is a non-normalized path (ie: C:\\\\users\\\\... instead of C:/users/...)\n if (path.startsWith(internalConfig.outBaseDir)) return;\n changeQueue.push([event, path]);\n\n await fileChangedMutex.runExclusive(async () => {\n const fileChanges = changeQueue.splice(0, changeQueue.length);\n if (fileChanges.length === 0) return;\n\n const changes = detectDevChanges(fileChanges, server.currentOutput);\n if (changes.type === 'no-change') return;\n\n // Log the entrypoints that were effected\n internalConfig.logger.info(\n `Changed: ${Array.from(new Set(fileChanges.map((change) => change[1])))\n .map((file) => pc.dim(relative(internalConfig.root, file)))\n .join(', ')}`,\n );\n const rebuiltNames = changes.rebuildGroups\n .flat()\n .map((entry) => {\n return pc.cyan(\n relative(internalConfig.outDir, getEntrypointOutputFile(entry, '')),\n );\n })\n .join(pc.dim(', '));\n\n // Get latest config and Rebuild groups with changes\n internalConfig = await getLatestInternalConfig();\n internalConfig.server = server;\n const { output: newOutput } = await rebuild(\n internalConfig,\n // TODO: this excludes new entrypoints, so they're not built until the dev command is restarted\n changes.rebuildGroups,\n changes.cachedOutput,\n );\n server.currentOutput = newOutput;\n\n // Perform reloads\n switch (changes.type) {\n case 'extension-reload':\n server.reloadExtension();\n break;\n case 'html-reload':\n reloadHtmlPages(changes.rebuildGroups, server, internalConfig);\n break;\n case 'content-script-reload':\n reloadContentScripts(changes.changedSteps, internalConfig, server);\n break;\n }\n consola.success(`Reloaded: ${rebuiltNames}`);\n });\n });\n\n return server;\n}\n","/**\n * Checks if `predicate` returns truthy for all elements of the array.\n */\nexport function every<T>(\n array: T[],\n predicate: (item: T, index: number) => boolean,\n): boolean {\n for (let i = 0; i < array.length; i++)\n if (!predicate(array[i], i)) return false;\n return true;\n}\n","import { BuildOutput, BuildStepOutput, EntrypointGroup } from '../types';\nimport * as vite from 'vite';\nimport { every } from './arrays';\nimport { normalizePath } from './paths';\n\n/**\n * Compare the changed files vs the build output and determine what kind of reload needs to happen:\n *\n * - Do nothing\n * - CSS or JS file associated with an HTML page is changed - this is handled automatically by the\n * dev server\n * - Change isn't used by any of the entrypoints\n * - Reload Content script\n * - CSS or JS file associated with a content script\n * - Background script will be told to reload the content script\n * - Reload HTML file\n * - HTML file itself is saved - HMR doesn't handle this because the HTML pages are pre-rendered\n * - Chrome is OK reloading the page when the HTML file is changed without reloading the whole\n * extension. Not sure about firefox, this might need to change to an extension reload\n * - Reload extension\n * - Background script is changed\n * - Manifest is different\n * - Restart browser\n * - Config file changed (wxt.config.ts, .env, web-ext.config.ts, etc)\n */\nexport function detectDevChanges(\n changedFiles: [event: string, path: string][],\n currentOutput: BuildOutput | undefined,\n): DevModeChange {\n if (currentOutput == null) return { type: 'no-change' };\n\n const changedSteps = new Set(\n changedFiles.flatMap((changedFile) =>\n findEffectedSteps(changedFile, currentOutput),\n ),\n );\n if (changedSteps.size === 0) return { type: 'no-change' };\n\n const unchangedOutput: BuildOutput = {\n manifest: currentOutput.manifest,\n steps: [],\n publicAssets: [],\n };\n const changedOutput: BuildOutput = {\n manifest: currentOutput.manifest,\n steps: [],\n publicAssets: [],\n };\n\n for (const step of currentOutput.steps) {\n if (changedSteps.has(step)) {\n changedOutput.steps.push(step);\n } else {\n unchangedOutput.steps.push(step);\n }\n }\n for (const asset of currentOutput.publicAssets) {\n if (changedSteps.has(asset)) {\n changedOutput.publicAssets.push(asset);\n } else {\n unchangedOutput.publicAssets.push(asset);\n }\n }\n\n const isOnlyHtmlChanges =\n changedFiles.length > 0 &&\n every(changedFiles, ([_, file]) => file.endsWith('.html'));\n if (isOnlyHtmlChanges) {\n return {\n type: 'html-reload',\n cachedOutput: unchangedOutput,\n rebuildGroups: changedOutput.steps.map((step) => step.entrypoints),\n };\n }\n\n const isOnlyContentScripts =\n changedOutput.steps.length > 0 &&\n every(\n changedOutput.steps.flatMap((step) => step.entrypoints),\n (entry) => entry.type === 'content-script',\n );\n if (isOnlyContentScripts) {\n return {\n type: 'content-script-reload',\n cachedOutput: unchangedOutput,\n changedSteps: changedOutput.steps,\n rebuildGroups: changedOutput.steps.map((step) => step.entrypoints),\n };\n }\n\n return {\n type: 'extension-reload',\n cachedOutput: unchangedOutput,\n rebuildGroups: changedOutput.steps.map((step) => step.entrypoints),\n };\n}\n\n/**\n * For a single change, return all the step of the build output that were effected by it.\n */\nfunction findEffectedSteps(\n changedFile: [event: string, path: string],\n currentOutput: BuildOutput,\n): DetectedChange[] {\n const changes: DetectedChange[] = [];\n const changedPath = normalizePath(changedFile[1]);\n\n const isChunkEffected = (\n chunk: vite.Rollup.OutputChunk | vite.Rollup.OutputAsset,\n ): boolean =>\n // If it's an HTML file with the same path, is is effected because HTML files need to be pre-rendered\n // fileName is normalized, relative bundle path\n (chunk.type === 'asset' && changedPath.endsWith(chunk.fileName)) ||\n // If it's a chunk that depends on the changed file, it is effected\n // moduleIds are absolute, normalized paths\n (chunk.type === 'chunk' && chunk.moduleIds.includes(changedPath));\n\n for (const step of currentOutput.steps) {\n const effectedChunk = step.chunks.find((chunk) => isChunkEffected(chunk));\n if (effectedChunk) changes.push(step);\n }\n\n const effectedAsset = currentOutput.publicAssets.find((chunk) =>\n isChunkEffected(chunk),\n );\n if (effectedAsset) changes.push(effectedAsset);\n\n return changes;\n}\n\n/**\n * Contains information about what files changed, what needs rebuilt, and the type of reload that is\n * required.\n */\nexport type DevModeChange =\n | NoChange\n | HtmlReload\n | ExtensionReload\n | ContentScriptReload;\n// | BrowserRestart\n\ninterface NoChange {\n type: 'no-change';\n}\n\ninterface RebuildChange {\n /**\n * The list of entrypoints that need rebuilt.\n */\n rebuildGroups: EntrypointGroup[];\n /**\n * The previous output stripped of any files are going to change.\n */\n cachedOutput: BuildOutput;\n}\n\ninterface HtmlReload extends RebuildChange {\n type: 'html-reload';\n}\n\ninterface ExtensionReload extends RebuildChange {\n type: 'extension-reload';\n}\n\n// interface BrowserRestart extends RebuildChange {\n// type: 'browser-restart';\n// }\n\ninterface ContentScriptReload extends RebuildChange {\n type: 'content-script-reload';\n changedSteps: BuildStepOutput[];\n}\n\n/**\n * When figuring out what needs reloaded, this stores the step that was changed, or the public\n * directory asset that was changed. It doesn't know what type of change is required yet. Just an\n * intermediate type.\n */\ntype DetectedChange = BuildStepOutput | vite.Rollup.OutputAsset;\n","import * as vite from 'vite';\nimport {\n BuildOutput,\n BuildStepOutput,\n Entrypoint,\n EntrypointGroup,\n InternalConfig,\n} from '../types';\nimport * as wxtPlugins from '../vite-plugins';\nimport { removeEmptyDirs } from '../utils/removeEmptyDirs';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\nimport fs from 'fs-extra';\nimport { dirname, resolve } from 'path';\nimport { getPublicFiles } from '../utils/public';\nimport { getEntrypointGlobals } from '../utils/globals';\nimport type { Ora } from 'ora';\nimport pc from 'picocolors';\n\nexport async function buildEntrypoints(\n groups: EntrypointGroup[],\n config: InternalConfig,\n spinner: Ora,\n): Promise<Omit<BuildOutput, 'manifest'>> {\n const steps: BuildStepOutput[] = [];\n for (let i = 0; i < groups.length; i++) {\n const group = groups[i];\n\n spinner.text =\n pc.dim(`[${i + 1}/${groups.length}]`) +\n ` ${[group]\n .flat()\n .map((e) => e.name)\n .join(pc.dim(', '))}`;\n\n const step = Array.isArray(group)\n ? await buildMultipleEntrypoints(group, config)\n : await buildSingleEntrypoint(group, config);\n steps.push(step);\n }\n const publicAssets = await copyPublicDirectory(config);\n\n // Remove any empty directories from moving outputs around\n await removeEmptyDirs(config.outDir);\n\n return { publicAssets, steps };\n}\n\n/**\n * Use Vite's lib mode + IIFE format to bundle the entrypoint to a single file.\n */\nasync function buildSingleEntrypoint(\n entrypoint: Entrypoint,\n config: InternalConfig,\n): Promise<BuildStepOutput> {\n // Should this entrypoint be wrapped by the vite-plugins/virtualEntrypoint plugin?\n const isVirtual = ['background', 'content-script'].includes(entrypoint.type);\n const entry = isVirtual\n ? `virtual:wxt-${entrypoint.type}?${entrypoint.inputPath}`\n : entrypoint.inputPath;\n\n const plugins: NonNullable<vite.UserConfig['plugins']> = [];\n if (\n entrypoint.type === 'content-script-style' ||\n entrypoint.type === 'unlisted-style'\n ) {\n plugins.push(wxtPlugins.cssEntrypoints(entrypoint, config));\n }\n\n const libMode: vite.UserConfig = {\n plugins,\n build: {\n lib: {\n entry,\n formats: ['iife'],\n name: '_',\n fileName: entrypoint.name,\n },\n rollupOptions: {\n output: {\n // There's only a single output for this build, so we use the desired bundle path for the\n // entry output (like \"content-scripts/overlay.js\")\n entryFileNames: getEntrypointBundlePath(\n entrypoint,\n config.outDir,\n '.js',\n ),\n // Output content script CSS to `content-scripts/`, but all other scripts are written to\n // `assets/`.\n assetFileNames: ({ name }) => {\n if (entrypoint.type === 'content-script' && name?.endsWith('css')) {\n return `content-scripts/${entrypoint.name}.[ext]`;\n } else {\n return `assets/${entrypoint.name}.[ext]`;\n }\n },\n },\n },\n },\n define: {\n // See https://github.com/aklinker1/vite-plugin-web-extension/issues/96\n 'process.env.NODE_ENV': JSON.stringify(config.mode),\n },\n };\n for (const global of getEntrypointGlobals(config, entrypoint.name)) {\n libMode.define![global.name] = JSON.stringify(global.value);\n }\n const entryConfig = vite.mergeConfig(\n libMode,\n await config.vite(config.env),\n ) as vite.InlineConfig;\n\n const result = await vite.build(entryConfig);\n return {\n entrypoints: entrypoint,\n chunks: getBuildOutputChunks(result),\n };\n}\n\n/**\n * Use Vite's multipage build to bundle all the entrypoints in a single step.\n */\nasync function buildMultipleEntrypoints(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): Promise<BuildStepOutput> {\n const multiPage: vite.UserConfig = {\n plugins: [wxtPlugins.multipageMove(entrypoints, config)],\n build: {\n rollupOptions: {\n input: entrypoints.reduce<Record<string, string>>((input, entry) => {\n input[entry.name] = entry.inputPath;\n return input;\n }, {}),\n output: {\n // Include a hash to prevent conflicts\n chunkFileNames: 'chunks/[name]-[hash].js',\n // Include a hash to prevent conflicts\n entryFileNames: 'chunks/[name]-[hash].js',\n // We can't control the \"name\", so we need a hash to prevent conflicts\n assetFileNames: 'assets/[name]-[hash].[ext]',\n },\n },\n },\n define: {},\n };\n for (const global of getEntrypointGlobals(config, 'html')) {\n multiPage.define![global.name] = JSON.stringify(global.value);\n }\n\n const entryConfig = vite.mergeConfig(\n multiPage,\n await config.vite(config.env),\n ) as vite.UserConfig;\n\n const result = await vite.build(entryConfig);\n return {\n entrypoints,\n chunks: getBuildOutputChunks(result),\n };\n}\n\nfunction getBuildOutputChunks(\n result: Awaited<ReturnType<typeof vite.build>>,\n): BuildStepOutput['chunks'] {\n if ('on' in result) throw Error('wxt does not support vite watch mode.');\n if (Array.isArray(result)) return result.flatMap(({ output }) => output);\n return result.output;\n}\n\nasync function copyPublicDirectory(\n config: InternalConfig,\n): Promise<BuildOutput['publicAssets']> {\n const files = await getPublicFiles(config);\n if (files.length === 0) return [];\n\n const publicAssets: BuildOutput['publicAssets'] = [];\n for (const file of files) {\n const srcPath = resolve(config.publicDir, file);\n const outPath = resolve(config.outDir, file);\n\n await fs.ensureDir(dirname(outPath));\n await fs.copyFile(srcPath, outPath);\n publicAssets.push({\n type: 'asset',\n fileName: file,\n name: file,\n needsCodeReference: false,\n source: await fs.readFile(srcPath),\n });\n }\n\n return publicAssets;\n}\n","import fs from 'fs-extra';\nimport path from 'path';\n\nexport async function removeEmptyDirs(dir: string): Promise<void> {\n const files = await fs.readdir(dir);\n for (const file of files) {\n const filePath = path.join(dir, file);\n const stats = await fs.stat(filePath);\n if (stats.isDirectory()) {\n await removeEmptyDirs(filePath);\n }\n }\n\n try {\n await fs.rmdir(dir);\n } catch {\n // noop on failure - this means the directory was not empty.\n }\n}\n","import { InternalConfig } from '../types';\nimport fs from 'fs-extra';\nimport glob from 'fast-glob';\nimport { unnormalizePath } from './paths';\n\n/**\n * Get all the files in the project's public directory. Returned paths are relative to the\n * `config.publicDir`.\n */\nexport async function getPublicFiles(\n config: InternalConfig,\n): Promise<string[]> {\n if (!(await fs.exists(config.publicDir))) return [];\n\n const files = await glob('**/*', { cwd: config.publicDir });\n return files.map(unnormalizePath);\n}\n","import { relative, resolve } from 'path';\nimport {\n BackgroundEntrypoint,\n BackgroundScriptDefintition,\n BaseEntrypointOptions,\n ContentScriptDefinition,\n ContentScriptEntrypoint,\n Entrypoint,\n GenericEntrypoint,\n InternalConfig,\n OptionsEntrypoint,\n PopupEntrypoint,\n} from '../types';\nimport fs from 'fs-extra';\nimport { minimatch } from 'minimatch';\nimport { parseHTML } from 'linkedom';\nimport JSON5 from 'json5';\nimport { importEntrypointFile } from '../utils/importEntrypointFile';\nimport glob from 'fast-glob';\nimport {\n getEntrypointName,\n resolvePerBrowserOption,\n} from '../utils/entrypoints';\nimport { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '../vite-plugins/noopBackground';\nimport { CSS_EXTENSIONS_PATTERN } from '../utils/paths';\n\n/**\n * Return entrypoints and their configuration by looking through the project's files.\n */\nexport async function findEntrypoints(\n config: InternalConfig,\n): Promise<Entrypoint[]> {\n const relativePaths = await glob('**/*', {\n cwd: config.entrypointsDir,\n });\n // Ensure consistent output\n relativePaths.sort();\n\n const pathGlobs = Object.keys(PATH_GLOB_TO_TYPE_MAP);\n const existingNames: Record<string, Entrypoint | undefined> = {};\n\n const entrypoints: Entrypoint[] = [];\n let hasBackground = false;\n await Promise.all(\n relativePaths.map(async (relativePath) => {\n const path = resolve(config.entrypointsDir, relativePath);\n const matchingGlob = pathGlobs.find((glob) =>\n minimatch(relativePath, glob),\n );\n\n if (matchingGlob == null) {\n return config.logger.warn(\n `${relativePath} does not match any known entrypoint. Known entrypoints:\\n${JSON.stringify(\n PATH_GLOB_TO_TYPE_MAP,\n null,\n 2,\n )}`,\n );\n }\n\n const type = PATH_GLOB_TO_TYPE_MAP[matchingGlob];\n if (type === 'ignored') return;\n\n let entrypoint: Entrypoint;\n switch (type) {\n case 'popup':\n entrypoint = await getPopupEntrypoint(config, path);\n break;\n case 'options':\n entrypoint = await getOptionsEntrypoint(config, path);\n break;\n case 'background':\n entrypoint = await getBackgroundEntrypoint(config, path);\n hasBackground = true;\n break;\n case 'content-script':\n entrypoint = await getContentScriptEntrypoint(\n config,\n getEntrypointName(config.entrypointsDir, path),\n path,\n );\n break;\n case 'unlisted-page':\n entrypoint = await getUnlistedPageEntrypoint(config, path);\n break;\n case 'content-script-style':\n entrypoint = {\n type,\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: resolve(config.outDir, CONTENT_SCRIPT_OUT_DIR),\n options: {\n include: undefined,\n exclude: undefined,\n },\n };\n break;\n default:\n entrypoint = {\n type,\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: config.outDir,\n options: {\n include: undefined,\n exclude: undefined,\n },\n };\n }\n\n const withSameName = existingNames[entrypoint.name];\n if (withSameName) {\n throw Error(\n `Multiple entrypoints with the name \"${\n entrypoint.name\n }\" detected, but only one is allowed: ${[\n relative(config.root, withSameName.inputPath),\n relative(config.root, entrypoint.inputPath),\n ].join(', ')}`,\n );\n }\n entrypoints.push(entrypoint);\n existingNames[entrypoint.name] = entrypoint;\n }),\n );\n if (config.command === 'serve' && !hasBackground) {\n entrypoints.push(\n await getBackgroundEntrypoint(config, VIRTUAL_NOOP_BACKGROUND_MODULE_ID),\n );\n }\n\n config.logger.debug('All entrypoints:', entrypoints);\n const targetEntrypoints = entrypoints.filter((entry) => {\n const { include, exclude } = entry.options;\n if (include?.length && exclude?.length) {\n config.logger.warn(\n `The ${entry.name} entrypoint lists both include and exclude, but only one can be used per entrypoint. Entrypoint ignored.`,\n );\n return false;\n }\n if (exclude?.length && !include?.length) {\n return !exclude.includes(config.browser);\n }\n if (include?.length && !exclude?.length) {\n return include.includes(config.browser);\n }\n\n return true;\n });\n config.logger.debug(`${config.browser} entrypoints:`, targetEntrypoints);\n return targetEntrypoints;\n}\n\nfunction getHtmlBaseOptions(document: Document): BaseEntrypointOptions {\n const options: BaseEntrypointOptions = {};\n\n const includeContent = document\n .querySelector(\"meta[name='manifest.include']\")\n ?.getAttribute('content');\n if (includeContent) {\n options.include = JSON5.parse(includeContent);\n }\n\n const excludeContent = document\n .querySelector(\"meta[name='manifest.exclude']\")\n ?.getAttribute('content');\n if (excludeContent) {\n options.exclude = JSON5.parse(excludeContent);\n }\n\n return options;\n}\n\n/**\n * @param path Absolute path to the popup HTML file.\n * @param content String contents of the file at the path.\n */\nasync function getPopupEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<PopupEntrypoint> {\n const content = await fs.readFile(path, 'utf-8');\n const { document } = parseHTML(content);\n\n const options: PopupEntrypoint['options'] = getHtmlBaseOptions(document);\n\n const title = document.querySelector('title');\n if (title != null) options.defaultTitle = title.textContent ?? undefined;\n\n const defaultIconContent = document\n .querySelector(\"meta[name='manifest.default_icon']\")\n ?.getAttribute('content');\n if (defaultIconContent) {\n try {\n options.defaultIcon = JSON5.parse(defaultIconContent);\n } catch (err) {\n config.logger.fatal(\n `Failed to parse default_icon meta tag content as JSON5. content=${defaultIconContent}`,\n err,\n );\n }\n }\n\n const mv2KeyContent = document\n .querySelector(\"meta[name='manifest.type']\")\n ?.getAttribute('content');\n if (mv2KeyContent) {\n options.mv2Key =\n mv2KeyContent === 'page_action' ? 'page_action' : 'browser_action';\n }\n\n return {\n type: 'popup',\n name: 'popup',\n options,\n inputPath: path,\n outputDir: config.outDir,\n };\n}\n\n/**\n * @param path Absolute path to the options HTML file.\n * @param content String contents of the file at the path.\n */\nasync function getOptionsEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<OptionsEntrypoint> {\n const content = await fs.readFile(path, 'utf-8');\n const { document } = parseHTML(content);\n\n const options: OptionsEntrypoint['options'] = getHtmlBaseOptions(document);\n\n const openInTabContent = document\n .querySelector(\"meta[name='manifest.open_in_tab']\")\n ?.getAttribute('content');\n if (openInTabContent) {\n options.openInTab = openInTabContent === 'true';\n }\n\n const chromeStyleContent = document\n .querySelector(\"meta[name='manifest.chrome_style']\")\n ?.getAttribute('content');\n if (chromeStyleContent) {\n options.chromeStyle = chromeStyleContent === 'true';\n }\n\n const browserStyleContent = document\n .querySelector(\"meta[name='manifest.browser_style']\")\n ?.getAttribute('content');\n if (browserStyleContent) {\n options.browserStyle = browserStyleContent === 'true';\n }\n\n return {\n type: 'options',\n name: 'options',\n options,\n inputPath: path,\n outputDir: config.outDir,\n };\n}\n\n/**\n * @param path Absolute path to the HTML file.\n * @param content String contents of the file at the path.\n */\nasync function getUnlistedPageEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<GenericEntrypoint> {\n const content = await fs.readFile(path, 'utf-8');\n const { document } = parseHTML(content);\n\n return {\n type: 'unlisted-page',\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: config.outDir,\n options: getHtmlBaseOptions(document),\n };\n}\n\n/**\n * @param path Absolute path to the background's TS file.\n */\nasync function getBackgroundEntrypoint(\n config: InternalConfig,\n path: string,\n): Promise<BackgroundEntrypoint> {\n let options: Omit<BackgroundScriptDefintition, 'main'> = {};\n if (path !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {\n const defaultExport =\n await importEntrypointFile<BackgroundScriptDefintition>(path, config);\n if (defaultExport == null) {\n throw Error('Background script does not have a default export');\n }\n const { main: _, ...moduleOptions } = defaultExport;\n options = moduleOptions;\n }\n return {\n type: 'background',\n name: 'background',\n inputPath: path,\n outputDir: config.outDir,\n options: {\n ...options,\n type: resolvePerBrowserOption(options.type, config.browser),\n persistent: resolvePerBrowserOption(options.persistent, config.browser),\n },\n };\n}\n\n/**\n * @param path Absolute path to the content script's TS file.\n */\nasync function getContentScriptEntrypoint(\n config: InternalConfig,\n name: string,\n path: string,\n): Promise<ContentScriptEntrypoint> {\n const { main: _, ...options } =\n await importEntrypointFile<ContentScriptDefinition>(path, config);\n if (options == null) {\n throw Error(`Content script ${name} does not have a default export`);\n }\n return {\n type: 'content-script',\n name: getEntrypointName(config.entrypointsDir, path),\n inputPath: path,\n outputDir: resolve(config.outDir, CONTENT_SCRIPT_OUT_DIR),\n options,\n };\n}\n\nconst PATH_GLOB_TO_TYPE_MAP: Record<string, Entrypoint['type'] | 'ignored'> = {\n 'sandbox.html': 'sandbox',\n 'sandbox/index.html': 'sandbox',\n '*.sandbox.html': 'sandbox',\n '*.sandbox/index.html': 'sandbox',\n\n 'bookmarks.html': 'bookmarks',\n 'bookmarks/index.html': 'bookmarks',\n\n 'history.html': 'history',\n 'history/index.html': 'history',\n\n 'newtab.html': 'newtab',\n 'newtab/index.html': 'newtab',\n\n 'sidepanel.html': 'sidepanel',\n 'sidepanel/index.html': 'sidepanel',\n '*.sidepanel.html': 'sidepanel',\n '*.sidepanel/index.html': 'sidepanel',\n\n 'devtools.html': 'devtools',\n 'devtools/index.html': 'devtools',\n\n 'background.[jt]s': 'background',\n 'background/index.[jt]s': 'background',\n [VIRTUAL_NOOP_BACKGROUND_MODULE_ID]: 'background',\n\n 'content.[jt]s?(x)': 'content-script',\n 'content/index.[jt]s?(x)': 'content-script',\n '*.content.[jt]s?(x)': 'content-script',\n '*.content/index.[jt]s?(x)': 'content-script',\n [`content.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n [`*.content.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n [`content/index.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n [`*.content/index.${CSS_EXTENSIONS_PATTERN}`]: 'content-script-style',\n\n 'popup.html': 'popup',\n 'popup/index.html': 'popup',\n\n 'options.html': 'options',\n 'options/index.html': 'options',\n\n '*.html': 'unlisted-page',\n '*/index.html': 'unlisted-page',\n '*.[jt]s': 'unlisted-script',\n '*/index.ts': 'unlisted-script',\n [`*.${CSS_EXTENSIONS_PATTERN}`]: 'unlisted-style',\n [`*/index.${CSS_EXTENSIONS_PATTERN}`]: 'unlisted-style',\n\n // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests\n '*/**': 'ignored',\n};\n\nconst CONTENT_SCRIPT_OUT_DIR = 'content-scripts';\n","import createJITI, { TransformOptions as JitiTransformOptions } from 'jiti';\nimport { InternalConfig } from '../types';\nimport { createUnimport } from 'unimport';\nimport fs from 'fs-extra';\nimport { resolve } from 'path';\nimport { getUnimportOptions } from './auto-imports';\nimport { removeProjectImportStatements } from './strings';\nimport { normalizePath } from './paths';\nimport { TransformOptions, transformSync } from 'esbuild';\n\n/**\n * Get the value from the default export of a `path`.\n *\n * It works by:\n *\n * 1. Reading the file text\n * 2. Stripping all imports from it via regex\n * 3. Auto-import only the client helper functions\n *\n * This prevents resolving imports of imports, speeding things up and preventing \"xxx is not\n * defined\" errors.\n *\n * Downside is that code cannot be executed outside of the main fucntion for the entrypoint,\n * otherwise you will see \"xxx is not defined\" errors for any imports used outside of main function.\n */\nexport async function importEntrypointFile<T>(\n path: string,\n config: InternalConfig,\n): Promise<T> {\n config.logger.debug('Loading file metadata:', path);\n // JITI & Babel uses normalized paths.\n const normalPath = normalizePath(path);\n\n const unimport = createUnimport({\n ...getUnimportOptions(config),\n // Only allow specific imports, not all from the project\n dirs: [],\n });\n await unimport.init();\n\n const text = await fs.readFile(path, 'utf-8');\n const textNoImports = removeProjectImportStatements(text);\n const { code } = await unimport.injectImports(textNoImports);\n config.logger.debug(\n ['Text:', text, 'No imports:', textNoImports, 'Code:', code].join('\\n'),\n );\n\n const jiti = createJITI(__filename, {\n cache: false,\n debug: config.debug,\n esmResolve: true,\n interopDefault: true,\n alias: {\n 'webextension-polyfill': resolve(\n config.root,\n 'node_modules/wxt/dist/virtual-modules/fake-browser.js',\n ),\n },\n // List of extensions to transform with esbuild\n extensions: ['.ts', '.cts', '.mts', '.tsx', '.js', '.cjs', '.mjs', '.jsx'],\n transform(opts) {\n const isEntrypoint = opts.filename === normalPath;\n return transformSync(\n // Use modified source code for entrypoints\n isEntrypoint ? code : opts.source,\n getEsbuildOptions(opts),\n );\n },\n });\n\n try {\n return await jiti(path);\n } catch (err) {\n config.logger.error(err);\n throw err;\n }\n}\n\nfunction getEsbuildOptions(opts: JitiTransformOptions): TransformOptions {\n const isJsx = opts.filename?.endsWith('x');\n return {\n format: 'cjs',\n loader: isJsx ? 'tsx' : 'ts',\n jsx: isJsx ? 'automatic' : undefined,\n };\n}\n","export function kebabCaseAlphanumeric(str: string): string {\n return str\n .toLowerCase()\n .replace(/[^a-z0-9-\\s]/g, '') // Remove all non-alphanumeric, non-hyphen characters\n .replace(/\\s+/g, '-'); // Replace spaces with hyphens\n}\n\n/**\n * Removes import statements from the top of a file. Keeps import.meta and inline, async `import()`\n * calls.\n */\nexport function removeImportStatements(text: string): string {\n return text.replace(\n /(import\\s?[{\\w][\\s\\S]*?from\\s?[\"'][\\s\\S]*?[\"'];?|import\\s?[\"'][\\s\\S]*?[\"'];?)/gm,\n '',\n );\n}\n\n/**\n * Removes imports, ensuring that some of WXT's client imports are present, so that entrypoints can be parsed if auto-imports are disabled.\n */\nexport function removeProjectImportStatements(text: string): string {\n const noImports = removeImportStatements(text);\n\n return `import { defineContentScript, defineBackground } from 'wxt/client';\n\n${noImports}`;\n}\n","import { UnimportOptions, createUnimport } from 'unimport';\nimport { Entrypoint, InternalConfig } from '../types';\nimport fs from 'fs-extra';\nimport { relative, resolve } from 'path';\nimport { getEntrypointBundlePath } from '../utils/entrypoints';\nimport { getUnimportOptions } from '../utils/auto-imports';\nimport { getEntrypointGlobals, getGlobals } from '../utils/globals';\nimport { getPublicFiles } from '../utils/public';\nimport { normalizePath } from '../utils/paths';\nimport path from 'node:path';\nimport { Message, parseI18nMessages } from '../utils/i18n';\nimport { writeFileIfDifferent } from '../utils/fs';\n\n/**\n * Generate and write all the files inside the `InternalConfig.typesDir` directory.\n */\nexport async function generateTypesDir(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): Promise<void> {\n await fs.ensureDir(config.typesDir);\n\n const references: string[] = [];\n\n const imports = getUnimportOptions(config);\n if (imports !== false) {\n references.push(await writeImportsDeclarationFile(config, imports));\n }\n\n references.push(await writePathsDeclarationFile(entrypoints, config));\n references.push(await writeI18nDeclarationFile(config));\n references.push(await writeGlobalsDeclarationFile(config));\n\n const mainReference = await writeMainDeclarationFile(references, config);\n await writeTsConfigFile(mainReference, config);\n}\n\nasync function writeImportsDeclarationFile(\n config: InternalConfig,\n unimportOptions: Partial<UnimportOptions>,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'imports.d.ts');\n const unimport = createUnimport(unimportOptions);\n\n // Load project imports into unimport memory so they are output via generateTypeDeclarations\n await unimport.scanImportsFromDir(undefined, { cwd: config.srcDir });\n\n await writeFileIfDifferent(\n filePath,\n ['// Generated by wxt', await unimport.generateTypeDeclarations()].join(\n '\\n',\n ) + '\\n',\n );\n\n return filePath;\n}\n\nasync function writePathsDeclarationFile(\n entrypoints: Entrypoint[],\n config: InternalConfig,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'paths.d.ts');\n const unions = entrypoints\n .map((entry) =>\n getEntrypointBundlePath(\n entry,\n config.outDir,\n entry.inputPath.endsWith('.html') ? '.html' : '.js',\n ),\n )\n .concat(await getPublicFiles(config))\n .map(normalizePath)\n .map((path) => ` | \"/${path}\"`)\n .sort()\n .join('\\n');\n\n const template = `// Generated by wxt\nimport \"wxt/browser\";\n\ndeclare module \"wxt/browser\" {\n type PublicPath =\n{{ union }}\n export interface WxtRuntime extends Runtime.Static {\n getURL(path: PublicPath): string;\n }\n}\n`;\n\n await writeFileIfDifferent(\n filePath,\n template.replace('{{ union }}', unions || ' | never'),\n );\n\n return filePath;\n}\n\nasync function writeI18nDeclarationFile(\n config: InternalConfig,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'i18n.d.ts');\n const defaultLocale = config.manifest.default_locale;\n const template = `// Generated by wxt\nimport \"wxt/browser\";\n\ndeclare module \"wxt/browser\" {\n /**\n * See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage\n */\n interface GetMessageOptions {\n /**\n * See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage\n */\n escapeLt?: boolean\n }\n\n export interface WxtI18n extends I18n.Static {\n{{ overrides }}\n }\n}\n`;\n\n let messages: Message[];\n if (defaultLocale) {\n const defaultLocalePath = path.resolve(\n config.publicDir,\n '_locales',\n defaultLocale,\n 'messages.json',\n );\n const content = JSON.parse(await fs.readFile(defaultLocalePath, 'utf-8'));\n messages = parseI18nMessages(content);\n } else {\n messages = parseI18nMessages({});\n }\n\n const overrides = messages.map((message) => {\n return ` /**\n * ${message.description ?? 'No message description.'}\n * \n * \"${message.message}\"\n */\n getMessage(\n messageName: \"${message.name}\",\n substitutions?: string | string[],\n options?: GetMessageOptions,\n ): string;`;\n });\n await writeFileIfDifferent(\n filePath,\n template.replace('{{ overrides }}', overrides.join('\\n')),\n );\n\n return filePath;\n}\n\nasync function writeGlobalsDeclarationFile(\n config: InternalConfig,\n): Promise<string> {\n const filePath = resolve(config.typesDir, 'globals.d.ts');\n const globals = [...getGlobals(config), ...getEntrypointGlobals(config, '')];\n await writeFileIfDifferent(\n filePath,\n [\n '// Generated by wxt',\n 'export {}',\n 'declare global {',\n ...globals.map((global) => ` const ${global.name}: ${global.type};`),\n '}',\n ].join('\\n') + '\\n',\n );\n return filePath;\n}\n\nasync function writeMainDeclarationFile(\n references: string[],\n config: InternalConfig,\n): Promise<string> {\n const dir = config.wxtDir;\n const filePath = resolve(dir, 'wxt.d.ts');\n await writeFileIfDifferent(\n filePath,\n [\n '// Generated by wxt',\n `/// <reference types=\"vite/client\" />`,\n ...references.map(\n (ref) =>\n `/// <reference types=\"./${normalizePath(relative(dir, ref))}\" />`,\n ),\n ].join('\\n') + '\\n',\n );\n return filePath;\n}\n\nasync function writeTsConfigFile(\n mainReference: string,\n config: InternalConfig,\n) {\n const dir = config.wxtDir;\n const rootPath = normalizePath(relative(dir, config.root));\n const srcPath = normalizePath(relative(dir, config.srcDir));\n await writeFileIfDifferent(\n resolve(dir, 'tsconfig.json'),\n `{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"Bundler\",\n \"noEmit\": true,\n \"esModuleInterop\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"resolveJsonModule\": true,\n \"strict\": true,\n \"lib\": [\"DOM\", \"WebWorker\"],\n \"skipLibCheck\": true,\n \"paths\": {\n \"@\": [\"${srcPath}\"],\n \"@/*\": [\"${srcPath}/*\"],\n \"~\": [\"${srcPath}\"],\n \"~/*\": [\"${srcPath}/*\"],\n \"@@\": [\"${rootPath}\"],\n \"@@/*\": [\"${rootPath}/*\"],\n \"~~\": [\"${rootPath}\"],\n \"~~/*\": [\"${rootPath}/*\"]\n }\n },\n \"include\": [\n \"${normalizePath(relative(dir, config.root))}/**/*\",\n \"./${normalizePath(relative(dir, mainReference))}\"\n ],\n \"exclude\": [\"${normalizePath(relative(dir, config.outBaseDir))}\"]\n}`,\n );\n}\n","export interface Message {\n name: string;\n message: string;\n description?: string;\n}\n\nconst predefinedMessages = {\n '@@extension_id': {\n message: '<browser.runtime.id>',\n description:\n \"The extension or app ID; you might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.\\nNote: You can't use this message in a manifest file.\",\n },\n '@@ui_locale': {\n message: '<browser.i18n.getUiLocale()>',\n description: '',\n },\n '@@bidi_dir': {\n message: '<ltr|rtl>',\n description:\n 'The text direction for the current locale, either \"ltr\" for left-to-right languages such as English or \"rtl\" for right-to-left languages such as Japanese.',\n },\n '@@bidi_reversed_dir': {\n message: '<rtl|ltr>',\n description:\n 'If the @@bidi_dir is \"ltr\", then this is \"rtl\"; otherwise, it\\'s \"ltr\".',\n },\n '@@bidi_start_edge': {\n message: '<left|right>',\n description:\n 'If the @@bidi_dir is \"ltr\", then this is \"left\"; otherwise, it\\'s \"right\".',\n },\n '@@bidi_end_edge': {\n message: '<right|left>',\n description:\n 'If the @@bidi_dir is \"ltr\", then this is \"right\"; otherwise, it\\'s \"left\".',\n },\n};\n\n/**\n * Get a list of all messages and their metadata from JSON file contents.\n *\n * @param messagesJson The contents of a `_locales/en/messages.json` file.\n */\nexport function parseI18nMessages(messagesJson: object): Message[] {\n return Object.entries({\n ...predefinedMessages,\n ...messagesJson,\n }).map<Message>(([name, details]) => ({\n name,\n ...details,\n }));\n}\n","import { Entrypoint } from '../..';\nimport { Manifest } from 'webextension-polyfill';\nimport {\n BackgroundEntrypoint,\n BuildOutput,\n ContentScriptEntrypoint,\n InternalConfig,\n OptionsEntrypoint,\n PopupEntrypoint,\n} from '../types';\nimport fs from 'fs-extra';\nimport { resolve } from 'path';\nimport {\n getEntrypointBundlePath,\n resolvePerBrowserOption,\n} from './entrypoints';\nimport { ContentSecurityPolicy } from './ContentSecurityPolicy';\nimport {\n hashContentScriptOptions,\n mapWxtOptionsToContentScript,\n} from './content-scripts';\nimport { getPackageJson } from './package';\nimport { normalizePath } from './paths';\nimport { writeFileIfDifferent } from './fs';\nimport { produce } from 'immer';\nimport * as vite from 'vite';\n\n/**\n * Writes the manifest to the output directory and the build output.\n */\nexport async function writeManifest(\n manifest: Manifest.WebExtensionManifest,\n output: BuildOutput,\n config: InternalConfig,\n): Promise<void> {\n const str =\n config.mode === 'production'\n ? JSON.stringify(manifest)\n : JSON.stringify(manifest, null, 2);\n\n await fs.ensureDir(config.outDir);\n await writeFileIfDifferent(resolve(config.outDir, 'manifest.json'), str);\n\n output.publicAssets.unshift({\n type: 'asset',\n fileName: 'manifest.json',\n name: 'manifest',\n needsCodeReference: false,\n source: str,\n });\n}\n\n/**\n * Generates the manifest based on the config and entrypoints.\n */\nexport async function generateMainfest(\n entrypoints: Entrypoint[],\n buildOutput: Omit<BuildOutput, 'manifest'>,\n config: InternalConfig,\n): Promise<Manifest.WebExtensionManifest> {\n const pkg = await getPackageJson(config);\n\n const baseManifest: Manifest.WebExtensionManifest = {\n manifest_version: config.manifestVersion,\n name: pkg?.name,\n description: pkg?.description,\n version: pkg?.version && simplifyVersion(pkg.version),\n // Only add the version name to chromium and if the user hasn't specified a custom version.\n version_name:\n config.browser !== 'firefox' && !config.manifest.version\n ? pkg?.version\n : undefined,\n short_name: pkg?.shortName,\n icons: discoverIcons(buildOutput),\n };\n const userManifest = config.manifest;\n\n const manifest = vite.mergeConfig(\n baseManifest,\n userManifest,\n ) as Manifest.WebExtensionManifest;\n\n addEntrypoints(manifest, entrypoints, buildOutput, config);\n\n if (config.command === 'serve') addDevModeCsp(manifest, config);\n if (config.command === 'serve') addDevModePermissions(manifest, config);\n\n const finalManifest = produce(manifest, config.transformManifest);\n\n if (finalManifest.name == null)\n throw Error(\n \"Manifest 'name' is missing. Either:\\n1. Set the name in your <rootDir>/package.json\\n2. Set a name via the manifest option in your wxt.config.ts\",\n );\n if (finalManifest.version == null) {\n throw Error(\n \"Manifest 'version' is missing. Either:\\n1. Add a version in your <rootDir>/package.json\\n2. Pass the version via the manifest option in your wxt.config.ts\",\n );\n }\n\n return finalManifest;\n}\n\n/**\n * Removes suffixes from the version, like X.Y.Z-alpha1 (which brosers don't allow), so it's a\n * simple version number, like X or X.Y or X.Y.Z, which browsers allow.\n */\nfunction simplifyVersion(versionName: string): string {\n // Regex adapted from here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/version#version_format\n const version = /^((0|[1-9][0-9]{0,8})([.](0|[1-9][0-9]{0,8})){0,3}).*$/.exec(\n versionName,\n )?.[1];\n\n if (version == null)\n throw Error(\n `Cannot simplify package.json version \"${versionName}\" to a valid extension version, \"X.Y.Z\"`,\n );\n\n return version;\n}\n\nfunction addEntrypoints(\n manifest: Manifest.WebExtensionManifest,\n entrypoints: Entrypoint[],\n buildOutput: Omit<BuildOutput, 'manifest'>,\n config: InternalConfig,\n): void {\n const entriesByType = entrypoints.reduce<\n Partial<Record<Entrypoint['type'], Entrypoint[]>>\n >((map, entrypoint) => {\n map[entrypoint.type] ??= [];\n map[entrypoint.type]?.push(entrypoint);\n return map;\n }, {});\n\n const background = entriesByType['background']?.[0] as\n | BackgroundEntrypoint\n | undefined;\n const bookmarks = entriesByType['bookmarks']?.[0];\n const contentScripts = entriesByType['content-script'] as\n | ContentScriptEntrypoint[]\n | undefined;\n const devtools = entriesByType['devtools']?.[0];\n const history = entriesByType['history']?.[0];\n const newtab = entriesByType['newtab']?.[0];\n const options = entriesByType['options']?.[0] as\n | OptionsEntrypoint\n | undefined;\n const popup = entriesByType['popup']?.[0] as PopupEntrypoint | undefined;\n const sandboxes = entriesByType['sandbox'];\n const sidepanels = entriesByType['sidepanel'];\n\n if (background) {\n const script = getEntrypointBundlePath(background, config.outDir, '.js');\n if (manifest.manifest_version === 3) {\n manifest.background = {\n type: background.options.type,\n service_worker: script,\n };\n } else {\n manifest.background = {\n persistent: background.options.persistent,\n scripts: [script],\n };\n }\n }\n\n if (bookmarks) {\n if (config.browser === 'firefox') {\n config.logger.warn(\n 'Bookmarks are not supported by Firefox. chrome_url_overrides.bookmarks was not added to the manifest',\n );\n } else {\n manifest.chrome_url_overrides ??= {};\n // @ts-expect-error: bookmarks is untyped in webextension-polyfill, but supported by chrome\n manifest.chrome_url_overrides.bookmarks = getEntrypointBundlePath(\n bookmarks,\n config.outDir,\n '.html',\n );\n }\n }\n\n if (history) {\n if (config.browser === 'firefox') {\n config.logger.warn(\n 'Bookmarks are not supported by Firefox. chrome_url_overrides.history was not added to the manifest',\n );\n } else {\n manifest.chrome_url_overrides ??= {};\n // @ts-expect-error: history is untyped in webextension-polyfill, but supported by chrome\n manifest.chrome_url_overrides.history = getEntrypointBundlePath(\n history,\n config.outDir,\n '.html',\n );\n }\n }\n\n if (newtab) {\n manifest.chrome_url_overrides ??= {};\n manifest.chrome_url_overrides.newtab = getEntrypointBundlePath(\n newtab,\n config.outDir,\n '.html',\n );\n }\n\n if (popup) {\n const default_popup = getEntrypointBundlePath(\n popup,\n config.outDir,\n '.html',\n );\n const options: Manifest.ActionManifest = {\n default_icon: popup.options.defaultIcon,\n default_title: popup.options.defaultTitle,\n };\n if (manifest.manifest_version === 3) {\n manifest.action = {\n ...options,\n default_popup,\n };\n } else {\n manifest[popup.options.mv2Key ?? 'browser_action'] = {\n ...options,\n default_popup,\n };\n }\n }\n\n if (devtools) {\n manifest.devtools_page = getEntrypointBundlePath(\n devtools,\n config.outDir,\n '.html',\n );\n }\n\n if (options) {\n const page = getEntrypointBundlePath(options, config.outDir, '.html');\n manifest.options_ui = {\n open_in_tab: options.options.openInTab,\n browser_style:\n config.browser === 'firefox' ? options.options.browserStyle : undefined,\n chrome_style:\n config.browser !== 'firefox' ? options.options.chromeStyle : undefined,\n page,\n };\n }\n\n if (sandboxes?.length) {\n if (config.browser === 'firefox') {\n config.logger.warn(\n 'Sandboxed pages not supported by Firefox. sandbox.pages was not added to the manifest',\n );\n } else {\n // @ts-expect-error: sandbox not typed\n manifest.sandbox = {\n pages: sandboxes.map((entry) =>\n getEntrypointBundlePath(entry, config.outDir, '.html'),\n ),\n };\n }\n }\n\n if (sidepanels?.length) {\n const defaultSidepanel =\n sidepanels.find((entry) => entry.name === 'sidepanel') ?? sidepanels[0];\n const page = getEntrypointBundlePath(\n defaultSidepanel,\n config.outDir,\n '.html',\n );\n\n if (config.browser === 'firefox') {\n manifest.sidebar_action = {\n // TODO: Add options to side panel\n // ...defaultSidepanel.options,\n default_panel: page,\n };\n } else if (config.manifestVersion === 3) {\n // @ts-expect-error: Untyped\n manifest.side_panel = {\n default_path: page,\n };\n } else {\n config.logger.warn(\n 'Side panel not supported by Chromium using MV2. side_panel.default_path was not added to the manifest',\n );\n }\n }\n\n if (contentScripts?.length) {\n const cssMap = getContentScriptsCssMap(buildOutput, contentScripts);\n\n // Don't add content scripts to the manifest in dev mode for MV3 - they're managed and reloaded\n // at runtime\n if (config.command === 'serve' && config.manifestVersion === 3) {\n const hostPermissions = new Set<string>(manifest.host_permissions ?? []);\n contentScripts.forEach((script) => {\n const matches = resolvePerBrowserOption(\n script.options.matches,\n config.browser,\n );\n matches.forEach((matchPattern) => {\n hostPermissions.add(matchPattern);\n });\n });\n hostPermissions.forEach((permission) =>\n addHostPermission(manifest, permission),\n );\n } else {\n const hashToEntrypointsMap = contentScripts.reduce((map, script) => {\n const hash = hashContentScriptOptions(script.options);\n if (map.has(hash)) map.get(hash)?.push(script);\n else map.set(hash, [script]);\n return map;\n }, new Map<string, ContentScriptEntrypoint[]>());\n\n const newContentScripts = Array.from(hashToEntrypointsMap.entries()).map(\n ([, scripts]) => ({\n ...mapWxtOptionsToContentScript(scripts[0].options, config),\n // TOOD: Sorting css and js arrays here so we get consistent test results... but we\n // shouldn't have to. Where is the inconsistency coming from?\n css: getContentScriptCssFiles(scripts, cssMap)?.sort(),\n js: scripts\n .map((entry) =>\n getEntrypointBundlePath(entry, config.outDir, '.js'),\n )\n .sort(),\n }),\n );\n if (newContentScripts.length >= 0) {\n manifest.content_scripts ??= [];\n manifest.content_scripts.push(...newContentScripts);\n }\n }\n\n const contentScriptCssResources = getContentScriptCssWebAccessibleResources(\n config,\n contentScripts,\n cssMap,\n );\n if (contentScriptCssResources.length > 0) {\n manifest.web_accessible_resources ??= [];\n manifest.web_accessible_resources.push(...contentScriptCssResources);\n }\n }\n}\n\nfunction discoverIcons(\n buildOutput: Omit<BuildOutput, 'manifest'>,\n): Manifest.WebExtensionManifest['icons'] {\n const icons: [string, string][] = [];\n // prettier-ignore\n // #region snippet\n const iconRegex = [\n /^icon-([0-9]+)\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon-16.png\n /^icon-([0-9]+)x[0-9]+\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon-16x16.png\n /^icon@([0-9]+)w\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon@16w.png\n /^icon@([0-9]+)h\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon@16h.png\n /^icon@([0-9]+)\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon@16.png\n /^icon[\\/\\\\]([0-9]+)\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon/16.png\n /^icon[\\/\\\\]([0-9]+)x[0-9]+\\.(png|bmp|jpeg|jpg|ico|gif)$/, // icon/16x16.png\n ];\n // #endregion snippet\n\n buildOutput.publicAssets.forEach((asset) => {\n let size: string | undefined;\n for (const regex of iconRegex) {\n const match = asset.fileName.match(regex);\n if (match?.[1] != null) {\n size = match[1];\n break;\n }\n }\n if (size == null) return;\n\n icons.push([size, normalizePath(asset.fileName)]);\n });\n\n return icons.length > 0 ? Object.fromEntries(icons) : undefined;\n}\n\nfunction addDevModeCsp(\n manifest: Manifest.WebExtensionManifest,\n config: InternalConfig,\n): void {\n const permission = `http://${config.server?.hostname ?? ''}/*`;\n const allowedCsp = config.server?.origin ?? 'http://localhost:*';\n\n if (manifest.manifest_version === 3) {\n addHostPermission(manifest, permission);\n } else {\n addPermission(manifest, permission);\n }\n\n const csp = new ContentSecurityPolicy(\n manifest.manifest_version === 3\n ? // @ts-expect-error: extension_pages is not typed\n manifest.content_security_policy?.extension_pages ??\n \"script-src 'self' 'wasm-unsafe-eval'; object-src 'self';\" // default CSP for MV3\n : manifest.content_security_policy ??\n \"script-src 'self'; object-src 'self';\", // default CSP for MV2\n );\n\n if (config.server) csp.add('script-src', allowedCsp);\n\n if (manifest.manifest_version === 3) {\n manifest.content_security_policy ??= {};\n // @ts-expect-error: extension_pages is not typed\n manifest.content_security_policy.extension_pages = csp.toString();\n } else {\n manifest.content_security_policy = csp.toString();\n }\n}\n\nfunction addDevModePermissions(\n manifest: Manifest.WebExtensionManifest,\n config: InternalConfig,\n) {\n // For reloading the page\n addPermission(manifest, 'tabs');\n\n // For registering content scripts\n if (config.manifestVersion === 3) addPermission(manifest, 'scripting');\n}\n\n/**\n * Returns the bundle paths to CSS files associated with a list of content scripts, or undefined if\n * there is no associated CSS.\n */\nexport function getContentScriptCssFiles(\n contentScripts: ContentScriptEntrypoint[],\n contentScriptCssMap: Record<string, string | undefined>,\n): string[] | undefined {\n const css: string[] = [];\n\n contentScripts.forEach((script) => {\n if (\n script.options.cssInjectionMode === 'manual' ||\n script.options.cssInjectionMode === 'ui'\n )\n return;\n\n const cssFile = contentScriptCssMap[script.name];\n if (cssFile == null) return;\n\n if (cssFile) css.push(cssFile);\n });\n\n if (css.length > 0) return css;\n return undefined;\n}\n\n/**\n * Content scripts configured with `cssInjectionMode: \"ui\"` need to add their CSS files to web\n * accessible resources so they can be fetched as text and added to shadow roots that the UI is\n * added to.\n */\nexport function getContentScriptCssWebAccessibleResources(\n config: InternalConfig,\n contentScripts: ContentScriptEntrypoint[],\n contentScriptCssMap: Record<string, string | undefined>,\n): any[] {\n const resources: any[] = [];\n\n contentScripts.forEach((script) => {\n if (script.options.cssInjectionMode !== 'ui') return;\n\n const cssFile = contentScriptCssMap[script.name];\n if (cssFile == null) return;\n\n if (config.manifestVersion === 2) {\n resources.push(cssFile);\n } else {\n resources.push({\n resources: [cssFile],\n matches: script.options.matches,\n });\n }\n });\n\n return resources;\n}\n\n/**\n * Based on the build output, return a Record of each content script's name to it CSS file if the\n * script includes one.\n */\nexport function getContentScriptsCssMap(\n buildOutput: Omit<BuildOutput, 'manifest'>,\n scripts: ContentScriptEntrypoint[],\n) {\n const map: Record<string, string | undefined> = {};\n const allChunks = buildOutput.steps.flatMap((step) => step.chunks);\n scripts.forEach((script) => {\n const relatedCss = allChunks.find(\n (chunk) => chunk.fileName === `content-scripts/${script.name}.css`,\n );\n if (relatedCss != null) map[script.name] = relatedCss.fileName;\n });\n return map;\n}\n\nfunction addPermission(\n manifest: Manifest.WebExtensionManifest,\n permission: string,\n): void {\n manifest.permissions ??= [];\n if (manifest.permissions.includes(permission)) return;\n manifest.permissions.push(permission);\n}\n\nfunction addHostPermission(\n manifest: Manifest.WebExtensionManifest,\n hostPermission: string,\n): void {\n manifest.host_permissions ??= [];\n if (manifest.host_permissions.includes(hostPermission)) return;\n manifest.host_permissions.push(hostPermission);\n}\n","/**\n * Directive names that make up CSPs. There are more, this is all I need for the plugin.\n */\nexport type CspDirective = 'default-src' | 'script-src' | 'object-src';\n\nexport class ContentSecurityPolicy {\n private static DIRECTIVE_ORDER: Record<string, number | undefined> = {\n 'default-src': 0,\n 'script-src': 1,\n 'object-src': 2,\n };\n\n data: Record<string, string[]>;\n\n constructor(csp?: string) {\n if (csp) {\n const sections = csp.split(';').map((section) => section.trim());\n this.data = sections.reduce<Record<string, string[]>>((data, section) => {\n const [key, ...values] = section.split(' ').map((item) => item.trim());\n if (key) data[key] = values;\n return data;\n }, {});\n } else {\n this.data = {};\n }\n }\n\n /**\n * Ensure a set of values are listed under a directive.\n */\n add(directive: CspDirective, ...newValues: string[]): ContentSecurityPolicy {\n const values = this.data[directive] ?? [];\n newValues.forEach((newValue) => {\n if (!values.includes(newValue)) values.push(newValue);\n });\n this.data[directive] = values;\n return this;\n }\n\n toString(): string {\n const directives = Object.entries(this.data).sort(([l], [r]) => {\n const lo = ContentSecurityPolicy.DIRECTIVE_ORDER[l] ?? 2;\n const ro = ContentSecurityPolicy.DIRECTIVE_ORDER[r] ?? 2;\n return lo - ro;\n });\n return directives.map((entry) => entry.flat().join(' ')).join('; ') + ';';\n }\n}\n","import { Manifest } from 'webextension-polyfill';\nimport { ContentScriptEntrypoint, InternalConfig } from '../types';\nimport { resolvePerBrowserOption } from './entrypoints';\n\n/**\n * Returns a unique and consistent string hash based on a content scripts options.\n *\n * It is able to recognize default values,\n */\nexport function hashContentScriptOptions(\n options: ContentScriptEntrypoint['options'],\n): string {\n const withDefaults: ContentScriptEntrypoint['options'] = {\n excludeGlobs: [],\n excludeMatches: [],\n includeGlobs: [],\n matchAboutBlank: false,\n matchOriginAsFallback: false,\n runAt: 'document_idle',\n allFrames: false,\n world: 'ISOLATED',\n // TODO: strip undefined fields from options object to improve content script grouping.\n ...options,\n };\n return JSON.stringify(\n Object.entries(withDefaults)\n // Sort any arrays so their values are consistent\n .map<[string, unknown]>(([key, value]) => {\n if (Array.isArray(value)) return [key, value.sort()];\n else return [key, value];\n })\n // Sort all the fields alphabetically\n .sort((l, r) => l[0].localeCompare(r[0])),\n );\n}\n\nexport function mapWxtOptionsToContentScript(\n options: ContentScriptEntrypoint['options'],\n config: InternalConfig,\n): Omit<Manifest.ContentScript, 'js' | 'css'> {\n return {\n matches: resolvePerBrowserOption(options.matches, config.browser),\n all_frames: resolvePerBrowserOption(options.allFrames, config.browser),\n match_about_blank: resolvePerBrowserOption(\n options.matchAboutBlank,\n config.browser,\n ),\n exclude_globs: resolvePerBrowserOption(\n options.excludeGlobs,\n config.browser,\n ),\n exclude_matches: resolvePerBrowserOption(\n options.excludeMatches,\n config.browser,\n ),\n include_globs: resolvePerBrowserOption(\n options.includeGlobs,\n config.browser,\n ),\n run_at: resolvePerBrowserOption(options.runAt, config.browser),\n\n // @ts-expect-error: untyped chrome options\n match_origin_as_fallback: resolvePerBrowserOption(\n options.matchOriginAsFallback,\n config.browser,\n ),\n world: options.world,\n };\n}\n","import { resolve } from 'node:path';\nimport { InternalConfig } from '../types';\nimport fs from 'fs-extra';\n\n/**\n * Read the project's package.json.\n *\n * TODO: look in root and up directories until it's found\n */\nexport async function getPackageJson(\n config: InternalConfig,\n): Promise<Partial<Record<string, any>> | undefined> {\n const file = resolve(config.root, 'package.json');\n try {\n return await fs.readJson(file);\n } catch (err) {\n config.logger.debug(\n `Failed to read package.json at: ${file}. Returning undefined.`,\n );\n return {};\n }\n}\n","import { Manifest } from 'webextension-polyfill';\nimport { BuildOutput } from './types';\nimport { buildEntrypoints } from './build/buildEntrypoints';\nimport { findEntrypoints } from './build/findEntrypoints';\nimport { generateTypesDir } from './build/generateTypesDir';\nimport { InternalConfig, EntrypointGroup } from './types';\nimport { generateMainfest, writeManifest } from './utils/manifest';\nimport pc from 'picocolors';\nimport * as vite from 'vite';\nimport fs from 'fs-extra';\nimport { groupEntrypoints } from './utils/groupEntrypoints';\nimport { formatDuration } from './utils/formatDuration';\nimport { printBuildSummary } from './log/printBuildSummary';\nimport { execaCommand } from 'execa';\nimport glob from 'fast-glob';\nimport { unnormalizePath } from './utils/paths';\n\n/**\n * Builds the extension based on an internal config.\n *\n * This function:\n * 1. Cleans the output directory\n * 2. Executes the rebuild function with a blank previous output so everything is built (see\n * `rebuild` for more details)\n * 3. Prints the summary\n */\nexport async function buildInternal(\n config: InternalConfig,\n): Promise<BuildOutput> {\n const verb = config.command === 'serve' ? 'Pre-rendering' : 'Building';\n const target = `${config.browser}-mv${config.manifestVersion}`;\n config.logger.info(\n `${verb} ${pc.cyan(target)} for ${pc.cyan(config.mode)} with ${pc.green(\n `Vite ${vite.version}`,\n )}`,\n );\n const startTime = Date.now();\n\n // Cleanup\n await fs.rm(config.outDir, { recursive: true, force: true });\n await fs.ensureDir(config.outDir);\n\n const entrypoints = await findEntrypoints(config);\n config.logger.debug('Detected entrypoints:', entrypoints);\n const groups = groupEntrypoints(entrypoints);\n const { output } = await rebuild(config, groups, undefined);\n\n // Post-build\n await printBuildSummary(\n config.logger.success,\n `Built extension in ${formatDuration(Date.now() - startTime)}`,\n output,\n config,\n );\n\n if (config.analysis.enabled) {\n await combineAnalysisStats(config);\n config.logger.info(\n `Analysis complete:\\n ${pc.gray('└─')} ${pc.yellow('stats.html')}`,\n );\n }\n\n return output;\n}\n\n/**\n * Given a configuration, list of entrypoints, and an existing, partial output, build the\n * entrypoints and merge the new output with the existing output.\n *\n * This function will:\n * 1. Generate the .wxt directory's types\n * 2. Build the `entrypointGroups` (and copies public files)\n * 3. Generate the latest manifest for all entrypoints\n * 4. Write the new manifest to the file system\n */\nexport async function rebuild(\n config: InternalConfig,\n entrypointGroups: EntrypointGroup[],\n existingOutput: Omit<BuildOutput, 'manifest'> = {\n steps: [],\n publicAssets: [],\n },\n): Promise<{ output: BuildOutput; manifest: Manifest.WebExtensionManifest }> {\n const { default: ora } = await import('ora');\n const spinner = ora(`Preparing...`).start();\n\n // Update types directory with new files and types\n const allEntrypoints = await findEntrypoints(config);\n await generateTypesDir(allEntrypoints, config).catch((err) => {\n config.logger.warn('Failed to update .wxt directory:', err);\n // Throw the error if doing a regular build, don't for dev mode.\n if (config.command === 'build') throw err;\n });\n\n // Build and merge the outputs\n const newOutput = await buildEntrypoints(entrypointGroups, config, spinner);\n const mergedOutput: Omit<BuildOutput, 'manifest'> = {\n steps: [...existingOutput.steps, ...newOutput.steps],\n publicAssets: [...existingOutput.publicAssets, ...newOutput.publicAssets],\n };\n\n const newManifest = await generateMainfest(\n allEntrypoints,\n mergedOutput,\n config,\n );\n const finalOutput: BuildOutput = {\n manifest: newManifest,\n ...newOutput,\n };\n\n // Write manifest\n await writeManifest(newManifest, finalOutput, config);\n\n // Stop the spinner and remove it from the CLI output\n spinner.clear().stop();\n\n return {\n output: {\n manifest: newManifest,\n steps: [...existingOutput.steps, ...finalOutput.steps],\n publicAssets: [\n ...existingOutput.publicAssets,\n ...finalOutput.publicAssets,\n ],\n },\n manifest: newManifest,\n };\n}\n\nasync function combineAnalysisStats(config: InternalConfig): Promise<void> {\n const unixFiles = await glob(`stats-*.json`, {\n cwd: config.outDir,\n absolute: true,\n });\n const absolutePaths = unixFiles.map(unnormalizePath);\n\n await execaCommand(\n `rollup-plugin-visualizer ${absolutePaths.join(' ')} --template ${\n config.analysis.template\n }`,\n { cwd: config.root, stdio: 'inherit' },\n );\n}\n","import { Entrypoint } from '../..';\nimport { EntrypointGroup } from '../types';\n\n/**\n * Entrypoints can be build in groups. HTML pages can all be built together in a single step, while\n * content scripts must be build individually.\n *\n * This function returns the entrypoints put into these types of groups.\n */\nexport function groupEntrypoints(entrypoints: Entrypoint[]): EntrypointGroup[] {\n const groupIndexMap: Partial<Record<Group, number>> = {};\n const groups: EntrypointGroup[] = [];\n\n for (const entry of entrypoints) {\n const group = ENTRY_TYPE_TO_GROUP_MAP[entry.type];\n if (group === 'no-group') {\n groups.push(entry);\n } else {\n let groupIndex = groupIndexMap[group];\n if (groupIndex == null) {\n groupIndex = groups.push([]) - 1;\n groupIndexMap[group] = groupIndex;\n }\n (groups[groupIndex] as Entrypoint[]).push(entry);\n }\n }\n\n return groups;\n}\n\nconst ENTRY_TYPE_TO_GROUP_MAP: Record<Entrypoint['type'], Group> = {\n sandbox: 'sandbox-page',\n\n popup: 'extension-page',\n newtab: 'extension-page',\n history: 'extension-page',\n options: 'extension-page',\n devtools: 'extension-page',\n bookmarks: 'extension-page',\n sidepanel: 'extension-page',\n 'unlisted-page': 'extension-page',\n\n background: 'no-group',\n 'content-script': 'no-group',\n 'unlisted-script': 'no-group',\n 'unlisted-style': 'no-group',\n 'content-script-style': 'no-group',\n};\n\ntype Group = 'extension-page' | 'sandbox-page' | 'no-group';\n","export function formatDuration(duration: number): string {\n if (duration < 1e3) return `${duration} ms`;\n if (duration < 10e3) return `${(duration / 1e3).toFixed(3)} s`;\n if (duration < 60e3) return `${(duration / 1e3).toFixed(1)} s`;\n return `${(duration / 1e3).toFixed(0)} s`;\n}\n","import { resolve } from 'path';\nimport { BuildOutput, InternalConfig } from '../types';\nimport { printFileList } from './printFileList';\n\nexport async function printBuildSummary(\n log: (...args: any[]) => void,\n header: string,\n output: BuildOutput,\n config: InternalConfig,\n) {\n const chunks = [\n ...output.steps.flatMap((step) => step.chunks),\n ...output.publicAssets,\n ].sort((l, r) => {\n const lWeight = getChunkSortWeight(l.fileName);\n const rWeight = getChunkSortWeight(r.fileName);\n const diff = lWeight - rWeight;\n if (diff !== 0) return diff;\n return l.fileName.localeCompare(r.fileName);\n });\n\n const files = chunks.map((chunk) => resolve(config.outDir, chunk.fileName));\n await printFileList(log, header, config.outDir, files);\n}\n\nconst DEFAULT_SORT_WEIGHT = 100;\nconst CHUNK_SORT_WEIGHTS: Record<string, number> = {\n 'manifest.json': 0,\n '.html': 1,\n '.js.map': 2,\n '.js': 2,\n '.css': 3,\n};\nfunction getChunkSortWeight(filename: string) {\n return (\n Object.entries(CHUNK_SORT_WEIGHTS).find(([key]) =>\n filename.endsWith(key),\n )?.[1] ?? DEFAULT_SORT_WEIGHT\n );\n}\n","import path from 'node:path';\nimport pc from 'picocolors';\nimport fs from 'fs-extra';\nimport { filesize } from 'filesize';\nimport { printTable } from './printTable';\n\nexport async function printFileList(\n log: (message: string) => void,\n header: string,\n baseDir: string,\n files: string[],\n): Promise<void> {\n let totalSize = 0;\n\n const fileRows: string[][] = await Promise.all(\n files.map(async (file, i) => {\n const parts = [\n path.relative(process.cwd(), baseDir) + path.sep,\n path.relative(baseDir, file),\n ];\n const prefix = i === files.length - 1 ? ' └─' : ' ├─';\n const color = getChunkColor(file);\n const stats = await fs.lstat(file);\n totalSize += stats.size;\n const size = String(filesize(stats.size));\n return [\n `${pc.gray(prefix)} ${pc.dim(parts[0])}${color(parts[1])}`,\n pc.dim(size),\n ];\n }),\n );\n\n fileRows.push([`${pc.cyan('Σ Total size:')} ${String(filesize(totalSize))}`]);\n\n printTable(log, header, fileRows);\n}\n\nconst DEFAULT_COLOR = pc.blue;\nconst CHUNK_COLORS: Record<string, (text: string) => string> = {\n '.js.map': pc.gray,\n '.html': pc.green,\n '.css': pc.magenta,\n '.js': pc.cyan,\n '.zip': pc.yellow,\n};\nfunction getChunkColor(filename: string) {\n return (\n Object.entries(CHUNK_COLORS).find(([key]) => filename.endsWith(key))?.[1] ??\n DEFAULT_COLOR\n );\n}\n","export function printTable(\n log: (message: string) => void,\n header: string,\n rows: string[][],\n gap = 2,\n): void {\n if (rows.length === 0) return;\n\n const columnWidths = rows.reduce(\n (widths, row) => {\n for (let i = 0; i < Math.max(widths.length, row.length); i++) {\n widths[i] = Math.max(row[i]?.length ?? 0, widths[i] ?? 0);\n }\n return widths;\n },\n rows[0].map((column) => column.length),\n );\n\n let str = '';\n rows.forEach((row, i) => {\n row.forEach((col, j) => {\n str += col.padEnd(columnWidths[j], ' ');\n if (j !== row.length - 1) str += ''.padEnd(gap, ' ');\n });\n if (i !== rows.length - 1) str += '\\n';\n });\n\n log(`${header}\\n${str}`);\n}\n","import {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport childProcess from 'node:child_process';\nimport process from 'node:process';\nimport crossSpawn from 'cross-spawn';\nimport stripFinalNewline from 'strip-final-newline';\nimport {npmRunPathEnv} from 'npm-run-path';\nimport onetime from 'onetime';\nimport {makeError} from './lib/error.js';\nimport {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';\nimport {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';\nimport {addPipeMethods} from './lib/pipe.js';\nimport {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';\nimport {mergePromise, getSpawnedPromise} from './lib/promise.js';\nimport {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';\nimport {logCommand, verboseDefault} from './lib/verbose.js';\n\nconst DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;\n\nconst getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {\n\tconst env = extendEnv ? {...process.env, ...envOption} : envOption;\n\n\tif (preferLocal) {\n\t\treturn npmRunPathEnv({env, cwd: localDir, execPath});\n\t}\n\n\treturn env;\n};\n\nconst handleArguments = (file, args, options = {}) => {\n\tconst parsed = crossSpawn._parse(file, args, options);\n\tfile = parsed.command;\n\targs = parsed.args;\n\toptions = parsed.options;\n\n\toptions = {\n\t\tmaxBuffer: DEFAULT_MAX_BUFFER,\n\t\tbuffer: true,\n\t\tstripFinalNewline: true,\n\t\textendEnv: true,\n\t\tpreferLocal: false,\n\t\tlocalDir: options.cwd || process.cwd(),\n\t\texecPath: process.execPath,\n\t\tencoding: 'utf8',\n\t\treject: true,\n\t\tcleanup: true,\n\t\tall: false,\n\t\twindowsHide: true,\n\t\tverbose: verboseDefault,\n\t\t...options,\n\t};\n\n\toptions.env = getEnv(options);\n\n\toptions.stdio = normalizeStdio(options);\n\n\tif (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {\n\t\t// #116\n\t\targs.unshift('/q');\n\t}\n\n\treturn {file, args, options, parsed};\n};\n\nconst handleOutput = (options, value, error) => {\n\tif (typeof value !== 'string' && !Buffer.isBuffer(value)) {\n\t\t// When `execaSync()` errors, we normalize it to '' to mimic `execa()`\n\t\treturn error === undefined ? undefined : '';\n\t}\n\n\tif (options.stripFinalNewline) {\n\t\treturn stripFinalNewline(value);\n\t}\n\n\treturn value;\n};\n\nexport function execa(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tvalidateTimeout(parsed.options);\n\n\tlet spawned;\n\ttry {\n\t\tspawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);\n\t} catch (error) {\n\t\t// Ensure the returned error is always both a promise and a child process\n\t\tconst dummySpawned = new childProcess.ChildProcess();\n\t\tconst errorPromise = Promise.reject(makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t}));\n\t\tmergePromise(dummySpawned, errorPromise);\n\t\treturn dummySpawned;\n\t}\n\n\tconst spawnedPromise = getSpawnedPromise(spawned);\n\tconst timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);\n\tconst processDone = setExitHandler(spawned, parsed.options, timedPromise);\n\n\tconst context = {isCanceled: false};\n\n\tspawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));\n\tspawned.cancel = spawnedCancel.bind(null, spawned, context);\n\n\tconst handlePromise = async () => {\n\t\tconst [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);\n\t\tconst stdout = handleOutput(parsed.options, stdoutResult);\n\t\tconst stderr = handleOutput(parsed.options, stderrResult);\n\t\tconst all = handleOutput(parsed.options, allResult);\n\n\t\tif (error || exitCode !== 0 || signal !== null) {\n\t\t\tconst returnedError = makeError({\n\t\t\t\terror,\n\t\t\t\texitCode,\n\t\t\t\tsignal,\n\t\t\t\tstdout,\n\t\t\t\tstderr,\n\t\t\t\tall,\n\t\t\t\tcommand,\n\t\t\t\tescapedCommand,\n\t\t\t\tparsed,\n\t\t\t\ttimedOut,\n\t\t\t\tisCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),\n\t\t\t\tkilled: spawned.killed,\n\t\t\t});\n\n\t\t\tif (!parsed.options.reject) {\n\t\t\t\treturn returnedError;\n\t\t\t}\n\n\t\t\tthrow returnedError;\n\t\t}\n\n\t\treturn {\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\texitCode: 0,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\tall,\n\t\t\tfailed: false,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t};\n\t};\n\n\tconst handlePromiseOnce = onetime(handlePromise);\n\n\thandleInput(spawned, parsed.options);\n\n\tspawned.all = makeAllStream(spawned, parsed.options);\n\n\taddPipeMethods(spawned);\n\tmergePromise(spawned, handlePromiseOnce);\n\treturn spawned;\n}\n\nexport function execaSync(file, args, options) {\n\tconst parsed = handleArguments(file, args, options);\n\tconst command = joinCommand(file, args);\n\tconst escapedCommand = getEscapedCommand(file, args);\n\tlogCommand(escapedCommand, parsed.options);\n\n\tconst input = handleInputSync(parsed.options);\n\n\tlet result;\n\ttry {\n\t\tresult = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});\n\t} catch (error) {\n\t\tthrow makeError({\n\t\t\terror,\n\t\t\tstdout: '',\n\t\t\tstderr: '',\n\t\t\tall: '',\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: false,\n\t\t\tisCanceled: false,\n\t\t\tkilled: false,\n\t\t});\n\t}\n\n\tconst stdout = handleOutput(parsed.options, result.stdout, result.error);\n\tconst stderr = handleOutput(parsed.options, result.stderr, result.error);\n\n\tif (result.error || result.status !== 0 || result.signal !== null) {\n\t\tconst error = makeError({\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t\terror: result.error,\n\t\t\tsignal: result.signal,\n\t\t\texitCode: result.status,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tparsed,\n\t\t\ttimedOut: result.error && result.error.code === 'ETIMEDOUT',\n\t\t\tisCanceled: false,\n\t\t\tkilled: result.signal !== null,\n\t\t});\n\n\t\tif (!parsed.options.reject) {\n\t\t\treturn error;\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tcommand,\n\t\tescapedCommand,\n\t\texitCode: 0,\n\t\tstdout,\n\t\tstderr,\n\t\tfailed: false,\n\t\ttimedOut: false,\n\t\tisCanceled: false,\n\t\tkilled: false,\n\t};\n}\n\nconst normalizeScriptStdin = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined\n\t? {stdin: 'inherit'}\n\t: {};\n\nconst normalizeScriptOptions = (options = {}) => ({\n\tpreferLocal: true,\n\t...normalizeScriptStdin(options),\n\t...options,\n});\n\nfunction create$(options) {\n\tfunction $(templatesOrOptions, ...expressions) {\n\t\tif (!Array.isArray(templatesOrOptions)) {\n\t\t\treturn create$({...options, ...templatesOrOptions});\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templatesOrOptions, expressions);\n\t\treturn execa(file, args, normalizeScriptOptions(options));\n\t}\n\n\t$.sync = (templates, ...expressions) => {\n\t\tif (!Array.isArray(templates)) {\n\t\t\tthrow new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');\n\t\t}\n\n\t\tconst [file, ...args] = parseTemplates(templates, expressions);\n\t\treturn execaSync(file, args, normalizeScriptOptions(options));\n\t};\n\n\treturn $;\n}\n\nexport const $ = create$();\n\nexport function execaCommand(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execa(file, args, options);\n}\n\nexport function execaCommandSync(command, options) {\n\tconst [file, ...args] = parseCommand(command);\n\treturn execaSync(file, args, options);\n}\n\nexport function execaNode(scriptPath, args, options = {}) {\n\tif (args && !Array.isArray(args) && typeof args === 'object') {\n\t\toptions = args;\n\t\targs = [];\n\t}\n\n\tconst stdio = normalizeStdioNode(options);\n\tconst defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));\n\n\tconst {\n\t\tnodePath = process.execPath,\n\t\tnodeOptions = defaultExecArgv,\n\t} = options;\n\n\treturn execa(\n\t\tnodePath,\n\t\t[\n\t\t\t...nodeOptions,\n\t\t\tscriptPath,\n\t\t\t...(Array.isArray(args) ? args : []),\n\t\t],\n\t\t{\n\t\t\t...options,\n\t\t\tstdin: undefined,\n\t\t\tstdout: undefined,\n\t\t\tstderr: undefined,\n\t\t\tstdio,\n\t\t\tshell: false,\n\t\t},\n\t);\n}\n","export default function stripFinalNewline(input) {\n\tconst LF = typeof input === 'string' ? '\\n' : '\\n'.charCodeAt();\n\tconst CR = typeof input === 'string' ? '\\r' : '\\r'.charCodeAt();\n\n\tif (input[input.length - 1] === LF) {\n\t\tinput = input.slice(0, -1);\n\t}\n\n\tif (input[input.length - 1] === CR) {\n\t\tinput = input.slice(0, -1);\n\t}\n\n\treturn input;\n}\n","import process from 'node:process';\nimport path from 'node:path';\nimport url from 'node:url';\nimport pathKey from 'path-key';\n\nexport function npmRunPath(options = {}) {\n\tconst {\n\t\tcwd = process.cwd(),\n\t\tpath: path_ = process.env[pathKey()],\n\t\texecPath = process.execPath,\n\t} = options;\n\n\tlet previous;\n\tconst cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;\n\tlet cwdPath = path.resolve(cwdString);\n\tconst result = [];\n\n\twhile (previous !== cwdPath) {\n\t\tresult.push(path.join(cwdPath, 'node_modules/.bin'));\n\t\tprevious = cwdPath;\n\t\tcwdPath = path.resolve(cwdPath, '..');\n\t}\n\n\t// Ensure the running `node` binary is used.\n\tresult.push(path.resolve(cwdString, execPath, '..'));\n\n\treturn [...result, path_].join(path.delimiter);\n}\n\nexport function npmRunPathEnv({env = process.env, ...options} = {}) {\n\tenv = {...env};\n\n\tconst path = pathKey({env});\n\toptions.path = env[path];\n\tenv[path] = npmRunPath(options);\n\n\treturn env;\n}\n","export default function pathKey(options = {}) {\n\tconst {\n\t\tenv = process.env,\n\t\tplatform = process.platform\n\t} = options;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n}\n","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable &&\n\t\ttoDescriptor.enumerable === fromDescriptor.enumerable &&\n\t\ttoDescriptor.configurable === fromDescriptor.configurable &&\n\t\t(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tObject.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","import mimicFunction from 'mimic-fn';\n\nconst calledFunctions = new WeakMap();\n\nconst onetime = (function_, options = {}) => {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError('Expected a function');\n\t}\n\n\tlet returnValue;\n\tlet callCount = 0;\n\tconst functionName = function_.displayName || function_.name || '<anonymous>';\n\n\tconst onetime = function (...arguments_) {\n\t\tcalledFunctions.set(onetime, ++callCount);\n\n\t\tif (callCount === 1) {\n\t\t\treturnValue = function_.apply(this, arguments_);\n\t\t\tfunction_ = null;\n\t\t} else if (options.throw === true) {\n\t\t\tthrow new Error(`Function \\`${functionName}\\` can only be called once`);\n\t\t}\n\n\t\treturn returnValue;\n\t};\n\n\tmimicFunction(onetime, function_);\n\tcalledFunctions.set(onetime, callCount);\n\n\treturn onetime;\n};\n\nonetime.callCount = function_ => {\n\tif (!calledFunctions.has(function_)) {\n\t\tthrow new Error(`The given function \\`${function_.name}\\` is not wrapped by the \\`onetime\\` package`);\n\t}\n\n\treturn calledFunctions.get(function_);\n};\n\nexport default onetime;\n","import process from 'node:process';\nimport {signalsByName} from 'human-signals';\n\nconst getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {\n\tif (timedOut) {\n\t\treturn `timed out after ${timeout} milliseconds`;\n\t}\n\n\tif (isCanceled) {\n\t\treturn 'was canceled';\n\t}\n\n\tif (errorCode !== undefined) {\n\t\treturn `failed with ${errorCode}`;\n\t}\n\n\tif (signal !== undefined) {\n\t\treturn `was killed with ${signal} (${signalDescription})`;\n\t}\n\n\tif (exitCode !== undefined) {\n\t\treturn `failed with exit code ${exitCode}`;\n\t}\n\n\treturn 'failed';\n};\n\nexport const makeError = ({\n\tstdout,\n\tstderr,\n\tall,\n\terror,\n\tsignal,\n\texitCode,\n\tcommand,\n\tescapedCommand,\n\ttimedOut,\n\tisCanceled,\n\tkilled,\n\tparsed: {options: {timeout, cwd = process.cwd()}},\n}) => {\n\t// `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.\n\t// We normalize them to `undefined`\n\texitCode = exitCode === null ? undefined : exitCode;\n\tsignal = signal === null ? undefined : signal;\n\tconst signalDescription = signal === undefined ? undefined : signalsByName[signal].description;\n\n\tconst errorCode = error && error.code;\n\n\tconst prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});\n\tconst execaMessage = `Command ${prefix}: ${command}`;\n\tconst isError = Object.prototype.toString.call(error) === '[object Error]';\n\tconst shortMessage = isError ? `${execaMessage}\\n${error.message}` : execaMessage;\n\tconst message = [shortMessage, stderr, stdout].filter(Boolean).join('\\n');\n\n\tif (isError) {\n\t\terror.originalMessage = error.message;\n\t\terror.message = message;\n\t} else {\n\t\terror = new Error(message);\n\t}\n\n\terror.shortMessage = shortMessage;\n\terror.command = command;\n\terror.escapedCommand = escapedCommand;\n\terror.exitCode = exitCode;\n\terror.signal = signal;\n\terror.signalDescription = signalDescription;\n\terror.stdout = stdout;\n\terror.stderr = stderr;\n\terror.cwd = cwd;\n\n\tif (all !== undefined) {\n\t\terror.all = all;\n\t}\n\n\tif ('bufferedData' in error) {\n\t\tdelete error.bufferedData;\n\t}\n\n\terror.failed = true;\n\terror.timedOut = Boolean(timedOut);\n\terror.isCanceled = isCanceled;\n\terror.killed = killed && !timedOut;\n\n\treturn error;\n};\n","import{constants}from\"node:os\";\n\nimport{SIGRTMAX}from\"./realtime.js\";\nimport{getSignals}from\"./signals.js\";\n\n\n\nconst getSignalsByName=()=>{\nconst signals=getSignals();\nreturn Object.fromEntries(signals.map(getSignalByName));\n};\n\nconst getSignalByName=({\nname,\nnumber,\ndescription,\nsupported,\naction,\nforced,\nstandard\n})=>[name,{name,number,description,supported,action,forced,standard}];\n\nexport const signalsByName=getSignalsByName();\n\n\n\n\nconst getSignalsByNumber=()=>{\nconst signals=getSignals();\nconst length=SIGRTMAX+1;\nconst signalsA=Array.from({length},(value,number)=>\ngetSignalByNumber(number,signals));\n\nreturn Object.assign({},...signalsA);\n};\n\nconst getSignalByNumber=(number,signals)=>{\nconst signal=findSignalByNumber(number,signals);\n\nif(signal===undefined){\nreturn{};\n}\n\nconst{name,description,supported,action,forced,standard}=signal;\nreturn{\n[number]:{\nname,\nnumber,\ndescription,\nsupported,\naction,\nforced,\nstandard\n}\n};\n};\n\n\n\nconst findSignalByNumber=(number,signals)=>{\nconst signal=signals.find(({name})=>constants.signals[name]===number);\n\nif(signal!==undefined){\nreturn signal;\n}\n\nreturn signals.find((signalA)=>signalA.number===number);\n};\n\nexport const signalsByNumber=getSignalsByNumber();","\nexport const getRealtimeSignals=()=>{\nconst length=SIGRTMAX-SIGRTMIN+1;\nreturn Array.from({length},getRealtimeSignal);\n};\n\nconst getRealtimeSignal=(value,index)=>({\nname:`SIGRT${index+1}`,\nnumber:SIGRTMIN+index,\naction:\"terminate\",\ndescription:\"Application-specific signal (realtime)\",\nstandard:\"posix\"\n});\n\nconst SIGRTMIN=34;\nexport const SIGRTMAX=64;","import{constants}from\"node:os\";\n\nimport{SIGNALS}from\"./core.js\";\nimport{getRealtimeSignals}from\"./realtime.js\";\n\n\n\nexport const getSignals=()=>{\nconst realtimeSignals=getRealtimeSignals();\nconst signals=[...SIGNALS,...realtimeSignals].map(normalizeSignal);\nreturn signals;\n};\n\n\n\n\n\n\n\nconst normalizeSignal=({\nname,\nnumber:defaultNumber,\ndescription,\naction,\nforced=false,\nstandard\n})=>{\nconst{\nsignals:{[name]:constantSignal}\n}=constants;\nconst supported=constantSignal!==undefined;\nconst number=supported?constantSignal:defaultNumber;\nreturn{name,number,description,supported,action,forced,standard};\n};","\n\nexport const SIGNALS=[\n{\nname:\"SIGHUP\",\nnumber:1,\naction:\"terminate\",\ndescription:\"Terminal closed\",\nstandard:\"posix\"\n},\n{\nname:\"SIGINT\",\nnumber:2,\naction:\"terminate\",\ndescription:\"User interruption with CTRL-C\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGQUIT\",\nnumber:3,\naction:\"core\",\ndescription:\"User interruption with CTRL-\\\\\",\nstandard:\"posix\"\n},\n{\nname:\"SIGILL\",\nnumber:4,\naction:\"core\",\ndescription:\"Invalid machine instruction\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGTRAP\",\nnumber:5,\naction:\"core\",\ndescription:\"Debugger breakpoint\",\nstandard:\"posix\"\n},\n{\nname:\"SIGABRT\",\nnumber:6,\naction:\"core\",\ndescription:\"Aborted\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGIOT\",\nnumber:6,\naction:\"core\",\ndescription:\"Aborted\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGBUS\",\nnumber:7,\naction:\"core\",\ndescription:\n\"Bus error due to misaligned, non-existing address or paging error\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGEMT\",\nnumber:7,\naction:\"terminate\",\ndescription:\"Command should be emulated but is not implemented\",\nstandard:\"other\"\n},\n{\nname:\"SIGFPE\",\nnumber:8,\naction:\"core\",\ndescription:\"Floating point arithmetic error\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGKILL\",\nnumber:9,\naction:\"terminate\",\ndescription:\"Forced termination\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGUSR1\",\nnumber:10,\naction:\"terminate\",\ndescription:\"Application-specific signal\",\nstandard:\"posix\"\n},\n{\nname:\"SIGSEGV\",\nnumber:11,\naction:\"core\",\ndescription:\"Segmentation fault\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGUSR2\",\nnumber:12,\naction:\"terminate\",\ndescription:\"Application-specific signal\",\nstandard:\"posix\"\n},\n{\nname:\"SIGPIPE\",\nnumber:13,\naction:\"terminate\",\ndescription:\"Broken pipe or socket\",\nstandard:\"posix\"\n},\n{\nname:\"SIGALRM\",\nnumber:14,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"posix\"\n},\n{\nname:\"SIGTERM\",\nnumber:15,\naction:\"terminate\",\ndescription:\"Termination\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGSTKFLT\",\nnumber:16,\naction:\"terminate\",\ndescription:\"Stack is empty or overflowed\",\nstandard:\"other\"\n},\n{\nname:\"SIGCHLD\",\nnumber:17,\naction:\"ignore\",\ndescription:\"Child process terminated, paused or unpaused\",\nstandard:\"posix\"\n},\n{\nname:\"SIGCLD\",\nnumber:17,\naction:\"ignore\",\ndescription:\"Child process terminated, paused or unpaused\",\nstandard:\"other\"\n},\n{\nname:\"SIGCONT\",\nnumber:18,\naction:\"unpause\",\ndescription:\"Unpaused\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGSTOP\",\nnumber:19,\naction:\"pause\",\ndescription:\"Paused\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGTSTP\",\nnumber:20,\naction:\"pause\",\ndescription:\"Paused using CTRL-Z or \\\"suspend\\\"\",\nstandard:\"posix\"\n},\n{\nname:\"SIGTTIN\",\nnumber:21,\naction:\"pause\",\ndescription:\"Background process cannot read terminal input\",\nstandard:\"posix\"\n},\n{\nname:\"SIGBREAK\",\nnumber:21,\naction:\"terminate\",\ndescription:\"User interruption with CTRL-BREAK\",\nstandard:\"other\"\n},\n{\nname:\"SIGTTOU\",\nnumber:22,\naction:\"pause\",\ndescription:\"Background process cannot write to terminal output\",\nstandard:\"posix\"\n},\n{\nname:\"SIGURG\",\nnumber:23,\naction:\"ignore\",\ndescription:\"Socket received out-of-band data\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGXCPU\",\nnumber:24,\naction:\"core\",\ndescription:\"Process timed out\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGXFSZ\",\nnumber:25,\naction:\"core\",\ndescription:\"File too big\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGVTALRM\",\nnumber:26,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGPROF\",\nnumber:27,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGWINCH\",\nnumber:28,\naction:\"ignore\",\ndescription:\"Terminal window size changed\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGIO\",\nnumber:29,\naction:\"terminate\",\ndescription:\"I/O is available\",\nstandard:\"other\"\n},\n{\nname:\"SIGPOLL\",\nnumber:29,\naction:\"terminate\",\ndescription:\"Watched event\",\nstandard:\"other\"\n},\n{\nname:\"SIGINFO\",\nnumber:29,\naction:\"ignore\",\ndescription:\"Request for process information\",\nstandard:\"other\"\n},\n{\nname:\"SIGPWR\",\nnumber:30,\naction:\"terminate\",\ndescription:\"Device running out of power\",\nstandard:\"systemv\"\n},\n{\nname:\"SIGSYS\",\nnumber:31,\naction:\"core\",\ndescription:\"Invalid system call\",\nstandard:\"other\"\n},\n{\nname:\"SIGUNUSED\",\nnumber:31,\naction:\"terminate\",\ndescription:\"Invalid system call\",\nstandard:\"other\"\n}];","const aliases = ['stdin', 'stdout', 'stderr'];\n\nconst hasAlias = options => aliases.some(alias => options[alias] !== undefined);\n\nexport const normalizeStdio = options => {\n\tif (!options) {\n\t\treturn;\n\t}\n\n\tconst {stdio} = options;\n\n\tif (stdio === undefined) {\n\t\treturn aliases.map(alias => options[alias]);\n\t}\n\n\tif (hasAlias(options)) {\n\t\tthrow new Error(`It's not possible to provide \\`stdio\\` in combination with one of ${aliases.map(alias => `\\`${alias}\\``).join(', ')}`);\n\t}\n\n\tif (typeof stdio === 'string') {\n\t\treturn stdio;\n\t}\n\n\tif (!Array.isArray(stdio)) {\n\t\tthrow new TypeError(`Expected \\`stdio\\` to be of type \\`string\\` or \\`Array\\`, got \\`${typeof stdio}\\``);\n\t}\n\n\tconst length = Math.max(stdio.length, aliases.length);\n\treturn Array.from({length}, (value, index) => stdio[index]);\n};\n\n// `ipc` is pushed unless it is already present\nexport const normalizeStdioNode = options => {\n\tconst stdio = normalizeStdio(options);\n\n\tif (stdio === 'ipc') {\n\t\treturn 'ipc';\n\t}\n\n\tif (stdio === undefined || typeof stdio === 'string') {\n\t\treturn [stdio, stdio, stdio, 'ipc'];\n\t}\n\n\tif (stdio.includes('ipc')) {\n\t\treturn stdio;\n\t}\n\n\treturn [...stdio, 'ipc'];\n};\n","import os from 'node:os';\nimport onExit from 'signal-exit';\n\nconst DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;\n\n// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior\nexport const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {\n\tconst killResult = kill(signal);\n\tsetKillTimeout(kill, signal, options, killResult);\n\treturn killResult;\n};\n\nconst setKillTimeout = (kill, signal, options, killResult) => {\n\tif (!shouldForceKill(signal, options, killResult)) {\n\t\treturn;\n\t}\n\n\tconst timeout = getForceKillAfterTimeout(options);\n\tconst t = setTimeout(() => {\n\t\tkill('SIGKILL');\n\t}, timeout);\n\n\t// Guarded because there's no `.unref()` when `execa` is used in the renderer\n\t// process in Electron. This cannot be tested since we don't run tests in\n\t// Electron.\n\t// istanbul ignore else\n\tif (t.unref) {\n\t\tt.unref();\n\t}\n};\n\nconst shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;\n\nconst isSigterm = signal => signal === os.constants.signals.SIGTERM\n\t\t|| (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');\n\nconst getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {\n\tif (forceKillAfterTimeout === true) {\n\t\treturn DEFAULT_FORCE_KILL_TIMEOUT;\n\t}\n\n\tif (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {\n\t\tthrow new TypeError(`Expected the \\`forceKillAfterTimeout\\` option to be a non-negative integer, got \\`${forceKillAfterTimeout}\\` (${typeof forceKillAfterTimeout})`);\n\t}\n\n\treturn forceKillAfterTimeout;\n};\n\n// `childProcess.cancel()`\nexport const spawnedCancel = (spawned, context) => {\n\tconst killResult = spawned.kill();\n\n\tif (killResult) {\n\t\tcontext.isCanceled = true;\n\t}\n};\n\nconst timeoutKill = (spawned, signal, reject) => {\n\tspawned.kill(signal);\n\treject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));\n};\n\n// `timeout` option handling\nexport const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {\n\tif (timeout === 0 || timeout === undefined) {\n\t\treturn spawnedPromise;\n\t}\n\n\tlet timeoutId;\n\tconst timeoutPromise = new Promise((resolve, reject) => {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimeoutKill(spawned, killSignal, reject);\n\t\t}, timeout);\n\t});\n\n\tconst safeSpawnedPromise = spawnedPromise.finally(() => {\n\t\tclearTimeout(timeoutId);\n\t});\n\n\treturn Promise.race([timeoutPromise, safeSpawnedPromise]);\n};\n\nexport const validateTimeout = ({timeout}) => {\n\tif (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) {\n\t\tthrow new TypeError(`Expected the \\`timeout\\` option to be a non-negative integer, got \\`${timeout}\\` (${typeof timeout})`);\n\t}\n};\n\n// `cleanup` option handling\nexport const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {\n\tif (!cleanup || detached) {\n\t\treturn timedPromise;\n\t}\n\n\tconst removeExitHandler = onExit(() => {\n\t\tspawned.kill();\n\t});\n\n\treturn timedPromise.finally(() => {\n\t\tremoveExitHandler();\n\t});\n};\n","import {createWriteStream} from 'node:fs';\nimport {ChildProcess} from 'node:child_process';\nimport {isWritableStream} from 'is-stream';\n\nconst isExecaChildProcess = target => target instanceof ChildProcess && typeof target.then === 'function';\n\nconst pipeToTarget = (spawned, streamName, target) => {\n\tif (typeof target === 'string') {\n\t\tspawned[streamName].pipe(createWriteStream(target));\n\t\treturn spawned;\n\t}\n\n\tif (isWritableStream(target)) {\n\t\tspawned[streamName].pipe(target);\n\t\treturn spawned;\n\t}\n\n\tif (!isExecaChildProcess(target)) {\n\t\tthrow new TypeError('The second argument must be a string, a stream or an Execa child process.');\n\t}\n\n\tif (!isWritableStream(target.stdin)) {\n\t\tthrow new TypeError('The target child process\\'s stdin must be available.');\n\t}\n\n\tspawned[streamName].pipe(target.stdin);\n\treturn target;\n};\n\nexport const addPipeMethods = spawned => {\n\tif (spawned.stdout !== null) {\n\t\tspawned.pipeStdout = pipeToTarget.bind(undefined, spawned, 'stdout');\n\t}\n\n\tif (spawned.stderr !== null) {\n\t\tspawned.pipeStderr = pipeToTarget.bind(undefined, spawned, 'stderr');\n\t}\n\n\tif (spawned.all !== undefined) {\n\t\tspawned.pipeAll = pipeToTarget.bind(undefined, spawned, 'all');\n\t}\n};\n","export function isStream(stream) {\n\treturn stream !== null\n\t\t&& typeof stream === 'object'\n\t\t&& typeof stream.pipe === 'function';\n}\n\nexport function isWritableStream(stream) {\n\treturn isStream(stream)\n\t\t&& stream.writable !== false\n\t\t&& typeof stream._write === 'function'\n\t\t&& typeof stream._writableState === 'object';\n}\n\nexport function isReadableStream(stream) {\n\treturn isStream(stream)\n\t\t&& stream.readable !== false\n\t\t&& typeof stream._read === 'function'\n\t\t&& typeof stream._readableState === 'object';\n}\n\nexport function isDuplexStream(stream) {\n\treturn isWritableStream(stream)\n\t\t&& isReadableStream(stream);\n}\n\nexport function isTransformStream(stream) {\n\treturn isDuplexStream(stream)\n\t\t&& typeof stream._transform === 'function';\n}\n","import {createReadStream, readFileSync} from 'node:fs';\nimport {isStream} from 'is-stream';\nimport getStream from 'get-stream';\nimport mergeStream from 'merge-stream';\n\nconst validateInputOptions = input => {\n\tif (input !== undefined) {\n\t\tthrow new TypeError('The `input` and `inputFile` options cannot be both set.');\n\t}\n};\n\nconst getInputSync = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn readFileSync(inputFile);\n};\n\n// `input` and `inputFile` option in sync mode\nexport const handleInputSync = options => {\n\tconst input = getInputSync(options);\n\n\tif (isStream(input)) {\n\t\tthrow new TypeError('The `input` option cannot be a stream in sync mode');\n\t}\n\n\treturn input;\n};\n\nconst getInput = ({input, inputFile}) => {\n\tif (typeof inputFile !== 'string') {\n\t\treturn input;\n\t}\n\n\tvalidateInputOptions(input);\n\treturn createReadStream(inputFile);\n};\n\n// `input` and `inputFile` option in async mode\nexport const handleInput = (spawned, options) => {\n\tconst input = getInput(options);\n\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\n\tif (isStream(input)) {\n\t\tinput.pipe(spawned.stdin);\n\t} else {\n\t\tspawned.stdin.end(input);\n\t}\n};\n\n// `all` interleaves `stdout` and `stderr`\nexport const makeAllStream = (spawned, {all}) => {\n\tif (!all || (!spawned.stdout && !spawned.stderr)) {\n\t\treturn;\n\t}\n\n\tconst mixed = mergeStream();\n\n\tif (spawned.stdout) {\n\t\tmixed.add(spawned.stdout);\n\t}\n\n\tif (spawned.stderr) {\n\t\tmixed.add(spawned.stderr);\n\t}\n\n\treturn mixed;\n};\n\n// On failure, `result.stdout|stderr|all` should contain the currently buffered stream\nconst getBufferedData = async (stream, streamPromise) => {\n\t// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve\n\tif (!stream || streamPromise === undefined) {\n\t\treturn;\n\t}\n\n\tstream.destroy();\n\n\ttry {\n\t\treturn await streamPromise;\n\t} catch (error) {\n\t\treturn error.bufferedData;\n\t}\n};\n\nconst getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {\n\tif (!stream || !buffer) {\n\t\treturn;\n\t}\n\n\tif (encoding) {\n\t\treturn getStream(stream, {encoding, maxBuffer});\n\t}\n\n\treturn getStream.buffer(stream, {maxBuffer});\n};\n\n// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)\nexport const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {\n\tconst stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});\n\tconst stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});\n\tconst allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});\n\n\ttry {\n\t\treturn await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);\n\t} catch (error) {\n\t\treturn Promise.all([\n\t\t\t{error, signal: error.signal, timedOut: error.timedOut},\n\t\t\tgetBufferedData(stdout, stdoutPromise),\n\t\t\tgetBufferedData(stderr, stderrPromise),\n\t\t\tgetBufferedData(all, allPromise),\n\t\t]);\n\t}\n};\n","// eslint-disable-next-line unicorn/prefer-top-level-await\nconst nativePromisePrototype = (async () => {})().constructor.prototype;\n\nconst descriptors = ['then', 'catch', 'finally'].map(property => [\n\tproperty,\n\tReflect.getOwnPropertyDescriptor(nativePromisePrototype, property),\n]);\n\n// The return value is a mixin of `childProcess` and `Promise`\nexport const mergePromise = (spawned, promise) => {\n\tfor (const [property, descriptor] of descriptors) {\n\t\t// Starting the main `promise` is deferred to avoid consuming streams\n\t\tconst value = typeof promise === 'function'\n\t\t\t? (...args) => Reflect.apply(descriptor.value, promise(), args)\n\t\t\t: descriptor.value.bind(promise);\n\n\t\tReflect.defineProperty(spawned, property, {...descriptor, value});\n\t}\n};\n\n// Use promises instead of `child_process` events\nexport const getSpawnedPromise = spawned => new Promise((resolve, reject) => {\n\tspawned.on('exit', (exitCode, signal) => {\n\t\tresolve({exitCode, signal});\n\t});\n\n\tspawned.on('error', error => {\n\t\treject(error);\n\t});\n\n\tif (spawned.stdin) {\n\t\tspawned.stdin.on('error', error => {\n\t\t\treject(error);\n\t\t});\n\t}\n});\n","import {Buffer} from 'node:buffer';\nimport {ChildProcess} from 'node:child_process';\n\nconst normalizeArgs = (file, args = []) => {\n\tif (!Array.isArray(args)) {\n\t\treturn [file];\n\t}\n\n\treturn [file, ...args];\n};\n\nconst NO_ESCAPE_REGEXP = /^[\\w.-]+$/;\nconst DOUBLE_QUOTES_REGEXP = /\"/g;\n\nconst escapeArg = arg => {\n\tif (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) {\n\t\treturn arg;\n\t}\n\n\treturn `\"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\\\\"')}\"`;\n};\n\nexport const joinCommand = (file, args) => normalizeArgs(file, args).join(' ');\n\nexport const getEscapedCommand = (file, args) => normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');\n\nconst SPACES_REGEXP = / +/g;\n\n// Handle `execaCommand()`\nexport const parseCommand = command => {\n\tconst tokens = [];\n\tfor (const token of command.trim().split(SPACES_REGEXP)) {\n\t\t// Allow spaces to be escaped by a backslash if not meant as a delimiter\n\t\tconst previousToken = tokens[tokens.length - 1];\n\t\tif (previousToken && previousToken.endsWith('\\\\')) {\n\t\t\t// Merge previous token with current one\n\t\t\ttokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;\n\t\t} else {\n\t\t\ttokens.push(token);\n\t\t}\n\t}\n\n\treturn tokens;\n};\n\nconst parseExpression = expression => {\n\tconst typeOfExpression = typeof expression;\n\n\tif (typeOfExpression === 'string') {\n\t\treturn expression;\n\t}\n\n\tif (typeOfExpression === 'number') {\n\t\treturn String(expression);\n\t}\n\n\tif (\n\t\ttypeOfExpression === 'object'\n\t\t&& expression !== null\n\t\t&& !(expression instanceof ChildProcess)\n\t\t&& 'stdout' in expression\n\t) {\n\t\tconst typeOfStdout = typeof expression.stdout;\n\n\t\tif (typeOfStdout === 'string') {\n\t\t\treturn expression.stdout;\n\t\t}\n\n\t\tif (Buffer.isBuffer(expression.stdout)) {\n\t\t\treturn expression.stdout.toString();\n\t\t}\n\n\t\tthrow new TypeError(`Unexpected \"${typeOfStdout}\" stdout in template expression`);\n\t}\n\n\tthrow new TypeError(`Unexpected \"${typeOfExpression}\" in template expression`);\n};\n\nconst concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0\n\t? [...tokens, ...nextTokens]\n\t: [\n\t\t...tokens.slice(0, -1),\n\t\t`${tokens[tokens.length - 1]}${nextTokens[0]}`,\n\t\t...nextTokens.slice(1),\n\t];\n\nconst parseTemplate = ({templates, expressions, tokens, index, template}) => {\n\tconst templateString = template ?? templates.raw[index];\n\tconst templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);\n\tconst newTokens = concatTokens(\n\t\ttokens,\n\t\ttemplateTokens,\n\t\ttemplateString.startsWith(' '),\n\t);\n\n\tif (index === expressions.length) {\n\t\treturn newTokens;\n\t}\n\n\tconst expression = expressions[index];\n\tconst expressionTokens = Array.isArray(expression)\n\t\t? expression.map(expression => parseExpression(expression))\n\t\t: [parseExpression(expression)];\n\treturn concatTokens(\n\t\tnewTokens,\n\t\texpressionTokens,\n\t\ttemplateString.endsWith(' '),\n\t);\n};\n\nexport const parseTemplates = (templates, expressions) => {\n\tlet tokens = [];\n\n\tfor (const [index, template] of templates.entries()) {\n\t\ttokens = parseTemplate({templates, expressions, tokens, index, template});\n\t}\n\n\treturn tokens;\n};\n\n","import {debuglog} from 'node:util';\nimport process from 'node:process';\n\nexport const verboseDefault = debuglog('execa').enabled;\n\nconst padField = (field, padding) => String(field).padStart(padding, '0');\n\nconst getTimestamp = () => {\n\tconst date = new Date();\n\treturn `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;\n};\n\nexport const logCommand = (escapedCommand, {verbose}) => {\n\tif (!verbose) {\n\t\treturn;\n\t}\n\n\tprocess.stderr.write(`[${getTimestamp()}] ${escapedCommand}\\n`);\n};\n","import {\n BuildStepOutput,\n EntrypointGroup,\n InternalConfig,\n WxtDevServer,\n} from './types';\nimport * as vite from 'vite';\nimport { Scripting } from 'webextension-polyfill';\nimport {\n getEntrypointBundlePath,\n resolvePerBrowserOption,\n} from './utils/entrypoints';\nimport {\n getContentScriptCssFiles,\n getContentScriptsCssMap,\n} from './utils/manifest';\nimport { buildInternal } from './build';\nimport { createExtensionRunner } from './runners';\n\nexport async function getServerInfo(): Promise<ServerInfo> {\n const { default: getPort, portNumbers } = await import('get-port');\n const port = await getPort({ port: portNumbers(3000, 3010) });\n const hostname = 'localhost';\n const origin = `http://${hostname}:${port}`;\n const serverConfig: vite.InlineConfig = {\n server: {\n origin,\n },\n };\n\n return {\n port,\n hostname,\n origin,\n viteServerConfig: serverConfig,\n };\n}\n\nexport async function setupServer(\n serverInfo: ServerInfo,\n config: InternalConfig,\n): Promise<WxtDevServer> {\n const runner = await createExtensionRunner(config);\n\n const viteServer = await vite.createServer(\n vite.mergeConfig(serverInfo, await config.vite(config.env)),\n );\n\n const start = async () => {\n await viteServer.listen(server.port);\n config.logger.success(`Started dev server @ ${serverInfo.origin}`);\n\n server.currentOutput = await buildInternal(config);\n await runner.openBrowser(config);\n };\n\n const reloadExtension = () => {\n viteServer.ws.send('wxt:reload-extension');\n };\n const reloadPage = (path: string) => {\n // Can't use Vite's built-in \"full-reload\" event because it doesn't like our paths, it expects\n // paths ending in \"/index.html\"\n viteServer.ws.send('wxt:reload-page', path);\n };\n const reloadContentScript = (\n contentScript: Omit<Scripting.RegisteredContentScript, 'id'>,\n ) => {\n viteServer.ws.send('wxt:reload-content-script', contentScript);\n };\n\n const server: WxtDevServer = {\n ...viteServer,\n start,\n currentOutput: {\n manifest: {\n manifest_version: 3,\n name: '',\n version: '',\n },\n publicAssets: [],\n steps: [],\n },\n port: serverInfo.port,\n hostname: serverInfo.hostname,\n origin: serverInfo.origin,\n reloadExtension,\n reloadPage,\n reloadContentScript,\n };\n\n return server;\n}\n\n/**\n * From the server, tell the client to reload content scripts from the provided build step outputs.\n */\nexport function reloadContentScripts(\n steps: BuildStepOutput[],\n config: InternalConfig,\n server: WxtDevServer,\n) {\n if (config.manifestVersion === 3) {\n steps.forEach((step) => {\n const entry = step.entrypoints;\n if (Array.isArray(entry) || entry.type !== 'content-script') return;\n\n const js = [getEntrypointBundlePath(entry, config.outDir, '.js')];\n const cssMap = getContentScriptsCssMap(server.currentOutput, [entry]);\n const css = getContentScriptCssFiles([entry], cssMap);\n\n server.reloadContentScript({\n allFrames: resolvePerBrowserOption(\n entry.options.allFrames,\n config.browser,\n ),\n excludeMatches: resolvePerBrowserOption(\n entry.options.excludeMatches,\n config.browser,\n ),\n matches: resolvePerBrowserOption(entry.options.matches, config.browser),\n runAt: resolvePerBrowserOption(entry.options.runAt, config.browser),\n // @ts-expect-error: Chrome accepts this, not typed in webextension-polyfill (https://developer.chrome.com/docs/extensions/reference/scripting/#type-RegisteredContentScript)\n world: resolvePerBrowserOption(entry.options.world, config.browser),\n js,\n css,\n });\n });\n } else {\n server.reloadExtension();\n }\n}\n\nexport function reloadHtmlPages(\n groups: EntrypointGroup[],\n server: WxtDevServer,\n config: InternalConfig,\n) {\n groups.flat().forEach((entry) => {\n const path = getEntrypointBundlePath(entry, config.outDir, '.html');\n server.reloadPage(path);\n });\n}\n\ninterface ServerInfo {\n port: number;\n hostname: string;\n origin: string;\n viteServerConfig: vite.InlineConfig;\n}\n","import { ExtensionRunner } from './extension-runner';\nimport { relative } from 'node:path';\n\n/**\n * The WSL runner just logs a warning message because `web-ext` doesn't work in WSL.\n */\nexport function createWslRunner(): ExtensionRunner {\n return {\n async openBrowser(config) {\n config.logger.warn(\n `Cannot open browser when using WSL. Load \"${relative(\n process.cwd(),\n config.outDir,\n )}\" as an unpacked extension manually`,\n );\n },\n async closeBrowser() {\n // noop\n },\n };\n}\n","import type { WebExtRunInstance } from 'web-ext-run';\nimport { ExtensionRunner } from './extension-runner';\n\n/**\n * Create an `ExtensionRunner` backed by `web-ext`.\n */\nexport function createWebExtRunner(): ExtensionRunner {\n let runner: WebExtRunInstance | undefined;\n\n return {\n async openBrowser(config) {\n config.logger.info('Opening browser...');\n\n // Use the plugin's logger instead of web-ext's built-in one.\n const webExtLogger = await import('web-ext-run/util/logger');\n webExtLogger.consoleStream.write = ({ level, msg, name }) => {\n if (level >= ERROR_LOG_LEVEL) config.logger.error(name, msg);\n if (level >= WARN_LOG_LEVEL) config.logger.warn(msg);\n };\n\n const wxtUserConfig = config.runnerConfig.config;\n const userConfig = {\n console: wxtUserConfig?.openConsole,\n devtools: wxtUserConfig?.openDevtools,\n startUrl: wxtUserConfig?.startUrls,\n ...(config.browser === 'firefox'\n ? {\n firefox: wxtUserConfig?.binaries?.firefox,\n firefoxProfile: wxtUserConfig?.firefoxProfile,\n prefs: wxtUserConfig?.firefoxPrefs,\n args: wxtUserConfig?.firefoxArgs,\n }\n : {\n chromiumBinary: wxtUserConfig?.binaries?.[config.browser],\n chromiumProfile: wxtUserConfig?.chromiumProfile,\n args: wxtUserConfig?.chromiumArgs,\n }),\n };\n\n const finalConfig = {\n ...userConfig,\n target: config.browser === 'firefox' ? 'firefox-desktop' : 'chromium',\n sourceDir: config.outDir,\n // WXT handles reloads, so disable auto-reload behaviors in web-ext\n noReload: true,\n noInput: true,\n };\n const options = {\n // Don't call `process.exit(0)` after starting web-ext\n shouldExitProgram: false,\n };\n config.logger.debug('web-ext config:', finalConfig);\n config.logger.debug('web-ext options:', options);\n\n const webExt = await import('web-ext-run');\n runner = await webExt.default.cmd.run(finalConfig, options);\n\n config.logger.success('Opened!');\n },\n\n async closeBrowser() {\n return await runner?.exit();\n },\n };\n}\n\n// https://github.com/mozilla/web-ext/blob/e37e60a2738478f512f1255c537133321f301771/src/util/logger.js#L12\nconst WARN_LOG_LEVEL = 40;\nconst ERROR_LOG_LEVEL = 50;\n","import { ExtensionRunner } from './extension-runner';\nimport { relative } from 'node:path';\n\n/**\n * The Safari runner just logs a warning message because `web-ext` doesn't work with Safari.\n */\nexport function createSafariRunner(): ExtensionRunner {\n return {\n async openBrowser(config) {\n config.logger.warn(\n `Cannot Safari using web-ext. Load \"${relative(\n process.cwd(),\n config.outDir,\n )}\" as an unpacked extension manually`,\n );\n },\n async closeBrowser() {\n // noop\n },\n };\n}\n","import { ExtensionRunner } from './extension-runner';\nimport { relative } from 'node:path';\n\n/**\n * The manual runner tells the user to load the unpacked extension manually.\n */\nexport function createManualRunner(): ExtensionRunner {\n return {\n async openBrowser(config) {\n config.logger.info(\n `Load \"${relative(\n process.cwd(),\n config.outDir,\n )}\" as an unpacked extension manually`,\n );\n },\n async closeBrowser() {\n // noop\n },\n };\n}\n","/**\n * Returns true when running on WSL or WSL2.\n */\nexport async function isWsl(): Promise<boolean> {\n const { default: isWsl } = await import('is-wsl'); // ESM only, requires dynamic import\n return isWsl;\n}\n","import { InternalConfig } from '../types';\nimport { ExtensionRunner } from './extension-runner';\nimport { createWslRunner } from './wsl';\nimport { createWebExtRunner } from './web-ext';\nimport { createSafariRunner } from './safari';\nimport { createManualRunner } from './manual';\nimport { isWsl } from '../utils/wsl';\n\nexport async function createExtensionRunner(\n config: InternalConfig,\n): Promise<ExtensionRunner> {\n if (config.browser === 'safari') return createSafariRunner();\n\n if (await isWsl()) return createWslRunner();\n if (config.runnerConfig.config?.disabled) return createManualRunner();\n\n return createWebExtRunner();\n}\n","import path from 'node:path';\nimport glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport { consola } from 'consola';\nimport pc from 'picocolors';\n\n/**\n * Remove generated/temp files from the directory.\n *\n * @param root The directory to look for generated/temp files in. Defaults to `process.cwd()`. Can be relative to `process.cwd()` or absolute.\n */\nexport async function clean(root = process.cwd()) {\n consola.info('Cleaning Project');\n\n const tempDirs = [\n 'node_modules/.vite',\n 'node_modules/.cache',\n '**/.wxt',\n '.output/*',\n ];\n consola.debug('Looking for:', tempDirs.map(pc.cyan).join(', '));\n const directories = await glob(tempDirs, {\n cwd: path.resolve(root),\n absolute: true,\n onlyDirectories: true,\n deep: 2,\n });\n if (directories.length === 0) {\n consola.debug('No generated files found.');\n return;\n }\n\n consola.debug(\n 'Found:',\n directories.map((dir) => pc.cyan(path.relative(root, dir))).join(', '),\n );\n for (const directory of directories) {\n await fs.rm(directory, { force: true, recursive: true });\n consola.debug('Deleted ' + pc.cyan(path.relative(root, directory)));\n }\n}\n","{\n \"name\": \"wxt\",\n \"type\": \"module\",\n \"version\": \"0.7.3\",\n \"description\": \"Next gen framework for developing web extensions\",\n \"engines\": {\n \"node\": \">=18.16.0\",\n \"pnpm\": \">=8\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/wxt-dev/wxt\"\n },\n \"homepage\": \"https://wxt.dev\",\n \"keywords\": [\n \"vite\",\n \"chrome\",\n \"web\",\n \"extension\",\n \"browser\",\n \"bundler\",\n \"framework\"\n ],\n \"author\": {\n \"name\": \"Aaron Klinker\",\n \"email\": \"aaronklinker1+wxt@gmail.com\"\n },\n \"license\": \"MIT\",\n \"files\": [\n \"bin\",\n \"dist\"\n ],\n \"bin\": \"./bin/wxt.cjs\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"require\": \"./dist/index.cjs\",\n \"import\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n },\n \"./client\": {\n \"import\": \"./dist/client.js\",\n \"types\": \"./dist/client.d.ts\"\n },\n \"./browser\": {\n \"import\": \"./dist/browser.js\",\n \"types\": \"./dist/browser.d.ts\"\n }\n },\n \"scripts\": {\n \"wxt\": \"tsx src/cli/index.ts\",\n \"build\": \"tsx scripts/build.ts\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --write .\",\n \"compile\": \"tsc --noEmit\",\n \"test\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage.enabled --coverage.exclude=e2e --coverage.exclude=src/testing\",\n \"prepare\": \"simple-git-hooks\",\n \"prepublish\": \"pnpm -s build\",\n \"docs:dev\": \"vitepress dev docs\",\n \"docs:build\": \"vitepress build docs\",\n \"docs:preview\": \"vitepress preview docs\",\n \"sync-releases\": \"pnpx changelogen@latest gh release\"\n },\n \"dependencies\": {\n \"@types/webextension-polyfill\": \"^0.10.1\",\n \"@webext-core/fake-browser\": \"^1.2.2\",\n \"@webext-core/isolated-element\": \"^1.0.4\",\n \"@webext-core/match-patterns\": \"^1.0.2\",\n \"async-mutex\": \"^0.4.0\",\n \"c12\": \"^1.4.2\",\n \"cac\": \"^6.7.14\",\n \"consola\": \"^3.2.3\",\n \"esbuild\": \"^0.19.4\",\n \"fast-glob\": \"^3.3.1\",\n \"filesize\": \"^10.0.8\",\n \"fs-extra\": \"^11.1.1\",\n \"get-port\": \"^7.0.0\",\n \"giget\": \"^1.1.2\",\n \"immer\": \"^10.0.2\",\n \"is-wsl\": \"^3.0.0\",\n \"jiti\": \"^1.19.1\",\n \"json5\": \"^2.2.3\",\n \"linkedom\": \"^0.15.1\",\n \"minimatch\": \"^9.0.3\",\n \"ora\": \"^7.0.1\",\n \"picocolors\": \"^1.0.0\",\n \"prompts\": \"^2.4.2\",\n \"rollup-plugin-visualizer\": \"^5.9.2\",\n \"unimport\": \"^3.1.0\",\n \"vite\": \"^4.4.7\",\n \"web-ext-run\": \"^0.1.0\",\n \"webextension-polyfill\": \"^0.10.0\",\n \"zip-dir\": \"^2.0.0\"\n },\n \"devDependencies\": {\n \"@faker-js/faker\": \"^8.0.2\",\n \"@types/fs-extra\": \"^11.0.1\",\n \"@types/lodash.merge\": \"^4.6.7\",\n \"@types/node\": \"^20.4.5\",\n \"@types/prompts\": \"^2.4.4\",\n \"@vitest/coverage-v8\": \"^0.34.1\",\n \"execa\": \"^7.2.0\",\n \"jsdom\": \"^22.1.0\",\n \"lint-staged\": \"^14.0.0\",\n \"lodash.merge\": \"^4.6.2\",\n \"npm-run-all\": \"^4.1.5\",\n \"prettier\": \"^3.0.1\",\n \"simple-git-hooks\": \"^2.9.0\",\n \"ts-morph\": \"^20.0.0\",\n \"tsup\": \"^7.1.0\",\n \"tsx\": \"^3.12.7\",\n \"typescript\": \"^5.2.2\",\n \"vitepress\": \"1.0.0-rc.10\",\n \"vitest\": \"^0.34.1\",\n \"vitest-mock-extended\": \"^1.1.4\",\n \"vue\": \"^3.3.4\",\n \"webextension-polyfill\": \"^0.10.0\"\n },\n \"peerDependencies\": {\n \"webextension-polyfill\": \">=0.10.0\"\n },\n \"packageManager\": \"pnpm@8.6.3\",\n \"simple-git-hooks\": {\n \"pre-commit\": \"pnpm lint-staged\"\n },\n \"lint-staged\": {\n \"*\": \"prettier --write\"\n },\n \"changelog\": {\n \"excludeAuthors\": [\n \"aaronklinker1@gmail.com\"\n ]\n },\n \"pnpm\": {\n \"peerDependencyRules\": {\n \"ignoreMissing\": [\n \"@algolia/client-search\",\n \"search-insights\"\n ]\n }\n }\n}\n","import { UserConfig } from '../types';\n\nexport function defineConfig(config: UserConfig): UserConfig {\n return config;\n}\n","import { ExtensionRunnerConfig } from '../types';\n\nexport function defineRunnerConfig(\n config: ExtensionRunnerConfig,\n): ExtensionRunnerConfig {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;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IAAI,CAAC;AAAA,MACf;AACA,YAAM,eAAe,QAAQ,cAC1B,KAAK,EACL,IAAI,CAAC,UAAU;AACd,eAAOD,IAAG;AAAA,UACRC,UAAS,eAAe,QAAQ,wBAAwB,OAAO,EAAE,CAAC;AAAA,QACpE;AAAA,MACF,CAAC,EACA,KAAKD,IAAG,IAAI,IAAI,CAAC;AAGpB,uBAAiB,MAAM,wBAAwB;AAC/C,qBAAe,SAAS;AACxB,YAAM,EAAE,QAAQ,UAAU,IAAI,MAAM;AAAA,QAClC;AAAA;AAAA,QAEA,QAAQ;AAAA,QACR,QAAQ;AAAA,MACV;AACA,aAAO,gBAAgB;AAGvB,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO,gBAAgB;AACvB;AAAA,QACF,KAAK;AACH,0BAAgB,QAAQ,eAAe,QAAQ,cAAc;AAC7D;AAAA,QACF,KAAK;AACH,+BAAqB,QAAQ,cAAc,gBAAgB,MAAM;AACjE;AAAA,MACJ;AACA,MAAAE,SAAQ,QAAQ,aAAa,YAAY,EAAE;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;","names":["fs","path","fs","path","fs","path","resolve","path","resolve","pathKey","path","path","fs","path","process","unload","emit","load","processReallyExit","processEmit","getStream","stream","resolve","path","vite","fs","path","fs","resolve","normalizePath","path","resolve","normalizePath","dirname","relative","resolve","url","isOffline","url","url","dirname","resolve","fs","ensureDir","normalizePath","resolve","ensureDir","dirname","fs","extname","unimport","fs","resolve","normalizePath","fs","resolve","path","env","global","pc","normalizePath","consola","relative","vite","fs","path","fs","dirname","resolve","fs","fs","global","resolve","fs","dirname","relative","resolve","fs","parseHTML","createUnimport","fs","resolve","path","normalizePath","unimport","createUnimport","fs","resolve","glob","glob","path","resolve","relative","fs","parseHTML","createUnimport","fs","relative","resolve","path","fs","resolve","unimport","createUnimport","normalizePath","path","global","relative","fs","resolve","resolve","fs","vite","fs","resolve","version","options","normalizePath","pc","vite","fs","resolve","path","pc","fs","path","fs","pc","resolve","Buffer","path","process","process","path","process","path","onetime","process","constants","constants","process","resolve","onExit","mergeStream","getStream","resolve","Buffer","ChildProcess","expression","process","process","crossSpawn","path","Buffer","$","glob","pc","fs","glob","vite","relative","relative","relative","isWsl","path","path","glob","fs","consola","pc","version","build","createServer","path","pc","relative","consola"]}