rollup 2.60.2 → 2.63.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/dist/rollup.d.ts CHANGED
@@ -169,6 +169,7 @@ interface ModuleInfo {
169
169
  importers: readonly string[];
170
170
  isEntry: boolean;
171
171
  isExternal: boolean;
172
+ isIncluded: boolean | null;
172
173
  meta: CustomPluginOptions;
173
174
  syntheticNamedExports: boolean | string;
174
175
  }
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.60.2
4
- Tue, 30 Nov 2021 05:36:58 GMT - commit 7c9b89fade00a4eb8ea39c6b15ef7d0e6e5739be
3
+ Rollup.js v2.63.0
4
+ Tue, 04 Jan 2022 07:30:25 GMT - commit ae674c9edde5efb8ce6d8ef845598a805938178c
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.60.2
4
- Tue, 30 Nov 2021 05:36:58 GMT - commit 7c9b89fade00a4eb8ea39c6b15ef7d0e6e5739be
3
+ Rollup.js v2.63.0
4
+ Tue, 04 Jan 2022 07:30:25 GMT - commit ae674c9edde5efb8ce6d8ef845598a805938178c
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.60.2
4
- Tue, 30 Nov 2021 05:36:58 GMT - commit 7c9b89fade00a4eb8ea39c6b15ef7d0e6e5739be
3
+ Rollup.js v2.63.0
4
+ Tue, 04 Jan 2022 07:30:25 GMT - commit ae674c9edde5efb8ce6d8ef845598a805938178c
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -13,6 +13,7 @@
13
13
  const fs = require('fs');
14
14
  const path = require('path');
15
15
  const url = require('url');
16
+ const process$1 = require('process');
16
17
  const tty = require('tty');
17
18
  const rollup = require('./rollup.js');
18
19
  const mergeOptions = require('./mergeOptions.js');
@@ -32,58 +33,116 @@ const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
32
33
  const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
33
34
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
34
35
 
35
- const env = process.env;
36
+ const env = process.env || {};
37
+ const argv = process.argv || [];
36
38
 
37
- const isDisabled = "NO_COLOR" in env;
38
- const isForced = "FORCE_COLOR" in env;
39
+ const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
40
+ const isForced = "FORCE_COLOR" in env || argv.includes("--color");
39
41
  const isWindows = process.platform === "win32";
40
42
 
41
43
  const isCompatibleTerminal =
42
- tty__namespace && tty__namespace.isatty(1) && env.TERM && env.TERM !== "dumb";
44
+ tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && env.TERM !== "dumb";
43
45
 
44
46
  const isCI =
45
47
  "CI" in env &&
46
48
  ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
47
49
 
48
- let enabled =
50
+ const isColorSupported =
49
51
  !isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI);
50
52
 
51
- const raw = (open, close, searchRegex, replaceValue) => (s) =>
52
- enabled
53
- ? open +
54
- (~(s += "").indexOf(close, 4) // skip opening \x1b[
55
- ? s.replace(searchRegex, replaceValue)
56
- : s) +
57
- close
58
- : s;
53
+ const replaceClose = (
54
+ index,
55
+ string,
56
+ close,
57
+ replace,
58
+ head = string.substring(0, index) + replace,
59
+ tail = string.substring(index + close.length),
60
+ next = tail.indexOf(close)
61
+ ) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
59
62
 
60
- const init = (open, close) => {
61
- return raw(
62
- `\x1b[${open}m`,
63
- `\x1b[${close}m`,
64
- new RegExp(`\\x1b\\[${close}m`, "g"),
65
- `\x1b[${open}m`
66
- )
63
+ const clearBleed = (index, string, open, close, replace) =>
64
+ index < 0
65
+ ? open + string + close
66
+ : open + replaceClose(index, string, close, replace) + close;
67
+
68
+ const filterEmpty =
69
+ (open, close, replace = open, at = open.length + 1) =>
70
+ (string) =>
71
+ string || !(string === "" || string === undefined)
72
+ ? clearBleed(
73
+ ("" + string).indexOf(close, at),
74
+ string,
75
+ open,
76
+ close,
77
+ replace
78
+ )
79
+ : "";
80
+
81
+ const init = (open, close, replace) =>
82
+ filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
83
+
84
+ const colors = {
85
+ reset: init(0, 0),
86
+ bold: init(1, 22, "\x1b[22m\x1b[1m"),
87
+ dim: init(2, 22, "\x1b[22m\x1b[2m"),
88
+ italic: init(3, 23),
89
+ underline: init(4, 24),
90
+ inverse: init(7, 27),
91
+ hidden: init(8, 28),
92
+ strikethrough: init(9, 29),
93
+ black: init(30, 39),
94
+ red: init(31, 39),
95
+ green: init(32, 39),
96
+ yellow: init(33, 39),
97
+ blue: init(34, 39),
98
+ magenta: init(35, 39),
99
+ cyan: init(36, 39),
100
+ white: init(37, 39),
101
+ gray: init(90, 39),
102
+ bgBlack: init(40, 49),
103
+ bgRed: init(41, 49),
104
+ bgGreen: init(42, 49),
105
+ bgYellow: init(43, 49),
106
+ bgBlue: init(44, 49),
107
+ bgMagenta: init(45, 49),
108
+ bgCyan: init(46, 49),
109
+ bgWhite: init(47, 49),
110
+ blackBright: init(90, 39),
111
+ redBright: init(91, 39),
112
+ greenBright: init(92, 39),
113
+ yellowBright: init(93, 39),
114
+ blueBright: init(94, 39),
115
+ magentaBright: init(95, 39),
116
+ cyanBright: init(96, 39),
117
+ whiteBright: init(97, 39),
118
+ bgBlackBright: init(100, 49),
119
+ bgRedBright: init(101, 49),
120
+ bgGreenBright: init(102, 49),
121
+ bgYellowBright: init(103, 49),
122
+ bgBlueBright: init(104, 49),
123
+ bgMagentaBright: init(105, 49),
124
+ bgCyanBright: init(106, 49),
125
+ bgWhiteBright: init(107, 49),
67
126
  };
68
127
 
69
- const options = Object.defineProperty({}, "enabled", {
70
- get: () => enabled,
71
- set: (value) => (enabled = value),
72
- });
73
- const bold = raw("\x1b[1m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[1m");
74
- const dim = raw("\x1b[2m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[2m");
75
- const underline = init(4, 24);
76
- const red = init(31, 39);
77
- const green = init(32, 39);
78
- const yellow = init(33, 39);
79
- const cyan = init(36, 39);
80
- const gray = init(90, 39);
128
+ const none = (any) => any;
129
+
130
+ const createColors = ({ useColor = isColorSupported } = {}) =>
131
+ useColor
132
+ ? colors
133
+ : Object.keys(colors).reduce(
134
+ (colors, key) => ({ ...colors, [key]: none }),
135
+ {}
136
+ );
137
+
138
+ createColors();
81
139
 
82
140
  // @see https://no-color.org
83
141
  // @see https://www.npmjs.com/package/chalk
84
- if (process.env.FORCE_COLOR === '0' || process.env.NO_COLOR) {
85
- options.enabled = false;
86
- }
142
+ const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
143
+ useColor: process$1.env.FORCE_COLOR !== '0' && !process$1.env.NO_COLOR
144
+ });
145
+
87
146
  // log to stderr to keep `rollup main.js > bundle.js` from breaking
88
147
  const stderr = console.error.bind(console);
89
148
  function handleError(err, recover = false) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.60.2
4
- Tue, 30 Nov 2021 05:36:58 GMT - commit 7c9b89fade00a4eb8ea39c6b15ef7d0e6e5739be
3
+ Rollup.js v2.63.0
4
+ Tue, 04 Jan 2022 07:30:25 GMT - commit ae674c9edde5efb8ce6d8ef845598a805938178c
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -85,7 +85,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
85
85
  shimMissingExports: getOption('shimMissingExports'),
86
86
  strictDeprecations: getOption('strictDeprecations'),
87
87
  treeshake: getObjectOption(config, overrides, 'treeshake', rollup.objectifyOptionWithPresets(rollup.treeshakePresets, 'treeshake', 'false, true, ')),
88
- watch: getWatch(config, overrides, 'watch')
88
+ watch: getWatch(config, overrides)
89
89
  };
90
90
  rollup.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
91
91
  return inputOptions;
@@ -99,7 +99,7 @@ const getExternal = (config, overrides) => {
99
99
  const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
100
100
  ? warning => config.onwarn(warning, defaultOnWarnHandler)
101
101
  : defaultOnWarnHandler;
102
- const getObjectOption = (config, overrides, name, objectifyValue = value => (typeof value === 'object' ? value : {})) => {
102
+ const getObjectOption = (config, overrides, name, objectifyValue = rollup.objectifyOption) => {
103
103
  const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
104
104
  const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
105
105
  if (commandOption !== undefined) {
@@ -107,7 +107,13 @@ const getObjectOption = (config, overrides, name, objectifyValue = value => (typ
107
107
  }
108
108
  return configOption;
109
109
  };
110
- const getWatch = (config, overrides, name) => config.watch !== false && getObjectOption(config, overrides, name);
110
+ const getWatch = (config, overrides) => config.watch !== false && getObjectOption(config, overrides, 'watch');
111
+ const isWatchEnabled = (optionValue) => {
112
+ if (Array.isArray(optionValue)) {
113
+ return optionValue.reduce((result, value) => (typeof value === 'boolean' ? value : result), false);
114
+ }
115
+ return optionValue === true;
116
+ };
111
117
  const normalizeObjectOptionValue = (optionValue, objectifyValue) => {
112
118
  if (!optionValue) {
113
119
  return optionValue;
@@ -168,5 +174,6 @@ function mergeOutputOptions(config, overrides, warn) {
168
174
  }
169
175
 
170
176
  exports.commandAliases = commandAliases;
177
+ exports.isWatchEnabled = isWatchEnabled;
171
178
  exports.mergeOptions = mergeOptions;
172
179
  //# sourceMappingURL=mergeOptions.js.map