quidproquo-deploy-webpack 0.0.91 → 0.0.92

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.
@@ -1,2 +1,2 @@
1
- declare function _exports(): string;
2
- export = _exports;
1
+ declare function _exports(): string;
2
+ export = _exports;
@@ -1,8 +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
- };
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
+ };
@@ -1,2 +1,2 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
1
+ declare function _exports(source: any): string;
2
+ export = _exports;
@@ -1,22 +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');
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
15
  const result = `${imports}
16
16
 
17
17
  module.exports = () => ({
18
18
  ${exports}
19
- })`;
20
- // console.log(result);
21
- return result;
22
- };
19
+ })`;
20
+ // console.log(result);
21
+ return result;
22
+ };
@@ -1,2 +1,2 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
1
+ declare function _exports(source: any): string;
2
+ export = _exports;
@@ -1,20 +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 ifStatements = config.allSrcEntries.map((e) => {
7
- const srcPath = path.join(root, e).replace(/\\/g, '/');
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, '/');
8
10
  return `if (moduleName === '${e}') {
9
11
  return await require('${srcPath}');
10
- }`;
11
- });
12
- const ifBlock = ifStatements.join(' else ');
12
+ }`;
13
+ });
14
+ const ifBlock = ifStatements.join(' else ');
13
15
  const result = `module.exports = async (moduleName) => {
14
16
  ${ifBlock};
15
17
 
16
18
  return null;
17
- }`;
18
- // console.log(result);
19
- return result;
20
- };
19
+ }`;
20
+ console.log(result);
21
+ return result;
22
+ };
@@ -1,2 +1,2 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
1
+ declare function _exports(source: any): string;
2
+ export = _exports;
@@ -1,8 +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
- };
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
+ };
@@ -1,7 +1,156 @@
1
- import { QPQConfig } from 'quidproquo-core';
2
- import webpack from 'webpack';
3
- export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, awsLambdasToBuild: string[]) => webpack.Configuration;
4
- export declare const getWebpackEntryNames: () => string[];
5
- export declare const getSeoWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => webpack.Configuration;
6
- export declare const getApiWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => webpack.Configuration;
7
- export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => webpack.Configuration;
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
+ crypto: boolean;
21
+ };
22
+ };
23
+ module: {
24
+ rules: ({
25
+ test: RegExp;
26
+ loader: string;
27
+ options: {
28
+ presets: string[];
29
+ };
30
+ type?: undefined;
31
+ exclude?: undefined;
32
+ } | {
33
+ test: RegExp;
34
+ type: string;
35
+ exclude: RegExp;
36
+ loader?: undefined;
37
+ options?: undefined;
38
+ })[];
39
+ };
40
+ };
41
+ export declare const getWebpackEntryNames: () => string[];
42
+ export declare const getSeoWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
43
+ entry: {};
44
+ resolveLoader: {
45
+ modules: string[];
46
+ };
47
+ mode: WebpackBuildMode;
48
+ externals: RegExp[];
49
+ target: string;
50
+ output: {
51
+ path: string;
52
+ filename: string;
53
+ globalObject: string;
54
+ libraryTarget: string;
55
+ };
56
+ resolve: {
57
+ extensions: string[];
58
+ fallback: {
59
+ crypto: boolean;
60
+ };
61
+ };
62
+ module: {
63
+ rules: ({
64
+ test: RegExp;
65
+ loader: string;
66
+ options: {
67
+ presets: string[];
68
+ };
69
+ type?: undefined;
70
+ exclude?: undefined;
71
+ } | {
72
+ test: RegExp;
73
+ type: string;
74
+ exclude: RegExp;
75
+ loader?: undefined;
76
+ options?: undefined;
77
+ })[];
78
+ };
79
+ };
80
+ export declare const getApiWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
81
+ entry: {};
82
+ resolveLoader: {
83
+ modules: string[];
84
+ };
85
+ mode: WebpackBuildMode;
86
+ externals: RegExp[];
87
+ target: string;
88
+ output: {
89
+ path: string;
90
+ filename: string;
91
+ globalObject: string;
92
+ libraryTarget: string;
93
+ };
94
+ resolve: {
95
+ extensions: string[];
96
+ fallback: {
97
+ crypto: boolean;
98
+ };
99
+ };
100
+ module: {
101
+ rules: ({
102
+ test: RegExp;
103
+ loader: string;
104
+ options: {
105
+ presets: string[];
106
+ };
107
+ type?: undefined;
108
+ exclude?: undefined;
109
+ } | {
110
+ test: RegExp;
111
+ type: string;
112
+ exclude: RegExp;
113
+ loader?: undefined;
114
+ options?: undefined;
115
+ })[];
116
+ };
117
+ };
118
+ export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, outputPath?: string) => {
119
+ entry: {};
120
+ resolveLoader: {
121
+ modules: string[];
122
+ };
123
+ mode: WebpackBuildMode;
124
+ externals: RegExp[];
125
+ target: string;
126
+ output: {
127
+ path: string;
128
+ filename: string;
129
+ globalObject: string;
130
+ libraryTarget: string;
131
+ };
132
+ resolve: {
133
+ extensions: string[];
134
+ fallback: {
135
+ crypto: boolean;
136
+ };
137
+ };
138
+ module: {
139
+ rules: ({
140
+ test: RegExp;
141
+ loader: string;
142
+ options: {
143
+ presets: string[];
144
+ };
145
+ type?: undefined;
146
+ exclude?: undefined;
147
+ } | {
148
+ test: RegExp;
149
+ type: string;
150
+ exclude: RegExp;
151
+ loader?: undefined;
152
+ options?: undefined;
153
+ })[];
154
+ };
155
+ };
156
+ export {};
@@ -1,104 +1,104 @@
1
- "use strict";
2
- // import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getAllWebpackConfig = exports.getApiWebpackConfig = exports.getSeoWebpackConfig = exports.getWebpackEntryNames = exports.getWebpackConfig = void 0;
8
- const path_1 = __importDefault(require("path"));
9
- const quidproquo_core_1 = require("quidproquo-core");
10
- const quidproquo_webserver_1 = require("quidproquo-webserver");
11
- const getWebpackBuildMode = (qpqConfig) => {
12
- const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
13
- if (['development', 'production'].indexOf(feature) >= 0) {
14
- return feature;
15
- }
16
- return 'production';
17
- };
18
- const getWebpackConfig = (qpqConfig, buildPath, awsLambdasToBuild) => {
19
- const allSrcEntries = [
20
- ...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig),
21
- ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig),
22
- ];
23
- const customActionProcessorSources = quidproquo_core_1.qpqCoreUtils.getActionProcessorSources(qpqConfig);
24
- // set the qpq config env for loaders
25
- process.env.QPQLoaderConfig = JSON.stringify({
26
- allSrcEntries,
27
- rootDir: path_1.default.resolve(buildPath, '..'),
28
- qpqConfig,
29
- customActionProcessorSources,
30
- projectRoot: quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig),
31
- userDirectoryEmailTemplates: quidproquo_core_1.qpqCoreUtils.getUserDirectoryEmailTemplates(qpqConfig),
32
- });
33
- return {
34
- entry: awsLambdasToBuild.reduce((acc, name) => (Object.assign(Object.assign({}, acc), { [name]: `quidproquo-deploy-awscdk/src/lambdas/${name}.ts` })), {}),
35
- resolveLoader: {
36
- modules: [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'],
37
- },
38
- mode: getWebpackBuildMode(qpqConfig),
39
- // mode: 'production',
40
- externals: [/aws-sdk/],
41
- target: 'node',
42
- output: {
43
- // Output path
44
- path: buildPath,
45
- filename: '[name]/index.js',
46
- // Allow compiling as a lib ~ don't tree shake my exports plz
47
- globalObject: 'this',
48
- libraryTarget: 'commonjs2',
49
- },
50
- resolve: {
51
- extensions: ['.ts', '.tsx', '.js', '.json'],
52
- fallback: {
53
- crypto: false,
54
- },
55
- },
56
- module: {
57
- rules: [
58
- {
59
- test: /\.(ts)$/,
60
- loader: 'babel-loader',
61
- options: {
62
- // without additional settings, this will reference .babelrc
63
- presets: ['@babel/preset-typescript'],
64
- },
65
- // exclude: /node_modules/,
66
- },
67
- {
68
- test: /\.(yaml|json)$/,
69
- type: 'asset/source',
70
- exclude: /node_modules/,
71
- },
72
- ],
73
- },
74
- // plugins: [new BundleAnalyzerPlugin()],
75
- };
76
- };
77
- exports.getWebpackConfig = getWebpackConfig;
78
- const getWebpackEntryNames = () => [
79
- 'lambdaAPIGatewayEvent',
80
- 'lambdaAPIGatewayEvent_redirect',
81
- 'lambdaEventBridgeEvent',
82
- 'lambdaEventOriginRequest',
83
- 'lambdaEventViewerRequest',
84
- 'lambdaServiceFunctionExecute',
85
- 'lambdaSQSEvent',
86
- 'lambdaCognitoTriggerEvent_CustomMessage',
87
- ];
88
- exports.getWebpackEntryNames = getWebpackEntryNames;
89
- const getSeoWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', [
90
- 'lambdaEventOriginRequest',
91
- 'lambdaEventViewerRequest',
92
- 'lambdaAPIGatewayEvent_redirect',
93
- ]);
94
- exports.getSeoWebpackConfig = getSeoWebpackConfig;
95
- const getApiWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', [
96
- 'lambdaEventBridgeEvent',
97
- 'lambdaAPIGatewayEvent',
98
- 'lambdaServiceFunctionExecute',
99
- 'lambdaSQSEvent',
100
- 'lambdaCognitoTriggerEvent_CustomMessage',
101
- ]);
102
- exports.getApiWebpackConfig = getApiWebpackConfig;
103
- const getAllWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', (0, exports.getWebpackEntryNames)());
104
- exports.getAllWebpackConfig = getAllWebpackConfig;
1
+ "use strict";
2
+ // import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getAllWebpackConfig = exports.getApiWebpackConfig = exports.getSeoWebpackConfig = exports.getWebpackEntryNames = exports.getWebpackConfig = void 0;
8
+ const path_1 = __importDefault(require("path"));
9
+ const quidproquo_core_1 = require("quidproquo-core");
10
+ const quidproquo_webserver_1 = require("quidproquo-webserver");
11
+ const getWebpackBuildMode = (qpqConfig) => {
12
+ const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
13
+ if (['development', 'production'].indexOf(feature) >= 0) {
14
+ return feature;
15
+ }
16
+ return 'production';
17
+ };
18
+ const getWebpackConfig = (qpqConfig, buildPath, awsLambdasToBuild) => {
19
+ const allSrcEntries = [
20
+ ...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig),
21
+ ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig),
22
+ ];
23
+ const customActionProcessorSources = quidproquo_core_1.qpqCoreUtils.getActionProcessorSources(qpqConfig);
24
+ // set the qpq config env for loaders
25
+ process.env.QPQLoaderConfig = JSON.stringify({
26
+ allSrcEntries,
27
+ rootDir: path_1.default.resolve(buildPath, '..'),
28
+ qpqConfig,
29
+ customActionProcessorSources,
30
+ projectRoot: quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig),
31
+ userDirectoryEmailTemplates: quidproquo_core_1.qpqCoreUtils.getUserDirectoryEmailTemplates(qpqConfig),
32
+ });
33
+ return {
34
+ entry: awsLambdasToBuild.reduce((acc, name) => (Object.assign(Object.assign({}, acc), { [name]: `quidproquo-deploy-awscdk/src/lambdas/${name}.ts` })), {}),
35
+ resolveLoader: {
36
+ modules: [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'],
37
+ },
38
+ mode: getWebpackBuildMode(qpqConfig),
39
+ // mode: 'production',
40
+ externals: [/aws-sdk/],
41
+ target: 'node',
42
+ output: {
43
+ // Output path
44
+ path: buildPath,
45
+ filename: '[name]/index.js',
46
+ // Allow compiling as a lib ~ don't tree shake my exports plz
47
+ globalObject: 'this',
48
+ libraryTarget: 'commonjs2',
49
+ },
50
+ resolve: {
51
+ extensions: ['.ts', '.tsx', '.js', '.json'],
52
+ fallback: {
53
+ crypto: false,
54
+ },
55
+ },
56
+ module: {
57
+ rules: [
58
+ {
59
+ test: /\.(ts)$/,
60
+ loader: 'babel-loader',
61
+ options: {
62
+ // without additional settings, this will reference .babelrc
63
+ presets: ['@babel/preset-typescript'],
64
+ },
65
+ // exclude: /node_modules/,
66
+ },
67
+ {
68
+ test: /\.(yaml|json)$/,
69
+ type: 'asset/source',
70
+ exclude: /node_modules/,
71
+ },
72
+ ],
73
+ },
74
+ // plugins: [new BundleAnalyzerPlugin()],
75
+ };
76
+ };
77
+ exports.getWebpackConfig = getWebpackConfig;
78
+ const getWebpackEntryNames = () => [
79
+ 'lambdaAPIGatewayEvent',
80
+ 'lambdaAPIGatewayEvent_redirect',
81
+ 'lambdaEventBridgeEvent',
82
+ 'lambdaEventOriginRequest',
83
+ 'lambdaEventViewerRequest',
84
+ 'lambdaServiceFunctionExecute',
85
+ 'lambdaSQSEvent',
86
+ 'lambdaCognitoTriggerEvent_CustomMessage',
87
+ ];
88
+ exports.getWebpackEntryNames = getWebpackEntryNames;
89
+ const getSeoWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', [
90
+ 'lambdaEventOriginRequest',
91
+ 'lambdaEventViewerRequest',
92
+ 'lambdaAPIGatewayEvent_redirect',
93
+ ]);
94
+ exports.getSeoWebpackConfig = getSeoWebpackConfig;
95
+ const getApiWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', [
96
+ 'lambdaEventBridgeEvent',
97
+ 'lambdaAPIGatewayEvent',
98
+ 'lambdaServiceFunctionExecute',
99
+ 'lambdaSQSEvent',
100
+ 'lambdaCognitoTriggerEvent_CustomMessage',
101
+ ]);
102
+ exports.getApiWebpackConfig = getApiWebpackConfig;
103
+ const getAllWebpackConfig = (qpqConfig, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', (0, exports.getWebpackEntryNames)());
104
+ exports.getAllWebpackConfig = getAllWebpackConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-deploy-webpack",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "description": "",
5
5
  "main": "./lib/webpack.config.js",
6
6
  "types": "./lib/webpack.config.d.js",
@@ -25,10 +25,6 @@
25
25
  },
26
26
  "homepage": "https://github.com/joe-coady/quidproquo#readme",
27
27
  "dependencies": {
28
- "aws-cdk": "2.52.1",
29
- "aws-cdk-lib": "2.52.1",
30
- "constructs": "^10.0.0",
31
- "esbuild": "^0.15.16",
32
28
  "quidproquo-actionprocessor-awslambda": "*",
33
29
  "quidproquo-actionprocessor-node": "*",
34
30
  "quidproquo-core": "*",
@@ -39,16 +35,12 @@
39
35
  "@babel/core": "^7.20.12",
40
36
  "@babel/preset-env": "^7.20.2",
41
37
  "@babel/preset-typescript": "^7.18.6",
42
- "@types/aws-lambda": "^8.10.109",
43
38
  "@types/babel__traverse": "7.18.2",
44
39
  "@types/node": "^10.17.60",
45
40
  "@types/prettier": "2.6.0",
46
- "@types/webpack-bundle-analyzer": "^4.6.0",
47
41
  "babel-loader": "^9.1.2",
48
42
  "quidproquo-tsconfig": "*",
49
43
  "ts-node": "^10.9.1",
50
- "typescript": "^4.9.3",
51
- "webpack": "^5.75.0",
52
- "webpack-bundle-analyzer": "^4.7.0"
44
+ "typescript": "^5.0.4"
53
45
  }
54
46
  }