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.
@@ -1,4 +1,4 @@
1
- import type { DtsEntry } from './';
1
+ import type { DtsEntry } from 'src';
2
2
  export type BundleOptions = {
3
3
  name: string;
4
4
  cwd: string;
@@ -1,69 +1,104 @@
1
- import { fileURLToPath } from "url";
2
- import path from "path";
3
- var getFilename = () => fileURLToPath(import.meta.url);
4
- var getDirname = () => path.dirname(getFilename());
5
- var __dirname = /* @__PURE__ */ getDirname();
6
- var __filename = /* @__PURE__ */ getFilename();
7
- import { join, relative } from "node:path";
8
- import {
9
- Extractor,
10
- ExtractorConfig
11
- } from "@microsoft/api-extractor";
12
- import { logger } from "@rsbuild/core";
13
- import color from "picocolors";
14
- import { getTimeCost } from "./utils.js";
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
- const {
17
- name,
18
- cwd,
19
- outDir,
20
- dtsExtension,
21
- dtsEntry = {
22
- name: "index",
23
- path: "index.d.ts"
24
- },
25
- tsconfigPath = "tsconfig.json",
26
- bundledPackages = []
27
- } = options;
28
- try {
29
- const start = Date.now();
30
- const untrimmedFilePath = join(
31
- cwd,
32
- relative(cwd, outDir),
33
- `${dtsEntry.name}${dtsExtension}`
34
- );
35
- const mainEntryPointFilePath = dtsEntry.path;
36
- const internalConfig = {
37
- mainEntryPointFilePath,
38
- bundledPackages,
39
- dtsRollup: {
40
- enabled: true,
41
- untrimmedFilePath
42
- },
43
- compiler: {
44
- tsconfigFilePath: tsconfigPath.includes(cwd) ? tsconfigPath : join(cwd, tsconfigPath)
45
- },
46
- projectFolder: cwd
47
- };
48
- const extractorConfig = ExtractorConfig.prepare({
49
- configObject: internalConfig,
50
- configObjectFullPath: void 0,
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
- export {
68
- bundleDts
69
- };
103
+
104
+ export { bundleDts };
package/dist/dts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DtsGenOptions } from './';
1
+ import type { DtsGenOptions } from 'src';
2
2
  export declare const calcBundledPackages: (options: {
3
3
  autoExternal: DtsGenOptions["autoExternal"];
4
4
  cwd: string;
package/dist/dts.js CHANGED
@@ -1,180 +1,247 @@
1
- import { fileURLToPath } from "url";
2
- import path from "path";
3
- var getFilename = () => fileURLToPath(import.meta.url);
4
- var getDirname = () => path.dirname(getFilename());
5
- var __dirname = /* @__PURE__ */ getDirname();
6
- var __filename = /* @__PURE__ */ getFilename();
7
- import fs from "node:fs";
8
- import { basename, dirname, join, relative } from "node:path";
9
- import { logger } from "@rsbuild/core";
10
- import color from "picocolors";
11
- import * as ts from "typescript";
12
- import { emitDts } from "./tsc.js";
13
- import {
14
- calcLongestCommonPath,
15
- ensureTempDeclarationDir,
16
- loadTsconfig
17
- } from "./utils.js";
18
- const isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
19
- const calcBundledPackages = (options) => {
20
- const { autoExternal, cwd, userExternals } = options;
21
- let pkgJson;
22
- try {
23
- const content = fs.readFileSync(join(cwd, "package.json"), "utf-8");
24
- pkgJson = JSON.parse(content);
25
- } catch (err) {
26
- logger.warn(
27
- "The type of third-party packages will not be bundled due to read package.json failed"
28
- );
29
- return [];
30
- }
31
- const externalOptions = autoExternal ? {
32
- dependencies: true,
33
- peerDependencies: true,
34
- devDependencies: false,
35
- ...autoExternal === true ? {} : autoExternal
36
- } : {
37
- dependencies: false,
38
- peerDependencies: false,
39
- devDependencies: false
40
- };
41
- const getUserExternalsKeys = (value) => {
42
- if (!value) {
43
- return [];
44
- }
45
- if (typeof value === "string" || value instanceof RegExp) {
46
- return [value];
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
- if (isObject(userExternals)) {
52
- return Object.keys(userExternals);
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
- return [];
55
- };
56
- const externals = getUserExternalsKeys(userExternals);
57
- const allDeps = [];
58
- for (const type of [
59
- "dependencies",
60
- "peerDependencies",
61
- "devDependencies"
62
- ]) {
63
- const deps = pkgJson[type] && Object.keys(pkgJson[type]);
64
- if (deps) {
65
- if (externalOptions[type]) {
66
- externals.push(...deps);
67
- }
68
- allDeps.push(...deps);
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
- const bundledPackages = allDeps.filter(
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
- const {
78
- bundle,
79
- distPath,
80
- dtsEntry,
81
- tsconfigPath,
82
- name,
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);
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
- return distPath2 ? distPath2 : rawCompilerOptions.declarationDir ?? "./dist";
103
- };
104
- const declarationDir = getDeclarationDir(bundle, distPath);
105
- const { name: entryName, path: entryPath } = dtsEntry;
106
- let entry = "";
107
- if (bundle === true && entryPath) {
108
- const entrySourcePath = join(cwd, entryPath);
109
- const relativePath = relative(rootDir, dirname(entrySourcePath));
110
- entry = join(
111
- declarationDir,
112
- relativePath,
113
- basename(entrySourcePath)
114
- ).replace(
115
- /\.(js|mjs|jsx|ts|mts|tsx|cjs|cts|cjsx|ctsx|mjsx|mtsx)$/,
116
- ".d.ts"
117
- );
118
- }
119
- const bundleDtsIfNeeded = async () => {
120
- if (bundle === true) {
121
- const { bundleDts } = await import("./apiExtractor.js");
122
- await bundleDts({
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
- outDir,
126
- dtsEntry: {
127
- name: entryName,
128
- path: entry
129
- },
130
- tsconfigPath,
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("message", async (data) => {
162
- if (!data.cwd) {
163
- return;
164
- }
165
- try {
166
- await generateDts(data);
167
- } catch (e) {
168
- logger.error(e);
169
- process.send("error");
170
- process.exit(1);
171
- }
172
- process.send("success");
173
- if (!data.isWatch) {
174
- process.exit();
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
- export {
178
- calcBundledPackages,
179
- generateDts
180
- };
246
+
247
+ export { calcBundledPackages, generateDts };