Skip to content
Browse files

REmove duplicate __decorate

  • Loading branch information...
1 parent a2b3811 commit 0ab3fa41b69ef1c3b87990ad231e00f567f9fe7c @deltakosh deltakosh committed
View
87 Tools/Gulp/gulp-addModuleExports.js
@@ -1,39 +1,48 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-
-module.exports = function (varName) {
- return through.obj(function (file, enc, cb) {
-
- var moduleExportsAddition =
- '\nif (((typeof window != "undefined" && window.module) || (typeof module != "undefined")) && typeof module.exports != "undefined") {\n' +
- ' module.exports = ' + varName + ';\n' +
- '};\n';
-
- var extendsAddition =
- 'var __extends = (this && this.__extends) || function (d, b) {\n' +
- 'for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n' +
- 'function __() { this.constructor = d; }\n' +
- '__.prototype = b.prototype;\n' +
- 'd.prototype = new __();\n' +
- '};\n';
-
- if (file.isNull()) {
- cb(null, file);
- return;
- }
-
- if (file.isStream()) {
- //streams not supported, no need for now.
- return;
- }
-
- try {
- file.contents = new Buffer(extendsAddition.concat(String(file.contents)).concat(moduleExportsAddition));
- this.push(file);
-
- } catch (err) {
- this.emit('error', new gutil.PluginError('gulp-add-module-exports', err, {fileName: file.path}));
- }
- cb();
- });
-};
+var gutil = require('gulp-util');
+var through = require('through2');
+
+module.exports = function (varName) {
+ return through.obj(function (file, enc, cb) {
+
+ var moduleExportsAddition =
+ '\nif (((typeof window != "undefined" && window.module) || (typeof module != "undefined")) && typeof module.exports != "undefined") {\n' +
+ ' module.exports = ' + varName + ';\n' +
+ '};\n';
+
+ var extendsAddition =
+ 'var __extends = (this && this.__extends) || function (d, b) {\n' +
+ 'for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n' +
+ 'function __() { this.constructor = d; }\n' +
+ '__.prototype = b.prototype;\n' +
+ 'd.prototype = new __();\n' +
+ '};\n';
+
+ var decorateAddition =
+ 'var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n' +
+ 'var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n' +
+ 'if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n' +
+ 'else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n' +
+ 'return c > 3 && r && Object.defineProperty(target, key, r), r;\n' +
+ '};\n';
+
+ if (file.isNull()) {
+ cb(null, file);
+ return;
+ }
+
+ if (file.isStream()) {
+ //streams not supported, no need for now.
+ return;
+ }
+
+ try {
+ file.contents = new Buffer(decorateAddition.concat(new Buffer(extendsAddition.concat(String(file.contents)).concat(moduleExportsAddition))));
+ this.push(file);
+
+ } catch (err) {
+ this.emit('error', new gutil.PluginError('gulp-add-module-exports', err, { fileName: file.path }));
+ }
+ cb();
+ });
+};
+
View
4 Tools/Gulp/gulpfile.js
@@ -20,6 +20,7 @@ var shadersStream;
var workersStream;
var extendsSearchRegex = /var\s__extends[\s\S]+?\};/g;
+var decorateSearchRegex = /var\s__decorate[\s\S]+?\};/g;
//function to convert the shaders' filenames to variable names.
function shadersName(filename) {
@@ -120,6 +121,7 @@ gulp.task("buildCore", ["shaders"], function () {
.pipe(concat(config.build.minCoreFilename))
.pipe(cleants())
.pipe(replace(extendsSearchRegex, ""))
+ .pipe(replace(decorateSearchRegex, ""))
.pipe(addModuleExports("BABYLON"))
.pipe(uglify())
.pipe(gulp.dest(config.build.outputDirectory));
@@ -135,6 +137,7 @@ gulp.task("buildNoWorker", ["shaders"], function () {
.pipe(concat(config.build.minNoWorkerFilename))
.pipe(cleants())
.pipe(replace(extendsSearchRegex, ""))
+ .pipe(replace(decorateSearchRegex, ""))
.pipe(addModuleExports("BABYLON"))
.pipe(uglify())
.pipe(gulp.dest(config.build.outputDirectory));
@@ -151,6 +154,7 @@ gulp.task("build", ["workers", "shaders"], function () {
.pipe(concat(config.build.filename))
.pipe(cleants())
.pipe(replace(extendsSearchRegex, ""))
+ .pipe(replace(decorateSearchRegex, ""))
.pipe(addModuleExports("BABYLON"))
.pipe(gulp.dest(config.build.outputDirectory))
.pipe(rename(config.build.minFilename))
View
46 dist/preview release/babylon.core.js
23 additions, 23 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
1,532 dist/preview release/babylon.d.ts
766 additions, 766 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
61 dist/preview release/babylon.js
30 additions, 31 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
3,241 dist/preview release/babylon.max.js
1,215 additions, 2,026 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
59 dist/preview release/babylon.noworker.js
29 additions, 30 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit 0ab3fa4

Please sign in to comment.
Something went wrong with that request. Please try again.