Skip to content

Commit

Permalink
docs(en): merging all conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
docschina-bot committed Nov 9, 2024
2 parents b10c452 + 42e587e commit dbc5998
Show file tree
Hide file tree
Showing 43 changed files with 244 additions and 27 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# rollup changelog

## 4.25.0

_2024-11-09_

### Features

- Add `output.sourcemapDebugIds` option to add matching debug ids to sourcemaps and code for tools like Sentry or Rollbar (#5712)

### Bug Fixes

- Make it easier to manually reproduce base16 hashes by using a more standard base16 conversion algorithm (#5719)

### Pull Requests

- [#5712](https://github.com/rollup/rollup/pull/5712): feat: Add support for injecting Debug IDs (@timfish)
- [#5717](https://github.com/rollup/rollup/pull/5717): fix(deps): update swc monorepo (major) (@renovate[bot])
- [#5718](https://github.com/rollup/rollup/pull/5718): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
- [#5719](https://github.com/rollup/rollup/pull/5719): Use a less surprising base-16 encoding (@lukastaegert)

## 4.24.4

_2024-11-04_
Expand Down
2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/browser",
"version": "4.24.4",
"version": "4.25.0",
"description": "Next-generation ES module bundler browser build",
"main": "dist/rollup.browser.js",
"module": "dist/es/rollup.browser.js",
Expand Down
1 change: 1 addition & 0 deletions cli/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Basic options:
--shimMissingExports Create shim variables for missing exports
--silent Don't print warnings
--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base
--sourcemapDebugIds Emit unique debug ids in source and sourcemaps
--sourcemapExcludeSources Do not include source code in source maps
--sourcemapFile <file> Specify bundle position for source maps
--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps
Expand Down
99 changes: 99 additions & 0 deletions docs/command-line-interface/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default {
preserveModulesRoot,
sourcemap,
sourcemapBaseUrl,
sourcemapDebugIds,
sourcemapExcludeSources,
sourcemapFile,
sourcemapFileNames,
Expand Down Expand Up @@ -373,6 +374,7 @@ export default {
许多选项都有等效的命令行标志。在这些情况下,如果你正在使用配置文件,则此处传递的任何参数都将覆盖配置文件。以下是所有支持的选项列表:
```
<<<<<<< HEAD
-c, --config <filename> 使用此配置文件
(如果使用参数但未指定值,则默认为 rollup.config.js
-d, --dir <dirname> 用于块的目录(如果不存在,则打印到 stdout)
Expand Down Expand Up @@ -467,6 +469,103 @@ export default {
--watch.onError <cmd>"ERROR" 事件上运行的 Shell 命令
--watch.onStart <cmd>"START" 事件上运行的 Shell 命令
--watch.skipWrite 在监视时不要将文件写入磁盘
=======
-c, --config <filename> Use this config file (if argument is used but value
is unspecified, defaults to rollup.config.js)
-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)
-e, --external <ids> Comma-separate list of module IDs to exclude
-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)
-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs
-h, --help Show this help message
-i, --input <filename> Input (alternative to <entry file>)
-m, --sourcemap Generate sourcemap (`-m inline` for inline map)
-n, --name <name> Name for UMD export
-o, --file <output> Single output file (if absent, prints to stdout)
-p, --plugin <plugin> Use the plugin specified (may be repeated)
-v, --version Show version number
-w, --watch Watch files in bundle and rebuild on changes
--amd.autoId Generate the AMD ID based off the chunk name
--amd.basePath <prefix> Path to prepend to auto generated AMD ID
--amd.define <name> Function to use in place of `define`
--amd.forceJsExtensionForImports Use `.js` extension in AMD imports
--amd.id <id> ID for AMD module (default is anonymous)
--assetFileNames <pattern> Name pattern for emitted assets
--banner <text> Code to insert at top of bundle (outside wrapper)
--chunkFileNames <pattern> Name pattern for emitted secondary chunks
--compact Minify wrapper code
--context <variable> Specify top-level `this` value
--no-dynamicImportInCjs Write external dynamic CommonJS imports as require
--entryFileNames <pattern> Name pattern for emitted entry chunks
--environment <values> Settings passed to config file (see example)
--no-esModule Do not add __esModule property
--exports <mode> Specify export mode (auto, default, named, none)
--extend Extend global variable defined by --name
--no-externalImportAttributes Omit import attributes in "es" output
--no-externalLiveBindings Do not generate code to support live bindings
--failAfterWarnings Exit with an error if the build produced warnings
--filterLogs <filter> Filter log messages
--footer <text> Code to insert at end of bundle (outside wrapper)
--forceExit Force exit the process when done
--no-freeze Do not freeze namespace objects
--generatedCode <preset> Which code features to use (es5/es2015)
--generatedCode.arrowFunctions Use arrow functions in generated code
--generatedCode.constBindings Use "const" in generated code
--generatedCode.objectShorthand Use shorthand properties in generated code
--no-generatedCode.reservedNamesAsProps Always quote reserved names as props
--generatedCode.symbols Use symbols in generated code
--hashCharacters <name> Use the specified character set for file hashes
--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks
--importAttributesKey <name> Use the specified keyword for import attributes
--no-indent Don't indent result
--inlineDynamicImports Create single bundle when using dynamic imports
--no-interop Do not include interop block
--intro <text> Code to insert at top of bundle (inside wrapper)
--logLevel <level> Which kind of logs to display
--no-makeAbsoluteExternalsRelative Prevent normalization of external imports
--maxParallelFileOps <value> How many files to read in parallel
--minifyInternalExports Force or disable minification of internal exports
--noConflict Generate a noConflict method for UMD globals
--outro <text> Code to insert at end of bundle (inside wrapper)
--perf Display performance timings
--no-preserveEntrySignatures Avoid facade chunks for entry points
--preserveModules Preserve module structure
--preserveModulesRoot Put preserved modules under this path at root level
--preserveSymlinks Do not follow symlinks when resolving files
--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports
--no-sanitizeFileName Do not replace invalid characters in file names
--shimMissingExports Create shim variables for missing exports
--silent Don't print warnings
--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base
--sourcemapDebugIds Emit unique debug ids in source and sourcemaps
--sourcemapExcludeSources Do not include source code in source maps
--sourcemapFile <file> Specify bundle position for source maps
--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps
--stdin=ext Specify file extension used for stdin input
--no-stdin Do not read "-" from stdin
--no-strict Don't emit `"use strict";` in the generated modules
--strictDeprecations Throw errors for deprecated features
--no-systemNullSetters Do not replace empty SystemJS setters with `null`
--no-treeshake Disable tree-shaking optimisations
--no-treeshake.annotations Ignore pure call annotations
--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared
--treeshake.manualPureFunctions <names> Manually declare functions as pure
--no-treeshake.moduleSideEffects Assume modules have no side effects
--no-treeshake.propertyReadSideEffects Ignore property access side effects
--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking
--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw
--validate Validate output
--waitForBundleInput Wait for bundle input files
--watch.buildDelay <number> Throttle watch rebuilds
--no-watch.clearScreen Do not clear the screen when rebuilding
--watch.exclude <files> Exclude files from being watched
--watch.include <files> Limit watching to specified files
--watch.onBundleEnd <cmd> Shell command to run on `"BUNDLE_END"` event
--watch.onBundleStart <cmd> Shell command to run on `"BUNDLE_START"` event
--watch.onEnd <cmd> Shell command to run on `"END"` event
--watch.onError <cmd> Shell command to run on `"ERROR"` event
--watch.onStart <cmd> Shell command to run on `"START"` event
--watch.skipWrite Do not write files to disk when watching
>>>>>>> 42e587e0e37bc0661aa39fe7ad6f1d7fd33f825c
```
以下标志仅通过命令行界面可用。所有其他标志都对应并覆盖其配置文件等效项,请参阅[选项大列表](../configuration-options/index.md)获取详细信息。
Expand Down
14 changes: 14 additions & 0 deletions docs/configuration-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,21 @@ export default {

默认情况下,Rollup 生成的 sourcemap 使用相对 URL 路径来引用它们描述的文件。该选项可提供一个绝对基础 URL 路径,例如 `https://example.com`,sourcemap 将使用绝对 URL 路径来代替。

<<<<<<< HEAD
### output.sourcemapExcludeSources {#output-sourcemapexcludesources}
=======
### output.sourcemapDebugIds

| | |
| -------: | :--------------------------------------------- |
| Type: | `boolean` |
| CLI: | `--sourcemapDebugIds`/`--no-sourcemapDebugIds` |
| Default: | `false` |

if `true`, unique ids will be emitted in source and sourcemaps which streamlines identifying sourcemaps across different builds. See the [TC39 sourcemap debug ID proposal](https://github.com/tc39/source-map/blob/main/proposals/debug-id.md) for more details.

### output.sourcemapExcludeSources
>>>>>>> 42e587e0e37bc0661aa39fe7ad6f1d7fd33f825c
| | |
| -----: | :--------------------------------------------------------- |
Expand Down
1 change: 1 addition & 0 deletions docs/javascript-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const outputOptions = {
preserveModulesRoot,
sourcemap,
sourcemapBaseUrl,
sourcemapDebugIds,
sourcemapExcludeSources,
sourcemapFile,
sourcemapFileNames,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rollup",
"version": "4.24.4",
"version": "4.25.0",
"description": "Next-generation ES module bundler",
"main": "dist/rollup.js",
"module": "dist/es/rollup.js",
Expand Down
2 changes: 1 addition & 1 deletion rust/xxhash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const CHARACTERS_BASE64: &[u8; 64] =

const CHARACTERS_BASE36: &[u8; 36] = b"abcdefghijklmnopqrstuvwxyz0123456789";

const CHARACTERS_BASE16: &[u8; 16] = b"abcdef0123456789";
const CHARACTERS_BASE16: &[u8; 16] = b"0123456789abcdef";

pub fn xxhash_base64_url(input: &[u8]) -> String {
to_string(&xxh3_128(input).to_le_bytes(), 64, CHARACTERS_BASE64).unwrap()
Expand Down
2 changes: 2 additions & 0 deletions src/rollup/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ export interface OutputOptions {
sourcemapFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption;
sourcemapPathTransform?: SourcemapPathTransformOption;
sourcemapDebugIds?: boolean;
strict?: boolean;
systemNullSetters?: boolean;
validate?: boolean;
Expand Down Expand Up @@ -836,6 +837,7 @@ export interface NormalizedOutputOptions {
sourcemapFileNames: string | ((chunkInfo: PreRenderedChunk) => string) | undefined;
sourcemapIgnoreList: SourcemapIgnoreListOption;
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
sourcemapDebugIds: boolean;
strict: boolean;
systemNullSetters: boolean;
validate: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/utils/options/mergeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ async function mergeOutputOptions(
sanitizeFileName: getOption('sanitizeFileName'),
sourcemap: getOption('sourcemap'),
sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
sourcemapDebugIds: getOption('sourcemapDebugIds'),
sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
sourcemapFile: getOption('sourcemapFile'),
sourcemapFileNames: getOption('sourcemapFileNames'),
Expand Down
1 change: 1 addition & 0 deletions src/utils/options/normalizeOutputOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export async function normalizeOutputOptions(
: defaultSanitizeFileName,
sourcemap: config.sourcemap || false,
sourcemapBaseUrl: getSourcemapBaseUrl(config),
sourcemapDebugIds: config.sourcemapDebugIds || false,
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
sourcemapFile: config.sourcemapFile,
sourcemapFileNames: getSourcemapFileNames(config, unsetOptions),
Expand Down
21 changes: 21 additions & 0 deletions src/utils/renderChunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ function addChunksToBundle(
const finalFileName = replacePlaceholders(fileName, hashesByPlaceholder);
let finalSourcemapFileName = null;
if (map) {
if (options.sourcemapDebugIds) {
updatedCode += calculateDebugIdAndGetComment(updatedCode, map);
}
finalSourcemapFileName = sourcemapFileName
? replacePlaceholders(sourcemapFileName, hashesByPlaceholder)
: `${finalFileName}.map`;
Expand All @@ -365,6 +368,9 @@ function addChunksToBundle(
hashesByPlaceholder.size > 0 ? replacePlaceholders(code, hashesByPlaceholder) : code;
let finalSourcemapFileName = null;
if (map) {
if (options.sourcemapDebugIds) {
updatedCode += calculateDebugIdAndGetComment(updatedCode, map);
}
finalSourcemapFileName = sourcemapFileName
? replacePlaceholders(sourcemapFileName, hashesByPlaceholder)
: `${fileName}.map`;
Expand Down Expand Up @@ -402,3 +408,18 @@ function emitSourceMapAndGetComment(
}
return sourcemap === 'hidden' ? '' : `//# ${SOURCEMAPPING_URL}=${url}\n`;
}

function calculateDebugIdAndGetComment(code: string, map: SourceMap & { debugId?: string }) {
const hash = hasherByType.hex(code);
const debugId = [
hash.slice(0, 8),
hash.slice(8, 12),
'4' + hash.slice(12, 15),
((parseInt(hash.slice(15, 16), 16) & 3) | 8).toString(16) + hash.slice(17, 20),
hash.slice(20, 32)
].join('-');

map.debugId = debugId;

return '//# debugId=' + debugId + '\n';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
define(['./dep-9748f597e7f841'], (function (dep) { 'use strict';

console.log('main1');

}));

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
define(['./dep-9748f597e7f841'], (function (dep) { 'use strict';

console.log('main2');

}));
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

require('./dep-56610f0f1f4a63.js');
require('./dep-8e72f6a548dc1a.js');

console.log('main1');
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

require('./dep-56610f0f1f4a63.js');
require('./dep-8e72f6a548dc1a.js');

console.log('main2');

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './dep-ea4271148a0859.js';

console.log('main1');
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './dep-ea4271148a0859.js';

console.log('main2');

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['./dep-bacfaa81397007.js'], (function () {
System.register(['./dep-fc1ce55215e47e.js'], (function () {
'use strict';
return {
setters: [null],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['./dep-bacfaa81397007.js'], (function () {
System.register(['./dep-fc1ce55215e47e.js'], (function () {
'use strict';
return {
setters: [null],
Expand Down
1 change: 1 addition & 0 deletions test/function/samples/output-options-hook/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = defineTest({
preserveModules: false,
reexportProtoFromExternal: true,
sourcemap: false,
sourcemapDebugIds: false,
sourcemapExcludeSources: false,
strict: true,
systemNullSetters: true,
Expand Down
Loading

0 comments on commit dbc5998

Please sign in to comment.