@ubean/shared 0.7.9 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -620,4 +620,14 @@ export interface FirstPaintOwnerConfig {
620
620
  * - `ui.theme === false` 或 `ui.theme.initScript === false`(显式手动注入)
621
621
  */
622
622
  export declare function integrationOwnsFirstPaintScript(config: FirstPaintOwnerConfig): boolean;
623
+ /**
624
+ * 运行环境判据。
625
+ *
626
+ * 全仓统一从 `@ubean/shared` 取(主包 `ubean` 主入口 re-export),不要在业务代码里散写
627
+ * `typeof window` —— 把 `!==` / `===` 写反不会有任何报错,只会让某条分支永远不执行。
628
+ */
629
+ /** 是否运行在浏览器(DOM)环境。SSR / Node / worker 均为 `false`。 */
630
+ export declare function isClient(): boolean;
631
+ /** 是否运行在服务端(无 DOM)环境。SSR / Node / worker 均为 `true`。 */
632
+ export declare function isServer(): boolean;
623
633
  export {};
package/dist/index.js CHANGED
@@ -597,4 +597,19 @@ function integrationOwnsFirstPaintScript(config) {
597
597
  if (typeof options.theme === "object" && options.theme !== null && options.theme.initScript === false) return false;
598
598
  return true;
599
599
  }
600
- export { ACTION_BRAND, ActionError, UbeanError, capitalize, createError, defineEnv, envField, errorToResponse, fail, getBasename, getDirname, getExtension, getStem, integrationOwnsFirstPaintScript, isActionFailure, isEnvFieldMeta, isNodeRuntime, isServerAction, isUbeanError, matchAnyGlob, matchGlob, normalizeEnvSchema, normalizePath, pathToTitle, resolveEnvSchema, setRuntimeEnv, useRuntimeEnv };
600
+ // src/platform.ts
601
+ /**
602
+ * 运行环境判据。
603
+ *
604
+ * 全仓统一从 `@ubean/shared` 取(主包 `ubean` 主入口 re-export),不要在业务代码里散写
605
+ * `typeof window` —— 把 `!==` / `===` 写反不会有任何报错,只会让某条分支永远不执行。
606
+ */
607
+ /** 是否运行在浏览器(DOM)环境。SSR / Node / worker 均为 `false`。 */
608
+ function isClient() {
609
+ return typeof window !== "undefined";
610
+ }
611
+ /** 是否运行在服务端(无 DOM)环境。SSR / Node / worker 均为 `true`。 */
612
+ function isServer() {
613
+ return typeof window === "undefined";
614
+ }
615
+ export { ACTION_BRAND, ActionError, UbeanError, capitalize, createError, defineEnv, envField, errorToResponse, fail, getBasename, getDirname, getExtension, getStem, integrationOwnsFirstPaintScript, isActionFailure, isClient, isEnvFieldMeta, isNodeRuntime, isServer, isServerAction, isUbeanError, matchAnyGlob, matchGlob, normalizeEnvSchema, normalizePath, pathToTitle, resolveEnvSchema, setRuntimeEnv, useRuntimeEnv };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/shared",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
4
4
  "description": "Shared protocol types, errors, env and universal utilities for ubean",
5
5
  "files": [
6
6
  "dist"
@@ -29,13 +29,13 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@standard-schema/spec": "1.1.0",
32
- "hono": "4.13.13",
32
+ "hono": "4.13.14",
33
33
  "pathe": "^2.0.3",
34
34
  "scule": "^1.3.0",
35
35
  "tslog": "^5.4.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/node": "^26.6.5",
38
+ "@types/node": "^26.6.6",
39
39
  "typescript": "npm:typescript-native-bridge@latest",
40
40
  "vite-plus": "1.4.0"
41
41
  },