Commit f361a7a
committed
Export browser bundle of drivers as ECMAScript module (neo4j#1038)
ECMAScript modules are the official standard format to package JavaScript code for reuse. This is standard improve the modularity of the applications by avoiding leaking global variables and other benefits.
Usage example of the `neo4j-driver-lite` esm in browser:
```javascript
// jsDelivr CDN minified for production use, version X.Y.Z where X.Y.Z >= 5.4.0
import neo4j from 'https://cdn.jsdelivr.net/npm/[email protected]/lib/browser/neo4j-lite-web.esm.min.js'
const driver = neo4j.driver(/* your host */, neo4j.auth.basic(/* user */, /* password */))
driver.verifyConnectivity()
.then(() => console.log('Connected'))
.catch(e => console.error(e))
```
**Changes in the `neo4j-driver-lite`**
`Browserify` was replaced by `rollup` as the browser building tool for building `umd` and `esm` outputs. Since `rollup` is already being used in the `testkit-backend`, this change also standardise the tooling in the monorepo.
The esm module is exported as `neo4j-lite-web.esm.js` (non-minified) and `neo4j-lite-web.esm.min.js` (minified). The files are available under `lib/browser` along with `umd` modules.
**Changes in the `neo4j-driver`**
`Browserify` was replace by `rollup` as in the `neo4j-driver-lite`. However, its usage is done using `gulp`. The library build was changed to use `tsc` building tool instead of `babel`.
Removed dev dependencies:
* @babel/eslint-parser
* @babel/preset-env
* @istanbuljs/nyc-config-babel
* babel-plugin-istanbul
* babelify
* browserify
* browserify-transform-tools
* gulp-babel
* istanbul
* karma-browserify
* nyc
* vinyl-source-stream
Removed prod dependencies:
* @babel/runtime
Some babel dependencies still needed since the gulp script depends on ES6 imports.1 parent 1856bdd commit f361a7a
File tree
22 files changed
+60481
-66144
lines changed- packages
- bolt-connection
- test/connection-provider
- core
- neo4j-driver-deno/lib/bolt-connection/connection
- neo4j-driver-lite
- neo4j-driver
- spec/support
- support
- test
- browser
- internal
- testkit-backend
- src/feature
22 files changed
+60481
-66144
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
81 | 102 | | |
82 | 103 | | |
83 | 104 | | |
| |||
0 commit comments