Skip to content

Commit

Permalink
Filter out SvelteComponent comments and types.
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonrt committed May 7, 2024
1 parent d6b4357 commit bc53c78
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/generate/processDTS.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ function processPackageStandard()
*/
function processPackageSvelte()
{
const svelteTypes = fs.readFileSync('./node_modules/svelte/types/index.d.ts', 'utf-8');
let svelteTypes = fs.readFileSync('./node_modules/svelte/types/index.d.ts', 'utf-8');

svelteTypes = svelteTypes.replaceAll('### PRIVATE API', '@internal');
svelteTypes = svelteTypes.replaceAll('### DO NOT USE!', '@internal');
svelteTypes = svelteTypes.replaceAll('$capture_state(): void;', '');
svelteTypes = svelteTypes.replaceAll('$inject_state(): void;', '');

// const regex = /declare module '([^']*)' \{([^}]*)}/gs;
const regex = /declare module '([^']*)' \{((?:[^d]|d(?!eclare module))+)}/gs;
Expand Down

0 comments on commit bc53c78

Please sign in to comment.