Explorar el Código

use tslib to provide helper functions (saves a lot of code)

David Sehnal hace 5 años
padre
commit
008ec2c88c
Se han modificado 4 ficheros con 183 adiciones y 23 borrados
  1. 171 3
      package-lock.json
  2. 1 0
      package.json
  3. 2 0
      tsconfig.json
  4. 9 20
      webpack.config.common.js

+ 171 - 3
package-lock.json

@@ -1694,6 +1694,14 @@
       "requires": {
         "@graphql-codegen/plugin-helpers": "1.12.2",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-codegen/cli": {
@@ -1813,6 +1821,12 @@
           "requires": {
             "has-flag": "^4.0.0"
           }
+        },
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
         }
       }
     },
@@ -1826,6 +1840,14 @@
         "@graphql-toolkit/common": "0.9.7",
         "@graphql-toolkit/schema-merging": "0.9.7",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-codegen/plugin-helpers": {
@@ -1844,6 +1866,14 @@
         "pascal-case": "3.1.1",
         "tslib": "1.10.0",
         "upper-case": "2.0.1"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-codegen/time": {
@@ -1866,6 +1896,14 @@
         "@graphql-codegen/visitor-plugin-common": "1.12.2",
         "auto-bind": "4.0.0",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-codegen/typescript-graphql-files-modules": {
@@ -1876,6 +1914,14 @@
       "requires": {
         "@graphql-codegen/plugin-helpers": "1.12.2",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-codegen/typescript-graphql-request": {
@@ -1888,6 +1934,14 @@
         "@graphql-codegen/visitor-plugin-common": "1.12.2",
         "auto-bind": "4.0.0",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-codegen/typescript-operations": {
@@ -1901,6 +1955,14 @@
         "@graphql-codegen/visitor-plugin-common": "1.12.2",
         "auto-bind": "4.0.0",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-codegen/visitor-plugin-common": {
@@ -1923,6 +1985,12 @@
           "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.10.1.tgz",
           "integrity": "sha512-jApXqWBzNXQ8jYa/HLkZJaVw9jgwNqZkywa2zfFn16Iv1Zb7ELNHkJaXHR7Quvd5SIGsy6Ny7SUKATgnu05uEg==",
           "dev": true
+        },
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
         }
       }
     },
@@ -1935,6 +2003,14 @@
         "@graphql-toolkit/common": "0.9.7",
         "apollo-language-server": "1.18.0",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-toolkit/code-file-loader": {
@@ -1946,6 +2022,14 @@
         "@graphql-toolkit/common": "0.9.7",
         "@graphql-toolkit/graphql-tag-pluck": "0.9.7",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-toolkit/common": {
@@ -1983,6 +2067,12 @@
           "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
           "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
           "dev": true
+        },
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
         }
       }
     },
@@ -2026,6 +2116,14 @@
       "requires": {
         "@graphql-toolkit/common": "0.9.7",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-toolkit/graphql-tag-pluck": {
@@ -2172,6 +2270,14 @@
       "requires": {
         "@graphql-toolkit/common": "0.9.7",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-toolkit/prisma-loader": {
@@ -2184,6 +2290,14 @@
         "@graphql-toolkit/url-loader": "0.9.7",
         "prisma-yml": "1.34.10",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-toolkit/relay-operation-optimizer": {
@@ -2206,6 +2320,14 @@
         "@graphql-toolkit/common": "0.9.7",
         "deepmerge": "4.2.2",
         "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@graphql-toolkit/url-loader": {
@@ -2219,6 +2341,14 @@
         "cross-fetch": "3.0.4",
         "tslib": "1.10.0",
         "valid-url": "1.0.9"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+          "dev": true
+        }
       }
     },
     "@istanbuljs/load-nyc-config": {
@@ -8463,6 +8593,12 @@
                 "merge2": "^1.3.0",
                 "slash": "^3.0.0"
               }
+            },
+            "tslib": {
+              "version": "1.10.0",
+              "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+              "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+              "dev": true
             }
           }
         },
@@ -8474,6 +8610,14 @@
           "requires": {
             "@graphql-toolkit/common": "0.9.1",
             "tslib": "1.10.0"
+          },
+          "dependencies": {
+            "tslib": {
+              "version": "1.10.0",
+              "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+              "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+              "dev": true
+            }
           }
         },
         "@graphql-toolkit/json-file-loader": {
@@ -8484,6 +8628,14 @@
           "requires": {
             "@graphql-toolkit/common": "0.9.1",
             "tslib": "1.10.0"
+          },
+          "dependencies": {
+            "tslib": {
+              "version": "1.10.0",
+              "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+              "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+              "dev": true
+            }
           }
         },
         "@graphql-toolkit/schema-merging": {
@@ -8496,6 +8648,14 @@
             "deepmerge": "4.2.2",
             "graphql-tools": "4.0.6",
             "tslib": "1.10.0"
+          },
+          "dependencies": {
+            "tslib": {
+              "version": "1.10.0",
+              "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+              "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+              "dev": true
+            }
           }
         },
         "@graphql-toolkit/url-loader": {
@@ -8508,6 +8668,14 @@
             "cross-fetch": "3.0.4",
             "tslib": "1.10.0",
             "valid-url": "1.0.9"
+          },
+          "dependencies": {
+            "tslib": {
+              "version": "1.10.0",
+              "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+              "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+              "dev": true
+            }
           }
         },
         "cosmiconfig": {
@@ -17145,9 +17313,9 @@
       }
     },
     "tslib": {
-      "version": "1.10.0",
-      "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
-      "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
+      "version": "1.11.1",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
+      "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA=="
     },
     "tsutils": {
       "version": "3.17.1",

+ 1 - 0
package.json

@@ -125,6 +125,7 @@
     "react-dom": "^16.13.0",
     "rxjs": "^6.5.4",
     "swagger-ui-dist": "^3.25.0",
+    "tslib": "^1.11.1",
     "util.promisify": "^1.0.1",
     "xhr2": "^0.2.0"
   }

+ 2 - 0
tsconfig.json

@@ -10,6 +10,8 @@
         "strictNullChecks": true,
         "strictFunctionTypes": true,
         // "downlevelIteration": true,
+        "importHelpers": true,
+        "noEmitHelpers": true,
         "jsx": "react",
         "lib": [ "es6", "dom", "esnext.asynciterable", "es2016" ],
         "rootDir": "src",

+ 9 - 20
webpack.config.common.js

@@ -29,6 +29,14 @@ const sharedConfig = {
         //     failOnError: false,
         //     cwd: process.cwd(),
         // }),
+        new webpack.ProvidePlugin({
+            '__assign': ['tslib', '__assign'],
+            '__extends': ['tslib', '__extends'],
+            '__awaiter': ['tslib', '__awaiter'],
+            '__generator': ['tslib', '__generator'],
+            '__spread': ['tslib', '__spread'],
+            '__spreadArrays': ['tslib', '__spreadArrays'],
+        }),
         new ExtraWatchWebpackPlugin({
             files: [
                 './lib/**/*.scss',
@@ -95,23 +103,4 @@ module.exports = {
     createBrowserTest,
     createNodeEntryPoint,
     createNodeApp
-}
-
-// module.exports = [
-//     createApp('viewer'),
-//     // createApp('basic-wrapper'),
-//     // createEntry('examples/proteopedia-wrapper/index', 'examples/proteopedia-wrapper', 'index'),
-//     // createEntry('apps/demos/lighting/index', 'demos/lighting', 'index'),
-//     // createNodeApp('state-docs'),
-//     // createNodeEntryPoint('preprocess', 'servers/model', 'model-server'),
-//     // createApp('model-server-query'),
-
-//     // createBrowserTest('font-atlas'),
-//     // createBrowserTest('marching-cubes'),
-//     // createBrowserTest('render-lines'),
-//     // createBrowserTest('render-mesh'),
-//     // createBrowserTest('render-shape'),
-//     // createBrowserTest('render-spheres'),
-//     // createBrowserTest('render-structure'),
-//     // createBrowserTest('render-text'),
-// ]
+}