Skip to content

Commit

Permalink
Moving AMD require on top, after NOT including common JS (fabricjs#4797)
Browse files Browse the repository at this point in the history
* fixed amd
  • Loading branch information
asturur authored Mar 11, 2018
1 parent b489c5d commit 1032ec2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
8 changes: 6 additions & 2 deletions HEADER.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: '2.2.0' };
var fabric = fabric || { version: '2.2.1' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}

/* _AMD_START_ */
else if (typeof define === 'function' && define.amd) {
define([], function() { return fabric; });
}
/* _AMD_END_ */
if (typeof document !== 'undefined' && typeof window !== 'undefined') {
fabric.document = document;
fabric.window = window;
Expand Down
4 changes: 3 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ function appendFileContents(fileNames, callback) {
fs.readFile(__dirname + '/' + fileName, function (err, data) {
if (err) throw err;
var strData = String(data);
if (fileName === 'src/HEADER.js' && amdLib === false) {
strData = strData.replace(/\/\* _AMD_START_ \*\/[\s\S]*?\/\* _AMD_END_ \*\//g, '');
}
if (noStrict) {
strData = strData.replace(/"use strict";?\n?/, '');
}
Expand Down Expand Up @@ -235,7 +238,6 @@ var filesToInclude = [
ifSpecifiedInclude('textbox', 'src/shapes/textbox.class.js'),
ifSpecifiedInclude('textbox', 'src/mixins/textbox_behavior.mixin.js'),

ifSpecifiedAMDInclude(amdLib)
];

if (buildMinified) {
Expand Down
14 changes: 6 additions & 8 deletions dist/fabric.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
var fabric = fabric || {
version: "2.2.0"
version: "2.2.1"
};

if (typeof exports !== "undefined") {
exports.fabric = fabric;
} else if (typeof define === "function" && define.amd) {
define([], function() {
return fabric;
});
}

if (typeof document !== "undefined" && typeof window !== "undefined") {
Expand Down Expand Up @@ -13991,10 +13995,4 @@ fabric.util.object.extend(fabric.IText.prototype, {
}
}
});
})();

if (typeof define === "function" && define.amd) {
define([], function() {
return fabric;
});
}
})();
2 changes: 1 addition & 1 deletion dist/fabric.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"homepage": "http://fabricjs.com/",
"version": "2.2.0",
"version": "2.2.1",
"author": "Juriy Zaytsev <[email protected]>",
"contributors": [
{
Expand Down
4 changes: 0 additions & 4 deletions src/amd/requirejs.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/shapes/object.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@

/**
* Color of object's fill
* takes css colors https://www.w3.org/TR/css-color-3/
* @type String
* @default
*/
Expand All @@ -279,6 +280,7 @@

/**
* Background color of an object.
* takes css colors https://www.w3.org/TR/css-color-3/
* @type String
* @default
*/
Expand All @@ -294,6 +296,7 @@

/**
* When defined, an object is rendered via stroke and this property specifies its color
* takes css colors https://www.w3.org/TR/css-color-3/
* @type String
* @default
*/
Expand Down

0 comments on commit 1032ec2

Please sign in to comment.