Commit Graph

424 Commits

Author SHA1 Message Date
Evan You aab99abd28 fix(slots): properly force update on forwarded slots
fix #1594
2020-07-15 20:12:49 -04:00
HcySunYang 64c7b2f9ce
fix(compiler-core): generate incremental keys for v-if/else-if/else chains (#1589)
fix #1587
2020-07-15 09:21:40 -04:00
Evan You 9152a89016 fix(v-on): capitalize dynamic event names 2020-07-13 17:36:46 -04:00
Evan You 576344d2c3 refactor(compiler): extract isStaticExp util 2020-07-13 16:48:24 -04:00
Evan You 65beba98fe fix(slots): differentiate dynamic/static compiled slots
fix #1557
2020-07-13 12:36:41 -04:00
Evan You b9595e64cf feat: ssr support for `<style vars>` 2020-07-12 18:04:09 -04:00
Evan You b6cdd5621e wip: template binding optimization 2020-07-10 22:12:25 -04:00
Evan You b51b79f5c4 refactor: rename optimizeBindings -> optimizeImports 2020-07-10 20:43:52 -04:00
Evan You 4c43d4e5b9 feat(compiler-sfc): `<script setup>` support (experimental)
This is the last commit for the feature which adds async/await detection.
2020-07-10 18:00:13 -04:00
Evan You 3e1cdba9db wip: tests for compileScriptSetup 2020-07-09 12:17:28 -04:00
Evan You 1359cc3a28 wip: compileScriptSetup 2020-07-09 12:17:28 -04:00
Evan You 87c2a1e50f fix(compiler-core/v-on): bail caching for member expression handlers on components
to preserve correct arity when it is passed down.
fix #1541
2020-07-08 11:48:12 -04:00
Evan You 4b5ce8b456 refactor(compiler-core): remove unnecessary arg in cached handler codegen 2020-07-08 11:48:12 -04:00
Felix Rilling 829b35e426
chore: typo fixes (#1546)
* chore: fix typos in comments/JSDoc.

* chore: fix typo in internal function name.

* chore: fix typos in test comments/descriptions/variable names.
2020-07-08 12:32:42 +02:00
Jack Robertson 64e2f46436
fix(compiler-core): add `\r` to accepted chars after end tag name (#1515)
fix #1476
2020-07-06 16:00:26 -04:00
Evan You afe13e0584 fix(ssr): fix ssr scopeId on component root 2020-06-27 00:27:44 -04:00
Evan You d5dbd27193 fix(ssr): handle fallthrough attrs in ssr compile output 2020-06-26 16:55:37 -04:00
HcySunYang 8a2cf21b71
perf(compiler-core): treat v-for with constant exp as a stable fragment (#1394) 2020-06-17 16:13:14 -04:00
Evan You 605953a154 refactor: only inject rest args for member expression handlers + fix tests 2020-06-15 15:24:46 -04:00
Cathrine Vaage 7e28173312
fix(compiler-core/v-on): pass noninitial arguments in cached event handlers (#1265) 2020-06-15 15:04:03 -04:00
underfin 35dbef268c
fix(compiler-core): should not prefix object method (#1375) 2020-06-15 11:20:00 -04:00
Evan You afb231ec5c fix(compiler-core): skip empty expressions when validating expressions in browser mode 2020-06-15 10:59:03 -04:00
Evan You 91fa52850a chore: lint for unused arguments 2020-06-12 16:31:31 -04:00
Evan You 825ec1500f fix(compiler-core): support static slot names containing dots for 2.x compat
close #1241
2020-06-12 16:09:27 -04:00
Evan You 0d26413433 fix(compiler-core): fix parsing for directive with dynamic argument containing dots 2020-06-12 15:59:13 -04:00
Evan You e29f0b3fc2 feat(compiler): better warning for invalid expressions in function/browser mode
fix #1266
2020-06-11 16:31:51 -04:00
Evan You f3623e4d1e fix(compiler-core): fix prod whitespace/comment removal
fix #1256
2020-06-11 11:45:10 -04:00
Evan You 80c868aefe workflow: setup eslint for prohibited syntax and globals
fix #1285
2020-06-10 16:54:23 -04:00
Evan You 9b5d13e598 fix: bail stringification for slots
fix #1281, close #1286
2020-06-10 14:31:59 -04:00
Carlos Rodrigues 958b6c80cf
fix(compiler-core): allow multiline expression on v-model and v-on (#1234) 2020-06-09 17:24:48 -04:00
Evan You 5f15d9aa4b fix(compiler-ssr): should escape template string interpolation chars in generated code 2020-05-26 14:38:24 -04:00
Evan You dd2bfb5a8f fix(compiler-dom): should bail stringification on runtime constant regardless of position
ref: vuejs/vite#157
2020-05-18 10:04:18 -04:00
Evan You d965bb6227 feat: improve static content stringiciation
Now a single static vnode can contain stringified content
for multiple consecutive nodes, which greatly improves the
coverage of this optimization.
2020-05-16 21:30:16 -04:00
Evan You baa6973b13 wip(compiler): tests for new stringification 2020-05-15 15:50:42 -04:00
Evan You cb9444807e wip(compiler): improve node stringification to support adjacent nodes 2020-05-15 12:58:44 -04:00
Evan You c2f3ee4dc0 chore: use jsdoc comments in ast 2020-05-15 11:00:07 -04:00
Evan You e58beecc97 refactor(compiler/types): convert compiler options documentation to jsdoc
BREAKING CHANGE: `getTextMode` compiler option signature has changed from

  ```ts
  (tag: string, ns: string, parent: ElementNode | undefined) => TextModes
  ```

  to

  ```ts
  (node: ElementNode, parent: ElementNode | undefined) => TextModes
  ```
2020-05-07 11:01:36 -04:00
Evan You 675330ba54 fix(compiler): warn against v-bind with empty attribute value
ref: https://github.com/vuejs/vue-next/issues/1128#issuecomment-624647434
2020-05-07 10:32:54 -04:00
Evan You f9a3766fd6 fix(compiler): bail strigification on runtime constant expressions 2020-05-04 15:15:26 -04:00
HiiTea f0d52d5428
chore: code comment formatting (#1089) [ci skip] 2020-05-01 18:48:44 -04:00
Evan You c5e7d8b532 fix(compiler-core): hoist pure annotations should apply to all nested calls 2020-05-01 18:36:34 -04:00
Evan You cad25d95a3 fix(compiler-core): hoisted vnode calls and scoped id calls should be marked pure
Otherwise they cannot be tree-shaken
2020-05-01 17:34:11 -04:00
HiiTea 22717772dd
chore: fix typos (#1090) 2020-05-01 09:42:58 -04:00
Evan You bd0f7da2c6 build: add browser builds for @vue/compiler-sfc 2020-04-26 01:24:25 -04:00
underfin 2b19965bcf
fix(slots): compiled slot fallback should be functions (#1030)
This avoids it being collected as dynamic children when it's not used.

fix #1021
2020-04-22 16:52:41 -04:00
Evan You 7d0ab3392a fix(compiler-core): dynamic component should always be made blocks
since it can potentially resolve to plain elements

fix #1018
2020-04-22 14:45:00 -04:00
Evan You 1068212cb2 chore: run prettier 2020-04-15 10:51:07 -04:00
Evan You a6e2b1052a fix(compiler-core): should not generate CLASS/STYLE patch flags on components
ref #677
2020-04-10 10:19:26 -04:00
Evan You 1f6e72b110 fix(compiler): support full range of entity decoding in browser builds
BREAKING CHANGE: compiler options have been adjusted.
    - new option `decodeEntities` is added.
    - `namedCharacterReferences` option has been removed.
    - `maxCRNameLength` option has been rmeoved.
2020-04-08 18:51:25 -04:00
Evan You 8c17535a47 fix(compiler): should not condense &nbsp;
fix #945
2020-04-08 17:33:07 -04:00
Evan You be666ebd59 fix(compiler): should only strip leading newline directly in pre tag 2020-04-08 16:44:32 -04:00
Evan You d531686f91 fix(compiler-core): elements with dynamic keys should be forced into blocks
fix #916
2020-04-07 18:44:21 -04:00
Evan You 7f30cb5772 fix(compiler): fix pre tag whitespace handling
- should preserve whitespace even in nested elements
- should remove leading newline per spec

fix #908
2020-04-03 21:02:20 -04:00
Evan You eee5095692 refactor: rename `<portal>` to `<teleport>`
BREAKING CHANGE: `<portal>` has been renamed to `<teleport>`.

    `target` prop is also renmaed to `to`, so the new usage will be:

    ```html
    <Teleport to="#modal-layer" :disabled="isMobile">
      <div class="modal">
        hello
      </div>
    </Teleport>
    ```

    The primary reason for the renaming is to avoid potential naming
    conflict with [native portals](https://wicg.github.io/portals/).
2020-04-01 21:55:19 -04:00
Evan You a022b63605 fix(compiler-core/slots): should support on-component named slots 2020-04-01 20:44:53 -04:00
Igor Randjelovic 20f4965b45
feat(compiler-core): export `transformElement` from compiler-core (#907) 2020-04-01 11:25:05 -04:00
Evan You 9ed9bf3687 feat(portal): SSR support for portal disabled prop 2020-03-30 11:24:29 -04:00
Evan You aafb880a0a feat(portal): support multiple portal appending to same target 2020-03-27 18:42:57 -04:00
Evan You b8ffbffaf7 feat(compiler-core): support v-is
see https://github.com/vuejs/rfcs/pull/149 for details
2020-03-27 16:38:31 -04:00
Evan You 16cd8eee78 fix(portal): portal should always remove its children when unmounted 2020-03-25 17:27:55 -04:00
Evan You c403c39126 chore: improve parser option comments [ci skip] 2020-03-24 18:29:15 -04:00
Evan You 0831b98eac fix(compiler-core): support interpolation in RCDATA mode (e.g. textarea) 2020-03-23 17:25:29 -04:00
Evan You f529dbde23 fix: dynamic component fallback to native element
fix #870
2020-03-23 14:47:04 -04:00
Evan You b8c1be18f3 refactor(types): use stricter settings
fix #847
2020-03-23 11:08:22 -04:00
ysj16 a3601e9fa7
perf(transform-vif): don't need to createBlock for a component (#853) 2020-03-20 11:29:44 -04:00
Evan You ba9a91c48c refactor: remove null comparisons 2020-03-18 18:14:51 -04:00
Evan You a1da9c28a0 fix(compiler-core): assign patchFlag for template v-if fragment
fix #850
2020-03-17 11:36:56 -04:00
Evan You 3b40fc56db fix(compiler-ssr): fix input w/ v-bind="obj" codegen 2020-03-16 18:14:49 -04:00
Evan You 4dc8ffc378 fix: simplify and use correct ctx in withCtx 2020-03-16 13:06:46 -04:00
Evan You 19228a469a refactor: simplify resolveDyanmicComponent 2020-03-16 13:06:46 -04:00
Evan You 9ad65b1653 refactor(template-ref): improve template ref handling
close #836, close #839
2020-03-16 13:06:46 -04:00
Evan You ecd7ce60d5 feat(compiler-core): wrap slot functions with render context 2020-03-16 13:06:46 -04:00
Evan You 586e5bb800 fix(compiler-core): fix property shorthand detection
fix #845
2020-03-16 10:27:03 -04:00
Evan You bcb2a9b4a6 build: make @vue/shared public
This avoids it being inlined multiple times in esm bundler builds
2020-02-29 22:04:42 -05:00
Evan You 8449a9727c feat(compiler-core): switch to @babel/parser for expression parsing
This enables default support for parsing bigInt, optional chaining
    and nullish coalescing, and also adds the `expressionPlugins`
    compiler option for enabling additional parsing plugins listed at
    https://babeljs.io/docs/en/next/babel-parser#plugins.
2020-02-27 16:53:51 -05:00
Evan You 3eab143843 fix(template-ref): fix string template refs inside slots 2020-02-25 18:29:51 -05:00
djy0 c11905fe36
chore: fix typo (#764) [ci skip] 2020-02-24 18:01:26 +01:00
Luxiaosong c54aa43fa7
chore: use 'const' instead of 'let' (#755) [ci skip] 2020-02-21 11:21:24 +01:00
likui 7b987d9450
fix(compiler-core): should alias name in helperString (#743)
fix #740
2020-02-19 09:49:46 -05:00
Evan You 028f748c32 fix(v-on): transform click.right and click.middle modifiers
fix #735
2020-02-18 14:32:06 -05:00
Evan You 66b5f0b480 chore: fix hoistStatic exhaustive check 2020-02-14 16:41:55 -05:00
Evan You e0f3c6b352 fix(compiler-core): should apply text transform to if branches
fix #725
2020-02-14 15:57:14 -05:00
Evan You 5455e8e69a fix(compiler-core): should not hoist element with cached + merged event handlers 2020-02-13 18:34:08 -05:00
Evan You 9aaef60ad2 wip(ssr): adjust event hydration flag 2020-02-13 18:28:40 -05:00
Evan You 6b505dcd23 wip(ssr): basic element hydration 2020-02-13 17:47:00 -05:00
Evan You 8b7c162125 feat(compiler-dom): handle constant expressions when stringifying static content 2020-02-12 15:00:00 -05:00
Evan You 1389d7b88c refactor(compiler-core): use more concise marker for compiled slots 2020-02-12 13:45:35 -05:00
Evan You 175f8aae8d feat(compiler): mark hoisted trees with patchFlag 2020-02-12 13:31:29 -05:00
Evan You 27913e661a feat(compiler-dom/runtime-dom): stringify eligible static trees 2020-02-12 11:56:42 -05:00
Evan You e861c6da90 test: test updates for d40c642 2020-02-11 18:40:42 -05:00
Evan You e3988b40d8 refactor(compiler-core): use dedicated node type for element codegen
Previously codegen node for elements and components used raw expressions,
which leads to multiple permutations of AST shapes based on whether the
node is a block or has directives. The complexity is spread across the
entire compiler and occurs whenever a transform needs to deal with
element codegen nodes.

This refactor centralizes the handling of all possible permutations
into the codegen phase, so that all elements/components will have a
consistent node type throughout the transform phase.

The refactor is split into two commits (with test updates in a separate
one) so changes can be easier to inspect.
2020-02-11 18:40:42 -05:00
Evan You f4c54a888b refactor(compiler-core): hoist static text calls between elements 2020-02-10 18:32:11 -05:00
Evan You 12fcf9ab95 fix(compiler): fix v-for fragment openBlock argument 2020-02-10 18:19:49 -05:00
Evan You 47e984d31f refactor(compiler): provide _ctx and _cache via arguments 2020-02-10 17:29:12 -05:00
Evan You ade07c64a1 fix(compiler-core): fix keep-alive when used in templates
fix #715
2020-02-10 16:49:37 -05:00
Evan You 571ed4226b feat(compiler-core/v-on): support @vnode-xxx usage for vnode hooks 2020-02-10 11:00:37 -05:00
djy0 782db6d7f5
chore(compiler-core/codegen): avoid generate indent spaces of empty lines. (#701) 2020-02-10 09:33:04 -05:00
Evan You 8b2d6a35d0 test: update tests and snapshots for helper prefixing 2020-02-07 19:04:55 -05:00
Evan You 51317af6e8 refactor(compiler): prefix all imported helpers to avoid scope collision 2020-02-07 18:53:39 -05:00
Evan You c44d9fbe3d build: drop unnecessary codegen branch for global build 2020-02-07 18:00:30 -05:00