quidproquo-deploy-webpack 0.0.222 → 0.0.224

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.
Files changed (35) hide show
  1. package/lib/commonjs/getWebpackConfigForQpq.d.ts +4 -0
  2. package/lib/commonjs/getWebpackConfigForQpq.js +49 -0
  3. package/lib/commonjs/plugins/QpqPlugin.js +8 -8
  4. package/lib/commonjs/plugins/getQpqDyanmicLoaderSrcFromQpqConfig.d.ts +2 -0
  5. package/lib/commonjs/plugins/getQpqDyanmicLoaderSrcFromQpqConfig.js +46 -0
  6. package/lib/commonjs/webpack.config.d.ts +1 -0
  7. package/lib/commonjs/webpack.config.js +1 -0
  8. package/lib/esm/getWebpackConfigForQpq.d.ts +4 -0
  9. package/lib/esm/getWebpackConfigForQpq.js +44 -0
  10. package/lib/esm/plugins/QpqPlugin.js +5 -8
  11. package/lib/esm/plugins/getQpqDyanmicLoaderSrcFromQpqConfig.d.ts +2 -0
  12. package/lib/esm/plugins/getQpqDyanmicLoaderSrcFromQpqConfig.js +42 -0
  13. package/lib/esm/webpack.config.d.ts +1 -0
  14. package/lib/esm/webpack.config.js +1 -0
  15. package/package.json +9 -8
  16. package/lib/commonjs/loaders/qpq-config-loader.d.ts +0 -2
  17. package/lib/commonjs/loaders/qpq-config-loader.js +0 -8
  18. package/lib/commonjs/loaders/qpq-custom-action-processors-loader.d.ts +0 -2
  19. package/lib/commonjs/loaders/qpq-custom-action-processors-loader.js +0 -22
  20. package/lib/commonjs/loaders/qpq-dynamic-loader-warmer.d.ts +0 -2
  21. package/lib/commonjs/loaders/qpq-dynamic-loader-warmer.js +0 -19
  22. package/lib/commonjs/loaders/qpq-dynamic-loader.d.ts +0 -2
  23. package/lib/commonjs/loaders/qpq-dynamic-loader.js +0 -22
  24. package/lib/commonjs/loaders/qpq-user-directory-email-templates.d.ts +0 -2
  25. package/lib/commonjs/loaders/qpq-user-directory-email-templates.js +0 -8
  26. package/lib/esm/loaders/qpq-config-loader.d.ts +0 -2
  27. package/lib/esm/loaders/qpq-config-loader.js +0 -8
  28. package/lib/esm/loaders/qpq-custom-action-processors-loader.d.ts +0 -2
  29. package/lib/esm/loaders/qpq-custom-action-processors-loader.js +0 -22
  30. package/lib/esm/loaders/qpq-dynamic-loader-warmer.d.ts +0 -2
  31. package/lib/esm/loaders/qpq-dynamic-loader-warmer.js +0 -19
  32. package/lib/esm/loaders/qpq-dynamic-loader.d.ts +0 -2
  33. package/lib/esm/loaders/qpq-dynamic-loader.js +0 -22
  34. package/lib/esm/loaders/qpq-user-directory-email-templates.d.ts +0 -2
  35. package/lib/esm/loaders/qpq-user-directory-email-templates.js +0 -8
@@ -0,0 +1,4 @@
1
+ import { QPQConfig } from 'quidproquo-core';
2
+ import { Configuration } from 'webpack';
3
+ export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, entries: Record<string, string>) => Configuration;
4
+ export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, entries: Record<string, string>, outputPath?: string) => Configuration;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getAllWebpackConfig = exports.getWebpackConfig = void 0;
5
+ const quidproquo_core_1 = require("quidproquo-core");
6
+ const plugins_1 = require("./plugins");
7
+ const getWebpackBuildMode = (qpqConfig) => {
8
+ const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
9
+ if (['development', 'production'].indexOf(feature) >= 0) {
10
+ return feature;
11
+ }
12
+ return 'production';
13
+ };
14
+ const getWebpackConfig = (qpqConfig, buildPath, entries) => {
15
+ return {
16
+ entry: entries,
17
+ mode: getWebpackBuildMode(qpqConfig),
18
+ // mode: 'production',
19
+ externals: [/aws-sdk/],
20
+ target: 'node',
21
+ output: {
22
+ // Output path
23
+ path: buildPath,
24
+ filename: '[name]/index.js',
25
+ // Allow compiling as a lib ~ don't tree shake my exports plz
26
+ globalObject: 'this',
27
+ libraryTarget: 'commonjs2',
28
+ },
29
+ resolve: {
30
+ extensions: ['.ts', '.tsx', '.js', '.json'],
31
+ fallback: {
32
+ crypto: false,
33
+ },
34
+ },
35
+ plugins: [new plugins_1.QpqPlugin({ qpqConfig })],
36
+ module: {
37
+ rules: [
38
+ {
39
+ test: /\.(yaml|json)$/,
40
+ type: 'asset/source',
41
+ exclude: /node_modules/,
42
+ },
43
+ ],
44
+ },
45
+ };
46
+ };
47
+ exports.getWebpackConfig = getWebpackConfig;
48
+ const getAllWebpackConfig = (qpqConfig, entries, outputPath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', entries);
49
+ exports.getAllWebpackConfig = getAllWebpackConfig;
@@ -1,19 +1,19 @@
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.QpqPlugin = void 0;
4
- const webpack_1 = require("webpack");
7
+ const webpack_virtual_modules_1 = __importDefault(require("webpack-virtual-modules"));
8
+ const getQpqDyanmicLoaderSrcFromQpqConfig_1 = require("./getQpqDyanmicLoaderSrcFromQpqConfig");
5
9
  class QpqPlugin {
6
10
  constructor(options) {
7
11
  this.options = options;
8
12
  }
9
13
  apply(compiler) {
10
- compiler.hooks.emit.tapAsync('QpqPlugin', (compilation, callback) => {
11
- // Add qpqConfig JS file to the output assets!
12
- const qpqConfigJs = `module.exports = ${JSON.stringify(this.options.qpqConfig, null, 2)};`;
13
- const outputFileName = 'qpqPlugin/config.js';
14
- compilation.emitAsset(outputFileName, new webpack_1.sources.RawSource(qpqConfigJs));
15
- callback();
16
- });
14
+ new webpack_virtual_modules_1.default({
15
+ 'node_modules/quidproquo-dynamic-loader.js': (0, getQpqDyanmicLoaderSrcFromQpqConfig_1.getQpqDyanmicLoaderSrcFromQpqConfig)(this.options.qpqConfig),
16
+ }).apply(compiler);
17
17
  }
18
18
  }
19
19
  exports.QpqPlugin = QpqPlugin;
@@ -0,0 +1,2 @@
1
+ import { QPQConfig } from 'quidproquo-core';
2
+ export declare const getQpqDyanmicLoaderSrcFromQpqConfig: (qpqConfig: QPQConfig) => string;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getQpqDyanmicLoaderSrcFromQpqConfig = void 0;
4
+ const quidproquo_core_1 = require("quidproquo-core");
5
+ const quidproquo_webserver_1 = require("quidproquo-webserver");
6
+ const getQpqDyanmicLoaderSrcFromQpqConfig = (qpqConfig) => {
7
+ const uniqueSrcFiles = [...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig), ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig)].filter((sf, index, arr) => arr.indexOf(sf) === index);
8
+ const caseStatements = [
9
+ ...uniqueSrcFiles.map((e) => {
10
+ const fullPath = quidproquo_core_1.qpqCoreUtils.getFullSrcPathFromQpqFunctionRuntime(e, qpqConfig);
11
+ const method = quidproquo_core_1.qpqCoreUtils.getStoryNameFromQpqFunctionRuntime(e);
12
+ const srcPath = fullPath.replace(/\\/g, '/');
13
+ return `case String.raw\`${e}\`: {
14
+ const module = await require('${srcPath}');
15
+ if (!module) {
16
+ throw new Error('Unable to dynamically load module');
17
+ }
18
+
19
+ const story = module['${method}'];
20
+ if (!story) {
21
+ throw new Error(\`Unable to dynamically load story: [${method}]\`);
22
+ }
23
+
24
+ return story;
25
+ }`;
26
+ }),
27
+ `default: {
28
+ console.log("Can't find module from list");
29
+
30
+ throw new Error('Unable to dynamically load module, no matching file path, path must match exactly what is in qpqConfig.');
31
+ }`,
32
+ ];
33
+ const result = `export const qpqConfig = ${JSON.stringify(qpqConfig, null, 2)};
34
+
35
+ export const qpqDynamicModuleLoader = async (moduleName) => {
36
+ switch (moduleName) {
37
+ ${caseStatements.join('\n')}
38
+ }
39
+
40
+ // This will never get hit
41
+ return null;
42
+ };`;
43
+ console.log(result);
44
+ return result;
45
+ };
46
+ exports.getQpqDyanmicLoaderSrcFromQpqConfig = getQpqDyanmicLoaderSrcFromQpqConfig;
@@ -4,3 +4,4 @@ export declare const getWebpackBuildMode: (qpqConfig: QPQConfig) => WebpackBuild
4
4
  export declare const setupWebpackQPQRuntime: (qpqConfig: QPQConfig, buildPath: string) => void;
5
5
  export declare const getResolveLoaderModules: () => string[];
6
6
  export * from './plugins';
7
+ export * from './getWebpackConfigForQpq';
@@ -47,3 +47,4 @@ exports.setupWebpackQPQRuntime = setupWebpackQPQRuntime;
47
47
  const getResolveLoaderModules = () => [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'];
48
48
  exports.getResolveLoaderModules = getResolveLoaderModules;
49
49
  __exportStar(require("./plugins"), exports);
50
+ __exportStar(require("./getWebpackConfigForQpq"), exports);
@@ -0,0 +1,4 @@
1
+ import { QPQConfig } from 'quidproquo-core';
2
+ import { Configuration } from 'webpack';
3
+ export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, entries: Record<string, string>) => Configuration;
4
+ export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, entries: Record<string, string>, outputPath?: string) => Configuration;
@@ -0,0 +1,44 @@
1
+ // import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
2
+ import { qpqCoreUtils } from 'quidproquo-core';
3
+ import { QpqPlugin } from './plugins';
4
+ const getWebpackBuildMode = (qpqConfig) => {
5
+ const feature = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
6
+ if (['development', 'production'].indexOf(feature) >= 0) {
7
+ return feature;
8
+ }
9
+ return 'production';
10
+ };
11
+ export const getWebpackConfig = (qpqConfig, buildPath, entries) => {
12
+ return {
13
+ entry: entries,
14
+ mode: getWebpackBuildMode(qpqConfig),
15
+ // mode: 'production',
16
+ externals: [/aws-sdk/],
17
+ target: 'node',
18
+ output: {
19
+ // Output path
20
+ path: buildPath,
21
+ filename: '[name]/index.js',
22
+ // Allow compiling as a lib ~ don't tree shake my exports plz
23
+ globalObject: 'this',
24
+ libraryTarget: 'commonjs2',
25
+ },
26
+ resolve: {
27
+ extensions: ['.ts', '.tsx', '.js', '.json'],
28
+ fallback: {
29
+ crypto: false,
30
+ },
31
+ },
32
+ plugins: [new QpqPlugin({ qpqConfig })],
33
+ module: {
34
+ rules: [
35
+ {
36
+ test: /\.(yaml|json)$/,
37
+ type: 'asset/source',
38
+ exclude: /node_modules/,
39
+ },
40
+ ],
41
+ },
42
+ };
43
+ };
44
+ export const getAllWebpackConfig = (qpqConfig, entries, outputPath) => getWebpackConfig(qpqConfig, outputPath || 'build', entries);
@@ -1,16 +1,13 @@
1
- import { sources } from 'webpack';
1
+ import VirtualModulesPlugin from 'webpack-virtual-modules';
2
+ import { getQpqDyanmicLoaderSrcFromQpqConfig } from './getQpqDyanmicLoaderSrcFromQpqConfig';
2
3
  export class QpqPlugin {
3
4
  options;
4
5
  constructor(options) {
5
6
  this.options = options;
6
7
  }
7
8
  apply(compiler) {
8
- compiler.hooks.emit.tapAsync('QpqPlugin', (compilation, callback) => {
9
- // Add qpqConfig JS file to the output assets!
10
- const qpqConfigJs = `module.exports = ${JSON.stringify(this.options.qpqConfig, null, 2)};`;
11
- const outputFileName = 'qpqPlugin/config.js';
12
- compilation.emitAsset(outputFileName, new sources.RawSource(qpqConfigJs));
13
- callback();
14
- });
9
+ new VirtualModulesPlugin({
10
+ 'node_modules/quidproquo-dynamic-loader.js': getQpqDyanmicLoaderSrcFromQpqConfig(this.options.qpqConfig),
11
+ }).apply(compiler);
15
12
  }
16
13
  }
@@ -0,0 +1,2 @@
1
+ import { QPQConfig } from 'quidproquo-core';
2
+ export declare const getQpqDyanmicLoaderSrcFromQpqConfig: (qpqConfig: QPQConfig) => string;
@@ -0,0 +1,42 @@
1
+ import { qpqCoreUtils } from 'quidproquo-core';
2
+ import { qpqWebServerUtils } from 'quidproquo-webserver';
3
+ export const getQpqDyanmicLoaderSrcFromQpqConfig = (qpqConfig) => {
4
+ const uniqueSrcFiles = [...qpqCoreUtils.getAllSrcEntries(qpqConfig), ...qpqWebServerUtils.getAllSrcEntries(qpqConfig)].filter((sf, index, arr) => arr.indexOf(sf) === index);
5
+ const caseStatements = [
6
+ ...uniqueSrcFiles.map((e) => {
7
+ const fullPath = qpqCoreUtils.getFullSrcPathFromQpqFunctionRuntime(e, qpqConfig);
8
+ const method = qpqCoreUtils.getStoryNameFromQpqFunctionRuntime(e);
9
+ const srcPath = fullPath.replace(/\\/g, '/');
10
+ return `case String.raw\`${e}\`: {
11
+ const module = await require('${srcPath}');
12
+ if (!module) {
13
+ throw new Error('Unable to dynamically load module');
14
+ }
15
+
16
+ const story = module['${method}'];
17
+ if (!story) {
18
+ throw new Error(\`Unable to dynamically load story: [${method}]\`);
19
+ }
20
+
21
+ return story;
22
+ }`;
23
+ }),
24
+ `default: {
25
+ console.log("Can't find module from list");
26
+
27
+ throw new Error('Unable to dynamically load module, no matching file path, path must match exactly what is in qpqConfig.');
28
+ }`,
29
+ ];
30
+ const result = `export const qpqConfig = ${JSON.stringify(qpqConfig, null, 2)};
31
+
32
+ export const qpqDynamicModuleLoader = async (moduleName) => {
33
+ switch (moduleName) {
34
+ ${caseStatements.join('\n')}
35
+ }
36
+
37
+ // This will never get hit
38
+ return null;
39
+ };`;
40
+ console.log(result);
41
+ return result;
42
+ };
@@ -4,3 +4,4 @@ export declare const getWebpackBuildMode: (qpqConfig: QPQConfig) => WebpackBuild
4
4
  export declare const setupWebpackQPQRuntime: (qpqConfig: QPQConfig, buildPath: string) => void;
5
5
  export declare const getResolveLoaderModules: () => string[];
6
6
  export * from './plugins';
7
+ export * from './getWebpackConfigForQpq';
@@ -24,3 +24,4 @@ export const setupWebpackQPQRuntime = (qpqConfig, buildPath) => {
24
24
  };
25
25
  export const getResolveLoaderModules = () => [path.resolve(__dirname, 'loaders'), 'node_modules'];
26
26
  export * from './plugins';
27
+ export * from './getWebpackConfigForQpq';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-deploy-webpack",
3
- "version": "0.0.222",
3
+ "version": "0.0.224",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/webpack.config.js",
6
6
  "module": "./lib/esm/webpack.config.js",
@@ -30,11 +30,12 @@
30
30
  "homepage": "https://github.com/joe-coady/quidproquo#readme",
31
31
  "dependencies": {
32
32
  "path-browserify": "^1.0.1",
33
- "quidproquo-actionprocessor-awslambda": "0.0.222",
34
- "quidproquo-actionprocessor-node": "0.0.222",
35
- "quidproquo-core": "0.0.222",
36
- "quidproquo-deploy-awscdk": "0.0.222",
37
- "quidproquo-webserver": "0.0.222"
33
+ "quidproquo-actionprocessor-awslambda": "0.0.224",
34
+ "quidproquo-actionprocessor-node": "0.0.224",
35
+ "quidproquo-core": "0.0.224",
36
+ "quidproquo-deploy-awscdk": "0.0.224",
37
+ "quidproquo-webserver": "0.0.224",
38
+ "webpack-virtual-modules": "^0.6.2"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@babel/core": "^7.20.12",
@@ -44,11 +45,11 @@
44
45
  "@types/node": "^20.2.1",
45
46
  "@types/prettier": "2.6.0",
46
47
  "babel-loader": "^9.1.2",
47
- "quidproquo-tsconfig": "0.0.222",
48
+ "quidproquo-tsconfig": "0.0.224",
48
49
  "ts-node": "^10.9.1",
49
50
  "typescript": "^5.0.4"
50
51
  },
51
52
  "peerDependencies": {
52
- "webpack": "^5.91.0"
53
+ "webpack": "^5.0.0"
53
54
  }
54
55
  }
@@ -1,2 +0,0 @@
1
- declare function _exports(): string;
2
- export = _exports;
@@ -1,8 +0,0 @@
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 +0,0 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
@@ -1,22 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): string;
2
- export = _exports;
@@ -1,19 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
@@ -1,22 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
@@ -1,8 +0,0 @@
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,2 +0,0 @@
1
- declare function _exports(): string;
2
- export = _exports;
@@ -1,8 +0,0 @@
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 +0,0 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
@@ -1,22 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): string;
2
- export = _exports;
@@ -1,19 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
@@ -1,22 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(source: any): string;
2
- export = _exports;
@@ -1,8 +0,0 @@
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
- };