vis-dev-utils 3.0.118 → 3.0.120
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/babel-register/index.js +26 -12
- package/babel-register/index.js.map +1 -1
- package/bin/ci-utils.js +4 -8
- package/bin/ci-utils.js.map +1 -1
- package/bin/generate-examples-index.js +755 -1015
- package/bin/generate-examples-index.js.map +1 -1
- package/bin/test-e2e-interop.js +2827 -828
- package/bin/test-e2e-interop.js.map +1 -1
- package/declarations/generate-rollup-configuration/index.d.ts +2 -1
- package/declarations/generate-rollup-configuration/index.d.ts.map +1 -1
- package/dist/vis-dev-utils.cjs.js +368 -347
- package/dist/vis-dev-utils.cjs.js.map +1 -1
- package/dist/vis-dev-utils.esm.js +336 -336
- package/dist/vis-dev-utils.esm.js.map +1 -1
- package/package.json +15 -16
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Development utilities for the Vis family projects.
|
|
6
6
|
*
|
|
7
|
-
* @version 3.0.
|
|
8
|
-
* @date 2023-02-
|
|
7
|
+
* @version 3.0.120
|
|
8
|
+
* @date 2023-02-15T20:06:40.240Z
|
|
9
9
|
*
|
|
10
10
|
* @copyright (c) 2011-2017 Almende B.V, http://almende.com
|
|
11
11
|
* @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
|
|
@@ -40,6 +40,8 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
|
|
|
40
40
|
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
41
41
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
42
42
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
43
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
44
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
43
45
|
var _Number$MAX_SAFE_INTEGER = require('@babel/runtime-corejs3/core-js-stable/number/max-safe-integer');
|
|
44
46
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
45
47
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -52,6 +54,7 @@ var _endsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/i
|
|
|
52
54
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
53
55
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
54
56
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
57
|
+
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
55
58
|
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
56
59
|
var analyzerPlugin = require('rollup-plugin-analyzer');
|
|
57
60
|
var babelPlugin = require('rollup-plugin-babel');
|
|
@@ -65,21 +68,38 @@ var postcssPlugin = require('rollup-plugin-postcss');
|
|
|
65
68
|
var stripCodePlugin = require('rollup-plugin-strip-code');
|
|
66
69
|
var typescriptPlugin = require('rollup-plugin-typescript2');
|
|
67
70
|
var findUp = require('find-up');
|
|
68
|
-
var
|
|
69
|
-
var
|
|
71
|
+
var node_fs = require('node:fs');
|
|
72
|
+
var node_path = require('node:path');
|
|
70
73
|
var rollupPluginString = require('rollup-plugin-string');
|
|
71
|
-
var globby = require('globby');
|
|
72
74
|
var rollupPluginTerser = require('rollup-plugin-terser');
|
|
73
75
|
var chai = require('chai');
|
|
74
76
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
75
77
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
76
78
|
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
77
79
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
78
|
-
var
|
|
80
|
+
var node_child_process = require('node:child_process');
|
|
79
81
|
var tmpPromise = require('tmp-promise');
|
|
80
82
|
|
|
81
83
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
82
84
|
|
|
85
|
+
function _interopNamespace(e) {
|
|
86
|
+
if (e && e.__esModule) return e;
|
|
87
|
+
var n = Object.create(null);
|
|
88
|
+
if (e) {
|
|
89
|
+
Object.keys(e).forEach(function (k) {
|
|
90
|
+
if (k !== 'default') {
|
|
91
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
92
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return e[k]; }
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
n["default"] = e;
|
|
100
|
+
return Object.freeze(n);
|
|
101
|
+
}
|
|
102
|
+
|
|
83
103
|
var _Object$freeze__default = /*#__PURE__*/_interopDefaultLegacy(_Object$freeze);
|
|
84
104
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefaultLegacy(_Object$getOwnPropertySymbols);
|
|
85
105
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_filterInstanceProperty);
|
|
@@ -92,6 +112,8 @@ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_obje
|
|
|
92
112
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
93
113
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
94
114
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
115
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
116
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
95
117
|
var _Number$MAX_SAFE_INTEGER__default = /*#__PURE__*/_interopDefaultLegacy(_Number$MAX_SAFE_INTEGER);
|
|
96
118
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_includesInstanceProperty);
|
|
97
119
|
var _Array$isArray__default = /*#__PURE__*/_interopDefaultLegacy(_Array$isArray);
|
|
@@ -104,6 +126,7 @@ var _endsWithInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_end
|
|
|
104
126
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_concatInstanceProperty);
|
|
105
127
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_mapInstanceProperty);
|
|
106
128
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_sortInstanceProperty);
|
|
129
|
+
var _Promise__default = /*#__PURE__*/_interopDefaultLegacy(_Promise);
|
|
107
130
|
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_bindInstanceProperty);
|
|
108
131
|
var analyzerPlugin__default = /*#__PURE__*/_interopDefaultLegacy(analyzerPlugin);
|
|
109
132
|
var babelPlugin__default = /*#__PURE__*/_interopDefaultLegacy(babelPlugin);
|
|
@@ -131,40 +154,40 @@ var BABEL_IGNORE_RE = _Object$freeze__default["default"](/[\\/]node_modules[\\/]
|
|
|
131
154
|
* @returns A block doc comment string that can be for example prepended to a
|
|
132
155
|
* bundled JavaScript file.
|
|
133
156
|
*/
|
|
134
|
-
|
|
135
157
|
function textToComment(string) {
|
|
136
158
|
var _context, _context2;
|
|
137
|
-
|
|
138
159
|
if (_includesInstanceProperty__default["default"](string).call(string, "*/")) {
|
|
139
160
|
throw new Error("Don't include comments in the input string. It will be converted automatically.");
|
|
140
161
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.replace(/^[\n\r]*/, "")
|
|
144
|
-
|
|
145
|
-
.
|
|
162
|
+
return "/**\n" + _mapInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = string
|
|
163
|
+
// Remove empty lines from the start.
|
|
164
|
+
.replace(/^[\n\r]*/, "")
|
|
165
|
+
// Remove empty lines from the end.
|
|
166
|
+
.replace(/[\n\r\s]*$/, "")
|
|
167
|
+
// Process each line on it's own from now on.
|
|
168
|
+
.split("\n")
|
|
169
|
+
// Prefix each line with an asterisk.
|
|
146
170
|
).call(_context2, function (line) {
|
|
147
171
|
return " * " + line;
|
|
148
|
-
})
|
|
172
|
+
})
|
|
173
|
+
// Remove trailing white space.
|
|
149
174
|
).call(_context, function (line) {
|
|
150
175
|
return line.replace(/[^\S\r\n]*$/, "");
|
|
151
|
-
})
|
|
176
|
+
})
|
|
177
|
+
// Join back into a string.
|
|
152
178
|
.join("\n") + "\n */\n";
|
|
153
179
|
}
|
|
154
|
-
var packageJSON = JSON.parse(
|
|
155
|
-
|
|
180
|
+
var packageJSON = JSON.parse(node_fs.readFileSync(findUp.sync("package.json"), "utf8"));
|
|
156
181
|
var buildHeader = function buildHeader(_ref) {
|
|
157
182
|
var _context3, _context4, _context5, _context6, _context7;
|
|
158
|
-
|
|
159
183
|
var customText = _ref.customText,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
184
|
+
date = _ref.date,
|
|
185
|
+
description = _ref.description,
|
|
186
|
+
homepage = _ref.homepage,
|
|
187
|
+
name = _ref.name,
|
|
188
|
+
version = _ref.version;
|
|
165
189
|
return textToComment(_concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = "\n".concat(name, "\n")).call(_context7, homepage, "\n\n")).call(_context6, description, "\n\n@version ")).call(_context5, version, "\n@date ")).call(_context4, date, "\n\n@copyright (c) 2011-2017 Almende B.V, http://almende.com\n@copyright (c) 2017-2019 visjs contributors, https://github.com/visjs\n\n@license\nvis.js is dual licensed under both\n\n 1. The Apache 2.0 License\n http://www.apache.org/licenses/LICENSE-2.0\n\n and\n\n 2. The MIT License\n http://opensource.org/licenses/MIT\n\nvis.js may be distributed under either license.\n\n")).call(_context3, customText, "\n"));
|
|
166
190
|
};
|
|
167
|
-
|
|
168
191
|
var defaultDate = new Date().toISOString();
|
|
169
192
|
var defaultDescription = packageJSON.description;
|
|
170
193
|
var defaultHomepage = packageJSON.homepage;
|
|
@@ -180,22 +203,20 @@ var defaultVersion = packageJSON.version;
|
|
|
180
203
|
* @throws If the string already contains a comment.
|
|
181
204
|
* @returns Ready to use banner text.
|
|
182
205
|
*/
|
|
183
|
-
|
|
184
206
|
function generateHeader(options) {
|
|
185
207
|
var _ref2 = options || {},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
208
|
+
_ref2$customText = _ref2.customText,
|
|
209
|
+
customText = _ref2$customText === void 0 ? "" : _ref2$customText,
|
|
210
|
+
_ref2$date = _ref2.date,
|
|
211
|
+
date = _ref2$date === void 0 ? defaultDate : _ref2$date,
|
|
212
|
+
_ref2$description = _ref2.description,
|
|
213
|
+
description = _ref2$description === void 0 ? defaultDescription : _ref2$description,
|
|
214
|
+
_ref2$homepage = _ref2.homepage,
|
|
215
|
+
homepage = _ref2$homepage === void 0 ? defaultHomepage : _ref2$homepage,
|
|
216
|
+
_ref2$name = _ref2.name,
|
|
217
|
+
name = _ref2$name === void 0 ? defaultName : _ref2$name,
|
|
218
|
+
_ref2$version = _ref2.version,
|
|
219
|
+
version = _ref2$version === void 0 ? defaultVersion : _ref2$version;
|
|
199
220
|
return buildHeader({
|
|
200
221
|
customText: customText,
|
|
201
222
|
date: date,
|
|
@@ -207,17 +228,13 @@ function generateHeader(options) {
|
|
|
207
228
|
}
|
|
208
229
|
|
|
209
230
|
var _excluded = ["dependencies", "devDependencies", "peerDependencies"];
|
|
210
|
-
|
|
211
231
|
var _context, _context2;
|
|
212
|
-
|
|
213
232
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
214
|
-
|
|
215
|
-
|
|
233
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context25, _context26; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context25 = ownKeys$1(Object(source), !0)).call(_context25, function (key) { _defineProperty__default["default"](target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context26 = ownKeys$1(Object(source))).call(_context26, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
234
|
+
var rawGlobby = Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('globby')); });
|
|
216
235
|
chai.config.truncateThreshold = _Number$MAX_SAFE_INTEGER__default["default"];
|
|
217
236
|
chai.use(chaiFs__default["default"]);
|
|
218
|
-
|
|
219
237
|
var VIS_DEBUG = _includesInstanceProperty__default["default"](_context = ["1", "true", "y", "yes"]).call(_context, process.env["VIS_DEBUG"] || "false");
|
|
220
|
-
|
|
221
238
|
var VIS_TEST = _includesInstanceProperty__default["default"](_context2 = ["1", "true", "y", "yes"]).call(_context2, process.env["VIS_TEST"] || "false");
|
|
222
239
|
/**
|
|
223
240
|
* Simple glob with workaround for non-posix paths.
|
|
@@ -225,17 +242,30 @@ var VIS_TEST = _includesInstanceProperty__default["default"](_context2 = ["1", "
|
|
|
225
242
|
* @param pattern - Single glob pattern.
|
|
226
243
|
* @returns Globbed paths.
|
|
227
244
|
*/
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
function glob(pattern) {
|
|
231
|
-
return globby.sync(path.sep === "\\" ? pattern.replace(/\\/g, "/") : pattern);
|
|
245
|
+
function glob(_x) {
|
|
246
|
+
return _glob.apply(this, arguments);
|
|
232
247
|
}
|
|
233
248
|
/**
|
|
234
249
|
* These are the dependencies that follow standalone/peer/ESNext export
|
|
235
250
|
* structure.
|
|
236
251
|
*/
|
|
237
|
-
|
|
238
|
-
|
|
252
|
+
function _glob() {
|
|
253
|
+
_glob = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(pattern) {
|
|
254
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context11) {
|
|
255
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
256
|
+
case 0:
|
|
257
|
+
_context11.next = 2;
|
|
258
|
+
return rawGlobby;
|
|
259
|
+
case 2:
|
|
260
|
+
return _context11.abrupt("return", _context11.sent.default(node_path.sep === "\\" ? pattern.replace(/\\/g, "/") : pattern));
|
|
261
|
+
case 3:
|
|
262
|
+
case "end":
|
|
263
|
+
return _context11.stop();
|
|
264
|
+
}
|
|
265
|
+
}, _callee);
|
|
266
|
+
}));
|
|
267
|
+
return _glob.apply(this, arguments);
|
|
268
|
+
}
|
|
239
269
|
var dependenciesWithVisExportStructure = ["vis-data", "vis-graph3d", "vis-network", "vis-timeline", "vis-util", "vis-uuid"];
|
|
240
270
|
/**
|
|
241
271
|
* This ensures that dependencies on Vis projects point to ESNext builds.
|
|
@@ -243,7 +273,6 @@ var dependenciesWithVisExportStructure = ["vis-data", "vis-graph3d", "vis-networ
|
|
|
243
273
|
* @param deps - The original dependencies as listed in package.json.
|
|
244
274
|
* @returns An array of dependencies for Rollup.
|
|
245
275
|
*/
|
|
246
|
-
|
|
247
276
|
function processDependencies(deps) {
|
|
248
277
|
var depNames = _Array$isArray__default["default"](deps) ? deps : _Object$keys__default["default"](deps);
|
|
249
278
|
return _flatMapInstanceProperty__default["default"](depNames).call(depNames, function (key) {
|
|
@@ -258,16 +287,12 @@ function processDependencies(deps) {
|
|
|
258
287
|
* @param globals - The original globals.
|
|
259
288
|
* @returns Globals forcing the use of ESNext builds for Vis projects.
|
|
260
289
|
*/
|
|
261
|
-
|
|
262
|
-
|
|
263
290
|
function processGlobals(globals) {
|
|
264
291
|
var _context3;
|
|
265
|
-
|
|
266
292
|
return _reduceInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](globals)).call(_context3, function (acc, _ref) {
|
|
267
293
|
var _ref2 = _slicedToArray__default["default"](_ref, 2),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
294
|
+
key = _ref2[0],
|
|
295
|
+
value = _ref2[1];
|
|
271
296
|
acc[_includesInstanceProperty__default["default"](dependenciesWithVisExportStructure).call(dependenciesWithVisExportStructure, key) ? key + "/esnext" : key] = value;
|
|
272
297
|
return acc;
|
|
273
298
|
}, _Object$create__default["default"](null));
|
|
@@ -275,8 +300,6 @@ function processGlobals(globals) {
|
|
|
275
300
|
/**
|
|
276
301
|
* @param path
|
|
277
302
|
*/
|
|
278
|
-
|
|
279
|
-
|
|
280
303
|
function isTS(path) {
|
|
281
304
|
return _endsWithInstanceProperty__default["default"](path).call(path, ".ts");
|
|
282
305
|
}
|
|
@@ -284,8 +307,6 @@ function isTS(path) {
|
|
|
284
307
|
* Make sure that Chai doesn't throw and therefore stop execution on failed
|
|
285
308
|
* validations during debugging.
|
|
286
309
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
310
|
var validate = VIS_DEBUG ? function (callback) {
|
|
290
311
|
try {
|
|
291
312
|
callback(chai.expect);
|
|
@@ -303,17 +324,14 @@ var validate = VIS_DEBUG ? function (callback) {
|
|
|
303
324
|
* @param moduleFormat - What kind of module system to use.
|
|
304
325
|
* @returns Path overrides for Rollup.
|
|
305
326
|
*/
|
|
306
|
-
|
|
307
327
|
function getPaths(buildVariant, moduleFormat) {
|
|
308
328
|
/**
|
|
309
329
|
* @param lib
|
|
310
330
|
*/
|
|
311
331
|
function getPath(lib) {
|
|
312
332
|
var _context4, _context5, _context6;
|
|
313
|
-
|
|
314
333
|
return _defineProperty__default["default"]({}, "vis-".concat(lib, "/esnext"), _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = "vis-".concat(lib, "/")).call(_context6, buildVariant, "/")).call(_context5, moduleFormat, "/vis-")).call(_context4, lib, ".js"));
|
|
315
334
|
}
|
|
316
|
-
|
|
317
335
|
return _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({}, getPath("charts")), getPath("data")), getPath("graph3d")), getPath("network")), getPath("timeline")), getPath("util")), getPath("uuid"));
|
|
318
336
|
}
|
|
319
337
|
/**
|
|
@@ -322,62 +340,52 @@ function getPaths(buildVariant, moduleFormat) {
|
|
|
322
340
|
* @param dirs - The directories there targets should be relative to.
|
|
323
341
|
* @returns A function that can be directly supplied to Array.map().
|
|
324
342
|
*/
|
|
325
|
-
|
|
326
|
-
|
|
327
343
|
function scopeCopyTarget() {
|
|
328
344
|
for (var _len = arguments.length, dirs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
329
345
|
dirs[_key] = arguments[_key];
|
|
330
346
|
}
|
|
331
|
-
|
|
332
347
|
return function (target) {
|
|
333
348
|
var dest = _Array$isArray__default["default"](target.dest) ? target.dest : [target.dest];
|
|
334
|
-
|
|
335
|
-
var bundleDest = _flatMapInstanceProperty__default["default"](dest).call(dest, function (path$1) {
|
|
349
|
+
var bundleDest = _flatMapInstanceProperty__default["default"](dest).call(dest, function (path) {
|
|
336
350
|
return _mapInstanceProperty__default["default"](dirs).call(dirs, function (dir) {
|
|
337
|
-
return
|
|
351
|
+
return node_path.join(dir, path);
|
|
338
352
|
});
|
|
339
353
|
});
|
|
340
|
-
|
|
341
354
|
return _objectSpread$1(_objectSpread$1({}, target), {}, {
|
|
342
355
|
dest: bundleDest
|
|
343
356
|
});
|
|
344
357
|
};
|
|
345
358
|
}
|
|
346
|
-
|
|
347
359
|
var injectCSS = true;
|
|
348
360
|
var minimize = true;
|
|
349
361
|
var transpile = true;
|
|
350
|
-
|
|
351
362
|
var generateRollupPluginArray = function generateRollupPluginArray(libraryFilename, assets, copyTargetsBundle, copyTargetsVariant, tsconfig, mode, bundleType) {
|
|
352
363
|
var _context7, _context8, _context9, _context10;
|
|
353
|
-
|
|
354
364
|
var _ref4 = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {},
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
365
|
+
_ref4$injectCSS = _ref4.injectCSS,
|
|
366
|
+
injectCSS = _ref4$injectCSS === void 0 ? false : _ref4$injectCSS,
|
|
367
|
+
_ref4$minimize = _ref4.minimize,
|
|
368
|
+
minimize = _ref4$minimize === void 0 ? false : _ref4$minimize,
|
|
369
|
+
_ref4$strip = _ref4.strip,
|
|
370
|
+
strip = _ref4$strip === void 0 ? mode === "production" : _ref4$strip,
|
|
371
|
+
_ref4$transpile = _ref4.transpile,
|
|
372
|
+
transpile = _ref4$transpile === void 0 ? false : _ref4$transpile,
|
|
373
|
+
_ref4$typescript = _ref4.typescript,
|
|
374
|
+
typescript = _ref4$typescript === void 0 ? false : _ref4$typescript;
|
|
366
375
|
var fullLibraryFilename = _concatInstanceProperty__default["default"](_context7 = "".concat(libraryFilename)).call(_context7, minimize ? ".min" : "");
|
|
367
|
-
|
|
368
376
|
var bundleDir = bundleType;
|
|
369
|
-
|
|
370
377
|
var bundleVariantDirs = _mapInstanceProperty__default["default"](_context8 = ["esm", "umd"]).call(_context8, function (variant) {
|
|
371
|
-
return
|
|
378
|
+
return node_path.join(bundleDir, variant);
|
|
372
379
|
});
|
|
373
|
-
|
|
374
|
-
|
|
380
|
+
return _concatInstanceProperty__default["default"](_context9 = []).call(_context9, _toConsumableArray__default["default"](strip ? [
|
|
381
|
+
// This should be first because it removes code from source files.
|
|
375
382
|
// It's much easier to follow if the removal happens before any
|
|
376
383
|
// transformations.
|
|
377
384
|
stripCodePlugin__default["default"]({
|
|
378
385
|
start_comment: "develblock:start",
|
|
379
386
|
end_comment: "develblock:end"
|
|
380
|
-
})] : [
|
|
387
|
+
})] : [
|
|
388
|
+
// Remove the comments marking devel blocks as they can cause problems
|
|
381
389
|
// later on because transpilation shuffles things around which may
|
|
382
390
|
// lead to all kinds of issues including syntax errors.
|
|
383
391
|
stripCodePlugin__default["default"]({
|
|
@@ -387,32 +395,34 @@ var generateRollupPluginArray = function generateRollupPluginArray(libraryFilena
|
|
|
387
395
|
summaryOnly: true
|
|
388
396
|
}), copyPlugin__default["default"]({
|
|
389
397
|
verbose: VIS_DEBUG,
|
|
390
|
-
targets: _concatInstanceProperty__default["default"](_context10 = [
|
|
398
|
+
targets: _concatInstanceProperty__default["default"](_context10 = [
|
|
399
|
+
// JavaScript
|
|
391
400
|
{
|
|
392
|
-
src:
|
|
401
|
+
src: node_path.resolve(__dirname, "assets/bundle-root.js"),
|
|
393
402
|
dest: bundleDir,
|
|
394
403
|
rename: "index.js"
|
|
395
404
|
}, {
|
|
396
|
-
src:
|
|
405
|
+
src: node_path.resolve(__dirname, "assets/bundle-index.js"),
|
|
397
406
|
dest: bundleVariantDirs,
|
|
398
407
|
rename: "index.js",
|
|
399
408
|
transform: function transform(content) {
|
|
400
409
|
return content.toString().replace("{{filename}}", libraryFilename);
|
|
401
410
|
}
|
|
402
|
-
},
|
|
411
|
+
},
|
|
412
|
+
// TypeScript
|
|
403
413
|
{
|
|
404
|
-
src:
|
|
414
|
+
src: node_path.resolve(__dirname, "assets/bundle-root.d.ts"),
|
|
405
415
|
dest: bundleDir,
|
|
406
416
|
rename: "index.d.ts"
|
|
407
417
|
}, {
|
|
408
|
-
src:
|
|
418
|
+
src: node_path.resolve(__dirname, "assets/bundle-index.d.ts"),
|
|
409
419
|
dest: bundleVariantDirs,
|
|
410
420
|
rename: "index.d.ts",
|
|
411
421
|
transform: function transform(content) {
|
|
412
422
|
return content.toString().replace("{{filename}}", libraryFilename);
|
|
413
423
|
}
|
|
414
424
|
}, {
|
|
415
|
-
src:
|
|
425
|
+
src: node_path.resolve(__dirname, "assets/bundle-file.d.ts"),
|
|
416
426
|
dest: bundleVariantDirs,
|
|
417
427
|
rename: "".concat(fullLibraryFilename, ".d.ts"),
|
|
418
428
|
transform: function transform(content) {
|
|
@@ -477,235 +487,265 @@ var generateRollupPluginArray = function generateRollupPluginArray(libraryFilena
|
|
|
477
487
|
* @returns Ready to use configuration object that can be just exported from
|
|
478
488
|
* `rollup.config.js` or mutated in any way if necessary.
|
|
479
489
|
*/
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
_ref5$assets
|
|
489
|
-
assets
|
|
490
|
-
_ref5$copyTargets
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
_ref5$
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
490
|
+
function generateRollupConfiguration(_x2) {
|
|
491
|
+
return _generateRollupConfiguration.apply(this, arguments);
|
|
492
|
+
}
|
|
493
|
+
function _generateRollupConfiguration() {
|
|
494
|
+
_generateRollupConfiguration = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(options) {
|
|
495
|
+
var _context15, _context18, _context19, _context20, _context21, _context22, _context23;
|
|
496
|
+
var mode,
|
|
497
|
+
_ref5,
|
|
498
|
+
_ref5$assets,
|
|
499
|
+
assets,
|
|
500
|
+
_ref5$copyTargets,
|
|
501
|
+
_ref5$copyTargets2,
|
|
502
|
+
_ref5$copyTargets2$bu,
|
|
503
|
+
copyTargetsBundle,
|
|
504
|
+
_ref5$copyTargets2$va,
|
|
505
|
+
copyTargetsVariant,
|
|
506
|
+
_ref5$externalForPeer,
|
|
507
|
+
externalForPeerBuild,
|
|
508
|
+
_ref5$globals,
|
|
509
|
+
globals,
|
|
510
|
+
_ref5$header,
|
|
511
|
+
header,
|
|
512
|
+
_ref5$libraryFilename,
|
|
513
|
+
libraryFilename,
|
|
514
|
+
_ref5$packageJSON,
|
|
515
|
+
_ref5$packageJSON2,
|
|
516
|
+
_ref5$packageJSON2$de,
|
|
517
|
+
dependencies,
|
|
518
|
+
_ref5$packageJSON2$de2,
|
|
519
|
+
devDependencies,
|
|
520
|
+
_ref5$packageJSON2$pe,
|
|
521
|
+
peerDependencies,
|
|
522
|
+
packageJSONRest,
|
|
523
|
+
_ref5$entryPoints,
|
|
524
|
+
entryPoint,
|
|
525
|
+
_ref5$tsconfig,
|
|
526
|
+
tsconfig,
|
|
527
|
+
_yield$Promise$all,
|
|
528
|
+
_yield$Promise$all2,
|
|
529
|
+
esnextEntry,
|
|
530
|
+
peerEntry,
|
|
531
|
+
standaloneEntry,
|
|
532
|
+
banner,
|
|
533
|
+
external,
|
|
534
|
+
commonOutput,
|
|
535
|
+
commonOutputESM,
|
|
536
|
+
commonOutputUMD,
|
|
537
|
+
getPlugins,
|
|
538
|
+
_args3 = arguments;
|
|
539
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context24) {
|
|
540
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
541
|
+
case 0:
|
|
542
|
+
mode = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : VIS_TEST ? "test" : VIS_DEBUG ? "development" : "production";
|
|
543
|
+
_ref5 = options || {}, _ref5$assets = _ref5.assets, assets = _ref5$assets === void 0 ? "." : _ref5$assets, _ref5$copyTargets = _ref5.copyTargets, _ref5$copyTargets2 = _ref5$copyTargets === void 0 ? {} : _ref5$copyTargets, _ref5$copyTargets2$bu = _ref5$copyTargets2.bundle, copyTargetsBundle = _ref5$copyTargets2$bu === void 0 ? [] : _ref5$copyTargets2$bu, _ref5$copyTargets2$va = _ref5$copyTargets2.variant, copyTargetsVariant = _ref5$copyTargets2$va === void 0 ? [] : _ref5$copyTargets2$va, _ref5$externalForPeer = _ref5.externalForPeerBuild, externalForPeerBuild = _ref5$externalForPeer === void 0 ? [] : _ref5$externalForPeer, _ref5$globals = _ref5.globals, globals = _ref5$globals === void 0 ? {} : _ref5$globals, _ref5$header = _ref5.header, header = _ref5$header === void 0 ? {
|
|
544
|
+
name: "Unknown Library"
|
|
545
|
+
} : _ref5$header, _ref5$libraryFilename = _ref5.libraryFilename, libraryFilename = _ref5$libraryFilename === void 0 ? "unknown-library" : _ref5$libraryFilename, _ref5$packageJSON = _ref5.packageJSON, _ref5$packageJSON2 = _ref5$packageJSON === void 0 ? {} : _ref5$packageJSON, _ref5$packageJSON2$de = _ref5$packageJSON2.dependencies, dependencies = _ref5$packageJSON2$de === void 0 ? {} : _ref5$packageJSON2$de, _ref5$packageJSON2$de2 = _ref5$packageJSON2.devDependencies, devDependencies = _ref5$packageJSON2$de2 === void 0 ? {} : _ref5$packageJSON2$de2, _ref5$packageJSON2$pe = _ref5$packageJSON2.peerDependencies, peerDependencies = _ref5$packageJSON2$pe === void 0 ? {} : _ref5$packageJSON2$pe, packageJSONRest = _objectWithoutProperties__default["default"](_ref5$packageJSON2, _excluded), _ref5$entryPoints = _ref5.entryPoints, entryPoint = _ref5$entryPoints === void 0 ? "./src" : _ref5$entryPoints, _ref5$tsconfig = _ref5.tsconfig, tsconfig = _ref5$tsconfig === void 0 ? "tsconfig.json" : _ref5$tsconfig;
|
|
546
|
+
validate(function (expect) {
|
|
547
|
+
// Note: Every array is a superset of empty array.
|
|
548
|
+
if (_Object$keys__default["default"](peerDependencies).length > 0) {
|
|
549
|
+
expect(_Object$keys__default["default"](dependencies), "The dependencies and peer dependencies have to be disjoint sets").to.be.an("array").that.does.not.include.any.members(_Object$keys__default["default"](peerDependencies));
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
validate(function (expect) {
|
|
553
|
+
_includesInstanceProperty__default["default"](expect(_Object$keys__default["default"](devDependencies), "For convenience all peer dependencies also have to be dev dependencies").to.be.an("array").that).all.members(_Object$keys__default["default"](peerDependencies));
|
|
554
|
+
});
|
|
555
|
+
validate(function (expect) {
|
|
556
|
+
_includesInstanceProperty__default["default"](expect(_Object$keys__default["default"](peerDependencies), "Peer build externals have to be a subset of peer dependencies").to.be.an("array").that).all.members(externalForPeerBuild);
|
|
557
|
+
});
|
|
558
|
+
validate(function (expect) {
|
|
559
|
+
var _context12, _context13, _context14;
|
|
560
|
+
expect(_sortInstanceProperty__default["default"](_context12 = _concatInstanceProperty__default["default"](_context13 = []).call(_context13, _toConsumableArray__default["default"](_Object$keys__default["default"](dependencies)), _toConsumableArray__default["default"](_Object$keys__default["default"](peerDependencies)))).call(_context12), "Globals have to be provided for all runtime and peer dependencies but nothing else").to.be.an("array").that.deep.equals(_sortInstanceProperty__default["default"](_context14 = _Object$keys__default["default"](globals)).call(_context14));
|
|
561
|
+
});
|
|
562
|
+
validate(function (expect) {
|
|
563
|
+
expect(node_path.resolve(assets), "Assets have to be a directory").to.be.a("string").and.a.directory();
|
|
564
|
+
});
|
|
565
|
+
validate(function (expect) {
|
|
566
|
+
expect(entryPoint, "The entry point has to be directory").to.be.a("string").and.a.directory();
|
|
567
|
+
});
|
|
568
|
+
_context24.next = 10;
|
|
569
|
+
return _Promise__default["default"].all(_mapInstanceProperty__default["default"](_context15 = ["ESNext", "peer", "standalone"]).call(_context15, /*#__PURE__*/function () {
|
|
570
|
+
var _ref6 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(name) {
|
|
571
|
+
var filenameGlob, files;
|
|
572
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context17) {
|
|
573
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
574
|
+
case 0:
|
|
575
|
+
filenameGlob = "entry-".concat(name.toLowerCase(), ".{js,ts}");
|
|
576
|
+
_context17.next = 3;
|
|
577
|
+
return glob(node_path.resolve(entryPoint, filenameGlob));
|
|
578
|
+
case 3:
|
|
579
|
+
files = _context17.sent;
|
|
580
|
+
validate(function (expect) {
|
|
581
|
+
var _context16;
|
|
582
|
+
expect(files, _concatInstanceProperty__default["default"](_context16 = "There has to be a single entry file (".concat(filenameGlob, ") for the ")).call(_context16, name, " build")).to.have.lengthOf(1).and.to.have.ownProperty("0").that.is.a.file();
|
|
583
|
+
});
|
|
584
|
+
return _context17.abrupt("return", files[0]);
|
|
585
|
+
case 6:
|
|
586
|
+
case "end":
|
|
587
|
+
return _context17.stop();
|
|
588
|
+
}
|
|
589
|
+
}, _callee2);
|
|
590
|
+
}));
|
|
591
|
+
return function (_x3) {
|
|
592
|
+
return _ref6.apply(this, arguments);
|
|
593
|
+
};
|
|
594
|
+
}()));
|
|
595
|
+
case 10:
|
|
596
|
+
_yield$Promise$all = _context24.sent;
|
|
597
|
+
_yield$Promise$all2 = _slicedToArray__default["default"](_yield$Promise$all, 3);
|
|
598
|
+
esnextEntry = _yield$Promise$all2[0];
|
|
599
|
+
peerEntry = _yield$Promise$all2[1];
|
|
600
|
+
standaloneEntry = _yield$Promise$all2[2];
|
|
601
|
+
validate(function (expect) {
|
|
602
|
+
expect(node_path.resolve("./declarations"), "There has to be a directory with TypeScript declarations").to.be.a("string").and.a.directory();
|
|
603
|
+
});
|
|
604
|
+
validate(function (expect) {
|
|
605
|
+
_includesInstanceProperty__default["default"](expect(packageJSONRest, "The directories with built files have to be included in the package").to.have.ownProperty("files").that.is.an("array").and).all.members(["declarations", "esnext", "peer", "standalone"]);
|
|
606
|
+
});
|
|
607
|
+
validate(function (expect) {
|
|
608
|
+
expect(packageJSONRest, "Package JSON's type property has to point to the declarations").to.have.ownProperty("types").that.is.a("string").and.equals("declarations/index.d.ts");
|
|
609
|
+
});
|
|
610
|
+
validate(function (expect) {
|
|
611
|
+
expect(packageJSONRest, "Package JSON's browser property has to point to the minifed UMD build").to.have.ownProperty("browser").that.is.a("string").and.equals("peer/umd/".concat(libraryFilename, ".min.js"));
|
|
612
|
+
});
|
|
613
|
+
validate(function (expect) {
|
|
614
|
+
expect(packageJSONRest, "Package JSON's main property has to point to the UMD build").to.have.ownProperty("main").that.is.a("string").and.equals("peer/umd/".concat(libraryFilename, ".js"));
|
|
615
|
+
});
|
|
616
|
+
validate(function (expect) {
|
|
617
|
+
expect(packageJSONRest, "Package JSON's modul property has to point to the ESM build").to.have.ownProperty("module").that.is.a("string").and.equals("peer/esm/".concat(libraryFilename, ".js"));
|
|
618
|
+
});
|
|
619
|
+
validate(function (expect) {
|
|
620
|
+
expect(packageJSONRest, "Package JSON's jsnext has to point to the ESNext build").to.have.ownProperty("jsnext").that.is.a("string").and.equals("esnext/esm/".concat(libraryFilename, ".js"));
|
|
621
|
+
});
|
|
622
|
+
// Note: .to.not.exist sounds great but doesn't work.
|
|
623
|
+
validate(function (expect) {
|
|
624
|
+
expect(node_path.resolve("./.babelrc"), "Babelrc is ignored. Use babel.config.js config file instead.").to.not.be.a.path;
|
|
625
|
+
});
|
|
626
|
+
validate(function (expect) {
|
|
627
|
+
expect(node_path.resolve("./babel.config.js"), "There has to be a babel.config.js config file.").to.not.be.a.path;
|
|
628
|
+
});
|
|
629
|
+
banner = generateHeader(header);
|
|
630
|
+
external = {
|
|
631
|
+
// No dependencies are bundled.
|
|
632
|
+
esnext: processDependencies(_concatInstanceProperty__default["default"](_context18 = []).call(_context18, _toConsumableArray__default["default"](_Object$keys__default["default"](dependencies)), _toConsumableArray__default["default"](_Object$keys__default["default"](peerDependencies)), _toConsumableArray__default["default"](_Object$keys__default["default"](devDependencies)))),
|
|
633
|
+
// Only dependencies that cause compatibility issues are not bundled.
|
|
634
|
+
peer: processDependencies(externalForPeerBuild),
|
|
635
|
+
// No runtime dependencies, everything's bundled.
|
|
636
|
+
standalone: []
|
|
637
|
+
};
|
|
638
|
+
commonOutput = {
|
|
639
|
+
banner: banner,
|
|
640
|
+
dir: ".",
|
|
641
|
+
globals: processGlobals(globals),
|
|
642
|
+
sourcemap: VIS_TEST ? "inline" : true
|
|
643
|
+
};
|
|
644
|
+
commonOutputESM = _objectSpread$1(_objectSpread$1({}, commonOutput), {}, {
|
|
645
|
+
format: "esm"
|
|
646
|
+
});
|
|
647
|
+
commonOutputUMD = _objectSpread$1(_objectSpread$1({}, commonOutput), {}, {
|
|
648
|
+
exports: "named",
|
|
649
|
+
extend: true,
|
|
650
|
+
format: "umd",
|
|
651
|
+
name: "vis",
|
|
652
|
+
strict: false // Regenerator runtime causes issues with CSP in strict mode.
|
|
653
|
+
}); // Note: Binding more than 4 at a time is not typesafe in TS.
|
|
654
|
+
getPlugins = _bindInstanceProperty__default["default"](_context19 = _bindInstanceProperty__default["default"](_context20 = _bindInstanceProperty__default["default"](_context21 = _bindInstanceProperty__default["default"](_context22 = _bindInstanceProperty__default["default"](_context23 = _bindInstanceProperty__default["default"](generateRollupPluginArray).call(generateRollupPluginArray, null, libraryFilename)).call(_context23, null, assets)).call(_context22, null, copyTargetsBundle)).call(_context21, null, copyTargetsVariant)).call(_context20, null, tsconfig)).call(_context19, null, mode);
|
|
655
|
+
return _context24.abrupt("return", [{
|
|
656
|
+
external: external.standalone,
|
|
657
|
+
input: standaloneEntry,
|
|
658
|
+
output: [_objectSpread$1(_objectSpread$1({}, commonOutputESM), {}, {
|
|
659
|
+
entryFileNames: "standalone/esm/".concat(libraryFilename, ".js")
|
|
660
|
+
}), _objectSpread$1(_objectSpread$1({}, commonOutputUMD), {}, {
|
|
661
|
+
entryFileNames: "standalone/umd/".concat(libraryFilename, ".js")
|
|
662
|
+
})],
|
|
663
|
+
plugins: getPlugins("standalone", {
|
|
664
|
+
injectCSS: injectCSS,
|
|
665
|
+
transpile: transpile,
|
|
666
|
+
typescript: isTS(standaloneEntry)
|
|
667
|
+
})
|
|
668
|
+
}, {
|
|
669
|
+
external: external.standalone,
|
|
670
|
+
input: standaloneEntry,
|
|
671
|
+
output: [_objectSpread$1(_objectSpread$1({}, commonOutputESM), {}, {
|
|
672
|
+
entryFileNames: "standalone/esm/".concat(libraryFilename, ".min.js")
|
|
673
|
+
}), _objectSpread$1(_objectSpread$1({}, commonOutputUMD), {}, {
|
|
674
|
+
entryFileNames: "standalone/umd/".concat(libraryFilename, ".min.js")
|
|
675
|
+
})],
|
|
676
|
+
plugins: getPlugins("standalone", {
|
|
677
|
+
injectCSS: injectCSS,
|
|
678
|
+
minimize: minimize,
|
|
679
|
+
transpile: transpile,
|
|
680
|
+
typescript: isTS(standaloneEntry)
|
|
681
|
+
})
|
|
682
|
+
}, {
|
|
683
|
+
external: external.peer,
|
|
684
|
+
input: peerEntry,
|
|
685
|
+
output: [_objectSpread$1(_objectSpread$1({}, commonOutputESM), {}, {
|
|
686
|
+
entryFileNames: "peer/esm/".concat(libraryFilename, ".js"),
|
|
687
|
+
paths: getPaths("peer", "esm")
|
|
688
|
+
}), _objectSpread$1(_objectSpread$1({}, commonOutputUMD), {}, {
|
|
689
|
+
entryFileNames: "peer/umd/".concat(libraryFilename, ".js"),
|
|
690
|
+
paths: getPaths("peer", "umd")
|
|
691
|
+
})],
|
|
692
|
+
plugins: getPlugins("peer", {
|
|
693
|
+
transpile: transpile,
|
|
694
|
+
typescript: isTS(peerEntry)
|
|
695
|
+
})
|
|
696
|
+
}, {
|
|
697
|
+
external: external.peer,
|
|
698
|
+
input: peerEntry,
|
|
699
|
+
output: [_objectSpread$1(_objectSpread$1({}, commonOutputESM), {}, {
|
|
700
|
+
entryFileNames: "peer/esm/".concat(libraryFilename, ".min.js"),
|
|
701
|
+
paths: getPaths("peer", "esm")
|
|
702
|
+
}), _objectSpread$1(_objectSpread$1({}, commonOutputUMD), {}, {
|
|
703
|
+
entryFileNames: "peer/umd/".concat(libraryFilename, ".min.js"),
|
|
704
|
+
paths: getPaths("peer", "umd")
|
|
705
|
+
})],
|
|
706
|
+
plugins: getPlugins("peer", {
|
|
707
|
+
minimize: minimize,
|
|
708
|
+
transpile: transpile,
|
|
709
|
+
typescript: isTS(peerEntry)
|
|
710
|
+
})
|
|
711
|
+
}, {
|
|
712
|
+
external: external.esnext,
|
|
713
|
+
input: esnextEntry,
|
|
714
|
+
output: [_objectSpread$1(_objectSpread$1({}, commonOutputESM), {}, {
|
|
715
|
+
entryFileNames: "esnext/esm/".concat(libraryFilename, ".js"),
|
|
716
|
+
paths: getPaths("esnext", "esm")
|
|
717
|
+
}), _objectSpread$1(_objectSpread$1({}, commonOutputUMD), {}, {
|
|
718
|
+
entryFileNames: "esnext/umd/".concat(libraryFilename, ".js"),
|
|
719
|
+
paths: getPaths("esnext", "umd")
|
|
720
|
+
})],
|
|
721
|
+
plugins: getPlugins("esnext", {
|
|
722
|
+
typescript: isTS(esnextEntry)
|
|
723
|
+
})
|
|
724
|
+
}, {
|
|
725
|
+
external: external.esnext,
|
|
726
|
+
input: esnextEntry,
|
|
727
|
+
output: [_objectSpread$1(_objectSpread$1({}, commonOutputESM), {}, {
|
|
728
|
+
entryFileNames: "esnext/esm/".concat(libraryFilename, ".min.js"),
|
|
729
|
+
paths: getPaths("esnext", "esm")
|
|
730
|
+
}), _objectSpread$1(_objectSpread$1({}, commonOutputUMD), {}, {
|
|
731
|
+
entryFileNames: "esnext/umd/".concat(libraryFilename, ".min.js"),
|
|
732
|
+
paths: getPaths("esnext", "umd")
|
|
733
|
+
})],
|
|
734
|
+
plugins: getPlugins("esnext", {
|
|
735
|
+
minimize: minimize,
|
|
736
|
+
typescript: isTS(esnextEntry)
|
|
737
|
+
})
|
|
738
|
+
}]);
|
|
739
|
+
case 31:
|
|
740
|
+
case "end":
|
|
741
|
+
return _context24.stop();
|
|
742
|
+
}
|
|
743
|
+
}, _callee3);
|
|
744
|
+
}));
|
|
745
|
+
return _generateRollupConfiguration.apply(this, arguments);
|
|
705
746
|
}
|
|
706
747
|
|
|
707
748
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
708
|
-
|
|
709
749
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context8, _context9; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(source), !0)).call(_context8, function (key) { _defineProperty__default["default"](target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context9 = ownKeys(Object(source))).call(_context9, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
710
750
|
tmpPromise.setGracefulCleanup();
|
|
711
751
|
var PACK_CMD = ["npm", "pack", "--dry-run"];
|
|
@@ -713,7 +753,6 @@ var PACK_CMD = ["npm", "pack", "--dry-run"];
|
|
|
713
753
|
* @param textOrLines
|
|
714
754
|
* @param message
|
|
715
755
|
*/
|
|
716
|
-
|
|
717
756
|
function logStderr(textOrLines, message) {
|
|
718
757
|
console.group('"npm pack" output');
|
|
719
758
|
console.error(_Array$isArray__default["default"](textOrLines) ? textOrLines.join("\n") : textOrLines);
|
|
@@ -723,40 +762,31 @@ function logStderr(textOrLines, message) {
|
|
|
723
762
|
/**
|
|
724
763
|
*
|
|
725
764
|
*/
|
|
726
|
-
|
|
727
|
-
|
|
728
765
|
function runNpmPack() {
|
|
729
766
|
var _context;
|
|
730
|
-
|
|
731
|
-
|
|
767
|
+
var tmpFile = tmpPromise.fileSync().name;
|
|
768
|
+
// There are issues with incomplete output when the stderr is read directly
|
|
732
769
|
// into Node. Saving it into tmp file using shell redirection and reading it
|
|
733
770
|
// from there doesn't exhibit those issues.
|
|
734
|
-
|
|
735
|
-
child_process.execSync(_concatInstanceProperty__default["default"](_context = "".concat(PACK_CMD.join(" "), " 2> ")).call(_context, tmpFile), {
|
|
771
|
+
node_child_process.execSync(_concatInstanceProperty__default["default"](_context = "".concat(PACK_CMD.join(" "), " 2> ")).call(_context, tmpFile), {
|
|
736
772
|
encoding: "utf-8",
|
|
737
773
|
env: _objectSpread(_objectSpread({}, process.env), {}, {
|
|
738
774
|
LC_ALL: "C"
|
|
739
775
|
})
|
|
740
776
|
});
|
|
741
|
-
var lines =
|
|
777
|
+
var lines = node_fs.readFileSync(tmpFile, "utf-8").split(/[\r\n]+/);
|
|
742
778
|
return lines;
|
|
743
779
|
}
|
|
744
780
|
/**
|
|
745
781
|
* @param lines
|
|
746
782
|
*/
|
|
747
|
-
|
|
748
|
-
|
|
749
783
|
function extractFiles(lines) {
|
|
750
784
|
var _context2, _context3, _context4, _context5, _context6;
|
|
751
|
-
|
|
752
785
|
var fileListingStart = _indexOfInstanceProperty__default["default"](lines).call(lines, "npm notice === Tarball Contents === ");
|
|
753
|
-
|
|
754
786
|
var fileListingEnd = _indexOfInstanceProperty__default["default"](lines).call(lines, "npm notice === Tarball Details === ");
|
|
755
|
-
|
|
756
787
|
if (fileListingStart === -1 || fileListingEnd === -1) {
|
|
757
788
|
logStderr(lines.join("\n"), 'Couldn\'t find tarball contents in "npm pack" output.');
|
|
758
789
|
}
|
|
759
|
-
|
|
760
790
|
var files = _mapInstanceProperty__default["default"](_context2 = _sortInstanceProperty__default["default"](_context3 = _mapInstanceProperty__default["default"](_context4 = _mapInstanceProperty__default["default"](_context5 = _mapInstanceProperty__default["default"](_context6 = _sliceInstanceProperty__default["default"](lines).call(lines, fileListingStart + 1, fileListingEnd)).call(_context6, function (line) {
|
|
761
791
|
return line.replace(/^npm notice /, "");
|
|
762
792
|
})).call(_context5, function (line) {
|
|
@@ -764,40 +794,31 @@ function extractFiles(lines) {
|
|
|
764
794
|
})).call(_context4, function (line) {
|
|
765
795
|
return line.replace(/^([^ ]+) +(.*)/, function (_, size, path) {
|
|
766
796
|
var _context7;
|
|
767
|
-
|
|
768
797
|
return _concatInstanceProperty__default["default"](_context7 = "".concat(path)).call(_context7, size === "0" ? "(empty)" : " ");
|
|
769
798
|
});
|
|
770
799
|
})).call(_context3)).call(_context2, function (line) {
|
|
771
800
|
return line.replace(/^(.*)(.{7})$/, "$2 $1");
|
|
772
801
|
});
|
|
773
|
-
|
|
774
802
|
if (files.length === 0) {
|
|
775
803
|
logStderr(lines, 'No files found in "npm pack" output.');
|
|
776
804
|
}
|
|
777
|
-
|
|
778
805
|
return files;
|
|
779
806
|
}
|
|
780
807
|
/**
|
|
781
808
|
* @param lines
|
|
782
809
|
*/
|
|
783
|
-
|
|
784
|
-
|
|
785
810
|
function extractName(lines) {
|
|
786
811
|
var nameLine = _findInstanceProperty__default["default"](lines).call(lines, function (line) {
|
|
787
812
|
return /^npm notice name:/.test(line);
|
|
788
813
|
});
|
|
789
|
-
|
|
790
814
|
if (nameLine == null) {
|
|
791
815
|
logStderr(lines, 'Can\'t find the name of the package in "npm pack" output.');
|
|
792
816
|
}
|
|
793
|
-
|
|
794
817
|
return nameLine.replace(/^npm notice name: */, "");
|
|
795
818
|
}
|
|
796
819
|
/**
|
|
797
820
|
*
|
|
798
821
|
*/
|
|
799
|
-
|
|
800
|
-
|
|
801
822
|
function inspectNpmPack() {
|
|
802
823
|
var lines = runNpmPack();
|
|
803
824
|
var files = extractFiles(lines);
|