Skip to content

Commit

Permalink
Merge branch 'master' into feat/support-using
Browse files Browse the repository at this point in the history
  • Loading branch information
TrickyPi committed Mar 28, 2024
2 parents 57f781a + aabd6f0 commit af6fdb4
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ jobs:
rustup target add riscv64gc-unknown-linux-gnu &&
npm run build:napi -- --release --target riscv64gc-unknown-linux-gnu &&
riscv64-linux-gnu-strip *.node
- host: ubuntu-latest
target: powerpc64le-unknown-linux-gnu
setup: |
sudo apt-get update
sudo apt-get install gcc-powerpc64le-linux-gnu -y
build: >-
set -e &&
export CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc && rustup target add powerpc64le-unknown-linux-gnu &&
npm run build:napi -- --release --target powerpc64le-unknown-linux-gnu &&
powerpc64le-linux-gnu-strip *.node
- host: ubuntu-latest
target: s390x-unknown-linux-gnu
setup: |
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# rollup changelog

## 4.13.2

_2024-03-28_

### Bug Fixes

- Support now ppc64le architecture (#5350)
- Ensure accessing module info is cached after the build phase for improved performance (#5438)

### Pull Requests

- [#5350](https://github.com/rollup/rollup/pull/5350): Add support for ppc64le (@pavolloffay, @lukastaegert)
- [#5438](https://github.com/rollup/rollup/pull/5438): Cache module info getters before output generation (@bluwy, @lukastaegert)

## 4.13.1

_2024-03-27_
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.13.1",
"version": "4.13.2",
"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 native.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const bindingsByPlatformAndArch = {
linux: {
arm: { base: 'linux-arm-gnueabihf', musl: null },
arm64: { base: 'linux-arm64-gnu', musl: 'linux-arm64-musl' },
ppc64le: { base: 'linux-ppc64le-gnu', musl: null },
riscv64: { base: 'linux-riscv64-gnu', musl: null },
s390x: { base: 'linux-s390x-gnu', musl: null },
x64: { base: 'linux-x64-gnu', musl: 'linux-x64-musl' }
Expand Down
3 changes: 3 additions & 0 deletions npm/linux-ppc64le-gnu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@rollup/rollup-linux-ppc64le-gnu`

This is the **ppc64le-unknown-linux-gnu** binary for `rollup`
22 changes: 22 additions & 0 deletions npm/linux-ppc64le-gnu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@rollup/rollup-linux-ppc64le-gnu",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"ppc64le"
],
"files": [
"rollup.linux-ppc64le-gnu.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": "rollup/rollup",
"libc": [
"glibc"
],
"main": "./rollup.linux-ppc64le-gnu.node"
}
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.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rollup",
"version": "4.13.1",
"version": "4.13.2",
"description": "Next-generation ES module bundler",
"main": "dist/rollup.js",
"module": "dist/es/rollup.js",
Expand All @@ -25,6 +25,7 @@
"armv7-unknown-linux-gnueabihf",
"i686-pc-windows-msvc",
"riscv64gc-unknown-linux-gnu",
"ppc64le-unknown-linux-gnu",
"s390x-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
Expand Down
5 changes: 5 additions & 0 deletions src/ExternalModule.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ExternalVariable from './ast/variables/ExternalVariable';
import type { CustomPluginOptions, ModuleInfo, NormalizedInputOptions } from './rollup/types';
import { EMPTY_ARRAY } from './utils/blank';
import { cacheObjectGetters } from './utils/getter';
import { makeLegal } from './utils/identifierHelpers';
import { LOGLEVEL_WARN } from './utils/logging';
import { logUnusedExternalImports } from './utils/logs';
Expand Down Expand Up @@ -59,6 +60,10 @@ export default class ExternalModule {
};
}

cacheInfoGetters(): void {
cacheObjectGetters(this.info, ['dynamicImporters', 'importers']);
}

getVariableForExportName(name: string): [variable: ExternalVariable] {
const declaration = this.declarations.get(name);
if (declaration) return [declaration];
Expand Down
1 change: 1 addition & 0 deletions src/Graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export default class Graph {
throw new Error('You must supply options.input to rollup');
}
for (const module of this.modulesById.values()) {
module.cacheInfoGetters();
if (module instanceof Module) {
this.modules.push(module);
} else {
Expand Down
17 changes: 17 additions & 0 deletions src/Module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import { decodedSourcemap, resetSourcemapCache } from './utils/decodedSourcemap'
import { getId } from './utils/getId';
import { getNewSet, getOrCreate } from './utils/getOrCreate';
import { getOriginalLocation } from './utils/getOriginalLocation';
import { cacheObjectGetters } from './utils/getter';
import { makeLegal } from './utils/identifierHelpers';
import { LOGLEVEL_WARN } from './utils/logging';
import {
Expand Down Expand Up @@ -390,6 +391,22 @@ export default class Module {
this.ast!.bind();
}

cacheInfoGetters(): void {
cacheObjectGetters(this.info, [
'dynamicallyImportedIdResolutions',
'dynamicallyImportedIds',
'dynamicImporters',
'exportedBindings',
'exports',
'hasDefaultExport',
'implicitlyLoadedAfterOneOf',
'implicitlyLoadedBefore',
'importedIdResolutions',
'importedIds',
'importers'
]);
}

error(properties: RollupError, pos: number | undefined): never {
pos !== undefined && this.addLocationToLogProps(properties, pos);
return error(properties);
Expand Down
16 changes: 16 additions & 0 deletions src/utils/getter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export function cacheObjectGetters<T, K extends PropertyKey = keyof T>(
object: T,
getterProperties: K[]
) {
for (const property of getterProperties) {
const propertyGetter = Object.getOwnPropertyDescriptor(object, property)!.get!;
Object.defineProperty(object, property, {
get() {
const value = propertyGetter.call(object);
// This replaces the getter with a fixed value for subsequent calls
Object.defineProperty(object, property, { value });
return value;
}
});
}
}

0 comments on commit af6fdb4

Please sign in to comment.