rollup 2.62.0 → 2.66.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,12 +1,93 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 2.66.0
4
+
5
+ _2022-01-22_
6
+
7
+ ### Features
8
+
9
+ - Note if a module has a default export in ModuleInfo to allow writing better proxy modules (#4356)
10
+ - Add option to wait until all imported ids have been resolved when awaiting `this.load` (#4358)
11
+
12
+ ### Pull Requests
13
+
14
+ - [#4356](https://github.com/rollup/rollup/pull/4356): Add hasDefaultExport to ModuleInfo (@lukastaegert)
15
+ - [#4358](https://github.com/rollup/rollup/pull/4358): Add "resolveDependencies" option to "this.load" (@lukastaegert)
16
+
17
+ ## 2.65.0
18
+
19
+ _2022-01-21_
20
+
21
+ ### Features
22
+
23
+ - Add complete import resolution objects to ModuleInfo for use in `this.load` (#4354)
24
+
25
+ ### Bug Fixes
26
+
27
+ - Use correct context in plugin hooks with `perf: true` (#4357)
28
+
29
+ ### Pull Requests
30
+
31
+ - [#4351](https://github.com/rollup/rollup/pull/4351): refactor: re-use source mapping url (@dnalborczyk)
32
+ - [#4352](https://github.com/rollup/rollup/pull/4352): refactor: replace require-relative with built-in require.resolve (@dnalborczyk)
33
+ - [#4353](https://github.com/rollup/rollup/pull/4353): chore: bump deps (@dnalborczyk)
34
+ - [#4354](https://github.com/rollup/rollup/pull/4354): Add importedIdResolutions to moduleInfo (@lukastaegert)
35
+ - [#4355](https://github.com/rollup/rollup/pull/4355): chore: remove external from config (@dnalborczyk)
36
+ - [#4357](https://github.com/rollup/rollup/pull/4357): fix: timed plugin context (@dnalborczyk)
37
+
38
+ ## 2.64.0
39
+
40
+ _2022-01-14_
41
+
42
+ ### Features
43
+
44
+ - Allow inspecting cached modules and forcing them to be transformed again via shouldTransformCachedModule (#4320)
45
+ - Do not wait for the config file to be parsed in watch mode if it is updated before that (#4344)
46
+
47
+ ### Bug Fixes
48
+
49
+ - Do not mutate objects returned as `meta` from the resolveId hook (#4347)
50
+
51
+ ### Pull Requests
52
+
53
+ - [#4326](https://github.com/rollup/rollup/pull/4326): refactor: type fixes (@dnalborczyk)
54
+ - [#4339](https://github.com/rollup/rollup/pull/4339): More watch test stabilization (@lukastaegert)
55
+ - [#4340](https://github.com/rollup/rollup/pull/4340): refactor: performance timers for node.js and browser (@dnalborczyk)
56
+ - [#4341](https://github.com/rollup/rollup/pull/4341): Implement shouldTransformCachedModule hook (@lukastaegert)
57
+ - [#4344](https://github.com/rollup/rollup/pull/4344): Directly restart Rollup when config file change is detected in watch mode (@lukastaegert)
58
+ - [#4347](https://github.com/rollup/rollup/pull/4347): Create a shallow copy when returning meta from resolveId (@lukastaegert)
59
+
60
+ ## 2.63.0
61
+
62
+ _2022-01-04_
63
+
64
+ ### Features
65
+
66
+ - Report a helpful error if rollup exits due to an empty event loop when using `this.load` (#4320)
67
+ - Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328)
68
+ - Detect additional side effect free array prototype methods (#4332)
69
+
70
+ ### Bug Fixes
71
+
72
+ - Do not watch if CLI watch options are specified but `--watch` is missing (#4335)
73
+
74
+ ### Pull Requests
75
+
76
+ - [#4320](https://github.com/rollup/rollup/pull/4320): Detect unfulfilled async hook actions and report error on exit (@kzc)
77
+ - [#4328](https://github.com/rollup/rollup/pull/4328): Make initial ModuleInfo.meta mutable and maintain object identity (@lukastaegert)
78
+ - [#4318](https://github.com/rollup/rollup/pull/4318): Stabilize watch tests (@lukastaegert)
79
+ - [#4331](https://github.com/rollup/rollup/pull/4331): Improve JS docs example (@lukastaegert)
80
+ - [#4332](https://github.com/rollup/rollup/pull/4332): add support for Array.prototype.findLast,findLastIndex (@dnalborczyk)
81
+ - [#4333](https://github.com/rollup/rollup/pull/4333): convert utils.transform to async function (@dnalborczyk)
82
+ - [#4335](https://github.com/rollup/rollup/pull/4335): Do not watch unless --watch is specified explicitly (@lukastaegert)
83
+ - [#4338](https://github.com/rollup/rollup/pull/4338): Add build delay for plugin event test (@lukastaegert)
84
+
3
85
  ## 2.62.0
4
86
 
5
87
  _2021-12-24_
6
88
 
7
89
  ### Features
8
90
 
9
- - Only resolve this.load once the code of the module is available (#4296)
10
91
  - Mark additional string prototype methods as side-effect-free and correct typings of existing ones (#4299)
11
92
  - Mark additional array prototype methods as side-effect-free and correct typings of existing ones (#4309)
12
93
  - Expose if a module is included after tree-shaking in its ModuleInfo (#4305)
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.62.0
6
- Fri, 24 Dec 2021 06:27:02 GMT - commit 81ce56f87de5fae51c00c4a0a977830ee93c5987
5
+ Rollup.js v2.66.0
6
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
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);