quidproquo-deploy-webpack 0.0.253 → 0.0.255
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/getWebpackConfigForQpq.d.ts +4 -4
- package/lib/commonjs/getWebpackConfigForQpq.js +49 -49
- package/lib/commonjs/plugins/QpqPlugin.d.ts +12 -11
- package/lib/commonjs/plugins/QpqPlugin.js +20 -19
- package/lib/commonjs/plugins/QpqWebPlugin.d.ts +11 -11
- package/lib/commonjs/plugins/QpqWebPlugin.js +28 -28
- package/lib/commonjs/plugins/getModuleLoaderSrcForService.d.ts +1 -1
- package/lib/commonjs/plugins/getModuleLoaderSrcForService.js +10 -11
- package/lib/commonjs/plugins/getQpqDyanmicLoaderSrcFromQpqConfigs.d.ts +1 -1
- package/lib/commonjs/plugins/getQpqDyanmicLoaderSrcFromQpqConfigs.js +11 -11
- package/lib/commonjs/plugins/getSrcLoaderForQpqConfig.d.ts +2 -2
- package/lib/commonjs/plugins/getSrcLoaderForQpqConfig.js +31 -31
- package/lib/commonjs/plugins/index.d.ts +2 -2
- package/lib/commonjs/plugins/index.js +18 -18
- package/lib/commonjs/webpack.config.d.ts +7 -7
- package/lib/commonjs/webpack.config.js +50 -50
- package/lib/esm/getWebpackConfigForQpq.d.ts +4 -4
- package/lib/esm/getWebpackConfigForQpq.js +44 -44
- package/lib/esm/plugins/QpqPlugin.d.ts +12 -11
- package/lib/esm/plugins/QpqPlugin.js +14 -13
- package/lib/esm/plugins/QpqWebPlugin.d.ts +11 -11
- package/lib/esm/plugins/QpqWebPlugin.js +25 -25
- package/lib/esm/plugins/getModuleLoaderSrcForService.d.ts +1 -1
- package/lib/esm/plugins/getModuleLoaderSrcForService.js +7 -7
- package/lib/esm/plugins/getQpqDyanmicLoaderSrcFromQpqConfigs.d.ts +1 -1
- package/lib/esm/plugins/getQpqDyanmicLoaderSrcFromQpqConfigs.js +7 -7
- package/lib/esm/plugins/getSrcLoaderForQpqConfig.d.ts +2 -2
- package/lib/esm/plugins/getSrcLoaderForQpqConfig.js +23 -23
- package/lib/esm/plugins/index.d.ts +2 -2
- package/lib/esm/plugins/index.js +2 -2
- package/lib/esm/webpack.config.d.ts +7 -7
- package/lib/esm/webpack.config.js +27 -27
- package/package.json +9 -9
|
@@ -1,4 +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
|
|
4
|
-
export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, entries: Record<string, string>, outputPath?: string) => Configuration;
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Configuration } from 'webpack';
|
|
3
|
+
export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, entries: Record<string, string>, nodeModulePath: string) => Configuration;
|
|
4
|
+
export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, entries: Record<string, string>, outputPath?: string, nodeModulePath?: string) => Configuration;
|
|
@@ -1,49 +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({ qpqConfigs: [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
|
+
"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, nodeModulePath) => {
|
|
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({ qpqConfigs: [qpqConfig], nodeModulePath })],
|
|
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, nodeModulePath) => (0, exports.getWebpackConfig)(qpqConfig, outputPath || 'build', entries, nodeModulePath || 'node_modules');
|
|
49
|
+
exports.getAllWebpackConfig = getAllWebpackConfig;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
-
interface QpqPluginOptions {
|
|
4
|
-
qpqConfigs: QPQConfig[];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
+
interface QpqPluginOptions {
|
|
4
|
+
qpqConfigs: QPQConfig[];
|
|
5
|
+
nodeModulePath: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class QpqPlugin implements WebpackPluginInstance {
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options: QpqPluginOptions);
|
|
10
|
+
apply(compiler: Compiler): void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.QpqPlugin = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.QpqPlugin = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const webpack_virtual_modules_1 = __importDefault(require("webpack-virtual-modules"));
|
|
9
|
+
const getQpqDyanmicLoaderSrcFromQpqConfigs_1 = require("./getQpqDyanmicLoaderSrcFromQpqConfigs");
|
|
10
|
+
class QpqPlugin {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
}
|
|
14
|
+
apply(compiler) {
|
|
15
|
+
new webpack_virtual_modules_1.default({
|
|
16
|
+
[path_1.default.resolve(this.options.nodeModulePath, 'quidproquo-dynamic-loader.js')]: (0, getQpqDyanmicLoaderSrcFromQpqConfigs_1.getQpqDyanmicLoaderSrcFromQpqConfigs)(this.options.qpqConfigs),
|
|
17
|
+
}).apply(compiler);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.QpqPlugin = QpqPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
-
interface QpqWebPluginOptions {
|
|
4
|
-
qpqConfig: QPQConfig;
|
|
5
|
-
}
|
|
6
|
-
export declare class QpqWebPlugin implements WebpackPluginInstance {
|
|
7
|
-
private options;
|
|
8
|
-
constructor(options: QpqWebPluginOptions);
|
|
9
|
-
apply(compiler: Compiler): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
+
interface QpqWebPluginOptions {
|
|
4
|
+
qpqConfig: QPQConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare class QpqWebPlugin implements WebpackPluginInstance {
|
|
7
|
+
private options;
|
|
8
|
+
constructor(options: QpqWebPluginOptions);
|
|
9
|
+
apply(compiler: Compiler): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QpqWebPlugin = void 0;
|
|
4
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
-
const webpack_1 = require("webpack");
|
|
6
|
-
class QpqWebPlugin {
|
|
7
|
-
constructor(options) {
|
|
8
|
-
this.options = options;
|
|
9
|
-
}
|
|
10
|
-
apply(compiler) {
|
|
11
|
-
const applicationName = quidproquo_core_1.qpqCoreUtils.getApplicationName(this.options.qpqConfig);
|
|
12
|
-
const environment = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(this.options.qpqConfig);
|
|
13
|
-
const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleFeature(this.options.qpqConfig);
|
|
14
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(this.options.qpqConfig);
|
|
15
|
-
const applicationConfigInfo = {
|
|
16
|
-
environment: environment,
|
|
17
|
-
module: serviceName,
|
|
18
|
-
name: applicationName,
|
|
19
|
-
feature: feature,
|
|
20
|
-
};
|
|
21
|
-
console.log('Applying QpqWebPlugin with config:', applicationConfigInfo);
|
|
22
|
-
new webpack_1.DefinePlugin({
|
|
23
|
-
[`process.env.QPQ_APPLICATION_CONFIG_INFO_${serviceName.toUpperCase()}`]: JSON.stringify(applicationConfigInfo),
|
|
24
|
-
'process.env.QPQ_APPLICATION_CONFIG_INFO': JSON.stringify(applicationConfigInfo),
|
|
25
|
-
}).apply(compiler);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.QpqWebPlugin = QpqWebPlugin;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QpqWebPlugin = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
const webpack_1 = require("webpack");
|
|
6
|
+
class QpqWebPlugin {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
apply(compiler) {
|
|
11
|
+
const applicationName = quidproquo_core_1.qpqCoreUtils.getApplicationName(this.options.qpqConfig);
|
|
12
|
+
const environment = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(this.options.qpqConfig);
|
|
13
|
+
const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleFeature(this.options.qpqConfig);
|
|
14
|
+
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(this.options.qpqConfig);
|
|
15
|
+
const applicationConfigInfo = {
|
|
16
|
+
environment: environment,
|
|
17
|
+
module: serviceName,
|
|
18
|
+
name: applicationName,
|
|
19
|
+
feature: feature,
|
|
20
|
+
};
|
|
21
|
+
console.log('Applying QpqWebPlugin with config:', applicationConfigInfo);
|
|
22
|
+
new webpack_1.DefinePlugin({
|
|
23
|
+
[`process.env.QPQ_APPLICATION_CONFIG_INFO_${serviceName.toUpperCase()}`]: JSON.stringify(applicationConfigInfo),
|
|
24
|
+
'process.env.QPQ_APPLICATION_CONFIG_INFO': JSON.stringify(applicationConfigInfo),
|
|
25
|
+
}).apply(compiler);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.QpqWebPlugin = QpqWebPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function getModuleLoaderSrcForService(qpqConfig: any, serviceNameVariableName: any, moduleNameVariableName: any): string;
|
|
1
|
+
export function getModuleLoaderSrcForService(qpqConfig: any, serviceNameVariableName: any, moduleNameVariableName: any): string;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getModuleLoaderSrcForService =
|
|
4
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
-
const getSrcLoaderForQpqConfig_1 = require("./getSrcLoaderForQpqConfig");
|
|
6
|
-
function getModuleLoaderSrcForService(qpqConfig, serviceNameVariableName, moduleNameVariableName) {
|
|
7
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getModuleLoaderSrcForService = getModuleLoaderSrcForService;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
const getSrcLoaderForQpqConfig_1 = require("./getSrcLoaderForQpqConfig");
|
|
6
|
+
function getModuleLoaderSrcForService(qpqConfig, serviceNameVariableName, moduleNameVariableName) {
|
|
7
|
+
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
8
8
|
const result = `
|
|
9
9
|
if (${serviceNameVariableName} === String.raw\`${serviceName}\`) {
|
|
10
10
|
${(0, getSrcLoaderForQpqConfig_1.getSrcLoaderForQpqConfig)(qpqConfig, moduleNameVariableName)}
|
|
11
11
|
}
|
|
12
|
-
`;
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
exports.getModuleLoaderSrcForService = getModuleLoaderSrcForService;
|
|
12
|
+
`;
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function getQpqDyanmicLoaderSrcFromQpqConfigs(qpqConfigs: any): string;
|
|
1
|
+
export function getQpqDyanmicLoaderSrcFromQpqConfigs(qpqConfigs: any): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getQpqDyanmicLoaderSrcFromQpqConfigs = void 0;
|
|
4
|
-
const getModuleLoaderSrcForService_1 = require("./getModuleLoaderSrcForService");
|
|
5
|
-
const getSrcLoaderForQpqConfig_1 = require("./getSrcLoaderForQpqConfig");
|
|
6
|
-
const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getQpqDyanmicLoaderSrcFromQpqConfigs = void 0;
|
|
4
|
+
const getModuleLoaderSrcForService_1 = require("./getModuleLoaderSrcForService");
|
|
5
|
+
const getSrcLoaderForQpqConfig_1 = require("./getSrcLoaderForQpqConfig");
|
|
6
|
+
const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
7
7
|
const result = `
|
|
8
8
|
export const qpqConfig = ${JSON.stringify(qpqConfigs[0], null, 2)};
|
|
9
9
|
export const qpqConfigs = ${JSON.stringify(qpqConfigs, null, 2)};
|
|
@@ -20,8 +20,8 @@ const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
|
20
20
|
|
|
21
21
|
// This will never get hit
|
|
22
22
|
return null;
|
|
23
|
-
};`;
|
|
24
|
-
// console.log(result);
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
exports.getQpqDyanmicLoaderSrcFromQpqConfigs = getQpqDyanmicLoaderSrcFromQpqConfigs;
|
|
23
|
+
};`;
|
|
24
|
+
// console.log(result);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
exports.getQpqDyanmicLoaderSrcFromQpqConfigs = getQpqDyanmicLoaderSrcFromQpqConfigs;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function getSrcLoaderForQpqConfig(qpqConfig: any, qpqFunctionRuntimeVariableName: any): string;
|
|
2
|
-
export function getFullSrcPathFromQpqFunctionRuntime(qpqFunctionRuntime: any, qpqConfig: any): string;
|
|
1
|
+
export function getSrcLoaderForQpqConfig(qpqConfig: any, qpqFunctionRuntimeVariableName: any): string;
|
|
2
|
+
export function getFullSrcPathFromQpqFunctionRuntime(qpqFunctionRuntime: any, qpqConfig: any): string;
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getFullSrcPathFromQpqFunctionRuntime = void 0;
|
|
7
|
+
exports.getSrcLoaderForQpqConfig = getSrcLoaderForQpqConfig;
|
|
8
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
9
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const getFullSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime, qpqConfig) => {
|
|
12
|
+
if ((0, quidproquo_core_1.isQpqFunctionRuntimeAbsolutePath)(qpqFunctionRuntime)) {
|
|
13
|
+
return path_1.default.join(qpqFunctionRuntime.basePath, qpqFunctionRuntime.relativePath);
|
|
14
|
+
}
|
|
15
|
+
const [srcPath] = qpqFunctionRuntime.split('::');
|
|
16
|
+
const configRoot = quidproquo_core_1.qpqCoreUtils.getApplicationConfigRoot(qpqConfig);
|
|
17
|
+
return path_1.default.join(configRoot, srcPath);
|
|
18
|
+
};
|
|
19
|
+
exports.getFullSrcPathFromQpqFunctionRuntime = getFullSrcPathFromQpqFunctionRuntime;
|
|
20
|
+
function getSrcLoaderForQpqConfig(qpqConfig, qpqFunctionRuntimeVariableName) {
|
|
21
|
+
const allQpqFunctionRuntimes = [...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig), ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
22
|
+
const ifStatements = allQpqFunctionRuntimes.map((qpqFunctionRuntime) => {
|
|
23
|
+
const fullPath = (0, exports.getFullSrcPathFromQpqFunctionRuntime)(qpqFunctionRuntime, qpqConfig);
|
|
24
|
+
const method = quidproquo_core_1.qpqCoreUtils.getStoryNameFromQpqFunctionRuntime(qpqFunctionRuntime);
|
|
25
|
+
const srcPath = path_1.default.posix.join(fullPath.replace(/\\/g, '/')); // Ensure proper path format
|
|
25
26
|
return `
|
|
26
27
|
if (typeof ${qpqFunctionRuntimeVariableName} === '${typeof qpqFunctionRuntime}' && !!${qpqFunctionRuntimeVariableName}) {
|
|
27
28
|
if (
|
|
28
|
-
${typeof qpqFunctionRuntime === 'string'
|
|
29
|
-
? `(${qpqFunctionRuntimeVariableName} === String.raw\`${qpqFunctionRuntime}\`)`
|
|
29
|
+
${typeof qpqFunctionRuntime === 'string'
|
|
30
|
+
? `(${qpqFunctionRuntimeVariableName} === String.raw\`${qpqFunctionRuntime}\`)`
|
|
30
31
|
: `(
|
|
31
32
|
${qpqFunctionRuntimeVariableName}.basePath === String.raw\`${qpqFunctionRuntime.basePath}\` &&
|
|
32
33
|
${qpqFunctionRuntimeVariableName}.relativePath === String.raw\`${qpqFunctionRuntime.relativePath}\` &&
|
|
@@ -46,8 +47,7 @@ function getSrcLoaderForQpqConfig(qpqConfig, qpqFunctionRuntimeVariableName) {
|
|
|
46
47
|
return story;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
`;
|
|
50
|
-
});
|
|
51
|
-
return ifStatements.join('\n');
|
|
52
|
-
}
|
|
53
|
-
exports.getSrcLoaderForQpqConfig = getSrcLoaderForQpqConfig;
|
|
50
|
+
`;
|
|
51
|
+
});
|
|
52
|
+
return ifStatements.join('\n');
|
|
53
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './QpqPlugin';
|
|
2
|
-
export * from './QpqWebPlugin';
|
|
1
|
+
export * from './QpqPlugin';
|
|
2
|
+
export * from './QpqWebPlugin';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./QpqPlugin"), exports);
|
|
18
|
-
__exportStar(require("./QpqWebPlugin"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./QpqPlugin"), exports);
|
|
18
|
+
__exportStar(require("./QpqWebPlugin"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
type WebpackBuildMode = 'none' | 'development' | 'production';
|
|
3
|
-
export declare const getWebpackBuildMode: (qpqConfig: QPQConfig) => WebpackBuildMode;
|
|
4
|
-
export declare const setupWebpackQPQRuntime: (qpqConfig: QPQConfig, buildPath: string) => void;
|
|
5
|
-
export declare const getResolveLoaderModules: () => string[];
|
|
6
|
-
export * from './getWebpackConfigForQpq';
|
|
7
|
-
export * from './plugins';
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
type WebpackBuildMode = 'none' | 'development' | 'production';
|
|
3
|
+
export declare const getWebpackBuildMode: (qpqConfig: QPQConfig) => WebpackBuildMode;
|
|
4
|
+
export declare const setupWebpackQPQRuntime: (qpqConfig: QPQConfig, buildPath: string) => void;
|
|
5
|
+
export declare const getResolveLoaderModules: () => string[];
|
|
6
|
+
export * from './getWebpackConfigForQpq';
|
|
7
|
+
export * from './plugins';
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.getResolveLoaderModules = exports.setupWebpackQPQRuntime = exports.getWebpackBuildMode = void 0;
|
|
22
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
23
|
-
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
24
|
-
const path_1 = __importDefault(require("path"));
|
|
25
|
-
const getWebpackBuildMode = (qpqConfig) => {
|
|
26
|
-
const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
|
|
27
|
-
if (['development', 'production'].indexOf(feature) >= 0) {
|
|
28
|
-
return feature;
|
|
29
|
-
}
|
|
30
|
-
return 'production';
|
|
31
|
-
};
|
|
32
|
-
exports.getWebpackBuildMode = getWebpackBuildMode;
|
|
33
|
-
const setupWebpackQPQRuntime = (qpqConfig, buildPath) => {
|
|
34
|
-
const allSrcEntries = [...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig), ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
35
|
-
const customActionProcessorSources = quidproquo_core_1.qpqCoreUtils.getActionProcessorSources(qpqConfig);
|
|
36
|
-
// set the qpq config env for loaders
|
|
37
|
-
process.env.QPQLoaderConfig = JSON.stringify({
|
|
38
|
-
allSrcEntries,
|
|
39
|
-
rootDir: path_1.default.resolve(buildPath, '..'),
|
|
40
|
-
qpqConfig,
|
|
41
|
-
customActionProcessorSources,
|
|
42
|
-
projectRoot: quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig),
|
|
43
|
-
userDirectoryEmailTemplates: quidproquo_core_1.qpqCoreUtils.getUserDirectoryEmailTemplates(qpqConfig),
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
exports.setupWebpackQPQRuntime = setupWebpackQPQRuntime;
|
|
47
|
-
const getResolveLoaderModules = () => [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'];
|
|
48
|
-
exports.getResolveLoaderModules = getResolveLoaderModules;
|
|
49
|
-
__exportStar(require("./getWebpackConfigForQpq"), exports);
|
|
50
|
-
__exportStar(require("./plugins"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.getResolveLoaderModules = exports.setupWebpackQPQRuntime = exports.getWebpackBuildMode = void 0;
|
|
22
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
23
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
24
|
+
const path_1 = __importDefault(require("path"));
|
|
25
|
+
const getWebpackBuildMode = (qpqConfig) => {
|
|
26
|
+
const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
|
|
27
|
+
if (['development', 'production'].indexOf(feature) >= 0) {
|
|
28
|
+
return feature;
|
|
29
|
+
}
|
|
30
|
+
return 'production';
|
|
31
|
+
};
|
|
32
|
+
exports.getWebpackBuildMode = getWebpackBuildMode;
|
|
33
|
+
const setupWebpackQPQRuntime = (qpqConfig, buildPath) => {
|
|
34
|
+
const allSrcEntries = [...quidproquo_core_1.qpqCoreUtils.getAllSrcEntries(qpqConfig), ...quidproquo_webserver_1.qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
35
|
+
const customActionProcessorSources = quidproquo_core_1.qpqCoreUtils.getActionProcessorSources(qpqConfig);
|
|
36
|
+
// set the qpq config env for loaders
|
|
37
|
+
process.env.QPQLoaderConfig = JSON.stringify({
|
|
38
|
+
allSrcEntries,
|
|
39
|
+
rootDir: path_1.default.resolve(buildPath, '..'),
|
|
40
|
+
qpqConfig,
|
|
41
|
+
customActionProcessorSources,
|
|
42
|
+
projectRoot: quidproquo_core_1.qpqCoreUtils.getConfigRoot(qpqConfig),
|
|
43
|
+
userDirectoryEmailTemplates: quidproquo_core_1.qpqCoreUtils.getUserDirectoryEmailTemplates(qpqConfig),
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.setupWebpackQPQRuntime = setupWebpackQPQRuntime;
|
|
47
|
+
const getResolveLoaderModules = () => [path_1.default.resolve(__dirname, 'loaders'), 'node_modules'];
|
|
48
|
+
exports.getResolveLoaderModules = getResolveLoaderModules;
|
|
49
|
+
__exportStar(require("./getWebpackConfigForQpq"), exports);
|
|
50
|
+
__exportStar(require("./plugins"), exports);
|
|
@@ -1,4 +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
|
|
4
|
-
export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, entries: Record<string, string>, outputPath?: string) => Configuration;
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Configuration } from 'webpack';
|
|
3
|
+
export declare const getWebpackConfig: (qpqConfig: QPQConfig, buildPath: string, entries: Record<string, string>, nodeModulePath: string) => Configuration;
|
|
4
|
+
export declare const getAllWebpackConfig: (qpqConfig: QPQConfig, entries: Record<string, string>, outputPath?: string, nodeModulePath?: string) => Configuration;
|
|
@@ -1,44 +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({ qpqConfigs: [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
|
+
// 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, nodeModulePath) => {
|
|
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({ qpqConfigs: [qpqConfig], nodeModulePath })],
|
|
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, nodeModulePath) => getWebpackConfig(qpqConfig, outputPath || 'build', entries, nodeModulePath || 'node_modules');
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
-
interface QpqPluginOptions {
|
|
4
|
-
qpqConfigs: QPQConfig[];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
+
interface QpqPluginOptions {
|
|
4
|
+
qpqConfigs: QPQConfig[];
|
|
5
|
+
nodeModulePath: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class QpqPlugin implements WebpackPluginInstance {
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options: QpqPluginOptions);
|
|
10
|
+
apply(compiler: Compiler): void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
3
|
+
import { getQpqDyanmicLoaderSrcFromQpqConfigs } from './getQpqDyanmicLoaderSrcFromQpqConfigs';
|
|
4
|
+
export class QpqPlugin {
|
|
5
|
+
options;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.options = options;
|
|
8
|
+
}
|
|
9
|
+
apply(compiler) {
|
|
10
|
+
new VirtualModulesPlugin({
|
|
11
|
+
[path.resolve(this.options.nodeModulePath, 'quidproquo-dynamic-loader.js')]: getQpqDyanmicLoaderSrcFromQpqConfigs(this.options.qpqConfigs),
|
|
12
|
+
}).apply(compiler);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
-
interface QpqWebPluginOptions {
|
|
4
|
-
qpqConfig: QPQConfig;
|
|
5
|
-
}
|
|
6
|
-
export declare class QpqWebPlugin implements WebpackPluginInstance {
|
|
7
|
-
private options;
|
|
8
|
-
constructor(options: QpqWebPluginOptions);
|
|
9
|
-
apply(compiler: Compiler): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
3
|
+
interface QpqWebPluginOptions {
|
|
4
|
+
qpqConfig: QPQConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare class QpqWebPlugin implements WebpackPluginInstance {
|
|
7
|
+
private options;
|
|
8
|
+
constructor(options: QpqWebPluginOptions);
|
|
9
|
+
apply(compiler: Compiler): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { qpqCoreUtils } from 'quidproquo-core';
|
|
2
|
-
import { DefinePlugin } from 'webpack';
|
|
3
|
-
export class QpqWebPlugin {
|
|
4
|
-
options;
|
|
5
|
-
constructor(options) {
|
|
6
|
-
this.options = options;
|
|
7
|
-
}
|
|
8
|
-
apply(compiler) {
|
|
9
|
-
const applicationName = qpqCoreUtils.getApplicationName(this.options.qpqConfig);
|
|
10
|
-
const environment = qpqCoreUtils.getApplicationModuleEnvironment(this.options.qpqConfig);
|
|
11
|
-
const feature = qpqCoreUtils.getApplicationModuleFeature(this.options.qpqConfig);
|
|
12
|
-
const serviceName = qpqCoreUtils.getApplicationModuleName(this.options.qpqConfig);
|
|
13
|
-
const applicationConfigInfo = {
|
|
14
|
-
environment: environment,
|
|
15
|
-
module: serviceName,
|
|
16
|
-
name: applicationName,
|
|
17
|
-
feature: feature,
|
|
18
|
-
};
|
|
19
|
-
console.log('Applying QpqWebPlugin with config:', applicationConfigInfo);
|
|
20
|
-
new DefinePlugin({
|
|
21
|
-
[`process.env.QPQ_APPLICATION_CONFIG_INFO_${serviceName.toUpperCase()}`]: JSON.stringify(applicationConfigInfo),
|
|
22
|
-
'process.env.QPQ_APPLICATION_CONFIG_INFO': JSON.stringify(applicationConfigInfo),
|
|
23
|
-
}).apply(compiler);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import { qpqCoreUtils } from 'quidproquo-core';
|
|
2
|
+
import { DefinePlugin } from 'webpack';
|
|
3
|
+
export class QpqWebPlugin {
|
|
4
|
+
options;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
apply(compiler) {
|
|
9
|
+
const applicationName = qpqCoreUtils.getApplicationName(this.options.qpqConfig);
|
|
10
|
+
const environment = qpqCoreUtils.getApplicationModuleEnvironment(this.options.qpqConfig);
|
|
11
|
+
const feature = qpqCoreUtils.getApplicationModuleFeature(this.options.qpqConfig);
|
|
12
|
+
const serviceName = qpqCoreUtils.getApplicationModuleName(this.options.qpqConfig);
|
|
13
|
+
const applicationConfigInfo = {
|
|
14
|
+
environment: environment,
|
|
15
|
+
module: serviceName,
|
|
16
|
+
name: applicationName,
|
|
17
|
+
feature: feature,
|
|
18
|
+
};
|
|
19
|
+
console.log('Applying QpqWebPlugin with config:', applicationConfigInfo);
|
|
20
|
+
new DefinePlugin({
|
|
21
|
+
[`process.env.QPQ_APPLICATION_CONFIG_INFO_${serviceName.toUpperCase()}`]: JSON.stringify(applicationConfigInfo),
|
|
22
|
+
'process.env.QPQ_APPLICATION_CONFIG_INFO': JSON.stringify(applicationConfigInfo),
|
|
23
|
+
}).apply(compiler);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function getModuleLoaderSrcForService(qpqConfig: any, serviceNameVariableName: any, moduleNameVariableName: any): string;
|
|
1
|
+
export function getModuleLoaderSrcForService(qpqConfig: any, serviceNameVariableName: any, moduleNameVariableName: any): string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { qpqCoreUtils } from 'quidproquo-core';
|
|
2
|
-
import { getSrcLoaderForQpqConfig } from './getSrcLoaderForQpqConfig';
|
|
3
|
-
export function getModuleLoaderSrcForService(qpqConfig, serviceNameVariableName, moduleNameVariableName) {
|
|
4
|
-
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
1
|
+
import { qpqCoreUtils } from 'quidproquo-core';
|
|
2
|
+
import { getSrcLoaderForQpqConfig } from './getSrcLoaderForQpqConfig';
|
|
3
|
+
export function getModuleLoaderSrcForService(qpqConfig, serviceNameVariableName, moduleNameVariableName) {
|
|
4
|
+
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
5
5
|
const result = `
|
|
6
6
|
if (${serviceNameVariableName} === String.raw\`${serviceName}\`) {
|
|
7
7
|
${getSrcLoaderForQpqConfig(qpqConfig, moduleNameVariableName)}
|
|
8
8
|
}
|
|
9
|
-
`;
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
9
|
+
`;
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function getQpqDyanmicLoaderSrcFromQpqConfigs(qpqConfigs: any): string;
|
|
1
|
+
export function getQpqDyanmicLoaderSrcFromQpqConfigs(qpqConfigs: any): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getModuleLoaderSrcForService } from './getModuleLoaderSrcForService';
|
|
2
|
-
import { getSrcLoaderForQpqConfig } from './getSrcLoaderForQpqConfig';
|
|
3
|
-
export const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
1
|
+
import { getModuleLoaderSrcForService } from './getModuleLoaderSrcForService';
|
|
2
|
+
import { getSrcLoaderForQpqConfig } from './getSrcLoaderForQpqConfig';
|
|
3
|
+
export const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
4
4
|
const result = `
|
|
5
5
|
export const qpqConfig = ${JSON.stringify(qpqConfigs[0], null, 2)};
|
|
6
6
|
export const qpqConfigs = ${JSON.stringify(qpqConfigs, null, 2)};
|
|
@@ -17,7 +17,7 @@ export const getQpqDyanmicLoaderSrcFromQpqConfigs = (qpqConfigs) => {
|
|
|
17
17
|
|
|
18
18
|
// This will never get hit
|
|
19
19
|
return null;
|
|
20
|
-
};`;
|
|
21
|
-
// console.log(result);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
20
|
+
};`;
|
|
21
|
+
// console.log(result);
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function getSrcLoaderForQpqConfig(qpqConfig: any, qpqFunctionRuntimeVariableName: any): string;
|
|
2
|
-
export function getFullSrcPathFromQpqFunctionRuntime(qpqFunctionRuntime: any, qpqConfig: any): string;
|
|
1
|
+
export function getSrcLoaderForQpqConfig(qpqConfig: any, qpqFunctionRuntimeVariableName: any): string;
|
|
2
|
+
export function getFullSrcPathFromQpqFunctionRuntime(qpqFunctionRuntime: any, qpqConfig: any): string;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { isQpqFunctionRuntimeAbsolutePath, qpqCoreUtils } from 'quidproquo-core';
|
|
2
|
-
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
export const getFullSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime, qpqConfig) => {
|
|
5
|
-
if (isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime)) {
|
|
6
|
-
return path.join(qpqFunctionRuntime.basePath, qpqFunctionRuntime.relativePath);
|
|
7
|
-
}
|
|
8
|
-
const [srcPath] = qpqFunctionRuntime.split('::');
|
|
9
|
-
const configRoot = qpqCoreUtils.getApplicationConfigRoot(qpqConfig);
|
|
10
|
-
return path.join(configRoot, srcPath);
|
|
11
|
-
};
|
|
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
|
|
1
|
+
import { isQpqFunctionRuntimeAbsolutePath, qpqCoreUtils } from 'quidproquo-core';
|
|
2
|
+
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
export const getFullSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime, qpqConfig) => {
|
|
5
|
+
if (isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime)) {
|
|
6
|
+
return path.join(qpqFunctionRuntime.basePath, qpqFunctionRuntime.relativePath);
|
|
7
|
+
}
|
|
8
|
+
const [srcPath] = qpqFunctionRuntime.split('::');
|
|
9
|
+
const configRoot = qpqCoreUtils.getApplicationConfigRoot(qpqConfig);
|
|
10
|
+
return path.join(configRoot, srcPath);
|
|
11
|
+
};
|
|
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
18
|
return `
|
|
19
19
|
if (typeof ${qpqFunctionRuntimeVariableName} === '${typeof qpqFunctionRuntime}' && !!${qpqFunctionRuntimeVariableName}) {
|
|
20
20
|
if (
|
|
21
|
-
${typeof qpqFunctionRuntime === 'string'
|
|
22
|
-
? `(${qpqFunctionRuntimeVariableName} === String.raw\`${qpqFunctionRuntime}\`)`
|
|
21
|
+
${typeof qpqFunctionRuntime === 'string'
|
|
22
|
+
? `(${qpqFunctionRuntimeVariableName} === String.raw\`${qpqFunctionRuntime}\`)`
|
|
23
23
|
: `(
|
|
24
24
|
${qpqFunctionRuntimeVariableName}.basePath === String.raw\`${qpqFunctionRuntime.basePath}\` &&
|
|
25
25
|
${qpqFunctionRuntimeVariableName}.relativePath === String.raw\`${qpqFunctionRuntime.relativePath}\` &&
|
|
@@ -39,7 +39,7 @@ export function getSrcLoaderForQpqConfig(qpqConfig, qpqFunctionRuntimeVariableNa
|
|
|
39
39
|
return story;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
`;
|
|
43
|
-
});
|
|
44
|
-
return ifStatements.join('\n');
|
|
45
|
-
}
|
|
42
|
+
`;
|
|
43
|
+
});
|
|
44
|
+
return ifStatements.join('\n');
|
|
45
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './QpqPlugin';
|
|
2
|
-
export * from './QpqWebPlugin';
|
|
1
|
+
export * from './QpqPlugin';
|
|
2
|
+
export * from './QpqWebPlugin';
|
package/lib/esm/plugins/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './QpqPlugin';
|
|
2
|
-
export * from './QpqWebPlugin';
|
|
1
|
+
export * from './QpqPlugin';
|
|
2
|
+
export * from './QpqWebPlugin';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
type WebpackBuildMode = 'none' | 'development' | 'production';
|
|
3
|
-
export declare const getWebpackBuildMode: (qpqConfig: QPQConfig) => WebpackBuildMode;
|
|
4
|
-
export declare const setupWebpackQPQRuntime: (qpqConfig: QPQConfig, buildPath: string) => void;
|
|
5
|
-
export declare const getResolveLoaderModules: () => string[];
|
|
6
|
-
export * from './getWebpackConfigForQpq';
|
|
7
|
-
export * from './plugins';
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
type WebpackBuildMode = 'none' | 'development' | 'production';
|
|
3
|
+
export declare const getWebpackBuildMode: (qpqConfig: QPQConfig) => WebpackBuildMode;
|
|
4
|
+
export declare const setupWebpackQPQRuntime: (qpqConfig: QPQConfig, buildPath: string) => void;
|
|
5
|
+
export declare const getResolveLoaderModules: () => string[];
|
|
6
|
+
export * from './getWebpackConfigForQpq';
|
|
7
|
+
export * from './plugins';
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
2
|
-
import { qpqCoreUtils } from 'quidproquo-core';
|
|
3
|
-
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
export const getWebpackBuildMode = (qpqConfig) => {
|
|
6
|
-
const feature = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
|
|
7
|
-
if (['development', 'production'].indexOf(feature) >= 0) {
|
|
8
|
-
return feature;
|
|
9
|
-
}
|
|
10
|
-
return 'production';
|
|
11
|
-
};
|
|
12
|
-
export const setupWebpackQPQRuntime = (qpqConfig, buildPath) => {
|
|
13
|
-
const allSrcEntries = [...qpqCoreUtils.getAllSrcEntries(qpqConfig), ...qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
14
|
-
const customActionProcessorSources = qpqCoreUtils.getActionProcessorSources(qpqConfig);
|
|
15
|
-
// set the qpq config env for loaders
|
|
16
|
-
process.env.QPQLoaderConfig = JSON.stringify({
|
|
17
|
-
allSrcEntries,
|
|
18
|
-
rootDir: path.resolve(buildPath, '..'),
|
|
19
|
-
qpqConfig,
|
|
20
|
-
customActionProcessorSources,
|
|
21
|
-
projectRoot: qpqCoreUtils.getConfigRoot(qpqConfig),
|
|
22
|
-
userDirectoryEmailTemplates: qpqCoreUtils.getUserDirectoryEmailTemplates(qpqConfig),
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
export const getResolveLoaderModules = () => [path.resolve(__dirname, 'loaders'), 'node_modules'];
|
|
26
|
-
export * from './getWebpackConfigForQpq';
|
|
27
|
-
export * from './plugins';
|
|
1
|
+
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
2
|
+
import { qpqCoreUtils } from 'quidproquo-core';
|
|
3
|
+
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
export const getWebpackBuildMode = (qpqConfig) => {
|
|
6
|
+
const feature = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
|
|
7
|
+
if (['development', 'production'].indexOf(feature) >= 0) {
|
|
8
|
+
return feature;
|
|
9
|
+
}
|
|
10
|
+
return 'production';
|
|
11
|
+
};
|
|
12
|
+
export const setupWebpackQPQRuntime = (qpqConfig, buildPath) => {
|
|
13
|
+
const allSrcEntries = [...qpqCoreUtils.getAllSrcEntries(qpqConfig), ...qpqWebServerUtils.getAllSrcEntries(qpqConfig)];
|
|
14
|
+
const customActionProcessorSources = qpqCoreUtils.getActionProcessorSources(qpqConfig);
|
|
15
|
+
// set the qpq config env for loaders
|
|
16
|
+
process.env.QPQLoaderConfig = JSON.stringify({
|
|
17
|
+
allSrcEntries,
|
|
18
|
+
rootDir: path.resolve(buildPath, '..'),
|
|
19
|
+
qpqConfig,
|
|
20
|
+
customActionProcessorSources,
|
|
21
|
+
projectRoot: qpqCoreUtils.getConfigRoot(qpqConfig),
|
|
22
|
+
userDirectoryEmailTemplates: qpqCoreUtils.getUserDirectoryEmailTemplates(qpqConfig),
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const getResolveLoaderModules = () => [path.resolve(__dirname, 'loaders'), 'node_modules'];
|
|
26
|
+
export * from './getWebpackConfigForQpq';
|
|
27
|
+
export * from './plugins';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-deploy-webpack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.255",
|
|
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.255",
|
|
37
|
+
"quidproquo-actionprocessor-node": "0.0.255",
|
|
38
|
+
"quidproquo-core": "0.0.255",
|
|
39
|
+
"quidproquo-deploy-awscdk": "0.0.255",
|
|
40
|
+
"quidproquo-webserver": "0.0.255",
|
|
41
41
|
"webpack-virtual-modules": "^0.6.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@babel/preset-env": "^7.20.2",
|
|
46
46
|
"@babel/preset-typescript": "^7.18.6",
|
|
47
47
|
"@types/babel__traverse": "7.18.2",
|
|
48
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^22.13.13",
|
|
49
49
|
"@types/prettier": "2.6.0",
|
|
50
50
|
"babel-loader": "^9.1.2",
|
|
51
|
-
"quidproquo-tsconfig": "0.0.
|
|
51
|
+
"quidproquo-tsconfig": "0.0.255",
|
|
52
52
|
"ts-node": "^10.9.1",
|
|
53
|
-
"typescript": "^5.
|
|
53
|
+
"typescript": "^5.8.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"webpack": "^5.0.0"
|