@cocos/ccbuild 1.0.0-alpha.10 → 1.0.0-alpha.11
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/CHANGELOG.md +6 -0
- package/README.md +14 -14
- package/lib/api-builder.js +1 -1
- package/lib/build-engine/engine-js/index.d.ts +2 -2
- package/lib/build-engine/engine-js/index.js +459 -459
- package/lib/build-engine/engine-js/rollup-plugins/asset-ref.d.ts +36 -36
- package/lib/build-engine/engine-js/rollup-plugins/asset-ref.js +87 -87
- package/lib/build-engine/engine-js/rollup-plugins/asset-url.d.ts +7 -7
- package/lib/build-engine/engine-js/rollup-plugins/asset-url.js +92 -92
- package/lib/build-engine/engine-js/rollup-plugins/code-asset.d.ts +28 -28
- package/lib/build-engine/engine-js/rollup-plugins/code-asset.js +135 -135
- package/lib/build-engine/engine-js/rollup-plugins/remove-deprecated-features.d.ts +2 -2
- package/lib/build-engine/engine-js/rollup-plugins/remove-deprecated-features.js +37 -37
- package/lib/build-engine/engine-js/rollup-plugins/ts-paths.d.ts +4 -4
- package/lib/build-engine/engine-js/rollup-plugins/ts-paths.js +42 -42
- package/lib/build-engine/index.d.ts +118 -118
- package/lib/build-engine/index.js +123 -124
- package/lib/build-engine/index.js.map +1 -1
- package/lib/engine-builder.d.ts +53 -53
- package/lib/engine-builder.js +549 -549
- package/lib/index.d.ts +4 -4
- package/lib/index.js +34 -34
- package/lib/module-resolver.d.ts +7 -7
- package/lib/module-resolver.js +28 -28
- package/lib/stats-query/config-interface.d.ts +129 -129
- package/lib/stats-query/config-interface.js +3 -3
- package/lib/stats-query/index.d.ts +161 -161
- package/lib/stats-query/index.js +527 -527
- package/lib/stats-query/path-utils.d.ts +2 -2
- package/lib/stats-query/path-utils.js +35 -35
- package/lib/transformer/babel.d.ts +5 -5
- package/lib/transformer/babel.js +34 -34
- package/lib/transformer/index.d.ts +2 -2
- package/lib/transformer/index.js +28 -28
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js +14 -14
- package/package.json +1 -1
- package/static/helper-dynamic-constants.txt +12 -12
- package/static/helper-global-exporter.txt +8 -8
- package/static/lib.dom.d.ts +20227 -20227
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
import { StatsQuery } from "../stats-query";
|
|
2
|
-
export declare function buildEngine(options: buildEngine.Options): Promise<buildEngine.Result>;
|
|
3
|
-
export declare namespace buildEngine {
|
|
4
|
-
type ModuleFormat = 'esm' | 'cjs' | 'system' | 'iife';
|
|
5
|
-
interface Options {
|
|
6
|
-
/**
|
|
7
|
-
* 引擎仓库目录。
|
|
8
|
-
*/
|
|
9
|
-
engine: string;
|
|
10
|
-
/**
|
|
11
|
-
* 输出目录。
|
|
12
|
-
*/
|
|
13
|
-
out: string;
|
|
14
|
-
mode: StatsQuery.ConstantManager.ModeType;
|
|
15
|
-
platform: StatsQuery.ConstantManager.PlatformType;
|
|
16
|
-
flags?: Partial<StatsQuery.ConstantManager.IFlagConfig>;
|
|
17
|
-
/**
|
|
18
|
-
* 包含的功能。
|
|
19
|
-
*/
|
|
20
|
-
features?: string[];
|
|
21
|
-
/**
|
|
22
|
-
* 输出模块格式。
|
|
23
|
-
* @default 'system'
|
|
24
|
-
*/
|
|
25
|
-
moduleFormat?: ModuleFormat;
|
|
26
|
-
/**
|
|
27
|
-
* 是否对生成结果进行压缩。
|
|
28
|
-
* @default false
|
|
29
|
-
*/
|
|
30
|
-
compress?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* 是否生成 source map。
|
|
33
|
-
* 若为 `inline` 则生成内联的 source map。
|
|
34
|
-
* @default false
|
|
35
|
-
*/
|
|
36
|
-
sourceMap?: boolean | 'inline';
|
|
37
|
-
/**
|
|
38
|
-
* 若 `sourceMap` 为 `true`,此选项指定了 source map 的路径。
|
|
39
|
-
* @default `${outputPath.map}`
|
|
40
|
-
*/
|
|
41
|
-
sourceMapFile?: string;
|
|
42
|
-
/**
|
|
43
|
-
* 若为 `true`,分割出 **所有** 引擎子模块。
|
|
44
|
-
* 否则,`.moduleEntries` 指定的所有子模块将被合并成一个单独的 `"cc"` 模块。
|
|
45
|
-
* @default false
|
|
46
|
-
*/
|
|
47
|
-
split?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* 使用的 ammo.js 版本,也即 `@cocos/ammo` 映射到的版本。
|
|
50
|
-
* - 为 `true` 时使用 WebAssembly 版本的 ammo.js;
|
|
51
|
-
* - 为 `false` 时使用 asm.js 版本的 ammo.js;
|
|
52
|
-
* - 为 `'fallback` 时同时在结果中包含两个版本的 ammo.js,并自动根据环境 fallback 选择。
|
|
53
|
-
*
|
|
54
|
-
* 注意,`'fallback'` 只有在 SystemJS 和 Async functions 同时支持时才有效。
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
|
-
ammoJsWasm?: boolean | 'fallback';
|
|
58
|
-
/**
|
|
59
|
-
* If true, all deprecated features/API are excluded.
|
|
60
|
-
* You can also specify a version range(in semver range) to exclude deprecations in specified version(s).
|
|
61
|
-
* @default false
|
|
62
|
-
*/
|
|
63
|
-
noDeprecatedFeatures?: string | boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Experimental.
|
|
66
|
-
*/
|
|
67
|
-
incremental?: string;
|
|
68
|
-
/**
|
|
69
|
-
* BrowsersList targets.
|
|
70
|
-
*/
|
|
71
|
-
targets?: string | string[] | Record<string, string>;
|
|
72
|
-
/**
|
|
73
|
-
* Enable loose compilation.
|
|
74
|
-
*/
|
|
75
|
-
loose?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* How to generate the reference to external assets:
|
|
78
|
-
* - `'relative-from-out'`
|
|
79
|
-
* Generate the path relative from `out` directory, does not contain the leading './'.
|
|
80
|
-
*
|
|
81
|
-
* - `'relative-from-chunk'`
|
|
82
|
-
* Generate the path relative from the referencing output chunk.
|
|
83
|
-
*
|
|
84
|
-
* - `'dynamic'`(default)
|
|
85
|
-
* Use runtime `URL` API to resolve the absolute URL.
|
|
86
|
-
* This requires `URL` and `import.meta.url` to be valid.
|
|
87
|
-
*/
|
|
88
|
-
assetURLFormat?: 'relative-from-out' | 'relative-from-chunk' | 'runtime-resolved';
|
|
89
|
-
}
|
|
90
|
-
interface Result {
|
|
91
|
-
/**
|
|
92
|
-
* Mappings between feature unit name and their actual chunk file, for example:
|
|
93
|
-
* ```js
|
|
94
|
-
* {
|
|
95
|
-
* "core": "./core.js",
|
|
96
|
-
* "gfx-webgl": "./gfx-webgl.js",
|
|
97
|
-
* }
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
exports: Record<string, string>;
|
|
101
|
-
/**
|
|
102
|
-
* The compulsory import mappings that should be applied.
|
|
103
|
-
*/
|
|
104
|
-
chunkAliases: Record<string, string>;
|
|
105
|
-
dependencyGraph?: Record<string, string[]>;
|
|
106
|
-
hasCriticalWarns: boolean;
|
|
107
|
-
}
|
|
108
|
-
function transform(code: string, moduleOption: ModuleFormat, loose?: boolean): Promise<{
|
|
109
|
-
code: string;
|
|
110
|
-
}>;
|
|
111
|
-
function isSourceChanged(incrementalFile: string): Promise<boolean>;
|
|
112
|
-
/**
|
|
113
|
-
* Enumerates all chunk files that used by specified feature units.
|
|
114
|
-
* @param meta Metadata of build result.
|
|
115
|
-
* @param featureUnits Feature units.
|
|
116
|
-
*/
|
|
117
|
-
function enumerateDependentChunks(meta: buildEngine.Result, featureUnits: string[]): string[];
|
|
118
|
-
}
|
|
1
|
+
import { StatsQuery } from "../stats-query";
|
|
2
|
+
export declare function buildEngine(options: buildEngine.Options): Promise<buildEngine.Result>;
|
|
3
|
+
export declare namespace buildEngine {
|
|
4
|
+
type ModuleFormat = 'esm' | 'cjs' | 'system' | 'iife';
|
|
5
|
+
interface Options {
|
|
6
|
+
/**
|
|
7
|
+
* 引擎仓库目录。
|
|
8
|
+
*/
|
|
9
|
+
engine: string;
|
|
10
|
+
/**
|
|
11
|
+
* 输出目录。
|
|
12
|
+
*/
|
|
13
|
+
out: string;
|
|
14
|
+
mode: StatsQuery.ConstantManager.ModeType;
|
|
15
|
+
platform: StatsQuery.ConstantManager.PlatformType;
|
|
16
|
+
flags?: Partial<StatsQuery.ConstantManager.IFlagConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* 包含的功能。
|
|
19
|
+
*/
|
|
20
|
+
features?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* 输出模块格式。
|
|
23
|
+
* @default 'system'
|
|
24
|
+
*/
|
|
25
|
+
moduleFormat?: ModuleFormat;
|
|
26
|
+
/**
|
|
27
|
+
* 是否对生成结果进行压缩。
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
compress?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 是否生成 source map。
|
|
33
|
+
* 若为 `inline` 则生成内联的 source map。
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
sourceMap?: boolean | 'inline';
|
|
37
|
+
/**
|
|
38
|
+
* 若 `sourceMap` 为 `true`,此选项指定了 source map 的路径。
|
|
39
|
+
* @default `${outputPath.map}`
|
|
40
|
+
*/
|
|
41
|
+
sourceMapFile?: string;
|
|
42
|
+
/**
|
|
43
|
+
* 若为 `true`,分割出 **所有** 引擎子模块。
|
|
44
|
+
* 否则,`.moduleEntries` 指定的所有子模块将被合并成一个单独的 `"cc"` 模块。
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
split?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 使用的 ammo.js 版本,也即 `@cocos/ammo` 映射到的版本。
|
|
50
|
+
* - 为 `true` 时使用 WebAssembly 版本的 ammo.js;
|
|
51
|
+
* - 为 `false` 时使用 asm.js 版本的 ammo.js;
|
|
52
|
+
* - 为 `'fallback` 时同时在结果中包含两个版本的 ammo.js,并自动根据环境 fallback 选择。
|
|
53
|
+
*
|
|
54
|
+
* 注意,`'fallback'` 只有在 SystemJS 和 Async functions 同时支持时才有效。
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
ammoJsWasm?: boolean | 'fallback';
|
|
58
|
+
/**
|
|
59
|
+
* If true, all deprecated features/API are excluded.
|
|
60
|
+
* You can also specify a version range(in semver range) to exclude deprecations in specified version(s).
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
noDeprecatedFeatures?: string | boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Experimental.
|
|
66
|
+
*/
|
|
67
|
+
incremental?: string;
|
|
68
|
+
/**
|
|
69
|
+
* BrowsersList targets.
|
|
70
|
+
*/
|
|
71
|
+
targets?: string | string[] | Record<string, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Enable loose compilation.
|
|
74
|
+
*/
|
|
75
|
+
loose?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* How to generate the reference to external assets:
|
|
78
|
+
* - `'relative-from-out'`
|
|
79
|
+
* Generate the path relative from `out` directory, does not contain the leading './'.
|
|
80
|
+
*
|
|
81
|
+
* - `'relative-from-chunk'`
|
|
82
|
+
* Generate the path relative from the referencing output chunk.
|
|
83
|
+
*
|
|
84
|
+
* - `'dynamic'`(default)
|
|
85
|
+
* Use runtime `URL` API to resolve the absolute URL.
|
|
86
|
+
* This requires `URL` and `import.meta.url` to be valid.
|
|
87
|
+
*/
|
|
88
|
+
assetURLFormat?: 'relative-from-out' | 'relative-from-chunk' | 'runtime-resolved';
|
|
89
|
+
}
|
|
90
|
+
interface Result {
|
|
91
|
+
/**
|
|
92
|
+
* Mappings between feature unit name and their actual chunk file, for example:
|
|
93
|
+
* ```js
|
|
94
|
+
* {
|
|
95
|
+
* "core": "./core.js",
|
|
96
|
+
* "gfx-webgl": "./gfx-webgl.js",
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
exports: Record<string, string>;
|
|
101
|
+
/**
|
|
102
|
+
* The compulsory import mappings that should be applied.
|
|
103
|
+
*/
|
|
104
|
+
chunkAliases: Record<string, string>;
|
|
105
|
+
dependencyGraph?: Record<string, string[]>;
|
|
106
|
+
hasCriticalWarns: boolean;
|
|
107
|
+
}
|
|
108
|
+
function transform(code: string, moduleOption: ModuleFormat, loose?: boolean): Promise<{
|
|
109
|
+
code: string;
|
|
110
|
+
}>;
|
|
111
|
+
function isSourceChanged(incrementalFile: string): Promise<boolean>;
|
|
112
|
+
/**
|
|
113
|
+
* Enumerates all chunk files that used by specified feature units.
|
|
114
|
+
* @param meta Metadata of build result.
|
|
115
|
+
* @param featureUnits Feature units.
|
|
116
|
+
*/
|
|
117
|
+
function enumerateDependentChunks(meta: buildEngine.Result, featureUnits: string[]): string[];
|
|
118
|
+
}
|
|
119
119
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,125 +1,124 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.buildEngine = void 0;
|
|
16
|
-
const engine_js_1 = require("./engine-js");
|
|
17
|
-
const transformer_1 = require("../transformer");
|
|
18
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
19
|
-
function verifyCache(options) {
|
|
20
|
-
// TODO
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
function buildEngine(options) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
if (verifyCache(options)) {
|
|
26
|
-
throw 'TODO';
|
|
27
|
-
}
|
|
28
|
-
if (options.platform === 'OPEN_HARMONY') {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
case '
|
|
57
|
-
case '
|
|
58
|
-
case '
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
* @param
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
})(buildEngine = exports.buildEngine || (exports.buildEngine = {}));
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.buildEngine = void 0;
|
|
16
|
+
const engine_js_1 = require("./engine-js");
|
|
17
|
+
const transformer_1 = require("../transformer");
|
|
18
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
19
|
+
function verifyCache(options) {
|
|
20
|
+
// TODO
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
function buildEngine(options) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (verifyCache(options)) {
|
|
26
|
+
throw 'TODO';
|
|
27
|
+
}
|
|
28
|
+
// if (options.platform === 'OPEN_HARMONY') {
|
|
29
|
+
// // we use a custom engine builder for OPEN_HARMONY platform
|
|
30
|
+
// throw 'TODO';
|
|
31
|
+
// } else {
|
|
32
|
+
return (0, engine_js_1.buildJsEngine)(options);
|
|
33
|
+
// }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.buildEngine = buildEngine;
|
|
37
|
+
(function (buildEngine) {
|
|
38
|
+
function transform(code, moduleOption, loose) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const babelFormat = moduleOptionsToBabelEnvModules(moduleOption);
|
|
41
|
+
const babelFileResult = yield transformer_1.babel.core.transformAsync(code, {
|
|
42
|
+
presets: [[transformer_1.babel.presetEnv, { modules: babelFormat, loose: loose !== null && loose !== void 0 ? loose : true }]],
|
|
43
|
+
});
|
|
44
|
+
if (!babelFileResult || !babelFileResult.code) {
|
|
45
|
+
throw new Error(`Failed to transform!`);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
code: babelFileResult.code,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
buildEngine.transform = transform;
|
|
53
|
+
function moduleOptionsToBabelEnvModules(moduleOptions) {
|
|
54
|
+
switch (moduleOptions) {
|
|
55
|
+
case 'cjs': return 'commonjs';
|
|
56
|
+
case 'system': return 'systemjs';
|
|
57
|
+
case 'iife':
|
|
58
|
+
case 'esm': return false;
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
60
|
+
default: throw new Error(`Unknown module format ${moduleOptions}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function isSourceChanged(incrementalFile) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
let record;
|
|
66
|
+
try {
|
|
67
|
+
record = yield fs_extra_1.default.readJSON(incrementalFile);
|
|
68
|
+
}
|
|
69
|
+
catch (_a) {
|
|
70
|
+
console.debug(`Failed to read incremental file: ${incrementalFile} - rebuild is needed.`);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
for (const file of Object.keys(record)) {
|
|
74
|
+
const mtime = record[file];
|
|
75
|
+
try {
|
|
76
|
+
/* eslint-disable-next-line no-await-in-loop */
|
|
77
|
+
const mtimeNow = (yield fs_extra_1.default.stat(file)).mtimeMs;
|
|
78
|
+
if (mtimeNow !== mtime) {
|
|
79
|
+
console.debug(`Source ${file} in watch files record ${incrementalFile} has a different time stamp - rebuild is needed.`);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (_b) {
|
|
84
|
+
console.debug(`Failed to read source ${file} in watch files record ${incrementalFile} - rebuild is needed.`);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
buildEngine.isSourceChanged = isSourceChanged;
|
|
92
|
+
/**
|
|
93
|
+
* Enumerates all chunk files that used by specified feature units.
|
|
94
|
+
* @param meta Metadata of build result.
|
|
95
|
+
* @param featureUnits Feature units.
|
|
96
|
+
*/
|
|
97
|
+
function enumerateDependentChunks(meta, featureUnits) {
|
|
98
|
+
const result = [];
|
|
99
|
+
const visited = new Set();
|
|
100
|
+
const addChunk = (chunkFileName) => {
|
|
101
|
+
if (visited.has(chunkFileName)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
visited.add(chunkFileName);
|
|
105
|
+
result.push(chunkFileName);
|
|
106
|
+
if (meta.dependencyGraph && chunkFileName in meta.dependencyGraph) {
|
|
107
|
+
for (const dependencyChunk of meta.dependencyGraph[chunkFileName]) {
|
|
108
|
+
addChunk(dependencyChunk);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
for (const featureUnit of featureUnits) {
|
|
113
|
+
const chunkFileName = meta.exports[featureUnit];
|
|
114
|
+
if (!chunkFileName) {
|
|
115
|
+
console.error(`Feature unit ${featureUnit} is not in build result!`);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
addChunk(chunkFileName);
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
buildEngine.enumerateDependentChunks = enumerateDependentChunks;
|
|
123
|
+
})(buildEngine = exports.buildEngine || (exports.buildEngine = {}));
|
|
125
124
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/build-engine/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2CAA4C;AAC5C,gDAAsC;AACtC,wDAA0B;AAE1B,SAAS,WAAW,CAAE,OAA4B;IAC9C,OAAO;IACP,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAsB,WAAW,CAAE,OAA4B;;QAC3D,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE;YACtB,MAAM,MAAM,CAAC;SAChB;QACD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/build-engine/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2CAA4C;AAC5C,gDAAsC;AACtC,wDAA0B;AAE1B,SAAS,WAAW,CAAE,OAA4B;IAC9C,OAAO;IACP,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAsB,WAAW,CAAE,OAA4B;;QAC3D,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE;YACtB,MAAM,MAAM,CAAC;SAChB;QACD,6CAA6C;QAC7C,kEAAkE;QAClE,oBAAoB;QACpB,WAAW;QACP,OAAO,IAAA,yBAAa,EAAC,OAAO,CAAC,CAAC;QAClC,IAAI;IACR,CAAC;CAAA;AAVD,kCAUC;AAED,WAAiB,WAAW;IAkJxB,SAAsB,SAAS,CAAC,IAAY,EAAE,YAA0B,EAAE,KAAe;;YACrF,MAAM,WAAW,GAAG,8BAA8B,CAAC,YAAY,CAAC,CAAC;YACjE,MAAM,eAAe,GAAG,MAAM,mBAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE;gBAC1D,OAAO,EAAE,CAAC,CAAC,mBAAK,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,EAA6B,C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.d.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { StatsQuery } from "./stats-query";
|
|
2
|
-
import ConstantManager = StatsQuery.ConstantManager;
|
|
3
|
-
export declare namespace EngineBuilder {
|
|
4
|
-
interface IBuildOptions {
|
|
5
|
-
root: string;
|
|
6
|
-
features?: string[];
|
|
7
|
-
platform: ConstantManager.PlatformType;
|
|
8
|
-
mode: ConstantManager.ModeType;
|
|
9
|
-
flagConfig: Partial<ConstantManager.IFlagConfig>;
|
|
10
|
-
outDir?: string;
|
|
11
|
-
}
|
|
12
|
-
interface IBuildResult {
|
|
13
|
-
[outputFile: string]: IHandleResult;
|
|
14
|
-
}
|
|
15
|
-
interface IHandleResult {
|
|
16
|
-
code: string;
|
|
17
|
-
file: string;
|
|
18
|
-
originalId: string;
|
|
19
|
-
resolvedId: string;
|
|
20
|
-
map: any;
|
|
21
|
-
}
|
|
22
|
-
interface ITransformResult {
|
|
23
|
-
code: string;
|
|
24
|
-
map?: any;
|
|
25
|
-
depIdList: string[];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export declare class EngineBuilder {
|
|
29
|
-
private _options;
|
|
30
|
-
private _entries;
|
|
31
|
-
private _entriesForPass2;
|
|
32
|
-
private _virtual2code;
|
|
33
|
-
private _feature2NodeModule;
|
|
34
|
-
private _nodeModules;
|
|
35
|
-
private _virtualOverrides;
|
|
36
|
-
private _buildTimeConstants;
|
|
37
|
-
private _moduleOverrides;
|
|
38
|
-
private _buildResult;
|
|
39
|
-
private _resolveExtension;
|
|
40
|
-
private _renameMap;
|
|
41
|
-
build(options: EngineBuilder.IBuildOptions): Promise<EngineBuilder.IBuildResult>;
|
|
42
|
-
private _initOptions;
|
|
43
|
-
private _handleId;
|
|
44
|
-
private _getOverrideId;
|
|
45
|
-
private _resolve;
|
|
46
|
-
private _resolveRelative;
|
|
47
|
-
private _load;
|
|
48
|
-
private _transform;
|
|
49
|
-
private _lintImport;
|
|
50
|
-
private _buildIndex;
|
|
51
|
-
private _copyTypes;
|
|
52
|
-
private _addNodeModulesDeps;
|
|
53
|
-
}
|
|
1
|
+
import { StatsQuery } from "./stats-query";
|
|
2
|
+
import ConstantManager = StatsQuery.ConstantManager;
|
|
3
|
+
export declare namespace EngineBuilder {
|
|
4
|
+
interface IBuildOptions {
|
|
5
|
+
root: string;
|
|
6
|
+
features?: string[];
|
|
7
|
+
platform: ConstantManager.PlatformType;
|
|
8
|
+
mode: ConstantManager.ModeType;
|
|
9
|
+
flagConfig: Partial<ConstantManager.IFlagConfig>;
|
|
10
|
+
outDir?: string;
|
|
11
|
+
}
|
|
12
|
+
interface IBuildResult {
|
|
13
|
+
[outputFile: string]: IHandleResult;
|
|
14
|
+
}
|
|
15
|
+
interface IHandleResult {
|
|
16
|
+
code: string;
|
|
17
|
+
file: string;
|
|
18
|
+
originalId: string;
|
|
19
|
+
resolvedId: string;
|
|
20
|
+
map: any;
|
|
21
|
+
}
|
|
22
|
+
interface ITransformResult {
|
|
23
|
+
code: string;
|
|
24
|
+
map?: any;
|
|
25
|
+
depIdList: string[];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export declare class EngineBuilder {
|
|
29
|
+
private _options;
|
|
30
|
+
private _entries;
|
|
31
|
+
private _entriesForPass2;
|
|
32
|
+
private _virtual2code;
|
|
33
|
+
private _feature2NodeModule;
|
|
34
|
+
private _nodeModules;
|
|
35
|
+
private _virtualOverrides;
|
|
36
|
+
private _buildTimeConstants;
|
|
37
|
+
private _moduleOverrides;
|
|
38
|
+
private _buildResult;
|
|
39
|
+
private _resolveExtension;
|
|
40
|
+
private _renameMap;
|
|
41
|
+
build(options: EngineBuilder.IBuildOptions): Promise<EngineBuilder.IBuildResult>;
|
|
42
|
+
private _initOptions;
|
|
43
|
+
private _handleId;
|
|
44
|
+
private _getOverrideId;
|
|
45
|
+
private _resolve;
|
|
46
|
+
private _resolveRelative;
|
|
47
|
+
private _load;
|
|
48
|
+
private _transform;
|
|
49
|
+
private _lintImport;
|
|
50
|
+
private _buildIndex;
|
|
51
|
+
private _copyTypes;
|
|
52
|
+
private _addNodeModulesDeps;
|
|
53
|
+
}
|
|
54
54
|
//# sourceMappingURL=engine-builder.d.ts.map
|