Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rollup/plugins
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 38045af0ff5ef452a3c0b49a36df79aa0ca673e3
Choose a base ref
...
head repository: rollup/plugins
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 468f5a06ed0afb527fbcbe89d2812e97ee9a670c
Choose a head ref

Commits on Oct 21, 2022

  1. chore(release): json v5.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    55ceae3 View commit details
  2. chore(release): legacy v3.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    c952544 View commit details
  3. chore(release): multi-entry v5.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    298c913 View commit details
  4. chore(release): node-resolve v15.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    6553006 View commit details
  5. chore(release): pluginutils v5.0.2

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    2eb71f2 View commit details
  6. chore(release): replace v5.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    8791470 View commit details
  7. chore(release): run v3.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    1ae3845 View commit details
  8. chore(release): strip v3.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    91bfd2d View commit details
  9. chore(release): sucrase v5.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    ee1b4ba View commit details
  10. chore(release): typescript v9.0.2

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    2f2ba1e View commit details
  11. chore(release): url v8.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    6ec4228 View commit details
  12. chore(release): virtual v3.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    6ddddeb View commit details
  13. chore(release): wasm v6.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    a187c2d View commit details
  14. chore(release): yaml v4.0.1

    Release Workflow committed Oct 21, 2022
    Copy the full SHA
    9b231e7 View commit details

Commits on Oct 24, 2022

  1. feat(multi-entry): add preserveModules option (#1237)

    * Update functionality to maintain file output names when preserveModule = true
    
    BREAKING CHANGES: Changes the default behaviour to not alter filenames
    if preserveModules=true
    
    * Fix docstring
    
    * Tests
    
    * Fix type doc
    
    * Swap to use preserveModules config option instead
    
    * Update readme and type docstrings
    
    * Fix tests
    
    * Revert odd changes in diff
    
    * Improve test
    
    * Fix tests
    
    Co-authored-by: Blake Lovelace <blake.lovelace@health.telstra.com>
    814k31 and Blake Lovelace authored Oct 24, 2022
    Copy the full SHA
    805339c View commit details
  2. chore(release): multi-entry v6.0.0

    Release Workflow committed Oct 24, 2022
    Copy the full SHA
    45503a6 View commit details

Commits on Oct 27, 2022

  1. feat(terser): initial release (#1323)

    * build(terser): add terser plugin to collection
    
    * build(terser): add README.md notice
    
    * fix(terser): test-suite + rollup plugin definition
    
    * style(terser): applied prettier rules
    
    * style(terser): apply prettier on root README.md + minor eslint fixes
    
    * test(terser): removed snapshot test due incorrect path with ava
    tada5hi authored and shellscape committed Oct 27, 2022
    Copy the full SHA
    047fc1d View commit details
  2. chore(release): terser v0.1.0

    Release Workflow committed Oct 27, 2022
    Copy the full SHA
    8ade726 View commit details
  3. fix(graphql): fix ESM build (#1318)

    Use file extensions for imports
    lukastaegert authored Oct 27, 2022
    Copy the full SHA
    46bd37c View commit details
  4. chore(release): graphql v2.0.2

    Release Workflow committed Oct 27, 2022
    Copy the full SHA
    570f77c View commit details

Commits on Nov 25, 2022

  1. Copy the full SHA
    2ae1c62 View commit details
  2. chore(release): babel v6.0.3

    Release Workflow committed Nov 25, 2022
    Copy the full SHA
    19ad1b6 View commit details

Commits on Nov 27, 2022

  1. fix(commonjs): correctly wrap a default class export from cjs module (#…

    …1350)
    
    * fix: correctly wraps the default export from a CommonJS module when it is a class
    
    Fixes https://github.com/vitejs/vite/issues/10853
    
    Since 3c00191
    the namespace became callable when requiring ESM with function default,
    but it isn't newable, leading to errors when the function is actually a
    class.
    
    * test: update snapshots as the helper code has changed
    haoqunjiang authored Nov 27, 2022
    Copy the full SHA
    ab05216 View commit details
  2. chore(release): commonjs v23.0.3

    Release Workflow committed Nov 27, 2022
    Copy the full SHA
    c719c7d View commit details
  3. Copy the full SHA
    5250b88 View commit details
  4. chore(release): json v5.0.2

    Release Workflow committed Nov 27, 2022
    Copy the full SHA
    b734673 View commit details
  5. fix(typescript)!: incorrect declarations directory

    BREAKING CHANGES: This fix changes the output directory for types with single-file builds
    georg94 authored Nov 27, 2022
    Copy the full SHA
    a5c90d1 View commit details
  6. chore(release): typescript v10.0.0

    Release Workflow committed Nov 27, 2022
    Copy the full SHA
    fd93b71 View commit details
  7. chore(repo): enable consistent-type-imports for typescript files (#…

    …1325)
    
    * refactor: distinguish between types of import
    
    * add consistent-type-import into the eslint config
    
    * fix: change the import method of non compliant rules
    jerry-lllman authored Nov 27, 2022
    Copy the full SHA
    a2e582a View commit details
  8. Copy the full SHA
    7871903 View commit details

Commits on Nov 28, 2022

  1. Copy the full SHA
    5c88274 View commit details
  2. chore(release): typescript v10.0.1

    Release Workflow committed Nov 28, 2022
    Copy the full SHA
    ca7a668 View commit details

Commits on Dec 5, 2022

  1. feat(terser): parallel execution (#1341)

    * feat(terser): parallel execution
    
    * fix(terser): exit process on promise rejection of worker
    
    * feat(terser): add woker-pool support
    
    * docs(terser): updated docs
    
    * fix(terser): worker count decrementation
    
    * style(terser): removed unnecessary Promise.resolve wrapping
    
    * docs(terser): enhanced options section
    
    * docs(terser): fix typo
    tada5hi authored Dec 5, 2022
    Copy the full SHA
    140e06b View commit details
  2. chore(release): terser v0.2.0

    Release Workflow committed Dec 5, 2022
    Copy the full SHA
    fb11bd3 View commit details

Commits on Dec 7, 2022

  1. Copy the full SHA
    a47c153 View commit details
  2. chore(release): commonjs v23.0.4

    Release Workflow committed Dec 7, 2022
    Copy the full SHA
    7b62557 View commit details

Commits on Dec 15, 2022

  1. Copy the full SHA
    39a39d7 View commit details
  2. chore(release): commonjs v23.0.5

    Release Workflow committed Dec 15, 2022
    Copy the full SHA
    75e9ff4 View commit details

Commits on Dec 17, 2022

  1. Copy the full SHA
    f5aa3c3 View commit details
  2. chore(release): commonjs v23.0.6

    Release Workflow committed Dec 17, 2022
    Copy the full SHA
    18e6c31 View commit details
  3. chore(release): dynamic-import-vars v2.0.2

    Release Workflow committed Dec 17, 2022
    Copy the full SHA
    672f650 View commit details
  4. chore(release): inject v5.0.3

    Release Workflow committed Dec 17, 2022
    Copy the full SHA
    468f5a0 View commit details
Showing with 3,962 additions and 457 deletions.
  1. +2 −1 .eslintrc.js
  2. +1 −0 README.md
  3. +1 −3 package.json
  4. +1 −1 packages/alias/src/index.ts
  5. +1 −1 packages/alias/types/index.d.ts
  6. +1 −1 packages/auto-install/src/index.ts
  7. +1 −1 packages/auto-install/types/index.d.ts
  8. +8 −0 packages/babel/CHANGELOG.md
  9. +1 −1 packages/babel/README.md
  10. +1 −1 packages/babel/package.json
  11. +2 −1 packages/babel/test/types.ts
  12. +3 −3 packages/babel/types/index.d.ts
  13. +1 −1 packages/beep/types/index.d.ts
  14. +1 −1 packages/buble/src/index.ts
  15. +1 −1 packages/buble/test/types.ts
  16. +3 −3 packages/buble/types/index.d.ts
  17. +32 −0 packages/commonjs/CHANGELOG.md
  18. +2 −2 packages/commonjs/package.json
  19. +7 −1 packages/commonjs/src/helpers.js
  20. +8 −3 packages/commonjs/src/index.js
  21. +3 −0 packages/commonjs/test/fixtures/samples/es-module-with-class-as-default-export/main.js
  22. +7 −0 packages/commonjs/test/fixtures/samples/es-module-with-class-as-default-export/other.js
  23. +327 −105 packages/commonjs/test/snapshots/function.js.md
  24. BIN packages/commonjs/test/snapshots/function.js.snap
  25. +33 −7 packages/commonjs/test/snapshots/test.js.md
  26. BIN packages/commonjs/test/snapshots/test.js.snap
  27. +9 −0 packages/commonjs/test/test.js
  28. +12 −12 packages/commonjs/types/index.d.ts
  29. +1 −1 packages/data-uri/src/index.ts
  30. +1 −1 packages/data-uri/types/index.d.ts
  31. +1 −1 packages/dsv/test/types.ts
  32. +3 −3 packages/dsv/types/index.d.ts
  33. +8 −0 packages/dynamic-import-vars/CHANGELOG.md
  34. +2 −2 packages/dynamic-import-vars/package.json
  35. +1 −1 packages/dynamic-import-vars/test/types.ts
  36. +4 −6 packages/dynamic-import-vars/types/index.d.ts
  37. +1 −1 packages/eslint/src/index.ts
  38. +3 −3 packages/eslint/types/index.d.ts
  39. +8 −0 packages/graphql/CHANGELOG.md
  40. +1 −1 packages/graphql/package.json
  41. +1 −1 packages/graphql/rollup.config.mjs
  42. +1 −1 packages/graphql/src/index.js
  43. +1 −0 packages/graphql/test/node_modules/current-package
  44. +2 −2 packages/graphql/test/test.js
  45. +22 −0 packages/graphql/test/test.mjs
  46. +1 −1 packages/graphql/test/types.ts
  47. +2 −2 packages/graphql/types/index.d.ts
  48. +1 −1 packages/html/src/index.ts
  49. +1 −1 packages/html/types/index.d.ts
  50. +1 −1 packages/image/test/types.ts
  51. +2 −2 packages/image/types/index.d.ts
  52. +8 −0 packages/inject/CHANGELOG.md
  53. +2 −2 packages/inject/package.json
  54. +1 −1 packages/inject/test/types.ts
  55. +1 −1 packages/inject/types/index.d.ts
  56. +16 −0 packages/json/CHANGELOG.md
  57. +2 −2 packages/json/README.md
  58. +1 −1 packages/json/package.json
  59. +1 −1 packages/json/test/types.ts
  60. +2 −2 packages/json/types/index.d.ts
  61. +8 −0 packages/legacy/CHANGELOG.md
  62. +1 −1 packages/legacy/package.json
  63. +1 −1 packages/legacy/test/types.ts
  64. +1 −1 packages/legacy/types/index.d.ts
  65. +16 −0 packages/multi-entry/CHANGELOG.md
  66. +7 −0 packages/multi-entry/README.md
  67. +1 −1 packages/multi-entry/package.json
  68. +1 −1 packages/multi-entry/src/index.js
  69. +40 −0 packages/multi-entry/test/test.mjs
  70. +1 −1 packages/multi-entry/test/types.ts
  71. +9 −2 packages/multi-entry/types/index.d.ts
  72. +8 −0 packages/node-resolve/CHANGELOG.md
  73. +1 −1 packages/node-resolve/package.json
  74. +1 −1 packages/node-resolve/types/index.d.ts
  75. +8 −0 packages/pluginutils/CHANGELOG.md
  76. +1 −1 packages/pluginutils/package.json
  77. +1 −1 packages/pluginutils/src/attachScopes.ts
  78. +13 −5 packages/pluginutils/src/extractAssignedNames.ts
  79. +3 −2 packages/pluginutils/test/attachScopes.ts
  80. +1 −1 packages/pluginutils/types/index.d.ts
  81. +8 −0 packages/replace/CHANGELOG.md
  82. +2 −2 packages/replace/package.json
  83. +1 −1 packages/replace/test/types.ts
  84. +2 −2 packages/replace/types/index.d.ts
  85. +8 −0 packages/run/CHANGELOG.md
  86. +1 −1 packages/run/package.json
  87. +3 −2 packages/run/src/index.ts
  88. +2 −2 packages/run/types/index.d.ts
  89. +8 −0 packages/strip/CHANGELOG.md
  90. +2 −2 packages/strip/package.json
  91. +1 −1 packages/strip/test/types.ts
  92. +2 −2 packages/strip/types/index.d.ts
  93. +8 −0 packages/sucrase/CHANGELOG.md
  94. +1 −1 packages/sucrase/package.json
  95. +1 −1 packages/sucrase/test/types.ts
  96. +3 −3 packages/sucrase/types/index.d.ts
  97. +17 −0 packages/terser/CHANGELOG.md
  98. +80 −0 packages/terser/README.md
  99. +74 −0 packages/terser/package.json
  100. +10 −0 packages/terser/rollup.config.mjs
  101. +8 −0 packages/terser/src/index.ts
  102. +72 −0 packages/terser/src/module.ts
  103. +33 −0 packages/terser/src/type.ts
  104. +117 −0 packages/terser/src/worker-pool.ts
  105. +47 −0 packages/terser/src/worker.ts
  106. +2 −0 packages/terser/test/fixtures/chunk-1.js
  107. +2 −0 packages/terser/test/fixtures/chunk-2.js
  108. +13 −0 packages/terser/test/fixtures/commented.js
  109. 0 packages/terser/test/fixtures/empty.js
  110. +1 −0 packages/terser/test/fixtures/export-number.js
  111. +2 −0 packages/terser/test/fixtures/failed.js
  112. +4 −0 packages/terser/test/fixtures/plain-file.js
  113. +9 −0 packages/terser/test/fixtures/properties-and-locals.js
  114. +5 −0 packages/terser/test/fixtures/properties.js
  115. +3 −0 packages/terser/test/fixtures/sourcemap.js
  116. +7 −0 packages/terser/test/fixtures/unminified.js
  117. +327 −0 packages/terser/test/test.js
  118. +14 −0 packages/terser/test/types.ts
  119. +7 −0 packages/terser/tsconfig.json
  120. +10 −0 packages/terser/types/index.d.ts
  121. +24 −0 packages/typescript/CHANGELOG.md
  122. +1 −1 packages/typescript/package.json
  123. +6 −5 packages/typescript/src/diagnostics/emit.ts
  124. +2 −1 packages/typescript/src/diagnostics/host.ts
  125. +3 −2 packages/typescript/src/diagnostics/toWarning.ts
  126. +11 −1 packages/typescript/src/index.ts
  127. +3 −2 packages/typescript/src/moduleResolution.ts
  128. +4 −5 packages/typescript/src/options/normalize.ts
  129. +8 −10 packages/typescript/src/options/tsconfig.ts
  130. +2 −2 packages/typescript/src/options/validate.ts
  131. +5 −3 packages/typescript/src/outputFile.ts
  132. +2 −2 packages/typescript/src/preflight.ts
  133. +2 −1 packages/typescript/src/tslib.ts
  134. +5 −5 packages/typescript/src/watchProgram.ts
  135. +1,920 −0 packages/typescript/test/fixtures/incremental-watch-off/dist/.tsbuildinfo
  136. +6 −0 packages/typescript/test/fixtures/incremental-watch-off/main.ts
  137. +6 −0 packages/typescript/test/fixtures/incremental-watch-off/original.txt
  138. +8 −0 packages/typescript/test/fixtures/incremental-watch-off/tsconfig.json
  139. +1 −1 packages/typescript/test/fixtures/project-references/animals/dog.ts
  140. +2 −1 packages/typescript/test/fixtures/project-references/zoo/zoo.ts
  141. +39 −1 packages/typescript/test/test.js
  142. +2 −1 packages/typescript/test/tslib.ts
  143. +6 −4 packages/typescript/types/index.d.ts
  144. +8 −0 packages/url/CHANGELOG.md
  145. +1 −1 packages/url/package.json
  146. +1 −1 packages/url/test/types.ts
  147. +2 −2 packages/url/types/index.d.ts
  148. +8 −0 packages/virtual/CHANGELOG.md
  149. +1 −1 packages/virtual/package.json
  150. +2 −2 packages/virtual/src/index.ts
  151. +1 −1 packages/virtual/types/index.d.ts
  152. +8 −0 packages/wasm/CHANGELOG.md
  153. +1 −1 packages/wasm/package.json
  154. +1 −1 packages/wasm/src/index.ts
  155. +1 −1 packages/wasm/types/index.d.ts
  156. +8 −0 packages/yaml/CHANGELOG.md
  157. +1 −1 packages/yaml/package.json
  158. +1 −1 packages/yaml/test/types.ts
  159. +2 −2 packages/yaml/types/index.d.ts
  160. +233 −160 pnpm-lock.yaml
  161. +2 −2 util/test.d.ts
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@ module.exports = {
'sort-keys': 'off',
'typescript-sort-keys/interface': 'off',
'import/extensions': 'off',
'import/no-unresolved': 'off'
'import/no-unresolved': 'off',
'@typescript-eslint/consistent-type-imports': 'error'
},
overrides: [
{
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ This repository houses plugins that Rollup considers critical to every day use o
| [run](packages/run) | Run your bundles in Node once they're built |
| [strip](packages/strip) | Remove debugger statements and functions like assert.equal and console.log from your code |
| [sucrase](packages/sucrase) | Compile TypeScript, Flow, JSX, etc with Sucrase |
| [terser](packages/terser) | Generate a minified output bundle with terser |
| [typescript](packages/typescript) | Integration between Rollup and Typescript |
| [url](packages/url) | Import files as data-URIs or ES Modules |
| [virtual](packages/virtual) | Load virtual modules from memory |
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -31,16 +31,14 @@
"codecov-lite": "2.0.0",
"conventional-commits-parser": "^3.2.1",
"del-cli": "^5.0.0",
"eslint": "^8.24.0",
"eslint-config-rollup": "^3.0.0",
"eslint-config-rollup": "^3.0.1",
"esm": "^3.2.25",
"execa": "^5.1.1",
"globby": "^11.0.1",
"husky": "8.0.1",
"lint-staged": "11.0.1",
"nyc": "^15.1.0",
"pnpm": "^7.12.2",
"prettier": "^2.7.1",
"prettier-plugin-package": "^1.3.0",
"semver": "^7.3.2",
"source-map-support": "^0.5.21",
2 changes: 1 addition & 1 deletion packages/alias/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin } from 'rollup';
import type { Plugin } from 'rollup';

import type { ResolvedAlias, ResolverFunction, ResolverObject, RollupAliasOptions } from '../types';

2 changes: 1 addition & 1 deletion packages/alias/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, PluginHooks } from 'rollup';
import type { Plugin, PluginHooks } from 'rollup';

type MapToFunction<T> = T extends Function ? T : never;

2 changes: 1 addition & 1 deletion packages/auto-install/src/index.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import mod from 'module';
import { exec } from 'child_process';
import { promisify } from 'util';

import { Plugin } from 'rollup';
import type { Plugin } from 'rollup';

import type { RollupAutoInstallOptions } from '../types';

2 changes: 1 addition & 1 deletion packages/auto-install/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin } from 'rollup';
import type { Plugin } from 'rollup';

export interface RollupAutoInstallOptions {
/**
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.3

_2022-11-25_

### Updates

- docs: small typo in babel plugin readme [#1355](https://github.com/rollup/plugins/pull/1355)

## v6.0.2

_2022-10-21_
2 changes: 1 addition & 1 deletion packages/babel/README.md
Original file line number Diff line number Diff line change
@@ -198,7 +198,7 @@ export default {
};
```

The `include`, `exclude` and `extensions` options are ignored when the when using `getBabelOutputPlugin` and `createBabelOutputPluginFactory` will produce warnings, and there are a few more points to note that users should be aware of.
The `include`, `exclude` and `extensions` options are ignored when using `getBabelOutputPlugin` and `createBabelOutputPluginFactory` will produce warnings, and there are a few more points to note that users should be aware of.

You can also run the plugin twice on the code, once when processing the input files to transpile special syntax to JavaScript and once on the output to transpile to a lower compatibility target:

2 changes: 1 addition & 1 deletion 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.2",
"version": "6.0.3",
"publishConfig": {
"access": "public"
},
3 changes: 2 additions & 1 deletion packages/babel/test/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** eslint-disable @typescript-eslint/no-unused-vars */
import type { RollupOptions } from 'rollup';

import babelPlugin, {
babel,
@@ -8,7 +9,7 @@ import babelPlugin, {
createBabelOutputPluginFactory
} from '../types';

const rollupConfig: import('rollup').RollupOptions = {
const rollupConfig: RollupOptions = {
input: 'main.js',
output: {
file: 'bundle.js',
6 changes: 3 additions & 3 deletions packages/babel/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Plugin, PluginContext, TransformPluginContext } from 'rollup';
import { FilterPattern, CreateFilter } from '@rollup/pluginutils';
import * as babelCore from '@babel/core';
import type { Plugin, PluginContext, TransformPluginContext } from 'rollup';
import type { FilterPattern, CreateFilter } from '@rollup/pluginutils';
import type * as babelCore from '@babel/core';

export interface RollupBabelInputPluginOptions
extends Omit<babelCore.TransformOptions, 'include' | 'exclude'> {
2 changes: 1 addition & 1 deletion packages/beep/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin } from 'rollup';
import type { Plugin } from 'rollup';

/**
* 🍣 A Rollup plugin that beeps when a build ends with errors.
2 changes: 1 addition & 1 deletion packages/buble/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { transform } from 'buble';
import { Plugin } from 'rollup';
import type { Plugin } from 'rollup';
import { createFilter } from '@rollup/pluginutils';

import type { RollupBubleOptions } from '../types';
2 changes: 1 addition & 1 deletion packages/buble/test/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RollupOptions } from 'rollup';
import type { RollupOptions } from 'rollup';

import buble from '..';

6 changes: 3 additions & 3 deletions packages/buble/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FilterPattern } from '@rollup/pluginutils';
import { TransformOptions } from 'buble';
import { Plugin } from 'rollup';
import type { FilterPattern } from '@rollup/pluginutils';
import type { TransformOptions } from 'buble';
import type { Plugin } from 'rollup';

export interface RollupBubleOptions extends TransformOptions {
/**
32 changes: 32 additions & 0 deletions packages/commonjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# @rollup/plugin-commonjs ChangeLog

## v23.0.6

_2022-12-17_

### Bugfixes

- fix: update magic-string [#1373](https://github.com/rollup/plugins/pull/1373)

## v23.0.5

_2022-12-15_

### Bugfixes

- fix: resolve export exports not found [#1363](https://github.com/rollup/plugins/pull/1363)

## v23.0.4

_2022-12-07_

### Bugfixes

- fix: declaration tag @default for ignoreTryCatch + fix some typos [#1370](https://github.com/rollup/plugins/pull/1370)

## v23.0.3

_2022-11-27_

### Bugfixes

- fix: correctly wrap a default class export from cjs module [#1350](https://github.com/rollup/plugins/pull/1350)

## v23.0.2

_2022-10-21_
4 changes: 2 additions & 2 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-commonjs",
"version": "23.0.2",
"version": "23.0.6",
"publishConfig": {
"access": "public"
},
@@ -67,7 +67,7 @@
"estree-walker": "^2.0.2",
"glob": "^8.0.3",
"is-reference": "1.2.1",
"magic-string": "^0.26.4"
"magic-string": "^0.27.0"
},
"devDependencies": {
"@rollup/plugin-json": "^5.0.0",
8 changes: 7 additions & 1 deletion packages/commonjs/src/helpers.js
Original file line number Diff line number Diff line change
@@ -37,7 +37,13 @@ export function getDefaultExportFromNamespaceIfNotNamed (n) {
export function getAugmentedNamespace(n) {
var f = n.default;
if (typeof f == "function") {
var a = function () {
var a = function a () {
if (this instanceof a) {
var args = [null];
args.push.apply(args, arguments);
var Ctor = Function.bind.apply(f, args);
return new Ctor();
}
return f.apply(this, arguments);
};
a.prototype = f.prototype;
11 changes: 8 additions & 3 deletions packages/commonjs/src/index.js
Original file line number Diff line number Diff line change
@@ -243,10 +243,15 @@ export default function commonjs(options = {}) {
}

if (isWrappedId(id, MODULE_SUFFIX)) {
const name = getName(unwrapId(id, MODULE_SUFFIX));
const module = getName(unwrapId(id, MODULE_SUFFIX));
const moduleExports = `${module}Exports`;
return {
code: `var ${name} = {exports: {}}; export {${name} as __module}`,
syntheticNamedExports: '__module',
code: `var ${moduleExports} = {};
var ${module} = {
get exports(){ return ${moduleExports}; },
set exports(v){ ${moduleExports} = v; },
};
export {${module} as __module, ${moduleExports} as exports}`,
meta: { commonjs: { isCommonJS: false } }
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const Foo = require('./other.js');

new Foo(1, 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default class Foo {
constructor(...args) {
if (args.length !== 2) {
throw new Error(`new Foo(...) requires exactly 2 arguments, received ${args.length}`);
}
}
}
Loading