dtsroll 1.7.5 → 1.7.6

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/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { cli } from 'cleye';
3
- import { b as bgYellow, a as black, d as dtsroll, l as logOutput } from './index-CcbG5cCp.mjs';
3
+ import { b as bgYellow, a as black, d as dtsroll, l as logOutput } from './index-CqO1yLQ_.mjs';
4
4
  import { patchErrorWithTrace } from 'rollup-plugin-import-trace';
5
5
  import 'node:path';
6
6
  import 'node:fs/promises';
@@ -14,7 +14,7 @@ import 'resolve-pkg-maps';
14
14
  import 'byte-size';
15
15
 
16
16
  var name = "dtsroll";
17
- var version = "1.7.5";
17
+ var version = "1.7.6";
18
18
  var description = "Bundle dts files";
19
19
 
20
20
  const argv = cli({
@@ -3132,6 +3132,23 @@ declare const ${defaultExport}: {`,
3132
3132
  }
3133
3133
  code.remove(start, end);
3134
3134
  }
3135
+ const fullText = sourceFile.getFullText();
3136
+ const eofTrivia = ts.getLeadingCommentRanges(fullText, sourceFile.endOfFileToken.getFullStart());
3137
+ const lastStatement = sourceFile.statements[sourceFile.statements.length - 1];
3138
+ const trailingTrivia = lastStatement ? ts.getTrailingCommentRanges(fullText, lastStatement.getEnd()) : void 0;
3139
+ for (const comment of [...eofTrivia ?? [], ...trailingTrivia ?? []]) {
3140
+ if (comment.kind !== ts.SyntaxKind.SingleLineCommentTrivia)
3141
+ continue;
3142
+ const text = fullText.slice(comment.pos, comment.end);
3143
+ if (!/\/\/[#@]\s*sourceMappingURL=/.test(text))
3144
+ continue;
3145
+ let start = comment.pos;
3146
+ if (start > 0 && fullText[start - 1] === "\n") {
3147
+ start -= 1;
3148
+ }
3149
+ code.remove(start, comment.end);
3150
+ break;
3151
+ }
3135
3152
  return {
3136
3153
  code,
3137
3154
  typeReferences,
@@ -4055,6 +4072,7 @@ const transform = (enableSourcemap) => {
4055
4072
  const moduleId = Array.from(moduleIds).find((id) => trimExtension(id) === name);
4056
4073
  const isEntry = Boolean(moduleId && this.getModuleInfo(moduleId)?.isEntry);
4057
4074
  const isJSON = Boolean(moduleId && JSON_EXTENSIONS.test(moduleId));
4075
+ const rawCode = code;
4058
4076
  let sourceFile = parse(fileName, code);
4059
4077
  const preprocessed = preProcess({ sourceFile, isEntry, isJSON });
4060
4078
  allTypeReferences.set(sourceFile.fileName, preprocessed.typeReferences);
@@ -4074,7 +4092,7 @@ const transform = (enableSourcemap) => {
4074
4092
  if (DTS_EXTENSIONS.test(fileName)) {
4075
4093
  pendingSourcemaps.set(fileName, {
4076
4094
  fileName,
4077
- originalCode: code,
4095
+ originalCode: rawCode,
4078
4096
  inputMapText
4079
4097
  });
4080
4098
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import 'node:path';
3
- export { d as dtsroll } from './index-CcbG5cCp.mjs';
3
+ export { d as dtsroll } from './index-CqO1yLQ_.mjs';
4
4
  import 'node:fs/promises';
5
5
  import 'rollup';
6
6
  import 'typescript';
package/dist/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { d as dtsroll, l as logOutput } from './index-CcbG5cCp.mjs';
2
+ import { d as dtsroll, l as logOutput } from './index-CqO1yLQ_.mjs';
3
3
  import 'node:path';
4
4
  import 'node:fs/promises';
5
5
  import 'rollup';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtsroll",
3
- "version": "1.7.5",
3
+ "version": "1.7.6",
4
4
  "description": "Bundle dts files",
5
5
  "keywords": [
6
6
  "bundle",