defuddle-cli 0.1.3 → 0.1.4

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/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import { JSDOM, VirtualConsole } from 'jsdom';
4
- import pkg from 'defuddle';
5
- const { Defuddle } = pkg;
4
+ import Defuddle from 'defuddle';
6
5
  import chalk from 'chalk';
7
6
  import { readFile, writeFile } from 'fs/promises';
8
7
  import { fileURLToPath } from 'url';
@@ -702,6 +701,7 @@ program
702
701
  }
703
702
  // Parse content with debug mode if enabled
704
703
  try {
704
+ // @ts-ignore - Module interop issue between ES modules and CommonJS
705
705
  const defuddle = new Defuddle(doc, {
706
706
  debug: options.debug
707
707
  });
@@ -767,6 +767,10 @@ program
767
767
  else {
768
768
  console.log(output);
769
769
  }
770
+ // Clean up JSDOM resources
771
+ contentDom.window.close();
772
+ dom.window.close();
773
+ process.exit(0);
770
774
  }
771
775
  catch (error) {
772
776
  console.error(chalk.red('Error during parsing:'), error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defuddle-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Command line interface for Defuddle - extract article content from web pages",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "chalk": "^5.3.0",
23
23
  "commander": "^12.0.0",
24
- "defuddle": "^0.3.6",
24
+ "defuddle": "^0.3.8",
25
25
  "jsdom": "^24.0.0",
26
26
  "turndown": "^7.2.0"
27
27
  },
package/src/index.ts CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander';
4
4
  import { JSDOM, VirtualConsole, DOMWindow } from 'jsdom';
5
- import pkg from 'defuddle';
6
- const { Defuddle } = pkg;
5
+ import Defuddle from 'defuddle';
7
6
  import chalk from 'chalk';
8
7
  import { readFile, writeFile } from 'fs/promises';
9
8
  import { fileURLToPath } from 'url';
@@ -801,6 +800,7 @@ program
801
800
 
802
801
  // Parse content with debug mode if enabled
803
802
  try {
803
+ // @ts-ignore - Module interop issue between ES modules and CommonJS
804
804
  const defuddle = new Defuddle(doc, {
805
805
  debug: options.debug
806
806
  });
@@ -870,6 +870,12 @@ program
870
870
  } else {
871
871
  console.log(output);
872
872
  }
873
+
874
+ // Clean up JSDOM resources
875
+ contentDom.window.close();
876
+ dom.window.close();
877
+
878
+ process.exit(0);
873
879
  } catch (error) {
874
880
  console.error(chalk.red('Error during parsing:'), error);
875
881
  process.exit(1);