🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

sunmi-env

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sunmi-env - npm Package Compare versions

Comparing version
2.0.1
to
2.0.2
+13
dist/index.d.ts
export declare const SUNMI_ENV: string;
export declare const NODE_HOST: string;
export declare const isServer: boolean;
export declare const isClient: boolean;
declare let isEncrypted: number;
declare let envHost: (host: string) => string;
declare let md5Key: string | undefined;
declare let DES: {
Iv: string;
Key: string;
};
declare let miniProgramType: any;
export { envHost, isEncrypted, md5Key, DES, miniProgramType };
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACnE,QAAA,SAAS,GAAG,iBAAS,CAAC;AACtB,QAAA,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AACzC,QAAA,QAAQ,GAAG,CAAC,gBAAQ,CAAC;AAElC,OAAO;AACP,IAAI,WAAmB,CAAC;AA4CN,kCAAW;AA3C7B,IAAI,OAAiC,CAAC;AA2C7B,0BAAO;AA1ChB,IAAI,MAA0B,CAAC;AA0CA,wBAAM;AAzCrC,IAAI,GAAgC,CAAC;AAyCE,kBAAG;AAxC1C,IAAI,eAAe,CAAC;AAwCwB,0CAAe;AAtC3D,QAAQ,iBAAS,EAAE;IACjB,KAAK,KAAK,CAAC;IACX,KAAK,MAAM;QACT,sBAAA,WAAW,GAAG,CAAC,CAAC;QAChB,kBAAA,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,WAAW,iBAAS,IAAI,IAAI,EAAE,CAAC;QAC3D,iBAAA,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;QAC9C,cAAA,GAAG,GAAG;YACJ,EAAE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AAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;IAC7B,eAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;CAC9B;AAED,kBAAe,cAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC"}
export const SUNMI_ENV = process.env.SUNMI_ENV || process.env.SUNMI_DEFAULTHOST;
export const NODE_HOST = SUNMI_ENV;
export const isServer = typeof window === 'undefined';
export const isClient = !isServer;
// 是否加密
let isEncrypted: number;
let envHost: (host: string) => string;
let md5Key: string | undefined;
let DES: { Iv: string; Key: string };
let miniProgramType;
switch (SUNMI_ENV) {
case 'dev':
case 'test':
isEncrypted = 0;
envHost = (host: string) => `https://${SUNMI_ENV}.${host}`;
md5Key = process.env.SUNMI_DEVELOPMENT_MD5KEY;
DES = {
Iv: process.env.SUNMI_DEVELOPMENT_DESIV || 'abc',
Key: process.env.SUNMI_DEVELOPMENT_DESKEY || 'abc',
};
// 开发版本
miniProgramType = 1;
break;
case 'uat':
isEncrypted = 1;
envHost = (host: string) => `https://${SUNMI_ENV}.${host}`;
md5Key = process.env.SUNMI_PRODUCTION_MD5KEY;
DES = {
Iv: process.env.SUNMI_PRODUCTION_DESIV || 'abc',
Key: process.env.SUNMI_PRODUCTION_DESKEY || 'abc',
};
// 体验版本
miniProgramType = 2;
break;
case 'pub':
default:
isEncrypted = 1;
envHost = (host: string) => `https://${host}`;
md5Key = process.env.SUNMI_PRODUCTION_MD5KEY;
DES = {
Iv: process.env.SUNMI_PRODUCTION_DESIV || 'abc',
Key: process.env.SUNMI_PRODUCTION_DESKEY || 'abc',
};
// 线上版本
miniProgramType = 0;
break;
}
export { envHost, isEncrypted, md5Key, DES, miniProgramType };
import { config, parse } from 'dotenv';
import * as fs from 'fs';
import * as path from 'path';
const dotenvFile = path.resolve('.env');
if (fs.existsSync(dotenvFile)) {
config({ path: dotenvFile });
}
export default parse(fs.readFileSync(dotenvFile));
{
"compilerOptions": {
/* Basic Options */
"target": "ES2017" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "none" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": [
"dom",
"es6"
] /* Specify library files to be included in the compilation. */,
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
"sourceMap": true /* Generates corresponding '.map' file. */,
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "dist" /* Redirect output structure to the directory. */,
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
// "strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
"baseUrl": "." /* Base directory to resolve non-absolute module names. */,
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": [
"./node_modules/@types"
] /* List of folders to include type definitions from. */,
// "types": [], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
// "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
"skipLibCheck": true,
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */
},
"include": ["./index.ts", "./setup.ts"]
}
+2
-7
{
"name": "sunmi-env",
"version": "2.0.1",
"version": "2.0.2",
"description": "sunmi-env",

@@ -11,7 +11,2 @@ "main": "dist/index.js",

},
"files": [
"./dist",
"setup.js",
"setup.d.ts"
],
"author": "",

@@ -22,3 +17,3 @@ "license": "ISC",

},
"gitHead": "a84bcd83088a6ba66c3fc4b0b772bf9a102cd4e4"
"gitHead": "4a60173d8f7187a2134534f1e8a936aa5ae0b79e"
}