@stryke/trpc-next 0.5.88 → 0.5.90
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/CHANGELOG.md +24 -0
- package/dist/action-handler.d.cts +1 -1
- package/dist/action-handler.d.mts +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/shared.cjs +2 -2
- package/dist/shared.d.cts +1 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.mjs +1 -1
- package/dist/tanstack-query/client.cjs +2 -3
- package/dist/tanstack-query/client.d.cts +1 -1
- package/dist/tanstack-query/client.d.cts.map +1 -1
- package/dist/tanstack-query/client.d.mts +1 -1
- package/dist/tanstack-query/client.d.mts.map +1 -1
- package/dist/tanstack-query/client.mjs +1 -2
- package/dist/tanstack-query/client.mjs.map +1 -1
- package/dist/tanstack-query/server.d.cts +1 -1
- package/dist/tanstack-query/server.d.mts +1 -1
- package/package.json +10 -61
- package/dist/env/src/ci-checks.cjs +0 -13
- package/dist/env/src/ci-checks.mjs +0 -13
- package/dist/env/src/ci-checks.mjs.map +0 -1
- package/dist/env/src/environment-checks.cjs +0 -97
- package/dist/env/src/environment-checks.mjs +0 -88
- package/dist/env/src/environment-checks.mjs.map +0 -1
- package/dist/env/src/get-env-paths.cjs +0 -10
- package/dist/env/src/get-env-paths.mjs +0 -10
- package/dist/env/src/get-env-paths.mjs.map +0 -1
- package/dist/env/src/index.cjs +0 -6
- package/dist/env/src/index.mjs +0 -6
- package/dist/env/src/load-env.cjs +0 -4
- package/dist/env/src/load-env.mjs +0 -4
- package/dist/env/src/providers.cjs +0 -111
- package/dist/env/src/providers.mjs +0 -111
- package/dist/env/src/providers.mjs.map +0 -1
- package/dist/env/src/runtime-checks.cjs +0 -60
- package/dist/env/src/runtime-checks.mjs +0 -53
- package/dist/env/src/runtime-checks.mjs.map +0 -1
- package/dist/fs/src/exists.mjs +0 -2
- package/dist/fs/src/read-file.mjs +0 -2
- package/dist/path/src/is-type.cjs +0 -28
- package/dist/path/src/is-type.mjs +0 -29
- package/dist/path/src/is-type.mjs.map +0 -1
- package/dist/path/src/join-paths.cjs +0 -122
- package/dist/path/src/join-paths.mjs +0 -123
- package/dist/path/src/join-paths.mjs.map +0 -1
- package/dist/path/src/regex.cjs +0 -12
- package/dist/path/src/regex.mjs +0 -9
- package/dist/path/src/regex.mjs.map +0 -1
- package/dist/path/src/slash.cjs +0 -15
- package/dist/path/src/slash.mjs +0 -15
- package/dist/path/src/slash.mjs.map +0 -1
- package/dist/string-format/src/acronyms.cjs +0 -413
- package/dist/string-format/src/acronyms.mjs +0 -413
- package/dist/string-format/src/acronyms.mjs.map +0 -1
- package/dist/string-format/src/format-special-cases.cjs +0 -1
- package/dist/string-format/src/format-special-cases.mjs +0 -1
- package/dist/string-format/src/title-case.cjs +0 -2
- package/dist/string-format/src/title-case.mjs +0 -2
- package/dist/types/src/base.d.cts +0 -14
- package/dist/types/src/base.d.cts.map +0 -1
- package/dist/types/src/base.d.mts +0 -14
- package/dist/types/src/base.d.mts.map +0 -1
- package/dist/url/src/index.d.cts +0 -1
- package/dist/url/src/index.d.mts +0 -1
- package/dist/url/src/storm-url.d.cts +0 -1
- package/dist/url/src/storm-url.d.mts +0 -1
- package/dist/url/src/types.d.cts +0 -76
- package/dist/url/src/types.d.cts.map +0 -1
- package/dist/url/src/types.d.mts +0 -76
- package/dist/url/src/types.d.mts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - TRPC Next
|
|
4
4
|
|
|
5
|
+
## [0.5.90](https://github.com/storm-software/stryke/releases/tag/trpc-next%400.5.90) (05/07/2026)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **monorepo:** Resolve inter-package dependency issues ([e83c91bc](https://github.com/storm-software/stryke/commit/e83c91bc))
|
|
10
|
+
|
|
11
|
+
### Updated Dependencies
|
|
12
|
+
|
|
13
|
+
- Updated **string-format** to **v0.17.16**
|
|
14
|
+
- Updated **type-checks** to **v0.6.7**
|
|
15
|
+
- Updated **types** to **v0.12.2**
|
|
16
|
+
- Updated **path** to **v0.29.1**
|
|
17
|
+
- Updated **env** to **v0.20.90**
|
|
18
|
+
- Updated **url** to **v0.4.22**
|
|
19
|
+
- Updated **fs** to **v0.33.73**
|
|
20
|
+
|
|
21
|
+
## [0.5.89](https://github.com/storm-software/stryke/releases/tag/trpc-next%400.5.89) (05/06/2026)
|
|
22
|
+
|
|
23
|
+
### Updated Dependencies
|
|
24
|
+
|
|
25
|
+
- Updated **path** to **v0.29.0**
|
|
26
|
+
- Updated **env** to **v0.20.89**
|
|
27
|
+
- Updated **url** to **v0.4.21**
|
|
28
|
+
|
|
5
29
|
## [0.5.88](https://github.com/storm-software/stryke/releases/tag/trpc-next%400.5.88) (05/06/2026)
|
|
6
30
|
|
|
7
31
|
### Miscellaneous
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MaybePromise } from "./types/src/base.cjs";
|
|
2
1
|
import { BaseContext } from "./types.cjs";
|
|
3
2
|
import * as _$_trpc_server0 from "@trpc/server";
|
|
4
3
|
import * as _$_trpc_next_app_dir_server0 from "@trpc/next/app-dir/server";
|
|
4
|
+
import { MaybePromise } from "@stryke/types";
|
|
5
5
|
import { AnyRootTypes, RootConfig } from "@trpc/server/unstable-core-do-not-import";
|
|
6
6
|
import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies.js";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MaybePromise } from "./types/src/base.mjs";
|
|
2
1
|
import { BaseContext } from "./types.mjs";
|
|
3
2
|
import * as _$_trpc_next_app_dir_server0 from "@trpc/next/app-dir/server";
|
|
4
3
|
import * as _$_trpc_server0 from "@trpc/server";
|
|
4
|
+
import { MaybePromise } from "@stryke/types";
|
|
5
5
|
import { AnyRootTypes, RootConfig } from "@trpc/server/unstable-core-do-not-import";
|
|
6
6
|
import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies.js";
|
|
7
7
|
|
package/dist/server.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MaybePromise } from "./types/src/base.cjs";
|
|
2
1
|
import { AnyTRPCRouter, inferRouterContext } from "@trpc/server";
|
|
2
|
+
import { MaybePromise } from "@stryke/types";
|
|
3
3
|
import { AnyProcedure, AnyRootTypes, ProcedureType, RouterRecord, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies.js";
|
|
5
5
|
import { Resolver } from "@trpc/client";
|
package/dist/server.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MaybePromise } from "./types/src/base.mjs";
|
|
2
1
|
import { Resolver } from "@trpc/client";
|
|
3
2
|
import { experimental_notFound as notFound, experimental_redirect as redirect } from "@trpc/server/adapters/next-app-dir";
|
|
4
3
|
import { FeatureFlags, ResolverDef } from "@trpc/tanstack-react-query";
|
|
5
4
|
import { AnyTRPCRouter, inferRouterContext } from "@trpc/server";
|
|
5
|
+
import { MaybePromise } from "@stryke/types";
|
|
6
6
|
import { AnyProcedure, AnyRootTypes, ProcedureType, RouterRecord, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
7
7
|
import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies.js";
|
|
8
8
|
|
package/dist/shared.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_join_paths = require('./path/src/join-paths.cjs');
|
|
4
3
|
let defu = require("defu");
|
|
5
4
|
defu = require_runtime.__toESM(defu, 1);
|
|
6
5
|
let _js_temporal_polyfill = require("@js-temporal/polyfill");
|
|
6
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
7
7
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
8
8
|
let superjson = require("superjson");
|
|
9
9
|
superjson = require_runtime.__toESM(superjson, 1);
|
|
10
10
|
|
|
11
11
|
//#region src/shared.ts
|
|
12
12
|
function getTRPCServerUrl(baseUrl, version = 1) {
|
|
13
|
-
return
|
|
13
|
+
return (0, _stryke_path_join_paths.joinPaths)(typeof baseUrl === "string" ? baseUrl : baseUrl.host || "", "api", version ? `v${version}` : "", "trpc");
|
|
14
14
|
}
|
|
15
15
|
superjson.default.registerCustom({
|
|
16
16
|
isApplicable: (v) => v instanceof _js_temporal_polyfill.Temporal.PlainDate,
|
package/dist/shared.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StormURLInterface } from "./url/src/types.cjs";
|
|
2
1
|
import { DataTransformer } from "@trpc/server/unstable-core-do-not-import";
|
|
2
|
+
import { StormURLInterface } from "@stryke/url/types";
|
|
3
3
|
import { QueryClient, QueryClientConfig } from "@tanstack/react-query";
|
|
4
4
|
|
|
5
5
|
//#region src/shared.d.ts
|
package/dist/shared.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StormURLInterface } from "./url/src/types.mjs";
|
|
2
1
|
import { QueryClient, QueryClientConfig } from "@tanstack/react-query";
|
|
3
2
|
import { DataTransformer } from "@trpc/server/unstable-core-do-not-import";
|
|
3
|
+
import { StormURLInterface } from "@stryke/url/types";
|
|
4
4
|
|
|
5
5
|
//#region src/shared.d.ts
|
|
6
6
|
declare function getTRPCServerUrl(baseUrl: string | StormURLInterface, version?: number | null): string;
|
package/dist/shared.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { joinPaths } from "./path/src/join-paths.mjs";
|
|
2
1
|
import defu from "defu";
|
|
3
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
4
4
|
import { QueryClient, defaultShouldDehydrateQuery } from "@tanstack/react-query";
|
|
5
5
|
import superjson from "superjson";
|
|
6
6
|
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
5
5
|
const require_shared = require('../shared.cjs');
|
|
6
|
-
const require_environment_checks = require('../env/src/environment-checks.cjs');
|
|
7
|
-
require('../env/src/index.cjs');
|
|
8
6
|
let _trpc_client = require("@trpc/client");
|
|
9
7
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
8
|
+
let _stryke_env = require("@stryke/env");
|
|
10
9
|
let _trpc_tanstack_react_query = require("@trpc/tanstack-react-query");
|
|
11
10
|
let react = require("react");
|
|
12
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -23,7 +22,7 @@ function createTRPCTanstackQueryClient(baseUrl, queryClient) {
|
|
|
23
22
|
useTRPCTanstackQuery: useTRPC,
|
|
24
23
|
TRPCTanstackQueryProvider: (props) => {
|
|
25
24
|
const { children } = props;
|
|
26
|
-
const [trpcClient] = (0, react.useState)(() => (0, _trpc_client.createTRPCClient)({ links: [(0, _trpc_client.loggerLink)({ enabled: (op) =>
|
|
25
|
+
const [trpcClient] = (0, react.useState)(() => (0, _trpc_client.createTRPCClient)({ links: [(0, _trpc_client.loggerLink)({ enabled: (op) => _stryke_env.isDevelopment || op.direction === "down" && op.result instanceof Error }), (0, _trpc_client.httpBatchStreamLink)({
|
|
27
26
|
transformer: require_shared.transformer,
|
|
28
27
|
url: require_shared.getTRPCServerUrl(baseUrl),
|
|
29
28
|
headers: { "x-trpc-source": "react-query" }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { StormURLInterface } from "../url/src/types.cjs";
|
|
2
1
|
import { AnyTRPCRouter } from "@trpc/server";
|
|
3
2
|
import * as _$_trpc_tanstack_react_query0 from "@trpc/tanstack-react-query";
|
|
4
3
|
import { QueryClient } from "@tanstack/react-query";
|
|
5
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import { StormURLInterface } from "@stryke/url";
|
|
6
6
|
|
|
7
7
|
//#region src/tanstack-query/client.d.ts
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.cts","names":[],"sources":["../../src/tanstack-query/client.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.cts","names":[],"sources":["../../src/tanstack-query/client.tsx"],"mappings":";;;;;;;;;;;AAuCA;iBAAgB,6BAAA,iBAA8C,aAAA,CAAA,CAC5D,OAAA,WAAkB,iBAAA,EAClB,WAAA,EAAa,WAAA;;;;;IAM0B,QAAA,EAAU,KAAA,CAAM,SAAA;EAAA,MAAW,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { StormURLInterface } from "../url/src/types.mjs";
|
|
2
1
|
import { QueryClient } from "@tanstack/react-query";
|
|
3
2
|
import * as _$_trpc_tanstack_react_query0 from "@trpc/tanstack-react-query";
|
|
4
3
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
4
|
import { AnyTRPCRouter } from "@trpc/server";
|
|
5
|
+
import { StormURLInterface } from "@stryke/url";
|
|
6
6
|
|
|
7
7
|
//#region src/tanstack-query/client.d.ts
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/tanstack-query/client.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/tanstack-query/client.tsx"],"mappings":";;;;;;;;;;;AAuCA;iBAAgB,6BAAA,iBAA8C,aAAA,CAAA,CAC5D,OAAA,WAAkB,iBAAA,EAClB,WAAA,EAAa,WAAA;;;;;IAM0B,QAAA,EAAU,KAAA,CAAM,SAAA;EAAA,MAAW,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { getTRPCServerUrl, transformer } from "../shared.mjs";
|
|
4
|
-
import { isDevelopment } from "../env/src/environment-checks.mjs";
|
|
5
|
-
import "../env/src/index.mjs";
|
|
6
4
|
import { createTRPCClient, httpBatchStreamLink, loggerLink } from "@trpc/client";
|
|
7
5
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
6
|
+
import { isDevelopment } from "@stryke/env";
|
|
8
7
|
import { createTRPCContext } from "@trpc/tanstack-react-query";
|
|
9
8
|
import { useState } from "react";
|
|
10
9
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","names":[],"sources":["../../src/tanstack-query/client.tsx"],"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\"use client\";\n\nimport { isDevelopment } from \"@stryke/env\";\nimport type { StormURLInterface } from \"@stryke/url\";\nimport type { QueryClient } from \"@tanstack/react-query\";\nimport { QueryClientProvider } from \"@tanstack/react-query\";\nimport {\n createTRPCClient,\n httpBatchStreamLink,\n loggerLink\n} from \"@trpc/client\";\nimport type { AnyTRPCRouter } from \"@trpc/server\";\nimport { createTRPCContext } from \"@trpc/tanstack-react-query\";\nimport { useState } from \"react\";\nimport { getTRPCServerUrl, transformer } from \"../shared\";\n\n/**\n * Create a TRPC Tanstack Query client.\n *\n * @returns The TRPC Tanstack Query client\n */\nexport function createTRPCTanstackQueryClient<TRouter extends AnyTRPCRouter>(\n baseUrl: string | StormURLInterface,\n queryClient: QueryClient\n) {\n const { TRPCProvider, useTRPC } = createTRPCContext<TRouter>();\n\n return {\n useTRPCTanstackQuery: useTRPC,\n TRPCTanstackQueryProvider: (props: { children: React.ReactNode }) => {\n const { children } = props;\n\n const [trpcClient] = useState(() =>\n createTRPCClient<TRouter>({\n links: [\n loggerLink({\n enabled: op =>\n isDevelopment ||\n (op.direction === \"down\" && op.result instanceof Error)\n }),\n httpBatchStreamLink<TRouter>({\n transformer,\n url: getTRPCServerUrl(baseUrl),\n headers: { \"x-trpc-source\": \"react-query\" }\n } as TRouter[\"_def\"][\"_config\"][\"$types\"])\n ]\n })\n );\n\n return (\n <TRPCProvider trpcClient={trpcClient} queryClient={queryClient}>\n <QueryClientProvider client={queryClient}>\n {children}\n </QueryClientProvider>\n </TRPCProvider>\n );\n }\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../../src/tanstack-query/client.tsx"],"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\"use client\";\n\nimport { isDevelopment } from \"@stryke/env\";\nimport type { StormURLInterface } from \"@stryke/url\";\nimport type { QueryClient } from \"@tanstack/react-query\";\nimport { QueryClientProvider } from \"@tanstack/react-query\";\nimport {\n createTRPCClient,\n httpBatchStreamLink,\n loggerLink\n} from \"@trpc/client\";\nimport type { AnyTRPCRouter } from \"@trpc/server\";\nimport { createTRPCContext } from \"@trpc/tanstack-react-query\";\nimport { useState } from \"react\";\nimport { getTRPCServerUrl, transformer } from \"../shared\";\n\n/**\n * Create a TRPC Tanstack Query client.\n *\n * @returns The TRPC Tanstack Query client\n */\nexport function createTRPCTanstackQueryClient<TRouter extends AnyTRPCRouter>(\n baseUrl: string | StormURLInterface,\n queryClient: QueryClient\n) {\n const { TRPCProvider, useTRPC } = createTRPCContext<TRouter>();\n\n return {\n useTRPCTanstackQuery: useTRPC,\n TRPCTanstackQueryProvider: (props: { children: React.ReactNode }) => {\n const { children } = props;\n\n const [trpcClient] = useState(() =>\n createTRPCClient<TRouter>({\n links: [\n loggerLink({\n enabled: op =>\n isDevelopment ||\n (op.direction === \"down\" && op.result instanceof Error)\n }),\n httpBatchStreamLink<TRouter>({\n transformer,\n url: getTRPCServerUrl(baseUrl),\n headers: { \"x-trpc-source\": \"react-query\" }\n } as TRouter[\"_def\"][\"_config\"][\"$types\"])\n ]\n })\n );\n\n return (\n <TRPCProvider trpcClient={trpcClient} queryClient={queryClient}>\n <QueryClientProvider client={queryClient}>\n {children}\n </QueryClientProvider>\n </TRPCProvider>\n );\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuCA,SAAgB,8BACd,SACA,aACA;CACA,MAAM,EAAE,cAAc,YAAY,mBAA4B;AAE9D,QAAO;EACL,sBAAsB;EACtB,4BAA4B,UAAyC;GACnE,MAAM,EAAE,aAAa;GAErB,MAAM,CAAC,cAAc,eACnB,iBAA0B,EACxB,OAAO,CACL,WAAW,EACT,UAAS,OACP,iBACC,GAAG,cAAc,UAAU,GAAG,kBAAkB,OACpD,CAAC,EACF,oBAA6B;IAC3B;IACA,KAAK,iBAAiB,QAAQ;IAC9B,SAAS,EAAE,iBAAiB,eAAe;IAC5C,CAAyC,CAC3C,EACF,CAAC,CACH;AAED,UACE,oBAAC,cAAD;IAA0B;IAAyB;cACjD,oBAAC,qBAAD;KAAqB,QAAQ;KAC1B;KACmB;IACT;;EAGpB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MaybePromise } from "../types/src/base.cjs";
|
|
2
1
|
import { AnyTRPCRouter, inferRouterContext } from "@trpc/server";
|
|
2
|
+
import { MaybePromise } from "@stryke/types";
|
|
3
3
|
import * as _$_trpc_tanstack_react_query0 from "@trpc/tanstack-react-query";
|
|
4
4
|
import { TRPCQueryOptions } from "@trpc/tanstack-react-query";
|
|
5
5
|
import { QueryClientConfig } from "@tanstack/react-query";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MaybePromise } from "../types/src/base.mjs";
|
|
2
1
|
import { QueryClientConfig } from "@tanstack/react-query";
|
|
3
2
|
import * as _$_trpc_tanstack_react_query0 from "@trpc/tanstack-react-query";
|
|
4
3
|
import { TRPCQueryOptions } from "@trpc/tanstack-react-query";
|
|
5
4
|
import React from "react";
|
|
6
5
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
6
|
import { AnyTRPCRouter, inferRouterContext } from "@trpc/server";
|
|
7
|
+
import { MaybePromise } from "@stryke/types";
|
|
8
8
|
|
|
9
9
|
//#region src/tanstack-query/server.d.ts
|
|
10
10
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/trpc-next",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.90",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package to help in using tRPC in modern NextJs applications.",
|
|
6
6
|
"repository": {
|
|
@@ -19,52 +19,6 @@
|
|
|
19
19
|
"import": "./dist/client.mjs",
|
|
20
20
|
"require": "./dist/client.cjs"
|
|
21
21
|
},
|
|
22
|
-
"./env/src": {
|
|
23
|
-
"import": "./dist/env/src/index.mjs",
|
|
24
|
-
"require": "./dist/env/src/index.cjs"
|
|
25
|
-
},
|
|
26
|
-
"./env/src/ci-checks": {
|
|
27
|
-
"import": "./dist/env/src/ci-checks.mjs",
|
|
28
|
-
"require": "./dist/env/src/ci-checks.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./env/src/environment-checks": {
|
|
31
|
-
"import": "./dist/env/src/environment-checks.mjs",
|
|
32
|
-
"require": "./dist/env/src/environment-checks.cjs"
|
|
33
|
-
},
|
|
34
|
-
"./env/src/get-env-paths": {
|
|
35
|
-
"import": "./dist/env/src/get-env-paths.mjs",
|
|
36
|
-
"require": "./dist/env/src/get-env-paths.cjs"
|
|
37
|
-
},
|
|
38
|
-
"./env/src/load-env": {
|
|
39
|
-
"import": "./dist/env/src/load-env.mjs",
|
|
40
|
-
"require": "./dist/env/src/load-env.cjs"
|
|
41
|
-
},
|
|
42
|
-
"./env/src/providers": {
|
|
43
|
-
"import": "./dist/env/src/providers.mjs",
|
|
44
|
-
"require": "./dist/env/src/providers.cjs"
|
|
45
|
-
},
|
|
46
|
-
"./env/src/runtime-checks": {
|
|
47
|
-
"import": "./dist/env/src/runtime-checks.mjs",
|
|
48
|
-
"require": "./dist/env/src/runtime-checks.cjs"
|
|
49
|
-
},
|
|
50
|
-
"./fs/src/exists": "./dist/fs/src/exists.mjs",
|
|
51
|
-
"./fs/src/read-file": "./dist/fs/src/read-file.mjs",
|
|
52
|
-
"./path/src/is-type": {
|
|
53
|
-
"import": "./dist/path/src/is-type.mjs",
|
|
54
|
-
"require": "./dist/path/src/is-type.cjs"
|
|
55
|
-
},
|
|
56
|
-
"./path/src/join-paths": {
|
|
57
|
-
"import": "./dist/path/src/join-paths.mjs",
|
|
58
|
-
"require": "./dist/path/src/join-paths.cjs"
|
|
59
|
-
},
|
|
60
|
-
"./path/src/regex": {
|
|
61
|
-
"import": "./dist/path/src/regex.mjs",
|
|
62
|
-
"require": "./dist/path/src/regex.cjs"
|
|
63
|
-
},
|
|
64
|
-
"./path/src/slash": {
|
|
65
|
-
"import": "./dist/path/src/slash.mjs",
|
|
66
|
-
"require": "./dist/path/src/slash.cjs"
|
|
67
|
-
},
|
|
68
22
|
"./server": {
|
|
69
23
|
"import": "./dist/server.mjs",
|
|
70
24
|
"require": "./dist/server.cjs"
|
|
@@ -105,18 +59,6 @@
|
|
|
105
59
|
"import": "./dist/shield/validation.mjs",
|
|
106
60
|
"require": "./dist/shield/validation.cjs"
|
|
107
61
|
},
|
|
108
|
-
"./string-format/src/acronyms": {
|
|
109
|
-
"import": "./dist/string-format/src/acronyms.mjs",
|
|
110
|
-
"require": "./dist/string-format/src/acronyms.cjs"
|
|
111
|
-
},
|
|
112
|
-
"./string-format/src/format-special-cases": {
|
|
113
|
-
"import": "./dist/string-format/src/format-special-cases.mjs",
|
|
114
|
-
"require": "./dist/string-format/src/format-special-cases.cjs"
|
|
115
|
-
},
|
|
116
|
-
"./string-format/src/title-case": {
|
|
117
|
-
"import": "./dist/string-format/src/title-case.mjs",
|
|
118
|
-
"require": "./dist/string-format/src/title-case.cjs"
|
|
119
|
-
},
|
|
120
62
|
"./tanstack-query/client": {
|
|
121
63
|
"import": "./dist/tanstack-query/client.mjs",
|
|
122
64
|
"require": "./dist/tanstack-query/client.cjs"
|
|
@@ -133,6 +75,13 @@
|
|
|
133
75
|
"types": "./dist/index.d.cts",
|
|
134
76
|
"dependencies": {
|
|
135
77
|
"@js-temporal/polyfill": "^0.5.1",
|
|
78
|
+
"@stryke/env": "^0.20.90",
|
|
79
|
+
"@stryke/fs": "^0.33.73",
|
|
80
|
+
"@stryke/path": "^0.29.1",
|
|
81
|
+
"@stryke/string-format": "^0.17.16",
|
|
82
|
+
"@stryke/type-checks": "^0.6.7",
|
|
83
|
+
"@stryke/types": "^0.12.2",
|
|
84
|
+
"@stryke/url": "^0.4.22",
|
|
136
85
|
"@tanstack/react-query": "^5.100.9",
|
|
137
86
|
"@trpc/client": "^11.17.0",
|
|
138
87
|
"@trpc/next": "^11.17.0",
|
|
@@ -140,7 +89,7 @@
|
|
|
140
89
|
"@trpc/tanstack-react-query": "^11.17.0",
|
|
141
90
|
"defu": "^6.1.7",
|
|
142
91
|
"server-only": "^0.0.1",
|
|
143
|
-
"superjson": "2.2.
|
|
92
|
+
"superjson": "^2.2.6"
|
|
144
93
|
},
|
|
145
94
|
"devDependencies": {
|
|
146
95
|
"@types/react": "^19.2.14",
|
|
@@ -159,5 +108,5 @@
|
|
|
159
108
|
"react-native": { "optional": true }
|
|
160
109
|
},
|
|
161
110
|
"publishConfig": { "access": "public" },
|
|
162
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "2ed697a18e476a0415c784f7e12e46770ea397e0"
|
|
163
112
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region ../env/src/ci-checks.ts
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if the current environment is a CI environment.
|
|
5
|
-
*
|
|
6
|
-
* @returns True if the current environment is a CI environment.
|
|
7
|
-
*/
|
|
8
|
-
const isCI = (env = process.env) => {
|
|
9
|
-
return Boolean(env.STORM_CI || env.CI || env.CONTINUOUS_INTEGRATION || env.BUILD_NUMBER || env.RUN_ID || env.AGOLA_GIT_REF || env.AC_APPCIRCLE || env.APPVEYOR || env.CODEBUILD || env.TF_BUILD || env.bamboo_planKey || env.BITBUCKET_COMMIT || env.BITRISE_IO || env.BUDDY_WORKSPACE_ID || env.BUILDKITE || env.CIRCLECI || env.CIRRUS_CI || env.CF_BUILD_ID || env.CM_BUILD_ID || env.CI_NAME || env.DRONE || env.DSARI || env.EARTHLY_CI || env.EAS_BUILD || env.GERRIT_PROJECT || env.GITEA_ACTIONS || env.GITHUB_ACTIONS || env.GITLAB_CI || env.GOCD || env.BUILDER_OUTPUT || env.HARNESS_BUILD_ID || env.JENKINS_URL || env.BUILD_ID || env.LAYERCI || env.MAGNUM || env.NETLIFY || env.NEVERCODE || env.PROW_JOB_ID || env.RELEASE_BUILD_ID || env.RENDER || env.SAILCI || env.HUDSON || env.JENKINS_URL || env.BUILD_ID || env.SCREWDRIVER || env.SEMAPHORE || env.SOURCEHUT || env.STRIDER || env.TASK_ID || env.RUN_ID || env.TEAMCITY_VERSION || env.TRAVIS || env.VELA || env.NOW_BUILDER || env.APPCENTER_BUILD_ID || env.CI_XCODE_PROJECT || env.XCS || false);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
exports.isCI = isCI;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region ../env/src/ci-checks.ts
|
|
2
|
-
/**
|
|
3
|
-
* Returns true if the current environment is a CI environment.
|
|
4
|
-
*
|
|
5
|
-
* @returns True if the current environment is a CI environment.
|
|
6
|
-
*/
|
|
7
|
-
const isCI = (env = process.env) => {
|
|
8
|
-
return Boolean(env.STORM_CI || env.CI || env.CONTINUOUS_INTEGRATION || env.BUILD_NUMBER || env.RUN_ID || env.AGOLA_GIT_REF || env.AC_APPCIRCLE || env.APPVEYOR || env.CODEBUILD || env.TF_BUILD || env.bamboo_planKey || env.BITBUCKET_COMMIT || env.BITRISE_IO || env.BUDDY_WORKSPACE_ID || env.BUILDKITE || env.CIRCLECI || env.CIRRUS_CI || env.CF_BUILD_ID || env.CM_BUILD_ID || env.CI_NAME || env.DRONE || env.DSARI || env.EARTHLY_CI || env.EAS_BUILD || env.GERRIT_PROJECT || env.GITEA_ACTIONS || env.GITHUB_ACTIONS || env.GITLAB_CI || env.GOCD || env.BUILDER_OUTPUT || env.HARNESS_BUILD_ID || env.JENKINS_URL || env.BUILD_ID || env.LAYERCI || env.MAGNUM || env.NETLIFY || env.NEVERCODE || env.PROW_JOB_ID || env.RELEASE_BUILD_ID || env.RENDER || env.SAILCI || env.HUDSON || env.JENKINS_URL || env.BUILD_ID || env.SCREWDRIVER || env.SEMAPHORE || env.SOURCEHUT || env.STRIDER || env.TASK_ID || env.RUN_ID || env.TEAMCITY_VERSION || env.TRAVIS || env.VELA || env.NOW_BUILDER || env.APPCENTER_BUILD_ID || env.CI_XCODE_PROJECT || env.XCS || false);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { isCI };
|
|
13
|
-
//# sourceMappingURL=ci-checks.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ci-checks.mjs","names":[],"sources":["../../../../env/src/ci-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/**\n * Returns true if the current environment is a CI environment.\n *\n * @returns True if the current environment is a CI environment.\n */\nexport const isCI = (\n env: Record<string, string | undefined> = process.env\n): boolean => {\n // From https://github.com/watson/ci-info/blob/44e98cebcdf4403f162195fbcf90b1f69fc6e047/index.js#L54-L61\n // Evaluating at runtime makes it possible to change the values in our tests\n // This list is probably not exhaustive though `process.env.CI` should be enough\n // but since we were using this utility in the past, we want to keep the same behavior\n return Boolean(\n env.STORM_CI || // Custom CI\n env.CI || // Travis CI, CircleCI, Cirrus CI, GitLab CI, Appveyor, CodeShip, dsari\n env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI\n env.BUILD_NUMBER || // Jenkins, TeamCity\n env.RUN_ID || // TaskCluster, dsari\n // From `env` from v4.0.0 https://github.com/watson/ci-info/blob/3e1488e98680f1f776785fe8708a157b7f00e568/vendors.json\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n // See https://github.com/prisma/prisma/issues/22380 for why we commented it out\n // Users deploying on Vercel might have this env var set in the local dev env\n // env.VERCEL ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS ||\n false\n );\n};\n\n// Same logic as https://github.com/sindresorhus/is-interactive/blob/dc8037ae1a61d828cfb42761c345404055b1e036/index.js\n// But defaults to check `stdin` for our prompts\n// It checks that the stream is TTY, not a dumb terminal\n\n/**\n * Check if the current process is interactive\n *\n * @param stream - The stream to check\n * @returns True if the current process is interactive\n */\nexport const isInteractive = (stream = process.stdin): boolean => {\n return Boolean(stream?.isTTY && process.env.TERM !== \"dumb\");\n};\n"],"mappings":";;;;;;AAuBA,MAAa,QACX,MAA0C,QAAQ,QACtC;AAKZ,QAAO,QACL,IAAI,YACJ,IAAI,MACJ,IAAI,0BACJ,IAAI,gBACJ,IAAI,UAEJ,IAAI,iBACJ,IAAI,gBACJ,IAAI,YACJ,IAAI,aACJ,IAAI,YACJ,IAAI,kBACJ,IAAI,oBACJ,IAAI,cACJ,IAAI,sBACJ,IAAI,aACJ,IAAI,YACJ,IAAI,aACJ,IAAI,eACJ,IAAI,eACJ,IAAI,WACJ,IAAI,SACJ,IAAI,SACJ,IAAI,cACJ,IAAI,aACJ,IAAI,kBACJ,IAAI,iBACJ,IAAI,kBACJ,IAAI,aACJ,IAAI,QACJ,IAAI,kBACJ,IAAI,oBACJ,IAAI,eACJ,IAAI,YACJ,IAAI,WACJ,IAAI,UACJ,IAAI,WACJ,IAAI,aACJ,IAAI,eACJ,IAAI,oBACJ,IAAI,UACJ,IAAI,UACJ,IAAI,UACJ,IAAI,eACJ,IAAI,YACJ,IAAI,eACJ,IAAI,aACJ,IAAI,aACJ,IAAI,WACJ,IAAI,WACJ,IAAI,UACJ,IAAI,oBACJ,IAAI,UACJ,IAAI,QACJ,IAAI,eAIJ,IAAI,sBACJ,IAAI,oBACJ,IAAI,OACJ,MACD"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
const require_ci_checks = require('./ci-checks.cjs');
|
|
2
|
-
|
|
3
|
-
//#region ../env/src/environment-checks.ts
|
|
4
|
-
/** Value of process.platform */
|
|
5
|
-
const platform = process?.platform || "";
|
|
6
|
-
/** Detect if stdout.TTY is available */
|
|
7
|
-
const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);
|
|
8
|
-
/** Detect if `DEBUG` environment variable is set */
|
|
9
|
-
const isDebug = Boolean(process.env.DEBUG);
|
|
10
|
-
/** Detect the `NODE_ENV` environment variable */
|
|
11
|
-
const mode = process.env.STORM_MODE || process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV || "production";
|
|
12
|
-
/** Detect if the application is running in a staging environment */
|
|
13
|
-
const isStaging = [
|
|
14
|
-
"stg",
|
|
15
|
-
"stage",
|
|
16
|
-
"staging"
|
|
17
|
-
].includes(mode?.toLowerCase());
|
|
18
|
-
/**
|
|
19
|
-
* Check if the current environment is production.
|
|
20
|
-
*
|
|
21
|
-
* @param mode - The mode string to check.
|
|
22
|
-
* @returns Whether the environment is production
|
|
23
|
-
*/
|
|
24
|
-
function isProductionMode(mode) {
|
|
25
|
-
return [
|
|
26
|
-
"prd",
|
|
27
|
-
"prod",
|
|
28
|
-
"production",
|
|
29
|
-
"preprod",
|
|
30
|
-
"preproduction",
|
|
31
|
-
"uat"
|
|
32
|
-
].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
33
|
-
}
|
|
34
|
-
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
35
|
-
const isProduction = isProductionMode(mode);
|
|
36
|
-
/**
|
|
37
|
-
* Check if the current environment is test.
|
|
38
|
-
*
|
|
39
|
-
* @param mode - The mode string to check.
|
|
40
|
-
* @returns Whether the environment is test
|
|
41
|
-
*/
|
|
42
|
-
function isTestMode(mode) {
|
|
43
|
-
return [
|
|
44
|
-
"tst",
|
|
45
|
-
"test",
|
|
46
|
-
"testing",
|
|
47
|
-
"stg",
|
|
48
|
-
"stage",
|
|
49
|
-
"staging",
|
|
50
|
-
"qa",
|
|
51
|
-
"qualityassurance"
|
|
52
|
-
].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
53
|
-
}
|
|
54
|
-
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
55
|
-
const isTest = isTestMode(mode) || isStaging || Boolean(process.env.TEST);
|
|
56
|
-
/**
|
|
57
|
-
* Check if the current environment is development.
|
|
58
|
-
*
|
|
59
|
-
* @param mode - The mode string to check.
|
|
60
|
-
* @returns Whether the environment is development
|
|
61
|
-
*/
|
|
62
|
-
function isDevelopmentMode(mode) {
|
|
63
|
-
return [
|
|
64
|
-
"dev",
|
|
65
|
-
"development",
|
|
66
|
-
"int",
|
|
67
|
-
"integration"
|
|
68
|
-
].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
69
|
-
}
|
|
70
|
-
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
71
|
-
const isDevelopment = isDevelopmentMode(mode) || isDebug;
|
|
72
|
-
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
73
|
-
const isMinimal = Boolean(process.env.MINIMAL) || require_ci_checks.isCI() || isTest || !hasTTY;
|
|
74
|
-
/** Detect if process.platform is Windows */
|
|
75
|
-
const isWindows = /^win/i.test(platform);
|
|
76
|
-
/** Detect if process.platform is Linux */
|
|
77
|
-
const isLinux = /^linux/i.test(platform);
|
|
78
|
-
/** Detect if process.platform is macOS (darwin kernel) */
|
|
79
|
-
const isMacOS = /^darwin/i.test(platform);
|
|
80
|
-
/** Color Support */
|
|
81
|
-
const isColorSupported = !process.env.NO_COLOR && (Boolean(process.env.FORCE_COLOR) || (hasTTY || isWindows) && process.env.TERM !== "dumb" || require_ci_checks.isCI());
|
|
82
|
-
/** Node.js versions */
|
|
83
|
-
const nodeVersion = (process?.versions?.node || "").replace(/^v/, "") || null;
|
|
84
|
-
const nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
|
|
85
|
-
|
|
86
|
-
//#endregion
|
|
87
|
-
exports.hasTTY = hasTTY;
|
|
88
|
-
exports.isDebug = isDebug;
|
|
89
|
-
exports.isDevelopment = isDevelopment;
|
|
90
|
-
exports.isDevelopmentMode = isDevelopmentMode;
|
|
91
|
-
exports.isProductionMode = isProductionMode;
|
|
92
|
-
exports.isStaging = isStaging;
|
|
93
|
-
exports.isTest = isTest;
|
|
94
|
-
exports.isTestMode = isTestMode;
|
|
95
|
-
exports.isWindows = isWindows;
|
|
96
|
-
exports.nodeVersion = nodeVersion;
|
|
97
|
-
exports.platform = platform;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { isCI } from "./ci-checks.mjs";
|
|
2
|
-
|
|
3
|
-
//#region ../env/src/environment-checks.ts
|
|
4
|
-
/** Value of process.platform */
|
|
5
|
-
const platform = process?.platform || "";
|
|
6
|
-
/** Detect if stdout.TTY is available */
|
|
7
|
-
const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);
|
|
8
|
-
/** Detect if `DEBUG` environment variable is set */
|
|
9
|
-
const isDebug = Boolean(process.env.DEBUG);
|
|
10
|
-
/** Detect the `NODE_ENV` environment variable */
|
|
11
|
-
const mode = process.env.STORM_MODE || process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV || "production";
|
|
12
|
-
/** Detect if the application is running in a staging environment */
|
|
13
|
-
const isStaging = [
|
|
14
|
-
"stg",
|
|
15
|
-
"stage",
|
|
16
|
-
"staging"
|
|
17
|
-
].includes(mode?.toLowerCase());
|
|
18
|
-
/**
|
|
19
|
-
* Check if the current environment is production.
|
|
20
|
-
*
|
|
21
|
-
* @param mode - The mode string to check.
|
|
22
|
-
* @returns Whether the environment is production
|
|
23
|
-
*/
|
|
24
|
-
function isProductionMode(mode) {
|
|
25
|
-
return [
|
|
26
|
-
"prd",
|
|
27
|
-
"prod",
|
|
28
|
-
"production",
|
|
29
|
-
"preprod",
|
|
30
|
-
"preproduction",
|
|
31
|
-
"uat"
|
|
32
|
-
].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
33
|
-
}
|
|
34
|
-
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
35
|
-
const isProduction = isProductionMode(mode);
|
|
36
|
-
/**
|
|
37
|
-
* Check if the current environment is test.
|
|
38
|
-
*
|
|
39
|
-
* @param mode - The mode string to check.
|
|
40
|
-
* @returns Whether the environment is test
|
|
41
|
-
*/
|
|
42
|
-
function isTestMode(mode) {
|
|
43
|
-
return [
|
|
44
|
-
"tst",
|
|
45
|
-
"test",
|
|
46
|
-
"testing",
|
|
47
|
-
"stg",
|
|
48
|
-
"stage",
|
|
49
|
-
"staging",
|
|
50
|
-
"qa",
|
|
51
|
-
"qualityassurance"
|
|
52
|
-
].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
53
|
-
}
|
|
54
|
-
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
55
|
-
const isTest = isTestMode(mode) || isStaging || Boolean(process.env.TEST);
|
|
56
|
-
/**
|
|
57
|
-
* Check if the current environment is development.
|
|
58
|
-
*
|
|
59
|
-
* @param mode - The mode string to check.
|
|
60
|
-
* @returns Whether the environment is development
|
|
61
|
-
*/
|
|
62
|
-
function isDevelopmentMode(mode) {
|
|
63
|
-
return [
|
|
64
|
-
"dev",
|
|
65
|
-
"development",
|
|
66
|
-
"int",
|
|
67
|
-
"integration"
|
|
68
|
-
].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
|
|
69
|
-
}
|
|
70
|
-
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
71
|
-
const isDevelopment = isDevelopmentMode(mode) || isDebug;
|
|
72
|
-
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
73
|
-
const isMinimal = Boolean(process.env.MINIMAL) || isCI() || isTest || !hasTTY;
|
|
74
|
-
/** Detect if process.platform is Windows */
|
|
75
|
-
const isWindows = /^win/i.test(platform);
|
|
76
|
-
/** Detect if process.platform is Linux */
|
|
77
|
-
const isLinux = /^linux/i.test(platform);
|
|
78
|
-
/** Detect if process.platform is macOS (darwin kernel) */
|
|
79
|
-
const isMacOS = /^darwin/i.test(platform);
|
|
80
|
-
/** Color Support */
|
|
81
|
-
const isColorSupported = !process.env.NO_COLOR && (Boolean(process.env.FORCE_COLOR) || (hasTTY || isWindows) && process.env.TERM !== "dumb" || isCI());
|
|
82
|
-
/** Node.js versions */
|
|
83
|
-
const nodeVersion = (process?.versions?.node || "").replace(/^v/, "") || null;
|
|
84
|
-
const nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
|
|
85
|
-
|
|
86
|
-
//#endregion
|
|
87
|
-
export { hasTTY, isDebug, isDevelopment, isDevelopmentMode, isProductionMode, isStaging, isTest, isTestMode, isWindows, nodeVersion, platform };
|
|
88
|
-
//# sourceMappingURL=environment-checks.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment-checks.mjs","names":[],"sources":["../../../../env/src/environment-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\nimport { isCI } from \"./ci-checks\";\n\n/** Value of process.platform */\nexport const platform = process?.platform || \"\";\n\n/** Detect if stdout.TTY is available */\nexport const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);\n\n/** Detect if `DEBUG` environment variable is set */\nexport const isDebug = Boolean(process.env.DEBUG);\n\n/** Detect the `NODE_ENV` environment variable */\nconst mode =\n process.env.STORM_MODE ||\n process.env.NEXT_PUBLIC_VERCEL_ENV ||\n process.env.NODE_ENV ||\n \"production\";\n\n/** Detect if the application is running in a staging environment */\nexport const isStaging = [\"stg\", \"stage\", \"staging\"].includes(\n mode?.toLowerCase()\n);\n\n/**\n * Check if the current environment is production.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is production\n */\nexport function isProductionMode(mode: string) {\n return [\n \"prd\",\n \"prod\",\n \"production\",\n\n \"preprod\",\n\n \"preproduction\",\n \"uat\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `production` */\nexport const isProduction = isProductionMode(mode);\n\n/**\n * Check if the current environment is test.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is test\n */\nexport function isTestMode(mode: string) {\n return [\n \"tst\",\n \"test\",\n \"testing\",\n \"stg\",\n \"stage\",\n \"staging\",\n \"qa\",\n\n \"qualityassurance\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `test` */\nexport const isTest =\n isTestMode(mode) || isStaging || Boolean(process.env.TEST);\n\n/**\n * Check if the current environment is development.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is development\n */\nexport function isDevelopmentMode(mode: string) {\n return [\"dev\", \"development\", \"int\", \"integration\"].includes(\n mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\")\n );\n}\n\n/** Detect if `NODE_ENV` environment variable is `dev` or `development` */\nexport const isDevelopment = isDevelopmentMode(mode) || isDebug;\n\n/**\n * Convert a mode string to a standardized mode value of \"production\", \"development\", or \"test\".\n *\n * @param mode - The mode string to convert.\n * @returns The standardized mode value.\n */\nexport function toMode(mode: string): \"production\" | \"development\" | \"test\" {\n if (isProductionMode(mode)) {\n return \"production\";\n } else if (isTestMode(mode)) {\n return \"test\";\n } else if (isDevelopmentMode(mode)) {\n return \"development\";\n }\n\n return \"production\";\n}\n\n/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */\nexport const isMinimal =\n Boolean(process.env.MINIMAL) || isCI() || isTest || !hasTTY;\n\n/** Detect if process.platform is Windows */\nexport const isWindows = /^win/i.test(platform);\n\n/** Detect if process.platform is Linux */\nexport const isLinux = /^linux/i.test(platform);\n\n/** Detect if process.platform is macOS (darwin kernel) */\nexport const isMacOS = /^darwin/i.test(platform);\n\n/** Color Support */\nexport const isColorSupported =\n !process.env.NO_COLOR &&\n (Boolean(process.env.FORCE_COLOR) ||\n ((hasTTY || isWindows) && process.env.TERM !== \"dumb\") ||\n isCI());\n\nfunction parseVersion(versionString = \"\") {\n if (/^\\d{3,4}$/.test(versionString)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(versionString) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versions = (versionString ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versions[0],\n minor: versions[1],\n patch: versions[2]\n };\n}\n\n/**\n * Check if the current environment supports hyperlinks in the terminal.\n *\n * @param stream - The stream to check for TTY support (default: process.stdout)\n * @returns Whether hyperlinks are supported\n */\nexport function isHyperlinkSupported(\n stream: NodeJS.WriteStream = process.stdout\n): boolean {\n if (process.env.FORCE_HYPERLINK) {\n return !(\n process.env.FORCE_HYPERLINK.length > 0 &&\n Number.parseInt(process.env.FORCE_HYPERLINK, 10) === 0\n );\n }\n\n // Netlify does not run a TTY, it does not need `supportsColor` check\n if (process.env.NETLIFY) {\n return true;\n } else if (!isColorSupported) {\n return false;\n } else if (stream && !stream.isTTY) {\n return false;\n } else if (\"WT_SESSION\" in process.env) {\n return true;\n } else if (process.platform === \"win32\") {\n return false;\n } else if (isCI()) {\n return false;\n } else if (process.env.TEAMCITY_VERSION) {\n return false;\n } else if (process.env.TERM_PROGRAM) {\n const version = parseVersion(process.env.TERM_PROGRAM_VERSION);\n\n switch (process.env.TERM_PROGRAM) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n case \"vscode\": {\n // Cursor forked VS Code and supports hyperlinks in 0.x.x\n if (process.env.CURSOR_TRACE_ID) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (process.env.VTE_VERSION) {\n // 0.50.0 was supposed to support hyperlinks, but throws a segfault\n if (process.env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(process.env.VTE_VERSION);\n\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (process.env.TERM === \"alacritty\") {\n return true;\n }\n\n return false;\n}\n\n/** Node.js versions */\nexport const nodeVersion =\n (process?.versions?.node || \"\").replace(/^v/, \"\") || null;\n\nexport const nodeMajorVersion = Number(nodeVersion?.split(\".\")[0]) || null;\n"],"mappings":";;;;AAqBA,MAAa,WAAW,SAAS,YAAY;;AAG7C,MAAa,SAAS,QAAQ,SAAS,UAAU,SAAS,OAAO,MAAM;;AAGvE,MAAa,UAAU,QAAQ,QAAQ,IAAI,MAAM;;AAGjD,MAAM,OACJ,QAAQ,IAAI,cACZ,QAAQ,IAAI,0BACZ,QAAQ,IAAI,YACZ;;AAGF,MAAa,YAAY;CAAC;CAAO;CAAS;CAAU,CAAC,SACnD,MAAM,aAAa,CACpB;;;;;;;AAQD,SAAgB,iBAAiB,MAAc;AAC7C,QAAO;EACL;EACA;EACA;EAEA;EAEA;EACA;EACD,CAAC,SAAS,MAAM,aAAa,EAAE,QAAQ,YAAY,GAAG,CAAC;;;AAI1D,MAAa,eAAe,iBAAiB,KAAK;;;;;;;AAQlD,SAAgB,WAAW,MAAc;AACvC,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACD,CAAC,SAAS,MAAM,aAAa,EAAE,QAAQ,YAAY,GAAG,CAAC;;;AAI1D,MAAa,SACX,WAAW,KAAK,IAAI,aAAa,QAAQ,QAAQ,IAAI,KAAK;;;;;;;AAQ5D,SAAgB,kBAAkB,MAAc;AAC9C,QAAO;EAAC;EAAO;EAAe;EAAO;EAAc,CAAC,SAClD,MAAM,aAAa,EAAE,QAAQ,YAAY,GAAG,CAC7C;;;AAIH,MAAa,gBAAgB,kBAAkB,KAAK,IAAI;;AAqBxD,MAAa,YACX,QAAQ,QAAQ,IAAI,QAAQ,IAAI,MAAM,IAAI,UAAU,CAAC;;AAGvD,MAAa,YAAY,QAAQ,KAAK,SAAS;;AAG/C,MAAa,UAAU,UAAU,KAAK,SAAS;;AAG/C,MAAa,UAAU,WAAW,KAAK,SAAS;;AAGhD,MAAa,mBACX,CAAC,QAAQ,IAAI,aACZ,QAAQ,QAAQ,IAAI,YAAY,KAC7B,UAAU,cAAc,QAAQ,IAAI,SAAS,UAC/C,MAAM;;AA6GV,MAAa,eACV,SAAS,UAAU,QAAQ,IAAI,QAAQ,MAAM,GAAG,IAAI;AAEvD,MAAa,mBAAmB,OAAO,aAAa,MAAM,IAAI,CAAC,GAAG,IAAI"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
require('../../string-format/src/title-case.cjs');
|
|
3
|
-
let node_os = require("node:os");
|
|
4
|
-
node_os = require_runtime.__toESM(node_os, 1);
|
|
5
|
-
|
|
6
|
-
//#region ../env/src/get-env-paths.ts
|
|
7
|
-
const homedir = node_os.default.homedir();
|
|
8
|
-
const tmpdir = node_os.default.tmpdir();
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import "../../string-format/src/title-case.mjs";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import "node:path";
|
|
4
|
-
|
|
5
|
-
//#region ../env/src/get-env-paths.ts
|
|
6
|
-
const homedir = os.homedir();
|
|
7
|
-
const tmpdir = os.tmpdir();
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
//# sourceMappingURL=get-env-paths.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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":";;;;;AAyBA,MAAM,UAAU,GAAG,SAAS;AAC5B,MAAM,SAAS,GAAG,QAAQ"}
|