Skip to content

Commit 58f9a24

Browse files
committed
chore: Change the module to use a named export for Editable
BREAKING CHANGE: The module exports changed from a default export to a named export For Import: change ``` import Editable from '@livingdocs/editable.js' ``` to ``` import {Editable} from '@livingdocs/editable.js' ``` For require: change ``` const Editable = require('@livingdocs/editable.js') ``` to ``` const {Editable} = require('@livingdocs/editable.js') ``` The source code doesn't get transpiled anymore into the `lib` directory. This simplifies the usage together with npm link as there's a build step less in between. The files in the dist folder should work as before.
1 parent ed5a4fe commit 58f9a24

File tree

10 files changed

+11
-12
lines changed

10 files changed

+11
-12
lines changed

examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Prism from 'prismjs'
22

3-
import Editable from '../src/core'
3+
import {Editable} from '../src/core'
44
import eventList from './events.js'
55

66
// Paragraph Example

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"editable"
5959
],
6060
"license": "MIT",
61-
"main": "lib/core.js",
61+
"module": "src/core.js",
6262
"repository": {
6363
"type": "git",
6464
"url": "https://github.com/livingdocsIO/editable.js.git"
@@ -67,8 +67,7 @@
6767
"start": "WEBPACK_DEV=true BUILD_DOCS=true webpack serve",
6868
"build:dist": "rimraf ./coverage && BUILD_DIST=true webpack",
6969
"build:docs": "rimraf ./examples/dist && BUILD_DOCS=true webpack",
70-
"build:lib": "rimraf ./{lib,coverage} && babel src --out-dir lib",
71-
"build": "npm run build:dist -s && npm run build:lib -s && npm run build:docs -s",
70+
"build": "npm run build:dist -s && npm run build:docs -s",
7271
"test:ci": "npm run test:karma -s",
7372
"test": "npm run build -s && npm run test:karma -s",
7473
"posttest": "npm run lint -s",

spec/api.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Editable from '../src/core'
1+
import {Editable} from '../src/core'
22

33
describe('Editable', function () {
44
let editable, div

spec/config.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cloneDeep from 'lodash.clonedeep'
22
import config from '../src/config'
3-
import Editable from '../src/core'
3+
import {Editable} from '../src/core'
44

55
describe('Editable configuration', function () {
66

spec/create-default-events.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import rangy from 'rangy'
22

33
import Cursor from '../src/cursor'
4-
import Editable from '../src/core'
4+
import {Editable} from '../src/core'
55

66
describe('Default Events', function () {
77

spec/dispatcher.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import rangy from 'rangy'
33
import * as content from '../src/content'
44
import Cursor from '../src/cursor'
55
import Keyboard from '../src/keyboard'
6-
import Editable from '../src/core'
6+
import {Editable} from '../src/core'
77
import Selection from '../src/selection'
88
const {key} = Keyboard
99

spec/highlighting.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rangy from 'rangy'
2-
import Editable from '../src/core'
2+
import {Editable} from '../src/core'
33
import Highlighting from '../src/highlighting'
44
import highlightSupport from '../src/highlight-support'
55
import WordHighlighter from '../src/plugins/highlighting/text-highlighting'

spec/spellcheck.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import rangy from 'rangy'
22
import sinon from 'sinon'
33

4-
import Editable from '../src/core'
4+
import {Editable} from '../src/core'
55
import Highlighting from '../src/highlighting'
66
import Cursor from '../src/cursor'
77
import {createElement} from '../src/util/dom'

src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {domArray} from './util/dom'
3535
*
3636
* @class Editable
3737
*/
38-
export default class Editable {
38+
export class Editable {
3939

4040
constructor (instanceConfig) {
4141
const defaultInstanceConfig = {

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
output: {
2525
library: dist ? 'Editable' : undefined,
2626
libraryTarget: 'umd',
27-
libraryExport: 'default',
27+
libraryExport: 'Editable',
2828
path: __dirname,
2929
filename: '[name].js'
3030
},

0 commit comments

Comments
 (0)