@digest/webpack-express 4.14.5-next.1 → 4.14.6
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 +3 -0
- package/dist/app.js +59 -0
- package/dist/routers/dev.d.ts +4 -0
- package/dist/routers/dev.js +26 -0
- package/dist/routers/hot.d.ts +4 -0
- package/dist/routers/hot.js +23 -0
- package/dist/routers/index.d.ts +3 -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 +2 -2
package/dist/app.d.ts
ADDED
package/dist/app.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const routers_1 = __importDefault(require("./routers"));
|
|
40
|
+
const server_1 = __importDefault(require("@digest/express/dist/server"));
|
|
41
|
+
const scripts_1 = require("@digest/scripts");
|
|
42
|
+
const connect_slashes_1 = __importDefault(require("connect-slashes"));
|
|
43
|
+
const express_1 = __importDefault(require("express"));
|
|
44
|
+
const helmet_1 = __importStar(require("helmet"));
|
|
45
|
+
const app = (0, express_1.default)();
|
|
46
|
+
app.use((0, helmet_1.default)(), routers_1.default, (0, connect_slashes_1.default)(false));
|
|
47
|
+
if (!scripts_1.production) {
|
|
48
|
+
app.use((0, helmet_1.contentSecurityPolicy)({
|
|
49
|
+
directives: {
|
|
50
|
+
defaultSrc: [
|
|
51
|
+
'\'self\'',
|
|
52
|
+
'\'unsafe-inline\''
|
|
53
|
+
],
|
|
54
|
+
upgradeInsecureRequests: null
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
(0, server_1.default)(app);
|
|
59
|
+
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 express_1 = require("express");
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
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: node_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 express_1 = require("express");
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
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: `${node_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 webpack_1 = __importDefault(require("../util/webpack"));
|
|
7
|
+
const dev_1 = __importDefault(require("./dev"));
|
|
8
|
+
const hot_1 = __importDefault(require("./hot"));
|
|
9
|
+
const history_1 = __importDefault(require("@digest/express/dist/routers/history"));
|
|
10
|
+
const statics_1 = __importDefault(require("@digest/express/dist/routers/statics"));
|
|
11
|
+
const scripts_1 = require("@digest/scripts");
|
|
12
|
+
const express_1 = require("express");
|
|
13
|
+
const { baseHref } = scripts_1.config;
|
|
14
|
+
const staticPath = scripts_1.config.staticPath;
|
|
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, scripts_1.production);
|
|
21
|
+
routers.use(baseHref, historyRouter, staticsRouter);
|
|
22
|
+
if (!scripts_1.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 = require("@digest/scripts");
|
|
7
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
+
const webpack = (dashboard = false) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const config = require(scripts_1.config.webpack);
|
|
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": "LGPL-3.0-or-later",
|
|
5
|
-
"version": "4.14.
|
|
5
|
+
"version": "4.14.6",
|
|
6
6
|
"description": "Digested Express Webpack middleware configurations",
|
|
7
7
|
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
8
8
|
"contributors": [
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"express",
|
|
62
62
|
"webpack"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "af58088b1b1a805901a52dc502472269dde55367"
|
|
65
65
|
}
|