ux(exports): replaced main export path with init

BREAKING CHANGE: The main export path, 'snabbdom' was replaced with
the export path 'snabbdom/init'. This new export path includes only
the named export `init`.

Reference: #522.
pull/697/head
Shahar Or (mightyiam) 5 years ago committed by Shahar Dawn Or
parent fefd141f5f
commit 09f2d1ca5a

6
.gitignore vendored

@ -23,6 +23,9 @@
/build/package/htmldomapi.d.ts
/build/package/htmldomapi.js
/build/package/htmldomapi.js.map
/build/package/init.d.ts
/build/package/init.js
/build/package/init.js.map
/build/package/is.d.ts
/build/package/is.js
/build/package/is.js.map
@ -56,9 +59,6 @@
/build/package/modules/style.d.ts
/build/package/modules/style.js
/build/package/modules/style.js.map
/build/package/snabbdom.d.ts
/build/package/snabbdom.js
/build/package/snabbdom.js.map
/build/package/thunk.d.ts
/build/package/thunk.js
/build/package/thunk.js.map

@ -58,7 +58,7 @@ performance, small size and all the features listed below.
## Example
```mjs
import { init } from 'snabbdom'
import { init } from 'snabbdom/init'
import { classModule } from 'snabbdom/modules/class'
import { propsModule } from 'snabbdom/modules/props'
import { styleModule } from 'snabbdom/modules/style'
@ -102,7 +102,7 @@ patch(vnode, newVnode) // Snabbdom efficiently updates the old view to the new s
## Table of contents
* [Core documentation](#core-documentation)
* [`snabbdom.init`](#snabbdominit)
* [`init`](#init)
* [`patch`](#patch)
* [Unmounting](#unmounting)
* [`snabbdom/h`](#snabbdomh)
@ -146,9 +146,9 @@ The core of Snabbdom provides only the most essential functionality.
It is designed to be as simple as possible while still being fast and
extendable.
### `snabbdom.init`
### `init`
The core exposes only one single function `snabbdom.init`. This `init`
The core exposes only one single function `init`. This `init`
takes a list of modules and returns a `patch` function that uses the
specified set of modules.
@ -211,7 +211,7 @@ Converts a DOM node into a virtual node. Especially good for patching over an pr
server-side generated content.
```mjs
import { init } from 'snabbdom'
import { init } from 'snabbdom/init'
import { classModule } from 'snabbdom/modules/class'
import { propsModule } from 'snabbdom/modules/props'
import { styleModule } from 'snabbdom/modules/style'

@ -4,7 +4,7 @@
"description": "A virtual DOM library with focus on simplicity, modularity, powerful features and performance.",
"type": "module",
"exports": {
"./": "./build/package/snabbdom.js",
"./init": "./build/package/init.js",
"./h": "./build/package/h.js",
"./helpers/attachto": "./build/package/helpers/attachto.js",
"./hooks": "./build/package/hooks.js",

@ -45,9 +45,6 @@ function createKeyToOldIdx (children: VNode[], beginIdx: number, endIdx: number)
const hooks: Array<keyof Module> = ['create', 'update', 'remove', 'destroy', 'pre', 'post']
export { h } from './h'
export { thunk } from './thunk'
export function init (modules: Array<Partial<Module>>, domApi?: DOMAPI) {
let i: number
let j: number

@ -22,6 +22,7 @@
"helpers/attachto.ts",
"hooks.ts",
"htmldomapi.ts",
"init.ts",
"is.ts",
"jsx-global.ts",
"jsx.ts",
@ -33,7 +34,6 @@
"modules/module.ts",
"modules/props.ts",
"modules/style.ts",
"snabbdom.ts",
"thunk.ts",
"tovnode.ts",
"vnode.ts"

@ -2,7 +2,7 @@ import 'core-js/stable/array/fill'
import faker from 'faker'
import { VNode } from '../../package/vnode'
import { h } from '../../package/h'
import { init as curInit } from '../../package/snabbdom'
import { init as curInit } from '../../package/init'
import { init as refInit } from 'latest-snabbdom-release'
import { assert } from 'chai'
import pReduce from 'p-reduce'

@ -1,5 +1,5 @@
import { assert } from 'chai'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { RemoveHook } from '../../package/hooks'
import { attachTo } from '../../package/helpers/attachto'
import { h } from '../../package/h'

@ -1,5 +1,5 @@
import { assert } from 'chai'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { attributesModule } from '../../package/modules/attributes'
import { h } from '../../package/h'

@ -1,7 +1,7 @@
import { assert } from 'chai'
import shuffle from 'lodash.shuffle'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { classModule } from '../../package/modules/class'
import { propsModule } from '../../package/modules/props'
import { styleModule } from '../../package/modules/style'

@ -1,7 +1,7 @@
import { assert } from 'chai'
import { datasetModule } from '../../package/modules/dataset'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { h } from '../../package/h'
var patch = init([

@ -1,7 +1,7 @@
import { assert } from 'chai'
import { VNode } from '../../package/vnode'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { eventListenersModule } from '../../package/modules/eventlisteners'
import { h } from '../../package/h'

@ -1,6 +1,6 @@
import { assert } from 'chai'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { h } from '../../package/h'
import { attributesModule } from '../../package/modules/attributes'

@ -1,6 +1,6 @@
import { assert } from 'chai'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { styleModule } from '../../package/modules/style'
import { h } from '../../package/h'
import { toVNode } from '../../package/tovnode'

@ -1,6 +1,6 @@
import { assert } from 'chai'
import { init } from '../../package/snabbdom'
import { init } from '../../package/init'
import { h } from '../../package/h'
import { thunk } from '../../package/thunk'
import { VNode } from '../../package/vnode'

Loading…
Cancel
Save