Skip to content

Commit

Permalink
Merge pull request #163 from rollup/sync-f5c349e5
Browse files Browse the repository at this point in the history
docs(en): merge rollup/master into rollup-docs-cn/master @ f5c349e
  • Loading branch information
waynzh authored Jan 6, 2025
2 parents 3b2c8eb + 96bb29b commit d313775
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 49 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# rollup changelog

## 4.29.2

_2025-01-05_

### Bug Fixes

- Keep import attributes when using dynamic ESM `import()` expressions from CommonJS (#5781)

### Pull Requests

- [#5772](https://github.com/rollup/rollup/pull/5772): Improve caching on CI (@lukastaegert)
- [#5773](https://github.com/rollup/rollup/pull/5773): fix(deps): lock file maintenance minor/patch updates (@renovate[bot])
- [#5780](https://github.com/rollup/rollup/pull/5780): feat: use picocolors instead of colorette (@re-taro)
- [#5781](https://github.com/rollup/rollup/pull/5781): fix: keep import attributes for cjs format (@TrickyPi)

## 4.29.1

_2024-12-21_
Expand Down
38 changes: 23 additions & 15 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,6 @@ Repository: git+https://github.com/paulmillr/chokidar.git
---------------------------------------

## colorette
License: MIT
By: Jorge Bucaran
Repository: jorgebucaran/colorette

> Copyright © Jorge Bucaran <<https://jorgebucaran.com>>
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------

## date-time
License: MIT
By: Sindre Sorhus
Expand Down Expand Up @@ -470,6 +455,29 @@ Repository: sindresorhus/parse-ms
---------------------------------------

## picocolors
License: ISC
By: Alexey Raspopov
Repository: alexeyraspopov/picocolors

> ISC License
>
> Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
>
> Permission to use, copy, modify, and/or distribute this software for any
> purpose with or without fee is hereby granted, provided that the above
> copyright notice and this permission notice appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------

## picomatch
License: MIT
By: Jon Schlinkert
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.29.1",
"version": "4.29.2",
"description": "Next-generation ES module bundler browser build",
"main": "dist/rollup.browser.js",
"module": "dist/es/rollup.browser.js",
Expand Down
6 changes: 3 additions & 3 deletions cli/run/batchWarnings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { blue, cyan } from 'colorette';
import pc from 'picocolors';
import type { RollupLog } from '../../src/rollup/types';
import { bold, gray, yellow } from '../../src/utils/colors';
import { ensureArray } from '../../src/utils/ensureArray';
Expand Down Expand Up @@ -72,14 +72,14 @@ export default function batchWarnings(command: Record<string, any>): BatchWarnin
}
case LOGLEVEL_DEBUG: {
if (!silent) {
stderr(bold(blue(log.message)));
stderr(bold(pc.blue(log.message)));
defaultBody(log);
}
return;
}
default: {
if (!silent) {
stderr(bold(cyan(log.message)));
stderr(bold(pc.cyan(log.message)));
defaultBody(log);
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ Promise.resolve()
| CLI: | `--externalImportAttributes`/`--no-externalImportAttributes` |
| 默认: | `true` |

是否在输出中为外部引入添加导入属性,如果输出格式为 `es`。默认情况下,属性来自输入文件,但插件可以稍后添加或删除属性。例如,`import "foo" assert {type: "json"}` 将导致相同的导入出现在输出中,除非将该选项设置为 `false`。请注意,模块的所有导入都需要具有一致的属性,否则会发出警告。
是否在输出格式为 `es``cjs` 时,在输出中为外部引入添加导入属性。默认情况下,属性是从输入文件中获取的,但插件可以在后面添加或删除属性。例如,`import "foo" assert {type: "json"}` 将导致相同的导入出现在输出中,除非该选项设置为 `false`。请注意,一个模块的所有导入需要具有一致的属性,否则会发出警告。

### output.generatedCode {#output-generatedcode}

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rollup",
"version": "4.29.1",
"version": "4.29.2",
"description": "Next-generation ES module bundler",
"main": "dist/rollup.js",
"module": "dist/es/rollup.js",
Expand Down Expand Up @@ -150,7 +150,6 @@
"buble": "^0.20.0",
"builtin-modules": "^4.0.0",
"chokidar": "^3.6.0",
"colorette": "^2.0.20",
"concurrently": "^9.1.0",
"core-js": "3.38.1",
"cross-env": "^7.0.3",
Expand All @@ -176,6 +175,7 @@
"nodemon": "^3.1.9",
"npm-audit-resolver": "^3.0.0-RC.0",
"nyc": "^17.1.0",
"picocolors": "^1.1.1",
"pinia": "^2.3.0",
"prettier": "^3.4.2",
"prettier-plugin-organize-imports": "^4.1.0",
Expand Down
8 changes: 4 additions & 4 deletions scripts/colors.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createColors } from 'colorette';
import { env } from 'node:process';
import pc from 'picocolors';

// @see https://no-color.org
// @see https://www.npmjs.com/package/chalk
export const { bold, cyan, green, red, yellow, blue, magenta } = createColors({
useColor: env.FORCE_COLOR !== '0' && !env.NO_COLOR
});
export const { bold, cyan, green, red, yellow, blue, magenta } = pc.createColors(
env.FORCE_COLOR !== '0' && !env.NO_COLOR
);
4 changes: 2 additions & 2 deletions scripts/perf-report/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* global gc */

import { createColors } from 'colorette';
import { mkdir, symlink, writeFile } from 'node:fs/promises';
import { chdir } from 'node:process';
import { fileURLToPath } from 'node:url';
import pc from 'picocolors';
import prettyBytes from 'pretty-bytes';
import { runWithEcho } from '../helpers.js';
import reportCollector from './report-collector.js';
Expand All @@ -20,7 +20,7 @@ import { newRollup, previousRollup, previousVersion } from './rollup-artefacts.j
const PERF_DIRECTORY = new URL('../../perf/', import.meta.url);
const ENTRY = new URL('entry.js', PERF_DIRECTORY);
const THREEJS_COPIES = 10;
const { bold, underline, cyan, red, green } = createColors();
const { bold, underline, cyan, red, green } = pc.createColors();
const MIN_ABSOLUTE_TIME_DEVIATION = 10;
const MIN_RELATIVE_DEVIATION_PERCENT = 2;
const RELATIVE_DEVIATION_PERCENT_FOR_COLORING = 5;
Expand Down
4 changes: 3 additions & 1 deletion src/Chunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,9 @@ export default class Chunk {
}
return [
resolution || '',
(this.outputOptions.format === 'es' && this.outputOptions.externalImportAttributes) || null
(['es', 'cjs'].includes(this.outputOptions.format) &&
this.outputOptions.externalImportAttributes) ||
null
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/ExternalChunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class ExternalChunk {

getImportAttributes(snippets: GenerateCodeSnippets): string | null {
return (this.importAttributes ||= formatAttributes(
this.options.format === 'es' &&
['es', 'cjs'].includes(this.options.format) &&
this.options.externalImportAttributes &&
this.moduleInfo.attributes,
snippets
Expand Down
8 changes: 4 additions & 4 deletions src/utils/colors.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createColors } from 'colorette';
import { env } from 'node:process';
import pc from 'picocolors';

// @see https://no-color.org
// @see https://www.npmjs.com/package/chalk
export const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
useColor: env.FORCE_COLOR !== '0' && !env.NO_COLOR
});
export const { bold, cyan, dim, gray, green, red, underline, yellow } = pc.createColors(
env.FORCE_COLOR !== '0' && !env.NO_COLOR
);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

import('external');
import(globalThis.unknown);
import('resolvedString');
import('resolved-id');
import('resolved-different');
import('unresolved');
import('external', { assert: { type: 'special' } });
import(globalThis.unknown, { assert: { type: 'special' } });
import('resolvedString', { assert: { type: 'special' } });
import('resolved-id', { assert: { type: 'special' } });
import('resolved-different', { assert: { type: 'special' } });
import('unresolved', { assert: { type: 'special' } });
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

import('external');
import(globalThis.unknown);
import('resolvedString');
import('resolved-id');
import('resolved-different');
import('unresolved');
import('external', { assert: { type: 'special' } });
import(globalThis.unknown, { with: { type: 'special' } });
import('resolvedString', { with: { type: 'special' } });
import('resolved-id', { assert: { type: 'special' } });
import('resolved-different', { assert: { type: 'special' } });
import('unresolved', { assert: { type: 'special' } });

0 comments on commit d313775

Please sign in to comment.