Skip to content

Commit

Permalink
Merge branch 'rollup:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Geylnu authored Oct 24, 2023
2 parents cc5eb20 + c72cf7c commit 29d8b10
Show file tree
Hide file tree
Showing 102 changed files with 1,019 additions and 482 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
run: pnpm install --ignore-scripts

- name: run tests
run: pnpm --filter "...[origin/master]" ci:test
run: pnpm --workspace-concurrency 1 --filter "...[origin/master]" ci:test
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2
token: ${{ secrets.GH_TOKEN }}

- name: Update Master
run: |
Expand Down Expand Up @@ -75,7 +76,7 @@ jobs:
git config pull.rebase false
git config --global user.email "[email protected]"
git config --global user.name "Release Workflow"
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
git remote set-url origin https://github.com/${{ github.repository }}
- name: pnpm install
run: pnpm install --frozen-lockfile
Expand Down
8 changes: 8 additions & 0 deletions packages/alias/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-alias ChangeLog

## v5.0.1

_2023-10-05_

### Bugfixes

- fix: ensure rollup 4 compatibility [#1595](https://github.com/rollup/plugins/pull/1595)

## v5.0.0

_2023-04-04_
Expand Down
6 changes: 3 additions & 3 deletions packages/alias/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-alias",
"version": "5.0.0",
"version": "5.0.1",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -50,7 +50,7 @@
"alias"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -64,7 +64,7 @@
"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-typescript": "^9.0.1",
"del-cli": "^5.0.0",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"typescript": "^4.8.3"
},
"ava": {
Expand Down
10 changes: 5 additions & 5 deletions packages/alias/test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
{
source: 'nonEntry',
importer: '/src/importer.js',
options: { assertions: {}, isEntry: false, custom: { test: 42 } }
options: { attributes: {}, isEntry: false, custom: { test: 42 } }
}
]
).then((result) => {
Expand All @@ -464,7 +464,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
'entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: void 0,
isEntry: true
}
Expand All @@ -473,7 +473,7 @@ test('Forwards isEntry and custom options to a custom resolver', (t) => {
'non-entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: { test: 42 },
isEntry: false
}
Expand Down Expand Up @@ -514,7 +514,7 @@ test('Forwards isEntry and custom options to other plugins', (t) => {
'entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: void 0,
isEntry: true
}
Expand All @@ -523,7 +523,7 @@ test('Forwards isEntry and custom options to other plugins', (t) => {
'non-entry-point',
'/src/importer.js',
{
assertions: {},
attributes: {},
custom: { test: 42 },
isEntry: false
}
Expand Down
8 changes: 8 additions & 0 deletions packages/auto-install/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-auto-install ChangeLog

## v3.0.5

_2023-10-05_

### Bugfixes

- fix: ensure rollup 4 compatibility [#1595](https://github.com/rollup/plugins/pull/1595)

## v3.0.4

_2023-04-04_
Expand Down
6 changes: 3 additions & 3 deletions packages/auto-install/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-auto-install",
"version": "3.0.4",
"version": "3.0.5",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -52,7 +52,7 @@
"modules"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -64,7 +64,7 @@
"@rollup/plugin-typescript": "^9.0.1",
"del": "^6.1.1",
"node-noop": "^1.0.0",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"typescript": "^4.8.3"
},
"ava": {
Expand Down
8 changes: 8 additions & 0 deletions packages/babel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-babel ChangeLog

## v6.0.4

_2023-10-05_

### Bugfixes

- fix: ensure rollup 4 compatibility [#1595](https://github.com/rollup/plugins/pull/1595)

## v6.0.3

_2022-11-25_
Expand Down
6 changes: 3 additions & 3 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-babel",
"version": "6.0.3",
"version": "6.0.4",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -54,7 +54,7 @@
"peerDependencies": {
"@babel/core": "^7.0.0",
"@types/babel__core": "^7.1.9",
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -78,7 +78,7 @@
"@rollup/plugin-json": "^5.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@types/babel__core": "^7.1.9",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"source-map": "^0.7.4"
},
"ava": {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel/test/as-output-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ test('transforms all chunks in a code-splitting setup', async (t) => {
t.deepEqual(
output.map(({ code }) => code),
[
`import('./dep-20aaf50b.js').then(function (result) {
`import('./dep--s88I99N.js').then(function (result) {
return console.log(result);
});
`,
Expand Down
8 changes: 8 additions & 0 deletions packages/beep/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-beep ChangeLog

## v1.0.3

_2023-10-05_

### Bugfixes

- fix: ensure rollup 4 compatibility [#1595](https://github.com/rollup/plugins/pull/1595)

## v1.0.2

_2022-10-21_
Expand Down
6 changes: 3 additions & 3 deletions packages/beep/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-beep",
"version": "1.0.2",
"version": "1.0.3",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -37,15 +37,15 @@
"rollup"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
},
"devDependencies": {
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"strip-ansi": "^7.0.1"
},
"types": "types/index.d.ts",
Expand Down
8 changes: 8 additions & 0 deletions packages/buble/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-buble ChangeLog

## v1.0.3

_2023-10-05_

### Bugfixes

- fix: ensure rollup 4 compatibility [#1595](https://github.com/rollup/plugins/pull/1595)

## v1.0.2

_2023-01-20_
Expand Down
6 changes: 3 additions & 3 deletions packages/buble/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-buble",
"version": "1.0.2",
"version": "1.0.3",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -52,7 +52,7 @@
"modules"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -67,7 +67,7 @@
"devDependencies": {
"@rollup/plugin-typescript": "^9.0.1",
"del-cli": "^5.0.0",
"rollup": "^3.2.3",
"rollup": "^4.0.0-24",
"source-map": "^0.7.4",
"typescript": "^4.8.3"
},
Expand Down
24 changes: 24 additions & 0 deletions packages/commonjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @rollup/plugin-commonjs ChangeLog

## v25.0.7

_2023-10-15_

### Bugfixes

- fix: bump magic-string version [#1596](https://github.com/rollup/plugins/pull/1596)

## v25.0.6

_2023-10-15_

### Bugfixes

- fix: Keep the shebang at the top of the file content [#1610](https://github.com/rollup/plugins/pull/1610)

## v25.0.5

_2023-10-05_

### Bugfixes

- fix: ensure rollup 4 compatibility [#1595](https://github.com/rollup/plugins/pull/1595)

## v25.0.4

_2023-08-11_
Expand Down
8 changes: 4 additions & 4 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-commonjs",
"version": "25.0.4",
"version": "25.0.7",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -53,7 +53,7 @@
"require"
],
"peerDependencies": {
"rollup": "^2.68.0||^3.0.0"
"rollup": "^2.68.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
Expand All @@ -66,14 +66,14 @@
"estree-walker": "^2.0.2",
"glob": "^8.0.3",
"is-reference": "1.2.1",
"magic-string": "^0.27.0"
"magic-string": "^0.30.3"
},
"devDependencies": {
"@rollup/plugin-json": "^5.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"locate-character": "^2.0.5",
"require-relative": "^0.8.7",
"rollup": "^3.19.0",
"rollup": "^4.0.0-24",
"shx": "^0.3.4",
"source-map": "^0.7.4",
"source-map-support": "^0.5.21",
Expand Down
13 changes: 11 additions & 2 deletions packages/commonjs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,16 @@ export default function commonjs(options = {}) {
// entry suffix is just appended to not mess up relative external resolution
if (id.endsWith(ENTRY_SUFFIX)) {
const acutalId = id.slice(0, -ENTRY_SUFFIX.length);
return getEntryProxy(acutalId, getDefaultIsModuleExports(acutalId), this.getModuleInfo);
const {
meta: { commonjs: commonjsMeta }
} = this.getModuleInfo(acutalId);
const shebang = commonjsMeta?.shebang ?? '';
return getEntryProxy(
acutalId,
getDefaultIsModuleExports(acutalId),
this.getModuleInfo,
shebang
);
}

if (isWrappedId(id, ES_IMPORT_SUFFIX)) {
Expand Down Expand Up @@ -306,7 +315,7 @@ export default function commonjs(options = {}) {
try {
return transformAndCheckExports.call(this, code, id);
} catch (err) {
return this.error(err, err.loc);
return this.error(err, err.pos);
}
}
};
Expand Down
10 changes: 7 additions & 3 deletions packages/commonjs/src/proxies.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function getStaticRequireProxy(id, requireReturnsDefault, loadModul
return `export { default } from ${JSON.stringify(id)};`;
}

export function getEntryProxy(id, defaultIsModuleExports, getModuleInfo) {
export function getEntryProxy(id, defaultIsModuleExports, getModuleInfo, shebang) {
const {
meta: { commonjs: commonjsMeta },
hasDefaultExport
Expand All @@ -55,9 +55,13 @@ export function getEntryProxy(id, defaultIsModuleExports, getModuleInfo) {
if (hasDefaultExport) {
code += `export { default } from ${stringifiedId};`;
}
return code;
return shebang + code;
}
return getEsImportProxy(id, defaultIsModuleExports);
const result = getEsImportProxy(id, defaultIsModuleExports);
return {
...result,
code: shebang + result.code
};
}

export function getEsImportProxy(id, defaultIsModuleExports) {
Expand Down
Loading

0 comments on commit 29d8b10

Please sign in to comment.