mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 19:12:40 +08:00
810de3fe68
* add constant type for number * support number type of build time constant * publish 4.3.11 * update test * support genCCEnvConstants && publish 4.3.12 * NET_MODE is public, SERVER_MODE is private * update deps * fix exportDynamicConstants * update test * publish 4.3.14 * update deps * support JIT is not dynamic * update lock
429 lines
8.1 KiB
Plaintext
429 lines
8.1 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`exportDynamicConstants 1`] = `
|
|
"function tryDefineGlobal (name, value) {
|
|
const _global = typeof window === 'undefined' ? global : window;
|
|
if (typeof _global[name] === 'undefined') {
|
|
return (_global[name] = value);
|
|
} else {
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
return _global[name];
|
|
}
|
|
}
|
|
function defined (name) {
|
|
const _global = typeof window === 'undefined' ? global : window;
|
|
return typeof _global[name] === 'object';
|
|
}
|
|
|
|
export const TEST = tryDefineGlobal('CC_TEST', defined('tap') || defined('QUnit'));
|
|
export const EDITOR = tryDefineGlobal('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions));
|
|
export const PREVIEW = tryDefineGlobal('CC_PREVIEW', !EDITOR);
|
|
export const JSB = tryDefineGlobal('CC_JSB', defined('jsb'));
|
|
export const NATIVE = JSB;
|
|
export const HTML5 = !(EDITOR && NATIVE);
|
|
export const DEV = tryDefineGlobal('CC_DEV', true);
|
|
|
|
export const WECHAT = true;
|
|
tryDefineGlobal('CC_WECHAT', true);
|
|
|
|
export const BAIDU = false;
|
|
tryDefineGlobal('CC_BAIDU', false);
|
|
|
|
export const XIAOMI = false;
|
|
tryDefineGlobal('CC_XIAOMI', false);
|
|
|
|
export const ALIPAY = false;
|
|
tryDefineGlobal('CC_ALIPAY', false);
|
|
|
|
export const BYTEDANCE = false;
|
|
tryDefineGlobal('CC_BYTEDANCE', false);
|
|
|
|
export const OPPO = false;
|
|
tryDefineGlobal('CC_OPPO', false);
|
|
|
|
export const VIVO = false;
|
|
tryDefineGlobal('CC_VIVO', false);
|
|
|
|
export const HUAWEI = false;
|
|
tryDefineGlobal('CC_HUAWEI', false);
|
|
|
|
export const COCOSPLAY = false;
|
|
tryDefineGlobal('CC_COCOSPLAY', false);
|
|
|
|
export const QTT = false;
|
|
tryDefineGlobal('CC_QTT', false);
|
|
|
|
export const LINKSURE = false;
|
|
tryDefineGlobal('CC_LINKSURE', false);
|
|
|
|
export const BUILD = true;
|
|
tryDefineGlobal('CC_BUILD', true);
|
|
|
|
export const DEBUG = true;
|
|
tryDefineGlobal('CC_DEBUG', true);
|
|
|
|
export const MINIGAME = true;
|
|
tryDefineGlobal('CC_MINIGAME', true);
|
|
|
|
export const RUNTIME_BASED = false;
|
|
tryDefineGlobal('CC_RUNTIME_BASED', false);
|
|
|
|
export const NET_MODE = 0;
|
|
|
|
"
|
|
`;
|
|
|
|
exports[`exportStaticConstants 1`] = `
|
|
"function tryDefineGlobal (name, value) {
|
|
const _global = typeof window === 'undefined' ? global : window;
|
|
if (typeof _global[name] === 'undefined') {
|
|
return (_global[name] = value);
|
|
} else {
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
return _global[name];
|
|
}
|
|
}
|
|
export const HTML5 = false;
|
|
|
|
export const NATIVE = false;
|
|
|
|
export const WECHAT = true;
|
|
tryDefineGlobal('CC_WECHAT', true);
|
|
|
|
export const BAIDU = false;
|
|
tryDefineGlobal('CC_BAIDU', false);
|
|
|
|
export const XIAOMI = false;
|
|
tryDefineGlobal('CC_XIAOMI', false);
|
|
|
|
export const ALIPAY = false;
|
|
tryDefineGlobal('CC_ALIPAY', false);
|
|
|
|
export const BYTEDANCE = false;
|
|
tryDefineGlobal('CC_BYTEDANCE', false);
|
|
|
|
export const OPPO = false;
|
|
tryDefineGlobal('CC_OPPO', false);
|
|
|
|
export const VIVO = false;
|
|
tryDefineGlobal('CC_VIVO', false);
|
|
|
|
export const HUAWEI = false;
|
|
tryDefineGlobal('CC_HUAWEI', false);
|
|
|
|
export const COCOSPLAY = false;
|
|
tryDefineGlobal('CC_COCOSPLAY', false);
|
|
|
|
export const QTT = false;
|
|
tryDefineGlobal('CC_QTT', false);
|
|
|
|
export const LINKSURE = false;
|
|
tryDefineGlobal('CC_LINKSURE', false);
|
|
|
|
export const EDITOR = false;
|
|
tryDefineGlobal('CC_EDITOR', false);
|
|
|
|
export const PREVIEW = true;
|
|
tryDefineGlobal('CC_PREVIEW', true);
|
|
|
|
export const BUILD = false;
|
|
tryDefineGlobal('CC_BUILD', false);
|
|
|
|
export const TEST = false;
|
|
tryDefineGlobal('CC_TEST', false);
|
|
|
|
export const DEBUG = false;
|
|
tryDefineGlobal('CC_DEBUG', false);
|
|
|
|
export const SERVER_MODE = true;
|
|
|
|
export const DEV = true;
|
|
tryDefineGlobal('CC_DEV', true);
|
|
|
|
export const MINIGAME = true;
|
|
tryDefineGlobal('CC_MINIGAME', true);
|
|
|
|
export const RUNTIME_BASED = false;
|
|
tryDefineGlobal('CC_RUNTIME_BASED', false);
|
|
|
|
export const SUPPORT_JIT = false;
|
|
tryDefineGlobal('CC_SUPPORT_JIT', false);
|
|
|
|
export const JSB = false;
|
|
tryDefineGlobal('CC_JSB', false);
|
|
|
|
export const NOT_PACK_PHYSX_LIBS = false;
|
|
|
|
export const NET_MODE = 0;
|
|
|
|
"
|
|
`;
|
|
|
|
exports[`generateCCEnv 1`] = `
|
|
"declare module 'cc/env'{
|
|
/**
|
|
* Running in Web platform
|
|
*/
|
|
export const HTML5: boolean;
|
|
|
|
/**
|
|
* Running in native platform (mobile app, desktop app, or simulator).
|
|
*/
|
|
export const NATIVE: boolean;
|
|
|
|
/**
|
|
* Running in the Wechat's mini game.
|
|
*/
|
|
export const WECHAT: boolean;
|
|
|
|
/**
|
|
* Running in the baidu's mini game.
|
|
*/
|
|
export const BAIDU: boolean;
|
|
|
|
/**
|
|
* Running in the xiaomi's quick game.
|
|
*/
|
|
export const XIAOMI: boolean;
|
|
|
|
/**
|
|
* Running in the alipay's mini game.
|
|
*/
|
|
export const ALIPAY: boolean;
|
|
|
|
/**
|
|
* Running in the ByteDance's mini game.
|
|
*/
|
|
export const BYTEDANCE: boolean;
|
|
|
|
/**
|
|
* Running in the oppo's quick game.
|
|
*/
|
|
export const OPPO: boolean;
|
|
|
|
/**
|
|
* Running in the vivo's quick game.
|
|
*/
|
|
export const VIVO: boolean;
|
|
|
|
/**
|
|
* Running in the huawei's quick game.
|
|
*/
|
|
export const HUAWEI: boolean;
|
|
|
|
/**
|
|
* Running in the cocosplay.
|
|
*/
|
|
export const COCOSPLAY: boolean;
|
|
|
|
/**
|
|
* Running in the qtt's quick game.
|
|
*/
|
|
export const QTT: boolean;
|
|
|
|
/**
|
|
* Running in the linksure's quick game.
|
|
*/
|
|
export const LINKSURE: boolean;
|
|
|
|
/**
|
|
* Running in the editor.
|
|
*/
|
|
export const EDITOR: boolean;
|
|
|
|
/**
|
|
* Preview in browser or simulator.
|
|
*/
|
|
export const PREVIEW: boolean;
|
|
|
|
/**
|
|
* Running in published project.
|
|
*/
|
|
export const BUILD: boolean;
|
|
|
|
/**
|
|
* Running in the engine's unit test.
|
|
*/
|
|
export const TEST: boolean;
|
|
|
|
/**
|
|
* Running debug mode.
|
|
*/
|
|
export const DEBUG: boolean;
|
|
|
|
/**
|
|
* Running in the editor or preview.
|
|
*/
|
|
export const DEV: boolean;
|
|
|
|
/**
|
|
* Running in mini game.
|
|
*/
|
|
export const MINIGAME: boolean;
|
|
|
|
/**
|
|
* Running in runtime based environment.
|
|
*/
|
|
export const RUNTIME_BASED: boolean;
|
|
|
|
/**
|
|
* Support JIT.
|
|
*/
|
|
export const SUPPORT_JIT: boolean;
|
|
|
|
/**
|
|
* Running in environment where using JSB as the JavaScript interface binding scheme.
|
|
*/
|
|
export const JSB: boolean;
|
|
|
|
/**
|
|
* The network access mode.
|
|
* - 0 Client
|
|
* - 1 ListenServer
|
|
* - 2 HostServer
|
|
*/
|
|
export const NET_MODE: number;
|
|
|
|
}
|
|
"
|
|
`;
|
|
|
|
exports[`generateInternalConstants 1`] = `
|
|
"declare module 'internal:constants'{
|
|
/**
|
|
* Running in Web platform
|
|
*/
|
|
export const HTML5: boolean;
|
|
|
|
/**
|
|
* Running in native platform (mobile app, desktop app, or simulator).
|
|
*/
|
|
export const NATIVE: boolean;
|
|
|
|
/**
|
|
* Running in the Wechat's mini game.
|
|
*/
|
|
export const WECHAT: boolean;
|
|
|
|
/**
|
|
* Running in the baidu's mini game.
|
|
*/
|
|
export const BAIDU: boolean;
|
|
|
|
/**
|
|
* Running in the xiaomi's quick game.
|
|
*/
|
|
export const XIAOMI: boolean;
|
|
|
|
/**
|
|
* Running in the alipay's mini game.
|
|
*/
|
|
export const ALIPAY: boolean;
|
|
|
|
/**
|
|
* Running in the ByteDance's mini game.
|
|
*/
|
|
export const BYTEDANCE: boolean;
|
|
|
|
/**
|
|
* Running in the oppo's quick game.
|
|
*/
|
|
export const OPPO: boolean;
|
|
|
|
/**
|
|
* Running in the vivo's quick game.
|
|
*/
|
|
export const VIVO: boolean;
|
|
|
|
/**
|
|
* Running in the huawei's quick game.
|
|
*/
|
|
export const HUAWEI: boolean;
|
|
|
|
/**
|
|
* Running in the cocosplay.
|
|
*/
|
|
export const COCOSPLAY: boolean;
|
|
|
|
/**
|
|
* Running in the qtt's quick game.
|
|
*/
|
|
export const QTT: boolean;
|
|
|
|
/**
|
|
* Running in the linksure's quick game.
|
|
*/
|
|
export const LINKSURE: boolean;
|
|
|
|
/**
|
|
* Running in the editor.
|
|
*/
|
|
export const EDITOR: boolean;
|
|
|
|
/**
|
|
* Preview in browser or simulator.
|
|
*/
|
|
export const PREVIEW: boolean;
|
|
|
|
/**
|
|
* Running in published project.
|
|
*/
|
|
export const BUILD: boolean;
|
|
|
|
/**
|
|
* Running in the engine's unit test.
|
|
*/
|
|
export const TEST: boolean;
|
|
|
|
/**
|
|
* Running debug mode.
|
|
*/
|
|
export const DEBUG: boolean;
|
|
|
|
/**
|
|
* Running in the server mode.
|
|
*/
|
|
export const SERVER_MODE: boolean;
|
|
|
|
/**
|
|
* Running in the editor or preview.
|
|
*/
|
|
export const DEV: boolean;
|
|
|
|
/**
|
|
* Running in mini game.
|
|
*/
|
|
export const MINIGAME: boolean;
|
|
|
|
/**
|
|
* Running in runtime based environment.
|
|
*/
|
|
export const RUNTIME_BASED: boolean;
|
|
|
|
/**
|
|
* Support JIT.
|
|
*/
|
|
export const SUPPORT_JIT: boolean;
|
|
|
|
/**
|
|
* Running in environment where using JSB as the JavaScript interface binding scheme.
|
|
*/
|
|
export const JSB: boolean;
|
|
|
|
/**
|
|
* This is an internal constant to determine whether pack physx libs.
|
|
*/
|
|
export const NOT_PACK_PHYSX_LIBS: boolean;
|
|
|
|
/**
|
|
* The network access mode.
|
|
* - 0 Client
|
|
* - 1 ListenServer
|
|
* - 2 HostServer
|
|
*/
|
|
export const NET_MODE: number;
|
|
|
|
}
|
|
"
|
|
`;
|