1
0
Eugene Pankov 3 жил өмнө
parent
commit
b7e2e0875e

+ 0 - 1
app/package.json

@@ -15,7 +15,6 @@
     "watch": "webpack --progress --color --watch"
   },
   "dependencies": {
-    "@angular/cdk": "^12.2.9",
     "@electron/remote": "2.0.1",
     "@tabby-gang/node-pty": "^0.11.0-beta.200",
     "any-promise": "^1.3.0",

+ 12 - 5
app/src/plugins.ts

@@ -21,6 +21,8 @@ const builtinPluginsPath = process.env.TABBY_DEV ? path.dirname(remote.app.getAp
 
 const cachedBuiltinModules = {
     '@angular/animations': require('@angular/animations'),
+    '@angular/cdk/drag-drop': require('@angular/cdk/drag-drop'),
+    '@angular/cdk/clipboard': require('@angular/cdk/clipboard'),
     '@angular/common': require('@angular/common'),
     '@angular/compiler': require('@angular/compiler'),
     '@angular/core': require('@angular/core'),
@@ -64,18 +66,23 @@ export type ProgressCallback = (current: number, total: number) => void
 export function initModuleLookup (userPluginsPath: string): void {
     global['module'].paths.map((x: string) => nodeModule.globalPaths.push(normalizePath(x)))
 
-    nodeModule.globalPaths.unshift(path.join(userPluginsPath, 'node_modules'))
+    const paths = []
+    paths.unshift(path.join(userPluginsPath, 'node_modules'))
+    paths.unshift(path.join(remote.app.getAppPath(), 'node_modules'))
 
     if (process.env.TABBY_DEV) {
-        nodeModule.globalPaths.unshift(path.dirname(remote.app.getAppPath()))
+        paths.unshift(path.dirname(remote.app.getAppPath()))
     }
 
-    nodeModule.globalPaths.unshift(builtinPluginsPath)
-    // nodeModule.globalPaths.unshift(path.join((process as any).resourcesPath, 'app.asar', 'node_modules'))
+    paths.unshift(builtinPluginsPath)
+    // paths.unshift(path.join((process as any).resourcesPath, 'app.asar', 'node_modules'))
     if (process.env.TABBY_PLUGINS) {
-        process.env.TABBY_PLUGINS.split(':').map(x => nodeModule.globalPaths.push(normalizePath(x)))
+        process.env.TABBY_PLUGINS.split(':').map(x => paths.push(normalizePath(x)))
     }
 
+    process.env.NODE_PATH += path.delimiter + paths.join(path.delimiter)
+    nodeModule._initPaths()
+
     builtinModules.forEach(m => {
         if (!cachedBuiltinModules[m]) {
             cachedBuiltinModules[m] = nodeRequire(m)

+ 1 - 15
app/yarn.lock

@@ -2,15 +2,6 @@
 # yarn lockfile v1
 
 
-"@angular/cdk@^12.2.9":
-  version "12.2.9"
-  resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-12.2.9.tgz#f39e4d7cdb3568ad8e1d412e3500772e2d4c605c"
-  integrity sha512-9Wgj69iGAZ4teQqW/zPbVg2RGna+m9i3v0zkWGx/+Uo95rikJCUZBQM4bfeOe+bSJrS77jV5EisBWG7ayNUSzQ==
-  dependencies:
-    tslib "^2.2.0"
-  optionalDependencies:
-    parse5 "^5.0.0"
-
 "@electron/[email protected]":
   version "2.0.1"
   resolved "https://registry.yarnpkg.com/@electron/remote/-/remote-2.0.1.tgz#810cbc595a21f0f94641eb2d7e8264063a3f84de"
@@ -2758,11 +2749,6 @@ parse-json@^2.2.0:
   dependencies:
     error-ex "^1.2.0"
 
-parse5@^5.0.0:
-  version "5.1.1"
-  resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178"
-  integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==
-
 patch-package@^6.4.7:
   version "6.4.7"
   resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.4.7.tgz#2282d53c397909a0d9ef92dae3fdeb558382b148"
@@ -3661,7 +3647,7 @@ tough-cookie@~2.5.0:
     psl "^1.1.28"
     punycode "^2.1.1"
 
-tslib@^2.0.0, tslib@^2.1.0, tslib@^2.2.0:
+tslib@^2.0.0, tslib@^2.1.0:
   version "2.3.1"
   resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
   integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==

+ 1 - 0
package.json

@@ -2,6 +2,7 @@
   "devDependencies": {
     "@angular/animations": "^12.0.0",
     "@angular/common": "^12.0.0",
+    "@angular/cdk": "^12.2.9",
     "@angular/compiler": "^12.0.0",
     "@angular/core": "^12.0.0",
     "@angular/forms": "^12.0.0",

+ 1 - 0
webpack.plugin.config.js

@@ -102,6 +102,7 @@ module.exports = options => {
         externals: [
             '@electron/remote',
             '@serialport/bindings',
+            '@serialport/bindings-cpp',
             'any-promise',
             'child_process',
             'electron-promise-ipc',

+ 14 - 0
yarn.lock

@@ -14,6 +14,15 @@
   dependencies:
     tslib "^2.2.0"
 
+"@angular/cdk@^12.2.9":
+  version "12.2.13"
+  resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-12.2.13.tgz#1fdbe814adfd6b4ff906c6d9c4c6df07b83f09d8"
+  integrity sha512-zSKRhECyFqhingIeyRInIyTvYErt4gWo+x5DQr0b7YLUbU8DZSwWnG4w76Ke2s4U8T7ry1jpJBHoX/e8YBpGMg==
+  dependencies:
+    tslib "^2.2.0"
+  optionalDependencies:
+    parse5 "^5.0.0"
+
 "@angular/common@^12.0.0":
   version "12.1.1"
   resolved "https://registry.yarnpkg.com/@angular/common/-/common-12.1.1.tgz#34f63b339570699e1ba6968fd0afdee0cbd66fe3"
@@ -6216,6 +6225,11 @@ parse-json@^5.0.0:
     json-parse-even-better-errors "^2.3.0"
     lines-and-columns "^1.1.6"
 
+parse5@^5.0.0:
+  version "5.1.1"
+  resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178"
+  integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==
+
 parse5@^6.0.1:
   version "6.0.1"
   resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b"