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

chore(module-tools): upgrade rollup and rollup-plugin-dts version #5199

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/mighty-readers-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/module-tools': patch
---

chore(module-tools): upgrade rollup and rollup-plugin-dts version
chore(module-tools): 更新 rollup 和 rollup-plugin-dts 版本
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 1

## Environment preparation

In order to use the Modern.js Module, you first need [NodeJS](https://nodejs.org/zh/) engine, we recommend the latest [LTS version](https://github.com/nodejs/Release), and make sure the Node version is **>=14.18.0**. because non-stable NodeJS releases frequently have bugs. You might consider installing via [nvm-windows](https://github.com/coreybutler/nvm-windows) and [nvm](https://github.com/nvm-sh/nvm) (Mac / Linux), so you can easily switch to different NodeJS versions that might be required for different projects that you work on.
In order to use the Modern.js Module, you first need [NodeJS](https://nodejs.org/zh/) engine, we recommend the latest [LTS version](https://github.com/nodejs/Release), and make sure the Node version is **>=16.0.0**. because non-stable NodeJS releases frequently have bugs. You might consider installing via [nvm-windows](https://github.com/coreybutler/nvm-windows) and [nvm](https://github.com/nvm-sh/nvm) (Mac / Linux), so you can easily switch to different NodeJS versions that might be required for different projects that you work on.

## Getting Started with npm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 3

## 3 minute demo

Want to experience Modern.js Module in action? The only prerequisite you need is [Node.js LTS](https://github.com/nodejs/Release) and make sure your Node version is **>= 14.18.0**.We recommend using the LTS version of Node.js 18.
Want to experience Modern.js Module in action? The only prerequisite you need is [Node.js LTS](https://github.com/nodejs/Release) and make sure your Node version is **>= 16.0.0**.We recommend using the LTS version of Node.js 18.

### Create new project

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 1

## 环境准备

为了使用 Modern.js Module,首先需要 [NodeJS](https://nodejs.org/zh/),我们推荐最新的[长期维护版本](https://github.com/nodejs/Release),并确保 Node 版本大于等于 **14.18.0**。因为非稳定的 NodeJS 时常有一些 Bug,你可以使用 [nvm-windows](https://github.com/coreybutler/nvm-windows) 和 [nvm](https://github.com/nvm-sh/nvm)(Mac / Linux)安装,这样你就可以方便地切换到不同的 NodeJS 版本,这些版本可能会用于不同的项目。
为了使用 Modern.js Module,首先需要 [NodeJS](https://nodejs.org/zh/),我们推荐最新的[长期维护版本](https://github.com/nodejs/Release),并确保 Node 版本大于等于 **16.0.0**。因为非稳定的 NodeJS 时常有一些 Bug,你可以使用 [nvm-windows](https://github.com/coreybutler/nvm-windows) 和 [nvm](https://github.com/nvm-sh/nvm)(Mac / Linux)安装,这样你就可以方便地切换到不同的 NodeJS 版本,这些版本可能会用于不同的项目。

## 初识 npm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 3

## 三分钟快速上手

想要实际体验 Modern.js Module?首先你需要安装 [Node.js LTS](https://github.com/nodejs/Release),并确保 Node 版本大于等于 **14.18.0**。我们推荐使用 Node.js 18 的 LTS 版本。
想要实际体验 Modern.js Module?首先你需要安装 [Node.js LTS](https://github.com/nodejs/Release),并确保 Node 版本大于等于 **16.0.0**。我们推荐使用 Node.js 18 的 LTS 版本。

### 创建新项目

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,27 @@ export interface RollupLog {
line: number;
};
message: string;
meta?: any;
names?: string[];
plugin?: string;
pluginCode?: string;
pluginCode?: unknown;
pos?: number;
reexporter?: string;
stack?: string;
url?: string;
}

export type LogLevel = 'warn' | 'info' | 'debug';
export type LogLevelOption = LogLevel | 'silent';

export type SourceMapSegment =
| [number]
| [number, number, number, number]
| [number, number, number, number, number];

export interface ExistingDecodedSourceMap {
file?: string;
mappings: SourceMapSegment[][];
readonly mappings: SourceMapSegment[][];
names: string[];
sourceRoot?: string;
sources: string[];
Expand All @@ -70,11 +74,10 @@ export interface ExistingRawSourceMap {

export type DecodedSourceMapOrMissing =
| {
mappings?: never;
missing: true;
plugin: string;
}
| ExistingDecodedSourceMap;
| (ExistingDecodedSourceMap & { missing?: false });

export interface SourceMap {
file: string;
Expand Down Expand Up @@ -128,8 +131,14 @@ export interface PluginCache {
set<T = any>(id: string, value: T): void;
}

export type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;

export interface MinimalPluginContext {
debug: LoggingFunction;
error: (error: RollupError | string) => never;
info: LoggingFunction;
meta: PluginContextMeta;
warn: LoggingFunction;
}

export interface EmittedAsset {
Expand All @@ -155,6 +164,7 @@ export interface EmittedPrebuiltChunk {
exports?: string[];
fileName: string;
map?: SourceMap;
sourcemapFileName?: string;
type: 'prebuilt-chunk';
}

Expand Down Expand Up @@ -190,15 +200,22 @@ export interface CustomPluginOptions {
[plugin: string]: any;
}

type LoggingFunctionWithPosition = (
log: RollupLog | string | (() => RollupLog | string),
pos?: number | { column: number; line: number }
) => void;

export interface PluginContext extends MinimalPluginContext {
addWatchFile: (id: string) => void;
cache: PluginCache;
debug: LoggingFunction;
emitFile: EmitFile;
error: (error: RollupError | string, pos?: number | { column: number; line: number }) => never;
error: (error: RollupError | string) => never;
getFileName: (fileReferenceId: string) => string;
getModuleIds: () => IterableIterator<string>;
getModuleInfo: GetModuleInfo;
getWatchFiles: () => string[];
info: LoggingFunction;
load: (
options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
) => Promise<ModuleInfo>;
Expand All @@ -216,7 +233,7 @@ export interface PluginContext extends MinimalPluginContext {
}
) => Promise<ResolvedId | null>;
setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
warn: LoggingFunction;
}

export interface PluginContextMeta {
Expand Down Expand Up @@ -279,7 +296,11 @@ export type LoadResult = SourceDescription | string | NullValue;
export type LoadHook = (this: PluginContext, id: string) => LoadResult;

export interface TransformPluginContext extends PluginContext {
debug: LoggingFunctionWithPosition;
error: (error: RollupError | string, pos?: number | { column: number; line: number }) => never;
getCombinedSourcemap: () => SourceMap;
info: LoggingFunctionWithPosition;
warn: LoggingFunctionWithPosition;
}

export type TransformResult = string | NullValue | Partial<SourceDescription>;
Expand Down Expand Up @@ -349,7 +370,7 @@ export type WatchChangeHook = (
* ```
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
export type PluginImpl<O extends object = object, A = any> = (options?: O) => Plugin<A>;

export interface OutputBundle {
[fileName: string]: OutputAsset | OutputChunk;
Expand All @@ -369,6 +390,7 @@ export interface FunctionPluginHooks {
) => void;
load: LoadHook;
moduleParsed: ModuleParsedHook;
onLog: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => boolean | NullValue;
options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | NullValue;
outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | NullValue;
renderChunk: RenderChunkHook;
Expand Down Expand Up @@ -417,6 +439,7 @@ export type InputPluginHooks = Exclude<keyof FunctionPluginHooks, OutputPluginHo

export type SyncPluginHooks =
| 'augmentChunkHash'
| 'onLog'
| 'outputOptions'
| 'renderDynamicImport'
| 'resolveFileUrl'
Expand All @@ -436,6 +459,7 @@ export type FirstPluginHooks =
export type SequentialPluginHooks =
| 'augmentChunkHash'
| 'generateBundle'
| 'onLog'
| 'options'
| 'outputOptions'
| 'renderChunk'
Expand Down Expand Up @@ -474,12 +498,12 @@ export interface OutputPlugin
version?: string;
}

export interface Plugin extends OutputPlugin, Partial<PluginHooks> {
export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
// for inter-plugin communication
api?: any;
api?: A;
}

type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
export type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';

export interface NormalizedTreeshakingOptions {
annotations: boolean;
Expand Down Expand Up @@ -508,16 +532,32 @@ export type ExternalOption =
| string
| RegExp
| ((source: string, importer: string | undefined, isResolved: boolean) => boolean | NullValue);
export type PureModulesOption = boolean | string[] | IsPureModule;

export type GlobalsOption = { [name: string]: string } | ((name: string) => string);

export type InputOption = string | string[] | { [entryAlias: string]: string };

export type ManualChunksOption = { [chunkAlias: string]: string[] } | GetManualChunk;

export type LogHandlerWithDefault = (
level: LogLevel,
log: RollupLog,
defaultHandler: LogOrStringHandler
) => void;

export type LogOrStringHandler = (level: LogLevel | 'error', log: RollupLog | string) => void;

export type LogHandler = (level: LogLevel, log: RollupLog) => void;

export type ModuleSideEffectsOption = boolean | 'no-external' | string[] | HasModuleSideEffects;

export type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';

export type SourcemapPathTransformOption = (
relativeSourcePath: string,
sourcemapPath: string
) => string;

export type SourcemapIgnoreListOption = (
relativeSourcePath: string,
sourcemapPath: string
Expand All @@ -536,13 +576,15 @@ export interface InputOptions {
/** @deprecated Use the "inlineDynamicImports" output option instead. */
inlineDynamicImports?: boolean;
input?: InputOption;
logLevel?: LogLevelOption;
makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
/** @deprecated Use the "manualChunks" output option instead. */
manualChunks?: ManualChunksOption;
maxParallelFileOps?: number;
/** @deprecated Use the "maxParallelFileOps" option instead. */
maxParallelFileReads?: number;
moduleContext?: ((id: string) => string | NullValue) | { [id: string]: string };
onLog?: LogHandlerWithDefault;
onwarn?: WarningHandlerWithDefault;
perf?: boolean;
plugins?: InputPluginOption;
Expand Down Expand Up @@ -571,14 +613,16 @@ export interface NormalizedInputOptions {
/** @deprecated Use the "inlineDynamicImports" output option instead. */
inlineDynamicImports: boolean | undefined;
input: string[] | { [entryAlias: string]: string };
logLevel: LogLevelOption;
makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
/** @deprecated Use the "manualChunks" output option instead. */
manualChunks: ManualChunksOption | undefined;
maxParallelFileOps: number;
/** @deprecated Use the "maxParallelFileOps" option instead. */
maxParallelFileReads: number;
moduleContext: (id: string) => string;
onwarn: WarningHandler;
onLog: LogHandler;
onwarn: (warning: RollupLog) => void;
perf: boolean;
plugins: Plugin[];
preserveEntrySignatures: PreserveEntrySignaturesOption;
Expand Down Expand Up @@ -701,6 +745,7 @@ export interface OutputOptions {
sourcemapBaseUrl?: string;
sourcemapExcludeSources?: boolean;
sourcemapFile?: string;
sourcemapFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption;
sourcemapPathTransform?: SourcemapPathTransformOption;
strict?: boolean;
Expand Down Expand Up @@ -756,6 +801,7 @@ export interface NormalizedOutputOptions {
sourcemapBaseUrl: string | undefined;
sourcemapExcludeSources: boolean;
sourcemapFile: string | undefined;
sourcemapFileNames: string | ((chunkInfo: PreRenderedChunk) => string) | undefined;
sourcemapIgnoreList: SourcemapIgnoreListOption;
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
strict: boolean;
Expand All @@ -764,10 +810,9 @@ export interface NormalizedOutputOptions {
}

export type WarningHandlerWithDefault = (
warning: RollupWarning,
defaultHandler: WarningHandler
warning: RollupLog,
defaultHandler: LoggingFunction
) => void;
export type WarningHandler = (warning: RollupWarning) => void;

export interface SerializedTimings {
[label: string]: [number, number, number];
Expand All @@ -785,7 +830,7 @@ export interface OutputAsset extends PreRenderedAsset {
}

export interface RenderedModule {
code: string | null;
readonly code: string | null;
originalLength: number;
removedExports: string[];
renderedExports: string[];
Expand Down Expand Up @@ -820,6 +865,8 @@ export interface RenderedChunk extends PreRenderedChunk {
export interface OutputChunk extends RenderedChunk {
code: string;
map: SourceMap | null;
sourcemapFileName: string | null;
preliminaryFileName: string;
}

export interface SerializablePluginCache {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PluginImpl } from '../rollup';
import { PluginImpl } from './rollup';
import ts from 'typescript';

interface Options {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"rollup-plugin-dts","author":"Arpad Borsos <arpad.borsos@googlemail.com>","version":"5.3.0","funding":{"url":"https://github.com/sponsors/Swatinem"},"license":"LGPL-3.0","types":"./dist/rollup-plugin-dts.d.ts"}
{"name":"rollup-plugin-dts","author":"Arpad Borsos <arpad.borsos@googlemail.com>","version":"6.1.0","funding":{"url":"https://github.com/sponsors/Swatinem"},"license":"LGPL-3.0","types":"index.d.ts"}
Loading