Browse Source

Fix none relative imports

sebavan 6 years ago
parent
commit
9e2f97d2e5

+ 6 - 0
Tools/Config/config.json

@@ -510,6 +510,12 @@
         "build": {
         "build": {
             "ignoreInTestMode": true,
             "ignoreInTestMode": true,
             "mainFolder": "./inspector/",
             "mainFolder": "./inspector/",
+            "uncheckedLintImports": [
+                "react",
+                "react-dom",
+                "re-resizable",
+                "glTF"
+            ],
             "umd": {
             "umd": {
                 "packageName": "babylonjs-inspector",
                 "packageName": "babylonjs-inspector",
                 "webpackRoot": "INSPECTOR",
                 "webpackRoot": "INSPECTOR",

+ 13 - 1
Tools/Gulp/helpers/gulp-validateImports.js

@@ -79,6 +79,7 @@ var validateImports = function(data, fileLocation, options) {
 
 
     // Let's go line by line and check if we have special folder replacements
     // Let's go line by line and check if we have special folder replacements
     // Replaces declare module '...'; by declare module 'babylonjs/...'; for instance
     // Replaces declare module '...'; by declare module 'babylonjs/...'; for instance
+    mainSearch:
     for (let index = 0; index < lines.length; index++) {
     for (let index = 0; index < lines.length; index++) {
         let line = lines[index];
         let line = lines[index];
         let module = null, externalModule = null;
         let module = null, externalModule = null;
@@ -111,13 +112,24 @@ var validateImports = function(data, fileLocation, options) {
                 }
                 }
             }
             }
 
 
+            if (options.uncheckedLintImports) {
+                for (let ext of options.uncheckedLintImports) {
+                    if (line.indexOf(ext) > -1) {
+                        continue mainSearch;
+                    }
+                }
+            }
+
             // Check if path is correct internal.
             // Check if path is correct internal.
             if (externalModule) {
             if (externalModule) {
                 const splitter = module.indexOf("/");
                 const splitter = module.indexOf("/");
+                if (splitter === -1 && module !== "babylonjs-gltf2interface") {
+                    errors.push(`Line ${index + 1} Import ${module} needs to be relative.`);
+                }
+
                 const baseModule = module.substring(0, splitter);
                 const baseModule = module.substring(0, splitter);
                 if (mapping[baseModule]) {
                 if (mapping[baseModule]) {
                     const configName = mapping[baseModule];
                     const configName = mapping[baseModule];
-
                     const directory = config[configName].computed.srcDirectory;
                     const directory = config[configName].computed.srcDirectory;
                     module = module.substring(splitter);
                     module = module.substring(splitter);
                     validatePath(fileLocation, directory, module, index + 1, errors, false);
                     validatePath(fileLocation, directory, module, index + 1, errors, false);

+ 4 - 3
Tools/Gulp/tasks/gulpTasks-importLint.js

@@ -28,7 +28,8 @@ var importLintLibrary = function(settings) {
         .pipe(fxFilter)
         .pipe(fxFilter)
         .pipe(validateImports({
         .pipe(validateImports({
             externals: settings.build.umd.processDeclaration.classMap,
             externals: settings.build.umd.processDeclaration.classMap,
-            isCore: settings.isCore
+            isCore: settings.isCore,
+            uncheckedLintImports: settings.build.uncheckedLintImports
         }));
         }));
 }
 }
 
 
@@ -49,7 +50,7 @@ var lintLibrary = function(settings) {
 /**
 /**
  * Dynamic module linting for library (mat, post processes, ...).
  * Dynamic module linting for library (mat, post processes, ...).
  */
  */
-config.lintModules.map(function(module) {
+config.modules.map(function(module) {
     const settings = config[module];
     const settings = config[module];
     gulp.task(module + "-importLint", lintLibrary(settings));
     gulp.task(module + "-importLint", lintLibrary(settings));
 });
 });
@@ -59,7 +60,7 @@ config.lintModules.map(function(module) {
  * Full Librairies importLint.
  * Full Librairies importLint.
  */
  */
 gulp.task("typescript-libraries-importLint",
 gulp.task("typescript-libraries-importLint",
-    gulp.series(config.lintModules.map((module) => {
+    gulp.series(config.modules.map((module) => {
         return module + "-importLint";
         return module + "-importLint";
     })
     })
 ));
 ));

+ 2 - 1
gui/src/2D/measure.ts

@@ -1,5 +1,6 @@
 import { Matrix2D } from "./math2D";
 import { Matrix2D } from "./math2D";
-import { Vector2, Polygon } from "babylonjs";
+import { Vector2 } from "babylonjs/Maths/math";
+import { Polygon } from "babylonjs/Meshes/polygonMesh";
 
 
 /**
 /**
  * Class used to store 2D control sizes
  * Class used to store 2D control sizes

+ 1 - 1
inspector/src/components/actionTabs/actionTabsComponent.tsx

@@ -10,7 +10,7 @@ import Resizable from "re-resizable";
 import { PropertyGridTabComponent } from "./tabs/propertyGridTabComponent";
 import { PropertyGridTabComponent } from "./tabs/propertyGridTabComponent";
 import { HeaderComponent } from "../headerComponent";
 import { HeaderComponent } from "../headerComponent";
 import { ToolsTabComponent } from "./tabs/toolsTabComponent";
 import { ToolsTabComponent } from "./tabs/toolsTabComponent";
-import { GlobalState } from "components/globalState";
+import { GlobalState } from "../../components/globalState";
 
 
 require("./actionTabs.scss");
 require("./actionTabs.scss");
 
 

+ 1 - 1
inspector/src/components/actionTabs/lines/textInputLineComponent.tsx

@@ -1,6 +1,6 @@
 import * as React from "react";
 import * as React from "react";
 import { Observable } from "babylonjs/Misc/observable";
 import { Observable } from "babylonjs/Misc/observable";
-import { PropertyChangedEvent } from "components/propertyChangedEvent";
+import { PropertyChangedEvent } from "../../../components/propertyChangedEvent";
 import { LockObject } from "../tabs/propertyGrids/lockObject";
 import { LockObject } from "../tabs/propertyGrids/lockObject";
 
 
 interface ITextInputLineComponentProps {
 interface ITextInputLineComponentProps {

+ 1 - 1
inspector/src/components/actionTabs/lines/textureLineComponent.tsx

@@ -7,7 +7,7 @@ import { RenderTargetTexture } from "babylonjs/Materials/Textures/renderTargetTe
 import { PostProcess } from "babylonjs/PostProcesses/postProcess";
 import { PostProcess } from "babylonjs/PostProcesses/postProcess";
 import { PassPostProcess, PassCubePostProcess } from "babylonjs/PostProcesses/passPostProcess";
 import { PassPostProcess, PassCubePostProcess } from "babylonjs/PostProcesses/passPostProcess";
 
 
-import { GlobalState } from "components/globalState";
+import { GlobalState } from "../../../components/globalState";
 
 
 interface ITextureLineComponentProps {
 interface ITextureLineComponentProps {
     texture: BaseTexture,
     texture: BaseTexture,

+ 1 - 1
inspector/src/components/actionTabs/paneComponent.tsx

@@ -3,7 +3,7 @@ import { IconDefinition } from '@fortawesome/free-solid-svg-icons';
 import { Observable } from "babylonjs/Misc/observable";
 import { Observable } from "babylonjs/Misc/observable";
 import { Scene } from "babylonjs/scene";
 import { Scene } from "babylonjs/scene";
 import { PropertyChangedEvent } from "../propertyChangedEvent";
 import { PropertyChangedEvent } from "../propertyChangedEvent";
-import { GlobalState } from "components/globalState";
+import { GlobalState } from "../../components/globalState";
 
 
 export interface IPaneComponentProps {
 export interface IPaneComponentProps {
     title: string,
     title: string,

+ 1 - 1
inspector/src/components/actionTabs/tabs/propertyGrids/materials/texturePropertyGridComponent.tsx

@@ -18,7 +18,7 @@ import { OptionsLineComponent } from "../../../lines/optionsLineComponent";
 import { FileButtonLineComponent } from "../../../lines/fileButtonLineComponent";
 import { FileButtonLineComponent } from "../../../lines/fileButtonLineComponent";
 import { LockObject } from "../lockObject";
 import { LockObject } from "../lockObject";
 import { ValueLineComponent } from "../../../lines/valueLineComponent";
 import { ValueLineComponent } from "../../../lines/valueLineComponent";
-import { GlobalState } from "components/globalState";
+import { GlobalState } from "../../../../../components/globalState";
 
 
 import { AdvancedDynamicTextureInstrumentation } from "babylonjs-gui/2D/adtInstrumentation";
 import { AdvancedDynamicTextureInstrumentation } from "babylonjs-gui/2D/adtInstrumentation";
 import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
 import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";

+ 1 - 1
inspector/src/components/embedHost/embedHostComponent.tsx

@@ -4,7 +4,7 @@ import Resizable from "re-resizable";
 import { SceneExplorerComponent } from "../sceneExplorer/sceneExplorerComponent";
 import { SceneExplorerComponent } from "../sceneExplorer/sceneExplorerComponent";
 import { ActionTabsComponent } from "../actionTabs/actionTabsComponent";
 import { ActionTabsComponent } from "../actionTabs/actionTabsComponent";
 import { Scene } from "babylonjs/scene";
 import { Scene } from "babylonjs/scene";
-import { GlobalState } from "components/globalState";
+import { GlobalState } from "../../components/globalState";
 
 
 const Split = require('split.js').default;
 const Split = require('split.js').default;
 
 

+ 1 - 1
inspector/src/components/sceneExplorer/entities/sceneTreeItemComponent.tsx

@@ -11,7 +11,7 @@ import { ExtensionsComponent } from "../extensionsComponent";
 import * as React from "react";
 import * as React from "react";
 
 
 import { GlobalState } from "../../globalState";
 import { GlobalState } from "../../globalState";
-import { UtilityLayerRenderer } from 'babylonjs';
+import { UtilityLayerRenderer } from "babylonjs/Rendering/utilityLayerRenderer";
 
 
 interface ISceneTreeItemComponentProps {
 interface ISceneTreeItemComponentProps {
     scene: Scene;
     scene: Scene;

+ 1 - 1
inspector/src/components/sceneExplorer/sceneExplorerComponent.tsx

@@ -11,7 +11,7 @@ import Resizable from "re-resizable";
 import { HeaderComponent } from "../headerComponent";
 import { HeaderComponent } from "../headerComponent";
 import { SceneTreeItemComponent } from "./entities/sceneTreeItemComponent";
 import { SceneTreeItemComponent } from "./entities/sceneTreeItemComponent";
 import { Tools } from "../../tools";
 import { Tools } from "../../tools";
-import { GlobalState } from "components/globalState";
+import { GlobalState } from "../../components/globalState";
 
 
 require("./sceneExplorer.scss");
 require("./sceneExplorer.scss");
 
 

+ 5 - 4
serializers/src/glTF/2.0/Extensions/KHR_lights_punctual.ts

@@ -1,5 +1,6 @@
 import { SpotLight } from "babylonjs/Lights/spotLight";
 import { SpotLight } from "babylonjs/Lights/spotLight";
-import { Vector3, Color3 } from "babylonjs/Maths/math";
+import { Vector3, Color3, Quaternion } from "babylonjs/Maths/math";
+import { Nullable } from "babylonjs/types";
 import { Light } from "babylonjs/Lights/light";
 import { Light } from "babylonjs/Lights/light";
 import { Node } from "babylonjs/node";
 import { Node } from "babylonjs/node";
 import { ShadowLight } from "babylonjs/Lights/shadowLight";
 import { ShadowLight } from "babylonjs/Lights/shadowLight";
@@ -7,7 +8,7 @@ import { IChildRootProperty } from "babylonjs-gltf2interface";
 import { INode } from "babylonjs-gltf2interface";
 import { INode } from "babylonjs-gltf2interface";
 import { IGLTFExporterExtensionV2 } from "../glTFExporterExtension";
 import { IGLTFExporterExtensionV2 } from "../glTFExporterExtension";
 import { _Exporter } from "../glTFExporter";
 import { _Exporter } from "../glTFExporter";
-import { Tools, Nullable, Quaternion } from 'babylonjs';
+import { Logger } from "babylonjs/Misc/logger";
 import { _GLTFUtilities } from "../glTFUtilities";
 import { _GLTFUtilities } from "../glTFUtilities";
 
 
 const NAME = "KHR_lights_punctual";
 const NAME = "KHR_lights_punctual";
@@ -108,7 +109,7 @@ export class KHR_lights_punctual implements IGLTFExporterExtensionV2 {
                             babylonLight.getTypeID() == Light.LIGHTTYPEID_SPOTLIGHT ? LightType.SPOT : null
                             babylonLight.getTypeID() == Light.LIGHTTYPEID_SPOTLIGHT ? LightType.SPOT : null
                         )));
                         )));
                 if (lightType == null) {
                 if (lightType == null) {
-                    Tools.Warn(`${context}: Light ${babylonLight.name} is not supported in ${NAME}`);
+                    Logger.Warn(`${context}: Light ${babylonLight.name} is not supported in ${NAME}`);
                 }
                 }
                 else {
                 else {
                     const lightPosition = babylonLight.position.clone();
                     const lightPosition = babylonLight.position.clone();
@@ -133,7 +134,7 @@ export class KHR_lights_punctual implements IGLTFExporterExtensionV2 {
                     }
                     }
 
 
                     if (babylonLight.falloffType !== Light.FALLOFF_GLTF) {
                     if (babylonLight.falloffType !== Light.FALLOFF_GLTF) {
-                        Tools.Warn(`${context}: Light falloff for ${babylonLight.name} does not match the ${NAME} specification!`);
+                        Logger.Warn(`${context}: Light falloff for ${babylonLight.name} does not match the ${NAME} specification!`);
                     }
                     }
                     light = {
                     light = {
                         type: lightType
                         type: lightType