quidproquo-deploy-webpack 0.0.30 → 0.0.32

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,2 @@
1
+ declare function _exports(source: any): string;
2
+ export = _exports;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ const path = require('path');
3
+ module.exports = function (source) {
4
+ // console.log('Loader Running');
5
+ // console.log(process.env.QPQLoaderConfig);
6
+ // console.log('---');
7
+ const config = JSON.parse(process.env.QPQLoaderConfig);
8
+ const ifStatements = config.allSrcEntries.map((e) => {
9
+ return `if (moduleName === '${e}') {
10
+ return await require('./${e.replace(/\\/g, '/')}');
11
+ }`;
12
+ });
13
+ const ifBlock = ifStatements.join(' else ');
14
+ const result = `module.exports = async (moduleName) => {
15
+ ${ifBlock};
16
+
17
+ return null;
18
+ }`;
19
+ // console.log(result);
20
+ return result;
21
+ };
@@ -1,14 +1,25 @@
1
1
  import { QPQConfig } from 'quidproquo-core';
2
2
  export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, outputPrefix: string) => {
3
- entry: {};
3
+ entry: {
4
+ lambdaAPIGatewayEvent: string;
5
+ lambdaEventBridgeEvent: string;
6
+ };
7
+ resolveLoader: {
8
+ modules: string[];
9
+ };
4
10
  mode: string;
11
+ target: string;
5
12
  output: {
6
13
  path: string;
14
+ filename: string;
7
15
  globalObject: string;
8
16
  libraryTarget: string;
9
17
  };
10
18
  resolve: {
11
19
  extensions: string[];
20
+ fallback: {
21
+ crypto: boolean;
22
+ };
12
23
  };
13
24
  module: {
14
25
  rules: ({
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getWebpackConfig = void 0;
7
+ const path_1 = __importDefault(require("path"));
4
8
  const quidproquo_core_1 = require("quidproquo-core");
5
9
  const quidproquo_webserver_1 = require("quidproquo-webserver");
6
10
  const getWebpackBuildMode = (qpqConfig) => {
@@ -15,9 +19,28 @@ const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
15
19
  ...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig),
16
20
  ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig),
17
21
  ];
22
+ // set the qpq config env for loaders
23
+ process.env.QPQLoaderConfig = JSON.stringify({
24
+ allSrcEntries,
25
+ rootDir: path_1.default.resolve(buildPath, '..'),
26
+ });
18
27
  return {
19
- entry: allSrcEntries.reduce((entry, path) => (Object.assign(Object.assign({}, entry), { [`./${outputPrefix}/${path}`]: `./${path}` })), {}),
20
- mode: getWebpackBuildMode(qpqConfig),
28
+ // entry: allSrcEntries.reduce(
29
+ // (entry, path) => ({
30
+ // ...entry,
31
+ // [`./${outputPrefix}/${path}`]: `./${path}`,
32
+ // }),
33
+ // {},
34
+ // ),
35
+ entry: {
36
+ lambdaAPIGatewayEvent: 'quidproquo-deploy-awscdk/src/lambdas/LambdaAPIGatewayEvent.ts',
37
+ lambdaEventBridgeEvent: 'quidproquo-deploy-awscdk/src/lambdas/lambdaEventBridgeEvent.ts',
38
+ },
39
+ resolveLoader: {
40
+ modules: [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'],
41
+ },
42
+ // mode: getWebpackBuildMode(qpqConfig),
43
+ mode: 'production',
21
44
  // We should: sort out how to split the bundles and get it to work on aws
22
45
  // optimization: {
23
46
  // splitChunks: {
@@ -25,15 +48,20 @@ const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
25
48
  // chunks: "all",
26
49
  // },
27
50
  // },
51
+ target: 'node',
28
52
  output: {
29
53
  // Output path
30
54
  path: buildPath,
55
+ filename: '[name].js',
31
56
  // Allow compiling as a lib ~ don't tree shake my exports plz
32
57
  globalObject: 'this',
33
- libraryTarget: 'umd',
58
+ libraryTarget: 'commonjs2',
34
59
  },
35
60
  resolve: {
36
61
  extensions: ['.ts', '.tsx', '.js', '.json'],
62
+ fallback: {
63
+ crypto: false,
64
+ },
37
65
  },
38
66
  module: {
39
67
  rules: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-deploy-webpack",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "",
5
5
  "main": "./lib/webpack.config.js",
6
6
  "types": "./lib/webpack.config.d.js",
@@ -32,7 +32,8 @@
32
32
  "quidproquo-actionprocessor-awslambda": "*",
33
33
  "quidproquo-actionprocessor-node": "*",
34
34
  "quidproquo-core": "*",
35
- "quidproquo-webserver": "*"
35
+ "quidproquo-webserver": "*",
36
+ "webpack": "^5.75.0"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/aws-lambda": "^8.10.109",