@intlify/bundle-utils 12.0.0-alpha.3 → 12.0.0-alpha.4

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/lib/index.cjs CHANGED
@@ -14,7 +14,20 @@ const yamlEslintParser = require('yaml-eslint-parser');
14
14
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
15
15
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
16
16
 
17
+ function _interopNamespaceCompat(e) {
18
+ if (e && typeof e === 'object' && 'default' in e) return e;
19
+ const n = Object.create(null);
20
+ if (e) {
21
+ for (const k in e) {
22
+ n[k] = e[k];
23
+ }
24
+ }
25
+ n.default = e;
26
+ return n;
27
+ }
28
+
17
29
  const module__default = /*#__PURE__*/_interopDefaultCompat(module$1);
30
+ const messageCompiler__namespace = /*#__PURE__*/_interopNamespaceCompat(messageCompiler);
18
31
 
19
32
  const _require = module__default.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
20
33
  function checkInstallPackage(pkg, debug) {
@@ -160,6 +173,14 @@ const ON_ERROR_NOOP = () => {
160
173
  function parsePath(path) {
161
174
  return path ? path.join(".") : "";
162
175
  }
176
+ const COMPILE_ERROR_MESSAGES = messageCompiler__namespace.errorMessages;
177
+ function getCompileErrorMessage(err) {
178
+ if (err.message !== String(err.code)) {
179
+ return err.message;
180
+ }
181
+ const text = COMPILE_ERROR_MESSAGES?.[err.code];
182
+ return text ? text.replace(/:\s*\\?'?\{\d+\}'?/g, "") : err.message;
183
+ }
163
184
  function generateMessageFunction(msg, options = {}, path) {
164
185
  const env = options.env != null ? options.env : "development";
165
186
  const strictMessage = shared.isBoolean(options.strictMessage) ? options.strictMessage : true;
@@ -188,7 +209,7 @@ function generateMessageFunction(msg, options = {}, path) {
188
209
  domain: err.domain,
189
210
  location: err.location
190
211
  };
191
- onError(err.message, extra);
212
+ onError(getCompileErrorMessage(err), extra);
192
213
  errors.push(err);
193
214
  }
194
215
  };
@@ -307,7 +328,7 @@ function generateResourceAst(msg, options = {}, path) {
307
328
  domain: err.domain,
308
329
  location: err.location
309
330
  };
310
- onError(err.message, extra);
331
+ onError(getCompileErrorMessage(err), extra);
311
332
  errors.push(err);
312
333
  }
313
334
  };
@@ -316,6 +337,41 @@ function generateResourceAst(msg, options = {}, path) {
316
337
  const code = !occured ? `${shared.friendlyJSONstringify(ast)}` : `\`${_msg}\``;
317
338
  return { code, ast, map, errors };
318
339
  }
340
+ function describeResource({ type, filename }) {
341
+ return type === "sfc" ? `the i18n custom block of ${filename}` : `${filename}`;
342
+ }
343
+ function describeValue(value) {
344
+ if (Array.isArray(value)) return "an array";
345
+ if (value === void 0) return "undefined";
346
+ return `a ${typeof value}`;
347
+ }
348
+ function stringifyValue(value) {
349
+ if (typeof value === "number") return Object.is(value, -0) ? "-0" : String(value);
350
+ if (value === void 0) return "undefined";
351
+ return JSON.stringify(value);
352
+ }
353
+ function createResourceError(message, options) {
354
+ return new Error(`${message} in ${describeResource(options)}.`);
355
+ }
356
+ function createResourceParseError(err, options, columnOffset = 0) {
357
+ if (!(err instanceof Error)) return err;
358
+ const { lineNumber, column } = err;
359
+ const position = lineNumber != null ? ` (${lineNumber}:${column + columnOffset})` : "";
360
+ return new SyntaxError(`${err.message} in ${describeResource(options)}${position}`, {
361
+ cause: err
362
+ });
363
+ }
364
+ function createOxcParseError(errors, source, options, offsetUnit = "utf-16") {
365
+ const error = errors.find((e) => e.severity === "Error") ?? errors[0];
366
+ const err = new Error(error.message);
367
+ const start = error.labels[0]?.start;
368
+ if (start != null) {
369
+ const before = offsetUnit === "utf-8" ? Buffer.from(source).subarray(0, start).toString() : source.slice(0, start);
370
+ err.lineNumber = before.split("\n").length;
371
+ err.column = before.length - before.lastIndexOf("\n");
372
+ }
373
+ return createResourceParseError(err, options);
374
+ }
319
375
  function excludeLocales({
320
376
  messages,
321
377
  onlyLocales
@@ -351,10 +407,16 @@ function generate$3(targetSource, options) {
351
407
  const value = Buffer.isBuffer(targetSource) ? targetSource.toString() : targetSource;
352
408
  const _options = Object.assign({}, DEFAULT_OPTIONS, options, { source: value });
353
409
  const generator = createCodeGenerator(_options);
354
- const { program: ast } = oxcParser.parseSync(_options.filename ?? "", value, {
410
+ const { program: ast, errors } = oxcParser.parseSync(_options.filename ?? "", value, {
355
411
  sourceType: "module",
356
- lang: "js"
412
+ lang: "js",
413
+ // `(value)` is the value itself: `export default ({ ... })` is an object, a parenthesized
414
+ // message is compiled, and escodegen does not know `ParenthesizedExpression`
415
+ preserveParens: false
357
416
  });
417
+ if (errors.length > 0) {
418
+ throw createOxcParseError(errors, value, _options);
419
+ }
358
420
  const exportResult = scanAst(ast);
359
421
  if (!_options.allowDynamic) {
360
422
  if (!exportResult) {
@@ -646,7 +708,25 @@ function generate$2(targetSource, {
646
708
  escapeHtml,
647
709
  jit
648
710
  };
649
- let ast = jsoncEslintParser.parseJSON(value, { filePath: filename });
711
+ let ast;
712
+ try {
713
+ ast = jsoncEslintParser.parseJSON(value, { filePath: filename });
714
+ } catch (err) {
715
+ throw createResourceParseError(err, options);
716
+ }
717
+ const root = ast.body[0].expression;
718
+ if (root.type !== "JSONObjectExpression") {
719
+ const rootValue = jsoncEslintParser.getStaticJSONValue(root);
720
+ if (rootValue !== null) {
721
+ throw createResourceError(
722
+ `You need to define an object as the locale messages at the top level, but got ${describeValue(rootValue)}`,
723
+ options
724
+ );
725
+ }
726
+ value = JSON.stringify({});
727
+ ast = jsoncEslintParser.parseJSON(value, { filePath: filename });
728
+ options.source = void 0;
729
+ }
650
730
  if (!locale && type === "sfc" && onlyLocales?.length) {
651
731
  const messages = jsoncEslintParser.getStaticJSONValue(ast);
652
732
  value = JSON.stringify(
@@ -686,6 +766,19 @@ function _generate$1(generator, node, options = {}) {
686
766
  sourceMap && map != null && codeMaps.set(value, map);
687
767
  return code;
688
768
  }
769
+ function pushExpressionValue(node2) {
770
+ const value = jsoncEslintParser.getStaticJSONValue(node2);
771
+ if (shared.isString(value)) {
772
+ generator.push(codegenFn(value), node2, value);
773
+ return;
774
+ }
775
+ const strValue = stringifyValue(value);
776
+ if (forceStringify) {
777
+ generator.push(codegenFn(strValue), node2, strValue);
778
+ } else {
779
+ generator.push(strValue);
780
+ }
781
+ }
689
782
  const componentNamespace = "_Component";
690
783
  jsoncEslintParser.traverseNodes(node, {
691
784
  enterNode(node2, parent) {
@@ -742,6 +835,8 @@ function _generate$1(generator, node, options = {}) {
742
835
  } else {
743
836
  generator.push(strValue2);
744
837
  }
838
+ } else if (node2.value.type !== "JSONObjectExpression" && node2.value.type !== "JSONArrayExpression") {
839
+ pushExpressionValue(node2.value);
745
840
  }
746
841
  break;
747
842
  }
@@ -757,6 +852,14 @@ function _generate$1(generator, node, options = {}) {
757
852
  generator.push(strValue);
758
853
  }
759
854
  break;
855
+ case "JSONUnaryExpression":
856
+ case "JSONIdentifier":
857
+ case "JSONTemplateLiteral":
858
+ case "JSONBinaryExpression":
859
+ if (parent.type === "JSONArrayExpression") {
860
+ pushExpressionValue(node2);
861
+ }
862
+ break;
760
863
  }
761
864
  },
762
865
  leaveNode(node2, parent) {
@@ -806,6 +909,9 @@ function generate$1(targetSource, options) {
806
909
  let value = Buffer.isBuffer(targetSource) ? targetSource.toString() : targetSource;
807
910
  const _options = Object.assign({}, DEFAULT_OPTIONS, options, { source: value });
808
911
  const transformed = oxcTransform.transform(_options.filename ?? "", value, { lang: "ts" });
912
+ if (transformed.errors.length > 0) {
913
+ throw createOxcParseError(transformed.errors, value, _options, "utf-8");
914
+ }
809
915
  if (transformed && transformed.code) {
810
916
  value = transformed.code;
811
917
  _options.source = transformed.code;
@@ -829,6 +935,9 @@ function generate(targetSource, {
829
935
  jit = false
830
936
  }) {
831
937
  let value = Buffer.isBuffer(targetSource) ? targetSource.toString() : targetSource;
938
+ if (value.charCodeAt(0) === 65279) {
939
+ value = value.slice(1);
940
+ }
832
941
  const options = {
833
942
  type,
834
943
  source: value,
@@ -844,9 +953,31 @@ function generate(targetSource, {
844
953
  escapeHtml,
845
954
  jit
846
955
  };
847
- let ast = yamlEslintParser.parseYAML(value, { filePath: filename });
956
+ let ast;
957
+ try {
958
+ ast = yamlEslintParser.parseYAML(value, { filePath: filename });
959
+ } catch (err) {
960
+ throw createResourceParseError(err, options, 1);
961
+ }
962
+ const rootDocument = getRootDocument(ast, options);
963
+ const content = rootDocument?.content;
964
+ const root = content?.type === "YAMLWithMeta" ? content.value : content;
965
+ if (root?.type !== "YAMLMapping") {
966
+ const isAlias = root?.type === "YAMLAlias";
967
+ const rootValue = rootDocument == null || isAlias ? null : yamlEslintParser.getStaticYAMLValue(rootDocument);
968
+ if (isAlias || rootValue !== null) {
969
+ const actual = isAlias ? "an alias" : describeValue(rootValue);
970
+ throw createResourceError(
971
+ `You need to define an object as the locale messages at the top level, but got ${actual}`,
972
+ options
973
+ );
974
+ }
975
+ value = JSON.stringify({});
976
+ ast = yamlEslintParser.parseYAML(value, { filePath: filename });
977
+ options.source = void 0;
978
+ }
848
979
  if (!locale && type === "sfc" && onlyLocales?.length) {
849
- const messages = yamlEslintParser.getStaticYAMLValue(ast);
980
+ const messages = yamlEslintParser.getStaticYAMLValue(getRootDocument(ast, options));
850
981
  value = JSON.stringify(
851
982
  excludeLocales({
852
983
  messages,
@@ -871,6 +1002,16 @@ function generate(targetSource, {
871
1002
  map: newMap != null ? newMap : void 0
872
1003
  };
873
1004
  }
1005
+ function getRootDocument(ast, options) {
1006
+ const documents = ast.body.filter((doc) => doc.content != null);
1007
+ if (documents.length > 1) {
1008
+ throw createResourceError(
1009
+ `You need to define the locale messages in a single YAML document, but got ${documents.length} documents`,
1010
+ options
1011
+ );
1012
+ }
1013
+ return documents[0] ?? null;
1014
+ }
874
1015
  function _generate(generator, node, options = {}) {
875
1016
  const propsCountStack = [];
876
1017
  const pathStack = [];
@@ -931,7 +1072,7 @@ function _generate(generator, node, options = {}) {
931
1072
  const name = node2.key.value;
932
1073
  const value = node2.value.value;
933
1074
  const strName = JSON.stringify(name);
934
- const strValue = JSON.stringify(value);
1075
+ const strValue = stringifyValue(value);
935
1076
  name && pathStack.push(name.toString());
936
1077
  generator.push(`${strName}: `);
937
1078
  if (shared.isString(value)) {
@@ -950,7 +1091,7 @@ function _generate(generator, node, options = {}) {
950
1091
  case "YAMLScalar":
951
1092
  if (parent.type === "YAMLSequence") {
952
1093
  const value = node2.value;
953
- const strValue = JSON.stringify(value);
1094
+ const strValue = stringifyValue(value);
954
1095
  if (shared.isString(value)) {
955
1096
  generator.push(codegenFn(value), node2, value);
956
1097
  } else if (forceStringify) {
package/lib/index.mjs CHANGED
@@ -3,6 +3,7 @@ import { isBoolean, format, escapeHtml, friendlyJSONstringify, isString, isNumbe
3
3
  import { generate as generate$4 } from 'escodegen';
4
4
  import { parseSync } from 'oxc-parser';
5
5
  import { walk } from 'oxc-walker';
6
+ import * as messageCompiler from '@intlify/message-compiler';
6
7
  import { LOCATION_STUB, detectHtmlTag, baseCompile } from '@intlify/message-compiler';
7
8
  import { SourceMapGenerator, SourceMapConsumer } from 'source-map-js';
8
9
  import { parseJSON, getStaticJSONValue, traverseNodes } from 'jsonc-eslint-parser';
@@ -153,6 +154,14 @@ const ON_ERROR_NOOP = () => {
153
154
  function parsePath(path) {
154
155
  return path ? path.join(".") : "";
155
156
  }
157
+ const COMPILE_ERROR_MESSAGES = messageCompiler.errorMessages;
158
+ function getCompileErrorMessage(err) {
159
+ if (err.message !== String(err.code)) {
160
+ return err.message;
161
+ }
162
+ const text = COMPILE_ERROR_MESSAGES?.[err.code];
163
+ return text ? text.replace(/:\s*\\?'?\{\d+\}'?/g, "") : err.message;
164
+ }
156
165
  function generateMessageFunction(msg, options = {}, path) {
157
166
  const env = options.env != null ? options.env : "development";
158
167
  const strictMessage = isBoolean(options.strictMessage) ? options.strictMessage : true;
@@ -181,7 +190,7 @@ function generateMessageFunction(msg, options = {}, path) {
181
190
  domain: err.domain,
182
191
  location: err.location
183
192
  };
184
- onError(err.message, extra);
193
+ onError(getCompileErrorMessage(err), extra);
185
194
  errors.push(err);
186
195
  }
187
196
  };
@@ -300,7 +309,7 @@ function generateResourceAst(msg, options = {}, path) {
300
309
  domain: err.domain,
301
310
  location: err.location
302
311
  };
303
- onError(err.message, extra);
312
+ onError(getCompileErrorMessage(err), extra);
304
313
  errors.push(err);
305
314
  }
306
315
  };
@@ -309,6 +318,41 @@ function generateResourceAst(msg, options = {}, path) {
309
318
  const code = !occured ? `${friendlyJSONstringify(ast)}` : `\`${_msg}\``;
310
319
  return { code, ast, map, errors };
311
320
  }
321
+ function describeResource({ type, filename }) {
322
+ return type === "sfc" ? `the i18n custom block of ${filename}` : `${filename}`;
323
+ }
324
+ function describeValue(value) {
325
+ if (Array.isArray(value)) return "an array";
326
+ if (value === void 0) return "undefined";
327
+ return `a ${typeof value}`;
328
+ }
329
+ function stringifyValue(value) {
330
+ if (typeof value === "number") return Object.is(value, -0) ? "-0" : String(value);
331
+ if (value === void 0) return "undefined";
332
+ return JSON.stringify(value);
333
+ }
334
+ function createResourceError(message, options) {
335
+ return new Error(`${message} in ${describeResource(options)}.`);
336
+ }
337
+ function createResourceParseError(err, options, columnOffset = 0) {
338
+ if (!(err instanceof Error)) return err;
339
+ const { lineNumber, column } = err;
340
+ const position = lineNumber != null ? ` (${lineNumber}:${column + columnOffset})` : "";
341
+ return new SyntaxError(`${err.message} in ${describeResource(options)}${position}`, {
342
+ cause: err
343
+ });
344
+ }
345
+ function createOxcParseError(errors, source, options, offsetUnit = "utf-16") {
346
+ const error = errors.find((e) => e.severity === "Error") ?? errors[0];
347
+ const err = new Error(error.message);
348
+ const start = error.labels[0]?.start;
349
+ if (start != null) {
350
+ const before = offsetUnit === "utf-8" ? Buffer.from(source).subarray(0, start).toString() : source.slice(0, start);
351
+ err.lineNumber = before.split("\n").length;
352
+ err.column = before.length - before.lastIndexOf("\n");
353
+ }
354
+ return createResourceParseError(err, options);
355
+ }
312
356
  function excludeLocales({
313
357
  messages,
314
358
  onlyLocales
@@ -344,10 +388,16 @@ function generate$3(targetSource, options) {
344
388
  const value = Buffer.isBuffer(targetSource) ? targetSource.toString() : targetSource;
345
389
  const _options = Object.assign({}, DEFAULT_OPTIONS, options, { source: value });
346
390
  const generator = createCodeGenerator(_options);
347
- const { program: ast } = parseSync(_options.filename ?? "", value, {
391
+ const { program: ast, errors } = parseSync(_options.filename ?? "", value, {
348
392
  sourceType: "module",
349
- lang: "js"
393
+ lang: "js",
394
+ // `(value)` is the value itself: `export default ({ ... })` is an object, a parenthesized
395
+ // message is compiled, and escodegen does not know `ParenthesizedExpression`
396
+ preserveParens: false
350
397
  });
398
+ if (errors.length > 0) {
399
+ throw createOxcParseError(errors, value, _options);
400
+ }
351
401
  const exportResult = scanAst(ast);
352
402
  if (!_options.allowDynamic) {
353
403
  if (!exportResult) {
@@ -639,7 +689,25 @@ function generate$2(targetSource, {
639
689
  escapeHtml,
640
690
  jit
641
691
  };
642
- let ast = parseJSON(value, { filePath: filename });
692
+ let ast;
693
+ try {
694
+ ast = parseJSON(value, { filePath: filename });
695
+ } catch (err) {
696
+ throw createResourceParseError(err, options);
697
+ }
698
+ const root = ast.body[0].expression;
699
+ if (root.type !== "JSONObjectExpression") {
700
+ const rootValue = getStaticJSONValue(root);
701
+ if (rootValue !== null) {
702
+ throw createResourceError(
703
+ `You need to define an object as the locale messages at the top level, but got ${describeValue(rootValue)}`,
704
+ options
705
+ );
706
+ }
707
+ value = JSON.stringify({});
708
+ ast = parseJSON(value, { filePath: filename });
709
+ options.source = void 0;
710
+ }
643
711
  if (!locale && type === "sfc" && onlyLocales?.length) {
644
712
  const messages = getStaticJSONValue(ast);
645
713
  value = JSON.stringify(
@@ -679,6 +747,19 @@ function _generate$1(generator, node, options = {}) {
679
747
  sourceMap && map != null && codeMaps.set(value, map);
680
748
  return code;
681
749
  }
750
+ function pushExpressionValue(node2) {
751
+ const value = getStaticJSONValue(node2);
752
+ if (isString(value)) {
753
+ generator.push(codegenFn(value), node2, value);
754
+ return;
755
+ }
756
+ const strValue = stringifyValue(value);
757
+ if (forceStringify) {
758
+ generator.push(codegenFn(strValue), node2, strValue);
759
+ } else {
760
+ generator.push(strValue);
761
+ }
762
+ }
682
763
  const componentNamespace = "_Component";
683
764
  traverseNodes(node, {
684
765
  enterNode(node2, parent) {
@@ -735,6 +816,8 @@ function _generate$1(generator, node, options = {}) {
735
816
  } else {
736
817
  generator.push(strValue2);
737
818
  }
819
+ } else if (node2.value.type !== "JSONObjectExpression" && node2.value.type !== "JSONArrayExpression") {
820
+ pushExpressionValue(node2.value);
738
821
  }
739
822
  break;
740
823
  }
@@ -750,6 +833,14 @@ function _generate$1(generator, node, options = {}) {
750
833
  generator.push(strValue);
751
834
  }
752
835
  break;
836
+ case "JSONUnaryExpression":
837
+ case "JSONIdentifier":
838
+ case "JSONTemplateLiteral":
839
+ case "JSONBinaryExpression":
840
+ if (parent.type === "JSONArrayExpression") {
841
+ pushExpressionValue(node2);
842
+ }
843
+ break;
753
844
  }
754
845
  },
755
846
  leaveNode(node2, parent) {
@@ -799,6 +890,9 @@ function generate$1(targetSource, options) {
799
890
  let value = Buffer.isBuffer(targetSource) ? targetSource.toString() : targetSource;
800
891
  const _options = Object.assign({}, DEFAULT_OPTIONS, options, { source: value });
801
892
  const transformed = transform(_options.filename ?? "", value, { lang: "ts" });
893
+ if (transformed.errors.length > 0) {
894
+ throw createOxcParseError(transformed.errors, value, _options, "utf-8");
895
+ }
802
896
  if (transformed && transformed.code) {
803
897
  value = transformed.code;
804
898
  _options.source = transformed.code;
@@ -822,6 +916,9 @@ function generate(targetSource, {
822
916
  jit = false
823
917
  }) {
824
918
  let value = Buffer.isBuffer(targetSource) ? targetSource.toString() : targetSource;
919
+ if (value.charCodeAt(0) === 65279) {
920
+ value = value.slice(1);
921
+ }
825
922
  const options = {
826
923
  type,
827
924
  source: value,
@@ -837,9 +934,31 @@ function generate(targetSource, {
837
934
  escapeHtml,
838
935
  jit
839
936
  };
840
- let ast = parseYAML(value, { filePath: filename });
937
+ let ast;
938
+ try {
939
+ ast = parseYAML(value, { filePath: filename });
940
+ } catch (err) {
941
+ throw createResourceParseError(err, options, 1);
942
+ }
943
+ const rootDocument = getRootDocument(ast, options);
944
+ const content = rootDocument?.content;
945
+ const root = content?.type === "YAMLWithMeta" ? content.value : content;
946
+ if (root?.type !== "YAMLMapping") {
947
+ const isAlias = root?.type === "YAMLAlias";
948
+ const rootValue = rootDocument == null || isAlias ? null : getStaticYAMLValue(rootDocument);
949
+ if (isAlias || rootValue !== null) {
950
+ const actual = isAlias ? "an alias" : describeValue(rootValue);
951
+ throw createResourceError(
952
+ `You need to define an object as the locale messages at the top level, but got ${actual}`,
953
+ options
954
+ );
955
+ }
956
+ value = JSON.stringify({});
957
+ ast = parseYAML(value, { filePath: filename });
958
+ options.source = void 0;
959
+ }
841
960
  if (!locale && type === "sfc" && onlyLocales?.length) {
842
- const messages = getStaticYAMLValue(ast);
961
+ const messages = getStaticYAMLValue(getRootDocument(ast, options));
843
962
  value = JSON.stringify(
844
963
  excludeLocales({
845
964
  messages,
@@ -864,6 +983,16 @@ function generate(targetSource, {
864
983
  map: newMap != null ? newMap : void 0
865
984
  };
866
985
  }
986
+ function getRootDocument(ast, options) {
987
+ const documents = ast.body.filter((doc) => doc.content != null);
988
+ if (documents.length > 1) {
989
+ throw createResourceError(
990
+ `You need to define the locale messages in a single YAML document, but got ${documents.length} documents`,
991
+ options
992
+ );
993
+ }
994
+ return documents[0] ?? null;
995
+ }
867
996
  function _generate(generator, node, options = {}) {
868
997
  const propsCountStack = [];
869
998
  const pathStack = [];
@@ -924,7 +1053,7 @@ function _generate(generator, node, options = {}) {
924
1053
  const name = node2.key.value;
925
1054
  const value = node2.value.value;
926
1055
  const strName = JSON.stringify(name);
927
- const strValue = JSON.stringify(value);
1056
+ const strValue = stringifyValue(value);
928
1057
  name && pathStack.push(name.toString());
929
1058
  generator.push(`${strName}: `);
930
1059
  if (isString(value)) {
@@ -943,7 +1072,7 @@ function _generate(generator, node, options = {}) {
943
1072
  case "YAMLScalar":
944
1073
  if (parent.type === "YAMLSequence") {
945
1074
  const value = node2.value;
946
- const strValue = JSON.stringify(value);
1075
+ const strValue = stringifyValue(value);
947
1076
  if (isString(value)) {
948
1077
  generator.push(codegenFn(value), node2, value);
949
1078
  } else if (forceStringify) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intlify/bundle-utils",
3
3
  "description": "Bundle utilities for Intlify project",
4
- "version": "12.0.0-alpha.3",
4
+ "version": "12.0.0-alpha.4",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -22,7 +22,7 @@
22
22
  "@intlify/shared": "next",
23
23
  "escodegen": "^2.1.0",
24
24
  "jsonc-eslint-parser": "^2.3.0",
25
- "oxc-parser": "^0.130.0",
25
+ "oxc-parser": "^0.131.0",
26
26
  "oxc-transform": "^0.96.0",
27
27
  "oxc-walker": "^0.7.0",
28
28
  "source-map-js": "^1.0.1",