@digest/webpack-express 3.3.1 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts +2 -0
- package/dist/app.js +14 -0
- package/dist/routers/dev.d.ts +3 -0
- package/dist/routers/dev.js +26 -0
- package/dist/routers/hot.d.ts +3 -0
- package/dist/routers/hot.js +23 -0
- package/dist/routers/index.d.ts +2 -0
- package/dist/routers/index.js +29 -0
- package/dist/util/webpack.d.ts +3 -0
- package/dist/util/webpack.js +18 -0
- package/package.json +22 -14
- package/dist/dev.d.ts +0 -2
- package/dist/dev.js +0 -27
- package/dist/start.d.ts +0 -2
- package/dist/start.js +0 -14
package/dist/app.d.ts
ADDED
package/dist/app.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const server_1 = __importDefault(require("@digest/express/dist/server"));
|
|
7
|
+
const connect_slashes_1 = __importDefault(require("connect-slashes"));
|
|
8
|
+
const express_1 = __importDefault(require("express"));
|
|
9
|
+
const helmet_1 = __importDefault(require("helmet"));
|
|
10
|
+
const routers_1 = __importDefault(require("./routers"));
|
|
11
|
+
const app = (0, express_1.default)();
|
|
12
|
+
app.use((0, helmet_1.default)(), routers_1.default, (0, connect_slashes_1.default)(false));
|
|
13
|
+
(0, server_1.default)(app);
|
|
14
|
+
exports.default = app;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const express_1 = require("express");
|
|
8
|
+
const webpack_dev_middleware_1 = __importDefault(require("webpack-dev-middleware"));
|
|
9
|
+
const dev = (compiler, baseHref, publicPath = 'bundle') => {
|
|
10
|
+
const router = (0, express_1.Router)({
|
|
11
|
+
caseSensitive: true,
|
|
12
|
+
strict: true
|
|
13
|
+
});
|
|
14
|
+
const devMiddleware = (0, webpack_dev_middleware_1.default)(compiler, {
|
|
15
|
+
publicPath: path_1.default.join(baseHref, publicPath),
|
|
16
|
+
stats: {
|
|
17
|
+
colors: true
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const devBase = '/*';
|
|
21
|
+
router.get(devBase, devMiddleware);
|
|
22
|
+
router.head(devBase, devMiddleware);
|
|
23
|
+
router.options(devBase, devMiddleware);
|
|
24
|
+
return router;
|
|
25
|
+
};
|
|
26
|
+
exports.default = dev;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const express_1 = require("express");
|
|
8
|
+
const webpack_hot_middleware_1 = __importDefault(require("webpack-hot-middleware"));
|
|
9
|
+
const hot = (compiler, baseHref, hotPath = 'hot') => {
|
|
10
|
+
const router = (0, express_1.Router)({
|
|
11
|
+
caseSensitive: true,
|
|
12
|
+
strict: true
|
|
13
|
+
});
|
|
14
|
+
const hotMiddleware = (0, webpack_hot_middleware_1.default)(compiler, {
|
|
15
|
+
path: `${path_1.default.join(baseHref)}${hotPath}`
|
|
16
|
+
});
|
|
17
|
+
const hotBase = '/*';
|
|
18
|
+
router.get(hotBase, hotMiddleware);
|
|
19
|
+
router.head(hotBase, hotMiddleware);
|
|
20
|
+
router.options(hotBase, hotMiddleware);
|
|
21
|
+
return router;
|
|
22
|
+
};
|
|
23
|
+
exports.default = hot;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const history_1 = __importDefault(require("@digest/express/dist/routers/history"));
|
|
7
|
+
const statics_1 = __importDefault(require("@digest/express/dist/routers/statics"));
|
|
8
|
+
const scripts_1 = __importDefault(require("@digest/scripts"));
|
|
9
|
+
const express_1 = require("express");
|
|
10
|
+
const webpack_1 = __importDefault(require("../util/webpack"));
|
|
11
|
+
const dev_1 = __importDefault(require("./dev"));
|
|
12
|
+
const hot_1 = __importDefault(require("./hot"));
|
|
13
|
+
const { baseHref, production } = scripts_1.default;
|
|
14
|
+
const staticPath = scripts_1.default.staticPath.replace('/bundle', '');
|
|
15
|
+
const routers = (0, express_1.Router)({
|
|
16
|
+
caseSensitive: true,
|
|
17
|
+
strict: true
|
|
18
|
+
});
|
|
19
|
+
const historyRouter = (0, history_1.default)(baseHref);
|
|
20
|
+
const staticsRouter = (0, statics_1.default)(baseHref, staticPath, production);
|
|
21
|
+
routers.use(baseHref, historyRouter, staticsRouter);
|
|
22
|
+
if (!production) {
|
|
23
|
+
const compiler = (0, webpack_1.default)();
|
|
24
|
+
const devRouter = (0, dev_1.default)(compiler, baseHref);
|
|
25
|
+
const hotRouter = (0, hot_1.default)(compiler, baseHref);
|
|
26
|
+
const routersBase = `${baseHref}*`;
|
|
27
|
+
routers.get(routersBase, devRouter, hotRouter);
|
|
28
|
+
}
|
|
29
|
+
exports.default = routers;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const scripts_1 = __importDefault(require("@digest/scripts"));
|
|
7
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
+
const webpack = (dashboard = false) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const config = require(scripts_1.default.config);
|
|
11
|
+
if (dashboard) {
|
|
12
|
+
const DashboardPlugin = require('webpack-dashboard/plugin');
|
|
13
|
+
(_a = config.plugins) === null || _a === void 0 ? void 0 : _a.concat(new DashboardPlugin());
|
|
14
|
+
}
|
|
15
|
+
const compiler = (0, webpack_1.default)(config);
|
|
16
|
+
return compiler;
|
|
17
|
+
};
|
|
18
|
+
exports.default = webpack;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@digest/webpack-express",
|
|
3
3
|
"title": "Express Webpack Middleware Digest",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
|
-
"version": "3.3.
|
|
5
|
+
"version": "3.3.5",
|
|
6
6
|
"description": "Digested Express Webpack middleware configurations",
|
|
7
7
|
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
8
8
|
"contributors": [
|
|
@@ -12,13 +12,21 @@
|
|
|
12
12
|
"position": "Initial and Lead Developer"
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
|
-
"main": "dist/
|
|
16
|
-
"types": "dist/
|
|
15
|
+
"main": "dist/app.js",
|
|
16
|
+
"types": "dist/app.d.ts",
|
|
17
17
|
"files": [
|
|
18
|
-
"/dist/dev.d.ts",
|
|
19
|
-
"/dist/dev.js",
|
|
20
|
-
"/dist/
|
|
21
|
-
"/dist/
|
|
18
|
+
"/dist/routers/dev.d.ts",
|
|
19
|
+
"/dist/routers/dev.js",
|
|
20
|
+
"/dist/routers/hot.d.ts",
|
|
21
|
+
"/dist/routers/hot.js",
|
|
22
|
+
"/dist/routers/index.d.ts",
|
|
23
|
+
"/dist/routers/index.js",
|
|
24
|
+
"/dist/routers/webpack.d.ts",
|
|
25
|
+
"/dist/routers/webpack.js",
|
|
26
|
+
"/dist/util/webpack.d.ts",
|
|
27
|
+
"/dist/util/webpack.js",
|
|
28
|
+
"/dist/app.d.ts",
|
|
29
|
+
"/dist/app.js",
|
|
22
30
|
"/LICENSE.md"
|
|
23
31
|
],
|
|
24
32
|
"homepage": "https://gitlab.com/digested/node-digest/tree/master/packages/webpack-express",
|
|
@@ -36,21 +44,21 @@
|
|
|
36
44
|
"clean": "rimraf node_modules dist package-lock.json npm-debug.log"
|
|
37
45
|
},
|
|
38
46
|
"dependencies": {
|
|
39
|
-
"@digest/express": "^3.3.
|
|
40
|
-
"@digest/scripts": "^3.3.
|
|
41
|
-
"@digest/webpack": "^3.3.
|
|
42
|
-
"
|
|
43
|
-
"webpack-dev-middleware": "^5.2.2",
|
|
47
|
+
"@digest/express": "^3.3.5",
|
|
48
|
+
"@digest/scripts": "^3.3.5",
|
|
49
|
+
"@digest/webpack": "^3.3.5",
|
|
50
|
+
"webpack-dev-middleware": "^5.3.0",
|
|
44
51
|
"webpack-hot-middleware": "^2.25.1"
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
47
54
|
"@types/express": "^4.17.13",
|
|
48
|
-
"@types/webpack
|
|
55
|
+
"@types/webpack": "^5.28.0",
|
|
56
|
+
"@types/webpack-dev-middleware": "^5.3.0"
|
|
49
57
|
},
|
|
50
58
|
"keywords": [
|
|
51
59
|
"digest",
|
|
52
60
|
"express",
|
|
53
61
|
"webpack"
|
|
54
62
|
],
|
|
55
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c92b63a632cc91df2fbfc342ae638ddee694f62c"
|
|
56
64
|
}
|
package/dist/dev.d.ts
DELETED
package/dist/dev.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const scripts_1 = __importDefault(require("@digest/scripts"));
|
|
7
|
-
const express_1 = require("express");
|
|
8
|
-
const webpack_1 = __importDefault(require("webpack"));
|
|
9
|
-
const webpack_dev_middleware_1 = __importDefault(require("webpack-dev-middleware"));
|
|
10
|
-
const webpack_hot_middleware_1 = __importDefault(require("webpack-hot-middleware"));
|
|
11
|
-
const config = require(scripts_1.default.config);
|
|
12
|
-
const compiler = (0, webpack_1.default)(config);
|
|
13
|
-
const router = (0, express_1.Router)();
|
|
14
|
-
function default_1(publicPath = config.output.publicPath, dashboard = scripts_1.default.webpackDashboard, production = scripts_1.default.production) {
|
|
15
|
-
if (dashboard && !production) {
|
|
16
|
-
const DashboardPlugin = require('webpack-dashboard/plugin');
|
|
17
|
-
config.plugins.concat(new DashboardPlugin());
|
|
18
|
-
}
|
|
19
|
-
if (!production) {
|
|
20
|
-
router.use((0, webpack_dev_middleware_1.default)(compiler, {
|
|
21
|
-
publicPath,
|
|
22
|
-
stats: { colors: true }
|
|
23
|
-
})).use((0, webpack_hot_middleware_1.default)(compiler));
|
|
24
|
-
}
|
|
25
|
-
return router;
|
|
26
|
-
}
|
|
27
|
-
exports.default = default_1;
|
package/dist/start.d.ts
DELETED
package/dist/start.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const app_1 = __importDefault(require("@digest/express/dist/app"));
|
|
7
|
-
const server_1 = __importDefault(require("@digest/express/dist/server"));
|
|
8
|
-
const express_1 = __importDefault(require("express"));
|
|
9
|
-
const dev_1 = __importDefault(require("./dev"));
|
|
10
|
-
const start = (0, express_1.default)();
|
|
11
|
-
start.use((0, dev_1.default)());
|
|
12
|
-
start.use((0, app_1.default)());
|
|
13
|
-
(0, server_1.default)(start);
|
|
14
|
-
exports.default = start;
|