wxt 0.21.3 → 0.21.5
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/README.md +1 -1
- package/dist/{core/build.d.mts → build.d.mts} +2 -2
- package/dist/{core/build.mjs → build.mjs} +3 -4
- package/dist/{core/clean.d.mts → clean.d.mts} +2 -2
- package/dist/{core/clean.mjs → clean.mjs} +3 -3
- package/dist/cli/cli-utils.mjs +11 -8
- package/dist/cli/commands.mjs +10 -9
- package/dist/{core/create-server.d.mts → create-server.d.mts} +2 -2
- package/dist/{core/create-server.mjs → create-server.mjs} +13 -14
- package/dist/define-config.d.mts +6 -0
- package/dist/{core/define-config.mjs → define-config.mjs} +1 -1
- package/dist/{core/define-web-ext-config.d.mts → define-web-ext-config.d.mts} +2 -2
- package/dist/{core/define-web-ext-config.mjs → define-web-ext-config.mjs} +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +10 -11
- package/dist/{core/initialize.d.mts → initialize.d.mts} +2 -1
- package/dist/{core/initialize.mjs → initialize.mjs} +22 -7
- package/dist/inline/dotenv-expand/index.mjs +31 -0
- package/dist/inline/get-port-please/index.mjs +196 -0
- package/dist/inline/is-wsl/index.mjs +44 -0
- package/dist/inline/normalize-path/index.mjs +23 -0
- package/dist/inline/ohash/index.mjs +113 -0
- package/dist/inline/scule/index.mjs +50 -0
- package/dist/{core/utils/building → internal}/build-entrypoints.mjs +5 -5
- package/dist/internal/builders/unknown.mjs +22 -0
- package/dist/{core → internal}/builders/vite/index.mjs +144 -139
- package/dist/internal/builders/vite/plugins/add-entrypoint-group-runtime-env-entries.mjs +16 -0
- package/dist/internal/builders/vite/plugins/add-runtime-env-entries.mjs +14 -0
- package/dist/{core/builders/vite/plugins/bundleAnalysis.mjs → internal/builders/vite/plugins/bundle-analysis.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/cssEntrypoints.mjs → internal/builders/vite/plugins/css-entrypoints.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/defineImportMeta.mjs → internal/builders/vite/plugins/define-import-meta.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/devHtmlPrerender.mjs → internal/builders/vite/plugins/dev-html-prerender.mjs} +6 -7
- package/dist/{core/builders/vite/plugins/devServerGlobals.mjs → internal/builders/vite/plugins/dev-server-globals.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/extensionApiMock.mjs → internal/builders/vite/plugins/extension-api-mock.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/iifeAnonymous.mjs → internal/builders/vite/plugins/iife-anonymous.mjs} +1 -1
- package/dist/{core/builders/vite/plugins/iifeFooter.mjs → internal/builders/vite/plugins/iife-footer.mjs} +1 -1
- package/dist/internal/builders/vite/plugins/index.mjs +17 -0
- package/dist/{core/builders/vite/plugins/noopBackground.mjs → internal/builders/vite/plugins/noop-background.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/removeEntrypointMainFunction.mjs → internal/builders/vite/plugins/remove-entrypoint-main-function.mjs} +3 -4
- package/dist/{core/builders/vite/plugins/resolveAppConfig.mjs → internal/builders/vite/plugins/resolve-app-config.mjs} +2 -2
- package/dist/{core/builders/vite/plugins/resolveVirtualModules.mjs → internal/builders/vite/plugins/resolve-virtual-modules.mjs} +8 -6
- package/dist/{core/builders/vite/plugins/tsconfigPaths.mjs → internal/builders/vite/plugins/tsconfig-paths.mjs} +1 -1
- package/dist/internal/builders/vite/plugins/wxt-plugin-loader.mjs +77 -0
- package/dist/{builtin-modules → internal/builtin-modules}/escape-unicode.mjs +2 -2
- package/dist/{builtin-modules → internal/builtin-modules}/favicon-permission.mjs +2 -2
- package/dist/{builtin-modules → internal/builtin-modules}/index.mjs +4 -2
- package/dist/internal/builtin-modules/plugins.mjs +21 -0
- package/dist/{builtin-modules → internal/builtin-modules}/unimport.mjs +20 -9
- package/dist/{core/utils → internal}/constants.mjs +1 -1
- package/dist/internal/detect-builder.mjs +9 -0
- package/dist/{core/utils/building → internal}/detect-dev-changes.mjs +4 -4
- package/dist/internal/detect-runner.mjs +11 -0
- package/dist/internal/entrypoint-finders/flat.mjs +84 -0
- package/dist/internal/environments/browser-environment.mjs +48 -0
- package/dist/{core/utils → internal}/environments/environment.mjs +1 -1
- package/dist/{core/utils → internal}/environments/extension-environment.mjs +1 -1
- package/dist/{core/utils/create-file-reloader.mjs → internal/file-reloader.mjs} +10 -11
- package/dist/{core/utils/building → internal}/find-entrypoints.mjs +10 -75
- package/dist/{core → internal}/generate-wxt-dir.mjs +10 -10
- package/dist/internal/get-public-files.mjs +14 -0
- package/dist/{core/utils/building → internal}/group-entrypoints.mjs +1 -1
- package/dist/{core/utils → internal}/i18n.mjs +1 -1
- package/dist/{core/utils/building → internal}/internal-build.mjs +10 -10
- package/dist/{core → internal}/keyboard-shortcuts.mjs +2 -1
- package/dist/{core/utils → internal}/manifest.mjs +14 -14
- package/dist/internal/package-managers/bun.mjs +22 -0
- package/dist/{core → internal}/package-managers/deno.mjs +1 -1
- package/dist/{core → internal}/package-managers/index.mjs +1 -1
- package/dist/{core → internal}/package-managers/npm.mjs +11 -5
- package/dist/{core → internal}/package-managers/pnpm.mjs +6 -3
- package/dist/{core → internal}/package-managers/yarn.mjs +6 -3
- package/dist/{core/utils → internal}/package.mjs +3 -3
- package/dist/{core/utils/building → internal}/rebuild.mjs +5 -5
- package/dist/{core → internal}/resolve-config.mjs +22 -42
- package/dist/internal/runners/manual.mjs +22 -0
- package/dist/internal/runners/web-ext.mjs +79 -0
- package/dist/{core/utils/globals.mjs → internal/runtime-env-entries.mjs} +4 -4
- package/dist/internal/spinner.mjs +69 -0
- package/dist/{core/utils → internal}/syntax-errors.mjs +2 -2
- package/dist/{core/utils → internal}/theme-icons.mjs +3 -3
- package/dist/{core/utils → internal}/transform.mjs +1 -1
- package/dist/{core/utils → internal}/validation.mjs +1 -1
- package/dist/{core → internal}/wxt.mjs +24 -7
- package/dist/{core/utils/arrays.mjs → internal-utils/array-utils.mjs} +1 -1
- package/dist/{core/utils/cache.mjs → internal-utils/cache-utils.mjs} +3 -3
- package/dist/{core/utils/content-scripts.mjs → internal-utils/content-script-utils.mjs} +2 -2
- package/dist/{core/utils/content-security-policy.mjs → internal-utils/csp-utils.mjs} +1 -1
- package/dist/{core/utils/entrypoints.d.mts → internal-utils/entrypoint-utils.d.mts} +2 -2
- package/dist/{core/utils/entrypoints.mjs → internal-utils/entrypoint-utils.mjs} +2 -2
- package/dist/{core/utils/env.mjs → internal-utils/env-utils.mjs} +3 -3
- package/dist/internal-utils/eslint-utils.mjs +8 -0
- package/dist/{core/utils/fs.mjs → internal-utils/fs-utils.mjs} +6 -11
- package/dist/internal-utils/log/index.mjs +6 -0
- package/dist/{core/utils/log/printBuildSummary.mjs → internal-utils/log/print-build-summary.mjs} +3 -3
- package/dist/{core/utils/log/printFileList.mjs → internal-utils/log/print-file-list.mjs} +9 -8
- package/dist/{core/utils/log/printHeader.mjs → internal-utils/log/print-header.mjs} +2 -2
- package/dist/{core/utils/log/printTable.mjs → internal-utils/log/print-table.mjs} +1 -1
- package/dist/internal-utils/log/wxt-logger.mjs +32 -0
- package/dist/internal-utils/module-utils.mjs +32 -0
- package/dist/{core/utils/number.mjs → internal-utils/number-utils.mjs} +1 -1
- package/dist/{core/utils/paths.d.mts → internal-utils/path-utils.d.mts} +1 -1
- package/dist/{core/utils/paths.mjs → internal-utils/path-utils.mjs} +3 -3
- package/dist/{core/utils/strings.mjs → internal-utils/string-utils.mjs} +3 -3
- package/dist/{core/utils/time.mjs → internal-utils/time-utils.mjs} +1 -1
- package/dist/{core/utils/types.d.mts → internal-utils/type-utils.d.mts} +2 -1
- package/dist/{modules.d.mts → modules/index.d.mts} +10 -4
- package/dist/{modules.mjs → modules/index.mjs} +14 -5
- package/dist/prepare.d.mts +6 -0
- package/dist/prepare.mjs +11 -0
- package/dist/testing/wxt-vitest-plugin.mjs +7 -7
- package/dist/types.d.mts +97 -47
- package/dist/utils/content-script-context.d.mts +1 -1
- package/dist/utils/content-script-ui/iframe.d.mts +7 -0
- package/dist/utils/content-script-ui/iframe.mjs +2 -0
- package/dist/utils/content-script-ui/integrated.d.mts +7 -0
- package/dist/utils/content-script-ui/integrated.mjs +2 -0
- package/dist/utils/content-script-ui/shadow-root.d.mts +7 -0
- package/dist/utils/content-script-ui/shadow-root.mjs +2 -0
- package/dist/utils/content-script-ui/types.d.mts +23 -7
- package/dist/utils/internal/custom-events.d.mts +11 -1
- package/dist/utils/internal/custom-events.mjs +4 -0
- package/dist/version.mjs +1 -1
- package/dist/virtual/background-entrypoint.mjs +11 -0
- package/dist/{core/zip.d.mts → zip.d.mts} +2 -2
- package/dist/{core/zip.mjs → zip.mjs} +11 -13
- package/package.json +14 -15
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +0 -16
- package/dist/core/builders/vite/plugins/globals.mjs +0 -14
- package/dist/core/builders/vite/plugins/index.mjs +0 -17
- package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +0 -56
- package/dist/core/define-config.d.mts +0 -6
- package/dist/core/index.d.mts +0 -10
- package/dist/core/index.mjs +0 -12
- package/dist/core/package-managers/bun.mjs +0 -19
- package/dist/core/prepare.d.mts +0 -6
- package/dist/core/prepare.mjs +0 -12
- package/dist/core/runners/manual.mjs +0 -11
- package/dist/core/runners/safari.mjs +0 -14
- package/dist/core/runners/web-ext.mjs +0 -63
- package/dist/core/runners/wsl.mjs +0 -14
- package/dist/core/utils/building/index.mjs +0 -7
- package/dist/core/utils/environments/browser-environment.mjs +0 -18
- package/dist/core/utils/eslint.mjs +0 -11
- package/dist/core/utils/index.d.mts +0 -2
- package/dist/core/utils/index.mjs +0 -3
- package/dist/core/utils/log/index.mjs +0 -5
- /package/dist/{core/utils → internal}/environments/index.mjs +0 -0
- /package/dist/{core/utils → internal}/virtual-modules.mjs +0 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
Next-gen framework for developing web extensions.<br/>⚡<br/><q><i>It's like Nuxt, but for Web Extensions</i></q>
|
|
12
12
|
|
|
13
13
|
[Get Started](https://wxt.dev/guide/installation.html) •
|
|
14
|
-
[Configuration](https://wxt.dev/api/
|
|
14
|
+
[Configuration](https://wxt.dev/api/reference/wxt/interfaces/inlineconfig.html) •
|
|
15
15
|
[Examples](https://wxt.dev/examples.html) •
|
|
16
16
|
[Changelog](https://github.com/wxt-dev/wxt/blob/main/packages/wxt/CHANGELOG.md) •
|
|
17
17
|
[Discord](https://discord.gg/ZFsZqGery9)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BuildOutput, InlineConfig } from "
|
|
1
|
+
import { BuildOutput, InlineConfig } from "./types.mjs";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/build.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Bundles the extension for production. Returns a promise of the build result.
|
|
6
6
|
* Discovers the `wxt.config.ts` file in the root directory, and merges that
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { registerWxt } from "./wxt.mjs";
|
|
2
|
-
import { internalBuild } from "./
|
|
3
|
-
|
|
4
|
-
//#region src/core/build.ts
|
|
1
|
+
import { registerWxt } from "./internal/wxt.mjs";
|
|
2
|
+
import { internalBuild } from "./internal/internal-build.mjs";
|
|
3
|
+
//#region src/build.ts
|
|
5
4
|
/**
|
|
6
5
|
* Bundles the extension for production. Returns a promise of the build result.
|
|
7
6
|
* Discovers the `wxt.config.ts` file in the root directory, and merges that
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { registerWxt, wxt } from "./wxt.mjs";
|
|
1
|
+
import { registerWxt, wxt } from "./internal/wxt.mjs";
|
|
2
2
|
import { rm } from "node:fs/promises";
|
|
3
|
-
import { glob } from "tinyglobby";
|
|
4
3
|
import path from "node:path";
|
|
4
|
+
import { glob } from "tinyglobby";
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/clean.ts
|
|
7
7
|
/**
|
|
8
8
|
* Remove generated/temp files from the directory.
|
|
9
9
|
*
|
package/dist/cli/cli-utils.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { filterTruthy, toArray } from "../
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { printHeader } from "../
|
|
5
|
-
import "../
|
|
6
|
-
import { ValidationError } from "../
|
|
7
|
-
import
|
|
1
|
+
import { filterTruthy, toArray } from "../internal-utils/array-utils.mjs";
|
|
2
|
+
import { formatDuration } from "../internal-utils/time-utils.mjs";
|
|
3
|
+
import { registerWxt } from "../internal/wxt.mjs";
|
|
4
|
+
import { printHeader } from "../internal-utils/log/print-header.mjs";
|
|
5
|
+
import "../internal-utils/log/index.mjs";
|
|
6
|
+
import { ValidationError } from "../internal/validation.mjs";
|
|
7
|
+
import { x } from "tinyexec";
|
|
8
8
|
import consola, { LogLevels } from "consola";
|
|
9
9
|
//#region src/cli/cli-utils.ts
|
|
10
10
|
/**
|
|
@@ -47,7 +47,10 @@ function createAliasedCommand(base, name, alias, bin, docsUrl) {
|
|
|
47
47
|
const aliasedCommand = base.command(`${name} [...args]`, `Alias for ${alias} (${docsUrl})`).allowUnknownOptions().action(async () => {
|
|
48
48
|
try {
|
|
49
49
|
await registerWxt("build");
|
|
50
|
-
await
|
|
50
|
+
await x(bin, process.argv.slice(process.argv.indexOf(aliasedCommand.name) + 1), {
|
|
51
|
+
throwOnError: true,
|
|
52
|
+
nodeOptions: { stdio: "inherit" }
|
|
53
|
+
});
|
|
51
54
|
} catch {
|
|
52
55
|
process.exit(1);
|
|
53
56
|
}
|
package/dist/cli/commands.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { build } from "../
|
|
2
|
-
import { clean } from "../
|
|
3
|
-
import { createServer } from "../
|
|
4
|
-
import { initialize } from "../
|
|
5
|
-
import { prepare } from "../
|
|
6
|
-
import { zip } from "../
|
|
7
|
-
import "../
|
|
1
|
+
import { build } from "../build.mjs";
|
|
2
|
+
import { clean } from "../clean.mjs";
|
|
3
|
+
import { createServer } from "../create-server.mjs";
|
|
4
|
+
import { initialize } from "../initialize.mjs";
|
|
5
|
+
import { prepare } from "../prepare.mjs";
|
|
6
|
+
import { zip } from "../zip.mjs";
|
|
7
|
+
import "../index.mjs";
|
|
8
8
|
import { createAliasedCommand, getArrayFromFlags, wrapAction } from "./cli-utils.mjs";
|
|
9
9
|
import cac from "cac";
|
|
10
10
|
//#region src/cli/commands.ts
|
|
@@ -67,11 +67,12 @@ cli.command("clean [root]", "clean generated files and caches").alias("cleanup")
|
|
|
67
67
|
debug: flags.debug
|
|
68
68
|
});
|
|
69
69
|
}));
|
|
70
|
-
cli.command("init [directory]", "initialize a new project").option("-t, --template <template>", "template to use").option("--pm <packageManager>", "which package manager to use").action(wrapAction(async (directory, flags) => {
|
|
70
|
+
cli.command("init [directory]", "initialize a new project").option("-t, --template <template>", "template to use").option("--pm <packageManager>", "which package manager to use").option("--no-git", "skip initialize git repo").action(wrapAction(async (directory, flags) => {
|
|
71
71
|
await initialize({
|
|
72
72
|
directory,
|
|
73
73
|
template: flags.template,
|
|
74
|
-
packageManager: flags.pm
|
|
74
|
+
packageManager: flags.pm,
|
|
75
|
+
requireGit: flags.git
|
|
75
76
|
});
|
|
76
77
|
}, { disableFinishedLog: true }));
|
|
77
78
|
createAliasedCommand(cli, "submit", "publish-extension", "wxt-publish-extension", "https://www.npmjs.com/publish-browser-extension");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InlineConfig, WxtDevServer } from "
|
|
1
|
+
import { InlineConfig, WxtDevServer } from "./types.mjs";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/create-server.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Creates a dev server and pre-builds all the files that need to exist before
|
|
6
6
|
* loading the extension.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { unnormalizePath } from "./utils/
|
|
2
|
-
import { deinitWxtModules, initWxtModules, registerWxt, wxt } from "./wxt.mjs";
|
|
3
|
-
import { internalBuild } from "./
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createFileReloader, reloadContentScripts } from "./utils/create-file-reloader.mjs";
|
|
1
|
+
import { unnormalizePath } from "./internal-utils/path-utils.mjs";
|
|
2
|
+
import { deinitWxtModules, initWxtModules, registerWxt, wxt } from "./internal/wxt.mjs";
|
|
3
|
+
import { internalBuild } from "./internal/internal-build.mjs";
|
|
4
|
+
import { createKeyboardShortcuts } from "./internal/keyboard-shortcuts.mjs";
|
|
5
|
+
import { isBabelSyntaxError, logBabelSyntaxError } from "./internal/syntax-errors.mjs";
|
|
6
|
+
import { createFileReloader, reloadContentScripts } from "./internal/file-reloader.mjs";
|
|
8
7
|
import chokidar from "chokidar";
|
|
9
|
-
//#region src/
|
|
8
|
+
//#region src/create-server.ts
|
|
10
9
|
/**
|
|
11
10
|
* Creates a dev server and pre-builds all the files that need to exist before
|
|
12
11
|
* loading the extension.
|
|
@@ -74,7 +73,7 @@ async function createServerInternal() {
|
|
|
74
73
|
async stop() {
|
|
75
74
|
wasStopped = true;
|
|
76
75
|
keyboardShortcuts.stop();
|
|
77
|
-
await wxt.
|
|
76
|
+
await wxt.runner.closeBrowser?.();
|
|
78
77
|
await builderServer.close();
|
|
79
78
|
await wxt.hooks.callHook("server:closed", wxt, server);
|
|
80
79
|
deinitWxtModules();
|
|
@@ -97,12 +96,12 @@ async function createServerInternal() {
|
|
|
97
96
|
server.ws.send("wxt:reload-extension");
|
|
98
97
|
},
|
|
99
98
|
async restartBrowser() {
|
|
100
|
-
await wxt.
|
|
99
|
+
await wxt.runner.closeBrowser?.();
|
|
101
100
|
keyboardShortcuts.stop();
|
|
102
101
|
await wxt.reloadConfig();
|
|
103
|
-
await wxt.
|
|
102
|
+
await wxt.runner.openBrowser();
|
|
104
103
|
keyboardShortcuts.start();
|
|
105
|
-
keyboardShortcuts.printHelp({ canReopenBrowser: !wxt.config.webExt.config.disabled && !!wxt.
|
|
104
|
+
keyboardShortcuts.printHelp({ canReopenBrowser: !wxt.config.webExt.config.disabled && !!wxt.runner.canOpen?.() });
|
|
106
105
|
}
|
|
107
106
|
};
|
|
108
107
|
const keyboardShortcuts = createKeyboardShortcuts(server);
|
|
@@ -131,9 +130,9 @@ async function createServerInternal() {
|
|
|
131
130
|
} catch (err) {
|
|
132
131
|
wxt.config.logger.warn("Failed to register additional file paths:", err);
|
|
133
132
|
}
|
|
134
|
-
await wxt.
|
|
133
|
+
await wxt.runner.openBrowser();
|
|
135
134
|
keyboardShortcuts.start();
|
|
136
|
-
keyboardShortcuts.printHelp({ canReopenBrowser: !wxt.config.webExt.config.disabled && !!wxt.
|
|
135
|
+
keyboardShortcuts.printHelp({ canReopenBrowser: !wxt.config.webExt.config.disabled && !!wxt.runner.canOpen?.() });
|
|
137
136
|
};
|
|
138
137
|
builderServer.on?.("close", () => keyboardShortcuts.stop());
|
|
139
138
|
return server;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WebExtConfig } from "
|
|
1
|
+
import { WebExtConfig } from "./types.mjs";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/define-web-ext-config.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Configure how [`web-ext`](https://github.com/mozilla/web-ext) starts the
|
|
6
6
|
* browser during development.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointGroup, EntrypointInfo, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig } from "./types.mjs";
|
|
2
|
-
import { build } from "./
|
|
3
|
-
import { clean } from "./
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { initialize } from "./
|
|
8
|
-
import { prepare } from "./
|
|
9
|
-
import { zip } from "./core/zip.mjs";
|
|
10
|
-
import { normalizePath } from "./core/utils/paths.mjs";
|
|
11
|
-
import { getEntrypointBundlePath } from "./core/utils/entrypoints.mjs";
|
|
1
|
+
import { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointFinder, EntrypointGroup, EntrypointInfo, EslintConfigVersion, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtLogger, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtPluginEntry, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig } from "./types.mjs";
|
|
2
|
+
import { build } from "./build.mjs";
|
|
3
|
+
import { clean } from "./clean.mjs";
|
|
4
|
+
import { createServer } from "./create-server.mjs";
|
|
5
|
+
import { defineConfig } from "./define-config.mjs";
|
|
6
|
+
import { defineWebExtConfig } from "./define-web-ext-config.mjs";
|
|
7
|
+
import { initialize } from "./initialize.mjs";
|
|
8
|
+
import { prepare } from "./prepare.mjs";
|
|
12
9
|
import { version } from "./version.mjs";
|
|
13
|
-
|
|
10
|
+
import { zip } from "./zip.mjs";
|
|
11
|
+
import { getEntrypointBundlePath } from "./internal-utils/entrypoint-utils.mjs";
|
|
12
|
+
import { normalizePath } from "./internal-utils/path-utils.mjs";
|
|
13
|
+
export { BackgroundDefinition, BackgroundEntrypoint, BackgroundEntrypointOptions, BaseContentScriptEntrypointOptions, BaseEntrypoint, BaseEntrypointOptions, BaseScriptEntrypointOptions, BuildOutput, BuildStepOutput, ConfigEnv, ContentScriptDefinition, ContentScriptEntrypoint, CopiedPublicFile, Dependency, Entrypoint, EntrypointFinder, EntrypointGroup, EntrypointInfo, EslintConfigVersion, EslintGlobalsPropValue, Eslintrc, ExtensionRunner, FirefoxDataCollectionPermissions, FirefoxDataCollectionType, FsCache, GeneratedPublicFile, GenericEntrypoint, HookResult, InlineConfig, IsolatedWorldContentScriptDefinition, IsolatedWorldContentScriptEntrypointOptions, Logger, MainWorldContentScriptDefinition, MainWorldContentScriptEntrypointOptions, OnContentScriptStopped, OptionsEntrypoint, OptionsEntrypointOptions, OutputAsset, OutputChunk, OutputFile, PerBrowserMap, PerBrowserOption, PopupEntrypoint, PopupEntrypointOptions, PrepareTsconfigs, PublicPathEntry, ReloadContentScriptPayload, ResolvedBasePublicFile, ResolvedConfig, ResolvedEslintrc, ResolvedPerBrowserOptions, ResolvedPublicFile, ServerInfo, SidepanelEntrypoint, SidepanelEntrypointOptions, TargetBrowser, TargetManifestVersion, ThemeIcon, UnlistedScriptDefinition, UnlistedScriptEntrypoint, UserConfig, UserManifest, UserManifestFn, WebExtConfig, Wxt, WxtBuilder, WxtBuilderServer, WxtCommand, WxtDevServer, WxtDirEntry, WxtDirFileEntry, WxtDirTypeReferenceEntry, WxtHooks, WxtLogger, WxtModule, WxtModuleOptions, WxtModuleSetup, WxtModuleWithMetadata, WxtPackageManager, WxtPlugin, WxtPluginEntry, WxtResolvedUnimportOptions, WxtUnimportOptions, WxtViteConfig, build, clean, createServer, defineConfig, defineWebExtConfig, getEntrypointBundlePath, initialize, normalizePath, prepare, version, zip };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { normalizePath } from "./
|
|
2
|
-
import { getEntrypointBundlePath } from "./
|
|
1
|
+
import { normalizePath } from "./internal-utils/path-utils.mjs";
|
|
2
|
+
import { getEntrypointBundlePath } from "./internal-utils/entrypoint-utils.mjs";
|
|
3
3
|
import { version } from "./version.mjs";
|
|
4
|
-
import { build } from "./
|
|
5
|
-
import { clean } from "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { initialize } from "./
|
|
10
|
-
import { prepare } from "./
|
|
11
|
-
import { zip } from "./
|
|
12
|
-
import "./core/index.mjs";
|
|
4
|
+
import { build } from "./build.mjs";
|
|
5
|
+
import { clean } from "./clean.mjs";
|
|
6
|
+
import { createServer } from "./create-server.mjs";
|
|
7
|
+
import { defineConfig } from "./define-config.mjs";
|
|
8
|
+
import { defineWebExtConfig } from "./define-web-ext-config.mjs";
|
|
9
|
+
import { initialize } from "./initialize.mjs";
|
|
10
|
+
import { prepare } from "./prepare.mjs";
|
|
11
|
+
import { zip } from "./zip.mjs";
|
|
13
12
|
export { build, clean, createServer, defineConfig, defineWebExtConfig, getEntrypointBundlePath, initialize, normalizePath, prepare, version, zip };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/initialize.d.ts
|
|
2
2
|
declare function initialize(options: {
|
|
3
3
|
directory?: string;
|
|
4
4
|
template?: string;
|
|
5
5
|
packageManager?: string;
|
|
6
|
+
requireGit?: boolean;
|
|
6
7
|
}): Promise<void>;
|
|
7
8
|
//#endregion
|
|
8
9
|
export { initialize };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizePath } from "./internal-utils/path-utils.mjs";
|
|
2
|
+
import { pathExists } from "./internal-utils/fs-utils.mjs";
|
|
3
|
+
import { createSpinner } from "./internal/spinner.mjs";
|
|
2
4
|
import { readdir, rename } from "node:fs/promises";
|
|
3
5
|
import path from "node:path";
|
|
6
|
+
import { x } from "tinyexec";
|
|
4
7
|
import { consola as consola$1 } from "consola";
|
|
5
8
|
import { styleText } from "node:util";
|
|
6
|
-
import { question, select } from "@topcli/prompts";
|
|
9
|
+
import { confirm, question, select } from "@topcli/prompts";
|
|
7
10
|
import { downloadTemplate } from "giget";
|
|
8
|
-
//#region src/
|
|
11
|
+
//#region src/initialize.ts
|
|
9
12
|
async function initialize(options) {
|
|
10
13
|
consola$1.info("Initializing new project");
|
|
11
14
|
const templates = await listTemplates();
|
|
@@ -36,6 +39,7 @@ async function initialize(options) {
|
|
|
36
39
|
value: "yarn"
|
|
37
40
|
}
|
|
38
41
|
] });
|
|
42
|
+
const requireGitInitialized = options.requireGit ?? await confirm("Initialize a new git repository?", { initial: true });
|
|
39
43
|
if (await pathExists(directory)) {
|
|
40
44
|
if (!((await readdir(directory)).filter((dir) => dir !== ".git").length === 0)) {
|
|
41
45
|
consola$1.error(`The directory ${path.resolve(directory)} is not empty. Aborted.`);
|
|
@@ -44,7 +48,8 @@ async function initialize(options) {
|
|
|
44
48
|
}
|
|
45
49
|
await cloneProject({
|
|
46
50
|
directory,
|
|
47
|
-
template
|
|
51
|
+
template,
|
|
52
|
+
requireGitInitialized
|
|
48
53
|
});
|
|
49
54
|
const cdPath = path.relative(process.cwd(), path.resolve(directory));
|
|
50
55
|
console.log();
|
|
@@ -79,15 +84,25 @@ async function listTemplatesGithub() {
|
|
|
79
84
|
if (res.status !== 200) throw Error(`Request failed with status ${res.status} ${res.statusText}: ${await res.text()}`);
|
|
80
85
|
return await res.json();
|
|
81
86
|
}
|
|
82
|
-
async function cloneProject({ directory, template }) {
|
|
83
|
-
const { createSpinner } = await import("nanospinner");
|
|
87
|
+
async function cloneProject({ directory, template, requireGitInitialized }) {
|
|
84
88
|
const spinner = createSpinner("Downloading template").start();
|
|
85
89
|
try {
|
|
86
|
-
await downloadTemplate(`gh:${REPO}/${template.path}`, {
|
|
90
|
+
const response = await downloadTemplate(`gh:${REPO}/${template.path}`, {
|
|
87
91
|
dir: directory,
|
|
88
92
|
force: true
|
|
89
93
|
});
|
|
90
94
|
await rename(path.join(directory, "_gitignore"), path.join(directory, ".gitignore")).catch((err) => consola$1.warn("Failed to move _gitignore to .gitignore:", err));
|
|
95
|
+
if (requireGitInitialized) try {
|
|
96
|
+
await x("git", ["init"], {
|
|
97
|
+
throwOnError: true,
|
|
98
|
+
nodeOptions: {
|
|
99
|
+
cwd: normalizePath(response.dir),
|
|
100
|
+
shell: true
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error(error);
|
|
105
|
+
}
|
|
91
106
|
spinner.success();
|
|
92
107
|
} catch (err) {
|
|
93
108
|
spinner.error();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var dotenv_expand_default = ((e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports))(((e, t) => {
|
|
2
|
+
function n(e) {
|
|
3
|
+
return e.replace(/\\\$/g, `$`);
|
|
4
|
+
}
|
|
5
|
+
function r(e, t, n) {
|
|
6
|
+
let r = {
|
|
7
|
+
...n,
|
|
8
|
+
...t
|
|
9
|
+
}, i = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g, a = e, o, s = /* @__PURE__ */ new Set();
|
|
10
|
+
for (; (o = i.exec(a)) !== null;) {
|
|
11
|
+
s.add(a);
|
|
12
|
+
let [e, t, c] = o, l = t || c, u = l.match(/(:\+|\+|:-|-)/), d = u ? u[0] : null, f = l.split(d), p, m, h = f.shift();
|
|
13
|
+
if ([`:+`, `+`].includes(d) ? (p = r[h] ? f.join(d) : ``, m = null) : (p = f.join(d), m = r[h]), a = m ? s.has(m) ? a.replace(e, p) : a.replace(e, m) : a.replace(e, p), a === n[h]) break;
|
|
14
|
+
i.lastIndex = 0;
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
}
|
|
18
|
+
function i(e) {
|
|
19
|
+
let t = {}, i = process.env;
|
|
20
|
+
e && e.processEnv != null && (i = e.processEnv);
|
|
21
|
+
for (let a in e.parsed) {
|
|
22
|
+
let o = e.parsed[a];
|
|
23
|
+
o = i[a] && i[a] !== o ? i[a] : r(o, i, t), e.parsed[a] = n(o), t[a] = n(o);
|
|
24
|
+
}
|
|
25
|
+
for (let t in e.parsed) i[t] = e.parsed[t];
|
|
26
|
+
return e;
|
|
27
|
+
}
|
|
28
|
+
t.exports.expand = i;
|
|
29
|
+
}))();
|
|
30
|
+
//#endregion
|
|
31
|
+
export { dotenv_expand_default as default };
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import "node:fs/promises";
|
|
2
|
+
import "node:path";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { networkInterfaces } from "node:os";
|
|
5
|
+
//#region inline/get-port-please/index.mjs
|
|
6
|
+
const o = new Set([
|
|
7
|
+
1,
|
|
8
|
+
7,
|
|
9
|
+
9,
|
|
10
|
+
11,
|
|
11
|
+
13,
|
|
12
|
+
15,
|
|
13
|
+
17,
|
|
14
|
+
19,
|
|
15
|
+
20,
|
|
16
|
+
21,
|
|
17
|
+
22,
|
|
18
|
+
23,
|
|
19
|
+
25,
|
|
20
|
+
37,
|
|
21
|
+
42,
|
|
22
|
+
43,
|
|
23
|
+
53,
|
|
24
|
+
69,
|
|
25
|
+
77,
|
|
26
|
+
79,
|
|
27
|
+
87,
|
|
28
|
+
95,
|
|
29
|
+
101,
|
|
30
|
+
102,
|
|
31
|
+
103,
|
|
32
|
+
104,
|
|
33
|
+
109,
|
|
34
|
+
110,
|
|
35
|
+
111,
|
|
36
|
+
113,
|
|
37
|
+
115,
|
|
38
|
+
117,
|
|
39
|
+
119,
|
|
40
|
+
123,
|
|
41
|
+
135,
|
|
42
|
+
137,
|
|
43
|
+
139,
|
|
44
|
+
143,
|
|
45
|
+
161,
|
|
46
|
+
179,
|
|
47
|
+
389,
|
|
48
|
+
427,
|
|
49
|
+
465,
|
|
50
|
+
512,
|
|
51
|
+
513,
|
|
52
|
+
514,
|
|
53
|
+
515,
|
|
54
|
+
526,
|
|
55
|
+
530,
|
|
56
|
+
531,
|
|
57
|
+
532,
|
|
58
|
+
540,
|
|
59
|
+
548,
|
|
60
|
+
554,
|
|
61
|
+
556,
|
|
62
|
+
563,
|
|
63
|
+
587,
|
|
64
|
+
601,
|
|
65
|
+
636,
|
|
66
|
+
989,
|
|
67
|
+
990,
|
|
68
|
+
993,
|
|
69
|
+
995,
|
|
70
|
+
1719,
|
|
71
|
+
1720,
|
|
72
|
+
1723,
|
|
73
|
+
2049,
|
|
74
|
+
3659,
|
|
75
|
+
4045,
|
|
76
|
+
5060,
|
|
77
|
+
5061,
|
|
78
|
+
6e3,
|
|
79
|
+
6566,
|
|
80
|
+
6665,
|
|
81
|
+
6666,
|
|
82
|
+
6667,
|
|
83
|
+
6668,
|
|
84
|
+
6669,
|
|
85
|
+
6697,
|
|
86
|
+
10080
|
|
87
|
+
]);
|
|
88
|
+
function s(e) {
|
|
89
|
+
return o.has(e);
|
|
90
|
+
}
|
|
91
|
+
function c(e) {
|
|
92
|
+
return !s(e);
|
|
93
|
+
}
|
|
94
|
+
var l = class extends Error {
|
|
95
|
+
constructor(e, t) {
|
|
96
|
+
super(e, t), this.message = e;
|
|
97
|
+
}
|
|
98
|
+
name = `GetPortError`;
|
|
99
|
+
};
|
|
100
|
+
function u(e, t) {
|
|
101
|
+
e && console.log(`[get-port] ${t}`);
|
|
102
|
+
}
|
|
103
|
+
function d(e, t) {
|
|
104
|
+
if (t < e) return [];
|
|
105
|
+
let n = [];
|
|
106
|
+
for (let r = e; r <= t; r++) n.push(r);
|
|
107
|
+
return n;
|
|
108
|
+
}
|
|
109
|
+
function f(e, n) {
|
|
110
|
+
return new Promise((r) => {
|
|
111
|
+
let i = createServer();
|
|
112
|
+
i.unref(), i.on(`error`, () => {
|
|
113
|
+
r(!1);
|
|
114
|
+
}), i.listen({
|
|
115
|
+
port: e,
|
|
116
|
+
host: n
|
|
117
|
+
}, () => {
|
|
118
|
+
let { port: e } = i.address();
|
|
119
|
+
i.close(() => {
|
|
120
|
+
r(c(e) && e);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function p(e) {
|
|
126
|
+
let t = new Set(e);
|
|
127
|
+
for (let e of Object.values(networkInterfaces())) for (let n of e || []) n.address && !n.internal && !n.address.startsWith(`fe80::`) && !n.address.startsWith(`169.254`) && t.add(n.address);
|
|
128
|
+
return [...t];
|
|
129
|
+
}
|
|
130
|
+
async function m(e, t) {
|
|
131
|
+
for (let n of e) {
|
|
132
|
+
let e = await f(n, t);
|
|
133
|
+
if (e) return e;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function h(e) {
|
|
137
|
+
return e ? `on host ${JSON.stringify(e)}` : `on any host`;
|
|
138
|
+
}
|
|
139
|
+
const g = /^(?!-)[\d.:A-Za-z-]{1,63}(?<!-)$/;
|
|
140
|
+
function _(e, t, n) {
|
|
141
|
+
if (e && !g.test(e)) {
|
|
142
|
+
let r = t ? `0.0.0.0` : `127.0.0.1`;
|
|
143
|
+
return u(n, `Invalid hostname: ${JSON.stringify(e)}. Using ${JSON.stringify(r)} as fallback.`), r;
|
|
144
|
+
}
|
|
145
|
+
return e;
|
|
146
|
+
}
|
|
147
|
+
async function v(e = {}) {
|
|
148
|
+
(typeof e == `number` || typeof e == `string`) && (e = { port: Number.parseInt(e + ``) || 0 });
|
|
149
|
+
let t = Number(e.port ?? process.env.PORT), n = !!(e.port || e.ports?.length || e.portRange?.length), r = {
|
|
150
|
+
random: t === 0,
|
|
151
|
+
ports: [],
|
|
152
|
+
portRange: [],
|
|
153
|
+
alternativePortRange: n ? [] : [3e3, 3100],
|
|
154
|
+
verbose: !1,
|
|
155
|
+
...e,
|
|
156
|
+
port: t,
|
|
157
|
+
host: _(e.host ?? process.env.HOST, e.public, e.verbose)
|
|
158
|
+
};
|
|
159
|
+
if (r.random && !n) return y(r.host);
|
|
160
|
+
let i = [
|
|
161
|
+
r.port,
|
|
162
|
+
...r.ports,
|
|
163
|
+
...d(...r.portRange)
|
|
164
|
+
].filter((e) => e ? c(e) ? !0 : (u(r.verbose, `Ignoring unsafe port: ${e}`), !1) : !1);
|
|
165
|
+
i.length === 0 && i.push(3e3);
|
|
166
|
+
let a = await m(i, r.host);
|
|
167
|
+
if (!a && r.alternativePortRange.length > 0 && (a = await m(d(...r.alternativePortRange), r.host), i.length > 0)) {
|
|
168
|
+
let e = `Unable to find an available port (tried ${i.join(`-`)} ${h(r.host)}).`;
|
|
169
|
+
a && (e += ` Using alternative port ${a}.`), u(r.verbose, e);
|
|
170
|
+
}
|
|
171
|
+
if (!a && e.random !== !1 && (a = await y(r.host), a && u(r.verbose, `Using random port ${a}`)), !a) {
|
|
172
|
+
let e = [
|
|
173
|
+
r.port,
|
|
174
|
+
r.portRange.join(`-`),
|
|
175
|
+
r.alternativePortRange.join(`-`)
|
|
176
|
+
].filter(Boolean).join(`, `);
|
|
177
|
+
throw new l(`Unable to find an available port ${h(r.host)} (tried ${e})`);
|
|
178
|
+
}
|
|
179
|
+
return a;
|
|
180
|
+
}
|
|
181
|
+
async function y(e) {
|
|
182
|
+
let t = await x(0, e);
|
|
183
|
+
if (t === !1) throw new l(`Unable to find a random port ${h(e)}`);
|
|
184
|
+
return t;
|
|
185
|
+
}
|
|
186
|
+
async function x(e, t = process.env.HOST, n) {
|
|
187
|
+
if (t ||= p([void 0, `0.0.0.0`]), !Array.isArray(t)) return f(e, t);
|
|
188
|
+
for (let r of t) {
|
|
189
|
+
let t = await f(e, r);
|
|
190
|
+
if (t === !1) return e < 1024 && n && u(n, `Unable to listen to the privileged port ${e} ${h(r)}`), !1;
|
|
191
|
+
e === 0 && t !== 0 && (e = t);
|
|
192
|
+
}
|
|
193
|
+
return e;
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
export { v };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import n from "node:fs";
|
|
2
|
+
import t from "node:os";
|
|
3
|
+
import e from "node:process";
|
|
4
|
+
//#region inline/is-wsl/index.mjs
|
|
5
|
+
let r;
|
|
6
|
+
function i() {
|
|
7
|
+
try {
|
|
8
|
+
return n.statSync(`/.dockerenv`), !0;
|
|
9
|
+
} catch {
|
|
10
|
+
return !1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function a() {
|
|
14
|
+
try {
|
|
15
|
+
return n.readFileSync(`/proc/self/cgroup`, `utf8`).includes(`docker`);
|
|
16
|
+
} catch {
|
|
17
|
+
return !1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function o() {
|
|
21
|
+
return r === void 0 && (r = i() || a()), r;
|
|
22
|
+
}
|
|
23
|
+
let s;
|
|
24
|
+
const c = () => {
|
|
25
|
+
try {
|
|
26
|
+
return n.statSync(`/run/.containerenv`), !0;
|
|
27
|
+
} catch {
|
|
28
|
+
return !1;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function l() {
|
|
32
|
+
return s === void 0 && (s = c() || o()), s;
|
|
33
|
+
}
|
|
34
|
+
const u = () => {
|
|
35
|
+
if (e.platform !== `linux`) return !1;
|
|
36
|
+
if (t.release().toLowerCase().includes(`microsoft`)) return !l();
|
|
37
|
+
try {
|
|
38
|
+
if (n.readFileSync(`/proc/version`, `utf8`).toLowerCase().includes(`microsoft`)) return !l();
|
|
39
|
+
} catch {}
|
|
40
|
+
return n.existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`) || n.existsSync(`/run/WSL`) ? !l() : !1;
|
|
41
|
+
};
|
|
42
|
+
var d = e.env.__IS_WSL_TEST__ ? u : u();
|
|
43
|
+
//#endregion
|
|
44
|
+
export { d };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var normalize_path_default = ((e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports))(((e, t) => {
|
|
2
|
+
/*!
|
|
3
|
+
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
6
|
+
* Released under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
t.exports = function(e, t) {
|
|
9
|
+
if (typeof e != `string`) throw TypeError(`expected path to be a string`);
|
|
10
|
+
if (e === `\\` || e === `/`) return `/`;
|
|
11
|
+
var n = e.length;
|
|
12
|
+
if (n <= 1) return e;
|
|
13
|
+
var r = ``;
|
|
14
|
+
if (n > 4 && e[3] === `\\`) {
|
|
15
|
+
var i = e[2];
|
|
16
|
+
(i === `?` || i === `.`) && e.slice(0, 2) === `\\\\` && (e = e.slice(2), r = `//`);
|
|
17
|
+
}
|
|
18
|
+
var a = e.split(/[/\\]+/);
|
|
19
|
+
return t !== !1 && a[a.length - 1] === `` && a.pop(), r + a.join(`/`);
|
|
20
|
+
};
|
|
21
|
+
}))();
|
|
22
|
+
//#endregion
|
|
23
|
+
export { normalize_path_default as default };
|