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.
package/dist/index.mjs CHANGED
@@ -26,7 +26,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
26
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
27
  PERFORMANCE OF THIS SOFTWARE.
28
28
  ***************************************************************************** */
29
- /* global Reflect, Promise, SuppressedError, Symbol */
29
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
30
30
 
31
31
  var __assign = function () {
32
32
  __assign = Object.assign || function __assign(t) {
@@ -78,12 +78,8 @@ function __generator(thisArg, body) {
78
78
  f,
79
79
  y,
80
80
  t,
81
- g;
82
- return g = {
83
- next: verb(0),
84
- "throw": verb(1),
85
- "return": verb(2)
86
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
81
+ g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
82
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
87
83
  return this;
88
84
  }), g;
89
85
  function verb(n) {
@@ -1450,7 +1446,12 @@ function hasOriginSymbols$1(value) {
1450
1446
  const originRegex = REGEX_MAP[option.originLang];
1451
1447
  return originRegex ? originRegex.test(value) : false;
1452
1448
  }
1449
+ function isTemplateFragmentSegment(value) {
1450
+ return /[^\p{Script=Han}A-Za-z0-9_\s]/u.test(value);
1451
+ }
1453
1452
  function getTemplateSemanticSplitSegments(value) {
1453
+ const expressionCount = value.match(/\$\{[^}]+}/g)?.length || 0;
1454
+ if (expressionCount < 2) return [];
1454
1455
  const segments = value.split(/\$\{[^}]+}/g);
1455
1456
  const result = new Set();
1456
1457
  for (let index = 0; index < segments.length - 1; index++) {
@@ -1458,7 +1459,7 @@ function getTemplateSemanticSplitSegments(value) {
1458
1459
  const afterValue = segments[index + 1];
1459
1460
  if (!hasOriginSymbols$1(beforeValue) || !hasOriginSymbols$1(afterValue)) continue;
1460
1461
  [beforeValue, afterValue].forEach(segment => {
1461
- if (segment.trim().length > 1) {
1462
+ if (segment.trim().length > 1 && isTemplateFragmentSegment(segment)) {
1462
1463
  result.add(segment);
1463
1464
  }
1464
1465
  });