quidproquo-deploy-webpack 0.0.45 → 0.0.47
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.
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const path = require('path');
|
|
3
|
+
module.exports = function (source) {
|
|
4
|
+
const config = JSON.parse(process.env.QPQLoaderConfig);
|
|
5
|
+
const imports = config.customActionProcessorSources
|
|
6
|
+
.map((src, i) => {
|
|
7
|
+
return `const customActionProcessorImport${i} = require('./${src}');`;
|
|
8
|
+
})
|
|
9
|
+
.join('\n');
|
|
10
|
+
const exports = config.customActionProcessorSources
|
|
11
|
+
.map((_, i) => ` ...customActionProcessorImport${i}.default()`)
|
|
12
|
+
.join('\n');
|
|
13
|
+
const result = `${imports}
|
|
14
|
+
|
|
15
|
+
console.log(customActionProcessorImport0.default);
|
|
16
|
+
|
|
17
|
+
module.exports = () => ({
|
|
18
|
+
${exports}
|
|
19
|
+
})`;
|
|
20
|
+
// console.log(result);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
package/lib/webpack.config.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
export declare const getWebpackEntryNames: () => string[];
|
|
2
3
|
export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, outputPrefix: string) => {
|
|
3
|
-
entry: {
|
|
4
|
-
lambdaAPIGatewayEvent: string;
|
|
5
|
-
lambdaEventBridgeEvent: string;
|
|
6
|
-
lambdaEventOriginRequest: string;
|
|
7
|
-
lambdaEventViewerRequest: string;
|
|
8
|
-
};
|
|
4
|
+
entry: {};
|
|
9
5
|
resolveLoader: {
|
|
10
6
|
modules: string[];
|
|
11
7
|
};
|
package/lib/webpack.config.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getWebpackConfig = void 0;
|
|
7
|
+
exports.getWebpackConfig = exports.getWebpackEntryNames = void 0;
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
9
10
|
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
@@ -14,47 +15,33 @@ const getWebpackBuildMode = (qpqConfig) => {
|
|
|
14
15
|
}
|
|
15
16
|
return 'production';
|
|
16
17
|
};
|
|
18
|
+
const getWebpackEntryNames = () => [
|
|
19
|
+
'lambdaAPIGatewayEvent',
|
|
20
|
+
'lambdaEventBridgeEvent',
|
|
21
|
+
'lambdaEventOriginRequest',
|
|
22
|
+
'lambdaEventViewerRequest',
|
|
23
|
+
];
|
|
24
|
+
exports.getWebpackEntryNames = getWebpackEntryNames;
|
|
17
25
|
const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
|
|
18
26
|
const allSrcEntries = [
|
|
19
27
|
...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig),
|
|
20
28
|
...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig),
|
|
21
29
|
];
|
|
30
|
+
const customActionProcessorSources = quidproquo_core_1.qpqCoreUtils.getActionProcessorSources(qpqConfig);
|
|
22
31
|
// set the qpq config env for loaders
|
|
23
32
|
process.env.QPQLoaderConfig = JSON.stringify({
|
|
24
33
|
allSrcEntries,
|
|
25
34
|
rootDir: path_1.default.resolve(buildPath, '..'),
|
|
26
35
|
qpqConfig,
|
|
36
|
+
customActionProcessorSources,
|
|
27
37
|
});
|
|
28
38
|
return {
|
|
29
|
-
entry: {
|
|
30
|
-
lambdaAPIGatewayEvent: 'quidproquo-deploy-awscdk/src/lambdas/lambdaAPIGatewayEvent.ts',
|
|
31
|
-
lambdaEventBridgeEvent: 'quidproquo-deploy-awscdk/src/lambdas/lambdaEventBridgeEvent.ts',
|
|
32
|
-
lambdaEventOriginRequest: 'quidproquo-deploy-awscdk/src/lambdas/lambdaEventOriginRequest.ts',
|
|
33
|
-
lambdaEventViewerRequest: 'quidproquo-deploy-awscdk/src/lambdas/lambdaEventViewerRequest.ts',
|
|
34
|
-
},
|
|
39
|
+
entry: (0, exports.getWebpackEntryNames)().reduce((acc, name) => (Object.assign(Object.assign({}, acc), { [name]: `quidproquo-deploy-awscdk/src/lambdas/${name}.ts` })), {}),
|
|
35
40
|
resolveLoader: {
|
|
36
41
|
modules: [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'],
|
|
37
42
|
},
|
|
38
43
|
// mode: getWebpackBuildMode(qpqConfig),
|
|
39
44
|
mode: 'production',
|
|
40
|
-
// externals: ({ request }: { request: string }, callback: any) => {
|
|
41
|
-
// if (/^@aws-sdk\//.test(request)) {
|
|
42
|
-
// return callback(null, `commonjs ${request}`);
|
|
43
|
-
// }
|
|
44
|
-
// callback();
|
|
45
|
-
// },
|
|
46
|
-
// optimization: {
|
|
47
|
-
// splitChunks: {
|
|
48
|
-
// chunks: 'all',
|
|
49
|
-
// automaticNameDelimiter: '.',
|
|
50
|
-
// cacheGroups: {
|
|
51
|
-
// vendors: {
|
|
52
|
-
// test: /[\\/]node_modules[\\/]/,
|
|
53
|
-
// priority: -10,
|
|
54
|
-
// },
|
|
55
|
-
// },
|
|
56
|
-
// },
|
|
57
|
-
// },
|
|
58
45
|
target: 'node',
|
|
59
46
|
output: {
|
|
60
47
|
// Output path
|