Skip to content

Commit b87a2e5

Browse files
authored
Add and use anchors for nested options (#4825)
* Add and use anchors for nested options * Fix inner gutter border radius
1 parent 12cbd25 commit b87a2e5

50 files changed

Lines changed: 212 additions & 99 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/.vitepress/theme/custom.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
--vp-c-brand-lighter: hsl(0 85% 80%);
55
--vp-c-brand-dark: hsl(0 85% 57%);
66
--vp-c-brand-darker: hsl(0 85% 40%);
7-
}
87

9-
:root {
108
--vp-home-hero-name-color: transparent;
119
--vp-home-hero-name-background: -webkit-linear-gradient(
1210
120deg,
@@ -16,7 +14,6 @@
1614
hsl(0 100% 60%) 65%,
1715
hsl(358 58% 47%)
1816
);
19-
2017
--vp-home-hero-image-background-image: linear-gradient(
2118
-45deg,
2219
hsl(0 100% 60% / 80%),
@@ -39,3 +36,7 @@
3936
--vp-home-hero-image-filter: blur(72px);
4037
}
4138
}
39+
40+
.vp-doc h4 {
41+
margin: 8px 0 -16px;
42+
}

docs/configuration-options/index.md

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,15 @@ Which language features Rollup can safely use in generated code. This will not t
570570
- `"es5"`: Do not use ES2015+ features like arrow functions, but do not quote reserved names used as props.
571571
- `"es2015"`: Use any JavaScript features up to ES2015.
572572
573-
**output.generatedCode.arrowFunctions**<br> Type: `boolean`<br> CLI: `--generatedCode.arrowFunctions`/`--no-generatedCode.arrowFunctions`<br> Default: `false`
573+
#### output.generatedCode.arrowFunctions
574+
575+
Type: `boolean`<br> CLI: `--generatedCode.arrowFunctions`/`--no-generatedCode.arrowFunctions`<br> Default: `false`
574576
575577
Whether to use arrow functions for auto-generated code snippets. Note that in certain places like module wrappers, Rollup will keep using regular functions wrapped in parentheses as in some JavaScript engines, these will provide [noticeably better performance](https://v8.dev/blog/preparser#pife).
576578
577-
**output.generatedCode.constBindings**<br> Type: `boolean`<br> CLI: `--generatedCode.constBindings`/`--no-generatedCode.constBindings`<br> Default: `false`
579+
#### output.generatedCode.constBindings
580+
581+
Type: `boolean`<br> CLI: `--generatedCode.constBindings`/`--no-generatedCode.constBindings`<br> Default: `false`
578582
579583
This will use `const` instead of `var` in certain places and helper functions. This will allow Rollup to generate more efficient helpers due to block scoping.
580584
@@ -607,7 +611,9 @@ for (const k in external) {
607611
}
608612
```
609613
610-
**output.generatedCode.objectShorthand**<br> Type: `boolean`<br> CLI: `--generatedCode.objectShorthand`/`--no-generatedCode.objectShorthand`<br> Default: `false`
614+
#### output.generatedCode.objectShorthand
615+
616+
Type: `boolean`<br> CLI: `--generatedCode.objectShorthand`/`--no-generatedCode.objectShorthand`<br> Default: `false`
611617
612618
Allows the use of shorthand notation in objects when the property name matches the value.
613619
@@ -639,7 +645,9 @@ System.register('bundle', [], function (exports) {
639645
});
640646
```
641647
642-
**output.generatedCode.preset**<br> Type: `"es5" | "es2015"`<br> CLI: `--generatedCode <value>`
648+
#### output.generatedCode.preset
649+
650+
Type: `"es5" | "es2015"`<br> CLI: `--generatedCode <value>`
643651
644652
Allows choosing one of the presets listed above while overriding some options.
645653
@@ -656,7 +664,9 @@ export default {
656664
};
657665
```
658666
659-
**output.generatedCode.reservedNamesAsProps**<br> Type: `boolean`<br> CLI: `--generatedCode.reservedNamesAsProps`/`--no-generatedCode.reservedNamesAsProps`<br> Default: `true`
667+
#### output.generatedCode.reservedNamesAsProps
668+
669+
Type: `boolean`<br> CLI: `--generatedCode.reservedNamesAsProps`/`--no-generatedCode.reservedNamesAsProps`<br> Default: `true`
660670
661671
Determine whether reserved words like "default" can be used as prop names without using quotes. This will make the syntax of the generated code ES3 compliant. Note however that for full ES3 compliance, you may also need to polyfill some builtin functions like `Object.keys` or `Array.prototype.forEach`.
662672
@@ -676,7 +686,9 @@ const foo = null;
676686
exports.void = foo;
677687
```
678688
679-
**output.generatedCode.symbols**<br> Type: `boolean`<br> CLI: `--generatedCode.symbols`/`--no-generatedCode.symbols`<br> Default: `false`
689+
#### output.generatedCode.symbols
690+
691+
Type: `boolean`<br> CLI: `--generatedCode.symbols`/`--no-generatedCode.symbols`<br> Default: `false`
680692
681693
Whether to allow the use of `Symbol` in auto-generated code snippets. Currently, this only controls if namespaces will have the `Symbol.toStringTag` property set to the correct value of `Module`, which means that for a namespace, `String(namespace)` logs `[object Module]`. This again is used for feature detection in certain libraries and frameworks.
682694
@@ -1424,7 +1436,9 @@ Type: `{ id?: string, autoId?: boolean, basePath?: string, define?: string }`
14241436

14251437
Note `id` can only be used for single-file builds, and cannot be combined with `autoId`/`basePath`.
14261438

1427-
**output.amd.id**<br> Type: `string`<br> CLI: `--amd.id <amdId>`
1439+
#### output.amd.id
1440+
1441+
Type: `string`<br> CLI: `--amd.id <amdId>`
14281442

14291443
An ID to use for AMD/UMD bundles:
14301444

@@ -1441,7 +1455,9 @@ export default {
14411455
// -> define('my-bundle', ['dependency'], ...
14421456
```
14431457

1444-
**output.amd.autoId**<br> Type: `boolean`<br> CLI: `--amd.autoId`
1458+
#### output.amd.autoId
1459+
1460+
Type: `boolean`<br> CLI: `--amd.autoId`
14451461

14461462
Set the ID to the chunk ID (with the '.js' extension removed).
14471463

@@ -1459,11 +1475,13 @@ export default {
14591475
// -> define('dynamic-chunk', ['dependency'], ...
14601476
```
14611477
1462-
**output.amd.basePath**<br> Type: `string`<br> CLI: `--amd.basePath`
1478+
#### output.amd.basePath
1479+
1480+
Type: `string`<br> CLI: `--amd.basePath`
14631481
14641482
The path that will be prepended to the auto generated ID. This is useful if the build is going to be placed inside another AMD project, and is not at the root.
14651483
1466-
Only valid with `output.amd.autoId`.
1484+
Only valid with [`output.amd.autoId`](#output-amd-autoid).
14671485
14681486
```js
14691487
// rollup.config.js
@@ -1480,7 +1498,9 @@ export default {
14801498
// -> define('some/where/dynamic-chunk', ['dependency'], ...
14811499
```
14821500
1483-
**output.amd.define**<br> Type: `string`<br> CLI: `--amd.define <defineFunctionName>`
1501+
#### output.amd.define
1502+
1503+
Type: `string`<br> CLI: `--amd.define <defineFunctionName>`
14841504
14851505
A function name to use instead of `define`:
14861506
@@ -1497,7 +1517,9 @@ export default {
14971517
// -> def(['dependency'],...
14981518
```
14991519
1500-
**output.amd.forceJsExtensionForImports**<br> Type: `boolean`<br> CLI: `--amd.forceJsExtensionForImports`<br> Default: `false`
1520+
#### output.amd.forceJsExtensionForImports
1521+
1522+
Type: `boolean`<br> CLI: `--amd.forceJsExtensionForImports`<br> Default: `false`
15011523
15021524
Add `.js` extension for imports of generated chunks and local AMD modules:
15031525
@@ -1699,17 +1721,19 @@ Type: `boolean | "smallest" | "safest" | "recommended" | { annotations?: boolean
16991721
Whether to apply tree-shaking and to fine-tune the tree-shaking process. Setting this option to `false` will produce bigger bundles but may improve build performance. You may also choose one of three presets that will automatically be updated if new options are added:
17001722
17011723
- `"smallest"` will choose option values for you to minimize output size as much as possible. This should work for most code bases as long as you do not rely on certain patterns, which are currently:
1702-
- getters with side effects will only be retained if the return value is used (`treeshake.propertyReadSideEffects: false`)
1703-
- code from imported modules will only be retained if at least one exported value is used (`treeshake.moduleSideEffects: false`)
1704-
- you should not bundle polyfills that rely on detecting broken builtins (`treeshake.tryCatchDeoptimization: false`)
1705-
- some semantic issues may be swallowed (`treeshake.unknownGlobalSideEffects: false`, `treeshake.correctVarValueBeforeDeclaration: false`)
1724+
- getters with side effects will only be retained if the return value is used ([`treeshake.propertyReadSideEffects: false`](#treeshake-propertyreadsideeffects))
1725+
- code from imported modules will only be retained if at least one exported value is used ([`treeshake.moduleSideEffects: false`](#treeshake-modulesideeffects))
1726+
- you should not bundle polyfills that rely on detecting broken builtins ([`treeshake.tryCatchDeoptimization: false`](#treeshake-trycatchdeoptimization))
1727+
- some semantic issues may be swallowed ([`treeshake.unknownGlobalSideEffects: false`](#treeshake-unknownglobalsideeffects), [`treeshake.correctVarValueBeforeDeclaration: false`](#treeshake-correctvarvaluebeforedeclaration))
17061728
- `"recommended"` should work well for most usage patterns. Some semantic issues may be swallowed, though (`treeshake.unknownGlobalSideEffects: false`, `treeshake.correctVarValueBeforeDeclaration: false`)
17071729
- `"safest"` tries to be as spec compliant as possible while still providing some basic tree-shaking capabilities.
17081730
- `true` is equivalent to not specifying the option and will always choose the default value (see below).
17091731
17101732
If you discover a bug caused by the tree-shaking algorithm, please file an issue! Setting this option to an object implies tree-shaking is enabled and grants the following additional options:
17111733
1712-
**treeshake.annotations**<br> Type: `boolean`<br> CLI: `--treeshake.annotations`/`--no-treeshake.annotations`<br> Default: `true`
1734+
#### treeshake.annotations
1735+
1736+
Type: `boolean`<br> CLI: `--treeshake.annotations`/`--no-treeshake.annotations`<br> Default: `true`
17131737
17141738
If `false`, ignore hints from pure annotations, i.e. comments containing `@__PURE__` or `#__PURE__`, when determining side effects of function calls and constructor invocations. These annotations need to immediately precede the call invocation to take effect. The following code will be completely removed unless this option is set to `false`, in which case it will remain unchanged.
17151739
@@ -1725,7 +1749,9 @@ class Impure {
17251749
/*@__PURE__*/ new Impure();
17261750
```
17271751
1728-
**treeshake.correctVarValueBeforeDeclaration**<br> Type: `boolean`<br> CLI: `--treeshake.correctVarValueBeforeDeclaration`/`--no-treeshake.correctVarValueBeforeDeclaration`<br> Default: `false`
1752+
#### treeshake.correctVarValueBeforeDeclaration
1753+
1754+
Type: `boolean`<br> CLI: `--treeshake.correctVarValueBeforeDeclaration`/`--no-treeshake.correctVarValueBeforeDeclaration`<br> Default: `false`
17291755
17301756
In some edge cases if a variable is accessed before its declaration assignment and is not reassigned, then Rollup may incorrectly assume that variable is constant throughout the program, as in the example below. This is not true if the variable is declared with `var`, however, as those variables can be accessed before their declaration where they will evaluate to `undefined`. Choosing `true` will make sure Rollup does not make any assumptions about the value of variables declared with `var`. Note though that this can have a noticeable negative impact on tree-shaking results.
17311757
@@ -1752,7 +1778,9 @@ logBeforeDeclaration = true;
17521778
logIfEnabled(); // needs to be retained as it displays a log
17531779
```
17541780
1755-
**treeshake.manualPureFunctions**<br> Type: `string[]`<br> CLI: `--treeshake.manualPureFunctions <names>`
1781+
#### treeshake.manualPureFunctions
1782+
1783+
Type: `string[]`<br> CLI: `--treeshake.manualPureFunctions <names>`
17561784
17571785
Allows to manually define a list of function names that should always be considered "pure", i.e. they have no side effects like changing global state etc. when called. The check is performed solely by name.
17581786
@@ -1783,7 +1811,9 @@ styled()(); // removed
17831811
styled().div(); // removed
17841812
```
17851813
1786-
**treeshake.moduleSideEffects**<br> Type: `boolean | "no-external" | string[] | (id: string, external: boolean) => boolean`<br> CLI: `--treeshake.moduleSideEffects`/`--no-treeshake.moduleSideEffects`/`--treeshake.moduleSideEffects no-external`<br> Default: `true`
1814+
#### treeshake.moduleSideEffects
1815+
1816+
Type: `boolean | "no-external" | string[] | (id: string, external: boolean) => boolean`<br> CLI: `--treeshake.moduleSideEffects`/`--no-treeshake.moduleSideEffects`/`--treeshake.moduleSideEffects no-external`<br> Default: `true`
17871817
17881818
If `false`, assume modules and external dependencies from which nothing is imported do not have other side effects like mutating global variables or logging without checking. For external dependencies, this will suppress empty imports:
17891819
@@ -1867,7 +1897,9 @@ console.log(foo);
18671897
18681898
Note that despite the name, this option does not "add" side effects to modules that do not have side effects. If it is important that e.g. an empty module is "included" in the bundle because you need this for dependency tracking, the plugin interface allows you to designate modules as being excluded from tree-shaking via the [`resolveId`](../plugin-development/index.md#resolveid), [`load`](../plugin-development/index.md#load) or [`transform`](../plugin-development/index.md#transform) hook.
18691899
1870-
**treeshake.preset**<br> Type: `"smallest" | "safest" | "recommended"`<br> CLI: `--treeshake <value>`<br>
1900+
#### treeshake.preset
1901+
1902+
Type: `"smallest" | "safest" | "recommended"`<br> CLI: `--treeshake <value>`<br>
18711903
18721904
Allows choosing one of the presets listed above while overriding some options.
18731905
@@ -1881,7 +1913,9 @@ export default {
18811913
};
18821914
```
18831915
1884-
**treeshake.propertyReadSideEffects**<br> Type: `boolean | 'always'`<br> CLI: `--treeshake.propertyReadSideEffects`/`--no-treeshake.propertyReadSideEffects`<br> Default: `true`
1916+
#### treeshake.propertyReadSideEffects
1917+
1918+
Type: `boolean | 'always'`<br> CLI: `--treeshake.propertyReadSideEffects`/`--no-treeshake.propertyReadSideEffects`<br> Default: `true`
18851919
18861920
If `true`, retain unused property reads that Rollup can determine to have side effects. This includes accessing properties of `null` or `undefined` or triggering explicit getters via property access. Note that this does not cover destructuring assignment or getters on objects passed as function parameters.
18871921
@@ -1901,7 +1935,9 @@ const result = foo.bar;
19011935
const illegalAccess = foo.quux.tooDeep;
19021936
```
19031937
1904-
**treeshake.tryCatchDeoptimization**<br> Type: `boolean`<br> CLI: `--treeshake.tryCatchDeoptimization`/`--no-treeshake.tryCatchDeoptimization`<br> Default: `true`
1938+
#### treeshake.tryCatchDeoptimization
1939+
1940+
Type: `boolean`<br> CLI: `--treeshake.tryCatchDeoptimization`/`--no-treeshake.tryCatchDeoptimization`<br> Default: `true`
19051941
19061942
By default, Rollup assumes that many builtin globals of the runtime behave according to the latest specs when tree-shaking and do not throw unexpected errors. In order to support e.g. feature detection workflows that rely on those errors being thrown, Rollup will by default deactivate tree-shaking inside try-statements. If a function parameter is called from within a try-statement, this parameter will be deoptimized as well. Set `treeshake.tryCatchDeoptimization` to `false` if you do not need this feature and want to have tree-shaking inside try-statements.
19071943
@@ -1937,7 +1973,9 @@ test(() => {
19371973
test(otherFn);
19381974
```
19391975
1940-
**treeshake.unknownGlobalSideEffects**<br> Type: `boolean`<br> CLI: `--treeshake.unknownGlobalSideEffects`/`--no-treeshake.unknownGlobalSideEffects`<br> Default: `true`
1976+
#### treeshake.unknownGlobalSideEffects
1977+
1978+
Type: `boolean`<br> CLI: `--treeshake.unknownGlobalSideEffects`/`--no-treeshake.unknownGlobalSideEffects`<br> Default: `true`
19411979
19421980
Since accessing a non-existing global variable will throw an error, Rollup does by default retain any accesses to non-builtin global variables. Set this option to `false` to avoid this check. This is probably safe for most code-bases.
19431981
@@ -1955,7 +1993,7 @@ const element = angular.element;
19551993
const element = angular.element;
19561994
```
19571995
1958-
In the example, the last line is always retained as accessing the `element` property could also throw an error if `angular` is e.g. `null`. To avoid this check, set `treeshake.propertyReadSideEffects` to `false` as well.
1996+
In the example, the last line is always retained as accessing the `element` property could also throw an error if `angular` is e.g. `null`. To avoid this check, set [`treeshake.propertyReadSideEffects`](#treeshake-propertyreadsideeffects) to `false` as well.
19591997
19601998
## Experimental options
19611999
@@ -2101,13 +2139,13 @@ This will rename the dynamic import function to the chosen name when outputting
21012139
21022140
### output.preferConst
21032141
2104-
_Use the [`output.generatedCode.constBindings`](#output-generatedcode) option instead._<br> Type: `boolean`<br> CLI: `--preferConst`/`--no-preferConst`<br> Default: `false`
2142+
_Use the [`output.generatedCode.constBindings`](#output-generatedcode-constbindings) option instead._<br> Type: `boolean`<br> CLI: `--preferConst`/`--no-preferConst`<br> Default: `false`
21052143
21062144
Generate `const` declarations for exports rather than `var` declarations.
21072145
21082146
### output.namespaceToStringTag
21092147
2110-
_Use [`output.generatedCode.symbols`](#output-generatedcode) instead._<br> Type: `boolean`<br> CLI: `--namespaceToStringTag`/`--no-namespaceToStringTag`<br> Default: `false`
2148+
_Use [`output.generatedCode.symbols`](#output-generatedcode-symbols) instead._<br> Type: `boolean`<br> CLI: `--namespaceToStringTag`/`--no-namespaceToStringTag`<br> Default: `false`
21112149
21122150
Whether to add spec compliant `.toString()` tags to namespace objects. If this option is set,
21132151

0 commit comments

Comments
 (0)