@stryke/prisma-better-auth-generator 0.14.104 → 0.14.106

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.
Files changed (84) hide show
  1. package/README.md +3 -3
  2. package/dist/_virtual/_rolldown/runtime.cjs +31 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +8 -0
  4. package/dist/access-control.cjs +37 -0
  5. package/dist/access-control.mjs +37 -0
  6. package/dist/access-control.mjs.map +1 -0
  7. package/dist/config.cjs +14 -0
  8. package/dist/config.mjs +13 -0
  9. package/dist/config.mjs.map +1 -0
  10. package/dist/generator.cjs +2 -0
  11. package/dist/generator.d.cts +1 -0
  12. package/dist/generator.d.mts +1 -0
  13. package/dist/generator.mjs +4 -0
  14. package/dist/index.cjs +26 -0
  15. package/dist/index.d.cts +1 -0
  16. package/dist/index.d.mts +1 -0
  17. package/dist/index.mjs +28 -0
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/packages/env/src/ci-checks.cjs +13 -0
  20. package/dist/packages/env/src/ci-checks.mjs +13 -0
  21. package/dist/packages/env/src/ci-checks.mjs.map +1 -0
  22. package/dist/packages/env/src/environment-checks.cjs +96 -0
  23. package/dist/packages/env/src/environment-checks.mjs +88 -0
  24. package/dist/packages/env/src/environment-checks.mjs.map +1 -0
  25. package/dist/packages/env/src/get-env-paths.cjs +87 -0
  26. package/dist/packages/env/src/get-env-paths.mjs +85 -0
  27. package/dist/packages/env/src/get-env-paths.mjs.map +1 -0
  28. package/dist/packages/env/src/index.cjs +6 -0
  29. package/dist/packages/env/src/index.mjs +8 -0
  30. package/dist/packages/env/src/load-env.cjs +10 -0
  31. package/dist/packages/env/src/load-env.mjs +12 -0
  32. package/dist/packages/env/src/load-env.mjs.map +1 -0
  33. package/dist/packages/env/src/providers.cjs +111 -0
  34. package/dist/packages/env/src/providers.mjs +111 -0
  35. package/dist/packages/env/src/providers.mjs.map +1 -0
  36. package/dist/packages/env/src/runtime-checks.cjs +60 -0
  37. package/dist/packages/env/src/runtime-checks.mjs +53 -0
  38. package/dist/packages/env/src/runtime-checks.mjs.map +1 -0
  39. package/dist/packages/string-format/src/acronyms.cjs +414 -0
  40. package/dist/packages/string-format/src/acronyms.mjs +414 -0
  41. package/dist/packages/string-format/src/acronyms.mjs.map +1 -0
  42. package/dist/packages/string-format/src/articles.cjs +10 -0
  43. package/dist/packages/string-format/src/articles.mjs +10 -0
  44. package/dist/packages/string-format/src/articles.mjs.map +1 -0
  45. package/dist/packages/string-format/src/combine.cjs +15 -0
  46. package/dist/packages/string-format/src/combine.mjs +15 -0
  47. package/dist/packages/string-format/src/combine.mjs.map +1 -0
  48. package/dist/packages/string-format/src/conjunctions.cjs +32 -0
  49. package/dist/packages/string-format/src/conjunctions.mjs +32 -0
  50. package/dist/packages/string-format/src/conjunctions.mjs.map +1 -0
  51. package/dist/packages/string-format/src/decamelize.cjs +14 -0
  52. package/dist/packages/string-format/src/decamelize.mjs +14 -0
  53. package/dist/packages/string-format/src/decamelize.mjs.map +1 -0
  54. package/dist/packages/string-format/src/format-special-cases.cjs +33 -0
  55. package/dist/packages/string-format/src/format-special-cases.mjs +34 -0
  56. package/dist/packages/string-format/src/format-special-cases.mjs.map +1 -0
  57. package/dist/packages/string-format/src/lower-case-first.cjs +17 -0
  58. package/dist/packages/string-format/src/lower-case-first.mjs +17 -0
  59. package/dist/packages/string-format/src/lower-case-first.mjs.map +1 -0
  60. package/dist/packages/string-format/src/prepositions.cjs +68 -0
  61. package/dist/packages/string-format/src/prepositions.mjs +68 -0
  62. package/dist/packages/string-format/src/prepositions.mjs.map +1 -0
  63. package/dist/packages/string-format/src/special-cases.cjs +53 -0
  64. package/dist/packages/string-format/src/special-cases.mjs +53 -0
  65. package/dist/packages/string-format/src/special-cases.mjs.map +1 -0
  66. package/dist/packages/string-format/src/title-case.cjs +20 -0
  67. package/dist/packages/string-format/src/title-case.mjs +21 -0
  68. package/dist/packages/string-format/src/title-case.mjs.map +1 -0
  69. package/dist/packages/string-format/src/upper-case-first.cjs +17 -0
  70. package/dist/packages/string-format/src/upper-case-first.mjs +17 -0
  71. package/dist/packages/string-format/src/upper-case-first.mjs.map +1 -0
  72. package/dist/prisma-generator.cjs +47 -0
  73. package/dist/prisma-generator.mjs +47 -0
  74. package/dist/prisma-generator.mjs.map +1 -0
  75. package/dist/project.cjs +15 -0
  76. package/dist/project.mjs +15 -0
  77. package/dist/project.mjs.map +1 -0
  78. package/dist/utils/get-jiti.cjs +22 -0
  79. package/dist/utils/get-jiti.mjs +22 -0
  80. package/dist/utils/get-jiti.mjs.map +1 -0
  81. package/dist/utils/get-prisma-internals.cjs +13 -0
  82. package/dist/utils/get-prisma-internals.mjs +13 -0
  83. package/dist/utils/get-prisma-internals.mjs.map +1 -0
  84. package/package.json +26 -53
@@ -0,0 +1,85 @@
1
+ import { titleCase } from "../../string-format/src/title-case.mjs";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+
6
+ //#region ../env/src/get-env-paths.ts
7
+ const homedir = os.homedir();
8
+ const tmpdir = os.tmpdir();
9
+ const macos = (orgId) => {
10
+ const library = joinPaths(homedir, "Library");
11
+ return {
12
+ data: joinPaths(library, "Application Support", orgId),
13
+ config: joinPaths(library, "Preferences", orgId),
14
+ cache: joinPaths(library, "Caches", orgId),
15
+ log: joinPaths(library, "Logs", orgId),
16
+ temp: joinPaths(tmpdir, orgId)
17
+ };
18
+ };
19
+ const windows = (orgId) => {
20
+ const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
21
+ const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
22
+ const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
23
+ return {
24
+ data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
25
+ config: joinPaths(appData, windowsFormattedOrgId, "Config"),
26
+ cache: joinPaths(localAppData, "Cache", orgId),
27
+ log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
28
+ temp: joinPaths(tmpdir, orgId)
29
+ };
30
+ };
31
+ const linux = (orgId) => {
32
+ const username = path.basename(homedir);
33
+ return {
34
+ data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
35
+ config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
36
+ cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
37
+ log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
38
+ temp: process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR ? joinPaths(process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR, orgId) : joinPaths(tmpdir, username, orgId)
39
+ };
40
+ };
41
+ /**
42
+ * Get paths for storing things like data, config, logs, and cache in the current runtime environment.
43
+ *
44
+ * @remarks
45
+ * On macOS, directories are generally created in `~/Library/Application Support/<name>`.
46
+ * On Windows, directories are generally created in `%AppData%/<name>`.
47
+ * On Linux, directories are generally created in `~/.config/<name>` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).
48
+ *
49
+ * If the `STORM_DATA_DIR`, `STORM_CONFIG_DIR`, `STORM_CACHE_DIR`, `STORM_LOG_DIR`, or `STORM_TEMP_DIR` environment variables are set, they will be used instead of the default paths.
50
+ *
51
+ * @param options - Parameters used to determine the specific paths for the current project/runtime environment
52
+ * @returns An object containing the various paths for the runtime environment
53
+ */
54
+ function getEnvPaths(options = {}) {
55
+ let orgId = options.orgId || "storm-software";
56
+ if (!orgId) throw new Error("You need to provide an orgId to the `getEnvPaths` function");
57
+ if (options.suffix) orgId += `-${typeof options.suffix === "string" ? options.suffix : "nodejs"}`;
58
+ let result = {};
59
+ if (process.platform === "darwin") result = macos(orgId);
60
+ else if (process.platform === "win32") result = windows(orgId);
61
+ else result = linux(orgId);
62
+ if (process.env.STORM_DATA_DIR) result.data = process.env.STORM_DATA_DIR;
63
+ else if (process.env.STORM_CONFIG_DIR) result.config = process.env.STORM_CONFIG_DIR;
64
+ else if (process.env.STORM_CACHE_DIR) result.cache = process.env.STORM_CACHE_DIR;
65
+ else if (process.env.STORM_LOG_DIR) result.log = process.env.STORM_LOG_DIR;
66
+ else if (process.env.STORM_TEMP_DIR) result.temp = process.env.STORM_TEMP_DIR;
67
+ if (options.workspaceRoot) {
68
+ result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
69
+ result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
70
+ result.log ??= joinPaths(result.temp, "logs");
71
+ result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
72
+ }
73
+ return Object.keys(result).reduce((ret, key) => {
74
+ if (result[key]) {
75
+ const filePath = result[key];
76
+ ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
77
+ if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) ret[key] = joinPaths(ret[key], options.nestedDir);
78
+ }
79
+ return ret;
80
+ }, {});
81
+ }
82
+
83
+ //#endregion
84
+ export { getEnvPaths };
85
+ //# sourceMappingURL=get-env-paths.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-env-paths.mjs","names":[],"sources":["../../../../../env/src/get-env-paths.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n// Forked from https://www.npmjs.com/package/env-paths\n\nconst homedir = os.homedir();\nconst tmpdir = os.tmpdir();\n\n/**\n * Options for the `getEnvPaths` function.\n */\nexport interface GetEnvPathsOptions {\n /**\n * The name of the organization\n *\n * @defaultValue \"storm-software\"\n */\n orgId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * For example: `~/ ... /storm-software/Log/<appId>`\n */\n appId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * When a value is provided, it will use `~/ ... /storm-software/Log/<appId>/<nestedDir>`\n *\n * @remarks\n * If no child is provided, it will use `~/ ... /storm-software/Log/<appId>`\n */\n nestedDir?: string;\n\n /**\n * The suffix to append to the project name.\n *\n * @remarks\n * If `suffix` is `true`, the project name will be suffixed with `\"nodejs\"`.\n *\n * @defaultValue false\n */\n suffix?: string | boolean | null;\n\n /**\n * The root directory of the workspace that is used for determining the `cache` and `tmp` paths if they were not already set by other means.\n */\n workspaceRoot?: string;\n}\n\nexport interface EnvPaths {\n data: string;\n config: string;\n cache: string;\n log: string;\n temp: string;\n}\n\nconst macos = (orgId: string): EnvPaths => {\n const library = joinPaths(homedir, \"Library\");\n\n return {\n data: joinPaths(library, \"Application Support\", orgId),\n config: joinPaths(library, \"Preferences\", orgId),\n cache: joinPaths(library, \"Caches\", orgId),\n log: joinPaths(library, \"Logs\", orgId),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\nconst windows = (orgId: string): EnvPaths => {\n const appData =\n process.env.APPDATA || joinPaths(homedir, \"AppData\", \"Roaming\");\n const localAppData =\n process.env.LOCALAPPDATA || joinPaths(homedir, \"AppData\", \"Local\");\n\n const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\\s+/g, \"\");\n\n return {\n // Data/config/cache/log are invented by me as Windows isn't opinionated about this\n data: joinPaths(localAppData, windowsFormattedOrgId, \"Data\"),\n config: joinPaths(appData, windowsFormattedOrgId, \"Config\"),\n cache: joinPaths(localAppData, \"Cache\", orgId),\n log: joinPaths(localAppData, windowsFormattedOrgId, \"Log\"),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\n// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\nconst linux = (orgId: string): EnvPaths => {\n const username = path.basename(homedir);\n\n return {\n data: joinPaths(\n process.env.XDG_DATA_HOME || joinPaths(homedir, \".local\", \"share\"),\n orgId\n ),\n config: joinPaths(\n process.env.XDG_CONFIG_HOME || joinPaths(homedir, \".config\"),\n orgId\n ),\n cache: joinPaths(\n process.env.XDG_CACHE_HOME || joinPaths(homedir, \".cache\"),\n orgId\n ),\n // https://wiki.debian.org/XDGBaseDirectorySpecification#state\n log: joinPaths(\n process.env.XDG_STATE_HOME || joinPaths(homedir, \".local\", \"state\"),\n orgId\n ),\n // https://devenv.sh/files-and-variables/#devenv_root\n temp:\n process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR\n ? joinPaths(\n (process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR)!,\n orgId\n )\n : joinPaths(tmpdir, username, orgId)\n };\n};\n\n/**\n * Get paths for storing things like data, config, logs, and cache in the current runtime environment.\n *\n * @remarks\n * On macOS, directories are generally created in `~/Library/Application Support/<name>`.\n * On Windows, directories are generally created in `%AppData%/<name>`.\n * On Linux, directories are generally created in `~/.config/<name>` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).\n *\n * If the `STORM_DATA_DIR`, `STORM_CONFIG_DIR`, `STORM_CACHE_DIR`, `STORM_LOG_DIR`, or `STORM_TEMP_DIR` environment variables are set, they will be used instead of the default paths.\n *\n * @param options - Parameters used to determine the specific paths for the current project/runtime environment\n * @returns An object containing the various paths for the runtime environment\n */\nexport function getEnvPaths(options: GetEnvPathsOptions = {}): EnvPaths {\n let orgId = options.orgId || \"storm-software\";\n if (!orgId) {\n throw new Error(\n \"You need to provide an orgId to the `getEnvPaths` function\"\n );\n }\n\n if (options.suffix) {\n // Add suffix to prevent possible conflict with native apps\n orgId += `-${typeof options.suffix === \"string\" ? options.suffix : \"nodejs\"}`;\n }\n\n let result = {} as EnvPaths;\n\n if (process.platform === \"darwin\") {\n result = macos(orgId);\n } else if (process.platform === \"win32\") {\n result = windows(orgId);\n } else {\n result = linux(orgId);\n }\n\n if (process.env.STORM_DATA_DIR) {\n result.data = process.env.STORM_DATA_DIR;\n } else if (process.env.STORM_CONFIG_DIR) {\n result.config = process.env.STORM_CONFIG_DIR;\n } else if (process.env.STORM_CACHE_DIR) {\n result.cache = process.env.STORM_CACHE_DIR;\n } else if (process.env.STORM_LOG_DIR) {\n result.log = process.env.STORM_LOG_DIR;\n } else if (process.env.STORM_TEMP_DIR) {\n result.temp = process.env.STORM_TEMP_DIR;\n }\n\n if (options.workspaceRoot) {\n result.cache ??= joinPaths(\n options.workspaceRoot,\n \"node_modules\",\n \".cache\",\n orgId\n );\n result.temp ??= joinPaths(options.workspaceRoot, \"tmp\", orgId);\n result.log ??= joinPaths(result.temp, \"logs\");\n result.config ??= joinPaths(options.workspaceRoot, \".config\", orgId);\n }\n\n return Object.keys(result).reduce((ret, key) => {\n if (result[key as keyof EnvPaths]) {\n const filePath = result[key as keyof EnvPaths];\n\n ret[key as keyof EnvPaths] =\n options.appId &&\n options.appId !== options.orgId &&\n options.appId !== options.nestedDir\n ? joinPaths(filePath, options.appId)\n : filePath;\n\n if (\n options.nestedDir &&\n options.nestedDir !== options.orgId &&\n options.nestedDir !== options.appId\n ) {\n ret[key as keyof EnvPaths] = joinPaths(\n ret[key as keyof EnvPaths],\n options.nestedDir\n );\n }\n }\n\n return ret;\n }, {} as EnvPaths);\n}\n"],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ const require_ci_checks = require('./ci-checks.cjs');
2
+ const require_environment_checks = require('./environment-checks.cjs');
3
+ const require_get_env_paths = require('./get-env-paths.cjs');
4
+ require('./load-env.cjs');
5
+ const require_providers = require('./providers.cjs');
6
+ const require_runtime_checks = require('./runtime-checks.cjs');
@@ -0,0 +1,8 @@
1
+ import { isCI } from "./ci-checks.mjs";
2
+ import { hasTTY, isDebug, isDevelopmentMode, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeVersion, platform } from "./environment-checks.mjs";
3
+ import { getEnvPaths } from "./get-env-paths.mjs";
4
+ import "./load-env.mjs";
5
+ import { providerInfo } from "./providers.mjs";
6
+ import { isBun, isDeno, isEdgeLight, isFastly, isNetlify, isNode, isWorkerd, runtimeInfo } from "./runtime-checks.mjs";
7
+
8
+ export { };
@@ -0,0 +1,10 @@
1
+ const require_main$1 = require('../../../node_modules/.pnpm/@dotenvx_dotenvx@1.35.0/node_modules/@dotenvx/dotenvx/src/lib/main.cjs');
2
+ require('../../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.cjs');
3
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
4
+ require("@stryke/fs/exists");
5
+ require("@stryke/fs/read-file");
6
+
7
+ //#region ../env/src/load-env.ts
8
+ var import_main = require_main$1.default;
9
+
10
+ //#endregion
@@ -0,0 +1,12 @@
1
+ import { require_main } from "../../../node_modules/.pnpm/@dotenvx_dotenvx@1.35.0/node_modules/@dotenvx/dotenvx/src/lib/main.mjs";
2
+ import "../../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs";
3
+ import { joinPaths } from "@stryke/path/join-paths";
4
+ import "@stryke/fs/exists";
5
+ import "@stryke/fs/read-file";
6
+
7
+ //#region ../env/src/load-env.ts
8
+ var import_main = require_main();
9
+
10
+ //#endregion
11
+ export { };
12
+ //# sourceMappingURL=load-env.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-env.mjs","names":[],"sources":["../../../../../env/src/load-env.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { DotenvPopulateInput } from \"@dotenvx/dotenvx\";\nimport { parse } from \"@dotenvx/dotenvx\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readFile } from \"@stryke/fs/read-file\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport type { DotenvParseOutput } from \"./types\";\nimport { ENV_PREFIXES } from \"./types\";\n\nexport function getEnvFilesForMode(\n envDir: string,\n mode = \"production\"\n): string[] {\n return [\n /** default file */ \".env\",\n /** local file */ \".env.local\",\n /** mode file */ `.env.${mode}`,\n /** mode local file */ `.env.${mode}.local`,\n /** local mode file */ `.env.local.${mode}`\n ].map(file => joinPaths(envDir, file));\n}\n\n/**\n * Load environment variables from a .env file.\n *\n * @param envFile - The path to the .env file.\n * @returns The environment variables.\n */\nexport async function loadEnvFile(\n envFile: string,\n envDir: string | string[] = []\n): Promise<DotenvParseOutput> {\n const envDirs = Array.isArray(envDir) ? envDir : [envDir];\n\n return (\n await Promise.all(\n (envDir.length > 0\n ? envDirs.map(envDir => joinPaths(envDir, envFile))\n : [envFile]\n ).map(async envFilePath => {\n if (!existsSync(envFilePath)) {\n return undefined;\n }\n\n return readFile(envFilePath);\n })\n )\n ).reduce((ret, envFileContent) => {\n if (!envFileContent) {\n return ret;\n }\n\n const result = parse(envFileContent, {\n processEnv: { ...process.env } as DotenvPopulateInput,\n privateKey:\n process.env.DOTENV_PRIVATE_KEY || process.env.STORM_PRIVATE_KEY\n });\n\n return defu(result, ret);\n }, {});\n}\n\n/**\n * Load environment variables from .env files.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @param prefix - The prefix or prefixes to use for the environment variables.\n * @returns The environment variables.\n */\nexport async function loadEnv(\n envDir: string | string[],\n mode?: string,\n prefix?: string | string[]\n): Promise<DotenvParseOutput> {\n if (mode === \"local\") {\n throw new Error(\n '\"local\" cannot be used as a mode name because it conflicts with ' +\n \"the .local postfix for .env files.\"\n );\n }\n\n const prefixes = toArray(prefix).reduce((ret, pre) => {\n if (!pre) {\n return ret;\n }\n\n if (!ret.includes(pre.endsWith(\"_\") ? pre : `${pre}_`)) {\n ret.push(pre.endsWith(\"_\") ? pre : `${pre}_`);\n }\n if (!ret.includes(`${pre.endsWith(\"_\") ? pre : `${pre}_`}PUBLIC_`)) {\n ret.push(`${pre.endsWith(\"_\") ? pre : `${pre}_`}PUBLIC_`);\n }\n return ret;\n }, [] as string[]);\n const envDirs = Array.isArray(envDir) ? envDir : [envDir];\n\n const env: DotenvParseOutput = {};\n const envFiles = envDirs.reduce((ret, envFilePath) => {\n ret.push(\n ...getEnvFilesForMode(envFilePath, mode).filter(\n envFile => !ret.includes(envFile)\n )\n );\n\n return ret;\n }, [] as string[]);\n\n let envParsed = (\n await Promise.all(\n envFiles.map(async filePath => {\n return loadEnvFile(filePath);\n })\n )\n ).reduce((ret, result) => {\n return defu(result, ret);\n }, {});\n\n // test NODE_ENV override before expand as otherwise process.env.NODE_ENV would override this\n if (envParsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {\n process.env.VITE_USER_NODE_ENV = JSON.stringify(envParsed.NODE_ENV);\n }\n // support BROWSER and BROWSER_ARGS env variables\n if (envParsed.BROWSER && process.env.BROWSER === undefined) {\n process.env.BROWSER = JSON.stringify(envParsed.BROWSER);\n }\n if (envParsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {\n process.env.BROWSER_ARGS = JSON.stringify(envParsed.BROWSER_ARGS);\n }\n\n // let environment variables use each other. make a copy of `process.env` so that we do not mutate the global `process.env`.\n envParsed = defu({ ...process.env }, envParsed);\n if (prefixes.length === 0) {\n return envParsed;\n }\n\n // only keys that start with prefix are exposed to client\n for (const [key, value] of Object.entries(envParsed)) {\n if (prefixes.some(prefix => key.startsWith(prefix))) {\n env[key] = String(value);\n }\n }\n\n // check if there are actual env variables starting with VITE_*\n // these are typically provided inline and should be prioritized\n for (const key in process.env) {\n if (prefixes.some(prefix => key.startsWith(prefix))) {\n env[key] = process.env[key];\n }\n }\n\n return env;\n}\n\n/**\n * Load environment variables from .env files for a client-side environment.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @param prefix - The prefix or prefixes to use for the environment variables.\n * @returns The environment variables.\n */\nexport async function loadClientEnv(\n envDir: string | string[],\n mode?: string,\n prefix: string | string[] = ENV_PREFIXES\n): Promise<DotenvParseOutput> {\n return loadEnv(envDir, mode, prefix);\n}\n\n/**\n * Load environment variables from .env files for a server-side environment.\n *\n * @remarks\n * This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:\n * - `.env`\n * - `.env.local`\n * - `.env.production`\n * - `.env.production.local`\n *\n * @param envDir - The directory/directories to load the environment variables from.\n * @param mode - The mode to load the environment variables for.\n * @returns The environment variables.\n */\nexport async function loadServerEnv(\n envDir: string | string[],\n mode: string\n): Promise<DotenvParseOutput> {\n return loadEnv(envDir, mode);\n}\n"],"mappings":""}
@@ -0,0 +1,111 @@
1
+
2
+ //#region ../env/src/providers.ts
3
+ const providers = [
4
+ ["APPVEYOR"],
5
+ [
6
+ "AWS_AMPLIFY",
7
+ "AWS_APP_ID",
8
+ { ci: true }
9
+ ],
10
+ ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
11
+ ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
12
+ ["APPCIRCLE", "AC_APPCIRCLE"],
13
+ ["BAMBOO", "bamboo_planKey"],
14
+ ["BITBUCKET", "BITBUCKET_COMMIT"],
15
+ ["BITRISE", "BITRISE_IO"],
16
+ ["BUDDY", "BUDDY_WORKSPACE_ID"],
17
+ ["BUILDKITE"],
18
+ ["CIRCLE", "CIRCLECI"],
19
+ ["CIRRUS", "CIRRUS_CI"],
20
+ [
21
+ "CLOUDFLARE_PAGES",
22
+ "CF_PAGES",
23
+ { ci: true }
24
+ ],
25
+ ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
26
+ ["CODEFRESH", "CF_BUILD_ID"],
27
+ ["DRONE"],
28
+ ["DRONE", "DRONE_BUILD_EVENT"],
29
+ ["DSARI"],
30
+ ["GITHUB_ACTIONS"],
31
+ ["GITLAB", "GITLAB_CI"],
32
+ ["GITLAB", "CI_MERGE_REQUEST_ID"],
33
+ ["GOCD", "GO_PIPELINE_LABEL"],
34
+ ["LAYERCI"],
35
+ ["HUDSON", "HUDSON_URL"],
36
+ ["JENKINS", "JENKINS_URL"],
37
+ ["MAGNUM"],
38
+ ["NETLIFY"],
39
+ [
40
+ "NETLIFY",
41
+ "NETLIFY_LOCAL",
42
+ { ci: false }
43
+ ],
44
+ ["NEVERCODE"],
45
+ ["RENDER"],
46
+ ["SAIL", "SAILCI"],
47
+ ["SEMAPHORE"],
48
+ ["SCREWDRIVER"],
49
+ ["SHIPPABLE"],
50
+ ["SOLANO", "TDDIUM"],
51
+ ["STRIDER"],
52
+ ["TEAMCITY", "TEAMCITY_VERSION"],
53
+ ["TRAVIS"],
54
+ ["VERCEL", "NOW_BUILDER"],
55
+ [
56
+ "VERCEL",
57
+ "VERCEL",
58
+ { ci: false }
59
+ ],
60
+ [
61
+ "VERCEL",
62
+ "VERCEL_ENV",
63
+ { ci: false }
64
+ ],
65
+ ["APPCENTER", "APPCENTER_BUILD_ID"],
66
+ [
67
+ "CODESANDBOX",
68
+ "CODESANDBOX_SSE",
69
+ { ci: false }
70
+ ],
71
+ ["STACKBLITZ"],
72
+ ["STORMKIT"],
73
+ ["CLEAVR"],
74
+ ["ZEABUR"],
75
+ [
76
+ "CODESPHERE",
77
+ "CODESPHERE_APP_ID",
78
+ { ci: true }
79
+ ],
80
+ ["RAILWAY", "RAILWAY_PROJECT_ID"],
81
+ ["RAILWAY", "RAILWAY_SERVICE_ID"],
82
+ ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
83
+ [
84
+ "FIREBASE_APP_HOSTING",
85
+ "FIREBASE_APP_HOSTING",
86
+ { ci: true }
87
+ ]
88
+ ];
89
+ function detectProvider() {
90
+ if (process?.env) for (const provider of providers) {
91
+ const envName = provider[1] || provider[0];
92
+ if (process?.env[envName]) return {
93
+ name: provider[0].toLowerCase(),
94
+ ...provider[2]
95
+ };
96
+ }
97
+ if (process?.env?.SHELL === "/bin/jsh" && process?.versions?.webcontainer) return {
98
+ name: "stackblitz",
99
+ ci: false
100
+ };
101
+ return {
102
+ name: "",
103
+ ci: false
104
+ };
105
+ }
106
+ /** Current provider info */
107
+ const providerInfo = detectProvider();
108
+ const provider = providerInfo.name;
109
+
110
+ //#endregion
111
+ exports.providerInfo = providerInfo;
@@ -0,0 +1,111 @@
1
+ //#region ../env/src/providers.ts
2
+ const providers = [
3
+ ["APPVEYOR"],
4
+ [
5
+ "AWS_AMPLIFY",
6
+ "AWS_APP_ID",
7
+ { ci: true }
8
+ ],
9
+ ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
10
+ ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
11
+ ["APPCIRCLE", "AC_APPCIRCLE"],
12
+ ["BAMBOO", "bamboo_planKey"],
13
+ ["BITBUCKET", "BITBUCKET_COMMIT"],
14
+ ["BITRISE", "BITRISE_IO"],
15
+ ["BUDDY", "BUDDY_WORKSPACE_ID"],
16
+ ["BUILDKITE"],
17
+ ["CIRCLE", "CIRCLECI"],
18
+ ["CIRRUS", "CIRRUS_CI"],
19
+ [
20
+ "CLOUDFLARE_PAGES",
21
+ "CF_PAGES",
22
+ { ci: true }
23
+ ],
24
+ ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
25
+ ["CODEFRESH", "CF_BUILD_ID"],
26
+ ["DRONE"],
27
+ ["DRONE", "DRONE_BUILD_EVENT"],
28
+ ["DSARI"],
29
+ ["GITHUB_ACTIONS"],
30
+ ["GITLAB", "GITLAB_CI"],
31
+ ["GITLAB", "CI_MERGE_REQUEST_ID"],
32
+ ["GOCD", "GO_PIPELINE_LABEL"],
33
+ ["LAYERCI"],
34
+ ["HUDSON", "HUDSON_URL"],
35
+ ["JENKINS", "JENKINS_URL"],
36
+ ["MAGNUM"],
37
+ ["NETLIFY"],
38
+ [
39
+ "NETLIFY",
40
+ "NETLIFY_LOCAL",
41
+ { ci: false }
42
+ ],
43
+ ["NEVERCODE"],
44
+ ["RENDER"],
45
+ ["SAIL", "SAILCI"],
46
+ ["SEMAPHORE"],
47
+ ["SCREWDRIVER"],
48
+ ["SHIPPABLE"],
49
+ ["SOLANO", "TDDIUM"],
50
+ ["STRIDER"],
51
+ ["TEAMCITY", "TEAMCITY_VERSION"],
52
+ ["TRAVIS"],
53
+ ["VERCEL", "NOW_BUILDER"],
54
+ [
55
+ "VERCEL",
56
+ "VERCEL",
57
+ { ci: false }
58
+ ],
59
+ [
60
+ "VERCEL",
61
+ "VERCEL_ENV",
62
+ { ci: false }
63
+ ],
64
+ ["APPCENTER", "APPCENTER_BUILD_ID"],
65
+ [
66
+ "CODESANDBOX",
67
+ "CODESANDBOX_SSE",
68
+ { ci: false }
69
+ ],
70
+ ["STACKBLITZ"],
71
+ ["STORMKIT"],
72
+ ["CLEAVR"],
73
+ ["ZEABUR"],
74
+ [
75
+ "CODESPHERE",
76
+ "CODESPHERE_APP_ID",
77
+ { ci: true }
78
+ ],
79
+ ["RAILWAY", "RAILWAY_PROJECT_ID"],
80
+ ["RAILWAY", "RAILWAY_SERVICE_ID"],
81
+ ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
82
+ [
83
+ "FIREBASE_APP_HOSTING",
84
+ "FIREBASE_APP_HOSTING",
85
+ { ci: true }
86
+ ]
87
+ ];
88
+ function detectProvider() {
89
+ if (process?.env) for (const provider of providers) {
90
+ const envName = provider[1] || provider[0];
91
+ if (process?.env[envName]) return {
92
+ name: provider[0].toLowerCase(),
93
+ ...provider[2]
94
+ };
95
+ }
96
+ if (process?.env?.SHELL === "/bin/jsh" && process?.versions?.webcontainer) return {
97
+ name: "stackblitz",
98
+ ci: false
99
+ };
100
+ return {
101
+ name: "",
102
+ ci: false
103
+ };
104
+ }
105
+ /** Current provider info */
106
+ const providerInfo = detectProvider();
107
+ const provider = providerInfo.name;
108
+
109
+ //#endregion
110
+ export { providerInfo };
111
+ //# sourceMappingURL=providers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.mjs","names":[],"sources":["../../../../../env/src/providers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n// Reference: https://github.com/watson/ci-info/blob/v3.2.0/vendors.json\n\nexport type ProviderName =\n | \"\"\n | \"appveyor\"\n | \"aws_amplify\"\n | \"azure_pipelines\"\n | \"azure_static\"\n | \"appcircle\"\n | \"bamboo\"\n | \"bitbucket\"\n | \"bitrise\"\n | \"buddy\"\n | \"buildkite\"\n | \"circle\"\n | \"cirrus\"\n | \"cloudflare_pages\"\n | \"codebuild\"\n | \"codefresh\"\n | \"drone\"\n | \"drone\"\n | \"dsari\"\n | \"github_actions\"\n | \"gitlab\"\n | \"gocd\"\n | \"layerci\"\n | \"hudson\"\n | \"jenkins\"\n | \"magnum\"\n | \"netlify\"\n | \"nevercode\"\n | \"render\"\n | \"sail\"\n | \"semaphore\"\n | \"screwdriver\"\n | \"shippable\"\n | \"solano\"\n | \"strider\"\n | \"teamcity\"\n | \"travis\"\n | \"vercel\"\n | \"appcenter\"\n | \"codesandbox\"\n | \"stackblitz\"\n | \"stormkit\"\n | \"cleavr\"\n | \"zeabur\"\n | \"codesphere\"\n | \"railway\"\n | \"deno-deploy\"\n | \"firebase_app_hosting\";\n\ntype InternalProvider = [\n providerName: Uppercase<ProviderName>,\n envName?: string,\n meta?: Record<string, any>\n];\n\nconst providers: InternalProvider[] = [\n [\"APPVEYOR\"],\n [\"AWS_AMPLIFY\", \"AWS_APP_ID\", { ci: true }],\n [\"AZURE_PIPELINES\", \"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI\"],\n [\"AZURE_STATIC\", \"INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN\"],\n [\"APPCIRCLE\", \"AC_APPCIRCLE\"],\n [\"BAMBOO\", \"bamboo_planKey\"],\n [\"BITBUCKET\", \"BITBUCKET_COMMIT\"],\n [\"BITRISE\", \"BITRISE_IO\"],\n [\"BUDDY\", \"BUDDY_WORKSPACE_ID\"],\n [\"BUILDKITE\"],\n [\"CIRCLE\", \"CIRCLECI\"],\n [\"CIRRUS\", \"CIRRUS_CI\"],\n [\"CLOUDFLARE_PAGES\", \"CF_PAGES\", { ci: true }],\n [\"CODEBUILD\", \"CODEBUILD_BUILD_ARN\"],\n [\"CODEFRESH\", \"CF_BUILD_ID\"],\n [\"DRONE\"],\n [\"DRONE\", \"DRONE_BUILD_EVENT\"],\n [\"DSARI\"],\n [\"GITHUB_ACTIONS\"],\n [\"GITLAB\", \"GITLAB_CI\"],\n [\"GITLAB\", \"CI_MERGE_REQUEST_ID\"],\n [\"GOCD\", \"GO_PIPELINE_LABEL\"],\n [\"LAYERCI\"],\n [\"HUDSON\", \"HUDSON_URL\"],\n [\"JENKINS\", \"JENKINS_URL\"],\n [\"MAGNUM\"],\n [\"NETLIFY\"],\n [\"NETLIFY\", \"NETLIFY_LOCAL\", { ci: false }],\n [\"NEVERCODE\"],\n [\"RENDER\"],\n [\"SAIL\", \"SAILCI\"],\n [\"SEMAPHORE\"],\n [\"SCREWDRIVER\"],\n [\"SHIPPABLE\"],\n [\"SOLANO\", \"TDDIUM\"],\n [\"STRIDER\"],\n [\"TEAMCITY\", \"TEAMCITY_VERSION\"],\n [\"TRAVIS\"],\n [\"VERCEL\", \"NOW_BUILDER\"],\n [\"VERCEL\", \"VERCEL\", { ci: false }],\n [\"VERCEL\", \"VERCEL_ENV\", { ci: false }],\n [\"APPCENTER\", \"APPCENTER_BUILD_ID\"],\n [\"CODESANDBOX\", \"CODESANDBOX_SSE\", { ci: false }],\n [\"STACKBLITZ\"],\n [\"STORMKIT\"],\n [\"CLEAVR\"],\n [\"ZEABUR\"],\n [\"CODESPHERE\", \"CODESPHERE_APP_ID\", { ci: true }],\n [\"RAILWAY\", \"RAILWAY_PROJECT_ID\"],\n [\"RAILWAY\", \"RAILWAY_SERVICE_ID\"],\n [\"DENO-DEPLOY\", \"DENO_DEPLOYMENT_ID\"],\n [\"FIREBASE_APP_HOSTING\", \"FIREBASE_APP_HOSTING\", { ci: true }]\n];\n\nexport interface ProviderInfo {\n name: ProviderName;\n ci?: boolean;\n [meta: string]: any;\n}\n\nfunction detectProvider(): ProviderInfo {\n // Based on env\n if (process?.env) {\n for (const provider of providers) {\n const envName = provider[1] || provider[0];\n if (process?.env[envName]) {\n return {\n name: provider[0].toLowerCase(),\n ...(provider[2] as any)\n };\n }\n }\n }\n\n // Stackblitz / Webcontainer\n if (process?.env?.SHELL === \"/bin/jsh\" && process?.versions?.webcontainer) {\n return {\n name: \"stackblitz\",\n ci: false\n };\n }\n\n return {\n name: \"\",\n ci: false\n };\n}\n\n/** Current provider info */\nexport const providerInfo = detectProvider();\nexport const provider: ProviderName = providerInfo.name;\n"],"mappings":";AA4EA,MAAM,YAAgC;CACpC,CAAC,WAAW;CACZ;EAAC;EAAe;EAAc,EAAE,IAAI,MAAM;EAAC;CAC3C,CAAC,mBAAmB,qCAAqC;CACzD,CAAC,gBAAgB,wCAAwC;CACzD,CAAC,aAAa,eAAe;CAC7B,CAAC,UAAU,iBAAiB;CAC5B,CAAC,aAAa,mBAAmB;CACjC,CAAC,WAAW,aAAa;CACzB,CAAC,SAAS,qBAAqB;CAC/B,CAAC,YAAY;CACb,CAAC,UAAU,WAAW;CACtB,CAAC,UAAU,YAAY;CACvB;EAAC;EAAoB;EAAY,EAAE,IAAI,MAAM;EAAC;CAC9C,CAAC,aAAa,sBAAsB;CACpC,CAAC,aAAa,cAAc;CAC5B,CAAC,QAAQ;CACT,CAAC,SAAS,oBAAoB;CAC9B,CAAC,QAAQ;CACT,CAAC,iBAAiB;CAClB,CAAC,UAAU,YAAY;CACvB,CAAC,UAAU,sBAAsB;CACjC,CAAC,QAAQ,oBAAoB;CAC7B,CAAC,UAAU;CACX,CAAC,UAAU,aAAa;CACxB,CAAC,WAAW,cAAc;CAC1B,CAAC,SAAS;CACV,CAAC,UAAU;CACX;EAAC;EAAW;EAAiB,EAAE,IAAI,OAAO;EAAC;CAC3C,CAAC,YAAY;CACb,CAAC,SAAS;CACV,CAAC,QAAQ,SAAS;CAClB,CAAC,YAAY;CACb,CAAC,cAAc;CACf,CAAC,YAAY;CACb,CAAC,UAAU,SAAS;CACpB,CAAC,UAAU;CACX,CAAC,YAAY,mBAAmB;CAChC,CAAC,SAAS;CACV,CAAC,UAAU,cAAc;CACzB;EAAC;EAAU;EAAU,EAAE,IAAI,OAAO;EAAC;CACnC;EAAC;EAAU;EAAc,EAAE,IAAI,OAAO;EAAC;CACvC,CAAC,aAAa,qBAAqB;CACnC;EAAC;EAAe;EAAmB,EAAE,IAAI,OAAO;EAAC;CACjD,CAAC,aAAa;CACd,CAAC,WAAW;CACZ,CAAC,SAAS;CACV,CAAC,SAAS;CACV;EAAC;EAAc;EAAqB,EAAE,IAAI,MAAM;EAAC;CACjD,CAAC,WAAW,qBAAqB;CACjC,CAAC,WAAW,qBAAqB;CACjC,CAAC,eAAe,qBAAqB;CACrC;EAAC;EAAwB;EAAwB,EAAE,IAAI,MAAM;EAAC;CAC/D;AAQD,SAAS,iBAA+B;AAEtC,KAAI,SAAS,IACX,MAAK,MAAM,YAAY,WAAW;EAChC,MAAM,UAAU,SAAS,MAAM,SAAS;AACxC,MAAI,SAAS,IAAI,SACf,QAAO;GACL,MAAM,SAAS,GAAG,aAAa;GAC/B,GAAI,SAAS;GACd;;AAMP,KAAI,SAAS,KAAK,UAAU,cAAc,SAAS,UAAU,aAC3D,QAAO;EACL,MAAM;EACN,IAAI;EACL;AAGH,QAAO;EACL,MAAM;EACN,IAAI;EACL;;;AAIH,MAAa,eAAe,gBAAgB;AAC5C,MAAa,WAAyB,aAAa"}
@@ -0,0 +1,60 @@
1
+
2
+ //#region ../env/src/runtime-checks.ts
3
+ /**
4
+ * Indicates if running in Node.js or a Node.js compatible runtime.
5
+ *
6
+ * **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.
7
+ *
8
+ * Use `runtime === "node"` if you need strict check for Node.js runtime.
9
+ */
10
+ const isNode = process?.release?.name === "node";
11
+ /**
12
+ * Indicates if running in Bun runtime.
13
+ */
14
+ const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);
15
+ /**
16
+ * Indicates if running in Deno runtime.
17
+ */
18
+ const isDeno = Boolean(Deno);
19
+ /**
20
+ * Indicates if running in Fastly runtime.
21
+ */
22
+ const isFastly = Boolean(fastly);
23
+ /**
24
+ * Indicates if running in Netlify runtime.
25
+ */
26
+ const isNetlify = Boolean(Netlify);
27
+ /**
28
+ *
29
+ * Indicates if running in EdgeLight (Vercel Edge) runtime.
30
+ */
31
+ const isEdgeLight = Boolean(EdgeRuntime);
32
+ /**
33
+ * Indicates if running in Cloudflare Workers runtime.
34
+ */
35
+ const isWorkerd = navigator?.userAgent === "Cloudflare-Workers";
36
+ const runtimeChecks = [
37
+ [isNetlify, "netlify"],
38
+ [isEdgeLight, "edge-light"],
39
+ [isWorkerd, "workerd"],
40
+ [isFastly, "fastly"],
41
+ [isDeno, "deno"],
42
+ [isBun, "bun"],
43
+ [isNode, "node"]
44
+ ];
45
+ function detectRuntime() {
46
+ const detectedRuntime = runtimeChecks.find((check) => check[0]);
47
+ if (detectedRuntime) return { name: detectedRuntime[1] };
48
+ }
49
+ const runtimeInfo = detectRuntime();
50
+ const runtime = runtimeInfo?.name || "";
51
+
52
+ //#endregion
53
+ exports.isBun = isBun;
54
+ exports.isDeno = isDeno;
55
+ exports.isEdgeLight = isEdgeLight;
56
+ exports.isFastly = isFastly;
57
+ exports.isNetlify = isNetlify;
58
+ exports.isNode = isNode;
59
+ exports.isWorkerd = isWorkerd;
60
+ exports.runtimeInfo = runtimeInfo;
@@ -0,0 +1,53 @@
1
+ //#region ../env/src/runtime-checks.ts
2
+ /**
3
+ * Indicates if running in Node.js or a Node.js compatible runtime.
4
+ *
5
+ * **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.
6
+ *
7
+ * Use `runtime === "node"` if you need strict check for Node.js runtime.
8
+ */
9
+ const isNode = process?.release?.name === "node";
10
+ /**
11
+ * Indicates if running in Bun runtime.
12
+ */
13
+ const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);
14
+ /**
15
+ * Indicates if running in Deno runtime.
16
+ */
17
+ const isDeno = Boolean(Deno);
18
+ /**
19
+ * Indicates if running in Fastly runtime.
20
+ */
21
+ const isFastly = Boolean(fastly);
22
+ /**
23
+ * Indicates if running in Netlify runtime.
24
+ */
25
+ const isNetlify = Boolean(Netlify);
26
+ /**
27
+ *
28
+ * Indicates if running in EdgeLight (Vercel Edge) runtime.
29
+ */
30
+ const isEdgeLight = Boolean(EdgeRuntime);
31
+ /**
32
+ * Indicates if running in Cloudflare Workers runtime.
33
+ */
34
+ const isWorkerd = navigator?.userAgent === "Cloudflare-Workers";
35
+ const runtimeChecks = [
36
+ [isNetlify, "netlify"],
37
+ [isEdgeLight, "edge-light"],
38
+ [isWorkerd, "workerd"],
39
+ [isFastly, "fastly"],
40
+ [isDeno, "deno"],
41
+ [isBun, "bun"],
42
+ [isNode, "node"]
43
+ ];
44
+ function detectRuntime() {
45
+ const detectedRuntime = runtimeChecks.find((check) => check[0]);
46
+ if (detectedRuntime) return { name: detectedRuntime[1] };
47
+ }
48
+ const runtimeInfo = detectRuntime();
49
+ const runtime = runtimeInfo?.name || "";
50
+
51
+ //#endregion
52
+ export { isBun, isDeno, isEdgeLight, isFastly, isNetlify, isNode, isWorkerd, runtimeInfo };
53
+ //# sourceMappingURL=runtime-checks.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-checks.mjs","names":[],"sources":["../../../../../env/src/runtime-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n// https://runtime-keys.proposal.wintercg.org/\nexport type RuntimeName =\n | \"workerd\"\n | \"deno\"\n | \"netlify\"\n | \"node\"\n | \"bun\"\n | \"edge-light\"\n | \"fastly\"\n | \"\";\n\nexport interface RuntimeInfo {\n name: RuntimeName;\n}\n\n/**\n * Indicates if running in Node.js or a Node.js compatible runtime.\n *\n * **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.\n *\n * Use `runtime === \"node\"` if you need strict check for Node.js runtime.\n */\nexport const isNode = process?.release?.name === \"node\";\n\n/**\n * Indicates if running in Bun runtime.\n */\nexport const isBun = Boolean(Bun) || Boolean(process?.versions?.bun);\n\n/**\n * Indicates if running in Deno runtime.\n */\nexport const isDeno = Boolean(Deno);\n\n/**\n * Indicates if running in Fastly runtime.\n */\nexport const isFastly = Boolean(fastly);\n\n/**\n * Indicates if running in Netlify runtime.\n */\nexport const isNetlify = Boolean(Netlify);\n\n/**\n *\n * Indicates if running in EdgeLight (Vercel Edge) runtime.\n */\nexport const isEdgeLight = Boolean(EdgeRuntime);\n// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\n/**\n * Indicates if running in Cloudflare Workers runtime.\n */\nexport const isWorkerd = navigator?.userAgent === \"Cloudflare-Workers\";\n\n/**\n * Indicates if the code is running on the server-side\n */\nexport const isRuntimeServer =\n isNode ||\n isBun ||\n isDeno ||\n isFastly ||\n isNetlify ||\n isEdgeLight ||\n isWorkerd;\n\n/**\n * Indicates if the code is running in the browser (and not on the server).\n */\nexport const isRuntimeClient = !isRuntimeServer;\n\nconst runtimeChecks: [boolean, RuntimeName][] = [\n [isNetlify, \"netlify\"],\n [isEdgeLight, \"edge-light\"],\n [isWorkerd, \"workerd\"],\n [isFastly, \"fastly\"],\n [isDeno, \"deno\"],\n [isBun, \"bun\"],\n [isNode, \"node\"]\n];\n\nfunction detectRuntime(): RuntimeInfo | undefined {\n const detectedRuntime = runtimeChecks.find(check => check[0]);\n\n if (detectedRuntime) {\n const name = detectedRuntime[1];\n\n return { name };\n }\n\n return undefined;\n}\n\nexport const runtimeInfo = detectRuntime();\n\nexport const runtime: RuntimeName = runtimeInfo?.name || \"\";\n"],"mappings":";;;;;;;;AAwCA,MAAa,SAAS,SAAS,SAAS,SAAS;;;;AAKjD,MAAa,QAAQ,QAAQ,IAAI,IAAI,QAAQ,SAAS,UAAU,IAAI;;;;AAKpE,MAAa,SAAS,QAAQ,KAAK;;;;AAKnC,MAAa,WAAW,QAAQ,OAAO;;;;AAKvC,MAAa,YAAY,QAAQ,QAAQ;;;;;AAMzC,MAAa,cAAc,QAAQ,YAAY;;;;AAM/C,MAAa,YAAY,WAAW,cAAc;AAmBlD,MAAM,gBAA0C;CAC9C,CAAC,WAAW,UAAU;CACtB,CAAC,aAAa,aAAa;CAC3B,CAAC,WAAW,UAAU;CACtB,CAAC,UAAU,SAAS;CACpB,CAAC,QAAQ,OAAO;CAChB,CAAC,OAAO,MAAM;CACd,CAAC,QAAQ,OAAO;CACjB;AAED,SAAS,gBAAyC;CAChD,MAAM,kBAAkB,cAAc,MAAK,UAAS,MAAM,GAAG;AAE7D,KAAI,gBAGF,QAAO,EAAE,MAFI,gBAAgB,IAEd;;AAMnB,MAAa,cAAc,eAAe;AAE1C,MAAa,UAAuB,aAAa,QAAQ"}