JSONPath-Plus / JSONPath

A fork of JSONPath from http://goessner.net/articles/JsonPath/
Other
975 stars 175 forks source link

Plans for new release to include breaking build changes #130

Closed brettz9 closed 3 years ago

brettz9 commented 4 years ago

Just giving a chance through a PR for the review of some significant build changes that will affect how JSONPath-Plus is imported. The immediate need is to try to fix #129 , but it is also for the sake of allowing direct import usage in Node ESM modules.

Note that the current use of exports in package.json will prevent Node users (on ESM-supporting versions--version 10 starts such usage, and I believe 14 ships it by default) from importing any other files in the repo (besides the main CJS and ESM builds). If anyone wishes any other files to be exported for some reason, let me know (though I don't see any particular need). It won't remove it from the npm package (so custom bundlers can still grab any file), but it will prevent a Node script directly importing specific paths within the package.

PR description

Overview of breaking changes

  1. Adds support for genuine ESM in Node (type and exports in package.json and changed main path).
  2. Changes browser paths to include "-browser" in the file name
  3. Adds browser to package.json to point to browser build for browser-specific bundling. Rollup users wishing the browser bundle must ensure @rollup/plugin-node-resolve has mainFields to include browser as the first item in the array; Webpack users may need to set resolve with aliasFields: ['browser'] and/or mainFields: ['browser', 'module', 'main'], ensuring that browser is in the front of the list
  4. Has module point to the Node-specific build (with a new path)

Summary of all changes

Checklist

abhishekarun commented 4 years ago

When is this planned to get merged and released?

brettz9 commented 4 years ago

https://github.com/JSONPath-Plus/JSONPath/issues/129#issuecomment-656984652