js-dev-tool 1.0.0

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.
@@ -0,0 +1,90 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" version="1.1" width="1584.185546875" height="461">
3
+ <defs>
4
+ <style type="text/css">svg {
5
+ background-color: #fff;
6
+ }
7
+
8
+ .root text,
9
+ .root tspan {
10
+ font: 12px Arial;
11
+ }
12
+
13
+ .root path {
14
+ fill-opacity: 0;
15
+ stroke-width: 2px;
16
+ stroke: #000;
17
+ }
18
+
19
+ .root circle {
20
+ fill: #6b6659;
21
+ stroke-width: 2px;
22
+ stroke: #000;
23
+ }
24
+
25
+ .anchor text, .any-character text {
26
+ fill: #fff;
27
+ }
28
+
29
+ .anchor rect, .any-character rect {
30
+ fill: #6b6659;
31
+ }
32
+
33
+ .escape text, .charset-escape text, .literal text {
34
+ fill: #000;
35
+ }
36
+
37
+ .escape rect, .charset-escape rect {
38
+ fill: #bada55;
39
+ }
40
+
41
+ .literal rect {
42
+ fill: #dae9e5;
43
+ }
44
+
45
+ .charset .charset-box {
46
+ fill: #cbcbba;
47
+ }
48
+
49
+ .subexp .subexp-label tspan,
50
+ .charset .charset-label tspan,
51
+ .match-fragment .repeat-label tspan {
52
+ font-size: 10px;
53
+ }
54
+
55
+ .repeat-label {
56
+ cursor: help;
57
+ }
58
+
59
+ .subexp .subexp-label tspan,
60
+ .charset .charset-label tspan {
61
+ dominant-baseline: text-after-edge;
62
+ }
63
+
64
+ .subexp .subexp-box {
65
+ stroke: #908c83;
66
+ stroke-dasharray: 6, 2;
67
+ stroke-width: 2px;
68
+ fill-opacity: 0;
69
+ }
70
+
71
+ .quote {
72
+ fill: #908c83;
73
+ }
74
+ /*# sourceURL=webpack://src/sass/svg.scss */
75
+ /*# sourceURL=webpack://src/sass/_base.scss */
76
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blxuQG1peGluIGFkanVzdC1mb250LXNpemUtdG8oJHRvLXNpemUsICRsaW5lczogYXV0bykge1xuICBmb250LXNpemU6IGNhbGMoJHRvLXNpemUgLyAkYmFzZS1mb250LXNpemUpICogMWVtO1xuICBAaWYgJGxpbmVzID09IGF1dG8ge1xuICAgICRsaW5lczogY2VpbChtYXRoLmRpdigkdG8tc2l6ZSwgJGJhc2UtZm9udC1zaXplKSk7XG4gICAgLy8gJGxpbmVzOiBjZWlsKCR0by1zaXplIC8gJGJhc2UtZm9udC1zaXplKTtcbiAgfVxuICBsaW5lLWhlaWdodDogcmh5dGhtKCRsaW5lcywgJHRvLXNpemUpO1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ== */</style>
77
+ </defs>
78
+ <metadata>
79
+ <rdf:rdf>
80
+ <cc:license rdf:about="http://creativecommons.org/licenses/by/3.0/">
81
+ <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"></cc:permits>
82
+ <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"></cc:permits>
83
+ <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"></cc:requires>
84
+ <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"></cc:requires>
85
+ <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"></cc:permits>
86
+ </cc:license>
87
+ </rdf:rdf>
88
+ </metadata>
89
+ <desc>Created with Snap</desc><g class="root" transform="matrix(1,0,0,1,15,10)"><g class="regexp match" transform="matrix(1,0,0,1,10,0)"><path d="M91.359375,220.5H116.3594M191.0547125,220.5H216.0547M1167.8564578125,220.5H1192.8564M1230.8808140625,220.5H1265.8809M1295.8809,220.5H1325.8809"></path><g class="match-fragment subexp regexp" transform="matrix(1,0,0,1,0,194)"><path d="M0,26.5c10,0 10,-14.5 20,-14.5M91.359375,26.5c-10,0 -10,-14.5 -20,-14.5M0,26.5c10,0 10,14.5 20,14.5M91.359375,26.5c-10,0 -10,14.5 -20,14.5"></path><g transform="matrix(1,0,0,1,20,0)" class="regexp-matches"><path d="M0,12h0.0078M51.35155,12H51.359375M0,41h0M51.359375,41H51.359375"></path><g class="match match-fragment literal" transform="matrix(1,0,0,1,0.0078,0)"><g class="label"><rect width="51.34375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>import</tspan><tspan class="quote">”</tspan></text></g></g><g class="match match-fragment literal" transform="matrix(1,0,0,1,0,29)"><g class="label"><rect width="51.359375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>export</tspan><tspan class="quote">”</tspan></text></g></g></g></g><g class="match-fragment" transform="matrix(1,0,0,1,101.3594,198.5)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment subexp regexp" transform="matrix(1,0,0,1,216.0547,0)"><path d="M10,73.5q0,-10 10,-10M941.8017578125,73.5q0,-10 -10,-10M10,270.5q0,10 10,10M941.8017578125,270.5q0,10 -10,10M0,220.5q10,0 10,-10V73.5M951.8017578125,220.5q-10,0 -10,-10V73.5M0,220.5q10,0 10,10V270.5M951.8017578125,220.5q-10,0 -10,10V270.5"></path><g transform="matrix(1,0,0,1,20,0)" class="regexp-matches"><path d="M0,63.5h398.1304M486.04343125,63.5H911.8017578125M0,280.5h0M896.80173125,280.5H911.8017578125"></path><g class="match" transform="matrix(1,0,0,1,398.1304,0)"><path d="M22.265625,63.5H54.8935"></path><g class="match-fragment literal" transform="matrix(1,0,0,1,0,51.5)"><g class="label"><rect width="22.265625" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>"</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment subexp" transform="matrix(1,0,0,1,32.2656,0)"><rect rx="3" ry="3" class="subexp-box" transform="matrix(1,0,0,1,0,11)" width="83.275390625" height="104"></rect><text x="0" y="0" class="subexp-label" transform="matrix(1,0,0,1,0,11)"><tspan>positive lookahead</tspan></text><g class="regexp match match-fragment" transform="matrix(1,0,0,1,12.6279,21)"><path d="M10,42.5q-10,0 -10,10v21.5q0,10 10,10h33.01953125q10,0 10,-10v-21.5q0,-10 -10,-10M53.01953125,57.5l5,-5m-5,5l-5,-5"></path><g class="charset" transform="matrix(1,0,0,1,10,0)"><rect rx="3" ry="3" class="charset-box" transform="matrix(1,0,0,1,0,11)" width="33.01953125" height="63"></rect><text x="0" y="0" class="charset-label" transform="matrix(1,0,0,1,0,11)"><tspan>One of:</tspan></text><g transform="matrix(1,0,0,1,5.8379,16)"><g class="literal" transform="matrix(1,0,0,1,0,0)"><g class="label"><rect width="21.34375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>.</tspan><tspan class="quote">”</tspan></text></g></g><g class="literal" transform="matrix(1,0,0,1,0,29)"><g class="label"><rect width="21.34375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>/</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g></g></g><g class="match" transform="matrix(1,0,0,1,0,120)"><path d="M811.5166015625,160.5H821.5166M843.782225,160.5H863.7822"></path><g class="match-fragment subexp regexp" transform="matrix(1,0,0,1,0,0)"><path d="M10,52.5q0,-10 10,-10M801.5166015625,52.5q0,-10 -10,-10M10,151.5q0,-10 10,-10M801.5166015625,151.5q0,-10 -10,-10M10,220.5q0,10 10,10M801.5166015625,220.5q0,10 -10,10M10,289q0,10 10,10M801.5166015625,289q0,10 -10,10M0,160.5q10,0 10,-10V52.5M811.5166015625,160.5q-10,0 -10,-10V52.5M0,160.5q10,0 10,10V289M811.5166015625,160.5q-10,0 -10,10V289"></path><g transform="matrix(1,0,0,1,20,0)" class="regexp-matches"><path d="M0,42.5h236.395M545.1216125,42.5H771.5166015625M0,141.5h25M756.5166125,141.5H771.5166015625M0,230.5h62.52M693.9966125,230.5H771.5166015625M0,299h233.7271M522.7896125,299H771.5166015625"></path><g class="match" transform="matrix(1,0,0,1,226.395,0)"><path d="M57.3359375,42.5H92.3359M167.03121249999998,42.5H192.0313M234.0313,42.5H244.0313"></path><g class="match-fragment" transform="matrix(1,0,0,1,0,0)"><path d="M10,42.5q-10,0 -10,10v21.5q0,10 10,10h47.3359375q10,0 10,-10v-21.5q0,-10 -10,-10M67.3359375,57.5l5,-5m-5,5l-5,-5"></path><g class="charset" transform="matrix(1,0,0,1,10,0)"><rect rx="3" ry="3" class="charset-box" transform="matrix(1,0,0,1,0,11)" width="47.3359375" height="63"></rect><text x="0" y="0" class="charset-label" transform="matrix(1,0,0,1,0,11)"><tspan>One of:</tspan></text><g transform="matrix(1,0,0,1,5,16)"><g class="charset-escape" transform="matrix(1,0,0,1,0,0)"><g class="label"><rect width="37.3359375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>word</tspan></text></g></g><g class="literal" transform="matrix(1,0,0,1,6.3242,29)"><g class="label"><rect width="24.6875" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>_</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g><g class="match-fragment" transform="matrix(1,0,0,1,82.3359,30.5)"><path d="M10,12q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M94.6953125,27l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,10,0)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,192.0313,30.5)"><g class="label"><rect width="42" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>from</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment escape" transform="matrix(1,0,0,1,244.0313,30.5)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match" transform="matrix(1,0,0,1,0,89)"><path d="M333.0703125,52.5H373.0703M395.085925,52.5H415.0859M453.1103140625,52.5H478.1104M500.126025,52.5H520.126M594.8213125,52.5H619.8213M661.8213,52.5H681.8213"></path><g class="match-fragment" transform="matrix(1,0,0,1,0,0)"><path d="M0,52.5q10,0 10,-10v-32.5q0,-10 10,-10h323.0703125q10,0 10,10v32.5q0,10 10,10"></path><g class="subexp regexp match" transform="matrix(1,0,0,1,15,10)"><path d="M57.3359375,42.5H97.3359M172.03121249999998,42.5H197.0313M218.37505,42.5H243.375"></path><g class="match-fragment" transform="matrix(1,0,0,1,0,0)"><path d="M10,42.5q-10,0 -10,10v21.5q0,10 10,10h47.3359375q10,0 10,-10v-21.5q0,-10 -10,-10M67.3359375,57.5l5,-5m-5,5l-5,-5"></path><g class="charset" transform="matrix(1,0,0,1,10,0)"><rect rx="3" ry="3" class="charset-box" transform="matrix(1,0,0,1,0,11)" width="47.3359375" height="63"></rect><text x="0" y="0" class="charset-label" transform="matrix(1,0,0,1,0,11)"><tspan>One of:</tspan></text><g transform="matrix(1,0,0,1,5,16)"><g class="charset-escape" transform="matrix(1,0,0,1,0,0)"><g class="label"><rect width="37.3359375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>word</tspan></text></g></g><g class="literal" transform="matrix(1,0,0,1,6.3242,29)"><g class="label"><rect width="24.6875" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>_</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g><g class="match-fragment" transform="matrix(1,0,0,1,82.3359,20.5)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,197.0313,30.5)"><g class="label"><rect width="21.34375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>,</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,228.375,20.5)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,373.0703,40.5)"><g class="label"><rect width="22.015625" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>{</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,405.0859,24.5)"><path d="M10,28q-10,0 -10,10v7q0,10 10,10h38.0244140625q10,0 10,-10v-7q0,-10 -10,-10M58.0244140625,43l5,-5m-5,5l-5,-5"></path><g class="charset" transform="matrix(1,0,0,1,10,0)"><rect rx="3" ry="3" class="charset-box" transform="matrix(1,0,0,1,0,11)" width="38.0244140625" height="34"></rect><text x="0" y="0" class="charset-label" transform="matrix(1,0,0,1,0,11)"><tspan>None of:</tspan></text><g transform="matrix(1,0,0,1,8.0044,16)"><g class="literal" transform="matrix(1,0,0,1,0,0)"><g class="label"><rect width="22.015625" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>}</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,478.1104,40.5)"><g class="label"><rect width="22.015625" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>}</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,510.126,40.5)"><path d="M10,12q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M94.6953125,27l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,10,0)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,619.8213,40.5)"><g class="label"><rect width="42" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>from</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,671.8213,40.5)"><path d="M10,12q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M94.6953125,27l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,10,0)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g></g><g class="match" transform="matrix(1,0,0,1,62.52,188)"><path d="M22.671875,42.5H47.6719M122.3672125,42.5H147.3672M178.0547,42.5H198.0547M272.7500125,42.5H307.75M355.0859375,42.5H390.0859M464.7812125,42.5H489.7813M531.7813,42.5H556.7813"></path><g class="match-fragment literal" transform="matrix(1,0,0,1,0,30.5)"><g class="label"><rect width="22.671875" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>*</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,32.6719,20.5)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,147.3672,30.5)"><g class="label"><rect width="30.6875" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>as</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,188.0547,30.5)"><path d="M10,12q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M94.6953125,27l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,10,0)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment" transform="matrix(1,0,0,1,297.75,0)"><path d="M10,42.5q-10,0 -10,10v21.5q0,10 10,10h47.3359375q10,0 10,-10v-21.5q0,-10 -10,-10M67.3359375,57.5l5,-5m-5,5l-5,-5"></path><g class="charset" transform="matrix(1,0,0,1,10,0)"><rect rx="3" ry="3" class="charset-box" transform="matrix(1,0,0,1,0,11)" width="47.3359375" height="63"></rect><text x="0" y="0" class="charset-label" transform="matrix(1,0,0,1,0,11)"><tspan>One of:</tspan></text><g transform="matrix(1,0,0,1,5,16)"><g class="charset-escape" transform="matrix(1,0,0,1,0,0)"><g class="label"><rect width="37.3359375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>word</tspan></text></g></g><g class="literal" transform="matrix(1,0,0,1,6.3242,29)"><g class="label"><rect width="24.6875" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>_</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g><g class="match-fragment" transform="matrix(1,0,0,1,380.0859,30.5)"><path d="M10,12q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M94.6953125,27l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,10,0)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,489.7813,30.5)"><g class="label"><rect width="42" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>from</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,541.7813,20.5)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g></g><g class="match" transform="matrix(1,0,0,1,233.7271,277)"><path d="M22.671875,22H47.6719M122.3672125,22H147.3672M189.3672,22H214.3672"></path><g class="match-fragment literal" transform="matrix(1,0,0,1,0,10)"><g class="label"><rect width="22.671875" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>*</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,32.6719,0)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,147.3672,10)"><g class="label"><rect width="42" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>from</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,199.3672,0)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g></g></g></g><g class="match-fragment literal" transform="matrix(1,0,0,1,821.5166,148.5)"><g class="label"><rect width="22.265625" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>"</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment subexp regexp match" transform="matrix(1,0,0,1,853.7822,118)"><path d="M10,42.5q-10,0 -10,10v21.5q0,10 10,10h33.01953125q10,0 10,-10v-21.5q0,-10 -10,-10M53.01953125,57.5l5,-5m-5,5l-5,-5"></path><g class="charset" transform="matrix(1,0,0,1,10,0)"><rect rx="3" ry="3" class="charset-box" transform="matrix(1,0,0,1,0,11)" width="33.01953125" height="63"></rect><text x="0" y="0" class="charset-label" transform="matrix(1,0,0,1,0,11)"><tspan>One of:</tspan></text><g transform="matrix(1,0,0,1,5.8379,16)"><g class="literal" transform="matrix(1,0,0,1,0,0)"><g class="label"><rect width="21.34375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>.</tspan><tspan class="quote">”</tspan></text></g></g><g class="literal" transform="matrix(1,0,0,1,0,29)"><g class="label"><rect width="21.34375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>/</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g></g></g></g><g class="match-fragment subexp regexp match" transform="matrix(1,0,0,1,1177.8564,182.5)"><path d="M0,38q10,0 10,-10v-18q0,-10 10,-10h28.0244140625q10,0 10,10v18q0,10 10,10M15,38q-10,0 -10,10v7q0,10 10,10h38.0244140625q10,0 10,-10v-7q0,-10 -10,-10M63.0244140625,53l5,-5m-5,5l-5,-5"></path><g class="charset" transform="matrix(1,0,0,1,15,10)"><rect rx="3" ry="3" class="charset-box" transform="matrix(1,0,0,1,0,11)" width="38.0244140625" height="34"></rect><text x="0" y="0" class="charset-label" transform="matrix(1,0,0,1,0,11)"><tspan>None of:</tspan></text><g transform="matrix(1,0,0,1,7.8794,16)"><g class="literal" transform="matrix(1,0,0,1,0,0)"><g class="label"><rect width="22.265625" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>"</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g><g class="match-fragment subexp" transform="matrix(1,0,0,1,1255.8809,187.5)"><rect rx="3" ry="3" class="subexp-box" transform="matrix(1,0,0,1,0,11)" width="50" height="44"></rect><text x="0" y="0" class="subexp-label" transform="matrix(1,0,0,1,0,11)"><tspan>group #1</tspan></text><g class="regexp match match-fragment literal" transform="matrix(1,0,0,1,10,21)"><g class="label"><rect width="30" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>.js</tspan><tspan class="quote">”</tspan></text></g></g></g><g class="match-fragment subexp" transform="matrix(1,0,0,1,1315.8809,177.5)"><rect rx="3" ry="3" class="subexp-box" transform="matrix(1,0,0,1,0,11)" width="218.30465698242188" height="64"></rect><text x="0" y="0" class="subexp-label" transform="matrix(1,0,0,1,0,11)"><tspan>positive lookahead</tspan></text><g class="regexp match" transform="matrix(1,0,0,1,10,21)"><path d="M22.265625,22H47.2656M121.9609125,22H161.9609"></path><g class="match-fragment literal" transform="matrix(1,0,0,1,0,10)"><g class="label"><rect width="22.265625" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>"</tspan><tspan class="quote">”</tspan></text></g></g><g class="match-fragment" transform="matrix(1,0,0,1,32.2656,0)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h64.6953125q10,0 10,10v2q0,10 10,10M15,22q-10,0 -10,10v2q0,10 10,10h74.6953125q10,0 10,-10v-2q0,-10 -10,-10M99.6953125,37l5,-5m-5,5l-5,-5"></path><g class="escape" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="74.6953125" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan>white space</tspan></text></g></g></g><g class="match-fragment" transform="matrix(1,0,0,1,146.9609,0)"><path d="M0,22q10,0 10,-10v-2q0,-10 10,-10h11.34375q10,0 10,10v2q0,10 10,10"></path><g class="literal" transform="matrix(1,0,0,1,15,10)"><g class="label"><rect width="21.34375" height="24" rx="3" ry="3"></rect><text x="0" y="0" transform="matrix(1,0,0,1,5,17)"><tspan class="quote">“</tspan><tspan>;</tspan><tspan class="quote">”</tspan></text></g></g></g></g></g></g><path d="M10,220.5H0M1519.1855500000001,220.5H1554.185546875"></path><circle cx="0" cy="220.5" r="5"></circle><circle cx="1554.185546875" cy="220.5" r="5"></circle></g></svg>
90
+
@@ -0,0 +1,125 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2023 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
8
+ /// <reference path="./tools.d.ts"/>
9
+ // @ts-check
10
+ /**
11
+ * @file comment trick toggle
12
+ */
13
+
14
+ /**
15
+ *
16
+ * @param {string} code
17
+ */
18
+ function cleanup(code) {
19
+ // DEVNOTE: 2023/10/27 - PCRE2 style: https://regex101.com/r/r3aGp5/2
20
+ // NOTE: cleanup 用の regex
21
+ const pcreStyle = String.raw`
22
+ \s*\/
23
+ (?:
24
+ \s*\/+\*\s+(?:ctt|comment-toggle-trick|https:\/\/coderwall)
25
+ ([\s\S]+?)
26
+ (?:\s+)\/\*\/
27
+ [\s\S]+
28
+ |
29
+ \s*\*\s+(?:ctt|comment-toggle-trick|https:\/\/coderwall)
30
+ [\s\S]+
31
+ \/\*\/
32
+ ([\s\S]+?)
33
+ )
34
+ \s*\/{2,}\*\/
35
+ `;
36
+ // to js regex
37
+ // /\s*\/(?:\s*\/+\*\s+(?:ctt|comment-toggle-trick|https:\/\/coderwall)([\s\S]+?)\/\*\/[\s\S]+|\s*\*\s+(?:ctt|comment-toggle-trick|https:\/\/coderwall)[\s\S]+\/\*\/([\s\S]+?))\s*\/{2,}\*\//g
38
+ return code.replace(
39
+ new RegExp(pcreStyle.replace(/\s*\(\?#.*\)\s*$|#\s.*$|\s+/gm, ""), "g"), ($0, $1, $2) => $1 || $2,
40
+ );
41
+ }
42
+
43
+ /**
44
+ * @param {string} code
45
+ */
46
+ function doIt(code) {
47
+ return code.replace(
48
+ /\/+(?=\*\s?(ctt|comment-toggle-trick|https:\/\/coderwall))/g, ($0) => {
49
+ const slashes = $0.length === 2 ? "/" : "//";
50
+ console.log(
51
+ "the-comment-toggle-trick: %s",
52
+ /*enableBefore*/ slashes.length === 2
53
+ ? "-->enable before<--, mute after"
54
+ : "mute before, -->enable after<--",
55
+ );
56
+ return slashes;
57
+ },
58
+ );
59
+ }
60
+
61
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62
+ // url: https://github.com/marketplace/models/azure-openai/gpt-4-1/playground?preset=jeffy-g%2Fts-js-adviser
63
+ // DEVNOTE: 2025/9/8 7:15:24 - この code の original は OpenAI GPT-4.1 が提示したものだが、
64
+ // そのままでは、意図した挙動にならず、修正
65
+ // -> 結局、origin `doIt` でしっかり処理できていたので、不要に
66
+ // -> 一回しか置換できないと勘違いし、doIt を review してもらったが、
67
+ // 原因は `//* ctt` のようになっていなかったため (token "ctt" が抜けていた)
68
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69
+ // /** @type {RegExp} */
70
+ // const BLOCK_RE = /^(?:\s*(\/+)\*+\s*(.+))$/gm;
71
+ // /**
72
+ // * @param {string} code
73
+ // */
74
+ // function doIt(code) {
75
+ // return code.replace(BLOCK_RE, ($0, $1, $2, offset, str) => {
76
+ // // すぐ後ろに* cttなどがあれば...
77
+ // if (/ctt|comment-toggle-trick|https:\/\/coderwall/.test($2)) {
78
+ // // if (str.slice(offset).match(/^\/*\*\s?(ctt|comment-toggle-trick|https:\/\/coderwall)/)) {
79
+ // const slashes = $1.length === 2 ? "/" : "//";
80
+ // console.log(
81
+ // "the-comment-toggle-trick: %s",
82
+ // slashes === "/" ? "-->enable before<--, mute after" : "mute before, -->enable after<--"
83
+ // );
84
+ // return slashes;
85
+ // }
86
+ // return $0;
87
+ // });
88
+ // }
89
+
90
+ // yarn test -base ./tool-lib -test re/\\.js$/ -help cmtTrick
91
+ // yarn test -base ./tool-lib -test re/\\.js$/ -cmd cmtTrick:clean
92
+ /**
93
+ * @returns {TJSToolEntry}
94
+ * @version 2.0 2023-10-27 supports `mode` feature
95
+ */
96
+ module.exports = () => {
97
+ return {
98
+ // ^\s*\/+\*\s+(?:ctt|comment-toggle-trick|https:\/\/coderwall)[\s\S]+\s*\/+\*\/|\/\*\s+(?:ctt|comment-toggle-trick|https:\/\/coderwall)[\s\S]+\/\*\/\s*([\s\S]+)\s*\/+\*\/
99
+ taskName: "comment trick toggle",
100
+ fn(mode) {
101
+ processSources(
102
+ /** @type {string} */ (this.taskName), (code) => {
103
+ return mode === "clean" ? cleanup(code) : doIt(code);
104
+ }, {
105
+ /* ctt
106
+ ...params
107
+ /*/
108
+ ...params,
109
+ //*/
110
+ },
111
+ );
112
+ },
113
+ get help() {
114
+ return `Do comment trick toggle
115
+ It recognizes three markers: \`ctt | comment-toggle-trick | https://coderwall\`
116
+ jstool -cmd cmtTrick[:clean] (-base <source dir> | -bases "<source dir>,<source dir>,...") [-test re/\\\\.js$/]
117
+ note:
118
+ :clean - remove comment token etc leaving the currently enabled code
119
+ base (or root) - scan single source folder
120
+ bases - must be array type arg, "['<path>', '<path>',...]" or "<path>,<path>,..."
121
+ test - terget extension, default is /\\\\.js$/
122
+ `;
123
+ },
124
+ };
125
+ };
package/tool-lib/ps.js ADDED
@@ -0,0 +1,158 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2023 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
8
+ /// <reference path="./tools.d.ts"/>
9
+ // @ts-check
10
+
11
+ const DEBUG = 0;
12
+ /**
13
+ * @file `processSources` will be globalized
14
+ */
15
+ module.exports = {
16
+ /**
17
+ *
18
+ * @param {import("fs")} fs
19
+ * @param {import("../utils")} utils
20
+ */
21
+ globalize: (fs, utils) => {
22
+ /**
23
+ *
24
+ * @param {string} taskName
25
+ * @param {(source: string) => Promise<string> | string} process
26
+ * @param {TProcessSourcesOpt} [opt]
27
+ */
28
+ function processSources(taskName, process, opt = {}) {
29
+ const {
30
+ root = params.root,
31
+ base = "./build",
32
+ bases,
33
+ test = /\.js$/,
34
+ suffix = "",
35
+ targets,
36
+ } = opt;
37
+
38
+ /** @type {string[]} */
39
+ let sourceFiles;
40
+ if ((!targets && root) || bases || base) {
41
+ sourceFiles = [];
42
+ const re = params.test || test;
43
+ const actualBases = Array.isArray(bases) ? bases : [base];
44
+ DEBUG && console.log("processSources::", actualBases, re);
45
+ // DEVNOTE: 2022/05/28 - bash bug?, cannot evaluate regex string at "tool.sh"
46
+ DEBUG && console.log("processSources::re", re, re.constructor);
47
+ /**
48
+ * @param {string} dir
49
+ * @param {true=} recurse
50
+ */
51
+ const visitDirectry = (dir, recurse) => {
52
+ if (dir.length) {
53
+ if (!fs.existsSync(dir)) {
54
+ console.info(`directory: [${dir}] is not found`);
55
+ } else {
56
+ utils.walkDirSync(dir, (dirent) => {
57
+ const path = `${dir}/${dirent.name}`;
58
+ if (dirent.isFile() && re.test(dirent.name)) {
59
+ DEBUG && console.log("processSources::", dirent.name);
60
+ sourceFiles.push(path);
61
+ } else if (recurse && dirent.isDirectory()) {
62
+ visitDirectry(path, true);
63
+ }
64
+ });
65
+ }
66
+ }
67
+ };
68
+ if (root) {
69
+ visitDirectry(root.trim(), true);
70
+ } else {
71
+ // DEVNOTE: remove extra whitespaces
72
+ actualBases.forEach((base) => base && visitDirectry(base.trim()));
73
+ }
74
+ } else {
75
+ sourceFiles = params.targets || params.args || targets;
76
+ if (sourceFiles.length && params.basePath) {
77
+ // DEVNOTE: remove extra whitespaces
78
+ sourceFiles = sourceFiles.map((s) => s && s.trim());
79
+ const basePath = getBasePaths()?.[0] || ".";
80
+ // const basePath = Array.isArray(params.basePath) ? params.basePath[0] : params.basePath;
81
+ utils.prependStringTo(sourceFiles, basePath, "/");
82
+ }
83
+ }
84
+
85
+ sourceFiles = sourceFiles.filter(Boolean);
86
+ DEBUG && console.log("processSources::processSources:", sourceFiles);
87
+ let count = sourceFiles.length;
88
+ let written = 0;
89
+ /** @type {(fileName?: string) => void} */
90
+ const done = (fileName) => {
91
+ --count === 0 &&
92
+ (console.timeEnd(taskName),
93
+ utils.log(`[${taskName}] file written: ${written}`));
94
+ if (verbose && fileName) {
95
+ utils.log(`[${taskName}] done: ${fileName}`);
96
+ }
97
+ };
98
+ /** @param {NodeJS.ErrnoException} err */
99
+ const handleError = (err) => {
100
+ console.error(err);
101
+ done();
102
+ };
103
+ count && console.time(taskName);
104
+ for (const sourceFile of sourceFiles) {
105
+ fs.stat(sourceFile, (err, stat) => {
106
+ if (stat.isFile()) {
107
+ fs.readFile(sourceFile, "utf8", async (err, code) => {
108
+ if (!err) {
109
+ const result = await runProcess(code, process);
110
+ // TODO: changeable extensions
111
+ const outputFileName = sourceFile.replace(/(?=\.js$)/, suffix);
112
+ // DEVNOTE: 2023/10/27 - Do not write no changes code
113
+ if (result !== code) {
114
+ fs.writeFile(outputFileName, result, () => {
115
+ written++, done(outputFileName);
116
+ });
117
+ } else {
118
+ done(outputFileName);
119
+ }
120
+ return;
121
+ }
122
+ handleError(err);
123
+ });
124
+ } else if (err) {
125
+ handleError(err);
126
+ } else {
127
+ done();
128
+ }
129
+ });
130
+ }
131
+ }
132
+ // OK
133
+ globalThis.processSources = processSources;
134
+ },
135
+ };
136
+ globalThis.getBasePaths = function () {
137
+ const bp = params.basePath;
138
+ return Array.isArray(bp)
139
+ ? bp
140
+ : typeof bp === "string" && bp.length
141
+ ? [bp]
142
+ : void 0;
143
+ };
144
+ /**
145
+ * @param {string} code
146
+ * @param {(code: string) => Promise<string> | string} process
147
+ * @returns {Promise<string>}
148
+ */
149
+ function runProcess(code, process) {
150
+ return new Promise((resolve) => {
151
+ const result = process(code);
152
+ if (result instanceof Promise) {
153
+ result.then((/** @type {string} */ afterData) => resolve(afterData));
154
+ } else {
155
+ resolve(result);
156
+ }
157
+ });
158
+ }
@@ -0,0 +1,181 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2023 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
8
+ /// <reference path="./tools.d.ts"/>
9
+ // @ts-check
10
+ /**
11
+ * @file (R)ecord(W)ebpack(S)ize
12
+ */
13
+
14
+ /**
15
+ * actually, return value will be like `TVersionString + "-dev"`
16
+ *
17
+ * @type {(v: Array<string | number>) => TVersionString}
18
+ */
19
+ const normalizeVersion = (version) => {
20
+ return /** @type {TVersionString} */ (
21
+ version.slice(0, 3).join(".") + (version[3] || "")
22
+ );
23
+ };
24
+ /**
25
+ * actually, return value will be like `TVersionString + "-dev"`
26
+ *
27
+ * NOTE: `nversionArray` elements are will be change!
28
+ *
29
+ * @param {Array<string | number>} nversionArray
30
+ * @returns {TVersionString} normalizeVersion
31
+ * @type {(v: Array<string>) => TVersionString}
32
+ */
33
+ const decrementVersion = (nversionArray) => {
34
+ if (+nversionArray[2] > 0) {
35
+ // @ts-ignore DEVNOTE: 2025/11/8 11:21:37 - string が number として変換可能な場合、"++", "--" によって covnert される number
36
+ nversionArray[2]--;
37
+ } else if (+nversionArray[1] > 0) {
38
+ // @ts-ignore
39
+ nversionArray[1]--, (nversionArray[2] = 99);
40
+ } else if (+nversionArray[0] > 0) {
41
+ // @ts-ignore
42
+ nversionArray[0]--, (nversionArray[1] = nversionArray[2] = 99);
43
+ }
44
+ return normalizeVersion(nversionArray);
45
+ };
46
+
47
+ /**
48
+ *
49
+ * @param {TVersionRecords} record
50
+ */
51
+ const reduceRecord = (record) => {
52
+ let keys = /** @type {TVersionString[]} */ (Object.keys(record));
53
+ if (keys.length > 10) {
54
+ keys = keys.slice(keys.length - 10);
55
+ /** @type {TVersionRecords} */
56
+ const newRecord = {};
57
+ for (let i = 0; i < keys.length; ) {
58
+ const key = keys[i++];
59
+ newRecord[key] = record[key];
60
+ }
61
+ return newRecord;
62
+ }
63
+ return record;
64
+ };
65
+
66
+ /**
67
+ * @param {import("fs")} fs
68
+ * @param {import("../utils")} utils
69
+ * @returns {TJSToolEntry}
70
+ */
71
+ module.exports = (fs, utils) => {
72
+ return {
73
+ taskName: "(R)ecord(W)ebpack(S)ize",
74
+ fn() {
75
+ const thisPackage = utils.readJson("./package.json");
76
+ const recordPath = params.dest || "./logs/webpack-size.json";
77
+ /** @type {TVersionRecords} */
78
+ const sizeRecord = fs.existsSync(recordPath)
79
+ ? utils.readJson(recordPath)
80
+ : {};
81
+ /** @type {TVersionString} */
82
+ const versionStr = thisPackage.version;
83
+ const tags = /** @type {TRwsTags[]} */ (["webpack", "umd", "bin"]);
84
+ // const tags = /** @type {TRwsTags[]} */(["webpack", "umd", "bin"]).concat(params["rws-tags"] || []);
85
+
86
+ /**
87
+ * @param {TSizeRecordEntry} a
88
+ * @param {TSizeRecordEntry} b
89
+ * @returns
90
+ */
91
+ const isDiff = (a, b) => {
92
+ return tags.some((tag) => {
93
+ const x = a[tag], y = b[tag];
94
+ // DEVNOTE: 2023/10/27 - means `tag` is not exist
95
+ if (typeof x !== "number" && typeof y !== "number") {
96
+ return false;
97
+ }
98
+ return !x || !y || x ^ y;
99
+ });
100
+ };
101
+ params.debug && console.log(tags);
102
+ /** @type {TSizeRecordEntry} */
103
+ const entry = {};
104
+ tags.forEach((tag) => {
105
+ const sourcePath = params[/** @type {TRwsTags} */ (tag)] || `./dist/${tag}/index.js`;
106
+ if (fs.existsSync(sourcePath)) {
107
+ entry[tag] = fs.statSync(sourcePath).size;
108
+ }
109
+ });
110
+ if (params["rws-tags"]) {
111
+ const tagArray = Array.isArray(params["rws-tags"]) ? params["rws-tags"] : [params["rws-tags"]];
112
+ tagArray.forEach((tagToekn) => {
113
+ const [tag, sourcePath] = tagToekn.split(":");
114
+ if (fs.existsSync(sourcePath)) {
115
+ entry[/** @type {TRwsTags} */ (tag)] = fs.statSync(sourcePath).size;
116
+ tags.push(/** @type {TRwsTags} */ (tag));
117
+ }
118
+ });
119
+ }
120
+
121
+ params.debug && console.log(entry);
122
+ // if (entry.webpack || entry.umd || entry.bin) {
123
+ if (tags.some((tag) => entry[tag])) {
124
+ let nversionArray = /** @type {RegExpExecArray} */ ( /(\d+)\.(\d+)\.(\d+)(-\w+)?/.exec(versionStr) );
125
+ const $0 = nversionArray.shift();
126
+ /** @type {TSizeRecordEntry} */
127
+ let prevEntry = sizeRecord[/** @type {TVersionString} */ ($0)];
128
+ if (!prevEntry)
129
+ do {
130
+ // DEVNOTE: 2023/10/24 - Modified the code to maintain a version string like `1.3.3-dev`!
131
+ const version = decrementVersion(nversionArray);
132
+ // DEVNOTE: debug log
133
+ // console. log(`decrementVersion: nversion=${nversionArray}, version=${version}`);
134
+ prevEntry = sizeRecord[version];
135
+ if (prevEntry || version.startsWith("0.0.0")) {
136
+ break;
137
+ }
138
+ } while (1);
139
+
140
+ let needWrite = true;
141
+ let msg = "";
142
+ if (prevEntry) {
143
+ if (isDiff(prevEntry, entry)) {
144
+ sizeRecord[versionStr] = entry;
145
+ utils.log(reduceRecord(sizeRecord));
146
+ msg = "[%s] is updated";
147
+ } else {
148
+ needWrite = false;
149
+ console.log(
150
+ `${this.taskName}: No change from previours webpack size record.`,
151
+ prevEntry,
152
+ );
153
+ }
154
+ } else {
155
+ sizeRecord[versionStr] = entry;
156
+ msg = `${this.taskName}: webpack size record created: [%s]`;
157
+ }
158
+ if (needWrite) {
159
+ utils.writeTextUTF8(
160
+ JSON.stringify(sizeRecord, null, 2),
161
+ recordPath,
162
+ () => {
163
+ console.log(msg, recordPath, entry);
164
+ },
165
+ );
166
+ }
167
+ }
168
+ },
169
+ get help() {
170
+ return `${this.taskName}
171
+ ex - jstool -cmd rws [-webpack lib/webpack.js -umd umd/webpack.js -dest "./dev-extras/webpack-size.json"] [-rws-tags "web/login:./dist/es/web/login.mjs,webpack-esm:./dist/webpack-esm/index.mjs"]
172
+ note:
173
+ webpack - if not specified then apply "./dist/webpack/index.js"
174
+ umd - if not specified then apply "./dist/umd/index.js"
175
+ bin - if not specified then apply "./dist/bin/index.js"
176
+ rws-tags - It is treated as parameter array separated by ":", e.g - "web/login:./dist/es/web/login.mjs,webpack-esm:./dist/webpack-esm/index.mjs"
177
+ dest - if not specified then apply "./logs/webpack-size.json"
178
+ `;
179
+ },
180
+ };
181
+ };