@tamagui/use-force-update 1.0.1-beta.98 → 1.0.1-rc.0

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/cjs/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -17,15 +18,20 @@ var __copyProps = (to, from, except, desc) => {
17
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
19
  var src_exports = {};
19
20
  __export(src_exports, {
21
+ isServerSide: () => isServerSide,
20
22
  useForceUpdate: () => useForceUpdate
21
23
  });
22
24
  module.exports = __toCommonJS(src_exports);
23
25
  var import_react = require("react");
26
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
27
+ const idFn = () => {
28
+ };
24
29
  function useForceUpdate() {
25
- return (0, import_react.useReducer)((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
30
+ return isServerSide ? idFn : (0, import_react.useReducer)((x) => x + 1, 0)[1];
26
31
  }
27
32
  // Annotate the CommonJS export names for ESM import in node:
28
33
  0 && (module.exports = {
34
+ isServerSide,
29
35
  useForceUpdate
30
36
  });
31
37
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAEpB,0BAA0B;AAC/B,SAAO,6BAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nconst idFn = () => {}\n\nexport function useForceUpdate() {\n return isServerSide ? idFn : (useReducer((x) => x + 1, 0)[1] as () => void)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAEpB,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAEtF,MAAM,OAAO,MAAM;AAAC;AAEb,SAAS,iBAAiB;AAC/B,SAAO,eAAe,WAAQ,yBAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AAC5D;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,8 +1,12 @@
1
1
  import { useReducer } from "react";
2
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
3
+ const idFn = () => {
4
+ };
2
5
  function useForceUpdate() {
3
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
6
+ return isServerSide ? idFn : useReducer((x) => x + 1, 0)[1];
4
7
  }
5
8
  export {
9
+ isServerSide,
6
10
  useForceUpdate
7
11
  };
8
12
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": "AAAA;AAEO,0BAA0B;AAC/B,SAAO,WAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nconst idFn = () => {}\n\nexport function useForceUpdate() {\n return isServerSide ? idFn : (useReducer((x) => x + 1, 0)[1] as () => void)\n}\n"],
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAEpB,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAEtF,MAAM,OAAO,MAAM;AAAC;AAEb,SAAS,iBAAiB;AAC/B,SAAO,eAAe,OAAQ,WAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AAC5D;",
6
6
  "names": []
7
7
  }
package/dist/jsx/index.js CHANGED
@@ -1,8 +1,12 @@
1
1
  import { useReducer } from "react";
2
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
3
+ const idFn = () => {
4
+ };
2
5
  function useForceUpdate() {
3
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
6
+ return isServerSide ? idFn : useReducer((x) => x + 1, 0)[1];
4
7
  }
5
8
  export {
9
+ isServerSide,
6
10
  useForceUpdate
7
11
  };
8
12
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": "AAAA;AAEO,0BAA0B;AAC/B,SAAO,WAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nconst idFn = () => {}\n\nexport function useForceUpdate() {\n return isServerSide ? idFn : (useReducer((x) => x + 1, 0)[1] as () => void)\n}\n"],
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAEpB,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAEtF,MAAM,OAAO,MAAM;AAAC;AAEb,SAAS,iBAAiB;AAC/B,SAAO,eAAe,OAAQ,WAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AAC5D;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@tamagui/use-force-update",
3
- "version": "1.0.1-beta.98",
3
+ "version": "1.0.1-rc.0",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
7
- "module:jsx": "dist/jsx",
8
7
  "files": [
9
8
  "src",
10
9
  "types",
@@ -13,15 +12,24 @@
13
12
  "scripts": {
14
13
  "build": "tamagui-build",
15
14
  "watch": "tamagui-build --watch",
15
+ "lint": "eslint src",
16
+ "lint:fix": "yarn lint --fix",
16
17
  "clean": "tamagui-build clean",
17
18
  "clean:build": "tamagui-build clean:build"
18
19
  },
20
+ "exports": {
21
+ "./package.json": "./package.json",
22
+ ".": {
23
+ "import": "./dist/esm/index.js",
24
+ "require": "./dist/cjs/index.js"
25
+ }
26
+ },
19
27
  "devDependencies": {
20
- "@tamagui/build": "^1.0.1-beta.98",
21
- "react": "*"
28
+ "@tamagui/build": "^1.0.1-rc.0",
29
+ "react": ">=18"
22
30
  },
23
31
  "peerDependencies": {
24
- "react": "*"
32
+ "react": ">=18"
25
33
  },
26
34
  "publishConfig": {
27
35
  "access": "public"
package/src/index.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { useReducer } from 'react'
2
2
 
3
+ export const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'
4
+
5
+ const idFn = () => {}
6
+
3
7
  export function useForceUpdate() {
4
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]
8
+ return isServerSide ? idFn : (useReducer((x) => x + 1, 0)[1] as () => void)
5
9
  }
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- export declare function useForceUpdate(): import("react").DispatchWithoutAction;
1
+ export declare const isServerSide: boolean;
2
+ export declare function useForceUpdate(): () => void;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,wBAAgB,cAAc,0CAE7B"}