zrender-nightly 5.5.0-dev.20230325 → 5.5.0-dev.20230327
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/build/prepublish.js +88 -0
- package/dist/zrender.js +9 -6
- package/dist/zrender.js.map +1 -1
- package/dist/zrender.min.js +1 -1
- package/lib/graphic/helper/parseText.js +6 -3
- package/lib/svg/core.js +2 -2
- package/lib/zrender.d.ts +1 -1
- package/lib/zrender.js +1 -1
- package/package.json +3 -2
- package/src/graphic/helper/parseText.ts +11 -3
- package/src/svg/core.ts +2 -2
- package/src/zrender.ts +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const ignore = require('ignore');
|
|
4
|
+
const { execSync } = require('node:child_process');
|
|
5
|
+
|
|
6
|
+
console.log();
|
|
7
|
+
console.log(chalk.yellowBright(`⚠️ You should have run ${chalk.bold('`npm run release`')} before running this script!`));
|
|
8
|
+
console.log();
|
|
9
|
+
|
|
10
|
+
// check versions in key dist files
|
|
11
|
+
|
|
12
|
+
console.log(chalk.yellow('🔎 Checking versions in dist files...'));
|
|
13
|
+
|
|
14
|
+
const fileVersions = [
|
|
15
|
+
'package.json',
|
|
16
|
+
'package-lock.json',
|
|
17
|
+
'dist/zrender.js',
|
|
18
|
+
'dist/zrender.min.js'
|
|
19
|
+
].map(filePath => ({
|
|
20
|
+
file: filePath,
|
|
21
|
+
version: require('../' + filePath).version
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
['lib/zrender.js', 'src/zrender.ts'].forEach(filePath => {
|
|
25
|
+
const version = fs.readFileSync(filePath, 'utf-8').match(/export (?:var|const) version = '(\S+)'/)[1];
|
|
26
|
+
fileVersions.push({
|
|
27
|
+
file: filePath,
|
|
28
|
+
version: version
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const versions = fileVersions.map(({ file, version }) => {
|
|
33
|
+
console.log(` ∟ The version in [${chalk.blueBright(file)}] is ${chalk.cyanBright.bold(version)}`);
|
|
34
|
+
return version;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (new Set(versions).size !== 1) {
|
|
38
|
+
console.log();
|
|
39
|
+
console.error(chalk.red('❌ Version does not match! Please check and rerun the release script via:'));
|
|
40
|
+
console.log();
|
|
41
|
+
console.error(chalk.yellow(' npm run release'));
|
|
42
|
+
console.log();
|
|
43
|
+
process.exit(-1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log();
|
|
47
|
+
console.log(chalk.green('✔️ Versions are all the same.'));
|
|
48
|
+
console.log();
|
|
49
|
+
|
|
50
|
+
console.log(chalk.yellow('🔎 Checking unexpected files that probably shouldn\'t be published...\n'));
|
|
51
|
+
|
|
52
|
+
// check if there are unexpected files that not in .npmignore
|
|
53
|
+
const npmignore = fs.readFileSync('.npmignore', 'utf-8');
|
|
54
|
+
const npmignorePatterns = npmignore
|
|
55
|
+
.split(/\r?\n/)
|
|
56
|
+
.filter(item => item && !item.startsWith('#'));
|
|
57
|
+
|
|
58
|
+
const untrackedFiles = execSync('git ls-files --others --exclude-standard', { encoding: 'utf-8' })
|
|
59
|
+
.trim()
|
|
60
|
+
.split('\n')
|
|
61
|
+
.map(escapeOctal);
|
|
62
|
+
|
|
63
|
+
if (untrackedFiles.length) {
|
|
64
|
+
const maybeUnexpectedFiles = ignore().add(npmignorePatterns).filter(untrackedFiles);
|
|
65
|
+
if (maybeUnexpectedFiles.length) {
|
|
66
|
+
console.error(chalk.red(`❌ Found ${maybeUnexpectedFiles.length} file(s) that are neither tracked by git nor ignored by .npmignore! Please double-check before publishing them to npm.`));
|
|
67
|
+
maybeUnexpectedFiles.forEach(filePath => {
|
|
68
|
+
console.log(' ∟ ' + filePath);
|
|
69
|
+
});
|
|
70
|
+
console.log();
|
|
71
|
+
process.exit(-1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log(chalk.green('✔️ No unexpected files found.'));
|
|
76
|
+
console.log();
|
|
77
|
+
|
|
78
|
+
function escapeOctal(str) {
|
|
79
|
+
const matches = str.match(/(\\\d{3}){3}/g);
|
|
80
|
+
if (matches) {
|
|
81
|
+
matches.forEach(match => {
|
|
82
|
+
let encoded = '';
|
|
83
|
+
match.split('\\').forEach(code => !code || (encoded += '%' + parseInt(code, 8).toString(16)));
|
|
84
|
+
str = str.replace(match, decodeURI(encoded));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return str;
|
|
88
|
+
}
|
package/dist/zrender.js
CHANGED
|
@@ -7238,7 +7238,7 @@
|
|
|
7238
7238
|
function registerPainter(name, Ctor) {
|
|
7239
7239
|
painterCtors[name] = Ctor;
|
|
7240
7240
|
}
|
|
7241
|
-
var version = '5.5.0-dev.
|
|
7241
|
+
var version = '5.5.0-dev.20230327';
|
|
7242
7242
|
|
|
7243
7243
|
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
|
|
7244
7244
|
var DEFAULT_COMMON_STYLE = {
|
|
@@ -12791,16 +12791,19 @@
|
|
|
12791
12791
|
}
|
|
12792
12792
|
}
|
|
12793
12793
|
}
|
|
12794
|
-
function
|
|
12794
|
+
function isAlphabeticLetter(ch) {
|
|
12795
12795
|
var code = ch.charCodeAt(0);
|
|
12796
|
-
return code >=
|
|
12796
|
+
return code >= 0x20 && code <= 0x24F
|
|
12797
|
+
|| code >= 0x370 && code <= 0x10FF
|
|
12798
|
+
|| code >= 0x1200 && code <= 0x13FF
|
|
12799
|
+
|| code >= 0x1E00 && code <= 0x206F;
|
|
12797
12800
|
}
|
|
12798
12801
|
var breakCharMap = reduce(',&?/;] '.split(''), function (obj, ch) {
|
|
12799
12802
|
obj[ch] = true;
|
|
12800
12803
|
return obj;
|
|
12801
12804
|
}, {});
|
|
12802
12805
|
function isWordBreakChar(ch) {
|
|
12803
|
-
if (
|
|
12806
|
+
if (isAlphabeticLetter(ch)) {
|
|
12804
12807
|
if (breakCharMap[ch]) {
|
|
12805
12808
|
return true;
|
|
12806
12809
|
}
|
|
@@ -15900,9 +15903,9 @@
|
|
|
15900
15903
|
opts = opts || {};
|
|
15901
15904
|
var S = opts.newline ? '\n' : '';
|
|
15902
15905
|
function convertElToString(el) {
|
|
15903
|
-
var children = el.children, tag = el.tag, attrs = el.attrs;
|
|
15906
|
+
var children = el.children, tag = el.tag, attrs = el.attrs, text = el.text;
|
|
15904
15907
|
return createElementOpen(tag, attrs)
|
|
15905
|
-
+ encodeHTML(
|
|
15908
|
+
+ (tag !== 'style' ? encodeHTML(text) : text || '')
|
|
15906
15909
|
+ (children ? "" + S + map(children, function (child) { return convertElToString(child); }).join(S) + S : '')
|
|
15907
15910
|
+ createElementClose(tag);
|
|
15908
15911
|
}
|