@cocos/ccbuild 1.1.6 → 1.1.8

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +14 -14
  3. package/lib/api-builder.js +1 -1
  4. package/lib/build-engine/engine-js/index.d.ts +2 -2
  5. package/lib/build-engine/engine-js/index.js +412 -412
  6. package/lib/build-engine/engine-js/index.js.map +1 -1
  7. package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.d.ts +43 -40
  8. package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.d.ts.map +1 -1
  9. package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.js +151 -92
  10. package/lib/build-engine/engine-js/rollup-plugins/external-wasm-loader.js.map +1 -1
  11. package/lib/build-engine/engine-js/rollup-plugins/remove-deprecated-features.d.ts +2 -2
  12. package/lib/build-engine/engine-js/rollup-plugins/remove-deprecated-features.js +37 -37
  13. package/lib/build-engine/engine-js/rollup-plugins/ts-paths.d.ts +4 -4
  14. package/lib/build-engine/engine-js/rollup-plugins/ts-paths.js +42 -42
  15. package/lib/build-engine/engine-ts/engine-builder.d.ts +57 -57
  16. package/lib/build-engine/engine-ts/engine-builder.js +631 -631
  17. package/lib/build-engine/engine-ts/field-decorator-helper.d.ts +9 -9
  18. package/lib/build-engine/engine-ts/field-decorator-helper.js +54 -54
  19. package/lib/build-engine/engine-ts/index.d.ts +2 -2
  20. package/lib/build-engine/engine-ts/index.js +34 -34
  21. package/lib/build-engine/engine-ts/plugins/external-wasm-loader.d.ts +6 -6
  22. package/lib/build-engine/engine-ts/plugins/external-wasm-loader.js +65 -65
  23. package/lib/build-engine/engine-ts/plugins/interface.d.ts +20 -20
  24. package/lib/build-engine/engine-ts/plugins/interface.js +1 -1
  25. package/lib/build-engine/index.d.ts +130 -130
  26. package/lib/build-engine/index.js +138 -138
  27. package/lib/index.d.ts +4 -4
  28. package/lib/index.js +33 -33
  29. package/lib/module-resolver.d.ts +7 -7
  30. package/lib/module-resolver.js +28 -28
  31. package/lib/stats-query/config-interface.d.ts +129 -129
  32. package/lib/stats-query/config-interface.js +3 -3
  33. package/lib/stats-query/index.d.ts +163 -163
  34. package/lib/stats-query/index.js +531 -531
  35. package/lib/stats-query/path-utils.d.ts +2 -2
  36. package/lib/stats-query/path-utils.js +35 -35
  37. package/lib/transformer/babel.d.ts +5 -5
  38. package/lib/transformer/babel.js +34 -34
  39. package/lib/transformer/index.d.ts +2 -2
  40. package/lib/transformer/index.js +28 -28
  41. package/lib/utils.d.ts +3 -3
  42. package/lib/utils.js +19 -19
  43. package/package.json +2 -2
  44. package/static/helper-dynamic-constants.txt +13 -13
  45. package/static/helper-file-decorator.ts +20 -20
  46. package/static/helper-global-exporter.txt +8 -8
  47. package/static/lib.dom.d.ts +20227 -20227
@@ -1,10 +1,10 @@
1
- import { BabelFile, types as t } from "@babel/core";
2
- export declare class FiledDecoratorHelper {
3
- private _moduleName;
4
- private _moduleSource?;
5
- private _file2NamedIdentifier;
6
- getModuleName(): string;
7
- genModuleSource(): string;
8
- addHelper(file: BabelFile): t.Identifier;
9
- }
1
+ import { BabelFile, types as t } from "@babel/core";
2
+ export declare class FiledDecoratorHelper {
3
+ private _moduleName;
4
+ private _moduleSource?;
5
+ private _file2NamedIdentifier;
6
+ getModuleName(): string;
7
+ genModuleSource(): string;
8
+ addHelper(file: BabelFile): t.Identifier;
9
+ }
10
10
  //# sourceMappingURL=field-decorator-helper.d.ts.map
@@ -1,55 +1,55 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.FiledDecoratorHelper = void 0;
27
- const fs = __importStar(require("fs-extra"));
28
- const ps = __importStar(require("path"));
29
- const helper_module_imports_1 = require("@babel/helper-module-imports");
30
- class FiledDecoratorHelper {
31
- constructor() {
32
- this._moduleName = 'CCBUILD_HELPER_MODULE';
33
- this._file2NamedIdentifier = new WeakMap();
34
- }
35
- getModuleName() {
36
- return this._moduleName;
37
- }
38
- genModuleSource() {
39
- if (this._moduleSource) {
40
- return this._moduleSource;
41
- }
42
- return this._moduleSource = fs.readFileSync(ps.join(__dirname, '../../../static/helper-file-decorator.ts'), 'utf8');
43
- }
44
- addHelper(file) {
45
- let namedIdentifier = this._file2NamedIdentifier.get(file);
46
- if (namedIdentifier) {
47
- return namedIdentifier;
48
- }
49
- namedIdentifier = (0, helper_module_imports_1.addNamed)(file.path, 'CCBuildTsFieldDecoratorHelper', this._moduleName);
50
- this._file2NamedIdentifier.set(file, namedIdentifier);
51
- return namedIdentifier;
52
- }
53
- }
54
- exports.FiledDecoratorHelper = FiledDecoratorHelper;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.FiledDecoratorHelper = void 0;
27
+ const fs = __importStar(require("fs-extra"));
28
+ const ps = __importStar(require("path"));
29
+ const helper_module_imports_1 = require("@babel/helper-module-imports");
30
+ class FiledDecoratorHelper {
31
+ constructor() {
32
+ this._moduleName = 'CCBUILD_HELPER_MODULE';
33
+ this._file2NamedIdentifier = new WeakMap();
34
+ }
35
+ getModuleName() {
36
+ return this._moduleName;
37
+ }
38
+ genModuleSource() {
39
+ if (this._moduleSource) {
40
+ return this._moduleSource;
41
+ }
42
+ return this._moduleSource = fs.readFileSync(ps.join(__dirname, '../../../static/helper-file-decorator.ts'), 'utf8');
43
+ }
44
+ addHelper(file) {
45
+ let namedIdentifier = this._file2NamedIdentifier.get(file);
46
+ if (namedIdentifier) {
47
+ return namedIdentifier;
48
+ }
49
+ namedIdentifier = (0, helper_module_imports_1.addNamed)(file.path, 'CCBuildTsFieldDecoratorHelper', this._moduleName);
50
+ this._file2NamedIdentifier.set(file, namedIdentifier);
51
+ return namedIdentifier;
52
+ }
53
+ }
54
+ exports.FiledDecoratorHelper = FiledDecoratorHelper;
55
55
  //# sourceMappingURL=field-decorator-helper.js.map
@@ -1,3 +1,3 @@
1
- import type { buildEngine } from '../index';
2
- export declare function buildTsEngine(options: buildEngine.Options): Promise<buildEngine.Result>;
1
+ import type { buildEngine } from '../index';
2
+ export declare function buildTsEngine(options: buildEngine.Options): Promise<buildEngine.Result>;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,35 +1,35 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.buildTsEngine = void 0;
13
- const engine_builder_1 = require("./engine-builder");
14
- function buildTsEngine(options) {
15
- var _a;
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const builder = new engine_builder_1.EngineBuilder();
18
- yield builder.build({
19
- root: options.engine,
20
- platform: options.platform,
21
- features: options.features,
22
- mode: options.mode,
23
- flagConfig: (_a = options.flags) !== null && _a !== void 0 ? _a : {},
24
- outDir: options.out,
25
- });
26
- // NOTE: here we return a fixed result.
27
- return {
28
- exports: {},
29
- chunkAliases: { cc: './system-cc.js' },
30
- hasCriticalWarns: false,
31
- };
32
- });
33
- }
34
- exports.buildTsEngine = buildTsEngine;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.buildTsEngine = void 0;
13
+ const engine_builder_1 = require("./engine-builder");
14
+ function buildTsEngine(options) {
15
+ var _a;
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const builder = new engine_builder_1.EngineBuilder();
18
+ yield builder.build({
19
+ root: options.engine,
20
+ platform: options.platform,
21
+ features: options.features,
22
+ mode: options.mode,
23
+ flagConfig: (_a = options.flags) !== null && _a !== void 0 ? _a : {},
24
+ outDir: options.out,
25
+ });
26
+ // NOTE: here we return a fixed result.
27
+ return {
28
+ exports: {},
29
+ chunkAliases: { cc: './system-cc.js' },
30
+ hasCriticalWarns: false,
31
+ };
32
+ });
33
+ }
34
+ exports.buildTsEngine = buildTsEngine;
35
35
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
- export declare function externalWasmLoaderFactory(options: externalWasmLoaderFactory.Options): ITsEnginePlugin;
2
- export declare namespace externalWasmLoaderFactory {
3
- interface Options {
4
- engineRoot: string;
5
- }
6
- }
1
+ export declare function externalWasmLoaderFactory(options: externalWasmLoaderFactory.Options): ITsEnginePlugin;
2
+ export declare namespace externalWasmLoaderFactory {
3
+ interface Options {
4
+ engineRoot: string;
5
+ }
6
+ }
7
7
  //# sourceMappingURL=external-wasm-loader.d.ts.map
@@ -1,66 +1,66 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.externalWasmLoaderFactory = void 0;
27
- const fs = __importStar(require("fs-extra"));
28
- const ps = __importStar(require("path"));
29
- const externalOrigin = 'external:';
30
- function externalWasmLoaderFactory(options) {
31
- const externalWasmLoader = {
32
- resolve(id, importer) {
33
- if (id.startsWith(externalOrigin)) {
34
- return id;
35
- }
36
- return undefined;
37
- },
38
- load(id) {
39
- if (id.startsWith(externalOrigin)) {
40
- if (id.endsWith('.wasm')) {
41
- return `export default 'WebAssembly is not supported !'`;
42
- }
43
- else {
44
- const filePath = ps.join(options.engineRoot, id.replace(externalOrigin, 'native/external/'));
45
- return fs.readFileSync(filePath, 'utf8');
46
- }
47
- }
48
- return undefined;
49
- },
50
- transformId(id, importer) {
51
- if (id.startsWith(externalOrigin)) {
52
- if (id.endsWith('.wasm')) {
53
- // we generate a ts file to throw an message that we don't support wasm for now
54
- return ps.join(options.engineRoot, id.replace(externalOrigin, 'native/external/') + '.ts');
55
- }
56
- else {
57
- return ps.join(options.engineRoot, id.replace(externalOrigin, 'native/external/'));
58
- }
59
- }
60
- return undefined;
61
- }
62
- };
63
- return externalWasmLoader;
64
- }
65
- exports.externalWasmLoaderFactory = externalWasmLoaderFactory;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.externalWasmLoaderFactory = void 0;
27
+ const fs = __importStar(require("fs-extra"));
28
+ const ps = __importStar(require("path"));
29
+ const externalOrigin = 'external:';
30
+ function externalWasmLoaderFactory(options) {
31
+ const externalWasmLoader = {
32
+ resolve(id, importer) {
33
+ if (id.startsWith(externalOrigin)) {
34
+ return id;
35
+ }
36
+ return undefined;
37
+ },
38
+ load(id) {
39
+ if (id.startsWith(externalOrigin)) {
40
+ if (id.endsWith('.wasm')) {
41
+ return `export default 'WebAssembly is not supported !'`;
42
+ }
43
+ else {
44
+ const filePath = ps.join(options.engineRoot, id.replace(externalOrigin, 'native/external/'));
45
+ return fs.readFileSync(filePath, 'utf8');
46
+ }
47
+ }
48
+ return undefined;
49
+ },
50
+ transformId(id, importer) {
51
+ if (id.startsWith(externalOrigin)) {
52
+ if (id.endsWith('.wasm')) {
53
+ // we generate a ts file to throw an message that we don't support wasm for now
54
+ return ps.join(options.engineRoot, id.replace(externalOrigin, 'native/external/') + '.ts');
55
+ }
56
+ else {
57
+ return ps.join(options.engineRoot, id.replace(externalOrigin, 'native/external/'));
58
+ }
59
+ }
60
+ return undefined;
61
+ }
62
+ };
63
+ return externalWasmLoader;
64
+ }
65
+ exports.externalWasmLoaderFactory = externalWasmLoaderFactory;
66
66
  //# sourceMappingURL=external-wasm-loader.js.map
@@ -1,21 +1,21 @@
1
- interface ITsEnginePlugin {
2
- /**
3
- * The hook to resolve id, return `null` if this plugin cannot handle this script.
4
- * @param id
5
- * @param importer
6
- */
7
- resolve?(id: string, importer?: string): string | void;
8
- /**
9
- * The hook to load script, return `null` if this plugin cannot handle this script.
10
- * @param id
11
- */
12
- load?(id: string): string | void;
13
- /**
14
- * The hook to transform id, return the absolute file path or null.
15
- * This is useful when we transform a virtual module id to an absolute file path.
16
- * eg. transform `internal:constants` to `filePath/__virtual__/internal_constants.ts`
17
- * @param id
18
- */
19
- transformId?(id: string, importer?: string): string | void;
20
- }
1
+ interface ITsEnginePlugin {
2
+ /**
3
+ * The hook to resolve id, return `null` if this plugin cannot handle this script.
4
+ * @param id
5
+ * @param importer
6
+ */
7
+ resolve?(id: string, importer?: string): string | void;
8
+ /**
9
+ * The hook to load script, return `null` if this plugin cannot handle this script.
10
+ * @param id
11
+ */
12
+ load?(id: string): string | void;
13
+ /**
14
+ * The hook to transform id, return the absolute file path or null.
15
+ * This is useful when we transform a virtual module id to an absolute file path.
16
+ * eg. transform `internal:constants` to `filePath/__virtual__/internal_constants.ts`
17
+ * @param id
18
+ */
19
+ transformId?(id: string, importer?: string): string | void;
20
+ }
21
21
  //# sourceMappingURL=interface.d.ts.map
@@ -1,2 +1,2 @@
1
- "use strict";
1
+ "use strict";
2
2
  //# sourceMappingURL=interface.js.map