Browse Source

Fix debugger port conflict and resolve-url issue

pull/355/head
Jerome Wu 5 years ago
parent
commit
15da58127d
  1. 2
      src/worker-script/browser/index.js
  2. 1
      src/worker-script/browser/resolveURL.js
  3. 2
      src/worker-script/index.js
  4. 2
      src/worker-script/node/index.js
  5. 1
      src/worker-script/node/resolveURL.js
  6. 9
      src/worker/node/spawnWorker.js

2
src/worker-script/browser/index.js

@ -11,7 +11,6 @@
const worker = require('../'); const worker = require('../');
const getCore = require('./getCore'); const getCore = require('./getCore');
const gunzip = require('./gunzip'); const gunzip = require('./gunzip');
const resolveURL = require('./resolveURL');
const cache = require('./cache'); const cache = require('./cache');
/* /*
@ -28,6 +27,5 @@ global.addEventListener('message', ({ data }) => {
worker.setAdapter({ worker.setAdapter({
getCore, getCore,
gunzip, gunzip,
resolveURL,
...cache, ...cache,
}); });

1
src/worker-script/browser/resolveURL.js

@ -1 +0,0 @@
module.exports = require('resolve-url');

2
src/worker-script/index.js

@ -91,8 +91,6 @@ const loadLanguage = async ({
if (isURL(langPath) || langPath.startsWith('chrome-extension://') || langPath.startsWith('file://')) { /** When langPath is an URL */ if (isURL(langPath) || langPath.startsWith('chrome-extension://') || langPath.startsWith('file://')) { /** When langPath is an URL */
path = langPath; path = langPath;
} else if (process.browser) { /** When langPath is not an URL in browser */
path = adapter.resolveURL(langPath);
} }
if (path !== null) { if (path !== null) {

2
src/worker-script/node/index.js

@ -10,7 +10,6 @@
const worker = require('../'); const worker = require('../');
const getCore = require('./getCore'); const getCore = require('./getCore');
const resolveURL = require('./resolveURL');
const gunzip = require('./gunzip'); const gunzip = require('./gunzip');
const cache = require('./cache'); const cache = require('./cache');
@ -24,6 +23,5 @@ process.on('message', (packet) => {
worker.setAdapter({ worker.setAdapter({
getCore, getCore,
gunzip, gunzip,
resolveURL,
...cache, ...cache,
}); });

1
src/worker-script/node/resolveURL.js

@ -1 +0,0 @@
module.exports = s => s;

9
src/worker/node/spawnWorker.js

@ -1,5 +1,7 @@
const { fork } = require('child_process'); const { fork } = require('child_process');
let debugPort = 9229;
/** /**
* spawnWorker * spawnWorker
* *
@ -7,6 +9,7 @@ const { fork } = require('child_process');
* @function fork a new process in node * @function fork a new process in node
* @access public * @access public
*/ */
module.exports = ({ workerPath }) => ( module.exports = ({ workerPath }) => {
fork(workerPath) debugPort += 1;
); return fork(workerPath, { execArgv: [`--debug-port=${debugPort}`] });
};

Loading…
Cancel
Save