rollup 1.15.5 → 1.16.2
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 +43 -0
- package/bin/rollup +16 -157
- package/dist/rollup.browser.es.js +3 -3
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.es.js +265 -162
- package/dist/rollup.js +265 -162
- package/package.json +7 -8
package/dist/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v1.
|
|
4
|
-
|
|
3
|
+
Rollup.js v1.16.2
|
|
4
|
+
Sat, 22 Jun 2019 08:26:33 GMT - commit 3ed6c52c86a1545385f172e86bdb373e59a15a3c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -23,7 +23,7 @@ var acorn__default = _interopDefault(acorn);
|
|
|
23
23
|
var events = require('events');
|
|
24
24
|
var module$1 = _interopDefault(require('module'));
|
|
25
25
|
|
|
26
|
-
var version = "1.
|
|
26
|
+
var version = "1.16.2";
|
|
27
27
|
|
|
28
28
|
var minimalisticAssert = assert;
|
|
29
29
|
function assert(val, msg) {
|
|
@@ -2647,10 +2647,12 @@ class ExternalModule {
|
|
|
2647
2647
|
this.exportedVariables = new Map();
|
|
2648
2648
|
}
|
|
2649
2649
|
getVariableForExportName(name, _isExportAllSearch) {
|
|
2650
|
-
if (name
|
|
2651
|
-
this.exportsNames = true;
|
|
2652
|
-
if (name === '*')
|
|
2650
|
+
if (name === '*') {
|
|
2653
2651
|
this.exportsNamespace = true;
|
|
2652
|
+
}
|
|
2653
|
+
else if (name !== 'default') {
|
|
2654
|
+
this.exportsNames = true;
|
|
2655
|
+
}
|
|
2654
2656
|
let declaration = this.declarations[name];
|
|
2655
2657
|
if (declaration)
|
|
2656
2658
|
return declaration;
|
|
@@ -8705,6 +8707,7 @@ ExportDefaultVariable.prototype.getBaseVariableName = ExportDefaultVariable.prot
|
|
|
8705
8707
|
|
|
8706
8708
|
const MISSING_EXPORT_SHIM_VARIABLE = '_missingExportShim';
|
|
8707
8709
|
const INTEROP_DEFAULT_VARIABLE = '_interopDefault';
|
|
8710
|
+
const INTEROP_NAMESPACE_VARIABLE = '_interopNamespace';
|
|
8708
8711
|
|
|
8709
8712
|
class ExportShimVariable extends Variable {
|
|
8710
8713
|
constructor(module) {
|
|
@@ -8982,11 +8985,11 @@ function getExportBlock(exports, dependencies, namedExportsMode, interop, compac
|
|
|
8982
8985
|
if (!compact && exportBlock)
|
|
8983
8986
|
exportBlock += '\n';
|
|
8984
8987
|
exportBlock +=
|
|
8985
|
-
`Object.keys(${name}).forEach(function${_}(
|
|
8986
|
-
`${t}Object.defineProperty(exports,${_}
|
|
8988
|
+
`Object.keys(${name}).forEach(function${_}(k)${_}{${n}` +
|
|
8989
|
+
`${t}if${_}(k${_}!==${_}'default')${_}Object.defineProperty(exports,${_}k,${_}{${n}` +
|
|
8987
8990
|
`${t}${t}enumerable:${_}true,${n}` +
|
|
8988
8991
|
`${t}${t}get:${_}function${_}()${_}{${n}` +
|
|
8989
|
-
`${t}${t}${t}return ${name}[
|
|
8992
|
+
`${t}${t}${t}return ${name}[k];${n}` +
|
|
8990
8993
|
`${t}${t}}${n}${t}});${n}});`;
|
|
8991
8994
|
}
|
|
8992
8995
|
});
|
|
@@ -9062,6 +9065,27 @@ function getInteropBlock(dependencies, options, varOrConst) {
|
|
|
9062
9065
|
.join(options.compact ? '' : '\n');
|
|
9063
9066
|
}
|
|
9064
9067
|
|
|
9068
|
+
function getInteropNamespace(_, n, t) {
|
|
9069
|
+
return `function ${INTEROP_NAMESPACE_VARIABLE}(e)${_}{${n}` +
|
|
9070
|
+
`${t}if${_}(e${_}&&${_}e.__esModule)${_}{${_}return e;${_}}${_}else${_}{${n}` +
|
|
9071
|
+
`${t}${t}var n${_}=${_}{};${n}` +
|
|
9072
|
+
`${t}${t}if${_}(e)${_}{${n}` +
|
|
9073
|
+
`${t}${t}${t}Object.keys(e).forEach(function${_}(k)${_}{${n}` +
|
|
9074
|
+
`${t}${t}${t}${t}var d${_}=${_}Object.getOwnPropertyDescriptor(e,${_}k);${n}` +
|
|
9075
|
+
`${t}${t}${t}${t}Object.defineProperty(n,${_}k,${_}d.get${_}?${_}d${_}:${_}{${n}` +
|
|
9076
|
+
`${t}${t}${t}${t}${t}enumerable:${_}true,${n}` +
|
|
9077
|
+
`${t}${t}${t}${t}${t}get:${_}function${_}()${_}{${n}` +
|
|
9078
|
+
`${t}${t}${t}${t}${t}${t}return e[k];${n}` +
|
|
9079
|
+
`${t}${t}${t}${t}${t}}${n}` +
|
|
9080
|
+
`${t}${t}${t}${t}});${n}` +
|
|
9081
|
+
`${t}${t}${t}});${n}` +
|
|
9082
|
+
`${t}${t}}${n}` +
|
|
9083
|
+
`${t}${t}n['default']${_}=${_}e;${n}` +
|
|
9084
|
+
`${t}${t}return n;${n}` +
|
|
9085
|
+
`${t}}${n}` +
|
|
9086
|
+
`}${n}${n}`;
|
|
9087
|
+
}
|
|
9088
|
+
|
|
9065
9089
|
const builtins$1 = {
|
|
9066
9090
|
assert: true,
|
|
9067
9091
|
buffer: true,
|
|
@@ -9138,8 +9162,12 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
9138
9162
|
const wrapperStart = `${define}(${params}function${_}(${args.join(`,${_}`)})${_}{${useStrict}${n}${n}`;
|
|
9139
9163
|
// var foo__default = 'default' in foo ? foo['default'] : foo;
|
|
9140
9164
|
const interopBlock = getInteropBlock(dependencies, options, varOrConst);
|
|
9141
|
-
if (interopBlock)
|
|
9165
|
+
if (interopBlock) {
|
|
9142
9166
|
magicString.prepend(interopBlock + n + n);
|
|
9167
|
+
}
|
|
9168
|
+
if (accessedGlobals.has(INTEROP_NAMESPACE_VARIABLE)) {
|
|
9169
|
+
magicString.prepend(getInteropNamespace(_, n, t));
|
|
9170
|
+
}
|
|
9143
9171
|
if (intro)
|
|
9144
9172
|
magicString.prepend(intro);
|
|
9145
9173
|
const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, options.interop, options.compact, t);
|
|
@@ -9155,7 +9183,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
9155
9183
|
.prepend(wrapperStart);
|
|
9156
9184
|
}
|
|
9157
9185
|
|
|
9158
|
-
function cjs(magicString, { dependencies, exports, hasExports, indentString: t, intro, isEntryModuleFacade, namedExportsMode, outro, varOrConst }, options) {
|
|
9186
|
+
function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports, indentString: t, intro, isEntryModuleFacade, namedExportsMode, outro, varOrConst }, options) {
|
|
9159
9187
|
const n = options.compact ? '' : '\n';
|
|
9160
9188
|
const _ = options.compact ? '' : ' ';
|
|
9161
9189
|
intro =
|
|
@@ -9201,6 +9229,9 @@ function cjs(magicString, { dependencies, exports, hasExports, indentString: t,
|
|
|
9201
9229
|
`(${ex}${_}&&${_}(typeof ${ex}${_}===${_}'object')${_}&&${_}'default'${_}in ${ex})${_}` +
|
|
9202
9230
|
`?${_}${ex}['default']${_}:${_}${ex}${options.compact ? '' : '; '}}${n}${n}`;
|
|
9203
9231
|
}
|
|
9232
|
+
if (accessedGlobals.has(INTEROP_NAMESPACE_VARIABLE)) {
|
|
9233
|
+
intro += getInteropNamespace(_, n, t);
|
|
9234
|
+
}
|
|
9204
9235
|
if (importBlock)
|
|
9205
9236
|
intro += importBlock + n + n;
|
|
9206
9237
|
const exportBlock = getExportBlock(exports, dependencies, namedExportsMode, options.interop, options.compact, t, `module.exports${_}=${_}`);
|
|
@@ -9391,6 +9422,7 @@ var Errors;
|
|
|
9391
9422
|
Errors["BAD_LOADER"] = "BAD_LOADER";
|
|
9392
9423
|
Errors["CHUNK_NOT_FOUND"] = "CHUNK_NOT_FOUND";
|
|
9393
9424
|
Errors["CHUNK_NOT_GENERATED"] = "CHUNK_NOT_GENERATED";
|
|
9425
|
+
Errors["DEPRECATED_FEATURE"] = "DEPRECATED_FEATURE";
|
|
9394
9426
|
Errors["INVALID_ASSET_NAME"] = "INVALID_ASSET_NAME";
|
|
9395
9427
|
Errors["INVALID_CHUNK"] = "INVALID_CHUNK";
|
|
9396
9428
|
Errors["INVALID_EXTERNAL_ID"] = "INVALID_EXTERNAL_ID";
|
|
@@ -9455,6 +9487,9 @@ function errChunkReferenceIdNotFoundForFilename(chunkReferenceId) {
|
|
|
9455
9487
|
message: `Plugin error - Unable to get file name for unknown chunk "${chunkReferenceId}".`
|
|
9456
9488
|
};
|
|
9457
9489
|
}
|
|
9490
|
+
function errDeprecation(deprecation) {
|
|
9491
|
+
return Object.assign({ code: Errors.DEPRECATED_FEATURE }, (typeof deprecation === 'string' ? { message: deprecation } : deprecation));
|
|
9492
|
+
}
|
|
9458
9493
|
function errInvalidAssetName(name) {
|
|
9459
9494
|
return {
|
|
9460
9495
|
code: Errors.INVALID_ASSET_NAME,
|
|
@@ -10639,8 +10674,15 @@ class ConditionalExpression extends NodeBase {
|
|
|
10639
10674
|
}
|
|
10640
10675
|
render(code, options, { renderedParentType, isCalleeOfRenderedParent } = BLANK) {
|
|
10641
10676
|
if (!this.test.included) {
|
|
10642
|
-
code.
|
|
10643
|
-
|
|
10677
|
+
const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
|
|
10678
|
+
if (this.consequent.included) {
|
|
10679
|
+
const questionmarkPos = findFirstOccurrenceOutsideComment(code.original, '?', this.test.end);
|
|
10680
|
+
code.remove(this.start, questionmarkPos + 1);
|
|
10681
|
+
code.remove(colonPos, this.end);
|
|
10682
|
+
}
|
|
10683
|
+
else {
|
|
10684
|
+
code.remove(this.start, colonPos + 1);
|
|
10685
|
+
}
|
|
10644
10686
|
removeAnnotations(this, code);
|
|
10645
10687
|
this.usedBranch.render(code, options, {
|
|
10646
10688
|
isCalleeOfRenderedParent: renderedParentType
|
|
@@ -10892,75 +10934,31 @@ class IfStatement extends NodeBase {
|
|
|
10892
10934
|
}
|
|
10893
10935
|
}
|
|
10894
10936
|
|
|
10895
|
-
const getDynamicImportMechanism = (options) => {
|
|
10896
|
-
switch (options.format) {
|
|
10897
|
-
case 'cjs': {
|
|
10898
|
-
const _ = options.compact ? '' : ' ';
|
|
10899
|
-
return {
|
|
10900
|
-
interopLeft: `Promise.resolve({${_}default:${_}require(`,
|
|
10901
|
-
interopRight: `)${_}})`,
|
|
10902
|
-
left: 'Promise.resolve(require(',
|
|
10903
|
-
right: '))'
|
|
10904
|
-
};
|
|
10905
|
-
}
|
|
10906
|
-
case 'amd': {
|
|
10907
|
-
const _ = options.compact ? '' : ' ';
|
|
10908
|
-
const resolve = options.compact ? 'c' : 'resolve';
|
|
10909
|
-
const reject = options.compact ? 'e' : 'reject';
|
|
10910
|
-
return {
|
|
10911
|
-
interopLeft: `new Promise(function${_}(${resolve},${_}${reject})${_}{${_}require([`,
|
|
10912
|
-
interopRight: `],${_}function${_}(m)${_}{${_}${resolve}({${_}default:${_}m${_}})${_}},${_}${reject})${_}})`,
|
|
10913
|
-
left: `new Promise(function${_}(${resolve},${_}${reject})${_}{${_}require([`,
|
|
10914
|
-
right: `],${_}${resolve},${_}${reject})${_}})`
|
|
10915
|
-
};
|
|
10916
|
-
}
|
|
10917
|
-
case 'system':
|
|
10918
|
-
return {
|
|
10919
|
-
left: 'module.import(',
|
|
10920
|
-
right: ')'
|
|
10921
|
-
};
|
|
10922
|
-
case 'es':
|
|
10923
|
-
return {
|
|
10924
|
-
left: `${options.dynamicImportFunction || 'import'}(`,
|
|
10925
|
-
right: ')'
|
|
10926
|
-
};
|
|
10927
|
-
}
|
|
10928
|
-
return undefined;
|
|
10929
|
-
};
|
|
10930
|
-
const accessedImportGlobals = {
|
|
10931
|
-
amd: ['require'],
|
|
10932
|
-
cjs: ['require'],
|
|
10933
|
-
system: ['module']
|
|
10934
|
-
};
|
|
10935
10937
|
class Import extends NodeBase {
|
|
10936
10938
|
constructor() {
|
|
10937
10939
|
super(...arguments);
|
|
10938
|
-
this.
|
|
10940
|
+
this.exportMode = 'auto';
|
|
10939
10941
|
}
|
|
10940
10942
|
include() {
|
|
10941
10943
|
if (!this.included) {
|
|
10942
10944
|
this.included = true;
|
|
10943
10945
|
this.context.includeDynamicImport(this);
|
|
10944
|
-
this.scope.addAccessedGlobalsByFormat(accessedImportGlobals);
|
|
10945
10946
|
}
|
|
10946
10947
|
}
|
|
10947
10948
|
initialise() {
|
|
10948
10949
|
this.context.addDynamicImport(this);
|
|
10949
10950
|
}
|
|
10950
10951
|
render(code, options) {
|
|
10951
|
-
if (this.
|
|
10952
|
+
if (this.inlineNamespace) {
|
|
10952
10953
|
const _ = options.compact ? '' : ' ';
|
|
10953
10954
|
const s = options.compact ? '' : ';';
|
|
10954
|
-
code.overwrite(this.parent.start, this.parent.end, `Promise.resolve().then(function${_}()${_}{${_}return ${this.
|
|
10955
|
+
code.overwrite(this.parent.start, this.parent.end, `Promise.resolve().then(function${_}()${_}{${_}return ${this.inlineNamespace.getName()}${s}${_}})`);
|
|
10955
10956
|
return;
|
|
10956
10957
|
}
|
|
10957
|
-
const importMechanism = getDynamicImportMechanism(options);
|
|
10958
|
+
const importMechanism = this.getDynamicImportMechanism(options);
|
|
10958
10959
|
if (importMechanism) {
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
code.overwrite(this.parent.start, leftMechanismEnd, leftMechanism);
|
|
10962
|
-
const rightMechanism = (this.resolutionInterop && importMechanism.interopRight) || importMechanism.right;
|
|
10963
|
-
code.overwrite(this.parent.end - 1, this.parent.end, rightMechanism);
|
|
10960
|
+
code.overwrite(this.parent.start, findFirstOccurrenceOutsideComment(code.original, '(', this.parent.callee.end) + 1, importMechanism.left);
|
|
10961
|
+
code.overwrite(this.parent.end - 1, this.parent.end, importMechanism.right);
|
|
10964
10962
|
}
|
|
10965
10963
|
}
|
|
10966
10964
|
renderFinalResolution(code, resolution, format) {
|
|
@@ -10971,9 +10969,76 @@ class Import extends NodeBase {
|
|
|
10971
10969
|
code.overwrite(this.parent.arguments[0].start, this.parent.arguments[0].end, resolution);
|
|
10972
10970
|
}
|
|
10973
10971
|
}
|
|
10974
|
-
setResolution(
|
|
10975
|
-
this.
|
|
10976
|
-
|
|
10972
|
+
setResolution(exportMode, inlineNamespace) {
|
|
10973
|
+
this.exportMode = exportMode;
|
|
10974
|
+
if (inlineNamespace) {
|
|
10975
|
+
this.inlineNamespace = inlineNamespace;
|
|
10976
|
+
}
|
|
10977
|
+
else {
|
|
10978
|
+
this.scope.addAccessedGlobalsByFormat({
|
|
10979
|
+
amd: ['require'],
|
|
10980
|
+
cjs: ['require'],
|
|
10981
|
+
system: ['module']
|
|
10982
|
+
});
|
|
10983
|
+
if (exportMode === 'auto') {
|
|
10984
|
+
this.scope.addAccessedGlobalsByFormat({
|
|
10985
|
+
amd: [INTEROP_NAMESPACE_VARIABLE],
|
|
10986
|
+
cjs: [INTEROP_NAMESPACE_VARIABLE]
|
|
10987
|
+
});
|
|
10988
|
+
}
|
|
10989
|
+
}
|
|
10990
|
+
}
|
|
10991
|
+
getDynamicImportMechanism(options) {
|
|
10992
|
+
switch (options.format) {
|
|
10993
|
+
case 'cjs': {
|
|
10994
|
+
const _ = options.compact ? '' : ' ';
|
|
10995
|
+
const resolve = options.compact ? 'c' : 'resolve';
|
|
10996
|
+
switch (this.exportMode) {
|
|
10997
|
+
case 'default':
|
|
10998
|
+
return {
|
|
10999
|
+
left: `new Promise(function${_}(${resolve})${_}{${_}${resolve}({${_}'default':${_}require(`,
|
|
11000
|
+
right: `)${_}});${_}})`
|
|
11001
|
+
};
|
|
11002
|
+
case 'auto':
|
|
11003
|
+
return {
|
|
11004
|
+
left: `new Promise(function${_}(${resolve})${_}{${_}${resolve}(${INTEROP_NAMESPACE_VARIABLE}(require(`,
|
|
11005
|
+
right: `)));${_}})`
|
|
11006
|
+
};
|
|
11007
|
+
default:
|
|
11008
|
+
return {
|
|
11009
|
+
left: `new Promise(function${_}(${resolve})${_}{${_}${resolve}(require(`,
|
|
11010
|
+
right: `));${_}})`
|
|
11011
|
+
};
|
|
11012
|
+
}
|
|
11013
|
+
}
|
|
11014
|
+
case 'amd': {
|
|
11015
|
+
const _ = options.compact ? '' : ' ';
|
|
11016
|
+
const resolve = options.compact ? 'c' : 'resolve';
|
|
11017
|
+
const reject = options.compact ? 'e' : 'reject';
|
|
11018
|
+
const resolveNamespace = this.exportMode === 'default'
|
|
11019
|
+
? `function${_}(m)${_}{${_}${resolve}({${_}'default':${_}m${_}});${_}}`
|
|
11020
|
+
: this.exportMode === 'auto'
|
|
11021
|
+
? `function${_}(m)${_}{${_}${resolve}(${INTEROP_NAMESPACE_VARIABLE}(m));${_}}`
|
|
11022
|
+
: resolve;
|
|
11023
|
+
return {
|
|
11024
|
+
left: `new Promise(function${_}(${resolve},${_}${reject})${_}{${_}require([`,
|
|
11025
|
+
right: `],${_}${resolveNamespace},${_}${reject})${_}})`
|
|
11026
|
+
};
|
|
11027
|
+
}
|
|
11028
|
+
case 'system':
|
|
11029
|
+
return {
|
|
11030
|
+
left: 'module.import(',
|
|
11031
|
+
right: ')'
|
|
11032
|
+
};
|
|
11033
|
+
case 'es':
|
|
11034
|
+
if (options.dynamicImportFunction) {
|
|
11035
|
+
return {
|
|
11036
|
+
left: `${options.dynamicImportFunction}(`,
|
|
11037
|
+
right: ')'
|
|
11038
|
+
};
|
|
11039
|
+
}
|
|
11040
|
+
}
|
|
11041
|
+
return null;
|
|
10977
11042
|
}
|
|
10978
11043
|
}
|
|
10979
11044
|
|
|
@@ -11141,8 +11206,13 @@ class LogicalExpression extends NodeBase {
|
|
|
11141
11206
|
}
|
|
11142
11207
|
render(code, options, { renderedParentType, isCalleeOfRenderedParent } = BLANK) {
|
|
11143
11208
|
if (!this.left.included || !this.right.included) {
|
|
11144
|
-
code.
|
|
11145
|
-
|
|
11209
|
+
const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
|
|
11210
|
+
if (this.right.included) {
|
|
11211
|
+
code.remove(this.start, operatorPos + 2);
|
|
11212
|
+
}
|
|
11213
|
+
else {
|
|
11214
|
+
code.remove(operatorPos, this.end);
|
|
11215
|
+
}
|
|
11146
11216
|
removeAnnotations(this, code);
|
|
11147
11217
|
this.usedBranch.render(code, options, {
|
|
11148
11218
|
isCalleeOfRenderedParent: renderedParentType
|
|
@@ -11574,7 +11644,6 @@ class MetaProperty extends NodeBase {
|
|
|
11574
11644
|
const relativePath = normalize(path.relative(path.dirname(chunkId), fileName));
|
|
11575
11645
|
let replacement;
|
|
11576
11646
|
if (assetReferenceId !== null) {
|
|
11577
|
-
// deprecated hook for assets
|
|
11578
11647
|
replacement = pluginDriver.hookFirstSync('resolveAssetUrl', [
|
|
11579
11648
|
{
|
|
11580
11649
|
assetFileName: fileName,
|
|
@@ -12146,16 +12215,13 @@ class SequenceExpression extends NodeBase {
|
|
|
12146
12215
|
this.expressions[this.expressions.length - 1].include(includeChildrenRecursively);
|
|
12147
12216
|
}
|
|
12148
12217
|
render(code, options, { renderedParentType, isCalleeOfRenderedParent } = BLANK) {
|
|
12149
|
-
let
|
|
12218
|
+
let includedNodes = 0;
|
|
12150
12219
|
for (const { node, start, end } of getCommaSeparatedNodesWithBoundaries(this.expressions, code, this.start, this.end)) {
|
|
12151
12220
|
if (!node.included) {
|
|
12152
12221
|
treeshakeNode(node, code, start, end);
|
|
12153
12222
|
continue;
|
|
12154
12223
|
}
|
|
12155
12224
|
includedNodes++;
|
|
12156
|
-
if (firstStart === 0)
|
|
12157
|
-
firstStart = start;
|
|
12158
|
-
lastEnd = end;
|
|
12159
12225
|
if (node === this.expressions[this.expressions.length - 1] && includedNodes === 1) {
|
|
12160
12226
|
node.render(code, options, {
|
|
12161
12227
|
isCalleeOfRenderedParent: renderedParentType
|
|
@@ -12168,11 +12234,6 @@ class SequenceExpression extends NodeBase {
|
|
|
12168
12234
|
node.render(code, options);
|
|
12169
12235
|
}
|
|
12170
12236
|
}
|
|
12171
|
-
// Round brackets are part of the actual parent and should be re-added in case the parent changed
|
|
12172
|
-
if (includedNodes > 1 && renderedParentType) {
|
|
12173
|
-
code.prependRight(firstStart, '(');
|
|
12174
|
-
code.appendLeft(lastEnd, ')');
|
|
12175
|
-
}
|
|
12176
12237
|
}
|
|
12177
12238
|
}
|
|
12178
12239
|
|
|
@@ -13402,8 +13463,7 @@ class Module {
|
|
|
13402
13463
|
return this.traceVariable(name) || this.graph.scope.findVariable(name);
|
|
13403
13464
|
}
|
|
13404
13465
|
if (name !== 'default') {
|
|
13405
|
-
for (
|
|
13406
|
-
const module = this.exportAllModules[i];
|
|
13466
|
+
for (const module of this.exportAllModules) {
|
|
13407
13467
|
const declaration = module.getVariableForExportName(name, true);
|
|
13408
13468
|
if (declaration)
|
|
13409
13469
|
return declaration;
|
|
@@ -13467,9 +13527,15 @@ class Module {
|
|
|
13467
13527
|
}
|
|
13468
13528
|
this.addModulesToSpecifiers(this.importDescriptions);
|
|
13469
13529
|
this.addModulesToSpecifiers(this.reexports);
|
|
13470
|
-
this.exportAllModules = this.exportAllSources
|
|
13530
|
+
this.exportAllModules = this.exportAllSources
|
|
13531
|
+
.map(source => {
|
|
13471
13532
|
const id = this.resolvedIds[source].id;
|
|
13472
13533
|
return this.graph.moduleById.get(id);
|
|
13534
|
+
})
|
|
13535
|
+
.sort((moduleA, moduleB) => {
|
|
13536
|
+
const aExternal = moduleA instanceof ExternalModule;
|
|
13537
|
+
const bExternal = moduleB instanceof ExternalModule;
|
|
13538
|
+
return aExternal === bExternal ? 0 : aExternal ? 1 : -1;
|
|
13473
13539
|
});
|
|
13474
13540
|
}
|
|
13475
13541
|
render(options) {
|
|
@@ -13595,7 +13661,7 @@ class Module {
|
|
|
13595
13661
|
this.graph.warn(warning);
|
|
13596
13662
|
}
|
|
13597
13663
|
addDynamicImport(node) {
|
|
13598
|
-
this.dynamicImports.push({ node, resolution:
|
|
13664
|
+
this.dynamicImports.push({ node, resolution: null });
|
|
13599
13665
|
}
|
|
13600
13666
|
addExport(node) {
|
|
13601
13667
|
const source = node.source && node.source.value;
|
|
@@ -14518,8 +14584,8 @@ class Chunk$1 {
|
|
|
14518
14584
|
}
|
|
14519
14585
|
}
|
|
14520
14586
|
sortByExecutionOrder(this.dependencies);
|
|
14521
|
-
this.setIdentifierRenderResolutions(options);
|
|
14522
14587
|
this.prepareDynamicImports();
|
|
14588
|
+
this.setIdentifierRenderResolutions(options);
|
|
14523
14589
|
let hoistedSource = '';
|
|
14524
14590
|
const renderedModules = (this.renderedModules = Object.create(null));
|
|
14525
14591
|
for (const module of this.orderedModules) {
|
|
@@ -14940,22 +15006,19 @@ class Chunk$1 {
|
|
|
14940
15006
|
prepareDynamicImports() {
|
|
14941
15007
|
for (const module of this.orderedModules) {
|
|
14942
15008
|
for (const { node, resolution } of module.dynamicImports) {
|
|
14943
|
-
if (!
|
|
15009
|
+
if (!node.included)
|
|
14944
15010
|
continue;
|
|
14945
15011
|
if (resolution instanceof Module) {
|
|
14946
15012
|
if (resolution.chunk === this) {
|
|
14947
15013
|
const namespace = resolution.getOrCreateNamespace();
|
|
14948
|
-
node.setResolution(
|
|
15014
|
+
node.setResolution('named', namespace);
|
|
14949
15015
|
}
|
|
14950
15016
|
else {
|
|
14951
|
-
node.setResolution(
|
|
15017
|
+
node.setResolution(resolution.chunk.exportMode);
|
|
14952
15018
|
}
|
|
14953
15019
|
}
|
|
14954
|
-
else if (resolution instanceof ExternalModule) {
|
|
14955
|
-
node.setResolution(false);
|
|
14956
|
-
}
|
|
14957
15020
|
else {
|
|
14958
|
-
node.setResolution(
|
|
15021
|
+
node.setResolution('auto');
|
|
14959
15022
|
}
|
|
14960
15023
|
}
|
|
14961
15024
|
}
|
|
@@ -15480,15 +15543,30 @@ var BuildPhase;
|
|
|
15480
15543
|
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
15481
15544
|
})(BuildPhase || (BuildPhase = {}));
|
|
15482
15545
|
|
|
15483
|
-
const
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
}
|
|
15546
|
+
const ANONYMOUS_PLUGIN_PREFIX = 'at position ';
|
|
15547
|
+
const deprecatedHooks = [
|
|
15548
|
+
{ active: true, deprecated: 'ongenerate', replacement: 'generateBundle' },
|
|
15549
|
+
{ active: true, deprecated: 'onwrite', replacement: 'generateBundle/writeBundle' },
|
|
15550
|
+
{ active: true, deprecated: 'transformBundle', replacement: 'renderChunk' },
|
|
15551
|
+
{ active: true, deprecated: 'transformChunk', replacement: 'renderChunk' },
|
|
15552
|
+
{ active: false, deprecated: 'resolveAssetUrl', replacement: 'resolveFileUrl' }
|
|
15553
|
+
];
|
|
15554
|
+
function warnDeprecatedHooks(plugins, graph) {
|
|
15555
|
+
for (const { active, deprecated, replacement } of deprecatedHooks) {
|
|
15556
|
+
for (const plugin of plugins) {
|
|
15557
|
+
if (deprecated in plugin) {
|
|
15558
|
+
graph.warnDeprecation({
|
|
15559
|
+
message: `The "${deprecated}" hook used by plugin ${plugin.name} is deprecated. The "${replacement}" hook should be used instead.`,
|
|
15560
|
+
plugin: plugin.name
|
|
15561
|
+
}, active);
|
|
15562
|
+
}
|
|
15563
|
+
}
|
|
15564
|
+
}
|
|
15565
|
+
}
|
|
15489
15566
|
function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
15567
|
+
warnDeprecatedHooks(options.plugins, graph);
|
|
15490
15568
|
const plugins = [
|
|
15491
|
-
...
|
|
15569
|
+
...options.plugins,
|
|
15492
15570
|
getRollupDefaultPlugin(options.preserveSymlinks)
|
|
15493
15571
|
];
|
|
15494
15572
|
const { emitAsset, getAssetFileName, setAssetSource } = createAssetPluginHooks(graph.assetsById);
|
|
@@ -15497,7 +15575,7 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15497
15575
|
const pluginContexts = plugins.map((plugin, pidx) => {
|
|
15498
15576
|
let cacheable = true;
|
|
15499
15577
|
if (typeof plugin.cacheKey !== 'string') {
|
|
15500
|
-
if (
|
|
15578
|
+
if (plugin.name.startsWith(ANONYMOUS_PLUGIN_PREFIX) || existingPluginKeys.has(plugin.name)) {
|
|
15501
15579
|
cacheable = false;
|
|
15502
15580
|
}
|
|
15503
15581
|
else {
|
|
@@ -15518,17 +15596,6 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15518
15596
|
else {
|
|
15519
15597
|
cacheInstance = uncacheablePlugin(plugin.name);
|
|
15520
15598
|
}
|
|
15521
|
-
let watcherDeprecationWarningShown = false;
|
|
15522
|
-
function deprecatedWatchListener(event, handler) {
|
|
15523
|
-
if (!watcherDeprecationWarningShown) {
|
|
15524
|
-
context.warn({
|
|
15525
|
-
code: 'PLUGIN_WATCHER_DEPRECATED',
|
|
15526
|
-
message: `this.watcher usage is deprecated in plugins. Use the watchChange plugin hook and this.addWatchFile() instead.`
|
|
15527
|
-
});
|
|
15528
|
-
watcherDeprecationWarningShown = true;
|
|
15529
|
-
}
|
|
15530
|
-
return watcher.on(event, handler);
|
|
15531
|
-
}
|
|
15532
15599
|
const context = {
|
|
15533
15600
|
addWatchFile(id) {
|
|
15534
15601
|
if (graph.phase >= BuildPhase.GENERATE)
|
|
@@ -15548,12 +15615,9 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15548
15615
|
if (err.code)
|
|
15549
15616
|
err.pluginCode = err.code;
|
|
15550
15617
|
err.code = 'PLUGIN_ERROR';
|
|
15551
|
-
err.plugin = plugin.name
|
|
15618
|
+
err.plugin = plugin.name;
|
|
15552
15619
|
return error(err);
|
|
15553
15620
|
},
|
|
15554
|
-
isExternal(id, parentId, isResolved = false) {
|
|
15555
|
-
return graph.moduleLoader.isExternal(id, parentId, isResolved);
|
|
15556
|
-
},
|
|
15557
15621
|
getAssetFileName: getAssetFileName,
|
|
15558
15622
|
getChunkFileName(chunkReferenceId) {
|
|
15559
15623
|
return graph.moduleLoader.getChunkFileName(chunkReferenceId);
|
|
@@ -15573,6 +15637,19 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15573
15637
|
isExternal: foundModule instanceof ExternalModule
|
|
15574
15638
|
};
|
|
15575
15639
|
},
|
|
15640
|
+
isExternal: (() => {
|
|
15641
|
+
let deprecationWarningShown = false;
|
|
15642
|
+
return (id, parentId, isResolved = false) => {
|
|
15643
|
+
if (!deprecationWarningShown) {
|
|
15644
|
+
deprecationWarningShown = true;
|
|
15645
|
+
graph.warnDeprecation({
|
|
15646
|
+
message: `The "this.isExternal" plugin context function used by plugin ${plugin.name} is deprecated. The "this.resolve" plugin context function should be used instead.`,
|
|
15647
|
+
plugin: plugin.name
|
|
15648
|
+
}, false);
|
|
15649
|
+
}
|
|
15650
|
+
return graph.moduleLoader.isExternal(id, parentId, isResolved);
|
|
15651
|
+
};
|
|
15652
|
+
})(),
|
|
15576
15653
|
meta: {
|
|
15577
15654
|
rollupVersion: version
|
|
15578
15655
|
},
|
|
@@ -15580,14 +15657,24 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15580
15657
|
return graph.moduleById.keys();
|
|
15581
15658
|
},
|
|
15582
15659
|
parse: graph.contextParse,
|
|
15583
|
-
resolveId(source, importer) {
|
|
15584
|
-
return graph.moduleLoader
|
|
15585
|
-
.resolveId(source, importer)
|
|
15586
|
-
.then(resolveId => resolveId && resolveId.id);
|
|
15587
|
-
},
|
|
15588
15660
|
resolve(source, importer, options) {
|
|
15589
15661
|
return graph.moduleLoader.resolveId(source, importer, options && options.skipSelf ? pidx : null);
|
|
15590
15662
|
},
|
|
15663
|
+
resolveId: (() => {
|
|
15664
|
+
let deprecationWarningShown = false;
|
|
15665
|
+
return (source, importer) => {
|
|
15666
|
+
if (!deprecationWarningShown) {
|
|
15667
|
+
deprecationWarningShown = true;
|
|
15668
|
+
graph.warnDeprecation({
|
|
15669
|
+
message: `The "this.resolveId" plugin context function used by plugin ${plugin.name} is deprecated. The "this.resolve" plugin context function should be used instead.`,
|
|
15670
|
+
plugin: plugin.name
|
|
15671
|
+
}, false);
|
|
15672
|
+
}
|
|
15673
|
+
return graph.moduleLoader
|
|
15674
|
+
.resolveId(source, importer)
|
|
15675
|
+
.then(resolveId => resolveId && resolveId.id);
|
|
15676
|
+
};
|
|
15677
|
+
})(),
|
|
15591
15678
|
setAssetSource,
|
|
15592
15679
|
warn(warning) {
|
|
15593
15680
|
if (typeof warning === 'string')
|
|
@@ -15595,11 +15682,24 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15595
15682
|
if (warning.code)
|
|
15596
15683
|
warning.pluginCode = warning.code;
|
|
15597
15684
|
warning.code = 'PLUGIN_WARNING';
|
|
15598
|
-
warning.plugin = plugin.name
|
|
15685
|
+
warning.plugin = plugin.name;
|
|
15599
15686
|
graph.warn(warning);
|
|
15600
15687
|
},
|
|
15601
15688
|
watcher: watcher
|
|
15602
|
-
?
|
|
15689
|
+
? (() => {
|
|
15690
|
+
let deprecationWarningShown = false;
|
|
15691
|
+
function deprecatedWatchListener(event, handler) {
|
|
15692
|
+
if (!deprecationWarningShown) {
|
|
15693
|
+
context.warn({
|
|
15694
|
+
code: 'PLUGIN_WATCHER_DEPRECATED',
|
|
15695
|
+
message: `this.watcher usage is deprecated in plugins. Use the watchChange plugin hook and this.addWatchFile() instead.`
|
|
15696
|
+
});
|
|
15697
|
+
deprecationWarningShown = true;
|
|
15698
|
+
}
|
|
15699
|
+
return watcher.on(event, handler);
|
|
15700
|
+
}
|
|
15701
|
+
return Object.assign({}, watcher, { addListener: deprecatedWatchListener, on: deprecatedWatchListener });
|
|
15702
|
+
})()
|
|
15603
15703
|
: undefined
|
|
15604
15704
|
};
|
|
15605
15705
|
return context;
|
|
@@ -15610,9 +15710,6 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15610
15710
|
const hook = plugin[hookName];
|
|
15611
15711
|
if (!hook)
|
|
15612
15712
|
return undefined;
|
|
15613
|
-
const deprecatedHookNewName = deprecatedHookNames[hookName];
|
|
15614
|
-
if (deprecatedHookNewName)
|
|
15615
|
-
context.warn(hookDeprecationWarning(hookName, deprecatedHookNewName, plugin, pluginIndex));
|
|
15616
15713
|
if (hookContext) {
|
|
15617
15714
|
context = hookContext(context, plugin);
|
|
15618
15715
|
if (!context || context === pluginContexts[pluginIndex])
|
|
@@ -15625,8 +15722,7 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15625
15722
|
return hook;
|
|
15626
15723
|
error({
|
|
15627
15724
|
code: 'INVALID_PLUGIN_HOOK',
|
|
15628
|
-
message: `Error running plugin hook ${hookName} for ${plugin.name
|
|
15629
|
-
`Plugin at position ${pluginIndex + 1}`}, expected a function hook.`
|
|
15725
|
+
message: `Error running plugin hook ${hookName} for ${plugin.name}, expected a function hook.`
|
|
15630
15726
|
});
|
|
15631
15727
|
}
|
|
15632
15728
|
return hook.apply(context, args);
|
|
@@ -15639,7 +15735,7 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15639
15735
|
err.pluginCode = err.code;
|
|
15640
15736
|
err.code = 'PLUGIN_ERROR';
|
|
15641
15737
|
}
|
|
15642
|
-
err.plugin = plugin.name
|
|
15738
|
+
err.plugin = plugin.name;
|
|
15643
15739
|
err.hook = hookName;
|
|
15644
15740
|
error(err);
|
|
15645
15741
|
}
|
|
@@ -15651,9 +15747,6 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15651
15747
|
const hook = plugin[hookName];
|
|
15652
15748
|
if (!hook)
|
|
15653
15749
|
return undefined;
|
|
15654
|
-
const deprecatedHookNewName = deprecatedHookNames[hookName];
|
|
15655
|
-
if (deprecatedHookNewName)
|
|
15656
|
-
context.warn(hookDeprecationWarning(hookName, deprecatedHookNewName, plugin, pluginIndex));
|
|
15657
15750
|
if (hookContext) {
|
|
15658
15751
|
context = hookContext(context, plugin);
|
|
15659
15752
|
if (!context || context === pluginContexts[pluginIndex])
|
|
@@ -15667,8 +15760,7 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15667
15760
|
return hook;
|
|
15668
15761
|
error({
|
|
15669
15762
|
code: 'INVALID_PLUGIN_HOOK',
|
|
15670
|
-
message: `Error running plugin hook ${hookName} for ${plugin.name
|
|
15671
|
-
`Plugin at position ${pluginIndex + 1}`}, expected a function hook.`
|
|
15763
|
+
message: `Error running plugin hook ${hookName} for ${plugin.name}, expected a function hook.`
|
|
15672
15764
|
});
|
|
15673
15765
|
}
|
|
15674
15766
|
return hook.apply(context, args);
|
|
@@ -15681,7 +15773,7 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
15681
15773
|
err.pluginCode = err.code;
|
|
15682
15774
|
err.code = 'PLUGIN_ERROR';
|
|
15683
15775
|
}
|
|
15684
|
-
err.plugin = plugin.name
|
|
15776
|
+
err.plugin = plugin.name;
|
|
15685
15777
|
err.hook = hookName;
|
|
15686
15778
|
error(err);
|
|
15687
15779
|
});
|
|
@@ -15838,7 +15930,7 @@ const noCache = {
|
|
|
15838
15930
|
}
|
|
15839
15931
|
};
|
|
15840
15932
|
function uncacheablePluginError(pluginName) {
|
|
15841
|
-
if (
|
|
15933
|
+
if (pluginName.startsWith(ANONYMOUS_PLUGIN_PREFIX))
|
|
15842
15934
|
error({
|
|
15843
15935
|
code: 'ANONYMOUS_PLUGIN_CACHE',
|
|
15844
15936
|
message: 'A plugin is trying to use the Rollup cache but is not declaring a plugin name or cacheKey.'
|
|
@@ -15866,13 +15958,6 @@ const uncacheablePlugin = pluginName => ({
|
|
|
15866
15958
|
return false;
|
|
15867
15959
|
}
|
|
15868
15960
|
});
|
|
15869
|
-
function hookDeprecationWarning(name, newName, plugin, pluginIndex) {
|
|
15870
|
-
return {
|
|
15871
|
-
code: name.toUpperCase() + '_HOOK_DEPRECATED',
|
|
15872
|
-
message: `The ${name} hook used by plugin ${plugin.name ||
|
|
15873
|
-
`at position ${pluginIndex + 1}`} is deprecated. The ${newName} hook should be used instead.`
|
|
15874
|
-
};
|
|
15875
|
-
}
|
|
15876
15961
|
|
|
15877
15962
|
function transform(graph, source, module) {
|
|
15878
15963
|
const id = module.id;
|
|
@@ -15905,7 +15990,7 @@ function transform(graph, source, module) {
|
|
|
15905
15990
|
}
|
|
15906
15991
|
}
|
|
15907
15992
|
else {
|
|
15908
|
-
// assets emitted by transform
|
|
15993
|
+
// assets/chunks emitted by a transform hook need to be emitted again if the hook is skipped
|
|
15909
15994
|
if (emittedAssets.length)
|
|
15910
15995
|
module.transformAssets = emittedAssets;
|
|
15911
15996
|
if (emittedChunks.length)
|
|
@@ -15913,10 +15998,7 @@ function transform(graph, source, module) {
|
|
|
15913
15998
|
if (result && typeof result === 'object' && Array.isArray(result.dependencies)) {
|
|
15914
15999
|
// not great, but a useful way to track this without assuming WeakMap
|
|
15915
16000
|
if (!curPlugin.warnedTransformDependencies)
|
|
15916
|
-
|
|
15917
|
-
code: 'TRANSFORM_DEPENDENCIES_DEPRECATED',
|
|
15918
|
-
message: `Returning "dependencies" from plugin transform hook is deprecated for using this.addWatchFile() instead.`
|
|
15919
|
-
});
|
|
16001
|
+
graph.warnDeprecation(`Returning "dependencies" from the "transform" hook as done by plugin ${plugin.name} is deprecated. The "this.addWatchFile" plugin context function should be used instead.`, true);
|
|
15920
16002
|
curPlugin.warnedTransformDependencies = true;
|
|
15921
16003
|
if (!transformDependencies)
|
|
15922
16004
|
transformDependencies = [];
|
|
@@ -16511,6 +16593,7 @@ class Graph {
|
|
|
16511
16593
|
this.watchFiles = Object.create(null);
|
|
16512
16594
|
this.externalModules = [];
|
|
16513
16595
|
this.modules = [];
|
|
16596
|
+
this.onwarn = options.onwarn || makeOnwarn();
|
|
16514
16597
|
this.curChunkIndex = 0;
|
|
16515
16598
|
this.deoptimizationTracker = new EntityPathTracker();
|
|
16516
16599
|
this.cachedModules = new Map();
|
|
@@ -16529,6 +16612,7 @@ class Graph {
|
|
|
16529
16612
|
}
|
|
16530
16613
|
}
|
|
16531
16614
|
this.preserveModules = options.preserveModules;
|
|
16615
|
+
this.strictDeprecations = options.strictDeprecations;
|
|
16532
16616
|
this.cacheExpiry = options.experimentalCacheExpiry;
|
|
16533
16617
|
if (options.treeshake !== false) {
|
|
16534
16618
|
this.treeshakingOptions = options.treeshake
|
|
@@ -16543,9 +16627,11 @@ class Graph {
|
|
|
16543
16627
|
annotations: true,
|
|
16544
16628
|
moduleSideEffects: true,
|
|
16545
16629
|
propertyReadSideEffects: true,
|
|
16546
|
-
pureExternalModules: false,
|
|
16547
16630
|
tryCatchDeoptimization: true
|
|
16548
16631
|
};
|
|
16632
|
+
if (typeof this.treeshakingOptions.pureExternalModules !== 'undefined') {
|
|
16633
|
+
this.warnDeprecation(`The "treeshake.pureExternalModules" option is deprecated. The "treeshake.moduleSideEffects" option should be used instead. "treeshake.pureExternalModules: true" is equivalent to "treeshake.moduleSideEffects: 'no-external'"`, false);
|
|
16634
|
+
}
|
|
16549
16635
|
}
|
|
16550
16636
|
this.contextParse = (code, options = {}) => this.acornParser.parse(code, Object.assign({}, defaultAcornOptions, options, this.acornOptions));
|
|
16551
16637
|
this.pluginDriver = createPluginDriver(this, options, this.pluginCache, watcher);
|
|
@@ -16573,7 +16659,6 @@ class Graph {
|
|
|
16573
16659
|
else {
|
|
16574
16660
|
this.getModuleContext = () => this.context;
|
|
16575
16661
|
}
|
|
16576
|
-
this.onwarn = options.onwarn || makeOnwarn();
|
|
16577
16662
|
this.acornOptions = options.acorn || {};
|
|
16578
16663
|
const acornPluginsToInject = [];
|
|
16579
16664
|
acornPluginsToInject.push(dynamicImport);
|
|
@@ -16752,6 +16837,15 @@ class Graph {
|
|
|
16752
16837
|
};
|
|
16753
16838
|
this.onwarn(warning);
|
|
16754
16839
|
}
|
|
16840
|
+
warnDeprecation(deprecation, activeDeprecation) {
|
|
16841
|
+
if (activeDeprecation || this.strictDeprecations) {
|
|
16842
|
+
const warning = errDeprecation(deprecation);
|
|
16843
|
+
if (this.strictDeprecations) {
|
|
16844
|
+
return error(warning);
|
|
16845
|
+
}
|
|
16846
|
+
this.warn(warning);
|
|
16847
|
+
}
|
|
16848
|
+
}
|
|
16755
16849
|
link(entryModules) {
|
|
16756
16850
|
for (const module of this.modules) {
|
|
16757
16851
|
module.linkDependencies();
|
|
@@ -16822,7 +16916,7 @@ function createAddons(graph, options) {
|
|
|
16822
16916
|
.catch((err) => {
|
|
16823
16917
|
error({
|
|
16824
16918
|
code: 'ADDON_ERROR',
|
|
16825
|
-
message: `Could not retrieve ${err.hook}. Check configuration of ${err.plugin}.
|
|
16919
|
+
message: `Could not retrieve ${err.hook}. Check configuration of plugin ${err.plugin}.
|
|
16826
16920
|
\tError Message: ${err.message}`
|
|
16827
16921
|
});
|
|
16828
16922
|
});
|
|
@@ -17053,6 +17147,7 @@ function getInputOptions(config, command = { external: [], globals: undefined },
|
|
|
17053
17147
|
preserveModules: getOption('preserveModules'),
|
|
17054
17148
|
preserveSymlinks: getOption('preserveSymlinks'),
|
|
17055
17149
|
shimMissingExports: getOption('shimMissingExports'),
|
|
17150
|
+
strictDeprecations: getOption('strictDeprecations', false),
|
|
17056
17151
|
treeshake: getObjectOption(config, command, 'treeshake'),
|
|
17057
17152
|
watch: config.watch
|
|
17058
17153
|
};
|
|
@@ -17109,10 +17204,10 @@ function getOutputOptions(config, command = {}) {
|
|
|
17109
17204
|
|
|
17110
17205
|
function checkOutputOptions(options) {
|
|
17111
17206
|
if (options.format === 'es6') {
|
|
17112
|
-
error({
|
|
17207
|
+
error(errDeprecation({
|
|
17113
17208
|
message: 'The "es6" output format is deprecated – use "esm" instead',
|
|
17114
17209
|
url: `https://rollupjs.org/guide/en#output-format`
|
|
17115
|
-
});
|
|
17210
|
+
}));
|
|
17116
17211
|
}
|
|
17117
17212
|
if (['amd', 'cjs', 'system', 'es', 'iife', 'umd'].indexOf(options.format) < 0) {
|
|
17118
17213
|
error({
|
|
@@ -17142,6 +17237,15 @@ function applyOptionHook(inputOptions, plugin) {
|
|
|
17142
17237
|
return plugin.options.call({ meta: { rollupVersion: version } }, inputOptions) || inputOptions;
|
|
17143
17238
|
return inputOptions;
|
|
17144
17239
|
}
|
|
17240
|
+
function ensureArray(items) {
|
|
17241
|
+
if (Array.isArray(items)) {
|
|
17242
|
+
return items.filter(Boolean);
|
|
17243
|
+
}
|
|
17244
|
+
if (items) {
|
|
17245
|
+
return [items];
|
|
17246
|
+
}
|
|
17247
|
+
return [];
|
|
17248
|
+
}
|
|
17145
17249
|
function getInputOptions$1(rawInputOptions) {
|
|
17146
17250
|
if (!rawInputOptions) {
|
|
17147
17251
|
throw new Error('You must supply an options object to rollup');
|
|
@@ -17151,13 +17255,14 @@ function getInputOptions$1(rawInputOptions) {
|
|
|
17151
17255
|
});
|
|
17152
17256
|
if (optionError)
|
|
17153
17257
|
inputOptions.onwarn({ message: optionError, code: 'UNKNOWN_OPTION' });
|
|
17154
|
-
|
|
17155
|
-
inputOptions.plugins =
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
17258
|
+
inputOptions = ensureArray(inputOptions.plugins).reduce(applyOptionHook, inputOptions);
|
|
17259
|
+
inputOptions.plugins = ensureArray(inputOptions.plugins);
|
|
17260
|
+
for (let pluginIndex = 0; pluginIndex < inputOptions.plugins.length; pluginIndex++) {
|
|
17261
|
+
const plugin = inputOptions.plugins[pluginIndex];
|
|
17262
|
+
if (!plugin.name) {
|
|
17263
|
+
plugin.name = `${ANONYMOUS_PLUGIN_PREFIX}${pluginIndex + 1}`;
|
|
17264
|
+
}
|
|
17265
|
+
}
|
|
17161
17266
|
if (inputOptions.inlineDynamicImports) {
|
|
17162
17267
|
if (inputOptions.preserveModules)
|
|
17163
17268
|
error({
|
|
@@ -18987,8 +19092,6 @@ const expandRange = (args, options) => {
|
|
|
18987
19092
|
args.sort();
|
|
18988
19093
|
let value = `[${args.join('-')}]`;
|
|
18989
19094
|
try {
|
|
18990
|
-
/* eslint-disable no-new */
|
|
18991
|
-
new RegExp(value);
|
|
18992
19095
|
}
|
|
18993
19096
|
catch (ex) {
|
|
18994
19097
|
return args.map(v => utils$2.escapeRegex(v)).join('..');
|
|
@@ -20454,7 +20557,7 @@ micromatch.braceExpand = (pattern, options) => {
|
|
|
20454
20557
|
*/
|
|
20455
20558
|
var micromatch_1 = micromatch;
|
|
20456
20559
|
|
|
20457
|
-
function ensureArray(thing) {
|
|
20560
|
+
function ensureArray$1(thing) {
|
|
20458
20561
|
if (Array.isArray(thing))
|
|
20459
20562
|
return thing;
|
|
20460
20563
|
if (thing == undefined)
|
|
@@ -20479,8 +20582,8 @@ const createFilter = function createFilter(include, exclude, options) {
|
|
|
20479
20582
|
.join('/'), { dot: true })
|
|
20480
20583
|
};
|
|
20481
20584
|
};
|
|
20482
|
-
const includeMatchers = ensureArray(include).map(getMatcher);
|
|
20483
|
-
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
|
20585
|
+
const includeMatchers = ensureArray$1(include).map(getMatcher);
|
|
20586
|
+
const excludeMatchers = ensureArray$1(exclude).map(getMatcher);
|
|
20484
20587
|
return function (id) {
|
|
20485
20588
|
if (typeof id !== 'string')
|
|
20486
20589
|
return false;
|