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.cjs CHANGED
@@ -50,7 +50,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
50
50
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51
51
  PERFORMANCE OF THIS SOFTWARE.
52
52
  ***************************************************************************** */
53
- /* global Reflect, Promise, SuppressedError, Symbol */
53
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
54
54
 
55
55
  var __assign = function () {
56
56
  __assign = Object.assign || function __assign(t) {
@@ -102,12 +102,8 @@ function __generator(thisArg, body) {
102
102
  f,
103
103
  y,
104
104
  t,
105
- g;
106
- return g = {
107
- next: verb(0),
108
- "throw": verb(1),
109
- "return": verb(2)
110
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
105
+ g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
106
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
111
107
  return this;
112
108
  }), g;
113
109
  function verb(n) {
@@ -1474,7 +1470,12 @@ function hasOriginSymbols$1(value) {
1474
1470
  const originRegex = REGEX_MAP[exports.option.originLang];
1475
1471
  return originRegex ? originRegex.test(value) : false;
1476
1472
  }
1473
+ function isTemplateFragmentSegment(value) {
1474
+ return /[^\p{Script=Han}A-Za-z0-9_\s]/u.test(value);
1475
+ }
1477
1476
  function getTemplateSemanticSplitSegments(value) {
1477
+ const expressionCount = value.match(/\$\{[^}]+}/g)?.length || 0;
1478
+ if (expressionCount < 2) return [];
1478
1479
  const segments = value.split(/\$\{[^}]+}/g);
1479
1480
  const result = new Set();
1480
1481
  for (let index = 0; index < segments.length - 1; index++) {
@@ -1482,7 +1483,7 @@ function getTemplateSemanticSplitSegments(value) {
1482
1483
  const afterValue = segments[index + 1];
1483
1484
  if (!hasOriginSymbols$1(beforeValue) || !hasOriginSymbols$1(afterValue)) continue;
1484
1485
  [beforeValue, afterValue].forEach(segment => {
1485
- if (segment.trim().length > 1) {
1486
+ if (segment.trim().length > 1 && isTemplateFragmentSegment(segment)) {
1486
1487
  result.add(segment);
1487
1488
  }
1488
1489
  });