@ray-js/env 0.3.0-beta.1c347991

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @ray-js/env
package/cjs/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { isNative, isIOS, isAndroid, isMiniProgram, isTuya, isWechat, isWeb } from './platform';
2
+ export { isNative, isIOS, isAndroid, isMiniProgram, isTuya, isWechat, isWeb };
3
+ declare const _default: {
4
+ isWeb: boolean;
5
+ isWechat: boolean;
6
+ isTuya: boolean;
7
+ isMiniProgram: boolean;
8
+ isIOS: boolean;
9
+ isAndroid: boolean;
10
+ isNative: boolean;
11
+ };
12
+ export default _default;
package/cjs/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWeb = exports.isWechat = exports.isTuya = exports.isMiniProgram = exports.isAndroid = exports.isIOS = exports.isNative = void 0;
4
+ var platform_1 = require("./platform");
5
+ Object.defineProperty(exports, "isNative", { enumerable: true, get: function () { return platform_1.isNative; } });
6
+ Object.defineProperty(exports, "isIOS", { enumerable: true, get: function () { return platform_1.isIOS; } });
7
+ Object.defineProperty(exports, "isAndroid", { enumerable: true, get: function () { return platform_1.isAndroid; } });
8
+ Object.defineProperty(exports, "isMiniProgram", { enumerable: true, get: function () { return platform_1.isMiniProgram; } });
9
+ Object.defineProperty(exports, "isTuya", { enumerable: true, get: function () { return platform_1.isTuya; } });
10
+ Object.defineProperty(exports, "isWechat", { enumerable: true, get: function () { return platform_1.isWechat; } });
11
+ Object.defineProperty(exports, "isWeb", { enumerable: true, get: function () { return platform_1.isWeb; } });
12
+ exports.default = {
13
+ isWeb: platform_1.isWeb,
14
+ isWechat: platform_1.isWechat,
15
+ isTuya: platform_1.isTuya,
16
+ isMiniProgram: platform_1.isWechat || platform_1.isTuya,
17
+ isIOS: platform_1.isIOS,
18
+ isAndroid: platform_1.isAndroid,
19
+ isNative: platform_1.isNative,
20
+ };
@@ -0,0 +1,7 @@
1
+ export declare const isWeb: boolean;
2
+ export declare const isWechat: boolean;
3
+ export declare const isTuya: boolean;
4
+ export declare const isMiniProgram: boolean;
5
+ export declare const isNative = false;
6
+ export declare const isAndroid = false;
7
+ export declare const isIOS = false;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIOS = exports.isAndroid = exports.isNative = exports.isMiniProgram = exports.isTuya = exports.isWechat = exports.isWeb = void 0;
4
+ // @ts-nocheck
5
+ exports.isWeb = typeof window !== 'undefined' && 'onload' in window;
6
+ exports.isWechat = typeof wx !== 'undefined' &&
7
+ wx !== null &&
8
+ (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
9
+ exports.isTuya = typeof ty !== 'undefined' && ty !== null;
10
+ exports.isMiniProgram = exports.isWechat || exports.isTuya;
11
+ exports.isNative = false;
12
+ exports.isAndroid = false;
13
+ exports.isIOS = false;
@@ -0,0 +1,7 @@
1
+ export declare const isWeb = false;
2
+ export declare const isWechat = false;
3
+ export declare const isTuya = false;
4
+ export declare const isMiniProgram = false;
5
+ export declare const isNative = true;
6
+ export declare const isIOS: boolean;
7
+ export declare const isAndroid: boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isAndroid = exports.isIOS = exports.isNative = exports.isMiniProgram = exports.isTuya = exports.isWechat = exports.isWeb = void 0;
5
+ var react_native_1 = require("react-native");
6
+ exports.isWeb = false;
7
+ exports.isWechat = false;
8
+ exports.isTuya = false;
9
+ exports.isMiniProgram = false;
10
+ exports.isNative = true;
11
+ exports.isIOS = react_native_1.Platform.OS === 'ios';
12
+ exports.isAndroid = react_native_1.Platform.OS === 'android';
package/esm/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { isNative, isIOS, isAndroid, isMiniProgram, isTuya, isWechat, isWeb } from './platform';
2
+ export { isNative, isIOS, isAndroid, isMiniProgram, isTuya, isWechat, isWeb };
3
+ declare const _default: {
4
+ isWeb: boolean;
5
+ isWechat: boolean;
6
+ isTuya: boolean;
7
+ isMiniProgram: boolean;
8
+ isIOS: boolean;
9
+ isAndroid: boolean;
10
+ isNative: boolean;
11
+ };
12
+ export default _default;
package/esm/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import { isNative, isIOS, isAndroid, isMiniProgram, isTuya, isWechat, isWeb } from './platform';
2
+ export { isNative, isIOS, isAndroid, isMiniProgram, isTuya, isWechat, isWeb };
3
+ export default {
4
+ isWeb: isWeb,
5
+ isWechat: isWechat,
6
+ isTuya: isTuya,
7
+ isMiniProgram: isWechat || isTuya,
8
+ isIOS: isIOS,
9
+ isAndroid: isAndroid,
10
+ isNative: isNative,
11
+ };
@@ -0,0 +1,7 @@
1
+ export declare const isWeb: boolean;
2
+ export declare const isWechat: boolean;
3
+ export declare const isTuya: boolean;
4
+ export declare const isMiniProgram: boolean;
5
+ export declare const isNative = false;
6
+ export declare const isAndroid = false;
7
+ export declare const isIOS = false;
@@ -0,0 +1,10 @@
1
+ // @ts-nocheck
2
+ export const isWeb = typeof window !== 'undefined' && 'onload' in window;
3
+ export const isWechat = typeof wx !== 'undefined' &&
4
+ wx !== null &&
5
+ (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
6
+ export const isTuya = typeof ty !== 'undefined' && ty !== null;
7
+ export const isMiniProgram = isWechat || isTuya;
8
+ export const isNative = false;
9
+ export const isAndroid = false;
10
+ export const isIOS = false;
@@ -0,0 +1,7 @@
1
+ export declare const isWeb = false;
2
+ export declare const isWechat = false;
3
+ export declare const isTuya = false;
4
+ export declare const isMiniProgram = false;
5
+ export declare const isNative = true;
6
+ export declare const isIOS: boolean;
7
+ export declare const isAndroid: boolean;
@@ -0,0 +1,9 @@
1
+ // @ts-nocheck
2
+ import { Platform } from 'react-native';
3
+ export const isWeb = false;
4
+ export const isWechat = false;
5
+ export const isTuya = false;
6
+ export const isMiniProgram = false;
7
+ export const isNative = true;
8
+ export const isIOS = Platform.OS === 'ios';
9
+ export const isAndroid = Platform.OS === 'android';
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@ray-js/env",
3
+ "version": "0.3.0-beta.1c347991",
4
+ "description": "Ray runtime environment",
5
+ "keywords": [
6
+ "ray"
7
+ ],
8
+ "author": "子长 <zichang.nong@tuya.com>",
9
+ "license": "MIT",
10
+ "main": "cjs/index.js",
11
+ "module": "esm/index.js",
12
+ "files": [
13
+ "cjs",
14
+ "esm"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org"
19
+ },
20
+ "scripts": {
21
+ "clean": "rm -rf cjs esm",
22
+ "build": "yarn build:cjs && yarn build:esm",
23
+ "build:cjs": "tsc -p ./tsconfig.build.json --target es5 --module commonjs --outDir cjs",
24
+ "build:esm": "tsc -p ./tsconfig.build.json --target es6 --module esnext --outDir esm",
25
+ "watch": "concurrently 'yarn build:cjs --watch' 'yarn build:esm --watch'"
26
+ },
27
+ "maintainers": [
28
+ {
29
+ "name": "tuyafe",
30
+ "email": "tuyafe@tuya.com"
31
+ }
32
+ ],
33
+ "devDependencies": {
34
+ "concurrently": "^7.0.0"
35
+ },
36
+ "gitHead": "e0bd013022ddda63380d3c9e20fd8cadb46cd61f",
37
+ "repository": {}
38
+ }