rsbuild-plugin-dts 0.0.0 → 0.0.2
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/dist/apiExtractor.d.ts +1 -1
- package/dist/apiExtractor.js +69 -66
- package/dist/dts.d.ts +1 -1
- package/dist/dts.js +205 -170
- package/dist/index.js +103 -88
- package/dist/tsc.js +96 -107
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +139 -114
- package/package.json +7 -6
- package/dist/apiExtractor.cjs +0 -94
- package/dist/dts.cjs +0 -205
- package/dist/index.cjs +0 -111
- package/dist/tsc.cjs +0 -134
- package/dist/utils.cjs +0 -171
package/dist/apiExtractor.d.ts
CHANGED
package/dist/apiExtractor.js
CHANGED
|
@@ -1,69 +1,72 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__microsoft_api_extractor__ from "@microsoft/api-extractor";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js__ from "./utils.js";
|
|
6
|
+
|
|
7
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
8
|
+
|
|
9
|
+
var external_node_path_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_path__;
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: external "@microsoft/api-extractor"
|
|
12
|
+
|
|
13
|
+
var api_extractor_namespaceObject = __WEBPACK_EXTERNAL_MODULE__microsoft_api_extractor__;
|
|
14
|
+
|
|
15
|
+
;// CONCATENATED MODULE: external "@rsbuild/core"
|
|
16
|
+
|
|
17
|
+
var core_namespaceObject = __WEBPACK_EXTERNAL_MODULE__rsbuild_core__;
|
|
18
|
+
|
|
19
|
+
;// CONCATENATED MODULE: external "picocolors"
|
|
20
|
+
|
|
21
|
+
var external_picocolors_namespaceObject = __WEBPACK_EXTERNAL_MODULE_picocolors__;
|
|
22
|
+
|
|
23
|
+
;// CONCATENATED MODULE: external "./utils.js"
|
|
24
|
+
|
|
25
|
+
var external_utils_js_namespaceObject = __WEBPACK_EXTERNAL_MODULE__utils_js__;
|
|
26
|
+
|
|
27
|
+
;// CONCATENATED MODULE: ./src/apiExtractor.ts
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
15
33
|
async function bundleDts(options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
packageJsonFullPath: join(cwd, "package.json")
|
|
52
|
-
});
|
|
53
|
-
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
54
|
-
localBuild: true
|
|
55
|
-
});
|
|
56
|
-
if (!extractorResult.succeeded) {
|
|
57
|
-
throw new Error(`API Extractor error. ${color.gray(`(${name})`)}`);
|
|
34
|
+
const { name, cwd, outDir, dtsExtension, dtsEntry = {
|
|
35
|
+
name: 'index',
|
|
36
|
+
path: 'index.d.ts'
|
|
37
|
+
}, tsconfigPath = 'tsconfig.json', bundledPackages = [] } = options;
|
|
38
|
+
try {
|
|
39
|
+
const start = Date.now();
|
|
40
|
+
const untrimmedFilePath = (0,external_node_path_namespaceObject.join)(cwd, (0,external_node_path_namespaceObject.relative)(cwd, outDir), `${dtsEntry.name}${dtsExtension}`);
|
|
41
|
+
const mainEntryPointFilePath = dtsEntry.path;
|
|
42
|
+
const internalConfig = {
|
|
43
|
+
mainEntryPointFilePath,
|
|
44
|
+
bundledPackages,
|
|
45
|
+
dtsRollup: {
|
|
46
|
+
enabled: true,
|
|
47
|
+
untrimmedFilePath
|
|
48
|
+
},
|
|
49
|
+
compiler: {
|
|
50
|
+
tsconfigFilePath: tsconfigPath.includes(cwd) ? tsconfigPath : (0,external_node_path_namespaceObject.join)(cwd, tsconfigPath)
|
|
51
|
+
},
|
|
52
|
+
projectFolder: cwd
|
|
53
|
+
};
|
|
54
|
+
const extractorConfig = api_extractor_namespaceObject.ExtractorConfig.prepare({
|
|
55
|
+
configObject: internalConfig,
|
|
56
|
+
configObjectFullPath: undefined,
|
|
57
|
+
packageJsonFullPath: (0,external_node_path_namespaceObject.join)(cwd, 'package.json')
|
|
58
|
+
});
|
|
59
|
+
const extractorResult = api_extractor_namespaceObject.Extractor.invoke(extractorConfig, {
|
|
60
|
+
localBuild: true
|
|
61
|
+
});
|
|
62
|
+
if (!extractorResult.succeeded) {
|
|
63
|
+
throw new Error(`API Extractor error. ${external_picocolors_namespaceObject["default"].gray(`(${name})`)}`);
|
|
64
|
+
}
|
|
65
|
+
core_namespaceObject.logger.info(`API Extractor bundle DTS succeeded: ${external_picocolors_namespaceObject["default"].cyan(untrimmedFilePath)} in ${(0,external_utils_js_namespaceObject.getTimeCost)(start)} ${external_picocolors_namespaceObject["default"].gray(`(${name})`)}`);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
core_namespaceObject.logger.error('API Extractor Error');
|
|
68
|
+
throw new Error(`${e}`);
|
|
58
69
|
}
|
|
59
|
-
logger.info(
|
|
60
|
-
`API Extractor bundle DTS succeeded: ${color.cyan(untrimmedFilePath)} in ${getTimeCost(start)} ${color.gray(`(${name})`)}`
|
|
61
|
-
);
|
|
62
|
-
} catch (e) {
|
|
63
|
-
logger.error("API Extractor Error");
|
|
64
|
-
throw new Error(`${e}`);
|
|
65
|
-
}
|
|
66
70
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
71
|
+
|
|
72
|
+
export { bundleDts };
|
package/dist/dts.d.ts
CHANGED
package/dist/dts.js
CHANGED
|
@@ -1,180 +1,215 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs__ from "node:fs";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_typescript__ from "typescript";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tsc_js__ from "./tsc.js";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js__ from "./utils.js";
|
|
8
|
+
var __webpack_modules__ = ({
|
|
9
|
+
"./apiExtractor": (function (module) {
|
|
10
|
+
module.exports = import("./apiExtractor.js");
|
|
11
|
+
|
|
12
|
+
}),
|
|
13
|
+
|
|
14
|
+
});
|
|
15
|
+
/************************************************************************/
|
|
16
|
+
// The module cache
|
|
17
|
+
var __webpack_module_cache__ = {};
|
|
18
|
+
|
|
19
|
+
// The require function
|
|
20
|
+
function __webpack_require__(moduleId) {
|
|
21
|
+
|
|
22
|
+
// Check if module is in cache
|
|
23
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
24
|
+
if (cachedModule !== undefined) {
|
|
25
|
+
return cachedModule.exports;
|
|
26
|
+
}
|
|
27
|
+
// Create a new module (and put it into the cache)
|
|
28
|
+
var module = (__webpack_module_cache__[moduleId] = {
|
|
29
|
+
exports: {}
|
|
30
|
+
});
|
|
31
|
+
// Execute the module function
|
|
32
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
33
|
+
|
|
34
|
+
// Return the exports of the module
|
|
35
|
+
return module.exports;
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/************************************************************************/
|
|
40
|
+
|
|
41
|
+
;// CONCATENATED MODULE: external "node:fs"
|
|
42
|
+
|
|
43
|
+
var external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_fs__;
|
|
44
|
+
|
|
45
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
46
|
+
|
|
47
|
+
var external_node_path_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_path__;
|
|
48
|
+
|
|
49
|
+
;// CONCATENATED MODULE: external "@rsbuild/core"
|
|
50
|
+
|
|
51
|
+
var core_namespaceObject = __WEBPACK_EXTERNAL_MODULE__rsbuild_core__;
|
|
52
|
+
|
|
53
|
+
;// CONCATENATED MODULE: external "picocolors"
|
|
54
|
+
|
|
55
|
+
var external_picocolors_namespaceObject = __WEBPACK_EXTERNAL_MODULE_picocolors__;
|
|
56
|
+
|
|
57
|
+
;// CONCATENATED MODULE: external "typescript"
|
|
58
|
+
|
|
59
|
+
var external_typescript_namespaceObject = __WEBPACK_EXTERNAL_MODULE_typescript__;
|
|
60
|
+
|
|
61
|
+
;// CONCATENATED MODULE: external "./tsc.js"
|
|
62
|
+
|
|
63
|
+
var external_tsc_js_namespaceObject = __WEBPACK_EXTERNAL_MODULE__tsc_js__;
|
|
64
|
+
|
|
65
|
+
;// CONCATENATED MODULE: external "./utils.js"
|
|
66
|
+
|
|
67
|
+
var external_utils_js_namespaceObject = __WEBPACK_EXTERNAL_MODULE__utils_js__;
|
|
68
|
+
|
|
69
|
+
;// CONCATENATED MODULE: ./src/dts.ts
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
const isObject = (obj)=>Object.prototype.toString.call(obj) === '[object Object]';
|
|
78
|
+
// use !externals
|
|
79
|
+
const calcBundledPackages = (options)=>{
|
|
80
|
+
const { autoExternal, cwd, userExternals } = options;
|
|
81
|
+
let pkgJson;
|
|
82
|
+
try {
|
|
83
|
+
const content = external_node_fs_namespaceObject["default"].readFileSync((0,external_node_path_namespaceObject.join)(cwd, 'package.json'), 'utf-8');
|
|
84
|
+
pkgJson = JSON.parse(content);
|
|
85
|
+
} catch (err) {
|
|
86
|
+
core_namespaceObject.logger.warn('The type of third-party packages will not be bundled due to read package.json failed');
|
|
87
|
+
return [];
|
|
53
88
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
89
|
+
const externalOptions = autoExternal ? {
|
|
90
|
+
dependencies: true,
|
|
91
|
+
peerDependencies: true,
|
|
92
|
+
devDependencies: false,
|
|
93
|
+
...autoExternal === true ? {} : autoExternal
|
|
94
|
+
} : {
|
|
95
|
+
dependencies: false,
|
|
96
|
+
peerDependencies: false,
|
|
97
|
+
devDependencies: false
|
|
98
|
+
};
|
|
99
|
+
// User externals should not bundled
|
|
100
|
+
// Only handle the case where the externals type is string / (string | RegExp)[] / plain object, function type is too complex.
|
|
101
|
+
const getUserExternalsKeys = (value)=>{
|
|
102
|
+
if (!value) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
if (typeof value === 'string' || value instanceof RegExp) {
|
|
106
|
+
return [
|
|
107
|
+
value
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
if (Array.isArray(value)) {
|
|
111
|
+
return value.flatMap((v)=>getUserExternalsKeys(v));
|
|
112
|
+
}
|
|
113
|
+
if (isObject(userExternals)) {
|
|
114
|
+
return Object.keys(userExternals);
|
|
115
|
+
}
|
|
116
|
+
return [];
|
|
117
|
+
};
|
|
118
|
+
const externals = getUserExternalsKeys(userExternals);
|
|
119
|
+
const allDeps = [];
|
|
120
|
+
for (const type of [
|
|
121
|
+
'dependencies',
|
|
122
|
+
'peerDependencies',
|
|
123
|
+
'devDependencies'
|
|
124
|
+
]){
|
|
125
|
+
const deps = pkgJson[type] && Object.keys(pkgJson[type]);
|
|
126
|
+
if (deps) {
|
|
127
|
+
if (externalOptions[type]) {
|
|
128
|
+
externals.push(...deps);
|
|
129
|
+
}
|
|
130
|
+
allDeps.push(...deps);
|
|
131
|
+
}
|
|
69
132
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
(d) => !externals.some((e) => typeof e === "string" ? d === e : e.test(d))
|
|
73
|
-
);
|
|
74
|
-
return Array.from(new Set(bundledPackages));
|
|
133
|
+
const bundledPackages = allDeps.filter((d)=>!externals.some((e)=>typeof e === 'string' ? d === e : e.test(d)));
|
|
134
|
+
return Array.from(new Set(bundledPackages));
|
|
75
135
|
};
|
|
76
136
|
async function generateDts(data) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
cwd,
|
|
84
|
-
isWatch,
|
|
85
|
-
dtsExtension = ".d.ts",
|
|
86
|
-
autoExternal = true,
|
|
87
|
-
userExternals
|
|
88
|
-
} = data;
|
|
89
|
-
logger.start(`Generating DTS... ${color.gray(`(${name})`)}`);
|
|
90
|
-
const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath);
|
|
91
|
-
if (!configPath) {
|
|
92
|
-
logger.error(`tsconfig.json not found in ${cwd}`);
|
|
93
|
-
throw new Error();
|
|
94
|
-
}
|
|
95
|
-
const { options: rawCompilerOptions, fileNames } = loadTsconfig(configPath);
|
|
96
|
-
const rootDir = rawCompilerOptions.rootDir ?? await calcLongestCommonPath(fileNames) ?? dirname(configPath);
|
|
97
|
-
const outDir = distPath ? distPath : rawCompilerOptions.declarationDir || "./dist";
|
|
98
|
-
const getDeclarationDir = (bundle2, distPath2) => {
|
|
99
|
-
if (bundle2) {
|
|
100
|
-
return ensureTempDeclarationDir(cwd);
|
|
137
|
+
const { bundle, distPath, dtsEntry, tsconfigPath, name, cwd, isWatch, dtsExtension = '.d.ts', autoExternal = true, userExternals } = data;
|
|
138
|
+
core_namespaceObject.logger.start(`Generating DTS... ${external_picocolors_namespaceObject["default"].gray(`(${name})`)}`);
|
|
139
|
+
const configPath = external_typescript_namespaceObject.findConfigFile(cwd, external_typescript_namespaceObject.sys.fileExists, tsconfigPath);
|
|
140
|
+
if (!configPath) {
|
|
141
|
+
core_namespaceObject.logger.error(`tsconfig.json not found in ${cwd}`);
|
|
142
|
+
throw new Error();
|
|
101
143
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
144
|
+
const { options: rawCompilerOptions, fileNames } = (0,external_utils_js_namespaceObject.loadTsconfig)(configPath);
|
|
145
|
+
const rootDir = rawCompilerOptions.rootDir ?? await (0,external_utils_js_namespaceObject.calcLongestCommonPath)(fileNames) ?? (0,external_node_path_namespaceObject.dirname)(configPath);
|
|
146
|
+
const outDir = distPath ? distPath : rawCompilerOptions.declarationDir || './dist';
|
|
147
|
+
const getDeclarationDir = (bundle, distPath)=>{
|
|
148
|
+
if (bundle) {
|
|
149
|
+
return (0,external_utils_js_namespaceObject.ensureTempDeclarationDir)(cwd);
|
|
150
|
+
}
|
|
151
|
+
return distPath ? distPath : rawCompilerOptions.declarationDir ?? './dist';
|
|
152
|
+
};
|
|
153
|
+
const declarationDir = getDeclarationDir(bundle, distPath);
|
|
154
|
+
const { name: entryName, path: entryPath } = dtsEntry;
|
|
155
|
+
let entry = '';
|
|
156
|
+
if (bundle === true && entryPath) {
|
|
157
|
+
const entrySourcePath = (0,external_node_path_namespaceObject.join)(cwd, entryPath);
|
|
158
|
+
const relativePath = (0,external_node_path_namespaceObject.relative)(rootDir, (0,external_node_path_namespaceObject.dirname)(entrySourcePath));
|
|
159
|
+
entry = (0,external_node_path_namespaceObject.join)(declarationDir, relativePath, (0,external_node_path_namespaceObject.basename)(entrySourcePath)).replace(/\.(js|mjs|jsx|ts|mts|tsx|cjs|cts|cjsx|ctsx|mjsx|mtsx)$/, '.d.ts');
|
|
160
|
+
}
|
|
161
|
+
const bundleDtsIfNeeded = async ()=>{
|
|
162
|
+
if (bundle === true) {
|
|
163
|
+
const { bundleDts } = await Promise.resolve(/* import() */ ).then(__webpack_require__.bind(__webpack_require__, "./apiExtractor"));
|
|
164
|
+
await bundleDts({
|
|
165
|
+
name,
|
|
166
|
+
cwd,
|
|
167
|
+
outDir,
|
|
168
|
+
dtsEntry: {
|
|
169
|
+
name: entryName,
|
|
170
|
+
path: entry
|
|
171
|
+
},
|
|
172
|
+
tsconfigPath,
|
|
173
|
+
dtsExtension,
|
|
174
|
+
bundledPackages: calcBundledPackages({
|
|
175
|
+
autoExternal,
|
|
176
|
+
cwd,
|
|
177
|
+
userExternals
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const onComplete = async (isSuccess)=>{
|
|
183
|
+
if (isSuccess) {
|
|
184
|
+
await bundleDtsIfNeeded();
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
await (0,external_tsc_js_namespaceObject.emitDts)({
|
|
123
188
|
name,
|
|
124
189
|
cwd,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
dtsExtension,
|
|
132
|
-
bundledPackages: calcBundledPackages({
|
|
133
|
-
autoExternal,
|
|
134
|
-
cwd,
|
|
135
|
-
userExternals
|
|
136
|
-
})
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const onComplete = async (isSuccess) => {
|
|
141
|
-
if (isSuccess) {
|
|
142
|
-
await bundleDtsIfNeeded();
|
|
190
|
+
configPath,
|
|
191
|
+
declarationDir,
|
|
192
|
+
dtsExtension
|
|
193
|
+
}, onComplete, bundle, isWatch);
|
|
194
|
+
if (!isWatch) {
|
|
195
|
+
await bundleDtsIfNeeded();
|
|
143
196
|
}
|
|
144
|
-
};
|
|
145
|
-
await emitDts(
|
|
146
|
-
{
|
|
147
|
-
name,
|
|
148
|
-
cwd,
|
|
149
|
-
configPath,
|
|
150
|
-
declarationDir,
|
|
151
|
-
dtsExtension
|
|
152
|
-
},
|
|
153
|
-
onComplete,
|
|
154
|
-
bundle,
|
|
155
|
-
isWatch
|
|
156
|
-
);
|
|
157
|
-
if (!isWatch) {
|
|
158
|
-
await bundleDtsIfNeeded();
|
|
159
|
-
}
|
|
160
197
|
}
|
|
161
|
-
process.on(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
process.on('message', async (data)=>{
|
|
199
|
+
if (!data.cwd) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
await generateDts(data);
|
|
204
|
+
} catch (e) {
|
|
205
|
+
core_namespaceObject.logger.error(e);
|
|
206
|
+
process.send('error');
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
process.send('success');
|
|
210
|
+
if (!data.isWatch) {
|
|
211
|
+
process.exit();
|
|
212
|
+
}
|
|
176
213
|
});
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
generateDts
|
|
180
|
-
};
|
|
214
|
+
|
|
215
|
+
export { calcBundledPackages, generateDts };
|