quidproquo-deploy-webpack 0.0.199 → 0.0.201
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/lib/esm/loaders/qpq-config-loader.d.ts +2 -0
- package/lib/esm/loaders/qpq-config-loader.js +8 -0
- package/lib/esm/loaders/qpq-custom-action-processors-loader.d.ts +2 -0
- package/lib/esm/loaders/qpq-custom-action-processors-loader.js +22 -0
- package/lib/esm/loaders/qpq-dynamic-loader-warmer.d.ts +2 -0
- package/lib/esm/loaders/qpq-dynamic-loader-warmer.js +19 -0
- package/lib/esm/loaders/qpq-dynamic-loader.d.ts +2 -0
- package/lib/esm/loaders/qpq-dynamic-loader.js +22 -0
- package/lib/esm/loaders/qpq-user-directory-email-templates.d.ts +2 -0
- package/lib/esm/loaders/qpq-user-directory-email-templates.js +8 -0
- package/lib/esm/webpack.config.d.ts +160 -0
- package/lib/esm/webpack.config.js +93 -0
- package/package.json +14 -10
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const path = require('path');
|
|
3
|
+
module.exports = function () {
|
|
4
|
+
const config = JSON.parse(process.env.QPQLoaderConfig);
|
|
5
|
+
const result = `module.exports = ${JSON.stringify(config.qpqConfig, null, 2)}`;
|
|
6
|
+
// console.log(result);
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
@@ -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 root = config.projectRoot;
|
|
6
|
+
const imports = config.customActionProcessorSources
|
|
7
|
+
.map((src, i) => {
|
|
8
|
+
const srcPath = path.join(root, src).replace(/\\/g, '/');
|
|
9
|
+
return `const customActionProcessorImport${i} = require('${srcPath}');`;
|
|
10
|
+
})
|
|
11
|
+
.join('\n');
|
|
12
|
+
const exports = config.customActionProcessorSources
|
|
13
|
+
.map((_, i) => ` ...customActionProcessorImport${i}.default()`)
|
|
14
|
+
.join(',\n');
|
|
15
|
+
const result = `${imports}
|
|
16
|
+
|
|
17
|
+
module.exports = () => ({
|
|
18
|
+
${exports}
|
|
19
|
+
})`;
|
|
20
|
+
// console.log(result);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const path = require('path');
|
|
3
|
+
module.exports = function () {
|
|
4
|
+
const config = JSON.parse(process.env.QPQLoaderConfig);
|
|
5
|
+
const root = config.projectRoot;
|
|
6
|
+
const uniqueSrcFiles = [...new Set(config.allSrcEntries)].filter((sf) => !sf.startsWith('@QpqService/'));
|
|
7
|
+
const requireStatements = uniqueSrcFiles.map((e) => {
|
|
8
|
+
const fullPath = path.join(root, e);
|
|
9
|
+
const srcPath = fullPath.replace(/\\/g, '/');
|
|
10
|
+
return ` require('${srcPath}')`;
|
|
11
|
+
});
|
|
12
|
+
const result = `module.exports = async () => {
|
|
13
|
+
await Promise.all([
|
|
14
|
+
${requireStatements.join(',\n')}
|
|
15
|
+
]);
|
|
16
|
+
}`;
|
|
17
|
+
// console.log(result);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
@@ -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 root = config.projectRoot;
|
|
6
|
+
const uniqueSrcFiles = [...new Set(config.allSrcEntries)].filter((sf) => !sf.startsWith('@QpqService/'));
|
|
7
|
+
const ifStatements = uniqueSrcFiles.map((e) => {
|
|
8
|
+
const fullPath = path.join(root, e);
|
|
9
|
+
const srcPath = fullPath.replace(/\\/g, '/');
|
|
10
|
+
return `if (moduleName === '${e}') {
|
|
11
|
+
return await require('${srcPath}');
|
|
12
|
+
}`;
|
|
13
|
+
});
|
|
14
|
+
const ifBlock = ifStatements.join(' else ');
|
|
15
|
+
const result = `module.exports = async (moduleName) => {
|
|
16
|
+
${ifBlock};
|
|
17
|
+
|
|
18
|
+
return null;
|
|
19
|
+
}`;
|
|
20
|
+
// console.log(result);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = function (source) {
|
|
3
|
+
const config = JSON.parse(process.env.QPQLoaderConfig);
|
|
4
|
+
const userDirectoryEmailTemplates = config.userDirectoryEmailTemplates;
|
|
5
|
+
const result = `module.exports = ${JSON.stringify(userDirectoryEmailTemplates, null, 2)};`;
|
|
6
|
+
// console.log(result);
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
type WebpackBuildMode = 'none' | 'development' | 'production';
|
|
3
|
+
export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, awsLambdasToBuild: string[]) => {
|
|
4
|
+
entry: {};
|
|
5
|
+
resolveLoader: {
|
|
6
|
+
modules: string[];
|
|
7
|
+
};
|
|
8
|
+
mode: WebpackBuildMode;
|
|
9
|
+
externals: RegExp[];
|
|
10
|
+
target: string;
|
|
11
|
+
output: {
|
|
12
|
+
path: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
globalObject: string;
|
|
15
|
+
libraryTarget: string;
|
|
16
|
+
};
|
|
17
|
+
resolve: {
|
|
18
|
+
extensions: string[];
|
|
19
|
+
fallback: {
|
|
20
|
+
path: string;
|
|
21
|
+
crypto: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
module: {
|
|
25
|
+
rules: ({
|
|
26
|
+
test: RegExp;
|
|
27
|
+
loader: string;
|
|
28
|
+
options: {
|
|
29
|
+
presets: string[];
|
|
30
|
+
};
|
|
31
|
+
type?: undefined;
|
|
32
|
+
exclude?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
test: RegExp;
|
|
35
|
+
type: string;
|
|
36
|
+
exclude: RegExp;
|
|
37
|
+
loader?: undefined;
|
|
38
|
+
options?: undefined;
|
|
39
|
+
})[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const getWebpackEntryNames: () => string[];
|
|
43
|
+
export declare const getSeoWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
|
|
44
|
+
entry: {};
|
|
45
|
+
resolveLoader: {
|
|
46
|
+
modules: string[];
|
|
47
|
+
};
|
|
48
|
+
mode: WebpackBuildMode;
|
|
49
|
+
externals: RegExp[];
|
|
50
|
+
target: string;
|
|
51
|
+
output: {
|
|
52
|
+
path: string;
|
|
53
|
+
filename: string;
|
|
54
|
+
globalObject: string;
|
|
55
|
+
libraryTarget: string;
|
|
56
|
+
};
|
|
57
|
+
resolve: {
|
|
58
|
+
extensions: string[];
|
|
59
|
+
fallback: {
|
|
60
|
+
path: string;
|
|
61
|
+
crypto: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
module: {
|
|
65
|
+
rules: ({
|
|
66
|
+
test: RegExp;
|
|
67
|
+
loader: string;
|
|
68
|
+
options: {
|
|
69
|
+
presets: string[];
|
|
70
|
+
};
|
|
71
|
+
type?: undefined;
|
|
72
|
+
exclude?: undefined;
|
|
73
|
+
} | {
|
|
74
|
+
test: RegExp;
|
|
75
|
+
type: string;
|
|
76
|
+
exclude: RegExp;
|
|
77
|
+
loader?: undefined;
|
|
78
|
+
options?: undefined;
|
|
79
|
+
})[];
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export declare const getApiWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
|
|
83
|
+
entry: {};
|
|
84
|
+
resolveLoader: {
|
|
85
|
+
modules: string[];
|
|
86
|
+
};
|
|
87
|
+
mode: WebpackBuildMode;
|
|
88
|
+
externals: RegExp[];
|
|
89
|
+
target: string;
|
|
90
|
+
output: {
|
|
91
|
+
path: string;
|
|
92
|
+
filename: string;
|
|
93
|
+
globalObject: string;
|
|
94
|
+
libraryTarget: string;
|
|
95
|
+
};
|
|
96
|
+
resolve: {
|
|
97
|
+
extensions: string[];
|
|
98
|
+
fallback: {
|
|
99
|
+
path: string;
|
|
100
|
+
crypto: boolean;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
module: {
|
|
104
|
+
rules: ({
|
|
105
|
+
test: RegExp;
|
|
106
|
+
loader: string;
|
|
107
|
+
options: {
|
|
108
|
+
presets: string[];
|
|
109
|
+
};
|
|
110
|
+
type?: undefined;
|
|
111
|
+
exclude?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
test: RegExp;
|
|
114
|
+
type: string;
|
|
115
|
+
exclude: RegExp;
|
|
116
|
+
loader?: undefined;
|
|
117
|
+
options?: undefined;
|
|
118
|
+
})[];
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
|
|
122
|
+
entry: {};
|
|
123
|
+
resolveLoader: {
|
|
124
|
+
modules: string[];
|
|
125
|
+
};
|
|
126
|
+
mode: WebpackBuildMode;
|
|
127
|
+
externals: RegExp[];
|
|
128
|
+
target: string;
|
|
129
|
+
output: {
|
|
130
|
+
path: string;
|
|
131
|
+
filename: string;
|
|
132
|
+
globalObject: string;
|
|
133
|
+
libraryTarget: string;
|
|
134
|
+
};
|
|
135
|
+
resolve: {
|
|
136
|
+
extensions: string[];
|
|
137
|
+
fallback: {
|
|
138
|
+
path: string;
|
|
139
|
+
crypto: boolean;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
module: {
|
|
143
|
+
rules: ({
|
|
144
|
+
test: RegExp;
|
|
145
|
+
loader: string;
|
|
146
|
+
options: {
|
|
147
|
+
presets: string[];
|
|
148
|
+
};
|
|
149
|
+
type?: undefined;
|
|
150
|
+
exclude?: undefined;
|
|
151
|
+
} | {
|
|
152
|
+
test: RegExp;
|
|
153
|
+
type: string;
|
|
154
|
+
exclude: RegExp;
|
|
155
|
+
loader?: undefined;
|
|
156
|
+
options?: undefined;
|
|
157
|
+
})[];
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { qpqCoreUtils } from 'quidproquo-core';
|
|
4
|
+
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
5
|
+
const getWebpackBuildMode = (qpqConfig) => {
|
|
6
|
+
const feature = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
|
|
7
|
+
if (['development', 'production'].indexOf(feature) >= 0) {
|
|
8
|
+
return feature;
|
|
9
|
+
}
|
|
10
|
+
return 'production';
|
|
11
|
+
};
|
|
12
|
+
export const getWebpackConfig = (qpqConfig, buildPath, awsLambdasToBuild) => {
|
|
13
|
+
const allSrcEntries = [...qpqCoreUtils.getAllSrcEntries(qpqConfig), ...qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
14
|
+
const customActionProcessorSources = qpqCoreUtils.getActionProcessorSources(qpqConfig);
|
|
15
|
+
// set the qpq config env for loaders
|
|
16
|
+
process.env.QPQLoaderConfig = JSON.stringify({
|
|
17
|
+
allSrcEntries,
|
|
18
|
+
rootDir: path.resolve(buildPath, '..'),
|
|
19
|
+
qpqConfig,
|
|
20
|
+
customActionProcessorSources,
|
|
21
|
+
projectRoot: qpqCoreUtils.getConfigRoot(qpqConfig),
|
|
22
|
+
userDirectoryEmailTemplates: qpqCoreUtils.getUserDirectoryEmailTemplates(qpqConfig),
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
entry: awsLambdasToBuild.reduce((acc, name) => ({ ...acc, [name]: `quidproquo-deploy-awscdk/src/lambdas/${name}.ts` }), {}),
|
|
26
|
+
resolveLoader: {
|
|
27
|
+
modules: [path.resolve(__dirname, 'loaders'), 'node_modules'],
|
|
28
|
+
},
|
|
29
|
+
mode: getWebpackBuildMode(qpqConfig),
|
|
30
|
+
// mode: 'production',
|
|
31
|
+
externals: [/aws-sdk/],
|
|
32
|
+
target: 'node',
|
|
33
|
+
output: {
|
|
34
|
+
// Output path
|
|
35
|
+
path: buildPath,
|
|
36
|
+
filename: '[name]/index.js',
|
|
37
|
+
// Allow compiling as a lib ~ don't tree shake my exports plz
|
|
38
|
+
globalObject: 'this',
|
|
39
|
+
libraryTarget: 'commonjs2',
|
|
40
|
+
},
|
|
41
|
+
resolve: {
|
|
42
|
+
extensions: ['.ts', '.tsx', '.js', '.json'],
|
|
43
|
+
fallback: {
|
|
44
|
+
path: require.resolve('path-browserify'),
|
|
45
|
+
crypto: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
module: {
|
|
49
|
+
rules: [
|
|
50
|
+
{
|
|
51
|
+
test: /\.(ts)$/,
|
|
52
|
+
loader: 'babel-loader',
|
|
53
|
+
options: {
|
|
54
|
+
// without additional settings, this will reference .babelrc
|
|
55
|
+
presets: ['@babel/preset-typescript'],
|
|
56
|
+
},
|
|
57
|
+
// exclude: /node_modules/,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
test: /\.(yaml|json)$/,
|
|
61
|
+
type: 'asset/source',
|
|
62
|
+
exclude: /node_modules/,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
// plugins: [new BundleAnalyzerPlugin()],
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export const getWebpackEntryNames = () => [
|
|
70
|
+
'lambdaAPIGatewayEvent',
|
|
71
|
+
'lambdaAPIGatewayEvent_redirect',
|
|
72
|
+
'lambdaWebsocketAPIGatewayEvent',
|
|
73
|
+
'lambdaEventBridgeEventStackDeploy',
|
|
74
|
+
'lambdaEventBridgeEvent',
|
|
75
|
+
'lambdaEventOriginRequest',
|
|
76
|
+
'lambdaEventViewerRequest',
|
|
77
|
+
'lambdaServiceFunctionExecute',
|
|
78
|
+
'lambdaSQSEvent',
|
|
79
|
+
'lambdaS3FileEvent',
|
|
80
|
+
'lambdaCognitoTriggerEvent_CustomMessage',
|
|
81
|
+
];
|
|
82
|
+
export const getSeoWebpackConfig = (qpqConfig, outputPath) => getWebpackConfig(qpqConfig, outputPath || 'build', ['lambdaEventOriginRequest', 'lambdaEventViewerRequest', 'lambdaAPIGatewayEvent_redirect']);
|
|
83
|
+
export const getApiWebpackConfig = (qpqConfig, outputPath) => getWebpackConfig(qpqConfig, outputPath || 'build', [
|
|
84
|
+
'lambdaEventBridgeEventStackDeploy',
|
|
85
|
+
'lambdaEventBridgeEvent',
|
|
86
|
+
'lambdaAPIGatewayEvent',
|
|
87
|
+
'lambdaWebsocketAPIGatewayEvent',
|
|
88
|
+
'lambdaServiceFunctionExecute',
|
|
89
|
+
'lambdaSQSEvent',
|
|
90
|
+
'lambdaS3FileEvent',
|
|
91
|
+
'lambdaCognitoTriggerEvent_CustomMessage',
|
|
92
|
+
]);
|
|
93
|
+
export const getAllWebpackConfig = (qpqConfig, outputPath) => getWebpackConfig(qpqConfig, outputPath || 'build', getWebpackEntryNames());
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-deploy-webpack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.201",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/webpack.config.js",
|
|
6
|
-
"
|
|
6
|
+
"module": "./lib/esm/webpack.config.js",
|
|
7
|
+
"types": "./lib/esm/webpack.config.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
7
9
|
"files": [
|
|
8
10
|
"lib/**/*"
|
|
9
11
|
],
|
|
10
12
|
"scripts": {
|
|
11
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
14
|
"clean": "npx rimraf lib && npx rimraf node_modules",
|
|
13
|
-
"build": "npm run clean &&
|
|
14
|
-
"watch": "tsc -p tsconfig.
|
|
15
|
+
"build": "npm run clean && npm run build:esm && npm run build:cjs",
|
|
16
|
+
"watch": "tsc -p tsconfig.esm.json -w",
|
|
17
|
+
"build:cjs": "tsc -p tsconfig.commonjs.json",
|
|
18
|
+
"build:esm": "tsc -p tsconfig.esm.json"
|
|
15
19
|
},
|
|
16
20
|
"repository": {
|
|
17
21
|
"type": "git",
|
|
@@ -26,11 +30,11 @@
|
|
|
26
30
|
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
27
31
|
"dependencies": {
|
|
28
32
|
"path-browserify": "^1.0.1",
|
|
29
|
-
"quidproquo-actionprocessor-awslambda": "0.0.
|
|
30
|
-
"quidproquo-actionprocessor-node": "0.0.
|
|
31
|
-
"quidproquo-core": "0.0.
|
|
32
|
-
"quidproquo-deploy-awscdk": "0.0.
|
|
33
|
-
"quidproquo-webserver": "0.0.
|
|
33
|
+
"quidproquo-actionprocessor-awslambda": "0.0.201",
|
|
34
|
+
"quidproquo-actionprocessor-node": "0.0.201",
|
|
35
|
+
"quidproquo-core": "0.0.201",
|
|
36
|
+
"quidproquo-deploy-awscdk": "0.0.201",
|
|
37
|
+
"quidproquo-webserver": "0.0.201"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|
|
36
40
|
"@babel/core": "^7.20.12",
|
|
@@ -40,7 +44,7 @@
|
|
|
40
44
|
"@types/node": "^20.2.1",
|
|
41
45
|
"@types/prettier": "2.6.0",
|
|
42
46
|
"babel-loader": "^9.1.2",
|
|
43
|
-
"quidproquo-tsconfig": "0.0.
|
|
47
|
+
"quidproquo-tsconfig": "0.0.201",
|
|
44
48
|
"ts-node": "^10.9.1",
|
|
45
49
|
"typescript": "^5.0.4"
|
|
46
50
|
}
|