webpack-gc-i18n-plugin 1.1.13 → 1.1.14

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.
@@ -48,7 +48,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48
48
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
49
49
  PERFORMANCE OF THIS SOFTWARE.
50
50
  ***************************************************************************** */
51
- /* global Reflect, Promise, SuppressedError, Symbol */
51
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
52
52
 
53
53
  var __assign = function () {
54
54
  __assign = Object.assign || function __assign(t) {
@@ -100,12 +100,8 @@ function __generator(thisArg, body) {
100
100
  f,
101
101
  y,
102
102
  t,
103
- g;
104
- return g = {
105
- next: verb(0),
106
- "throw": verb(1),
107
- "return": verb(2)
108
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
103
+ g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
104
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
109
105
  return this;
110
106
  }), g;
111
107
  function verb(n) {
@@ -701,7 +697,12 @@ function hasOriginSymbols$1(value) {
701
697
  const originRegex = REGEX_MAP[option.originLang];
702
698
  return originRegex ? originRegex.test(value) : false;
703
699
  }
700
+ function isTemplateFragmentSegment(value) {
701
+ return /[^\p{Script=Han}A-Za-z0-9_\s]/u.test(value);
702
+ }
704
703
  function getTemplateSemanticSplitSegments(value) {
704
+ const expressionCount = value.match(/\$\{[^}]+}/g)?.length || 0;
705
+ if (expressionCount < 2) return [];
705
706
  const segments = value.split(/\$\{[^}]+}/g);
706
707
  const result = new Set();
707
708
  for (let index = 0; index < segments.length - 1; index++) {
@@ -709,7 +710,7 @@ function getTemplateSemanticSplitSegments(value) {
709
710
  const afterValue = segments[index + 1];
710
711
  if (!hasOriginSymbols$1(beforeValue) || !hasOriginSymbols$1(afterValue)) continue;
711
712
  [beforeValue, afterValue].forEach(segment => {
712
- if (segment.trim().length > 1) {
713
+ if (segment.trim().length > 1 && isTemplateFragmentSegment(segment)) {
713
714
  result.add(segment);
714
715
  }
715
716
  });