rollup 2.61.1 → 2.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 2.65.0
4
+
5
+ _2022-01-21_
6
+
7
+ ### Features
8
+
9
+ - Add complete import resolution objects to ModuleInfo for use in `this.load` (#4354)
10
+
11
+ ### Bug Fixes
12
+
13
+ - Use correct context in plugin hooks with `perf: true` (#4357)
14
+
15
+ ### Pull Requests
16
+
17
+ - [#4351](https://github.com/rollup/rollup/pull/4351): refactor: re-use source mapping url (@dnalborczyk)
18
+ - [#4352](https://github.com/rollup/rollup/pull/4352): refactor: replace require-relative with built-in require.resolve (@dnalborczyk)
19
+ - [#4353](https://github.com/rollup/rollup/pull/4353): chore: bump deps (@dnalborczyk)
20
+ - [#4354](https://github.com/rollup/rollup/pull/4354): Add importedIdResolutions to moduleInfo (@lukastaegert)
21
+ - [#4355](https://github.com/rollup/rollup/pull/4355): chore: remove external from config (@dnalborczyk)
22
+ - [#4357](https://github.com/rollup/rollup/pull/4357): fix: timed plugin context (@dnalborczyk)
23
+
24
+ ## 2.64.0
25
+
26
+ _2022-01-14_
27
+
28
+ ### Features
29
+
30
+ - Allow inspecting cached modules and forcing them to be transformed again via shouldTransformCachedModule (#4320)
31
+ - Do not wait for the config file to be parsed in watch mode if it is updated before that (#4344)
32
+
33
+ ### Bug Fixes
34
+
35
+ - Do not mutate objects returned as `meta` from the resolveId hook (#4347)
36
+
37
+ ### Pull Requests
38
+
39
+ - [#4326](https://github.com/rollup/rollup/pull/4326): refactor: type fixes (@dnalborczyk)
40
+ - [#4339](https://github.com/rollup/rollup/pull/4339): More watch test stabilization (@lukastaegert)
41
+ - [#4340](https://github.com/rollup/rollup/pull/4340): refactor: performance timers for node.js and browser (@dnalborczyk)
42
+ - [#4341](https://github.com/rollup/rollup/pull/4341): Implement shouldTransformCachedModule hook (@lukastaegert)
43
+ - [#4344](https://github.com/rollup/rollup/pull/4344): Directly restart Rollup when config file change is detected in watch mode (@lukastaegert)
44
+ - [#4347](https://github.com/rollup/rollup/pull/4347): Create a shallow copy when returning meta from resolveId (@lukastaegert)
45
+
46
+ ## 2.63.0
47
+
48
+ _2022-01-04_
49
+
50
+ ### Features
51
+
52
+ - Report a helpful error if rollup exits due to an empty event loop when using `this.load` (#4320)
53
+ - Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328)
54
+ - Detect additional side effect free array prototype methods (#4332)
55
+
56
+ ### Bug Fixes
57
+
58
+ - Do not watch if CLI watch options are specified but `--watch` is missing (#4335)
59
+
60
+ ### Pull Requests
61
+
62
+ - [#4320](https://github.com/rollup/rollup/pull/4320): Detect unfulfilled async hook actions and report error on exit (@kzc)
63
+ - [#4328](https://github.com/rollup/rollup/pull/4328): Make initial ModuleInfo.meta mutable and maintain object identity (@lukastaegert)
64
+ - [#4318](https://github.com/rollup/rollup/pull/4318): Stabilize watch tests (@lukastaegert)
65
+ - [#4331](https://github.com/rollup/rollup/pull/4331): Improve JS docs example (@lukastaegert)
66
+ - [#4332](https://github.com/rollup/rollup/pull/4332): add support for Array.prototype.findLast,findLastIndex (@dnalborczyk)
67
+ - [#4333](https://github.com/rollup/rollup/pull/4333): convert utils.transform to async function (@dnalborczyk)
68
+ - [#4335](https://github.com/rollup/rollup/pull/4335): Do not watch unless --watch is specified explicitly (@lukastaegert)
69
+ - [#4338](https://github.com/rollup/rollup/pull/4338): Add build delay for plugin event test (@lukastaegert)
70
+
71
+ ## 2.62.0
72
+
73
+ _2021-12-24_
74
+
75
+ ### Features
76
+
77
+ - Mark additional string prototype methods as side-effect-free and correct typings of existing ones (#4299)
78
+ - Mark additional array prototype methods as side-effect-free and correct typings of existing ones (#4309)
79
+ - Expose if a module is included after tree-shaking in its ModuleInfo (#4305)
80
+
81
+ ### Bug Fixes
82
+
83
+ - Fix how fsevents is included to improve watch mode on MacOS (#4312)
84
+
85
+ ### Pull Requests
86
+
87
+ - [#4299](https://github.com/rollup/rollup/pull/4299): Add additional string prototype methods (@dnalborczyk)
88
+ - [#4300](https://github.com/rollup/rollup/pull/4300): Bump deps, fix expected test result for core-js (@dnalborczyk)
89
+ - [#4302](https://github.com/rollup/rollup/pull/4302): Replace type assertion with type guard (@dnalborczyk)
90
+ - [#4304](https://github.com/rollup/rollup/pull/4304): Re-use reserved names set (@dnalborczyk)
91
+ - [#4305](https://github.com/rollup/rollup/pull/4305): Expose isIncluded in module info (@william57m)
92
+ - [#4306](https://github.com/rollup/rollup/pull/4306): Fix git line breaks on windows (@dnalborczyk)
93
+ - [#4307](https://github.com/rollup/rollup/pull/4307): Add macos to pipeline (@dnalborczyk)
94
+ - [#4309](https://github.com/rollup/rollup/pull/4309): Add additional array prototype methods (@dnalborczyk)
95
+ - [#4311](https://github.com/rollup/rollup/pull/4311): Add Deno instructions to docs (@jespertheend)
96
+ - [#4312](https://github.com/rollup/rollup/pull/4312): fsevents integration (@dnalborczyk)
97
+ - [#4313](https://github.com/rollup/rollup/pull/4313): Remove non-existing static functions from known globals (@dnalborczyk)
98
+
3
99
  ## 2.61.1
4
100
 
5
101
  _2021-12-11_
package/LICENSE.md CHANGED
@@ -583,13 +583,6 @@ Repository: git://github.com/paulmillr/readdirp.git
583
583
 
584
584
  ---------------------------------------
585
585
 
586
- ## require-relative
587
- License: MIT
588
- By: Valerio Proietti
589
- Repository: git://github.com/kamicane/require-relative.git
590
-
591
- ---------------------------------------
592
-
593
586
  ## signal-exit
594
587
  License: ISC
595
588
  By: Ben Coe
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v2.61.1
6
- Sat, 11 Dec 2021 06:17:07 GMT - commit 2e91c85fc95bc722e5a7141d7fa0acde4aab61aa
5
+ Rollup.js v2.65.0
6
+ Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
7
7
 
8
8
 
9
9
  https://github.com/rollup/rollup
@@ -17,29 +17,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
17
17
  const rollup = require('../shared/rollup.js');
18
18
  const require$$2 = require('util');
19
19
  const fs = require('fs');
20
- const path$1 = require('path');
20
+ const require$$0 = require('path');
21
21
  const mergeOptions = require('../shared/mergeOptions.js');
22
22
  const loadConfigFile_js = require('../shared/loadConfigFile.js');
23
- const require$$1 = require('module');
23
+ const process$1 = require('process');
24
+ require('perf_hooks');
24
25
  require('crypto');
25
26
  require('events');
26
27
  require('url');
27
- require('process');
28
28
  require('tty');
29
29
 
30
- function _interopNamespaceDefault(e) {
31
- const n = Object.create(null);
32
- if (e) {
33
- for (const k in e) {
34
- n[k] = e[k];
35
- }
36
- }
37
- n.default = e;
38
- return n;
39
- }
40
-
41
- const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path$1);
42
-
43
30
  const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.id <id> ID for AMD module (default is anonymous)\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--no-indent Don't indent result\n--no-interop Do not include interop block\n--inlineDynamicImports Create single bundle when using dynamic imports\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--minifyInternalExports Force or disable minification of internal exports\n--namespaceToStringTag Create proper `.toString` methods for namespaces\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--preferConst Use `const` instead of `var` for exports\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--systemNullSetters Replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--no-treeshake.moduleSideEffects Assume modules have no side-effects\n--no-treeshake.propertyReadSideEffects Ignore property access side-effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--waitForBundleInput Wait for bundle input files\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.skipWrite Do not write files to disk when watching\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--validate Validate output\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
44
31
 
45
32
  /**
@@ -1221,8 +1208,8 @@ const parser = new YargsParser({
1221
1208
  return env;
1222
1209
  },
1223
1210
  format: require$$2.format,
1224
- normalize: path$1.normalize,
1225
- resolve: path$1.resolve,
1211
+ normalize: require$$0.normalize,
1212
+ resolve: require$$0.resolve,
1226
1213
  // TODO: figure out a way to combine ESM and CJS coverage, such that
1227
1214
  // we can exercise all the lines below:
1228
1215
  require: (path) => {
@@ -1394,10 +1381,6 @@ var prettyMs = (milliseconds, options = {}) => {
1394
1381
 
1395
1382
  const ms = prettyMs;
1396
1383
 
1397
- let SOURCEMAPPING_URL = 'sourceMa';
1398
- SOURCEMAPPING_URL += 'ppingURL';
1399
- const SOURCEMAPPING_URL$1 = SOURCEMAPPING_URL;
1400
-
1401
1384
  const BYTE_UNITS = [
1402
1385
  'B',
1403
1386
  'kB',
@@ -1562,7 +1545,7 @@ async function build(inputOptions, warnings, silent = false) {
1562
1545
  else {
1563
1546
  source = file.code;
1564
1547
  if (output.sourcemap === 'inline') {
1565
- source += `\n//# ${SOURCEMAPPING_URL$1}=${file.map.toUrl()}\n`;
1548
+ source += `\n//# ${rollup.SOURCEMAPPING_URL}=${file.map.toUrl()}\n`;
1566
1549
  }
1567
1550
  }
1568
1551
  if (outputs.length > 1)
@@ -1585,56 +1568,19 @@ async function build(inputOptions, warnings, silent = false) {
1585
1568
  }
1586
1569
  }
1587
1570
 
1588
- /*
1589
- relative require
1590
- */
1591
-
1592
- var path = path$1;
1593
- var Module = require$$1;
1594
-
1595
- var modules = {};
1596
-
1597
- var getModule = function(dir) {
1598
- var rootPath = dir ? path.resolve(dir) : process.cwd();
1599
- var rootName = path.join(rootPath, '@root');
1600
- var root = modules[rootName];
1601
- if (!root) {
1602
- root = new Module(rootName);
1603
- root.filename = rootName;
1604
- root.paths = Module._nodeModulePaths(rootPath);
1605
- modules[rootName] = root;
1606
- }
1607
- return root;
1608
- };
1609
-
1610
- var requireRelative = function(requested, relativeTo) {
1611
- var root = getModule(relativeTo);
1612
- return root.require(requested);
1613
- };
1614
-
1615
- requireRelative.resolve = function(requested, relativeTo) {
1616
- var root = getModule(relativeTo);
1617
- return Module._resolveFilename(requested, root);
1618
- };
1619
-
1620
- var requireRelative_1 = requireRelative;
1621
-
1622
- const relative = requireRelative_1;
1623
-
1624
1571
  const DEFAULT_CONFIG_BASE = 'rollup.config';
1625
1572
  function getConfigPath(commandConfig) {
1626
- const cwd = process.cwd();
1627
1573
  if (commandConfig === true) {
1628
- return path__namespace.resolve(findConfigFileNameInCwd());
1574
+ return require$$0.resolve(findConfigFileNameInCwd());
1629
1575
  }
1630
1576
  if (commandConfig.slice(0, 5) === 'node:') {
1631
1577
  const pkgName = commandConfig.slice(5);
1632
1578
  try {
1633
- return relative.resolve(`rollup-config-${pkgName}`, cwd);
1579
+ return require.resolve(`rollup-config-${pkgName}`, { paths: [process$1.cwd()] });
1634
1580
  }
1635
1581
  catch (_a) {
1636
1582
  try {
1637
- return relative.resolve(pkgName, cwd);
1583
+ return require.resolve(pkgName, { paths: [process$1.cwd()] });
1638
1584
  }
1639
1585
  catch (err) {
1640
1586
  if (err.code === 'MODULE_NOT_FOUND') {
@@ -1647,10 +1593,10 @@ function getConfigPath(commandConfig) {
1647
1593
  }
1648
1594
  }
1649
1595
  }
1650
- return path__namespace.resolve(commandConfig);
1596
+ return require$$0.resolve(commandConfig);
1651
1597
  }
1652
1598
  function findConfigFileNameInCwd() {
1653
- const filesInWorkingDir = new Set(fs.readdirSync(process.cwd()));
1599
+ const filesInWorkingDir = new Set(fs.readdirSync(process$1.cwd()));
1654
1600
  for (const extension of ['mjs', 'cjs', 'ts']) {
1655
1601
  const fileName = `${DEFAULT_CONFIG_BASE}.${extension}`;
1656
1602
  if (filesInWorkingDir.has(fileName))
@@ -1718,7 +1664,7 @@ async function runRollup(command) {
1718
1664
  });
1719
1665
  });
1720
1666
  }
1721
- if (command.watch) {
1667
+ if (mergeOptions.isWatchEnabled(command.watch)) {
1722
1668
  await rollup.loadFsEvents();
1723
1669
  const { watch } = await Promise.resolve().then(() => require('../shared/watch-cli.js'));
1724
1670
  watch(command);