-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unquoted object keys should support non-ASCII characters #1
Comments
Other references: |
Are there any ideas on how to support Unicode and their escape sequences in identifiers? What are the options, and what are the pros and cons of those options? It seems the biggest hurdle is that there is no standard way to determine what Unicode category a code point belongs to. For example, an identifier can start with Here are some ideas on perhaps how to solve this:
I think it's worth discussing the costs and benefits of implementing this support. What do you think? |
Great work investigating this! If you've already prototyped and profiled implementing this directly, I'd say that's a very appealing option. No dependency means this continues to be easily portable (e.g. in the browser). 👍 |
Full unicode testing could take as much space as the rest of the library. :) But I think it's worth it. You could generate this using esprima tools and just hardcode it into the library, since it's unlikely to be changed, or just take this one. PS: dependencies aren't an issue, because you can always use browserify. |
Nice @rlidwka, thanks! I agree re: browserify (we use and love it at FiftyThree), but I think there's still something to be said for having a simple drop-in file for developers who aren't knowledgeable about these tools. Maybe it's not worth worrying about that audience in this case though. We could also always provide a browserify-built distribution, either in the repo or via GitHub releases/downloads. |
Maybe this is enough. |
Fixed in 35269da. |
This large commit enhances support for JavaScript modules. This adds `lib/index.mjs`, which re-exports `lib/index.js` as a default export and `parse` and `stringify` as named exports. The `module` field in `package.json` now points to this file as the entry point for `import` statements in versions of Node.js that support modules. With this change, `import` statements in Node.js no longer need to use the path `json5/dist/index.mjs`, and should import the module as `json5` instead. `test/index.mjs` ensures that `lib/index.js` and `lib/index.mjs` export the same instance. This follows the guidance in approach json5#1 of [Writing dual packages while avoiding or minimizing hazards][guidance]. `rollup.config.js` now uses `lib/index.mjs` as its entry point for building browser bundles for JavaScript modules environments. It now writes browser bundles to `dist/json5.js` and `dist/json5.esm.js`, as well as minified versions. These are the new canonical paths for browser bundles. The legacy `dist/index.*` paths still exist for backward compatibility, but they will be removed in the next major version. All files in `build` and `lib` now explicitly require `lib/index.js` to ensure that `lib/index.mjs` is not imported. All files in `test` now require the package root to simulate the default behavior of the version of Node.js being tested. [guidance]: https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#writing-dual-packages-while-avoiding-or-minimizing-hazards
This large commit enhances support for JavaScript modules. This adds `lib/index.mjs`, which re-exports `lib/index.js` as a default export and `parse` and `stringify` as named exports. The `module` field in `package.json` now points to this file as the entry point for `import` statements in versions of Node.js that support modules. With this change, `import` statements in Node.js no longer need to use the path `json5/dist/index.mjs`, and should import the module as `json5` instead. `test/index.mjs` ensures that `lib/index.js` and `lib/index.mjs` export the same instance. This follows the guidance in approach json5#1 of [Writing dual packages while avoiding or minimizing hazards][guidance]. `rollup.config.js` now uses `lib/index.mjs` as its entry point for building browser bundles for JavaScript modules environments. It now writes browser bundles to `dist/json5.umd.js` and `dist/json5.esm.js`, as well as minified versions. These are the new canonical paths for browser bundles. The legacy `dist/index.*` paths still exist for backward compatibility, but they will be removed in the next major version. All files in `build` and `lib` now explicitly require `lib/index.js` to ensure that `lib/index.mjs` is not imported. All files in `test` now require the package root to simulate the default behavior of the version of Node.js being tested. [guidance]: https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#writing-dual-packages-while-avoiding-or-minimizing-hazards squash
This large commit enhances support for JavaScript modules. This adds `lib/index.mjs`, which re-exports `lib/index.js` as a default export and `parse` and `stringify` as named exports. The `module` field in `package.json` now points to this file as the entry point for `import` statements in versions of Node.js that support modules. With this change, `import` statements in Node.js no longer need to use the path `json5/dist/index.mjs`, and should import the module as `json5` instead. `test/index.mjs` ensures that `lib/index.js` and `lib/index.mjs` export the same instance. This follows the guidance in approach json5#1 of [Writing dual packages while avoiding or minimizing hazards][guidance]. `rollup.config.js` now uses `lib/index.mjs` as its entry point for building browser bundles for JavaScript modules environments. It now writes browser bundles to `dist/json5.umd.js` and `dist/json5.esm.js`, as well as minified versions. These are the new canonical paths for browser bundles. The legacy `dist/index.*` paths still exist for backward compatibility, but they will be removed in the next major version. All files in `build` and `lib` now explicitly require `lib/index.js` to ensure that `lib/index.mjs` is not imported. All files in `test` now require the package root to simulate the default behavior of the version of Node.js being tested. [guidance]: https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#writing-dual-packages-while-avoiding-or-minimizing-hazards squash
This large commit enhances support for JavaScript modules. This adds `lib/index.mjs`, which re-exports `lib/index.js` as a default export and `parse` and `stringify` as named exports. The `module` field in `package.json` now points to this file as the entry point for `import` statements in versions of Node.js that support modules. With this change, `import` statements in Node.js no longer need to use the path `json5/dist/index.mjs`, and should import the module as `json5` instead. `test/index.mjs` ensures that `lib/index.js` and `lib/index.mjs` export the same instance. This follows the guidance in approach json5#1 of [Writing dual packages while avoiding or minimizing hazards][guidance]. `rollup.config.js` now uses `lib/index.mjs` as its entry point for building browser bundles for JavaScript modules environments. It now writes browser bundles to `dist/json5.umd.js` and `dist/json5.esm.js`, as well as minified versions. These are the new canonical paths for browser bundles. The legacy `dist/index.*` paths still exist for backward compatibility, but they will be removed in the next major version. All files in `build` and `lib` now explicitly require `lib/index.js` to ensure that `lib/index.mjs` is not imported. All files in `test` now require the package root to simulate the default behavior of the version of Node.js being tested. [guidance]: https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#writing-dual-packages-while-avoiding-or-minimizing-hazards squash
This large commit enhances support for JavaScript modules. This adds `lib/index.mjs`, which re-exports `lib/index.js` as a default export and `parse` and `stringify` as named exports. The `module` field in `package.json` now points to this file as the entry point for `import` statements in versions of Node.js that support modules. With this change, `import` statements in Node.js no longer need to use the path `json5/dist/index.mjs`, and should import the module as `json5` instead. `test/index.mjs` ensures that `lib/index.js` and `lib/index.mjs` export the same instance. This follows the guidance in approach json5#1 of [Writing dual packages while avoiding or minimizing hazards][guidance]. `rollup.config.js` now uses `lib/index.mjs` as its entry point for building browser bundles for JavaScript modules environments. It now writes browser bundles to `dist/json5.umd.js` and `dist/json5.esm.js`, as well as minified versions. These are the new canonical paths for browser bundles. The legacy `dist/index.*` paths still exist for backward compatibility, but they will be removed in the next major version. All files in `build` and `lib` now explicitly require `lib/index.js` to ensure that `lib/index.mjs` is not imported. All files in `test` now require the package root to simulate the default behavior of the version of Node.js being tested. [guidance]: https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#writing-dual-packages-while-avoiding-or-minimizing-hazards squash
* Explain JSON5 better. Proactively emphasize that this is for config file type use cases, not machine-to-machine communication (the #1 misunderstanding or objection to JSON5). * Market/sell it better. The stats and company/project names are exciting! =) * Link to blog post. This doesn't need to be front-and-center though; just added it to my name in the credits. * Emphasize ES5 compatibility. Just put a stake in the ground here and preempt feature requests we'll never accept.
* Explain JSON5 better. Proactively emphasize that this is for config file type use cases, not machine-to-machine communication (the #1 misunderstanding or objection to JSON5). * Market/sell it better. The stats and company/project names are exciting! =) * Link to blog post. This doesn't need to be front-and-center though; just added it to my name in the credits. * Emphasize ES5 compatibility. Just put a stake in the ground here and preempt feature requests we'll never accept.
ES5 allows it. References:
Potentially some helpful resources:
The text was updated successfully, but these errors were encountered: