@cocos/ccbuild 1.0.0-alpha.2 → 1.0.0-alpha.3

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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@cocos/ccbuild",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.3",
4
4
  "description": "The next generation of build tool for Cocos engine.",
5
5
  "main": "./lib/index.js",
6
6
  "scripts": {
7
7
  "test": "jest"
8
8
  },
9
9
  "files": [
10
- "lib/**/*"
10
+ "lib/**/*",
11
+ "static/**/*"
11
12
  ],
12
13
  "repository": {
13
14
  "type": "git",
@@ -0,0 +1,12 @@
1
+ function defined (name) {
2
+ const _global = typeof window === 'undefined' ? global : window;
3
+ return typeof _global[name] === 'object';
4
+ }
5
+
6
+ export const TEST = tryDefineGlobal('CC_TEST', defined('tap') || defined('QUnit'));
7
+ export const EDITOR = tryDefineGlobal('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions));
8
+ export const PREVIEW = tryDefineGlobal('CC_PREVIEW', !EDITOR);
9
+ export const JSB = tryDefineGlobal('CC_JSB', defined('jsb'));
10
+ export const NATIVE = JSB;
11
+ export const HTML5 = !(EDITOR && NATIVE);
12
+ export const DEV = tryDefineGlobal('CC_DEV', true);
@@ -0,0 +1,9 @@
1
+ function tryDefineGlobal (name, value) {
2
+ const _global = typeof window === 'undefined' ? global : window;
3
+ if (typeof _global[name] === 'undefined') {
4
+ return (_global[name] = value);
5
+ } else {
6
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
7
+ return _global[name];
8
+ }
9
+ }