swc/crates
Justin Ridgewell a203fdb1b6
fix(common): Fix BytePos -> CharPos calculations (#6574)
**Description:**

This fixes the BytePos -> CharPos calculation necessary for source maps.
There were a few issues in the old code:

1. UTF-8 maps 1-3 bytes into 1 UTF-16 char, but 4 bytes into 2 UTF-16 chars
2. The starting offset was not recorded when we reached the end of the `multibyte_chars` iteration
3. The `mappings` can be unordered, meaning we need to restart the UTF-16 offset calculation

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6552.
2022-12-04 14:52:00 +09:00
..
ast_node chore: Publish crates 2022-09-15 05:23:46 +00:00
better_scoped_tls
binding_macros chore: Publish crates 2022-12-03 00:26:38 +00:00
dbg-swc chore: Publish crates 2022-12-03 00:26:38 +00:00
enum_kind
from_variant
jsdoc chore: Publish crates 2022-12-03 00:26:38 +00:00
preset_env_base chore: Publish crates 2022-11-30 07:13:15 +00:00
string_enum chore: Publish crates 2022-10-10 13:09:51 +00:00
swc fix(common): Fix BytePos -> CharPos calculations (#6574) 2022-12-04 14:52:00 +09:00
swc_atoms chore: Publish crates 2022-11-20 00:30:30 +00:00
swc_bundler chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_cached chore: Publish crates 2022-10-11 11:23:16 +00:00
swc_common fix(common): Fix BytePos -> CharPos calculations (#6574) 2022-12-04 14:52:00 +09:00
swc_config chore: Publish crates 2022-10-11 11:23:16 +00:00
swc_config_macro
swc_core chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_ast chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_codegen chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_codegen_macros build(cargo): Remove unused deps (#6117) 2022-10-11 11:20:14 +00:00
swc_css_compat chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_lints chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_minifier chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_modules chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_parser chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_prefixer chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_utils chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_css_visit chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_ast chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_codegen chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_codegen_macros
swc_ecma_dep_graph chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_ext_transforms chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_lints chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_loader chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_minifier chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_parser chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_preset_env chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_quote chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_quote_macros chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_testing chore: Publish crates 2022-12-01 05:26:50 +09:00
swc_ecma_transforms chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_base chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_classes chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_compat chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_macros perf(es/minifier): Enable parallel processing (#5705) 2022-09-01 13:36:30 +09:00
swc_ecma_transforms_module chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_optimization chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_proposal chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_react chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_testing chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_transforms_typescript chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_utils chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecma_visit chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_ecmascript chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_eq_ignore_macros
swc_error_reporters chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_estree_ast chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_estree_compat fix(common): Fix BytePos -> CharPos calculations (#6574) 2022-12-04 14:52:00 +09:00
swc_fast_graph chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_graph_analyzer chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_html chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_html_ast chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_html_codegen chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_html_codegen_macros build(cargo): Remove unused deps (#6117) 2022-10-11 11:20:14 +00:00
swc_html_minifier chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_html_parser chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_html_utils chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_html_visit chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_macros_common
swc_node_base chore: Publish crates 2022-10-24 03:58:37 +00:00
swc_node_bundler chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_node_comments chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_nodejs_common chore: Publish crates 2022-10-24 03:58:37 +00:00
swc_plugin
swc_plugin_macro chore: Publish crates 2022-12-02 14:55:20 +00:00
swc_plugin_proxy chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_plugin_runner chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_plugin_testing
swc_timer chore: Publish crates 2022-12-03 00:26:38 +00:00
swc_trace_macro
swc_visit chore: Publish crates 2022-09-21 09:59:44 +09:00
swc_visit_macros chore: Publish crates 2022-09-21 09:59:44 +09:00
swc_xml chore: Publish crates 2022-12-03 03:56:24 +00:00
swc_xml_ast chore: Publish crates 2022-12-03 03:56:24 +00:00
swc_xml_codegen chore: Publish crates 2022-12-03 03:56:24 +00:00
swc_xml_codegen_macros
swc_xml_parser chore: Publish crates 2022-12-03 03:56:24 +00:00
swc_xml_visit chore: Publish crates 2022-12-03 03:56:24 +00:00
testing chore: Publish crates 2022-12-03 00:26:38 +00:00
testing_macros refactor: Refactor code using clippy (#5863) 2022-09-14 15:05:59 +00:00