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