Commit Graph

767 Commits

Author SHA1 Message Date
Evan You e8bbc946cb
feat(compiler-sfc): analyze import usage in template via AST (#9729)
close #8897
close nuxt/nuxt#22416
2023-12-01 11:14:48 +08:00
Evan You 4d94ebfe75 perf(v-on): constant handlers with modifiers should not be treated as dynamic 2023-11-30 19:26:36 +08:00
edison 7cbcee3d83
fix(compiler-sfc): support resolving components from props (#8785) 2023-11-30 18:03:23 +08:00
ZHAO Jin-Xiang 3071de44bc
fix(compiler-core): fix referencing typo (#9708) 2023-11-29 21:15:44 +08:00
edison 509c192ff4
chore: fix typo (#9689) 2023-11-29 12:26:10 +08:00
ZHAO Jin-Xiang fff7b864f4
feat: use enum to replace const enum (#9261)
close #1228
2023-11-29 12:24:50 +08:00
Evan You 47ea285be3 fix(parser): properly set initial inXML state based on root ns 2023-11-28 18:37:17 +08:00
Evan You ef97e8b07d fix(parser): should reset inRCDATA state 2023-11-28 18:31:17 +08:00
三咲智子 Kevin Deng 9f8ba9821f feat(dx): link errors to docs in prod build (#9165) 2023-11-28 07:39:11 +08:00
Evan You e49dffc9ec fix(parser): directive arg should be undefined on shorthands with no arg 2023-11-27 18:10:00 +08:00
Evan You 41ff68ea57 feat(compiler): improve parsing tolerance for language-tools 2023-11-27 16:55:54 +08:00
Evan You fb619cf9a4 fix(compiler-sfc): fix ast reuse for ssr 2023-11-27 15:38:30 +08:00
Evan You 2e65ea481f fix(compiler-core): fix line/column tracking when fast forwarding 2023-11-27 14:49:13 +08:00
Evan You 50cde7cfbc perf(compiler-sfc): use faster source map addMapping 2023-11-27 14:42:12 +08:00
Evan You d193666fdc chore: use MappingItem type 2023-11-27 14:16:16 +08:00
Evan You f15d2f6cf6 perf: avoid sfc source map unnecessary serialization and parsing 2023-11-27 12:26:51 +08:00
Evan You 157cfcb796 refactor: restore isSelfClosing as optional property 2023-11-25 22:55:39 +08:00
Evan You e48cbf02be refactor: restore SourceLocation.source
this is used extensively in @vue/language-tools and does not have
noticeable impact on performance
2023-11-25 19:22:39 +08:00
Evan You 08f0baa2ad refactor: preserve source location convention in sfc mode for base parser
For compatibility w/ usage like https://github.com/vue-macros/vue-macros/blob/main/packages/setup-block/src/core/index.ts
2023-11-25 18:07:29 +08:00
Evan You be6cae7dac chore: remove isSelfClosing property 2023-11-25 18:03:22 +08:00
Evan You 6ec85ae872 chore: restructure parser files 2023-11-25 16:18:29 +08:00
Evan You c11002f16a perf(codegen): optimize source map generation 2023-11-25 16:18:29 +08:00
Evan You 3be53d9b97 perf(codegen): optimize line / column calculation during codegen
Previously, many CodegenContext.push() calls were unnecessarily
iterating through the entire pushed string to find newlines, when we
already know the newline positions for most of calls. Providing fast
paths for these calls significantly improves codegen performance when
source map is needed.

In benchmarks, this PR improves full SFC compilation performance by ~6%.
2023-11-25 16:18:29 +08:00
Evan You 20732366b9 perf: optimize position cloning 2023-11-25 16:18:29 +08:00
Evan You 3ee343928a wip: parser v2 compat 2023-11-25 16:18:29 +08:00
Evan You 6022ac05c4 chore: document rationale for ignoring some parsing errors 2023-11-25 16:18:29 +08:00
Evan You e702b278d4 wip: shorten some method names 2023-11-25 16:18:29 +08:00
Evan You 59227d4124 wip: parse error tests 2023-11-25 16:18:29 +08:00
Evan You 1b4efc30c3 wip: should parse sfc template with lang=html 2023-11-25 16:18:29 +08:00
Evan You e41cf8dc59 refactor: better naming for baseCompile argument 2023-11-25 16:18:29 +08:00
Evan You 94c86269d0 refactor: fix v-bind no-exp shorthand for new parser 2023-11-25 16:18:29 +08:00
Evan You e5afca6c1e wip: treat template with preprocessor as plain text 2023-11-25 16:18:29 +08:00
Evan You 059caafc13 wip: pass all compiler-sfc tests 2023-11-25 16:18:29 +08:00
Evan You dda4fd526e wip: pass all compiler-ssr tests 2023-11-25 16:18:29 +08:00
Evan You 5a44b84cde wip: pass all compiler-dom tests 2023-11-25 16:18:29 +08:00
Evan You 40f72d5e50 feat(compiler-core): support specifying root namespace when parsing 2023-11-25 16:18:29 +08:00
Evan You a1b10a21ac wip: pass more compiler-dom tests 2023-11-25 16:18:29 +08:00
Evan You 1912af04e3 wip: entities parsing in browser 2023-11-25 16:18:29 +08:00
Evan You caabba7590 wip: tune perf 2023-11-25 16:18:29 +08:00
Evan You 082b5a71c6 wip: pass all compiler-core tests 2023-11-25 16:18:29 +08:00
Evan You c4e50e46bb wip: more tests passing 2023-11-25 16:18:29 +08:00
Evan You e05ba29555 wip: pass all non-error parsing tests 2023-11-25 16:18:29 +08:00
Evan You a60ad9180d refactor: swap to new template parser
- get rid of SourceLocation.source for memory efficiency
- move source location generation logic transform phase into the parser
  itself so that SourceLocation.source is no longer needed
  - move v-for expression parsing into the parser itself
  - added nameLoc on AttributeNode for use in transformElement

Tests are not passing yet.
2023-11-25 16:18:29 +08:00
Evan You 65b44045ef wip: parse mode 2023-11-25 16:18:29 +08:00
Evan You 66c0ed0a3c perf: optimize away isBuiltInType 2023-11-25 16:18:29 +08:00
Evan You 59e38f18d8 wip: parseMode 2023-11-25 16:18:29 +08:00
Evan You 81e941da5b wip: getting ready for textmode handling 2023-11-25 16:18:29 +08:00
Evan You 5a855c57d7 wip: comments 2023-11-25 16:18:29 +08:00
Evan You a12abe72bc wip: refine element type 2023-11-25 16:18:29 +08:00
Evan You c342433cb5 wip: v-pre handling 2023-11-25 16:18:29 +08:00
Evan You 1a1f680536 wip: pre tag handling 2023-11-25 16:18:29 +08:00
Evan You 5762288bdf wip: parse interpolation 2023-11-25 16:18:29 +08:00
Evan You 70edd1c61e wip: check duplicated attributes 2023-11-25 16:18:29 +08:00
Evan You ec33e61e87 wip: remove htmlMode 2023-11-25 16:18:29 +08:00
Evan You db085b4a79 wip: remove foreignContext check 2023-11-25 16:18:29 +08:00
Evan You 65c0b31148 wip: modifiers 2023-11-25 16:18:29 +08:00
Evan You b81415ceac wip: source location for props 2023-11-25 16:18:29 +08:00
Evan You 08038a938c wip: parse directive in tokenizer 2023-11-25 16:18:29 +08:00
Evan You 622d34efe1 wip: optimize condenseWhitespace 2023-11-25 16:18:29 +08:00
Evan You 9aa8effec3 wip: parse directives 2023-11-25 16:18:29 +08:00
Evan You f131a4723b wip: loc for elements 2023-11-25 16:18:29 +08:00
Evan You f7db16b9cf wip: refactor line / column generation 2023-11-25 16:18:29 +08:00
Evan You 6311ebbf32 wip: save 2023-11-25 16:18:29 +08:00
Evan You 19bd714239 wip: port parser 2023-11-25 16:18:29 +08:00
Evan You 2a6292e37f wip: remove unused options 2023-11-25 16:18:29 +08:00
Evan You bc37eae8b0 wip: strip xmlMode / htmlMode 2023-11-25 16:18:29 +08:00
Evan You 5b9141cc30 wip: setup 2023-11-25 16:18:29 +08:00
Evan You 1ea775633d chore: Merge branch 'main' into minor 2023-11-21 09:48:26 +08:00
renovate[bot] 16a6438236
chore(deps): update lint (#9627)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-11-18 10:33:24 +08:00
Tycho d5fd343555
refactor(compiler-sfc): reuse `forAliasRE` regex from compiler-core (#9568) 2023-11-10 14:22:00 +08:00
Ha Pam 341b5416b2
chore: typo and grammar (#8568) [ci skip]
Co-authored-by: Han <phamvanhan@gmail.com>
2023-11-10 13:42:26 +08:00
Evan You 364f319d21 fix(hydration): force hydration for v-bind with .prop modifier
ref #7490
2023-11-10 13:13:07 +08:00
edison a2d810eb40
fix(compiler-core): avoid rewriting scope variables in inline for loops (#7245)
close #7238
2023-11-09 17:20:54 +08:00
zhiyuanzmj 26399aa6fa
feat(compiler-core): support v-bind shorthand for key and value with the same name (#9451) 2023-11-02 17:48:11 +08:00
丶远方 a75d1c5c62
fix(compiler-core): known global should be shadowed by local variables in expression rewrite (#9492)
fix #9482
2023-10-28 15:22:03 +08:00
花果山大圣 f7e80ee4a0
feat(compiler-core): export error message (#8729) 2023-10-27 23:28:40 +09:00
edison e09c26bc9b
fix(compiler-ssr): proper scope analysis for ssr vnode slot fallback (#7184)
close #7095
2023-10-25 01:01:29 +08:00
Evan You 28a6f05bf5 chore: remove internal flag on hmr option 2023-10-22 09:10:43 +08:00
Evan You 733437691f fix(hmr): fix hmr error for hoisted children array in v-for
fix #6978
close #7114
2023-10-21 21:08:49 +08:00
丶远方 712f96d6ac
perf: replace Map/Set with WeakMap/WeakSet (#8549) 2023-10-20 17:11:52 +08:00
Evan You ae7453f0f1 chore: use moduleResolution: bundler + shim estree-walker 2023-06-23 08:54:25 +08:00
Evan You a95e612b25 chore: rename globals allow list
close #8416
2023-05-26 11:07:13 -05:00
Evan You 8dc8cf852b fix(compiler-core): treat floating point numbers as constants
close #8295
2023-05-12 10:53:40 +01:00
Evan You b434d12bf6 fix(compiler-core): handle slot argument parsing edge case
ref https://github.com/vuejs/language-tools/issues/2710
2023-04-27 16:55:37 +08:00
Evan You bbd8301a13 feat(deprecation): deprecate v-is directive 2023-04-21 15:30:26 +08:00
Evan You 5f0394a5ab feat(deprecation): deprecate @vnode hooks in favor of vue: prefix 2023-04-21 15:20:12 +08:00
Evan You 0f77a2b1d1 fix(compiler): fix expression codegen for literal const bindings in non-inline mode 2023-04-18 11:39:53 +08:00
Evan You 8aa4ea81d6 feat(compiler-sfc): support relative imported types in macros 2023-04-15 22:08:39 +08:00
Evan You d0ac57872c refactor(compiler-sfc): extract more defineProps logic 2023-04-11 16:05:00 +08:00
Evan You 19e17a951c perf(compiler): use source-map-js 2023-04-09 16:50:20 +08:00
Evan You 05f94cf7b0 fix(compiler-ssr): disable v-once transform in ssr vdom fallback branch
fix #7644
2023-04-05 11:10:21 +08:00
Evan You 6bda4b6688 fix(compiler-core): fix codegen for literal const in non-inline mode 2023-03-30 15:19:27 +08:00
Evan You ba9c2ae247
feat(compiler-sfc): enable reactive props destructure by default and deprecate withDefaults() (#7986) 2023-03-30 11:58:16 +08:00
三咲智子 Kevin Deng 77686cf476
fix(compiler-core): check if expression is constant (#7974)
close #7973
2023-03-29 09:02:16 +08:00
三咲智子 Kevin Deng 0002567728
feat(compiler-sfc): support module string names syntax (#7428)
https://github.com/tc39/ecma262/pull/2154
2023-03-28 16:28:06 +08:00
三咲智子 Kevin Deng 1b69d5f2f4
fix(compiler-sfc): unwrap TS node for defineProps (#7340) 2023-03-28 15:22:01 +08:00
三咲智子 Kevin Deng 7def8b15b8
feat(complier-sfc): hoist literal constants for script (#5752)
- Support using literal constants in macros
- fix useCssVars insert position edge case
- fix non-literal-const enum hoisting

close #5750
2023-03-28 11:34:29 +08:00
Evan You 58e5c51149 build: upgrade to TypeScript 5.x 2023-03-23 17:11:35 +08:00
Evan You aac163110f refactor: remove circular dependencies in compiler 2023-03-23 16:30:42 +08:00
Evan You e22b5c510d chore: remove hanging slash from import 2023-02-03 04:31:17 +08:00