Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(en): merge rollup/master into rollup-docs-cn/master @ a503a4dd #160

Closed
wants to merge 10 commits into from

Conversation

docschina-bot
Copy link
Collaborator

此 PR 自动生成。

合并 rollup/rollup 的修改至本仓库(@ a503a4d

以下文件存在冲突,可能需要重新翻译:

请解决所有冲突后提交到此 pull request,可直接在 Github 修改、切换到 sync-a503a4dd 分支进行修改或者使用 Github Desktop 拉取此 pr 修改并提交。

禁止使用 Squash Merge 来合并此 Pull Request!

使用该操作会导致上游仓库的内容丢失,并致使下一次合并产生冲突。

renovate bot and others added 10 commits November 15, 2024 01:56
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Replace include with includePath

* Tree-shaking

* Reduce performance overhead

* Tree-shaking the namespace if it is passed to function

* Optimize tree-shaking for ParameterVariable

* refactor: track the usage of namespace

* Track arguments

* Improve tree-shaking and Tweak tests

* make path unconditional

* make code more concise

* Try to include all properties of arguments in ParameterScope

* Add comment to explain includePath semantics

* Ensure we do not confuse arguments and parameters by name

arguments = what is passed to a call
parameters = what is declared in a function

* Implement basic object expression tree-shaking

This will allow us to more easily track if the inclusion
logic is correct.

* include UNKNOWN_PATH for externalVariable and syntheticNamespace

* extend the includeVariableInModule function to take path

* preserve additionalInitializers

* wrap double brackets to empty object

* include UNKNOWN_PATH for resolved properties when subPath is empty

* clear cached path for paramter variable

* extends the includePath of Variable to take context

* extends InclusionContext to include currentIncludedParameter

* record the included Path of trackedArugment

* add a recursion tracker to the hasEffectsOnInteractionAtPath call in parameterVariable

* preserve the object on the right side of the global assignment

* avoid excessive object tree-shaking for parameters

* Move Identifier inclusion logic to IdentifierBase

To see in one place what happens here
and avoid duplication

* Use a dedicated tracker so that each path of
a variable is included once.

* Make the path a required parameter for includeVariableInModule

This will result in including the given path. However, if a
variable is later called with different paths, we also want
to include those paths. Thus if the variable is included, we
still call includePath on the variable and rely on the included
path tracking logic of the variable to prevent infinite cycles.

* Improve order of properties in file

* Only explicitly re-include non-empty paths

An empty path is equivalent to making something "included"

* Rename PathTracker -> EntityPathTracker

for better differentiation.

* Refine recursion detection

Use existing context function and differentiate
between different interaction types. This will
also allow us to treat recursions as "false" rather
than "true".

* Improve name

We are tracking which parts of an argument are included
via destructuring.

* Forward destructuring paths when declaring variables

The goal is to make it easy then to properly associate included
paths with variables declared via destructuring.
This will happen in subsequent commits.

* Improve handling of unknown keys in inclusion tracker

- short-circuiting when including them should save some memory
- other symbols will now be handled like unknown, making sure they are not overlooked,
  e.g. when "unknown number" is already included and checking whether a
  specific number is included.

* Rework how destructuring declarations are handled

While the lhs of a destructuring declaration is preserved if included, only
relevant paths of the rhs are preserved. This works by storing an initPath with
each variable that describes which path of the init is actually the init.

* Add detailed regression tests for destructured variables

* Rewrite initial support for parameter destructuring

* Include context with call arguments

We will need this as calling a function on an object, we need to make sure all
paths on the object accessed by the function are included. At the moment, this
includes many more paths as the logic is not yet very refined.
In the future, this should probably become includeInteractionArgumentsAtPath

* Only include properties of arguments that are used or destructured

* Track argument values through destructuring

Also, this will use the addArgumentValue method for tracking known values in the
same place we generally track values.
Note that at the moment, this will only work one level deep as ParameterVariable
only tracks top-level deoptimizations.

* Consider correct initPath when including call arguments

* Move argument deoptimization for function calls to ReturnValueScope

* Prevent access to parameter variables

* Clean up comments and add test

* Remove some leftover unused code

* Fix lint error

* Replace included paths with a constant when an unknown path is included

Hopefully, this saves some memory.

* Do not check audit while installing

This can fail a release as our audit check relies on a dependency

* Track side effects when destructuring

This tracks effects when destructuring properties of an object triggers a
getter or an access error.

* Only selectively deoptimize on pattern assignment

* Track side effects when passing objects with getters to functions

The destructuring may trigger the getters.

* Ensure to fully include objects via dynamic import

We want to tree-shake them eventually, but not this PR:

* Observe propertyReadSideEffects: false when destructuring

* Observe destructured getter side effects

When destructuring getters on an object, we need check whether the getter
mutates the object it is defined on. In that case, we cannot remove an unused
destructured variable.

* 4.27.0-0

* Always include variable for destructured variables

Especially in the case where we include for destructuring side effects only,
this ensures we avoid variable names conflicts.

* 4.27.0-1

---------

Co-authored-by: Lukas Taegert-Atkinson <[email protected]>
In certain cases, the maximum length was actually 21, resulting in unexpected
file names and off-by-one-sourcemaps.
fix(deps): update swc monorepo

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Add breakoff condition for deep path access.

* 4.27.1-0

* Add more breakoff condition for deep path access.

* 4.27.1-1
* Ensure we also include declared variables if they are included for a key or default side effect

* Always include full array patterns
Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup-docs-cn ❌ Failed (Inspect) Nov 15, 2024 10:15pm

Copy link

netlify bot commented Nov 15, 2024

Deploy Preview for relaxed-alfajores-47dd1b failed.

Name Link
🔨 Latest commit 92cf96c
🔍 Latest deploy log https://app.netlify.com/sites/relaxed-alfajores-47dd1b/deploys/6737c7cd27c1760008dd8127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants