Skip to content

Commit

Permalink
feat: change output file to cjs format, upgrade to babel7
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed Oct 4, 2018
1 parent c306e06 commit 2e04321
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 35 deletions.
5 changes: 2 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"env": {
"test": {
"presets": [["env", {"loose": true}], "stage-1"]
"presets": [["@babel/preset-env", {"loose": true}]]
},
"development": {
"presets": [["env", {"loose": true, "modules": false}], "stage-1"],
"plugins": ["external-helpers"]
"presets": [["@babel/preset-env", {"loose": true, "modules": false}]]
}
}
}
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
"license": "MIT",
"author": "Chunpeng Huo",
"devDependencies": {
"babel-eslint": "^8.2.6",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-1": "^6.24.1",
"babel-register": "^6.26.0",
"babelify": "^8.0.0",
"browserify": "^16.2.2",
"eslint": "^5.4.0",
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"babel-eslint": "^10.0.1",
"babelify": "^10.0.0",
"browserify": "^16.2.3",
"eslint": "^5.6.1",
"jquery": "^3.3.1",
"rollup": "^0.64.1",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-terser": "^1.0.1",
"rollup": "^0.66.2",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-terser": "^3.0.0",
"standard-changelog": "^2.0.1",
"tap-dot": "^2.0.0",
"tape": "^4.9.1",
"tape-run": "^4.0.0"
},
Expand Down
10 changes: 3 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ import resolve from 'rollup-plugin-node-resolve';
import {terser} from "rollup-plugin-terser";

export default {
input: 'src/index.js',
input: 'src/dnd-service.js',
output: {
format: 'umd',
name: 'BcxAureliaDnd',
file: 'dist/index.js',
globals: {
"aurelia-event-aggregator": "AureliaEventAggregator"
}
format: 'cjs',
file: 'dist/index.js'
},
external: ["aurelia-event-aggregator"],
plugins: [
Expand Down
20 changes: 10 additions & 10 deletions src/dnd-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {trPreview, liPreview, unknownTagPreview, defaultPreview} from './preview
// DndService only works in browser.
// code can be loaded in nodejs env, as long as you don't run it.
// for aurelia component testing in nodejs, feed constructor with a mock DndService.
//


const doc = _global.document;
const documentElement = doc && doc.documentElement;
Expand Down Expand Up @@ -187,7 +185,7 @@ function getCoord (coord, e) {
return host[coord];
}

export class DndSource {
class DndSource {
constructor(delegate, options = {}) {
if (!delegate) {
throw new Error("Missing delegate for dnd source.");
Expand Down Expand Up @@ -232,7 +230,7 @@ export class DndSource {
}
}

export class DndTarget {
class DndTarget {
constructor(delegate, options = {}) {
if (!delegate) {
throw new Error("Missing delegate for dnd target.");
Expand Down Expand Up @@ -291,16 +289,15 @@ function indexOfHandler(array, handler) {
return -1; // nothing found
}

export class DndService {
static inject = [EventAggregator]

dndSources = []
dndTargets = []
previewDrawers = [];
class DndService {

constructor(ea) {
this.ea = ea;

this.dndSources = [];
this.dndTargets = [];
this.previewDrawers = [];

injectStyles();
this.addPreviewDrawer(defaultPreview);
this.addPreviewDrawer(unknownTagPreview);
Expand Down Expand Up @@ -744,3 +741,6 @@ export class DndService {
}
}

DndService.inject = [EventAggregator];

export {DndService};
3 changes: 0 additions & 3 deletions src/index.js

This file was deleted.

0 comments on commit 2e04321

Please sign in to comment.