vis-dev-utils 3.0.117 → 3.0.119
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 +2 -7
- package/babel-register/index.js.map +1 -1
- package/bin/ci-utils.js +2 -6
- package/bin/ci-utils.js.map +1 -1
- package/bin/generate-examples-index.js +72 -326
- package/bin/generate-examples-index.js.map +1 -1
- package/bin/test-e2e-interop.js +14 -234
- package/bin/test-e2e-interop.js.map +1 -1
- package/dist/vis-dev-utils.cjs.js +96 -163
- package/dist/vis-dev-utils.cjs.js.map +1 -1
- package/dist/vis-dev-utils.esm.js +96 -163
- package/dist/vis-dev-utils.esm.js.map +1 -1
- package/package.json +6 -6
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Development utilities for the Vis family projects.
|
|
6
6
|
*
|
|
7
|
-
* @version 3.0.
|
|
8
|
-
* @date
|
|
7
|
+
* @version 3.0.119
|
|
8
|
+
* @date 2023-02-15T13:55:48.580Z
|
|
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
|
|
@@ -84,40 +84,40 @@ var BABEL_IGNORE_RE = _Object$freeze(/[\\/]node_modules[\\/](?!.*[\\/]esnext[\\/
|
|
|
84
84
|
* @returns A block doc comment string that can be for example prepended to a
|
|
85
85
|
* bundled JavaScript file.
|
|
86
86
|
*/
|
|
87
|
-
|
|
88
87
|
function textToComment(string) {
|
|
89
88
|
var _context, _context2;
|
|
90
|
-
|
|
91
89
|
if (_includesInstanceProperty(string).call(string, "*/")) {
|
|
92
90
|
throw new Error("Don't include comments in the input string. It will be converted automatically.");
|
|
93
91
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
.replace(/^[\n\r]*/, "")
|
|
97
|
-
|
|
98
|
-
.
|
|
92
|
+
return "/**\n" + _mapInstanceProperty(_context = _mapInstanceProperty(_context2 = string
|
|
93
|
+
// Remove empty lines from the start.
|
|
94
|
+
.replace(/^[\n\r]*/, "")
|
|
95
|
+
// Remove empty lines from the end.
|
|
96
|
+
.replace(/[\n\r\s]*$/, "")
|
|
97
|
+
// Process each line on it's own from now on.
|
|
98
|
+
.split("\n")
|
|
99
|
+
// Prefix each line with an asterisk.
|
|
99
100
|
).call(_context2, function (line) {
|
|
100
101
|
return " * " + line;
|
|
101
|
-
})
|
|
102
|
+
})
|
|
103
|
+
// Remove trailing white space.
|
|
102
104
|
).call(_context, function (line) {
|
|
103
105
|
return line.replace(/[^\S\r\n]*$/, "");
|
|
104
|
-
})
|
|
106
|
+
})
|
|
107
|
+
// Join back into a string.
|
|
105
108
|
.join("\n") + "\n */\n";
|
|
106
109
|
}
|
|
107
110
|
var packageJSON = JSON.parse(readFileSync(sync("package.json"), "utf8"));
|
|
108
|
-
|
|
109
111
|
var buildHeader = function buildHeader(_ref) {
|
|
110
112
|
var _context3, _context4, _context5, _context6, _context7;
|
|
111
|
-
|
|
112
113
|
var customText = _ref.customText,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
date = _ref.date,
|
|
115
|
+
description = _ref.description,
|
|
116
|
+
homepage = _ref.homepage,
|
|
117
|
+
name = _ref.name,
|
|
118
|
+
version = _ref.version;
|
|
118
119
|
return textToComment(_concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _concatInstanceProperty(_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"));
|
|
119
120
|
};
|
|
120
|
-
|
|
121
121
|
var defaultDate = new Date().toISOString();
|
|
122
122
|
var defaultDescription = packageJSON.description;
|
|
123
123
|
var defaultHomepage = packageJSON.homepage;
|
|
@@ -133,22 +133,20 @@ var defaultVersion = packageJSON.version;
|
|
|
133
133
|
* @throws If the string already contains a comment.
|
|
134
134
|
* @returns Ready to use banner text.
|
|
135
135
|
*/
|
|
136
|
-
|
|
137
136
|
function generateHeader(options) {
|
|
138
137
|
var _ref2 = options || {},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
138
|
+
_ref2$customText = _ref2.customText,
|
|
139
|
+
customText = _ref2$customText === void 0 ? "" : _ref2$customText,
|
|
140
|
+
_ref2$date = _ref2.date,
|
|
141
|
+
date = _ref2$date === void 0 ? defaultDate : _ref2$date,
|
|
142
|
+
_ref2$description = _ref2.description,
|
|
143
|
+
description = _ref2$description === void 0 ? defaultDescription : _ref2$description,
|
|
144
|
+
_ref2$homepage = _ref2.homepage,
|
|
145
|
+
homepage = _ref2$homepage === void 0 ? defaultHomepage : _ref2$homepage,
|
|
146
|
+
_ref2$name = _ref2.name,
|
|
147
|
+
name = _ref2$name === void 0 ? defaultName : _ref2$name,
|
|
148
|
+
_ref2$version = _ref2.version,
|
|
149
|
+
version = _ref2$version === void 0 ? defaultVersion : _ref2$version;
|
|
152
150
|
return buildHeader({
|
|
153
151
|
customText: customText,
|
|
154
152
|
date: date,
|
|
@@ -160,17 +158,12 @@ function generateHeader(options) {
|
|
|
160
158
|
}
|
|
161
159
|
|
|
162
160
|
var _excluded = ["dependencies", "devDependencies", "peerDependencies"];
|
|
163
|
-
|
|
164
161
|
var _context, _context2;
|
|
165
|
-
|
|
166
162
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
167
|
-
|
|
168
163
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context22, _context23; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context22 = ownKeys$1(Object(source), !0)).call(_context22, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context23 = ownKeys$1(Object(source))).call(_context23, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
169
164
|
config.truncateThreshold = _Number$MAX_SAFE_INTEGER;
|
|
170
165
|
use(chaiFs);
|
|
171
|
-
|
|
172
166
|
var VIS_DEBUG = _includesInstanceProperty(_context = ["1", "true", "y", "yes"]).call(_context, process.env["VIS_DEBUG"] || "false");
|
|
173
|
-
|
|
174
167
|
var VIS_TEST = _includesInstanceProperty(_context2 = ["1", "true", "y", "yes"]).call(_context2, process.env["VIS_TEST"] || "false");
|
|
175
168
|
/**
|
|
176
169
|
* Simple glob with workaround for non-posix paths.
|
|
@@ -178,8 +171,6 @@ var VIS_TEST = _includesInstanceProperty(_context2 = ["1", "true", "y", "yes"]).
|
|
|
178
171
|
* @param pattern - Single glob pattern.
|
|
179
172
|
* @returns Globbed paths.
|
|
180
173
|
*/
|
|
181
|
-
|
|
182
|
-
|
|
183
174
|
function glob(pattern) {
|
|
184
175
|
return sync$1(sep === "\\" ? pattern.replace(/\\/g, "/") : pattern);
|
|
185
176
|
}
|
|
@@ -187,8 +178,6 @@ function glob(pattern) {
|
|
|
187
178
|
* These are the dependencies that follow standalone/peer/ESNext export
|
|
188
179
|
* structure.
|
|
189
180
|
*/
|
|
190
|
-
|
|
191
|
-
|
|
192
181
|
var dependenciesWithVisExportStructure = ["vis-data", "vis-graph3d", "vis-network", "vis-timeline", "vis-util", "vis-uuid"];
|
|
193
182
|
/**
|
|
194
183
|
* This ensures that dependencies on Vis projects point to ESNext builds.
|
|
@@ -196,7 +185,6 @@ var dependenciesWithVisExportStructure = ["vis-data", "vis-graph3d", "vis-networ
|
|
|
196
185
|
* @param deps - The original dependencies as listed in package.json.
|
|
197
186
|
* @returns An array of dependencies for Rollup.
|
|
198
187
|
*/
|
|
199
|
-
|
|
200
188
|
function processDependencies(deps) {
|
|
201
189
|
var depNames = _Array$isArray(deps) ? deps : _Object$keys(deps);
|
|
202
190
|
return _flatMapInstanceProperty(depNames).call(depNames, function (key) {
|
|
@@ -211,16 +199,12 @@ function processDependencies(deps) {
|
|
|
211
199
|
* @param globals - The original globals.
|
|
212
200
|
* @returns Globals forcing the use of ESNext builds for Vis projects.
|
|
213
201
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
202
|
function processGlobals(globals) {
|
|
217
203
|
var _context3;
|
|
218
|
-
|
|
219
204
|
return _reduceInstanceProperty(_context3 = _Object$entries(globals)).call(_context3, function (acc, _ref) {
|
|
220
205
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
206
|
+
key = _ref2[0],
|
|
207
|
+
value = _ref2[1];
|
|
224
208
|
acc[_includesInstanceProperty(dependenciesWithVisExportStructure).call(dependenciesWithVisExportStructure, key) ? key + "/esnext" : key] = value;
|
|
225
209
|
return acc;
|
|
226
210
|
}, _Object$create(null));
|
|
@@ -228,8 +212,6 @@ function processGlobals(globals) {
|
|
|
228
212
|
/**
|
|
229
213
|
* @param path
|
|
230
214
|
*/
|
|
231
|
-
|
|
232
|
-
|
|
233
215
|
function isTS(path) {
|
|
234
216
|
return _endsWithInstanceProperty(path).call(path, ".ts");
|
|
235
217
|
}
|
|
@@ -237,8 +219,6 @@ function isTS(path) {
|
|
|
237
219
|
* Make sure that Chai doesn't throw and therefore stop execution on failed
|
|
238
220
|
* validations during debugging.
|
|
239
221
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
242
222
|
var validate = VIS_DEBUG ? function (callback) {
|
|
243
223
|
try {
|
|
244
224
|
callback(expect);
|
|
@@ -256,17 +236,14 @@ var validate = VIS_DEBUG ? function (callback) {
|
|
|
256
236
|
* @param moduleFormat - What kind of module system to use.
|
|
257
237
|
* @returns Path overrides for Rollup.
|
|
258
238
|
*/
|
|
259
|
-
|
|
260
239
|
function getPaths(buildVariant, moduleFormat) {
|
|
261
240
|
/**
|
|
262
241
|
* @param lib
|
|
263
242
|
*/
|
|
264
243
|
function getPath(lib) {
|
|
265
244
|
var _context4, _context5, _context6;
|
|
266
|
-
|
|
267
245
|
return _defineProperty({}, "vis-".concat(lib, "/esnext"), _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = "vis-".concat(lib, "/")).call(_context6, buildVariant, "/")).call(_context5, moduleFormat, "/vis-")).call(_context4, lib, ".js"));
|
|
268
246
|
}
|
|
269
|
-
|
|
270
247
|
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"));
|
|
271
248
|
}
|
|
272
249
|
/**
|
|
@@ -275,62 +252,52 @@ function getPaths(buildVariant, moduleFormat) {
|
|
|
275
252
|
* @param dirs - The directories there targets should be relative to.
|
|
276
253
|
* @returns A function that can be directly supplied to Array.map().
|
|
277
254
|
*/
|
|
278
|
-
|
|
279
|
-
|
|
280
255
|
function scopeCopyTarget() {
|
|
281
256
|
for (var _len = arguments.length, dirs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
282
257
|
dirs[_key] = arguments[_key];
|
|
283
258
|
}
|
|
284
|
-
|
|
285
259
|
return function (target) {
|
|
286
260
|
var dest = _Array$isArray(target.dest) ? target.dest : [target.dest];
|
|
287
|
-
|
|
288
261
|
var bundleDest = _flatMapInstanceProperty(dest).call(dest, function (path) {
|
|
289
262
|
return _mapInstanceProperty(dirs).call(dirs, function (dir) {
|
|
290
263
|
return join(dir, path);
|
|
291
264
|
});
|
|
292
265
|
});
|
|
293
|
-
|
|
294
266
|
return _objectSpread$1(_objectSpread$1({}, target), {}, {
|
|
295
267
|
dest: bundleDest
|
|
296
268
|
});
|
|
297
269
|
};
|
|
298
270
|
}
|
|
299
|
-
|
|
300
271
|
var injectCSS = true;
|
|
301
272
|
var minimize = true;
|
|
302
273
|
var transpile = true;
|
|
303
|
-
|
|
304
274
|
var generateRollupPluginArray = function generateRollupPluginArray(libraryFilename, assets, copyTargetsBundle, copyTargetsVariant, tsconfig, mode, bundleType) {
|
|
305
275
|
var _context7, _context8, _context9, _context10;
|
|
306
|
-
|
|
307
276
|
var _ref4 = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {},
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
277
|
+
_ref4$injectCSS = _ref4.injectCSS,
|
|
278
|
+
injectCSS = _ref4$injectCSS === void 0 ? false : _ref4$injectCSS,
|
|
279
|
+
_ref4$minimize = _ref4.minimize,
|
|
280
|
+
minimize = _ref4$minimize === void 0 ? false : _ref4$minimize,
|
|
281
|
+
_ref4$strip = _ref4.strip,
|
|
282
|
+
strip = _ref4$strip === void 0 ? mode === "production" : _ref4$strip,
|
|
283
|
+
_ref4$transpile = _ref4.transpile,
|
|
284
|
+
transpile = _ref4$transpile === void 0 ? false : _ref4$transpile,
|
|
285
|
+
_ref4$typescript = _ref4.typescript,
|
|
286
|
+
typescript = _ref4$typescript === void 0 ? false : _ref4$typescript;
|
|
319
287
|
var fullLibraryFilename = _concatInstanceProperty(_context7 = "".concat(libraryFilename)).call(_context7, minimize ? ".min" : "");
|
|
320
|
-
|
|
321
288
|
var bundleDir = bundleType;
|
|
322
|
-
|
|
323
289
|
var bundleVariantDirs = _mapInstanceProperty(_context8 = ["esm", "umd"]).call(_context8, function (variant) {
|
|
324
290
|
return join(bundleDir, variant);
|
|
325
291
|
});
|
|
326
|
-
|
|
327
|
-
|
|
292
|
+
return _concatInstanceProperty(_context9 = []).call(_context9, _toConsumableArray(strip ? [
|
|
293
|
+
// This should be first because it removes code from source files.
|
|
328
294
|
// It's much easier to follow if the removal happens before any
|
|
329
295
|
// transformations.
|
|
330
296
|
stripCodePlugin({
|
|
331
297
|
start_comment: "develblock:start",
|
|
332
298
|
end_comment: "develblock:end"
|
|
333
|
-
})] : [
|
|
299
|
+
})] : [
|
|
300
|
+
// Remove the comments marking devel blocks as they can cause problems
|
|
334
301
|
// later on because transpilation shuffles things around which may
|
|
335
302
|
// lead to all kinds of issues including syntax errors.
|
|
336
303
|
stripCodePlugin({
|
|
@@ -340,7 +307,8 @@ var generateRollupPluginArray = function generateRollupPluginArray(libraryFilena
|
|
|
340
307
|
summaryOnly: true
|
|
341
308
|
}), copyPlugin({
|
|
342
309
|
verbose: VIS_DEBUG,
|
|
343
|
-
targets: _concatInstanceProperty(_context10 = [
|
|
310
|
+
targets: _concatInstanceProperty(_context10 = [
|
|
311
|
+
// JavaScript
|
|
344
312
|
{
|
|
345
313
|
src: resolve(__dirname, "assets/bundle-root.js"),
|
|
346
314
|
dest: bundleDir,
|
|
@@ -352,7 +320,8 @@ var generateRollupPluginArray = function generateRollupPluginArray(libraryFilena
|
|
|
352
320
|
transform: function transform(content) {
|
|
353
321
|
return content.toString().replace("{{filename}}", libraryFilename);
|
|
354
322
|
}
|
|
355
|
-
},
|
|
323
|
+
},
|
|
324
|
+
// TypeScript
|
|
356
325
|
{
|
|
357
326
|
src: resolve(__dirname, "assets/bundle-root.d.ts"),
|
|
358
327
|
dest: bundleDir,
|
|
@@ -430,48 +399,41 @@ var generateRollupPluginArray = function generateRollupPluginArray(libraryFilena
|
|
|
430
399
|
* @returns Ready to use configuration object that can be just exported from
|
|
431
400
|
* `rollup.config.js` or mutated in any way if necessary.
|
|
432
401
|
*/
|
|
433
|
-
|
|
434
|
-
|
|
435
402
|
function generateRollupConfiguration(options) {
|
|
436
403
|
var _context14, _context16, _context17, _context18, _context19, _context20, _context21;
|
|
437
|
-
|
|
438
404
|
var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : VIS_TEST ? "test" : VIS_DEBUG ? "development" : "production";
|
|
439
|
-
|
|
440
405
|
var _ref5 = options || {},
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
406
|
+
_ref5$assets = _ref5.assets,
|
|
407
|
+
assets = _ref5$assets === void 0 ? "." : _ref5$assets,
|
|
408
|
+
_ref5$copyTargets = _ref5.copyTargets;
|
|
445
409
|
_ref5$copyTargets = _ref5$copyTargets === void 0 ? {} : _ref5$copyTargets;
|
|
446
410
|
var _ref5$copyTargets$bun = _ref5$copyTargets.bundle,
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
411
|
+
copyTargetsBundle = _ref5$copyTargets$bun === void 0 ? [] : _ref5$copyTargets$bun,
|
|
412
|
+
_ref5$copyTargets$var = _ref5$copyTargets.variant,
|
|
413
|
+
copyTargetsVariant = _ref5$copyTargets$var === void 0 ? [] : _ref5$copyTargets$var,
|
|
414
|
+
_ref5$externalForPeer = _ref5.externalForPeerBuild,
|
|
415
|
+
externalForPeerBuild = _ref5$externalForPeer === void 0 ? [] : _ref5$externalForPeer,
|
|
416
|
+
_ref5$globals = _ref5.globals,
|
|
417
|
+
globals = _ref5$globals === void 0 ? {} : _ref5$globals,
|
|
418
|
+
_ref5$header = _ref5.header,
|
|
419
|
+
header = _ref5$header === void 0 ? {
|
|
420
|
+
name: "Unknown Library"
|
|
421
|
+
} : _ref5$header,
|
|
422
|
+
_ref5$libraryFilename = _ref5.libraryFilename,
|
|
423
|
+
libraryFilename = _ref5$libraryFilename === void 0 ? "unknown-library" : _ref5$libraryFilename,
|
|
424
|
+
_ref5$packageJSON = _ref5.packageJSON;
|
|
461
425
|
_ref5$packageJSON = _ref5$packageJSON === void 0 ? {} : _ref5$packageJSON;
|
|
462
|
-
|
|
463
426
|
var _ref5$packageJSON$dep = _ref5$packageJSON.dependencies,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
427
|
+
dependencies = _ref5$packageJSON$dep === void 0 ? {} : _ref5$packageJSON$dep,
|
|
428
|
+
_ref5$packageJSON$dev = _ref5$packageJSON.devDependencies,
|
|
429
|
+
devDependencies = _ref5$packageJSON$dev === void 0 ? {} : _ref5$packageJSON$dev,
|
|
430
|
+
_ref5$packageJSON$pee = _ref5$packageJSON.peerDependencies,
|
|
431
|
+
peerDependencies = _ref5$packageJSON$pee === void 0 ? {} : _ref5$packageJSON$pee,
|
|
432
|
+
packageJSONRest = _objectWithoutProperties(_ref5$packageJSON, _excluded),
|
|
433
|
+
_ref5$entryPoints = _ref5.entryPoints,
|
|
434
|
+
entryPoint = _ref5$entryPoints === void 0 ? "./src" : _ref5$entryPoints,
|
|
435
|
+
_ref5$tsconfig = _ref5.tsconfig,
|
|
436
|
+
tsconfig = _ref5$tsconfig === void 0 ? "tsconfig.json" : _ref5$tsconfig;
|
|
475
437
|
validate(function (expect) {
|
|
476
438
|
// Note: Every array is a superset of empty array.
|
|
477
439
|
if (_Object$keys(peerDependencies).length > 0) {
|
|
@@ -486,7 +448,6 @@ function generateRollupConfiguration(options) {
|
|
|
486
448
|
});
|
|
487
449
|
validate(function (expect) {
|
|
488
450
|
var _context11, _context12, _context13;
|
|
489
|
-
|
|
490
451
|
expect(_sortInstanceProperty(_context11 = _concatInstanceProperty(_context12 = []).call(_context12, _toConsumableArray(_Object$keys(dependencies)), _toConsumableArray(_Object$keys(peerDependencies)))).call(_context11), "Globals have to be provided for all runtime and peer dependencies but nothing else").to.be.an("array").that.deep.equals(_sortInstanceProperty(_context13 = _Object$keys(globals)).call(_context13));
|
|
491
452
|
});
|
|
492
453
|
validate(function (expect) {
|
|
@@ -495,22 +456,19 @@ function generateRollupConfiguration(options) {
|
|
|
495
456
|
validate(function (expect) {
|
|
496
457
|
expect(entryPoint, "The entry point has to be directory").to.be.a("string").and.a.directory();
|
|
497
458
|
});
|
|
498
|
-
|
|
499
459
|
var _map = _mapInstanceProperty(_context14 = ["ESNext", "peer", "standalone"]).call(_context14, function (name) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
standaloneEntry = _map2[2];
|
|
513
|
-
|
|
460
|
+
var filenameGlob = "entry-".concat(name.toLowerCase(), ".{js,ts}");
|
|
461
|
+
var files = glob(resolve(entryPoint, filenameGlob));
|
|
462
|
+
validate(function (expect) {
|
|
463
|
+
var _context15;
|
|
464
|
+
expect(files, _concatInstanceProperty(_context15 = "There has to be a single entry file (".concat(filenameGlob, ") for the ")).call(_context15, name, " build")).to.have.lengthOf(1).and.to.have.ownProperty("0").that.is.a.file();
|
|
465
|
+
});
|
|
466
|
+
return files[0];
|
|
467
|
+
}),
|
|
468
|
+
_map2 = _slicedToArray(_map, 3),
|
|
469
|
+
esnextEntry = _map2[0],
|
|
470
|
+
peerEntry = _map2[1],
|
|
471
|
+
standaloneEntry = _map2[2];
|
|
514
472
|
validate(function (expect) {
|
|
515
473
|
expect(resolve("./declarations"), "There has to be a directory with TypeScript declarations").to.be.a("string").and.a.directory();
|
|
516
474
|
});
|
|
@@ -531,8 +489,8 @@ function generateRollupConfiguration(options) {
|
|
|
531
489
|
});
|
|
532
490
|
validate(function (expect) {
|
|
533
491
|
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"));
|
|
534
|
-
});
|
|
535
|
-
|
|
492
|
+
});
|
|
493
|
+
// Note: .to.not.exist sounds great but doesn't work.
|
|
536
494
|
validate(function (expect) {
|
|
537
495
|
expect(resolve("./.babelrc"), "Babelrc is ignored. Use babel.config.js config file instead.").to.not.be.a.path;
|
|
538
496
|
});
|
|
@@ -554,23 +512,18 @@ function generateRollupConfiguration(options) {
|
|
|
554
512
|
globals: processGlobals(globals),
|
|
555
513
|
sourcemap: VIS_TEST ? "inline" : true
|
|
556
514
|
};
|
|
557
|
-
|
|
558
515
|
var commonOutputESM = _objectSpread$1(_objectSpread$1({}, commonOutput), {}, {
|
|
559
516
|
format: "esm"
|
|
560
517
|
});
|
|
561
|
-
|
|
562
518
|
var commonOutputUMD = _objectSpread$1(_objectSpread$1({}, commonOutput), {}, {
|
|
563
519
|
exports: "named",
|
|
564
520
|
extend: true,
|
|
565
521
|
format: "umd",
|
|
566
522
|
name: "vis",
|
|
567
523
|
strict: false // Regenerator runtime causes issues with CSP in strict mode.
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
524
|
+
});
|
|
525
|
+
// Note: Binding more than 4 at a time is not typesafe in TS.
|
|
572
526
|
var getPlugins = _bindInstanceProperty(_context17 = _bindInstanceProperty(_context18 = _bindInstanceProperty(_context19 = _bindInstanceProperty(_context20 = _bindInstanceProperty(_context21 = _bindInstanceProperty(generateRollupPluginArray).call(generateRollupPluginArray, null, libraryFilename)).call(_context21, null, assets)).call(_context20, null, copyTargetsBundle)).call(_context19, null, copyTargetsVariant)).call(_context18, null, tsconfig)).call(_context17, null, mode);
|
|
573
|
-
|
|
574
527
|
return [{
|
|
575
528
|
external: external.standalone,
|
|
576
529
|
input: standaloneEntry,
|
|
@@ -658,7 +611,6 @@ function generateRollupConfiguration(options) {
|
|
|
658
611
|
}
|
|
659
612
|
|
|
660
613
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
661
|
-
|
|
662
614
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context8, _context9; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context8 = ownKeys(Object(source), !0)).call(_context8, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context9 = ownKeys(Object(source))).call(_context9, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
663
615
|
setGracefulCleanup();
|
|
664
616
|
var PACK_CMD = ["npm", "pack", "--dry-run"];
|
|
@@ -666,7 +618,6 @@ var PACK_CMD = ["npm", "pack", "--dry-run"];
|
|
|
666
618
|
* @param textOrLines
|
|
667
619
|
* @param message
|
|
668
620
|
*/
|
|
669
|
-
|
|
670
621
|
function logStderr(textOrLines, message) {
|
|
671
622
|
console.group('"npm pack" output');
|
|
672
623
|
console.error(_Array$isArray(textOrLines) ? textOrLines.join("\n") : textOrLines);
|
|
@@ -676,15 +627,12 @@ function logStderr(textOrLines, message) {
|
|
|
676
627
|
/**
|
|
677
628
|
*
|
|
678
629
|
*/
|
|
679
|
-
|
|
680
|
-
|
|
681
630
|
function runNpmPack() {
|
|
682
631
|
var _context;
|
|
683
|
-
|
|
684
|
-
|
|
632
|
+
var tmpFile = fileSync().name;
|
|
633
|
+
// There are issues with incomplete output when the stderr is read directly
|
|
685
634
|
// into Node. Saving it into tmp file using shell redirection and reading it
|
|
686
635
|
// from there doesn't exhibit those issues.
|
|
687
|
-
|
|
688
636
|
execSync(_concatInstanceProperty(_context = "".concat(PACK_CMD.join(" "), " 2> ")).call(_context, tmpFile), {
|
|
689
637
|
encoding: "utf-8",
|
|
690
638
|
env: _objectSpread(_objectSpread({}, process.env), {}, {
|
|
@@ -697,19 +645,13 @@ function runNpmPack() {
|
|
|
697
645
|
/**
|
|
698
646
|
* @param lines
|
|
699
647
|
*/
|
|
700
|
-
|
|
701
|
-
|
|
702
648
|
function extractFiles(lines) {
|
|
703
649
|
var _context2, _context3, _context4, _context5, _context6;
|
|
704
|
-
|
|
705
650
|
var fileListingStart = _indexOfInstanceProperty(lines).call(lines, "npm notice === Tarball Contents === ");
|
|
706
|
-
|
|
707
651
|
var fileListingEnd = _indexOfInstanceProperty(lines).call(lines, "npm notice === Tarball Details === ");
|
|
708
|
-
|
|
709
652
|
if (fileListingStart === -1 || fileListingEnd === -1) {
|
|
710
653
|
logStderr(lines.join("\n"), 'Couldn\'t find tarball contents in "npm pack" output.');
|
|
711
654
|
}
|
|
712
|
-
|
|
713
655
|
var files = _mapInstanceProperty(_context2 = _sortInstanceProperty(_context3 = _mapInstanceProperty(_context4 = _mapInstanceProperty(_context5 = _mapInstanceProperty(_context6 = _sliceInstanceProperty(lines).call(lines, fileListingStart + 1, fileListingEnd)).call(_context6, function (line) {
|
|
714
656
|
return line.replace(/^npm notice /, "");
|
|
715
657
|
})).call(_context5, function (line) {
|
|
@@ -717,40 +659,31 @@ function extractFiles(lines) {
|
|
|
717
659
|
})).call(_context4, function (line) {
|
|
718
660
|
return line.replace(/^([^ ]+) +(.*)/, function (_, size, path) {
|
|
719
661
|
var _context7;
|
|
720
|
-
|
|
721
662
|
return _concatInstanceProperty(_context7 = "".concat(path)).call(_context7, size === "0" ? "(empty)" : " ");
|
|
722
663
|
});
|
|
723
664
|
})).call(_context3)).call(_context2, function (line) {
|
|
724
665
|
return line.replace(/^(.*)(.{7})$/, "$2 $1");
|
|
725
666
|
});
|
|
726
|
-
|
|
727
667
|
if (files.length === 0) {
|
|
728
668
|
logStderr(lines, 'No files found in "npm pack" output.');
|
|
729
669
|
}
|
|
730
|
-
|
|
731
670
|
return files;
|
|
732
671
|
}
|
|
733
672
|
/**
|
|
734
673
|
* @param lines
|
|
735
674
|
*/
|
|
736
|
-
|
|
737
|
-
|
|
738
675
|
function extractName(lines) {
|
|
739
676
|
var nameLine = _findInstanceProperty(lines).call(lines, function (line) {
|
|
740
677
|
return /^npm notice name:/.test(line);
|
|
741
678
|
});
|
|
742
|
-
|
|
743
679
|
if (nameLine == null) {
|
|
744
680
|
logStderr(lines, 'Can\'t find the name of the package in "npm pack" output.');
|
|
745
681
|
}
|
|
746
|
-
|
|
747
682
|
return nameLine.replace(/^npm notice name: */, "");
|
|
748
683
|
}
|
|
749
684
|
/**
|
|
750
685
|
*
|
|
751
686
|
*/
|
|
752
|
-
|
|
753
|
-
|
|
754
687
|
function inspectNpmPack() {
|
|
755
688
|
var lines = runNpmPack();
|
|
756
689
|
var files = extractFiles(lines);
|