Commit Graph

322 Commits

Author SHA1 Message Date
Evan You 7b2ff1e207 chore: remove deprecated ref sugar warning 2023-04-21 15:54:51 +08:00
Evan You 4e028b9669 feat(compiler-sfc): support specifying global types for sfc macros
ref: https://github.com/vuejs/core/pull/8083#issuecomment-1508468713
2023-04-16 15:49:41 +08:00
Evan You 6b13e04b4c feat(compiler-sfc): mark props destructure as experimental and require explicit opt-in 2023-04-15 22:09:08 +08:00
Evan You 8d8ddd686c feat(compiler-sfc): expose type import deps on compiled script block 2023-04-15 22:08:39 +08:00
Evan You a9f5e14c7c chore: comments [ci skip] 2023-04-15 22:08:39 +08:00
Evan You 3982bef533 feat(compiler-sfc): support resolving type imports from modules 2023-04-15 22:08:39 +08:00
Evan You 8aa4ea81d6 feat(compiler-sfc): support relative imported types in macros 2023-04-15 22:08:39 +08:00
Evan You b2cdb2645f refactor(compiler-sfc): rework macro type resolution 2023-04-11 23:00:28 +08:00
Evan You ae5a9323b7 refactor(compiler-sfc): split normal script logic 2023-04-11 16:05:00 +08:00
Evan You 3da1bb36b1 refactor(compiler-sfc): split all macros 2023-04-11 16:05:00 +08:00
Evan You c52157c87d refactor(compiler-sfc): split more logic 2023-04-11 16:05:00 +08:00
Evan You 0232c00e11 refactor(compiler-sfc): simplify props destructure arguments 2023-04-11 16:05:00 +08:00
Evan You 5a529bbf23 refactor(compiler-sfc): extract defineEmits logic 2023-04-11 16:05:00 +08:00
Evan You 9f2ca5155e refactor(compiler-sfc): extract processDefineModel, move main magic string instance to context 2023-04-11 16:05:00 +08:00
Evan You 9f5692e052 refactor(compiler-sfc): collapse genRuntimeProps logic 2023-04-11 16:05:00 +08:00
Evan You d0ac57872c refactor(compiler-sfc): extract more defineProps logic 2023-04-11 16:05:00 +08:00
Evan You fe9760188d refactor(compiler-sfc): remove useless type generation
we are no longer type-checking generated code
2023-04-11 16:05:00 +08:00
Evan You acd7eb22cf refactor(compiler-sfc): (wip) split compileScript logic, use context, move defineProps 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
三咲智子 Kevin Deng 14f3d747a3
feat(sfc): introduce `defineModel` macro and `useModel` helper (#8018) 2023-04-08 12:13:05 +08:00
三咲智子 Kevin Deng f7f4624191
fix(compiler-sfc): fix binding type for constants when hoistStatic is disabled (#8029) 2023-04-06 17:19:00 +08:00
-isum 3ccbea08e0
fix(compiler-sfc): accept `StringLiteral` node in `defineEmit` tuple syntax (#8041)
close #8040
2023-04-06 17:13:34 +08:00
三咲智子 Kevin Deng 955752951e
fix(compiler-sfc): skip empty `defineOptions` and support TypeScript type assertions (#8028) 2023-04-05 17:33:29 +08:00
Evan You b2c874e3b9 refactor(compiler-sfc): move related files into separate directories 2023-04-05 16:35:10 +08:00
三咲智子 Kevin Deng 5a2f5d59cf
feat(types/slots): support slot presence / props type checks via `defineSlots` macro and `slots` option (#7982) 2023-04-03 16:49:16 +08:00
Evan You 59e828448e
feat(reactivity): improve support of getter usage in reactivity APIs (#7997) 2023-04-02 10:17:51 +08:00
Evan You 482f2e3434 fix(compiler-sfc): use dynamic defaults merging for methods with computed keys
ref #7113
2023-03-31 09:08:23 +08:00
Evan You fe619443d2 feat(compiler-sfc): support arbitrary expression as withDefaults argument
ref #6459
2023-03-31 09:04:27 +08:00
Evan You 566748c1ed chore: remove unused param 2023-03-31 08:58:03 +08:00
Evan You 4af5d1b075 feat(sfc): revert withDefaults() deprecation
In some cases, the user still needs access to the full props object,
in such cases withDefaults() is still needed.
2023-03-31 08:53:15 +08:00
Evan You f5971468e5 refactor(compiler-sfc): remove unnecessary emits type codegen
This is no longer necessary as we no longer recommend type checking generated code
2023-03-30 20:06:11 +08:00
Evan You ef73ea53ea feat(compiler-sfc): codegen support for defineEmits() short syntax (followup of #7992) 2023-03-30 19:59:07 +08:00
Evan You 71635be68d feat(compiler-sfc): support generating variable instead of default export in compileScript 2023-03-30 16:58:41 +08:00
三咲智子 Kevin Deng ba4cec31b9
fix(compiler-sfc): infer runtime type in defineProps (#7972) 2023-03-30 14:49:28 +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
Evan You e10a89e608 fix(compiler-sfc): fix function default value handling w/ props destructure 2023-03-29 22:21:27 +08:00
Evan You 1a04fba10b fix(compiler-sfc): infer object type for empty type literal 2023-03-29 21:01:52 +08:00
Evan You a94072dd2c fix(compiler-sfc): fix defineExpose() codegen regression from #7949 2023-03-29 20:31:25 +08:00
三咲智子 Kevin Deng 63ad77f6f6
feat(runtime-core): add skipCheck for prop (#7548) 2023-03-28 22:29:54 +08:00
Evan You 1bde9fbc91 chore: fix accidentally replaced comments [ci skip] 2023-03-28 21:22:11 +08:00
三咲智子 Kevin Deng c839129ab9
fix(compiler-sfc): avoid codegen conflict with user variable named `expose` (#7949)
rename `expose` to `__expose` to avoid duplicate identifier

relate #7890
2023-03-28 17:34:23 +08:00
三咲智子 Kevin Deng 93f77292c9
fix(compiler-sfc): disallow `expose` property in `defineOptions` (#7967) 2023-03-28 17:32:37 +08:00
Evan You eded94712e feat(compiler-sfc): improve runtime props inference for enum 2023-03-28 17:29:31 +08:00
Evan You 5fb406e3e1 fix(compiler-sfc): properly handle unknown types in runtime prop inference
fix #7511
2023-03-28 17:15:25 +08:00
Evan You 6f5698c932 Revert "fix(compiler-sfc): infer correct type for enums"
This reverts commit 2e074a7009.
2023-03-28 16:55:19 +08:00
Evan You 2e074a7009 fix(compiler-sfc): infer correct type for enums
fix #7511
2023-03-28 16:39:13 +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 d60e58c9f6
fix(compiler-sfc): fix edge case of default export call with no args (#7536)
closes #7534
2023-03-28 16:27:34 +08:00
三咲智子 Kevin Deng 336a3d7b91
fix(compiler-sfc): properly remove comma of multiple macros in the same declaration (#7423)
closes #7422
reverts #6778
2023-03-28 16:23:39 +08:00
三咲智子 Kevin Deng 9f5e20ccff
fix(compiler-sfc): allow `<script>` with lang='js' (#7398) 2023-03-28 15:48:41 +08:00
Evan You 4355d2492d fix(compiler-sfc): handle more TS built-in utilities in defineProps inference 2023-03-28 15:41:24 +08:00
三咲智子 Kevin Deng 151a8ad6b9
fix(compiler-sfc): infer TSIntersectionType in defineProps (#7394) 2023-03-28 15:40:03 +08:00
三咲智子 Kevin Deng 1b69d5f2f4
fix(compiler-sfc): unwrap TS node for defineProps (#7340) 2023-03-28 15:22:01 +08:00
三咲智子 Kevin Deng 6391daf658
fix(compiler-sfc): infer TS Extract&Exclude runtime type (#7339)
closes #7337
closes #6252
2023-03-28 15:19:14 +08:00
三咲智子 Kevin Deng 3a7572cdb2
fix(compiler-sfc): infer function prop type from type literal w/ callable signature (#7119) 2023-03-28 11:59:21 +08:00
三咲智子 Kevin Deng 701b95ff3d
fix(compiler-sfc): rewrite default export with AST analysis instead of regex (#7068)
closes #7038
closes #7041
closes #7078
2023-03-28 11:54:22 +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
三咲智子 Kevin Deng bcf5841dde
feat(compiler-sfc): add defineOptions macro (#5738) 2023-03-28 10:43:51 +08:00
Evan You efb54e7315 feat(sfc): deprecate reactivity transform 2023-03-27 21:01:36 +08:00
Evan You 53e3533b75 chore: bump deps 2023-02-03 05:47:40 +08:00
edison 30399d46b1
fix(compiler-sfc): support resolving type declaration from normal script (#5831)
fix #5830
2023-02-01 04:24:50 -05:00
Julien Huang 686c829fec
fix(compiler-sfc): allow declaring variables after defineProps (#7461)
* fix(compiler-sfc): allow declaring variables after defineProps

* test(compiler-sfc): test defineProps in multiple variable declaration
2023-01-09 15:13:58 +01:00
三咲智子 Kevin Deng 3427052229
fix(reactivity-transform): prohibit const assignment at compile time (#6993)
close #6992
2022-11-14 02:54:41 -05:00
三咲智子 Kevin Deng 9060bf0353
refactor(compiler-core): make ast.helpers a Set (#6774) 2022-11-13 20:44:02 -05:00
三咲智子 Kevin Deng 4e5d9cdb82
refactor(compiler-sfc): drop Function prop type when no static default value (#7125) 2022-11-13 20:15:17 -05:00
三咲智子 Kevin Deng 584eae60d1
fix(compiler-sfc): always generate runtime prop type for Function (#7112)
fix #7111
2022-11-13 19:36:03 -05:00
Evan You 0594400980 fix(sfc): also generate getter for import bindings during dev 2022-11-10 17:32:06 +08:00
Evan You 5a3d45ae29 fix(sfc): ensure consistent dev/prod behavior for non-reactive variables declared in `<script setup>`
fix #5655
2022-11-10 17:02:45 +08:00
三咲智子 Kevin Deng 8a882ce0a1
fix(compiler-sfc): handle method shorthand syntax in withDefaults (#6972)
fix #6971
2022-11-08 22:12:54 -05:00
三咲智子 Kevin Deng 910fa7677f
fix(compiler-sfc): resolve computed object key (#6963) 2022-11-08 21:57:40 -05:00
Evan You 6861d2380b refactor(compiler-sfc): optimize import alias check for binding analysis 2022-11-08 17:47:47 +08:00
Evan You 8d1f526174 fix(compiler-sfc): fix binding analysis for aliased late import 2022-11-08 17:19:45 +08:00
三咲智子 Kevin Deng 4a00fddfed
fix(compiler-sfc): check import source during binding analysation (#6826)
fix #6825
2022-11-08 04:07:28 -05:00
花果山大圣 99b6697fb4
fix(compiler-sfc): fix macro usage in multi-variable declaration (#6778)
fix #6757
2022-11-07 22:16:21 -05:00
三咲智子 Kevin Deng b72a4af38a
fix(compiler-sfc): add semicolon after `defineProps` statement (#6461)
fix #6428
2022-11-07 21:17:48 -05:00
三咲智子 Kevin Deng c4f213b425
fix(reactivity-transform): add semicolon after statements (#6303) 2022-11-07 20:38:47 -05:00
三咲智子 (Kevin) bbb66d7ac7
ci: check prettier format (#6830) 2022-10-28 09:39:34 +08:00
ygj6 eab76046e3
fix(compiler-sfc): allow type annotation for defineEmits variable (#5394)
fix #5393
2022-10-26 05:12:55 -04:00
edison 83f7e6f8a6
fix(compiler-sfc): support using extends interface with defineProps() (#4512)
fix #4498
2022-10-26 04:44:30 -04:00
Travis 6958ec1b37
fix(compiler-sfc): fix expression check for v-on with object literal value (#6652)
fix #6650
fix #6674
2022-09-27 05:30:10 -04:00
Evan You 769e5555f9 fix(compiler-sfc): fix template usage check edge case for v-on statements
ref: https://github.com/vuejs/vue/issues/12591
2022-07-04 11:49:47 +08:00
Evan You fb3bfde264 chore: fix wrong condition in 3ff83694 2022-07-01 12:18:21 +08:00
Evan You 3ff83694f5 fix(compiler-sfc): only add decorators-legacy parser plugin when new decorators plugin is not used 2022-06-30 10:39:14 +08:00
Evan You 9734b31c31 fix(sfc): avoid auto name inference leading to unwanted recursion
fix #5965
fix #6027
fix #6029
2022-06-06 17:36:49 +08:00
Evan You 583b625987 fix(compiler-sfc): fix usage detection for types in v-for/v-slot expressions
fix #5959
2022-05-21 00:09:15 +08:00
Yunyoung LEE 991d62322f
fix(compiler-sfc): type-only defineProps does not recognize Promise (fix #5941) (#5943) 2022-05-18 19:34:52 -04:00
Evan You efea4a8b57 fix(ssr/sfc-css-vars): fix v-bind css vars codegen for SSR
fix #5443
close #5444
2022-05-17 09:21:44 +08:00
Evan You be6a0bff98 refactor: simplify logic 2022-05-13 15:41:49 +08:00
liulinboyi 6c3b681d23 fix(compiler-sfc): async transformer doesn't correctly detect need for semicolon in block #5808 2022-05-13 15:41:49 +08:00
Evan You de7a879cda chore: fix snapshot + simplify fix 2022-05-13 11:04:24 +08:00
liulinboyi 3b7b107120 fix(compiler-sfc): <script> after <script setup> the script content not end with `\\n` 2022-05-13 11:04:24 +08:00
edison 242914d938
fix(reactivity-transform): fix props access codegen for non-identifier prop names (#5436)
fix #5425
2022-05-12 22:38:46 -04:00
Travis f2c48f5352
fix(compiler-sfc): fix defineEmits() scope reference check error message (#5404) 2022-05-12 21:08:28 -04:00
Evan You 8a123ac34f fix(compiler-sfc): fix treeshaking of namespace import when used in template
fix #5209
2022-05-12 18:56:54 +08:00
Evan You ccf92564d3 fix(compiler-sfc): fix template usage check false positives on types
fix #5414
2022-05-12 18:23:10 +08:00
Evan You b7025d24f1 fix(compiler-sfc): ensure consistent behavior of export default render with script setup
close #4980
2022-05-11 17:20:32 +08:00
Evan You 410144149f fix(compiler-sfc): defineProps return binding or rest binding should be considered reactive 2022-05-10 17:34:15 +08:00
小刘(liulinboyi) 7d7a2410e5
fix(compiler-sfc): remove the jsx from the babelParserPlugins when not match the case of adding jsx (#5846)
fix #5845
2022-05-09 21:20:18 -04:00
ygj6 16939241b0
fix(compiler-sfc): automatically infer component name from filename when using script setup (#4997)
close #4993
2022-05-09 21:16:28 -04:00
Evan You 7dfe146096 fix(compiler-sfc): fix object default values for reactive props destructure 2022-05-10 08:39:27 +08:00