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.
@@ -25,7 +25,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
25
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
26
  PERFORMANCE OF THIS SOFTWARE.
27
27
  ***************************************************************************** */
28
- /* global Reflect, Promise, SuppressedError, Symbol */
28
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
29
29
 
30
30
  var __assign = function () {
31
31
  __assign = Object.assign || function __assign(t) {
@@ -77,12 +77,8 @@ function __generator(thisArg, body) {
77
77
  f,
78
78
  y,
79
79
  t,
80
- g;
81
- return g = {
82
- next: verb(0),
83
- "throw": verb(1),
84
- "return": verb(2)
85
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
80
+ g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
81
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
86
82
  return this;
87
83
  }), g;
88
84
  function verb(n) {
@@ -678,7 +674,12 @@ function hasOriginSymbols$1(value) {
678
674
  const originRegex = REGEX_MAP[option.originLang];
679
675
  return originRegex ? originRegex.test(value) : false;
680
676
  }
677
+ function isTemplateFragmentSegment(value) {
678
+ return /[^\p{Script=Han}A-Za-z0-9_\s]/u.test(value);
679
+ }
681
680
  function getTemplateSemanticSplitSegments(value) {
681
+ const expressionCount = value.match(/\$\{[^}]+}/g)?.length || 0;
682
+ if (expressionCount < 2) return [];
682
683
  const segments = value.split(/\$\{[^}]+}/g);
683
684
  const result = new Set();
684
685
  for (let index = 0; index < segments.length - 1; index++) {
@@ -686,7 +687,7 @@ function getTemplateSemanticSplitSegments(value) {
686
687
  const afterValue = segments[index + 1];
687
688
  if (!hasOriginSymbols$1(beforeValue) || !hasOriginSymbols$1(afterValue)) continue;
688
689
  [beforeValue, afterValue].forEach(segment => {
689
- if (segment.trim().length > 1) {
690
+ if (segment.trim().length > 1 && isTemplateFragmentSegment(segment)) {
690
691
  result.add(segment);
691
692
  }
692
693
  });