Module: ReactOnRails::Generators::RscSetup::ClientReferences
- Included in:
- ReactOnRails::Generators::RscSetup
- Defined in:
- lib/generators/react_on_rails/rsc_setup/client_references.rb
Overview
rubocop:disable Metrics/ModuleLength
Constant Summary collapse
- JS_STRING_DELIMITERS =
["'", '"', "`"].freeze
- JS_COMMENT_STATES =
%i[line_comment block_comment].freeze
- REGEX_LITERAL_PRECEDERS =
Known limitation: this list only covers single-character regex preceders. Multi-character JavaScript keywords that legally precede a regex literal (‘return`, `typeof`, `void`, `delete`, `throw`, `case`, `in`, `instanceof`) are not represented. A regex like `/appearing after `return` may be misidentified as a division operator and let `{` / `` inside the regex body throw off `matching_js_closing_brace`’s depth counter. The unparseable-section detection in ‘rsc_plugin_options_followed_by_close_paren?` catches the resulting corruption and flags the section as unparseable, so the migration falls back safely rather than producing a wrong rewrite.
["(", "{", "[", "=", ":", ",", ";", "!", "?", "&", "|", "+", "-", "*", "~", "^", "<", ">"].freeze
- RSC_PLUGIN_INVOCATION_REGEX =
Matches ‘new RSCWebpackPlugin(` allowing whitespace/newlines between `new`, the class name, and the open paren. Shared by the partition scanner and the routing checks so both detect the same set of invocations.
/new\s+RSCWebpackPlugin\s*\(/