Skip to content

Commit 288511f

Browse files
authored
Merge pull request #239 from ambar/fix-bundler-compatibility
Fix bundler compatibility
2 parents 0b3caca + 38438d8 commit 288511f

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

src/color.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ export default class Color {
119119
}
120120

121121
static defineFunction (name, code, o = code) {
122-
if (arguments.length === 1) {
123-
[name, code, o] = [arguments[0].name, arguments[0], arguments[0]];
124-
}
125-
126122
let {instance = true, returns} = o;
127123

128124
let func = function (...args) {
@@ -168,12 +164,6 @@ export default class Color {
168164
if (exports.register) {
169165
exports.register(Color);
170166
}
171-
else if (exports.default) {
172-
Color.defineFunction(exports.default.name, exports.default);
173-
}
174-
else if (typeof exports === "function") {
175-
Color.defineFunction(exports);
176-
}
177167
else {
178168
// No register method, just add the module's functions
179169
for (let name in exports) {

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ import Color from "./color.js";
55
import "./spaces/index.js";
66

77
// Import all DeltaE methods
8-
import * as deltaE from "./deltaE.js";
8+
import deltaE from "./deltaE.js";
99
import * as deltaEMethods from "./deltaE/index.js";
1010

1111
Color.extend(deltaEMethods);
12-
Color.extend(deltaE);
12+
Color.extend({deltaE});
1313

1414
// Import optional modules
1515
import * as variations from "./variations.js";
1616
Color.extend(variations);
1717

1818
import contrast from "./contrast.js";
19-
Color.extend(contrast);
19+
Color.extend({contrast});
2020

2121
import * as chromaticity from "./chromaticity.js";
2222
Color.extend(chromaticity);

types/src/color.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ declare class Color {
9090
alpha: number
9191
): Color;
9292

93-
static defineFunction(code: DefineFunctionHybrid): void;
9493
static defineFunction(name: string, code: DefineFunctionHybrid): void;
9594
static defineFunction(
9695
name: string,
@@ -102,9 +101,7 @@ declare class Color {
102101

103102
static extend(
104103
exports:
105-
| DefineFunctionHybrid
106104
| { register: (color: typeof Color) => void }
107-
| { default: DefineFunctionHybrid }
108105
| Record<string, DefineFunctionHybrid>
109106
): void;
110107

0 commit comments

Comments
 (0)