You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement "output.hashCharacters" option to define character set for file hashes (#5371)
* Add documentation
* Add new hashing functions and update hashes
The hashes changed due to how they are now encoded
* Add new hashing functions in JavaScript
* Implement new output.hashCharacters option
Copy file name to clipboardexpand all lines: docs/configuration-options/index.md
+18-4
Original file line number
Diff line number
Diff line change
@@ -539,7 +539,7 @@ The pattern to use for naming custom emitted assets to include in the build outp
539
539
540
540
- `[extname]`: The file extension of the asset including a leading dot, e.g. `.css`.
541
541
- `[ext]`: The file extension without a leading dot, e.g. `css`.
542
-
- `[hash]`: A hash based on the content of the asset. You can also set a specific hash length via e.g. `[hash:10]`.
542
+
- `[hash]`: A hash based on the content of the asset. You can also set a specific hash length via e.g. `[hash:10]`. By default, it will create a base-64 hash. If you need a reduced character sets, see [`output.hashCharacters`](#output-hashcharacters)
543
543
- `[name]`: The file name of the asset excluding any extension.
544
544
545
545
Forward slashes `/` can be used to place files in sub-directories. When using a function, `assetInfo` is a reduced version of the one in [`generateBundle`](../plugin-development/index.md#generatebundle) without the `fileName`. See also [`output.chunkFileNames`](#output-chunkfilenames), [`output.entryFileNames`](#output-entryfilenames).
@@ -585,7 +585,7 @@ See also [`output.intro/output.outro`](#output-intro-output-outro).
585
585
The pattern to use for naming shared chunks created when code-splitting, or a function that is called per chunk to return such a pattern. Patterns support the following placeholders:
586
586
587
587
- `[format]`: The rendering format defined in the output options, e.g. `es` or `cjs`.
588
-
- `[hash]`: A hash based only on the content of the final generated chunk, including transformations in [`renderChunk`](../plugin-development/index.md#renderchunk) and any referenced file hashes. You can also set a specific hash length via e.g. `[hash:10]`.
588
+
- `[hash]`: A hash based only on the content of the final generated chunk, including transformations in [`renderChunk`](../plugin-development/index.md#renderchunk) and any referenced file hashes. You can also set a specific hash length via e.g. `[hash:10]`. By default, it will create a base-64 hash. If you need a reduced character sets, see [`output.hashCharacters`](#output-hashcharacters)
589
589
- `[name]`: The name of the chunk. This can be explicitly set via the [`output.manualChunks`](#output-manualchunks) option or when the chunk is created by a plugin via [`this.emitFile`](../plugin-development/index.md#this-emitfile). Otherwise, it will be derived from the chunk contents.
590
590
591
591
Forward slashes `/` can be used to place files in sub-directories. When using a function, `chunkInfo` is a reduced version of the one in [`generateBundle`](../plugin-development/index.md#generatebundle) without properties that depend on file names and no information about the rendered modules as rendering only happens after file names have been generated. You can however access a list of included `moduleIds`. See also [`output.assetFileNames`](#output-assetfilenames), [`output.entryFileNames`](#output-entryfilenames).
@@ -661,7 +661,7 @@ Promise.resolve()
661
661
The pattern to use for chunks created from entry points, or a function that is called per entry chunk to return such a pattern. Patterns support the following placeholders:
662
662
663
663
- `[format]`: The rendering format defined in the output options, e.g. `es` or `cjs`.
664
-
- `[hash]`: A hash based only on the content of the final generated entry chunk, including transformations in [`renderChunk`](../plugin-development/index.md#renderchunk) and any referenced file hashes. You can also set a specific hash length via e.g. `[hash:10]`.
664
+
- `[hash]`: A hash based only on the content of the final generated entry chunk, including transformations in [`renderChunk`](../plugin-development/index.md#renderchunk) and any referenced file hashes. You can also set a specific hash length via e.g. `[hash:10]`. By default, it will create a base-64 hash. If you need a reduced character sets, see [`output.hashCharacters`](#output-hashcharacters)
665
665
- `[name]`: The file name (without extension) of the entry point, unless the object form of input was used to define a different name.
666
666
667
667
Forward slashes `/` can be used to place files in sub-directories. When using a function, `chunkInfo` is a reduced version of the one in [`generateBundle`](../plugin-development/index.md#generatebundle) without properties that depend on file names and no information about the rendered modules as rendering only happens after file names have been generated. You can however access a list of included `moduleIds`. See also [`output.assetFileNames`](#output-assetfilenames), [`output.chunkFileNames`](#output-chunkfilenames).
@@ -863,6 +863,20 @@ const foo = 42;
863
863
exports.foo= foo;
864
864
```
865
865
866
+
### output.hashCharacters
867
+
868
+
| | |
869
+
| -------: | :------------------------------ |
870
+
| Type: | `"base64" \|"base32" \|"hex"` |
871
+
| CLI: | `--hashCharacters <name>` |
872
+
| Default: | `"base64"` |
873
+
874
+
This determines the character set that Rollup is allowed to use in file hashes.
875
+
876
+
- the default `"base64"` will use url-safe base-64 hashes with potential characters `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`.
877
+
- `"base36"` will only use lower-case letters and numbers `abcdefghijklmnopqrstuvwxyz0123456789`.
878
+
- `"hex"` will create hexadecimal hashes with characters `abcdef0123456789`.
879
+
866
880
### output.hoistTransitiveImports
867
881
868
882
| | |
@@ -1480,7 +1494,7 @@ The location of the generated bundle. If this is an absolute path, all the `sour
1480
1494
The pattern to use for sourcemaps, or a function that is called per sourcemap to return such a pattern. Patterns support the following placeholders:
1481
1495
1482
1496
- `[format]`: The rendering format defined in the output options, e.g. `es` or `cjs`.
1483
-
- `[hash]`: A hash based only on the content of the final generated sourcemap. You can also set a specific hash length via e.g. `[hash:10]`.
1497
+
- `[hash]`: A hash based only on the content of the final generated sourcemap. You can also set a specific hash length via e.g. `[hash:10]`. By default, it will create a base-64 hash. If you need a reduced character sets, see [`output.hashCharacters`](#output-hashcharacters)
1484
1498
- `[chunkhash]`: The same hash as the one used for the corresponding generated chunk (if any).
1485
1499
- `[name]`: The file name (without extension) of the entry point, unless the object form of input was used to define a different name.
0 commit comments