quidproquo-deploy-webpack 0.0.246 → 0.0.247
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/commonjs/plugins/getModuleLoaderSrcForService.js +3 -3
- package/lib/commonjs/plugins/getQpqDyanmicLoaderSrcFromQpqConfigs.js +5 -5
- package/lib/commonjs/plugins/getSrcLoaderForQpqConfig.d.ts +1 -1
- package/lib/commonjs/plugins/getSrcLoaderForQpqConfig.js +30 -30
- package/lib/esm/plugins/getModuleLoaderSrcForService.js +3 -3
- package/lib/esm/plugins/getQpqDyanmicLoaderSrcFromQpqConfigs.js +5 -5
- package/lib/esm/plugins/getSrcLoaderForQpqConfig.d.ts +1 -1
- package/lib/esm/plugins/getSrcLoaderForQpqConfig.js +30 -30
- package/package.json +7 -7
|
@@ -6,9 +6,9 @@ const getSrcLoaderForQpqConfig_1 = require("./getSrcLoaderForQpqConfig");
|
|
|
6
6
|
function getModuleLoaderSrcForService(qpqConfig, serviceNameVariableName, moduleNameVariableName) {
|
|
7
7
|
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
8
8
|
const result = `
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if (${serviceNameVariableName} === String.raw\`${serviceName}\`) {
|
|
10
|
+
${(0, getSrcLoaderForQpqConfig_1.getSrcLoaderForQpqConfig)(qpqConfig, moduleNameVariableName)}
|
|
11
|
+
}
|
|
12
12
|
`;
|
|
13
13
|
return result;
|
|
14
14
|
}
|
|
@@ -6,17 +6,17 @@ const getSrcLoaderForQpqConfig_1 = require("./getSrcLoaderForQpqConfig");
|
|
|
6
6
|
const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
7
7
|
const result = `
|
|
8
8
|
export const qpqConfig = ${JSON.stringify(qpqConfigs[0], null, 2)};
|
|
9
|
-
export const qpqConfigs = ${JSON.stringify(qpqConfigs, null, 2)};
|
|
9
|
+
export const qpqConfigs = ${JSON.stringify(qpqConfigs, null, 2)};
|
|
10
10
|
|
|
11
|
-
export const qpqDynamicModuleLoader = async (
|
|
12
|
-
${(0, getSrcLoaderForQpqConfig_1.getSrcLoaderForQpqConfig)(qpqConfigs[0], '
|
|
11
|
+
export const qpqDynamicModuleLoader = async (qpqFunctionRuntime) => {
|
|
12
|
+
${(0, getSrcLoaderForQpqConfig_1.getSrcLoaderForQpqConfig)(qpqConfigs[0], 'qpqFunctionRuntime')}
|
|
13
13
|
|
|
14
14
|
// This will never get hit
|
|
15
15
|
return null;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const qpqDynamicModuleLoaderForService = async (serviceName,
|
|
19
|
-
${qpqConfigs.map((qpqConfig) => (0, getModuleLoaderSrcForService_1.getModuleLoaderSrcForService)(qpqConfig, 'serviceName', '
|
|
18
|
+
export const qpqDynamicModuleLoaderForService = async (serviceName, qpqFunctionRuntime) => {
|
|
19
|
+
${qpqConfigs.map((qpqConfig) => (0, getModuleLoaderSrcForService_1.getModuleLoaderSrcForService)(qpqConfig, 'serviceName', 'qpqFunctionRuntime')).join('')}
|
|
20
20
|
|
|
21
21
|
// This will never get hit
|
|
22
22
|
return null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function getSrcLoaderForQpqConfig(qpqConfig: any,
|
|
1
|
+
export function getSrcLoaderForQpqConfig(qpqConfig: any, qpqFunctionRuntimeVariableName: any): string;
|
|
2
2
|
export function getFullSrcPathFromQpqFunctionRuntime(qpqFunctionRuntime: any, qpqConfig: any): string;
|
|
@@ -16,38 +16,38 @@ const getFullSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime, qpqConfig) =>
|
|
|
16
16
|
return path_1.default.join(configRoot, srcPath);
|
|
17
17
|
};
|
|
18
18
|
exports.getFullSrcPathFromQpqFunctionRuntime = getFullSrcPathFromQpqFunctionRuntime;
|
|
19
|
-
function getSrcLoaderForQpqConfig(qpqConfig,
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
function getSrcLoaderForQpqConfig(qpqConfig, qpqFunctionRuntimeVariableName) {
|
|
20
|
+
const allQpqFunctionRuntimes = [...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig), ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
21
|
+
const ifStatements = allQpqFunctionRuntimes.map((qpqFunctionRuntime) => {
|
|
22
|
+
const fullPath = (0, exports.getFullSrcPathFromQpqFunctionRuntime)(qpqFunctionRuntime, qpqConfig);
|
|
23
|
+
const method = quidproquo_core_1.qpqCoreUtils.getStoryNameFromQpqFunctionRuntime(qpqFunctionRuntime);
|
|
24
|
+
const srcPath = path_1.default.posix.join(fullPath.replace(/\\/g, '/')); // Ensure proper path format
|
|
25
|
+
return `
|
|
26
|
+
if (typeof ${qpqFunctionRuntimeVariableName} === '${typeof qpqFunctionRuntime}' && !!${qpqFunctionRuntimeVariableName}) {
|
|
27
|
+
if (
|
|
28
|
+
${typeof qpqFunctionRuntime === 'string'
|
|
29
|
+
? `(${qpqFunctionRuntimeVariableName} === String.raw\`${qpqFunctionRuntime}\`)`
|
|
30
|
+
: `(
|
|
31
|
+
${qpqFunctionRuntimeVariableName}.basePath === String.raw\`${qpqFunctionRuntime.basePath}\` &&
|
|
32
|
+
${qpqFunctionRuntimeVariableName}.relativePath === String.raw\`${qpqFunctionRuntime.relativePath}\` &&
|
|
33
|
+
${qpqFunctionRuntimeVariableName}.functionName === String.raw\`${qpqFunctionRuntime.functionName}\`
|
|
34
|
+
)`}
|
|
35
|
+
) {
|
|
36
|
+
const module = await require('${srcPath}');
|
|
37
|
+
if (!module) {
|
|
38
|
+
throw new Error('Unable to dynamically load module');
|
|
39
|
+
}
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
console.log("Can't find module from list");
|
|
41
|
+
const story = module['${method}'];
|
|
42
|
+
if (!story) {
|
|
43
|
+
throw new Error(\`Unable to dynamically load story: [${method}]\`);
|
|
44
|
+
}
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const result = `
|
|
47
|
-
switch (${moduleNameVariableName}) {
|
|
48
|
-
${caseStatements.join('\n')}
|
|
49
|
-
}
|
|
46
|
+
return story;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
50
49
|
`;
|
|
51
|
-
|
|
50
|
+
});
|
|
51
|
+
return ifStatements.join('\n');
|
|
52
52
|
}
|
|
53
53
|
exports.getSrcLoaderForQpqConfig = getSrcLoaderForQpqConfig;
|
|
@@ -3,9 +3,9 @@ import { getSrcLoaderForQpqConfig } from './getSrcLoaderForQpqConfig';
|
|
|
3
3
|
export function getModuleLoaderSrcForService(qpqConfig, serviceNameVariableName, moduleNameVariableName) {
|
|
4
4
|
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
5
5
|
const result = `
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
if (${serviceNameVariableName} === String.raw\`${serviceName}\`) {
|
|
7
|
+
${getSrcLoaderForQpqConfig(qpqConfig, moduleNameVariableName)}
|
|
8
|
+
}
|
|
9
9
|
`;
|
|
10
10
|
return result;
|
|
11
11
|
}
|
|
@@ -3,17 +3,17 @@ import { getSrcLoaderForQpqConfig } from './getSrcLoaderForQpqConfig';
|
|
|
3
3
|
export const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
4
4
|
const result = `
|
|
5
5
|
export const qpqConfig = ${JSON.stringify(qpqConfigs[0], null, 2)};
|
|
6
|
-
export const qpqConfigs = ${JSON.stringify(qpqConfigs, null, 2)};
|
|
6
|
+
export const qpqConfigs = ${JSON.stringify(qpqConfigs, null, 2)};
|
|
7
7
|
|
|
8
|
-
export const qpqDynamicModuleLoader = async (
|
|
9
|
-
${getSrcLoaderForQpqConfig(qpqConfigs[0], '
|
|
8
|
+
export const qpqDynamicModuleLoader = async (qpqFunctionRuntime) => {
|
|
9
|
+
${getSrcLoaderForQpqConfig(qpqConfigs[0], 'qpqFunctionRuntime')}
|
|
10
10
|
|
|
11
11
|
// This will never get hit
|
|
12
12
|
return null;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export const qpqDynamicModuleLoaderForService = async (serviceName,
|
|
16
|
-
${qpqConfigs.map((qpqConfig) => getModuleLoaderSrcForService(qpqConfig, 'serviceName', '
|
|
15
|
+
export const qpqDynamicModuleLoaderForService = async (serviceName, qpqFunctionRuntime) => {
|
|
16
|
+
${qpqConfigs.map((qpqConfig) => getModuleLoaderSrcForService(qpqConfig, 'serviceName', 'qpqFunctionRuntime')).join('')}
|
|
17
17
|
|
|
18
18
|
// This will never get hit
|
|
19
19
|
return null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function getSrcLoaderForQpqConfig(qpqConfig: any,
|
|
1
|
+
export function getSrcLoaderForQpqConfig(qpqConfig: any, qpqFunctionRuntimeVariableName: any): string;
|
|
2
2
|
export function getFullSrcPathFromQpqFunctionRuntime(qpqFunctionRuntime: any, qpqConfig: any): string;
|
|
@@ -9,37 +9,37 @@ export const getFullSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime, qpqConf
|
|
|
9
9
|
const configRoot = qpqCoreUtils.getApplicationConfigRoot(qpqConfig);
|
|
10
10
|
return path.join(configRoot, srcPath);
|
|
11
11
|
};
|
|
12
|
-
export function getSrcLoaderForQpqConfig(qpqConfig,
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
export function getSrcLoaderForQpqConfig(qpqConfig, qpqFunctionRuntimeVariableName) {
|
|
13
|
+
const allQpqFunctionRuntimes = [...qpqCoreUtils.getAllSrcEntries(qpqConfig), ...qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
14
|
+
const ifStatements = allQpqFunctionRuntimes.map((qpqFunctionRuntime) => {
|
|
15
|
+
const fullPath = getFullSrcPathFromQpqFunctionRuntime(qpqFunctionRuntime, qpqConfig);
|
|
16
|
+
const method = qpqCoreUtils.getStoryNameFromQpqFunctionRuntime(qpqFunctionRuntime);
|
|
17
|
+
const srcPath = path.posix.join(fullPath.replace(/\\/g, '/')); // Ensure proper path format
|
|
18
|
+
return `
|
|
19
|
+
if (typeof ${qpqFunctionRuntimeVariableName} === '${typeof qpqFunctionRuntime}' && !!${qpqFunctionRuntimeVariableName}) {
|
|
20
|
+
if (
|
|
21
|
+
${typeof qpqFunctionRuntime === 'string'
|
|
22
|
+
? `(${qpqFunctionRuntimeVariableName} === String.raw\`${qpqFunctionRuntime}\`)`
|
|
23
|
+
: `(
|
|
24
|
+
${qpqFunctionRuntimeVariableName}.basePath === String.raw\`${qpqFunctionRuntime.basePath}\` &&
|
|
25
|
+
${qpqFunctionRuntimeVariableName}.relativePath === String.raw\`${qpqFunctionRuntime.relativePath}\` &&
|
|
26
|
+
${qpqFunctionRuntimeVariableName}.functionName === String.raw\`${qpqFunctionRuntime.functionName}\`
|
|
27
|
+
)`}
|
|
28
|
+
) {
|
|
29
|
+
const module = await require('${srcPath}');
|
|
30
|
+
if (!module) {
|
|
31
|
+
throw new Error('Unable to dynamically load module');
|
|
32
|
+
}
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
console.log("Can't find module from list");
|
|
34
|
+
const story = module['${method}'];
|
|
35
|
+
if (!story) {
|
|
36
|
+
throw new Error(\`Unable to dynamically load story: [${method}]\`);
|
|
37
|
+
}
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const result = `
|
|
40
|
-
switch (${moduleNameVariableName}) {
|
|
41
|
-
${caseStatements.join('\n')}
|
|
42
|
-
}
|
|
39
|
+
return story;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
43
42
|
`;
|
|
44
|
-
|
|
43
|
+
});
|
|
44
|
+
return ifStatements.join('\n');
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-deploy-webpack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.247",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/webpack.config.js",
|
|
6
6
|
"module": "./lib/esm/webpack.config.js",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"path-browserify": "^1.0.1",
|
|
36
|
-
"quidproquo-actionprocessor-awslambda": "0.0.
|
|
37
|
-
"quidproquo-actionprocessor-node": "0.0.
|
|
38
|
-
"quidproquo-core": "0.0.
|
|
39
|
-
"quidproquo-deploy-awscdk": "0.0.
|
|
40
|
-
"quidproquo-webserver": "0.0.
|
|
36
|
+
"quidproquo-actionprocessor-awslambda": "0.0.247",
|
|
37
|
+
"quidproquo-actionprocessor-node": "0.0.247",
|
|
38
|
+
"quidproquo-core": "0.0.247",
|
|
39
|
+
"quidproquo-deploy-awscdk": "0.0.247",
|
|
40
|
+
"quidproquo-webserver": "0.0.247",
|
|
41
41
|
"webpack-virtual-modules": "^0.6.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/node": "^20.2.1",
|
|
49
49
|
"@types/prettier": "2.6.0",
|
|
50
50
|
"babel-loader": "^9.1.2",
|
|
51
|
-
"quidproquo-tsconfig": "0.0.
|
|
51
|
+
"quidproquo-tsconfig": "0.0.247",
|
|
52
52
|
"ts-node": "^10.9.1",
|
|
53
53
|
"typescript": "^5.0.4"
|
|
54
54
|
},
|