pintariching/rustle

General utilities rewrite

Closed this issue ยท 9 comments

One place to start would be rewriting all the utilities from here: https://github.com/sveltejs/svelte/tree/master/src/compiler/utils

A lot of them are used further up in the parsing and compiling.

  • error.ts
  • extract_svelte_ignore.ts
  • flatten.ts
  • full_char_code_at.ts
  • fuzzymatch.ts
  • get_code_frame.ts
  • link.ts
  • list.ts
  • mapped_code.ts
  • names.ts
  • namespaces.ts
  • nodes_match.ts
  • patterns.ts

I would love to help with this :)

@Antonio-Bennett Feel free to open a PR on anything you like ๐Ÿ˜

@pintariching okay thanks! Anything you're currently working on that I shouldn't duplicate?

Most of it is commited to main right now, so feel free to pick up anything

I need to review the PR implement locate_character module before implementing the error :)

  • trim.ts
    • contains two functions trim_start and trim_end I suppose we won't need these since Rust standard library already has these [1] [2]
  • push_array.ts
    • Same. Already implement in Rust standard library

Yeah that makes sense. No point in implementing these.

Hi there, I'd love to help with this (although I am pretty new to rust). It occurs to me that some of these functions will not be required as Rust's type safety will make it difficult for them to be called so it will be fixed at the calling level. For example the flatten function will take [1, [2, 3, [4, 5]]] => [1, 2, 3, 4, 5] but this would be challenging to even create a vec with this shape. It seems that we'd be doing some funny encoding (and wrapping stuff in Boxes) to just decode it after?? (Excuse me if I have completely missed some very basic concept in Rust!!)

It could be that the flatten function doesn't need to be used as with trim_start and trim_end. I haven't seen where it's used yet. If you're new and want a challenge you can try and implementing it as a challenge, but know that it may not be used ๐Ÿ˜