Bläddra i källkod

Change `type` to `module`.

Naotoshi Fujita 2 år sedan
förälder
incheckning
41595ab17e

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/js/splide-renderer.min.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/js/splide-renderer.min.js.map


+ 34 - 25
dist/js/splide.cjs.js

@@ -2498,21 +2498,26 @@ function Slide(Splide2, Components2, options) {
   };
 }
 
-const _Splide = class {
+class Splide {
+  static defaults = {};
+  static STATES = STATES;
+  root;
+  event = EventInterface();
+  Components = {};
+  state = State(CREATED);
+  splides = [];
+  _o = {};
+  _C;
+  _E = {};
+  _T;
   constructor(target, options) {
-    this.event = EventInterface();
-    this.Components = {};
-    this.state = State(CREATED);
-    this.splides = [];
-    this._o = {};
-    this._E = {};
     const root = isString(target) ? query(document, target) : target;
     assert(root, `${root} is invalid.`);
     this.root = root;
     options = merge({
       label: getAttribute(root, ARIA_LABEL) || "",
       labelledby: getAttribute(root, ARIA_LABELLEDBY) || ""
-    }, DEFAULTS, _Splide.defaults, options || {});
+    }, DEFAULTS, Splide.defaults, options || {});
     try {
       merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE)));
     } catch (e) {
@@ -2609,10 +2614,7 @@ const _Splide = class {
   get index() {
     return this._C.Controller.getIndex();
   }
-};
-let Splide = _Splide;
-Splide.defaults = {};
-Splide.STATES = STATES;
+}
 
 const CLASS_RENDERED = "is-rendered";
 
@@ -2622,8 +2624,10 @@ const RENDERER_DEFAULT_CONFIG = {
 };
 
 class Style {
+  styles = {};
+  id;
+  options;
   constructor(id, options) {
-    this.styles = {};
     this.id = id;
     this.options = options;
   }
@@ -2664,10 +2668,24 @@ class Style {
 }
 
 class SplideRenderer {
+  static clean(splide) {
+    const { on } = EventInterface(splide);
+    const { root } = splide;
+    const clones = queryAll(root, `.${CLASS_CLONE}`);
+    on(EVENT_MOUNTED, () => {
+      remove(child(root, "style"));
+    });
+    remove(clones);
+  }
+  contents;
+  slides = [];
+  Direction;
+  Style;
+  options = {};
+  config;
+  id;
+  breakpoints = [];
   constructor(contents, options, config, defaults) {
-    this.slides = [];
-    this.options = {};
-    this.breakpoints = [];
     merge(DEFAULTS, defaults || {});
     merge(merge(this.options, DEFAULTS), options || {});
     this.contents = contents;
@@ -2678,15 +2696,6 @@ class SplideRenderer {
     assert(this.contents.length, "Provide at least 1 content.");
     this.init();
   }
-  static clean(splide) {
-    const { on } = EventInterface(splide);
-    const { root } = splide;
-    const clones = queryAll(root, `.${CLASS_CLONE}`);
-    on(EVENT_MOUNTED, () => {
-      remove(child(root, "style"));
-    });
-    remove(clones);
-  }
   init() {
     this.parseBreakpoints();
     this.initSlides();

+ 34 - 25
dist/js/splide.esm.js

@@ -2494,21 +2494,26 @@ function Slide(Splide2, Components2, options) {
   };
 }
 
-const _Splide = class {
+class Splide {
+  static defaults = {};
+  static STATES = STATES;
+  root;
+  event = EventInterface();
+  Components = {};
+  state = State(CREATED);
+  splides = [];
+  _o = {};
+  _C;
+  _E = {};
+  _T;
   constructor(target, options) {
-    this.event = EventInterface();
-    this.Components = {};
-    this.state = State(CREATED);
-    this.splides = [];
-    this._o = {};
-    this._E = {};
     const root = isString(target) ? query(document, target) : target;
     assert(root, `${root} is invalid.`);
     this.root = root;
     options = merge({
       label: getAttribute(root, ARIA_LABEL) || "",
       labelledby: getAttribute(root, ARIA_LABELLEDBY) || ""
-    }, DEFAULTS, _Splide.defaults, options || {});
+    }, DEFAULTS, Splide.defaults, options || {});
     try {
       merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE)));
     } catch (e) {
@@ -2605,10 +2610,7 @@ const _Splide = class {
   get index() {
     return this._C.Controller.getIndex();
   }
-};
-let Splide = _Splide;
-Splide.defaults = {};
-Splide.STATES = STATES;
+}
 
 const CLASS_RENDERED = "is-rendered";
 
@@ -2618,8 +2620,10 @@ const RENDERER_DEFAULT_CONFIG = {
 };
 
 class Style {
+  styles = {};
+  id;
+  options;
   constructor(id, options) {
-    this.styles = {};
     this.id = id;
     this.options = options;
   }
@@ -2660,10 +2664,24 @@ class Style {
 }
 
 class SplideRenderer {
+  static clean(splide) {
+    const { on } = EventInterface(splide);
+    const { root } = splide;
+    const clones = queryAll(root, `.${CLASS_CLONE}`);
+    on(EVENT_MOUNTED, () => {
+      remove(child(root, "style"));
+    });
+    remove(clones);
+  }
+  contents;
+  slides = [];
+  Direction;
+  Style;
+  options = {};
+  config;
+  id;
+  breakpoints = [];
   constructor(contents, options, config, defaults) {
-    this.slides = [];
-    this.options = {};
-    this.breakpoints = [];
     merge(DEFAULTS, defaults || {});
     merge(merge(this.options, DEFAULTS), options || {});
     this.contents = contents;
@@ -2674,15 +2692,6 @@ class SplideRenderer {
     assert(this.contents.length, "Provide at least 1 content.");
     this.init();
   }
-  static clean(splide) {
-    const { on } = EventInterface(splide);
-    const { root } = splide;
-    const clones = queryAll(root, `.${CLASS_CLONE}`);
-    on(EVENT_MOUNTED, () => {
-      remove(child(root, "style"));
-    });
-    remove(clones);
-  }
   init() {
     this.parseBreakpoints();
     this.initSlides();

+ 14 - 12
dist/js/splide.js

@@ -2493,21 +2493,26 @@
     };
   }
 
-  const _Splide = class {
+  class Splide {
+    static defaults = {};
+    static STATES = STATES;
+    root;
+    event = EventInterface();
+    Components = {};
+    state = State(CREATED);
+    splides = [];
+    _o = {};
+    _C;
+    _E = {};
+    _T;
     constructor(target, options) {
-      this.event = EventInterface();
-      this.Components = {};
-      this.state = State(CREATED);
-      this.splides = [];
-      this._o = {};
-      this._E = {};
       const root = isString(target) ? query(document, target) : target;
       assert(root, `${root} is invalid.`);
       this.root = root;
       options = merge({
         label: getAttribute(root, ARIA_LABEL) || "",
         labelledby: getAttribute(root, ARIA_LABELLEDBY) || ""
-      }, DEFAULTS, _Splide.defaults, options || {});
+      }, DEFAULTS, Splide.defaults, options || {});
       try {
         merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE)));
       } catch (e) {
@@ -2604,10 +2609,7 @@
     get index() {
       return this._C.Controller.getIndex();
     }
-  };
-  let Splide = _Splide;
-  Splide.defaults = {};
-  Splide.STATES = STATES;
+  }
 
   return Splide;
 

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/js/splide.min.js


BIN
dist/js/splide.min.js.gz


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/js/splide.min.js.map


+ 290 - 0
package-lock.json

@@ -539,6 +539,32 @@
       "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
       "dev": true
     },
+    "node_modules/@cspotcode/source-map-support": {
+      "version": "0.8.1",
+      "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+      "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "dependencies": {
+        "@jridgewell/trace-mapping": "0.3.9"
+      },
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": {
+      "version": "0.3.9",
+      "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+      "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "dependencies": {
+        "@jridgewell/resolve-uri": "^3.0.3",
+        "@jridgewell/sourcemap-codec": "^1.4.10"
+      }
+    },
     "node_modules/@csstools/selector-specificity": {
       "version": "2.0.2",
       "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz",
@@ -1452,6 +1478,38 @@
         "node": ">= 10"
       }
     },
+    "node_modules/@tsconfig/node10": {
+      "version": "1.0.9",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
+      "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
+    "node_modules/@tsconfig/node12": {
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
+      "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
+    "node_modules/@tsconfig/node14": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
+      "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
+    "node_modules/@tsconfig/node16": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
+      "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "node_modules/@types/babel__core": {
       "version": "7.1.19",
       "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
@@ -1960,6 +2018,14 @@
         "node": ">= 8"
       }
     },
+    "node_modules/arg": {
+      "version": "4.1.3",
+      "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
+      "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "node_modules/argparse": {
       "version": "1.0.10",
       "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -2468,6 +2534,14 @@
         "node": ">=10"
       }
     },
+    "node_modules/create-require": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
+      "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "node_modules/cross-spawn": {
       "version": "7.0.3",
       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -2634,6 +2708,17 @@
         "node": ">=8"
       }
     },
+    "node_modules/diff": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
+      "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "engines": {
+        "node": ">=0.3.1"
+      }
+    },
     "node_modules/diff-sequences": {
       "version": "29.0.0",
       "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz",
@@ -7955,6 +8040,62 @@
         "node": ">=12"
       }
     },
+    "node_modules/ts-node": {
+      "version": "10.9.1",
+      "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
+      "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "dependencies": {
+        "@cspotcode/source-map-support": "^0.8.0",
+        "@tsconfig/node10": "^1.0.7",
+        "@tsconfig/node12": "^1.0.7",
+        "@tsconfig/node14": "^1.0.0",
+        "@tsconfig/node16": "^1.0.2",
+        "acorn": "^8.4.1",
+        "acorn-walk": "^8.1.1",
+        "arg": "^4.1.0",
+        "create-require": "^1.1.0",
+        "diff": "^4.0.1",
+        "make-error": "^1.1.1",
+        "v8-compile-cache-lib": "^3.0.1",
+        "yn": "3.1.1"
+      },
+      "bin": {
+        "ts-node": "dist/bin.js",
+        "ts-node-cwd": "dist/bin-cwd.js",
+        "ts-node-esm": "dist/bin-esm.js",
+        "ts-node-script": "dist/bin-script.js",
+        "ts-node-transpile-only": "dist/bin-transpile.js",
+        "ts-script": "dist/bin-script-deprecated.js"
+      },
+      "peerDependencies": {
+        "@swc/core": ">=1.2.50",
+        "@swc/wasm": ">=1.2.50",
+        "@types/node": "*",
+        "typescript": ">=2.7"
+      },
+      "peerDependenciesMeta": {
+        "@swc/core": {
+          "optional": true
+        },
+        "@swc/wasm": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/ts-node/node_modules/acorn-walk": {
+      "version": "8.2.0",
+      "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
+      "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "engines": {
+        "node": ">=0.4.0"
+      }
+    },
     "node_modules/tslib": {
       "version": "2.4.0",
       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
@@ -8106,6 +8247,14 @@
       "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
       "dev": true
     },
+    "node_modules/v8-compile-cache-lib": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
+      "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "node_modules/v8-to-istanbul": {
       "version": "9.0.1",
       "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz",
@@ -8392,6 +8541,17 @@
         "node": ">=12"
       }
     },
+    "node_modules/yn": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
+      "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "engines": {
+        "node": ">=6"
+      }
+    },
     "node_modules/yocto-queue": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
@@ -8782,6 +8942,31 @@
       "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
       "dev": true
     },
+    "@cspotcode/source-map-support": {
+      "version": "0.8.1",
+      "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+      "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "requires": {
+        "@jridgewell/trace-mapping": "0.3.9"
+      },
+      "dependencies": {
+        "@jridgewell/trace-mapping": {
+          "version": "0.3.9",
+          "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+          "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+          "dev": true,
+          "optional": true,
+          "peer": true,
+          "requires": {
+            "@jridgewell/resolve-uri": "^3.0.3",
+            "@jridgewell/sourcemap-codec": "^1.4.10"
+          }
+        }
+      }
+    },
     "@csstools/selector-specificity": {
       "version": "2.0.2",
       "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz",
@@ -9463,6 +9648,38 @@
       "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==",
       "dev": true
     },
+    "@tsconfig/node10": {
+      "version": "1.0.9",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
+      "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
+    "@tsconfig/node12": {
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
+      "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
+    "@tsconfig/node14": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
+      "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
+    "@tsconfig/node16": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
+      "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "@types/babel__core": {
       "version": "7.1.19",
       "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
@@ -9837,6 +10054,14 @@
         "picomatch": "^2.0.4"
       }
     },
+    "arg": {
+      "version": "4.1.3",
+      "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
+      "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "argparse": {
       "version": "1.0.10",
       "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -10219,6 +10444,14 @@
         "yaml": "^1.10.0"
       }
     },
+    "create-require": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
+      "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "cross-spawn": {
       "version": "7.0.3",
       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -10345,6 +10578,14 @@
       "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==",
       "dev": true
     },
+    "diff": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
+      "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "diff-sequences": {
       "version": "29.0.0",
       "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz",
@@ -14176,6 +14417,39 @@
         }
       }
     },
+    "ts-node": {
+      "version": "10.9.1",
+      "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
+      "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
+      "dev": true,
+      "optional": true,
+      "peer": true,
+      "requires": {
+        "@cspotcode/source-map-support": "^0.8.0",
+        "@tsconfig/node10": "^1.0.7",
+        "@tsconfig/node12": "^1.0.7",
+        "@tsconfig/node14": "^1.0.0",
+        "@tsconfig/node16": "^1.0.2",
+        "acorn": "^8.4.1",
+        "acorn-walk": "^8.1.1",
+        "arg": "^4.1.0",
+        "create-require": "^1.1.0",
+        "diff": "^4.0.1",
+        "make-error": "^1.1.1",
+        "v8-compile-cache-lib": "^3.0.1",
+        "yn": "3.1.1"
+      },
+      "dependencies": {
+        "acorn-walk": {
+          "version": "8.2.0",
+          "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
+          "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
+          "dev": true,
+          "optional": true,
+          "peer": true
+        }
+      }
+    },
     "tslib": {
       "version": "2.4.0",
       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
@@ -14279,6 +14553,14 @@
       "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
       "dev": true
     },
+    "v8-compile-cache-lib": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
+      "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "v8-to-istanbul": {
       "version": "9.0.1",
       "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz",
@@ -14492,6 +14774,14 @@
       "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
       "dev": true
     },
+    "yn": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
+      "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
+      "dev": true,
+      "optional": true,
+      "peer": true
+    },
     "yocto-queue": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",

+ 1 - 0
package.json

@@ -4,6 +4,7 @@
   "description": "Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.",
   "author": "Naotoshi Fujita",
   "license": "MIT",
+  "type": "module",
   "main": "dist/js/splide.cjs.js",
   "module": "dist/js/splide.esm.js",
   "types": "dist/types/index.d.ts",

+ 11 - 8
scripts/build-css.js

@@ -1,6 +1,8 @@
-const sass = require( 'sass' );
-const fs   = require( 'fs' ).promises;
-const path = require( 'path' );
+import sass from 'sass';
+import fs from 'fs/promises';
+import path from 'path';
+
+
 const name = 'splide';
 
 const files = [
@@ -10,7 +12,7 @@ const files = [
   './src/css/themes/skyblue/index.scss',
 ];
 
-async function buildCss( file ) {
+async function buildScss( file ) {
   const result  = await sass.compileAsync( file, { style: 'compressed' } );
   const outFile = rename( file );
 
@@ -31,8 +33,9 @@ function rename( file ) {
   return `./dist/${ dirname }/${ name }-${ fragments[ fragments.length - 1 ] }.min.css`;
 }
 
-Promise.all( files.map( buildCss ) ).catch( e => console.error( e ) );
+Promise.all( files.map( buildScss ) ).catch( e => console.error( e ) );
+
 
-exports.buildCss = () => {
-  files.forEach( buildCss );
-};
+export const buildCss = () => {
+  files.forEach( buildScss );
+}

+ 7 - 9
scripts/build-module.js

@@ -1,9 +1,10 @@
-const rollup  = require( 'rollup' ).rollup;
-const esbuild = require( 'rollup-plugin-esbuild' ).default;
-const banner  = require( './constants/banner' );
-const name    = 'splide';
+import { rollup } from 'rollup';
+import esbuild from 'rollup-plugin-esbuild';
+import { BANNER } from './constants/banner.js';
 
 
+const name = 'splide';
+
 function buildModule( type ) {
   return rollup( {
     input: './src/js/index.ts',
@@ -12,7 +13,7 @@ function buildModule( type ) {
     ],
   } ).then( bundle => {
     return bundle.write( {
-      banner,
+      banner   : BANNER,
       file     : `./dist/js/${ name }.${ type }.js`,
       format   : type,
       sourcemap: false,
@@ -21,7 +22,4 @@ function buildModule( type ) {
   } );
 }
 
-Promise.all( [ buildModule( 'cjs' ), buildModule( 'esm' ) ] ).catch( e => console.error( e ) );
-
-exports.buildCjs = () => buildModule( 'cjs' );
-exports.buildEsm = () => buildModule( 'esm' );
+Promise.all( [ buildModule( 'cjs' ), buildModule( 'esm' ) ] ).catch( e => console.error( e ) );

+ 12 - 12
scripts/build-script.js

@@ -1,13 +1,13 @@
-const rollup  = require( 'rollup' ).rollup;
-const esbuild = require( 'rollup-plugin-esbuild' ).default;
-const path    = require( 'path' );
-const minify  = require( './plugins/minify' ).minify;
-const banner  = require( './constants/banner' );
-const fs      = require( 'fs' ).promises;
-const zlib    = require( 'zlib' );
-const name    = 'splide';
+import { rollup } from 'rollup';
+import esbuild from 'rollup-plugin-esbuild';
+import { minify } from './plugins/minify.js';
+import { BANNER } from './constants/banner.js';
+import fs from 'fs/promises';
+import * as zlib from 'zlib';
 
 
+const name = 'splide';
+
 async function buildScript( compress, type = 'default' ) {
   const file = `./dist/js/${ name }${ type !== 'default' ? `-${ type }` : '' }${ compress ? '.min' : '' }.js`;
 
@@ -20,8 +20,8 @@ async function buildScript( compress, type = 'default' ) {
   } );
 
   await bundle.write( {
-    banner,
     file,
+    banner   : BANNER,
     format   : 'umd',
     name     : type === 'default' ? 'Splide' : 'SplideRenderer',
     sourcemap: compress,
@@ -48,6 +48,6 @@ Promise.all( [
   buildScript( true, 'renderer' ),
 ] ).catch( console.error );
 
-exports.buildJs       = () => buildScript();
-exports.buildMin      = () => buildScript( true );
-exports.buildRenderer = () => buildScript( true, 'renderer' );
+export const buildJs       = () => buildScript();
+export const buildMin      = () => buildScript( true );
+export const buildRenderer = () => buildScript( 'renderer' );

+ 10 - 7
scripts/build-types.js

@@ -1,10 +1,13 @@
-const { default: dts } = require( 'rollup-plugin-dts' );
-const { rollup }       = require( 'rollup' );
-const { promises: fs } = require( 'fs' );
-const path             = require( 'path' );
-const util             = require( 'util' );
-const exec             = util.promisify( require( 'child_process' ).exec );
-const dir              = './dist/types';
+import dts from 'rollup-plugin-dts';
+import { rollup } from 'rollup';
+import fs from 'fs/promises';
+import path from 'path';
+import * as util from 'util';
+import { exec as _exec } from 'child_process';
+
+
+const exec = util.promisify( _exec );
+const dir  = './dist/types';
 
 
 async function clean() {

+ 3 - 2
scripts/constants/banner.js

@@ -1,6 +1,7 @@
-const info = require( '../../package.json' );
+import info from '../../package.json' assert { type: "json" };
 
-module.exports = `/*!
+
+export const BANNER = `/*!
  * Splide.js
  * Version  : ${ info.version }
  * License  : ${ info.license }

+ 7 - 6
scripts/develop.js

@@ -1,22 +1,23 @@
-const chokidar = require( 'chokidar' );
-const { buildJs, buildRenderer } = require( './build-script' );
-const { buildCss } = require( './build-css' );
+import chokidar from 'chokidar';
+import { buildJs, buildRenderer } from './build-script.js';
+import { buildCss } from './build-css.js';
+
 
 chokidar.watch( [ './src/js/**/*.ts', '!*.test.ts', '!./src/js/renderer/**/*.ts' ] ).on( 'change', async () => {
   console.log( 'Building Script...' );
-  await buildJs()
+  await buildJs();
   console.log( 'Finished' );
 } );
 
 chokidar.watch( [ './src/js/renderer/**/*.ts', '!*.test.ts' ] ).on( 'change', async () => {
   console.log( 'Building Renderer Script...' );
-  await buildRenderer()
+  await buildRenderer();
   console.log( 'Finished' );
 } );
 
 chokidar.watch( [ './src/css/**/*.scss' ] ).on( 'change', async () => {
   console.log( 'Building CSS...' );
-  await buildCss()
+  await buildCss();
   console.log( 'Finished' );
 } );
 

+ 4 - 5
scripts/plugins/minify.js

@@ -1,4 +1,5 @@
-const uglify = require( 'uglify-js' );
+// const uglify = require( 'uglify-js' );
+import uglify from 'uglify-js';
 
 const DEFAULTS = {
   minify: {
@@ -15,7 +16,7 @@ const DEFAULTS = {
   },
 };
 
-function minify( pluginOptions = {} ) {
+export function minify( pluginOptions = {} ) {
   pluginOptions = { ...DEFAULTS, ...pluginOptions };
 
   return {
@@ -30,6 +31,4 @@ function minify( pluginOptions = {} ) {
       return result;
     },
   };
-}
-
-exports.minify = minify;
+}

+ 4 - 3
scripts/serve.js

@@ -1,6 +1,7 @@
-const http   = require( 'http' );
-const path   = require( 'path' );
-const fs     = require( 'fs' ).promises;
+import * as http from 'http';
+import path from 'path';
+import fs from 'fs/promises';
+
 const server = http.createServer();
 
 const mime = {

+ 4 - 6
tsconfig.json

@@ -1,7 +1,9 @@
 {
   "compilerOptions": {
     "outDir": "dist",
-    "target": "es6",
+    "target": "ESNext",
+    "module": "ESNext",
+    "lib": [ "ESNext", "DOM" ],
     "sourceMap": true,
     "mapRoot": "./",
     "moduleResolution": "node",
@@ -11,11 +13,7 @@
     "strictNullChecks": false,
     "suppressImplicitAnyIndexErrors": true,
     "declarationDir": "./dist/types",
-    "declaration": true,
-    "lib": [
-      "dom",
-      "es6"
-    ],
+    "declaration": true
   },
   "include": [
     "src/js/**/*.ts",

Vissa filer visades inte eftersom för många filer har ändrats