rolldown-plugin-dts 0.15.4 → 0.15.5
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.
|
@@ -248,6 +248,13 @@ function tscEmit(tscOptions) {
|
|
|
248
248
|
debug(`got source file: ${file.fileName}`);
|
|
249
249
|
let dtsCode;
|
|
250
250
|
let map;
|
|
251
|
+
const stripPrivateFields = (ctx) => {
|
|
252
|
+
const visitor = (node) => {
|
|
253
|
+
if (ts.isPropertySignature(node) && ts.isPrivateIdentifier(node.name)) return ctx.factory.updatePropertySignature(node, node.modifiers, ctx.factory.createStringLiteral(node.name.text), node.questionToken, node.type);
|
|
254
|
+
return ts.visitEachChild(node, visitor, ctx);
|
|
255
|
+
};
|
|
256
|
+
return (sourceFile) => ts.visitNode(sourceFile, visitor, ts.isSourceFile) ?? sourceFile;
|
|
257
|
+
};
|
|
251
258
|
const { emitSkipped, diagnostics } = program.emit(file, (fileName, code) => {
|
|
252
259
|
if (fileName.endsWith(".map")) {
|
|
253
260
|
debug(`emit dts sourcemap: ${fileName}`);
|
|
@@ -256,7 +263,7 @@ function tscEmit(tscOptions) {
|
|
|
256
263
|
debug(`emit dts: ${fileName}`);
|
|
257
264
|
dtsCode = code;
|
|
258
265
|
}
|
|
259
|
-
}, void 0, true,
|
|
266
|
+
}, void 0, true, { afterDeclarations: [stripPrivateFields] }, true);
|
|
260
267
|
if (emitSkipped && diagnostics.length) return { error: ts.formatDiagnostics(diagnostics, formatHost) };
|
|
261
268
|
if (!dtsCode && file.isDeclarationFile) {
|
|
262
269
|
debug("nothing was emitted. fallback to sourceFile text.");
|
package/dist/tsc-worker.js
CHANGED
package/dist/tsc.js
CHANGED