Skip to content

Commit 760ab95

Browse files
committed
Load old versions from unpkg for perf tests to simplify future releases
1 parent d60ff52 commit 760ab95

14 files changed

+9
-63709
lines changed

tests/perf/index.html

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,16 @@
2323
(function() {
2424
var match = /[?&]version=([^&]+)/.exec(location.search);
2525
var version = match ? match[1] : null;
26-
var knownVersion = {
27-
'4.4.0': true,
28-
'4.3.1': true,
29-
'4.2.4': true,
30-
'4.2.3': true,
31-
'4.2.0': true,
32-
'4.1.1': true,
33-
'4.0.0': true,
34-
'3.2.0': true,
35-
'3.1.1': true,
36-
'3.1.0': true,
37-
'3.0.0': true,
38-
'2.0.0': true,
39-
'1.5.1': true
40-
};
26+
var isValidVersion = /^\d+\.\d+\.\d+(?:-\w+)?$/.test(version);
4127

4228
if (version === null || version === 'latest') {
4329
document.write('<script src="../../xregexp-all.js"><\/script>');
44-
} else if (knownVersion[version]) {
30+
} else if (isValidVersion) {
4531
// Hack around ES6 incompatibility in XRegExp versions prior to 3.0.0
4632
if (parseInt(version, 10) < 3) {
4733
delete RegExp.prototype.sticky;
4834
}
49-
document.write('<script src="versions/xregexp-all-v'+version+'.js"><\/script>');
50-
} else {
51-
document.getElementById('log').innerHTML = 'Unrecognized version provided in query';
35+
document.write('<script src="https://unpkg.com/xregexp@' + version + '/xregexp-all.js"><\/script>');
5236
}
5337
}());
5438
</script>
@@ -77,8 +61,12 @@
7761
}
7862
}());
7963

80-
// Global run function provided by perf script
81-
onload = run;
64+
if (typeof XRegExp === 'undefined') {
65+
document.getElementById('log').innerHTML = 'Unable to find XRegExp version provided in query at &lt;unpkg.com&gt;';
66+
} else {
67+
// Global run function provided by perf script
68+
onload = run;
69+
}
8270
</script>
8371
</body>
8472
</html>

tests/perf/versions/xregexp-all-v1.5.1.js

Lines changed: 0 additions & 1297 deletions
This file was deleted.

0 commit comments

Comments
 (0)