chore(extension): remove replace-webpack-code (#671)

This commit is contained in:
Nathan Bierema 2020-11-16 16:06:21 -05:00 committed by GitHub
parent 6a0ba78cf3
commit 104cc8e715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 134 deletions

View File

@ -15,26 +15,6 @@ function copy(dest) {
gulp.src('./src/assets/**/*').pipe(gulp.dest(dest)); gulp.src('./src/assets/**/*').pipe(gulp.dest(dest));
} }
/*
* common tasks
*/
gulp.task('replace-webpack-code', (done) => {
const replaceTasks = [
{
from: './webpack/replace/JsonpMainTemplate.runtime.js',
to: './node_modules/webpack/lib/JsonpMainTemplate.runtime.js',
},
{
from: './webpack/replace/log-apply-result.js',
to: './node_modules/webpack/hot/log-apply-result.js',
},
];
replaceTasks.forEach((task) =>
fs.writeFileSync(task.to, fs.readFileSync(task.from))
);
done();
});
/* /*
* dev tasks * dev tasks
*/ */
@ -173,7 +153,6 @@ gulp.task('test:electron', () => {
gulp.task( gulp.task(
'default', 'default',
gulp.parallel( gulp.parallel(
'replace-webpack-code',
'webpack:dev', 'webpack:dev',
'views:dev', 'views:dev',
'copy:dev', 'copy:dev',
@ -184,7 +163,6 @@ gulp.task(
gulp.task( gulp.task(
'build:extension', 'build:extension',
gulp.parallel( gulp.parallel(
'replace-webpack-code',
'webpack:build:extension', 'webpack:build:extension',
'views:build:extension', 'views:build:extension',
'copy:build:extension' 'copy:build:extension'

View File

@ -1,76 +0,0 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ */
module.exports = function () {
function webpackHotUpdateCallback(chunkId, moreModules) {
// eslint-disable-line no-unused-vars
hotAddUpdateChunk(chunkId, moreModules);
if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
}
var context = this;
function evalCode(code, context) {
return function () {
return eval(code);
}.call(context);
}
context.hotDownloadUpdateChunk = function (chunkId) {
// eslint-disable-line no-unused-vars
var src =
__webpack_require__.p +
'' +
chunkId +
'.' +
hotCurrentHash +
'.hot-update.js';
var request = new XMLHttpRequest();
request.onload = function () {
evalCode(this.responseText, context);
};
request.open('get', src, true);
request.send();
};
function hotDownloadManifest(callback) {
// eslint-disable-line no-unused-vars
if (typeof XMLHttpRequest === 'undefined')
return callback(new Error('No browser support'));
try {
var request = new XMLHttpRequest();
var requestPath = $require$.p + $hotMainFilename$;
request.open('GET', requestPath, true);
request.timeout = 10000;
request.send(null);
} catch (err) {
return callback(err);
}
request.onreadystatechange = function () {
if (request.readyState !== 4) return;
if (request.status === 0) {
// timeout
callback(
new Error('Manifest request to ' + requestPath + ' timed out.')
);
} else if (request.status === 404) {
// no update available
callback();
} else if (request.status !== 200 && request.status !== 304) {
// other failure
callback(new Error('Manifest request to ' + requestPath + ' failed.'));
} else {
// success
try {
var update = JSON.parse(request.responseText);
} catch (e) {
callback(e);
return;
}
callback(null, update);
}
};
}
};

View File

@ -1,36 +0,0 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function (updatedModules, renewedModules) {
var unacceptedModules = updatedModules.filter(function (moduleId) {
return renewedModules && renewedModules.indexOf(moduleId) < 0;
});
if (unacceptedModules.length > 0) {
console.warn(
"[HMR] The following modules couldn't be hot updated: (They would need a full reload!)"
);
unacceptedModules.forEach(function (moduleId) {
console.warn('[HMR] - ' + moduleId);
});
if (chrome && chrome.runtime && chrome.runtime.reload) {
console.warn('[HMR] extension reload');
chrome.runtime.reload();
} else {
console.warn(
"[HMR] Can't extension reload. not found chrome.runtime.reload."
);
}
}
if (!renewedModules || renewedModules.length === 0) {
console.log('[HMR] Nothing hot updated.');
} else {
console.log('[HMR] Updated modules:');
renewedModules.forEach(function (moduleId) {
console.log('[HMR] - ' + moduleId);
});
}
};