Browse Source

Progressing on declaration Files

sebastien 6 năm trước cách đây
mục cha
commit
5a0e7a6862

+ 2 - 4
Tools/Gulp/config.json

@@ -81,10 +81,8 @@
                         "namespace": "BABYLON.Debug"
                     }
                 ],
-                "importsToRemove": [],
-                "classMap": {
-                    "babylonjs": "BABYLON"
-                }
+                "doNotAppendNamespace": true,
+                "prependToNamespaceText": "declare module 'babylonjs' { export = BABYLON; }"
             }
         }
     },

+ 60 - 0
Tools/Gulp/helpers/gulp-processAmdDeclarationToModule.js

@@ -0,0 +1,60 @@
+// Gulp Tools
+var fs = require("fs");
+
+var processData = function(data, options) {
+    var moduleName = options.moduleName;
+    var entryPoint = options.entryPoint;
+
+    var str = "" + data;
+
+    // Start process by extracting all lines.
+    let lines = str.split('\n');
+
+    // Let's go line by line and check if we have special folder replacements
+    // Replaces declare module '...'; by declare module 'babylonjs/...'; for instance
+    for (let index = 0; index < lines.length; index++) {
+        let line = lines[index];
+
+        // Replace Type Imports
+        var regex = /(.*)type ([A-Za-z0-9]*) = import\("(.*)"\)\.(.*);/g;
+        var match = regex.exec(line);
+        if (match) {
+            var spaces = match[1]
+            var module = match[3];
+            var type = match[4];
+            line = `${spaces}import { ${type} } from "${module}";`;
+        }
+
+        // Append Module Name
+        // Declaration
+        line = line.replace(/declare module "/g, `declare module "${moduleName}/`);
+        // From
+        line = line.replace(/ from "/g, ` from "${moduleName}/`);
+        // Module augmentation
+        line = line.replace(/    module "/g, `    module "${moduleName}/`);
+        // Inlined Import
+        line = line.replace(/import\("/g, `import("${moduleName}/`);
+
+        lines[index] = line;
+    }
+
+    // Recreate the file.
+    str = lines.join('\n');
+
+    // Add Entry point.
+    str += `declare module "${moduleName}" {
+    export * from "${moduleName}/${entryPoint.replace("./","").replace(".ts", "")}";
+}`;
+
+    return str;
+}
+
+module.exports = function(fileLocation, options, cb) {
+    options = options || { };
+
+    var data = fs.readFileSync(fileLocation);
+
+    newData = processData(data, options);
+
+    fs.writeFileSync(options.output || fileLocation, newData);
+}

+ 60 - 12
Tools/Gulp/helpers/gulp-processTypescriptDeclaration.js

@@ -6,15 +6,15 @@ var processData = function(data, options) {
 
     // Start process by extracting all lines.
     let lines = str.split('\n');
-    var firstIndex = lines.findIndex((line => { return line.indexOf(`'${options.packageName}/'`) !== -1 }));
-    var lastIndex = lines.findIndex(((line, idx) => { return line.trim() === '}' && idx > firstIndex }));
-    lines.splice(firstIndex, lastIndex - firstIndex + 1);
+    // var firstIndex = lines.findIndex((line => { return line.indexOf(`'${options.packageName}/`) !== -1 }));
+    // var lastIndex = lines.findIndex(((line, idx) => { return line.trim() === '}' && idx > firstIndex }));
+    // lines.splice(firstIndex, lastIndex - firstIndex + 1);
 
     // Let's go line by line and check if we have special folder replacements
     // Replaces declare module 'babylonjs'; by declare module BABYLON for instance
     for (var index = 0; index < lines.length; index++) {
         var namespace = options.moduleName;
-        var regex = /declare module '(.*)' {/g;
+        var regex = /declare module ["'](.*)["'] {/g;
 
         if (options.moduleSpecifics) {
             var match = regex.exec(lines[index]);
@@ -35,6 +35,46 @@ var processData = function(data, options) {
         lines[index] = lines[index].replace(regex, `declare module ${namespace} {`);
     }
 
+    // Replace module augmentation blocks
+    for (var index = 0; index < lines.length; index++) {
+        var namespace = options.moduleName;
+        var regex = /\smodule ["'](.*)["'] {/g;
+        var match = regex.exec(lines[index]);
+        if (!match) {
+            continue;
+        }
+        lines[index] = "";
+
+        // Find matching closing curly }
+        var opened = 0;
+        for (let endIndex = index; endIndex < lines.length; endIndex++) {
+            let scanLine = lines[endIndex].trim();
+            if (scanLine.length === 0) {
+                continue;
+            }
+            // Skip comments
+            if (scanLine[0] === "*" || scanLine[0] === "/") {
+                continue;
+            }
+
+            // Count open curly
+            if (scanLine.indexOf("{") != -1) {
+                opened++;
+            }
+            // And closing ones
+            if (scanLine.indexOf("}") != -1) {
+                opened--;
+
+                // until the closing module
+                if (opened < 0) {
+                    lines[endIndex] = "";
+                    index = endIndex;
+                    break;
+                }
+            }
+        }
+    }
+
     // Recreate the file.
     str = lines.join('\n');
 
@@ -144,19 +184,16 @@ var processData = function(data, options) {
         });
     }
 
-    // Clean up export.
+    // Clean up named export.
     str = str.replace(/export {(.*)};/g, '');
     // Clean up left import.
     str = str.replace(/import (.*);/g, "");
-
-    // Rearrange the d.ts.
+    // Clean up export * from.
     str = str.split("\n").filter(line => line.trim()).filter(line => line.indexOf("export * from") === -1).join("\n");
 
     // Remove empty module declaration
     var cleanEmptyNamespace = function(str, moduleName) {
-        let emptyDeclareRegexp = new RegExp("declare module " + moduleName + " {\n}\n", "g");
-        str = str.replace(emptyDeclareRegexp, "");
-        emptyDeclareRegexp = new RegExp("declare module " + moduleName + " {\r\n}\r\n", "g");
+        let emptyDeclareRegexp = new RegExp("declare module " + moduleName + " {\\s*}\\s*", "gm");
         str = str.replace(emptyDeclareRegexp, "");
 
         return str;
@@ -170,6 +207,12 @@ var processData = function(data, options) {
         });
     }
 
+    // Remove Empty Lines
+    str = str.replace(/^\s*$/g, "");
+
+    // Remove Inlined Import
+    str = str.replace(/import\("[A-Za-z0-9\/]*"\)\./g, "");
+
     return str;
 }
 
@@ -186,11 +229,16 @@ module.exports = function(fileLocation, options, cb) {
         if (options.prependText) {
             data = options.prependText + '\n' + data.toString();
         }
-        
+
         var newData = "";
         if (options) {
             newData = processData(data, options);
-            fs.writeFileSync(fileLocation.replace('.module', ''), newData);
+
+            var namespaceData = newData;
+            if (options.prependToNamespaceText) {
+                namespaceData = options.prependToNamespaceText + '\n' + namespaceData;
+            }
+            fs.writeFileSync(fileLocation.replace('.module', ''), namespaceData);
         }
 
         if (options.doNotAppendNamespace) {

+ 2 - 2
Tools/Gulp/helpers/gulp-processShaders.js

@@ -14,8 +14,7 @@ let name = '##NAME_PLACEHOLDER##';
 let shader = \`##SHADER_PLACEHOLDER##\`;
 
 Effect.##SHADERSTORE_PLACEHOLDER##[name] = shader;
-
-//export { shader, name };
+##EXPORT_PLACEHOLDER##
 `;
 
 
@@ -113,6 +112,7 @@ function main(isCore) {
             tsContent = tsContent.replace('##NAME_PLACEHOLDER##', shaderName);
             tsContent = tsContent.replace('##SHADER_PLACEHOLDER##', fxData);
             tsContent = tsContent.replace('##SHADERSTORE_PLACEHOLDER##', shaderStore);
+            tsContent = tsContent.replace('##EXPORT_PLACEHOLDER##', `export var ${shaderName} = { name, shader };`)
 
             // Go to disk.
             fs.writeFileSync(directory + '/' + tsFilename, tsContent);

+ 42 - 15
Tools/Gulp/tasks/gulpTasks-libraries.js

@@ -3,13 +3,15 @@ var gulp = require("gulp");
 var webpack = require('webpack');
 var webpackStream = require("webpack-stream");
 var dtsBundle = require('dts-bundle');
+var cp = require('child_process');
 var merge2 = require("merge2");
 var path = require("path");
 
 // Gulp Helpers
 var uncommentShaders = require('../helpers/gulp-removeShaderComments');
 var processShaders = require("../helpers/gulp-processShaders");
-var processDeclaration = require('../helpers/gulp-processTypescriptDeclaration');
+var processAmdDeclarationToModule = require('../helpers/gulp-processAmdDeclarationToModule');
+var processModuleDeclarationToNamespace = require('../helpers/gulp-processModuleDeclarationToNamespace');
 var rmDir = require("../helpers/gulp-rmDir");
 
 // Import Build Config
@@ -27,16 +29,19 @@ var buildShaders = function(settings) {
 /**
  * Build a single library (one of the material of mat lib) from a module (materialsLibrary for instance)
  */
-var buildExternalLibrary = function(library, settings, cb) {
+var buildExternalLibrariesMultiEntry = function(libraries, settings, cb) {
+    // Convert Module to Namespace for globals
     const sequence = [];
     var outputDirectory = config.build.outputDirectory + settings.build.distOutputDirectory;
 
     // Webpack Config.
     var wpConfig = require(settings.build.webpack);
-    wpConfig.entry = {
-        'main': path.resolve(wpConfig.context, library.entry),
-    };
-    wpConfig.output.filename = library.output;
+    wpConfig.entry = { };
+    wpConfig.output.filename = settings.isCore ? '[name].js' : '[name].min.js';
+    for (let library of settings.libraries) {
+        let name = library.output.replace(settings.isCore ? ".js" : ".min.js", "");
+        wpConfig.entry[name] = path.resolve(wpConfig.context, library.entry);
+    }
 
     // Generate minified file.
     let wpBuildMin = webpackStream(wpConfig, webpack);
@@ -46,7 +51,8 @@ var buildExternalLibrary = function(library, settings, cb) {
     // Generate unminified file.
     wpConfig.mode = "development";
     // Allow babylon.max.js and babylon.js
-    wpConfig.output.filename = library.maxOutput || wpConfig.output.filename.replace(".min", "");
+    wpConfig.output.filename = settings.isCore ? '[name].max.js' : '[name].js';
+    //wpConfig.output.filename = library.maxOutput || wpConfig.output.filename.replace(".min", "");
     let wpBuildMax = webpackStream(wpConfig, webpack);
     let buildEventMax = wpBuildMax.pipe(gulp.dest(outputDirectory));
     sequence.push(buildEventMax);
@@ -54,11 +60,34 @@ var buildExternalLibrary = function(library, settings, cb) {
     return merge2(sequence)
         .on("end", function() {
             // TODO. Generate all d.ts
+            let library = libraries[0];
             if (!library.preventLoadLibrary) {
-                dtsBundle.bundle(settings.build.dtsBundle);
-
                 let fileLocation = path.join(outputDirectory, settings.build.processDeclaration.filename);
-                processDeclaration(fileLocation, settings.build.processDeclaration);
+                // Generate DTS the Dts Bundle way...
+                // dtsBundle.bundle(settings.build.dtsBundle);
+
+                let srcDirectory = settings.build.srcDirectory;
+                let depthCount = srcDirectory.match(/\//g).length - srcDirectory.match(/\.\.\//g).length;
+                let tempDirectory = "";
+                for (let i = 0; i < depthCount; i++) {
+                    tempDirectory += "../"
+                }
+                tempDirectory += ".temp/";
+
+                // Generate DTS the old way...
+                cp.execSync('tsc --module amd --outFile "' + tempDirectory + 'amd.js" --emitDeclarationOnly true', {
+                    cwd: settings.build.srcDirectory
+                });
+
+                // Convert the tsc AMD BUNDLED declaration to our expected one
+                processAmdDeclarationToModule("../../.temp/amd.d.ts", {
+                    output: fileLocation,
+                    moduleName: settings.build.processDeclaration.packageName,
+                    entryPoint: library.entry
+                });
+
+                // Convert Module to Namespace for globals
+                processModuleDeclarationToNamespace(fileLocation, settings.build.processDeclaration);
             }
             cb();
         });
@@ -73,12 +102,10 @@ function buildExternalLibraries(settings) {
 
     // Creates the required tasks.
     var tasks = [];
-    for (let library of settings.libraries) {
-        var shaders = function() { return buildShaders(settings); };
-        var build = function(cb) { return buildExternalLibrary(library, settings, cb) };
+    var shaders = function() { return buildShaders(settings); };
+    var build = function(cb) { return buildExternalLibrariesMultiEntry(settings.libraries, settings, cb) };
 
-        tasks.push(shaders, build);
-    }
+    tasks.push(shaders, build);
 
     return gulp.series.apply(this, tasks);
 }

+ 1 - 1
Tools/Gulp/tasks/gulpTasks-viewerLibraries.js

@@ -9,7 +9,7 @@ var path = require("path");
 var rename = require("gulp-rename");
 
 // Gulp Helpers
-var processDeclaration = require('../helpers/gulp-processTypescriptDeclaration');
+var processDeclaration = require('../helpers/gulp-processModuleDeclarationToNamespace');
 var addModuleExports = require("../helpers/gulp-addModuleExports");
 
 // Import Build Config

+ 3 - 1
loaders/src/STL/stlFileLoader.ts

@@ -1,4 +1,5 @@
-import { SceneLoader, ISceneLoaderPlugin, ISceneLoaderPluginExtensions, Scene, Nullable, AbstractMesh, IParticleSystem, Skeleton, Mesh, Tools, AssetContainer, VertexBuffer } from "babylonjs";
+import { Scene, SceneLoader, ISceneLoaderPlugin, ISceneLoaderPluginExtensions, Nullable, AbstractMesh, IParticleSystem, Skeleton, Mesh, Tools, AssetContainer, VertexBuffer } from "babylonjs";
+import "babylonjs/Helpers/sceneHelpers";
 
 /**
  * STL file type loader.
@@ -116,6 +117,7 @@ export class STLFileLoader implements ISceneLoaderPlugin {
         var result = this.importMesh(null, scene, data, rootUrl, null, null, null);
 
         if (result) {
+            scene.createDefaultLight();
             scene.createDefaultCameraOrLight();
         }
 

+ 1 - 1
loaders/src/glTF/2.0/glTFLoader.ts

@@ -1239,7 +1239,7 @@ import { IGLTFLoader, GLTFFileLoader, GLTFLoaderState, IGLTFLoaderData, GLTFLoad
                     if (babylonBones) {
                         const babylonAnimationTargets = [babylonTransformNode, ...babylonBones];
                         for (const babylonAnimationTarget of babylonAnimationTargets) {
-                            babylonAnimationTarget.animations.push(babylonAnimation);
+                            (<any>babylonAnimationTarget.animations).push(babylonAnimation);
                         }
                         babylonAnimationGroup.addTargetedAnimation(babylonAnimation, babylonAnimationTargets);
                     }

+ 1 - 1
loaders/tsconfig.json

@@ -24,7 +24,7 @@
       "rootDir": "./",
       "paths": {
           "babylonjs": [
-            "../../dist/preview release/babylon.d.ts",
+            "../../dist/preview release/babylon.module.d.ts",
           ],
           "babylonjs-gltf2interface": [
             "../../dist/preview release/glTF2Interface/babylon.glTF2Interface.d.ts"

+ 11 - 8
loaders/webpack.config.js

@@ -22,14 +22,17 @@ module.exports = {
     resolve: {
         extensions: [".js", '.ts']
     },
-    externals: {
-        babylonjs: {
-            root: "BABYLON",
-            commonjs: "babylonjs",
-            commonjs2: "babylonjs",
-            amd: "babylonjs"
-        }
-    },
+    externals: [
+        {
+            babylonjs: {
+                root: "BABYLON",
+                commonjs: "babylonjs",
+                commonjs2: "babylonjs",
+                amd: "babylonjs"
+            }
+        },
+        /^babylonjs.*$/i
+    ],
     devtool: "source-map",
     module: {
         rules: [{

+ 4 - 4
materialsLibrary/src/custom/customMaterial.ts

@@ -116,7 +116,7 @@ export class CustomMaterial extends StandardMaterial {
             catch (e) { }
         };
 
-        BABYLON.Effect.ShadersStore[name + "VertexShader"] = this.VertexShader
+        Effect.ShadersStore[name + "VertexShader"] = this.VertexShader
             .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : ""))
             .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
             .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : ""))
@@ -125,7 +125,7 @@ export class CustomMaterial extends StandardMaterial {
 
             // #define CUSTOM_VERTEX_MAIN_END
 
-        BABYLON.Effect.ShadersStore[name + "PixelShader"] = this.FragmentShader
+        Effect.ShadersStore[name + "PixelShader"] = this.FragmentShader
             .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : ""))
             .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : ""))
             .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
@@ -148,8 +148,8 @@ export class CustomMaterial extends StandardMaterial {
         this.CustomParts = new ShaderSpecialParts();
         this.customShaderNameResolve = this.Builder;
 
-        this.FragmentShader = BABYLON.Effect.ShadersStore["defaultPixelShader"];
-        this.VertexShader = BABYLON.Effect.ShadersStore["defaultVertexShader"];
+        this.FragmentShader = Effect.ShadersStore["defaultPixelShader"];
+        this.VertexShader = Effect.ShadersStore["defaultVertexShader"];
     }
 
     public AddUniform(name: string, kind: string, param: any): CustomMaterial {

+ 2 - 2
materialsLibrary/src/grid/gridMaterial.ts

@@ -1,4 +1,4 @@
-import { MaterialDefines, serializeAsColor3, serializeAsTexture, expandToProperty, Color3, serialize, Vector3, Vector4, Scene, AbstractMesh, SubMesh, MaterialHelper, VertexBuffer, Matrix, Mesh, SerializationHelper, BaseTexture, StandardMaterial } from "babylonjs";
+import { PushMaterial, MaterialDefines, serializeAsColor3, serializeAsTexture, expandToProperty, Color3, serialize, Vector3, Vector4, Scene, AbstractMesh, SubMesh, MaterialHelper, VertexBuffer, Matrix, Mesh, SerializationHelper, BaseTexture, StandardMaterial } from "babylonjs";
 
 import "./grid.fragment";
 import "./grid.vertex";
@@ -21,7 +21,7 @@ class GridMaterialDefines extends MaterialDefines {
  * The grid materials allows you to wrap any shape with a grid.
  * Colors are customizable.
  */
-export class GridMaterial extends BABYLON.PushMaterial {
+export class GridMaterial extends PushMaterial {
 
     /**
      * Main color of the grid (e.g. between lines)

+ 2 - 2
materialsLibrary/src/shadowOnly/shadowOnlyMaterial.ts

@@ -1,4 +1,4 @@
-import { MaterialDefines, PushMaterial, IShadowLight, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, IShadowLight, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, SerializationHelper, Color3 } from "babylonjs";
 
 import "./shadowOnly.fragment";
 import "./shadowOnly.vertex";
@@ -29,7 +29,7 @@ export class ShadowOnlyMaterial extends PushMaterial {
         super(name, scene);
     }
 
-    public shadowColor = BABYLON.Color3.Black();
+    public shadowColor = Color3.Black();
 
     public needAlphaBlending(): boolean {
         return true;

+ 1 - 1
materialsLibrary/src/sky/skyMaterial.ts

@@ -161,7 +161,7 @@ export class SkyMaterial extends PushMaterial {
 
         if (this._mustRebind(scene, effect)) {
 
-            BABYLON.MaterialHelper.BindClipPlane(this._activeEffect, scene);
+            MaterialHelper.BindClipPlane(this._activeEffect, scene);
 
             // Point size
             if (this.pointsCloud) {

+ 5 - 5
materialsLibrary/src/water/waterMaterial.ts

@@ -1,4 +1,4 @@
-import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, serializeAsVector2, Vector2, SmartArray, RenderTargetTexture, Nullable, AbstractMesh, Matrix, Scene, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Mesh, Plane, Vector3, Camera, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, serializeAsVector2, Vector2, SmartArray, RenderTargetTexture, Nullable, AbstractMesh, Matrix, Scene, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Mesh, Plane, Vector3, Camera, IAnimatable, SerializationHelper, Constants } from "babylonjs";
 
 import "./water.fragment";
 import "./water.vertex";
@@ -510,13 +510,13 @@ export class WaterMaterial extends PushMaterial {
     private _createRenderTargets(scene: Scene, renderTargetSize: Vector2): void {
         // Render targets
         this._refractionRTT = new RenderTargetTexture(name + "_refraction", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
-        this._refractionRTT.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
-        this._refractionRTT.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
+        this._refractionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;
+        this._refractionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;
         this._refractionRTT.ignoreCameraViewport = true;
 
         this._reflectionRTT = new RenderTargetTexture(name + "_reflection", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
-        this._reflectionRTT.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
-        this._reflectionRTT.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
+        this._reflectionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;
+        this._reflectionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;
         this._reflectionRTT.ignoreCameraViewport = true;
 
         var isVisible: boolean;

+ 1 - 1
materialsLibrary/tsconfig.json

@@ -24,7 +24,7 @@
         "rootDir": "./",
         "paths": {
             "babylonjs": [
-                "../../dist/preview release/babylon.d.ts"
+                "../../dist/preview release/babylon.module.d.ts"
             ]
         },
         "outDir": "./build"

+ 12 - 9
materialsLibrary/webpack.config.js

@@ -22,15 +22,18 @@ module.exports = {
     resolve: {
         extensions: [".js", '.ts']
     },
-    externals: {
-        babylonjs: {
-            root: "BABYLON",
-            commonjs: "babylonjs",
-            commonjs2: "babylonjs",
-            amd: "babylonjs"
-        }
-    },
-    devtool: "source-map",
+    externals: [
+        {
+            babylonjs: {
+                root: "BABYLON",
+                commonjs: "babylonjs",
+                commonjs2: "babylonjs",
+                amd: "babylonjs"
+            }
+        },
+        /^babylonjs.*$/i,
+    ],
+    devtool: "souce-map",
     module: {
         rules: [{
             test: /\.tsx?$/,

+ 32 - 32
package.json

@@ -40,27 +40,27 @@
     "readmeFilename": "README.md",
     "dependencies": {},
     "devDependencies": {
-        "@types/node": "^10.5.3",
-        "@types/mocha": "2.2.46",
+        "@fortawesome/fontawesome-svg-core": "~1.2.8",
+        "@fortawesome/free-regular-svg-icons": "~5.4.1",
+        "@fortawesome/free-solid-svg-icons": "~5.4.1",
+        "@fortawesome/react-fontawesome": "~0.1.3",
         "@types/chai": "^4.1.0",
+        "@types/mocha": "2.2.46",
+        "@types/node": "^10.5.3",
+        "@types/react": "~16.7.3",
+        "@types/react-dom": "~16.0.9",
         "@types/sinon": "^4.1.3",
-        "typescript": "~3.0.1",
-        "base64-font-loader": "0.0.4",
-        "clean-webpack-plugin": "^0.1.19",
-        "ts-loader": "^5.2.1",
-        "webpack": "^4.25.1",
-        "webpack-cli": "^3.1.2",
-        "webpack-dev-server": "^3.1.5",
-        "dts-bundle-webpack": "^1.0.0",
-        "css-loader": "^1.0.0",
-        "mini-css-extract-plugin": "^0.4.1",
-        "node-sass": "^4.10.0",
-        "sass-loader": "^7.1.0",
-        "style-loader": "^0.21.0",
         "awesome-typescript-loader": "^5.2.1",
+        "base64-font-loader": "0.0.4",
         "chai": "^4.1.2",
+        "clean-webpack-plugin": "^0.1.19",
         "color-support": "^1.1.3",
+        "css-loader": "^1.0.0",
         "del": "3.0.0",
+        "dts-bundle": "^0.7.3",
+        "dts-bundle-webpack": "^1.0.0",
+        "file-loader": "~2.0.0",
+        "fs-extra": "^5.0.0",
         "gulp": "^4.0.0",
         "gulp-concat": "~2.6.1",
         "gulp-debug": "^4.0.0",
@@ -81,29 +81,29 @@
         "karma-phantomjs-launcher": "^1.0.4",
         "karma-sinon": "^1.0.5",
         "merge2": "~1.2.2",
+        "mini-css-extract-plugin": "^0.4.1",
         "minimist": "^1.2.0",
         "mocha": "^5.2.0",
+        "node-sass": "^4.10.0",
         "phantomjs-prebuilt": "^2.1.16",
-        "sinon": "^6.1.4",
-        "through2": "~2.0.3",
-        "tslint": "^5.11.0",
-        "typedoc": "^0.12.0",
-        "webpack-stream": "5.0.0",
-        "dts-bundle": "^0.7.3",
-        "fs-extra": "^5.0.0",
-        "prompt": "^1.0.0",
-        "shelljs": "^0.7.8",
         "plugin-error": "^1.0.1",
-        "@fortawesome/fontawesome-svg-core": "~1.2.8",
-        "@fortawesome/free-regular-svg-icons": "~5.4.1",
-        "@fortawesome/free-solid-svg-icons": "~5.4.1",
-        "@fortawesome/react-fontawesome": "~0.1.3",
-        "@types/react": "~16.7.3",
-        "@types/react-dom": "~16.0.9",
-        "file-loader": "~2.0.0",
+        "prompt": "^1.0.0",
         "re-resizable": "~4.9.1",
         "react": "~16.6.3",
         "react-dom": "~16.6.3",
-        "split.js": "^1.5.9"
+        "sass-loader": "^7.1.0",
+        "shelljs": "^0.7.8",
+        "sinon": "^6.1.4",
+        "split.js": "^1.5.9",
+        "style-loader": "^0.21.0",
+        "through2": "~2.0.3",
+        "ts-loader": "^5.2.1",
+        "tslint": "^5.11.0",
+        "typedoc": "^0.12.0",
+        "typescript": "~3.0.1",
+        "webpack": "^4.25.1",
+        "webpack-cli": "^3.1.2",
+        "webpack-dev-server": "^3.1.5",
+        "webpack-stream": "5.0.0"
     }
 }

+ 0 - 1
sandbox/index.js

@@ -1,5 +1,4 @@
 /// <reference path="../dist/preview release/babylon.d.ts" />
-/// <reference path="../dist/preview release/loaders/babylon.glTFFileLoader.d.ts" />
 
 var assetUrl;
 var cameraPosition;

+ 25 - 0
src/.dependency-cruiser.json

@@ -0,0 +1,25 @@
+{
+    "forbidden": [{
+        "name": "no-circular",
+        "severity": "warn",
+        "comment": "Warn in case there's circular dependencies",
+        "from": {},
+        "to": { "circular": true }
+    }],
+    "options": {
+        "doNotFollow": "node_modules",                    /* pattern specifying which files not to follow further when encountered*/
+        "tsConfig": {                                 /* Typescript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property) */
+           "fileName": "./tsconfig.json"              /* The typescript project file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './tsconfig.json'.*/
+        },
+        "webpackConfig": {                            /* Webpack configuration to use to get resolve options from */
+           "fileName": "./webpack.config.js"
+         }
+    }
+}
+
+// "exclude" : "",                               /* pattern specifying which files to exclude (regular expression) */
+        // "moduleSystems": ["amd", "cjs", "es6", "tsd"],/* list of module systems to cruise */
+        // "prefix": "",                                 /* prefix for links in html and svg output (e.g. https://github.com/you/yourrepo/blob/develop/) */
+        // "tsPreCompilationDeps": false,                /* if true detect dependencies that only exist before typescript-to-javascript compilation */
+        // "preserveSymlinks": false,                    /* if true leave symlinks untouched, otherwise use the realpath */
+       

+ 1 - 4
src/Events/babylon.clipboardEvents.ts

@@ -1,5 +1,3 @@
-
-module BABYLON {
     /**
      * Gather the list of clipboard event types as constants.
      */
@@ -53,5 +51,4 @@ module BABYLON {
                 default: return -1;
             }
         }
-    }
-}
+    }

+ 2 - 1
src/Events/index.ts

@@ -1,2 +1,3 @@
 export * from "./keyboardEvents";
-export * from "./pointerEvents";
+export * from "./pointerEvents";
+export * from "./clipboardEvents";

+ 0 - 1
src/webpack.config.js

@@ -1,6 +1,5 @@
 const path = require('path');
 const webpack = require('webpack');
-const DtsBundleWebpack = require('dts-bundle-webpack');
 const CleanWebpackPlugin = require('clean-webpack-plugin');
 
 module.exports = {