quidproquo-deploy-webpack 0.0.51 → 0.0.52
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.
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
module.exports = function (source) {
|
|
4
4
|
const config = JSON.parse(process.env.QPQLoaderConfig);
|
|
5
|
+
const root = config.projectRoot;
|
|
5
6
|
const ifStatements = config.allSrcEntries.map((e) => {
|
|
7
|
+
const srcPath = path.join(root, e).replace(/\\/g, '/');
|
|
6
8
|
return `if (moduleName === '${e}') {
|
|
7
|
-
return await require('
|
|
9
|
+
return await require('${srcPath}');
|
|
8
10
|
}`;
|
|
9
11
|
});
|
|
10
12
|
const ifBlock = ifStatements.join(' else ');
|
package/lib/webpack.config.d.ts
CHANGED
|
@@ -1,6 +1,117 @@
|
|
|
1
1
|
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, awsLambdasToBuild: string[]) => {
|
|
3
|
+
entry: {};
|
|
4
|
+
resolveLoader: {
|
|
5
|
+
modules: string[];
|
|
6
|
+
};
|
|
7
|
+
mode: string;
|
|
8
|
+
target: string;
|
|
9
|
+
output: {
|
|
10
|
+
path: string;
|
|
11
|
+
filename: string;
|
|
12
|
+
globalObject: string;
|
|
13
|
+
libraryTarget: string;
|
|
14
|
+
};
|
|
15
|
+
resolve: {
|
|
16
|
+
extensions: string[];
|
|
17
|
+
fallback: {
|
|
18
|
+
crypto: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
module: {
|
|
22
|
+
rules: ({
|
|
23
|
+
test: RegExp;
|
|
24
|
+
loader: string;
|
|
25
|
+
options: {
|
|
26
|
+
presets: string[];
|
|
27
|
+
};
|
|
28
|
+
type?: undefined;
|
|
29
|
+
exclude?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
test: RegExp;
|
|
32
|
+
type: string;
|
|
33
|
+
exclude: RegExp;
|
|
34
|
+
loader?: undefined;
|
|
35
|
+
options?: undefined;
|
|
36
|
+
})[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
2
39
|
export declare const getWebpackEntryNames: () => string[];
|
|
3
|
-
export declare const
|
|
40
|
+
export declare const getSeoWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
|
|
41
|
+
entry: {};
|
|
42
|
+
resolveLoader: {
|
|
43
|
+
modules: string[];
|
|
44
|
+
};
|
|
45
|
+
mode: string;
|
|
46
|
+
target: string;
|
|
47
|
+
output: {
|
|
48
|
+
path: string;
|
|
49
|
+
filename: string;
|
|
50
|
+
globalObject: string;
|
|
51
|
+
libraryTarget: string;
|
|
52
|
+
};
|
|
53
|
+
resolve: {
|
|
54
|
+
extensions: string[];
|
|
55
|
+
fallback: {
|
|
56
|
+
crypto: boolean;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
module: {
|
|
60
|
+
rules: ({
|
|
61
|
+
test: RegExp;
|
|
62
|
+
loader: string;
|
|
63
|
+
options: {
|
|
64
|
+
presets: string[];
|
|
65
|
+
};
|
|
66
|
+
type?: undefined;
|
|
67
|
+
exclude?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
test: RegExp;
|
|
70
|
+
type: string;
|
|
71
|
+
exclude: RegExp;
|
|
72
|
+
loader?: undefined;
|
|
73
|
+
options?: undefined;
|
|
74
|
+
})[];
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export declare const getApiWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
|
|
78
|
+
entry: {};
|
|
79
|
+
resolveLoader: {
|
|
80
|
+
modules: string[];
|
|
81
|
+
};
|
|
82
|
+
mode: string;
|
|
83
|
+
target: string;
|
|
84
|
+
output: {
|
|
85
|
+
path: string;
|
|
86
|
+
filename: string;
|
|
87
|
+
globalObject: string;
|
|
88
|
+
libraryTarget: string;
|
|
89
|
+
};
|
|
90
|
+
resolve: {
|
|
91
|
+
extensions: string[];
|
|
92
|
+
fallback: {
|
|
93
|
+
crypto: boolean;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
module: {
|
|
97
|
+
rules: ({
|
|
98
|
+
test: RegExp;
|
|
99
|
+
loader: string;
|
|
100
|
+
options: {
|
|
101
|
+
presets: string[];
|
|
102
|
+
};
|
|
103
|
+
type?: undefined;
|
|
104
|
+
exclude?: undefined;
|
|
105
|
+
} | {
|
|
106
|
+
test: RegExp;
|
|
107
|
+
type: string;
|
|
108
|
+
exclude: RegExp;
|
|
109
|
+
loader?: undefined;
|
|
110
|
+
options?: undefined;
|
|
111
|
+
})[];
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, outputPath: string) => {
|
|
4
115
|
entry: {};
|
|
5
116
|
resolveLoader: {
|
|
6
117
|
modules: string[];
|
package/lib/webpack.config.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.getAllWebpackConfig = exports.getApiWebpackConfig = exports.getSeoWebpackConfig = exports.getWebpackEntryNames = exports.getWebpackConfig = void 0;
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
10
10
|
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
@@ -15,15 +15,7 @@ const getWebpackBuildMode = (qpqConfig) => {
|
|
|
15
15
|
}
|
|
16
16
|
return 'production';
|
|
17
17
|
};
|
|
18
|
-
const
|
|
19
|
-
'lambdaAPIGatewayEvent',
|
|
20
|
-
'lambdaAPIGatewayEvent_redirect',
|
|
21
|
-
'lambdaEventBridgeEvent',
|
|
22
|
-
'lambdaEventOriginRequest',
|
|
23
|
-
'lambdaEventViewerRequest',
|
|
24
|
-
];
|
|
25
|
-
exports.getWebpackEntryNames = getWebpackEntryNames;
|
|
26
|
-
const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
|
|
18
|
+
const getWebpackConfig = (qpqConfig, buildPath, awsLambdasToBuild) => {
|
|
27
19
|
const allSrcEntries = [
|
|
28
20
|
...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig),
|
|
29
21
|
...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig),
|
|
@@ -35,9 +27,10 @@ const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
|
|
|
35
27
|
rootDir: path_1.default.resolve(buildPath, '..'),
|
|
36
28
|
qpqConfig,
|
|
37
29
|
customActionProcessorSources,
|
|
30
|
+
projectRoot: quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig),
|
|
38
31
|
});
|
|
39
32
|
return {
|
|
40
|
-
entry:
|
|
33
|
+
entry: awsLambdasToBuild.reduce((acc, name) => (Object.assign(Object.assign({}, acc), { [name]: `quidproquo-deploy-awscdk/src/lambdas/${name}.ts` })), {}),
|
|
41
34
|
resolveLoader: {
|
|
42
35
|
modules: [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'],
|
|
43
36
|
},
|
|
@@ -80,3 +73,24 @@ const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
|
|
|
80
73
|
};
|
|
81
74
|
};
|
|
82
75
|
exports.getWebpackConfig = getWebpackConfig;
|
|
76
|
+
const getWebpackEntryNames = () => [
|
|
77
|
+
'lambdaAPIGatewayEvent',
|
|
78
|
+
'lambdaAPIGatewayEvent_redirect',
|
|
79
|
+
'lambdaEventBridgeEvent',
|
|
80
|
+
'lambdaEventOriginRequest',
|
|
81
|
+
'lambdaEventViewerRequest',
|
|
82
|
+
];
|
|
83
|
+
exports.getWebpackEntryNames = getWebpackEntryNames;
|
|
84
|
+
const getSeoWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', [
|
|
85
|
+
'lambdaEventOriginRequest',
|
|
86
|
+
'lambdaEventViewerRequest',
|
|
87
|
+
'lambdaAPIGatewayEvent_redirect',
|
|
88
|
+
]);
|
|
89
|
+
exports.getSeoWebpackConfig = getSeoWebpackConfig;
|
|
90
|
+
const getApiWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', [
|
|
91
|
+
'lambdaEventBridgeEvent',
|
|
92
|
+
'lambdaAPIGatewayEvent',
|
|
93
|
+
]);
|
|
94
|
+
exports.getApiWebpackConfig = getApiWebpackConfig;
|
|
95
|
+
const getAllWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath, (0, exports.getWebpackEntryNames)());
|
|
96
|
+
exports.getAllWebpackConfig = getAllWebpackConfig;
|