quidproquo-deploy-webpack 0.0.42 → 0.0.44

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(): string;
2
+ export = _exports;
@@ -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
+ };
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  const path = require('path');
3
3
  module.exports = function (source) {
4
- // console.log('Loader Running');
5
- // console.log(process.env.QPQLoaderConfig);
6
- // console.log('---');
7
4
  const config = JSON.parse(process.env.QPQLoaderConfig);
8
5
  const ifStatements = config.allSrcEntries.map((e) => {
9
6
  return `if (moduleName === '${e}') {
@@ -3,11 +3,25 @@ export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string,
3
3
  entry: {
4
4
  lambdaAPIGatewayEvent: string;
5
5
  lambdaEventBridgeEvent: string;
6
+ lambdaEventOriginRequest: string;
7
+ lambdaEventViewerRequest: string;
6
8
  };
7
9
  resolveLoader: {
8
10
  modules: string[];
9
11
  };
10
12
  mode: string;
13
+ optimization: {
14
+ splitChunks: {
15
+ chunks: string;
16
+ automaticNameDelimiter: string;
17
+ cacheGroups: {
18
+ vendors: {
19
+ test: RegExp;
20
+ priority: number;
21
+ };
22
+ };
23
+ };
24
+ };
11
25
  target: string;
12
26
  output: {
13
27
  path: string;
@@ -28,8 +42,8 @@ export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string,
28
42
  options: {
29
43
  presets: string[];
30
44
  };
31
- exclude: RegExp;
32
45
  type?: undefined;
46
+ exclude?: undefined;
33
47
  } | {
34
48
  test: RegExp;
35
49
  type: string;
@@ -23,36 +23,43 @@ const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
23
23
  process.env.QPQLoaderConfig = JSON.stringify({
24
24
  allSrcEntries,
25
25
  rootDir: path_1.default.resolve(buildPath, '..'),
26
+ qpqConfig,
26
27
  });
27
28
  return {
28
- // entry: allSrcEntries.reduce(
29
- // (entry, path) => ({
30
- // ...entry,
31
- // [`./${outputPrefix}/${path}`]: `./${path}`,
32
- // }),
33
- // {},
34
- // ),
35
29
  entry: {
36
30
  lambdaAPIGatewayEvent: 'quidproquo-deploy-awscdk/src/lambdas/lambdaAPIGatewayEvent.ts',
37
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',
38
34
  },
39
35
  resolveLoader: {
40
36
  modules: [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'],
41
37
  },
42
38
  // mode: getWebpackBuildMode(qpqConfig),
43
39
  mode: 'production',
44
- // We should: sort out how to split the bundles and get it to work on aws
45
- // optimization: {
46
- // splitChunks: {
47
- // // include all types of chunks
48
- // chunks: "all",
49
- // },
40
+ // externals: ({ request }: { request: string }, callback: any) => {
41
+ // if (/^@aws-sdk\//.test(request)) {
42
+ // return callback(null, `commonjs ${request}`);
43
+ // }
44
+ // callback();
50
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
+ },
51
58
  target: 'node',
52
59
  output: {
53
60
  // Output path
54
61
  path: buildPath,
55
- filename: '[name].js',
62
+ filename: '[name]/index.js',
56
63
  // Allow compiling as a lib ~ don't tree shake my exports plz
57
64
  globalObject: 'this',
58
65
  libraryTarget: 'commonjs2',
@@ -72,7 +79,7 @@ const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
72
79
  // without additional settings, this will reference .babelrc
73
80
  presets: ['@babel/preset-typescript'],
74
81
  },
75
- exclude: /node_modules/,
82
+ // exclude: /node_modules/,
76
83
  },
77
84
  {
78
85
  test: /\.(yaml|json)$/,
@@ -81,6 +88,7 @@ const getWebpackConfig = (qpqConfig, buildPath, outputPrefix) => {
81
88
  },
82
89
  ],
83
90
  },
91
+ // plugins: [new BundleAnalyzerPlugin()],
84
92
  };
85
93
  };
86
94
  exports.getWebpackConfig = getWebpackConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-deploy-webpack",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "",
5
5
  "main": "./lib/webpack.config.js",
6
6
  "types": "./lib/webpack.config.d.js",
@@ -11,7 +11,7 @@
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "clean": "npx rimraf lib",
13
13
  "build": "npm run clean && tsc",
14
- "watch": "npm run clean && tsc -w"
14
+ "watch": "tsc -w"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -31,8 +31,8 @@
31
31
  "esbuild": "^0.15.16",
32
32
  "quidproquo-actionprocessor-awslambda": "*",
33
33
  "quidproquo-actionprocessor-node": "*",
34
- "quidproquo-deploy-awscdk": "*",
35
34
  "quidproquo-core": "*",
35
+ "quidproquo-deploy-awscdk": "*",
36
36
  "quidproquo-webserver": "*"
37
37
  },
38
38
  "devDependencies": {
@@ -43,10 +43,12 @@
43
43
  "@types/babel__traverse": "7.18.2",
44
44
  "@types/node": "^10.17.60",
45
45
  "@types/prettier": "2.6.0",
46
+ "@types/webpack-bundle-analyzer": "^4.6.0",
46
47
  "babel-loader": "^9.1.2",
47
48
  "quidproquo-tsconfig": "*",
48
49
  "ts-node": "^10.9.1",
49
50
  "typescript": "^4.9.3",
50
- "webpack": "^5.75.0"
51
+ "webpack": "^5.75.0",
52
+ "webpack-bundle-analyzer": "^4.7.0"
51
53
  }
52
54
  }