Skip to content

Commit 0b8b4cc

Browse files
committed
Merge branch 'master' of https://github.com/rollup/rollup into sync-b379a592
2 parents b53fe28 + b379a59 commit 0b8b4cc

File tree

12 files changed

+94
-4
lines changed

12 files changed

+94
-4
lines changed

.github/workflows/build-and-tests.yml

+10
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ jobs:
181181
rustup target add riscv64gc-unknown-linux-gnu &&
182182
npm run build:napi -- --release --target riscv64gc-unknown-linux-gnu &&
183183
riscv64-linux-gnu-strip *.node
184+
- host: ubuntu-latest
185+
target: powerpc64le-unknown-linux-gnu
186+
setup: |
187+
sudo apt-get update
188+
sudo apt-get install gcc-powerpc64le-linux-gnu -y
189+
build: >-
190+
set -e &&
191+
export CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc && rustup target add powerpc64le-unknown-linux-gnu &&
192+
npm run build:napi -- --release --target powerpc64le-unknown-linux-gnu &&
193+
powerpc64le-linux-gnu-strip *.node
184194
- host: ubuntu-latest
185195
target: s390x-unknown-linux-gnu
186196
setup: |

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# rollup changelog
22

3+
## 4.13.2
4+
5+
_2024-03-28_
6+
7+
### Bug Fixes
8+
9+
- Ensure accessing module info is cached after the build phase for improved performance (#5438)
10+
- Support powerpc64le CPUs (#5350)
11+
12+
### Pull Requests
13+
14+
- [#5350](https://github.com/rollup/rollup/pull/5350): Add support for ppc64le (@pavolloffay, @lukastaegert)
15+
- [#5438](https://github.com/rollup/rollup/pull/5438): Cache module info getters before output generation (@bluwy, @lukastaegert)
16+
317
## 4.13.1
418

519
_2024-03-27_

browser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rollup/browser",
3-
"version": "4.13.1",
3+
"version": "4.13.2",
44
"description": "Next-generation ES module bundler browser build",
55
"main": "dist/rollup.browser.js",
66
"module": "dist/es/rollup.browser.js",

native.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const bindingsByPlatformAndArch = {
1616
linux: {
1717
arm: { base: 'linux-arm-gnueabihf', musl: null },
1818
arm64: { base: 'linux-arm64-gnu', musl: 'linux-arm64-musl' },
19+
ppc64le: { base: 'linux-powerpc64le-gnu', musl: null },
1920
riscv64: { base: 'linux-riscv64-gnu', musl: null },
2021
s390x: { base: 'linux-s390x-gnu', musl: null },
2122
x64: { base: 'linux-x64-gnu', musl: 'linux-x64-musl' }

npm/linux-powerpc64le-gnu/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@rollup/rollup-linux-powerpc64le-gnu`
2+
3+
This is the **powerpc64le-unknown-linux-gnu** binary for `rollup`
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@rollup/rollup-linux-powerpc64le-gnu",
3+
"version": "0.0.0",
4+
"os": [
5+
"linux"
6+
],
7+
"cpu": [
8+
"ppc64le"
9+
],
10+
"files": [
11+
"rollup.linux-powerpc64le-gnu.node"
12+
],
13+
"description": "Native bindings for Rollup",
14+
"author": "Lukas Taegert-Atkinson",
15+
"homepage": "https://rollupjs.org/",
16+
"license": "MIT",
17+
"repository": "rollup/rollup",
18+
"libc": [
19+
"glibc"
20+
],
21+
"main": "./rollup.linux-powerpc64le-gnu.node"
22+
}

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rollup",
3-
"version": "4.13.1",
3+
"version": "4.13.2",
44
"description": "Next-generation ES module bundler",
55
"main": "dist/rollup.js",
66
"module": "dist/es/rollup.js",
@@ -25,6 +25,7 @@
2525
"armv7-unknown-linux-gnueabihf",
2626
"i686-pc-windows-msvc",
2727
"riscv64gc-unknown-linux-gnu",
28+
"powerpc64le-unknown-linux-gnu",
2829
"s390x-unknown-linux-gnu",
2930
"x86_64-apple-darwin",
3031
"x86_64-pc-windows-msvc",

src/ExternalModule.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ExternalVariable from './ast/variables/ExternalVariable';
22
import type { CustomPluginOptions, ModuleInfo, NormalizedInputOptions } from './rollup/types';
33
import { EMPTY_ARRAY } from './utils/blank';
4+
import { cacheObjectGetters } from './utils/getter';
45
import { makeLegal } from './utils/identifierHelpers';
56
import { LOGLEVEL_WARN } from './utils/logging';
67
import { logUnusedExternalImports } from './utils/logs';
@@ -59,6 +60,10 @@ export default class ExternalModule {
5960
};
6061
}
6162

63+
cacheInfoGetters(): void {
64+
cacheObjectGetters(this.info, ['dynamicImporters', 'importers']);
65+
}
66+
6267
getVariableForExportName(name: string): [variable: ExternalVariable] {
6368
const declaration = this.declarations.get(name);
6469
if (declaration) return [declaration];

src/Graph.ts

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export default class Graph {
151151
throw new Error('You must supply options.input to rollup');
152152
}
153153
for (const module of this.modulesById.values()) {
154+
module.cacheInfoGetters();
154155
if (module instanceof Module) {
155156
this.modules.push(module);
156157
} else {

src/Module.ts

+17
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import { decodedSourcemap, resetSourcemapCache } from './utils/decodedSourcemap'
5555
import { getId } from './utils/getId';
5656
import { getNewSet, getOrCreate } from './utils/getOrCreate';
5757
import { getOriginalLocation } from './utils/getOriginalLocation';
58+
import { cacheObjectGetters } from './utils/getter';
5859
import { makeLegal } from './utils/identifierHelpers';
5960
import { LOGLEVEL_WARN } from './utils/logging';
6061
import {
@@ -390,6 +391,22 @@ export default class Module {
390391
this.ast!.bind();
391392
}
392393

394+
cacheInfoGetters(): void {
395+
cacheObjectGetters(this.info, [
396+
'dynamicallyImportedIdResolutions',
397+
'dynamicallyImportedIds',
398+
'dynamicImporters',
399+
'exportedBindings',
400+
'exports',
401+
'hasDefaultExport',
402+
'implicitlyLoadedAfterOneOf',
403+
'implicitlyLoadedBefore',
404+
'importedIdResolutions',
405+
'importedIds',
406+
'importers'
407+
]);
408+
}
409+
393410
error(properties: RollupError, pos: number | undefined): never {
394411
pos !== undefined && this.addLocationToLogProps(properties, pos);
395412
return error(properties);

src/utils/getter.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export function cacheObjectGetters<T, K extends PropertyKey = keyof T>(
2+
object: T,
3+
getterProperties: K[]
4+
) {
5+
for (const property of getterProperties) {
6+
const propertyGetter = Object.getOwnPropertyDescriptor(object, property)!.get!;
7+
Object.defineProperty(object, property, {
8+
get() {
9+
const value = propertyGetter.call(object);
10+
// This replaces the getter with a fixed value for subsequent calls
11+
Object.defineProperty(object, property, { value });
12+
return value;
13+
}
14+
});
15+
}
16+
}

0 commit comments

Comments
 (0)