mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 14:16:01 +00:00
one more optimalization of plugin size & load time
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
const shell = require('./shell');
|
const shell = require('./shell');
|
||||||
const processArgs = require('./utility/processArgs');
|
const processArgs = require('./utility/processArgs');
|
||||||
|
const dbgateTools = require('dbgate-tools');
|
||||||
|
|
||||||
|
global['DBGATE_TOOLS'] = dbgateTools;
|
||||||
|
|
||||||
if (processArgs.startProcess) {
|
if (processArgs.startProcess) {
|
||||||
const proc = require('./proc');
|
const proc = require('./proc');
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function loadPlugins(pluginsDict, installedPlugins) {
|
async function loadPlugins(pluginsDict, installedPlugins) {
|
||||||
|
window['DBGATE_TOOLS'] = dbgateTools;
|
||||||
|
|
||||||
const newPlugins = {};
|
const newPlugins = {};
|
||||||
for (const installed of installedPlugins || []) {
|
for (const installed of installedPlugins || []) {
|
||||||
if (!_.keys(pluginsDict).includes(installed.name)) {
|
if (!_.keys(pluginsDict).includes(installed.name)) {
|
||||||
@@ -63,6 +65,7 @@
|
|||||||
import { useInstalledPlugins } from '../utility/metadataLoaders';
|
import { useInstalledPlugins } from '../utility/metadataLoaders';
|
||||||
import { buildFileFormats } from './fileformats';
|
import { buildFileFormats } from './fileformats';
|
||||||
import { buildThemes } from './themes';
|
import { buildThemes } from './themes';
|
||||||
|
import dbgateTools from 'dbgate-tools';
|
||||||
|
|
||||||
let pluginsDict = {};
|
let pluginsDict = {};
|
||||||
const installedPlugins = useInstalledPlugins();
|
const installedPlugins = useInstalledPlugins();
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {}
|
class Dumper extends SqlDumper {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
const mongoIdRegex = /^[0-9a-f]{24}$/;
|
const mongoIdRegex = /^[0-9a-f]{24}$/;
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class MsSqlDumper extends SqlDumper {
|
class MsSqlDumper extends SqlDumper {
|
||||||
autoIncrement() {
|
autoIncrement() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const MsSqlDumper = require('./MsSqlDumper');
|
const MsSqlDumper = require('./MsSqlDumper');
|
||||||
|
|
||||||
/** @type {import('dbgate-types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
// },
|
// },
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {
|
class Dumper extends SqlDumper {
|
||||||
/** @param type {import('dbgate-types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
/** @type {import('dbgate-types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {
|
class Dumper extends SqlDumper {
|
||||||
/** @param type {import('dbgate-types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
/** @type {import('dbgate-types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
var webpack = require("webpack");
|
var webpack = require('webpack');
|
||||||
var path = require("path");
|
var path = require('path');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
context: __dirname + "/src/frontend",
|
context: __dirname + '/src/frontend',
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
app: "./index.js",
|
app: './index.js',
|
||||||
},
|
},
|
||||||
target: "web",
|
target: 'web',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "dist"),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: "frontend.js",
|
filename: 'frontend.js',
|
||||||
libraryTarget: "var",
|
libraryTarget: 'var',
|
||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {}
|
class Dumper extends SqlDumper {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
function getDatabaseFileLabel(databaseFile) {
|
function getDatabaseFileLabel(databaseFile) {
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
var webpack = require("webpack");
|
var webpack = require('webpack');
|
||||||
var path = require("path");
|
var path = require('path');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
context: __dirname + "/src/frontend",
|
context: __dirname + '/src/frontend',
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
app: "./index.js",
|
app: './index.js',
|
||||||
},
|
},
|
||||||
target: "web",
|
target: 'web',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "dist"),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: "frontend.js",
|
filename: 'frontend.js',
|
||||||
libraryTarget: "var",
|
libraryTarget: 'var',
|
||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user