You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.
When the code after conversion is run in node.js v8:
(function (exports, require, module, __filename, __dirname) { const obj = JSON.parse('{"foo":"
^^^^^^^^^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
According to MDN, the latest Edge seems to fail too.
The text was updated successfully, but these errors were encountered:
If you want optimal backwards compatibility, you could indeed escape those two characters. Alternatively you could document that this plugin produces output that only works in modern environments (e.g. Node.js v10+).
Alternatively you could document that this plugin produces output that only works in modern environments (e.g. Node.js v10+).
I decided not to care about this backwards compatibility... (This is because Node.js v8 LTS is until 2019/12/31). I just documented this issue in README.
I'm not sure this is a bug, but this behavior is not an ideal one, I think.
This plugin generates a source code that old JavaScript engine cannot parse when object includes U+2028 or U+2029 in a string. cf. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON#JavaScript_and_JSON_differences
before
after
When the code after conversion is run in node.js v8:
According to MDN, the latest Edge seems to fail too.
The text was updated successfully, but these errors were encountered: