@twilio/flex-plugin-webpack 5.0.1-beta.0
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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/compiler.d.ts +34 -0
- package/dist/compiler.js +223 -0
- package/dist/compiler.js.map +1 -0
- package/dist/devServer/ipcServer.d.ts +83 -0
- package/dist/devServer/ipcServer.js +227 -0
- package/dist/devServer/ipcServer.js.map +1 -0
- package/dist/devServer/pluginServer.d.ts +78 -0
- package/dist/devServer/pluginServer.js +273 -0
- package/dist/devServer/pluginServer.js.map +1 -0
- package/dist/devServer/webpackDevServer.d.ts +11 -0
- package/dist/devServer/webpackDevServer.js +108 -0
- package/dist/devServer/webpackDevServer.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/DelayRenderStaticPlugin.d.ts +4 -0
- package/dist/plugins/DelayRenderStaticPlugin.js +63 -0
- package/dist/plugins/DelayRenderStaticPlugin.js.map +1 -0
- package/dist/prints/devServerSuccessful.d.ts +12 -0
- package/dist/prints/devServerSuccessful.js +48 -0
- package/dist/prints/devServerSuccessful.js.map +1 -0
- package/dist/prints/dotEnvIncorrectVariable.d.ts +2 -0
- package/dist/prints/dotEnvIncorrectVariable.js +11 -0
- package/dist/prints/dotEnvIncorrectVariable.js.map +1 -0
- package/dist/prints/index.d.ts +3 -0
- package/dist/prints/index.js +13 -0
- package/dist/prints/index.js.map +1 -0
- package/dist/prints/remotePluginNotFound.d.ts +9 -0
- package/dist/prints/remotePluginNotFound.js +57 -0
- package/dist/prints/remotePluginNotFound.js.map +1 -0
- package/dist/webpack/clientVariables.d.ts +26 -0
- package/dist/webpack/clientVariables.js +78 -0
- package/dist/webpack/clientVariables.js.map +1 -0
- package/dist/webpack/pnpTs.d.ts +10 -0
- package/dist/webpack/pnpTs.js +13 -0
- package/dist/webpack/pnpTs.js.map +1 -0
- package/dist/webpack/webpack.config.d.ts +78 -0
- package/dist/webpack/webpack.config.js +506 -0
- package/dist/webpack/webpack.config.js.map +1 -0
- package/dist/webpack/webpack.dev.d.ts +22 -0
- package/dist/webpack/webpack.dev.js +75 -0
- package/dist/webpack/webpack.dev.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
4
|
+
var fs_1 = require("@twilio/flex-dev-utils/dist/fs");
|
|
5
|
+
/**
|
|
6
|
+
* Prints the success message when dev-server compiles
|
|
7
|
+
* @param local the local port
|
|
8
|
+
* @param network the local network
|
|
9
|
+
* @param localPlugins the list of local plugins
|
|
10
|
+
* @param remotePlugins the list of remote plugins
|
|
11
|
+
* @param hasRemote whether remote plugins are running
|
|
12
|
+
*/
|
|
13
|
+
exports.default = (function (local, network, localPlugins, remotePlugins, hasRemote) {
|
|
14
|
+
flex_dev_utils_1.logger.success('Compiled successfully!');
|
|
15
|
+
flex_dev_utils_1.logger.newline();
|
|
16
|
+
flex_dev_utils_1.logger.info("Your plugin app is running in the browser on:");
|
|
17
|
+
flex_dev_utils_1.logger.newline();
|
|
18
|
+
var srcs = [
|
|
19
|
+
['Local', "!!" + local.url + "!!"],
|
|
20
|
+
['Network', "!!" + network.url + "!!"],
|
|
21
|
+
];
|
|
22
|
+
flex_dev_utils_1.logger.columns(srcs, { indent: true });
|
|
23
|
+
if (localPlugins.length) {
|
|
24
|
+
flex_dev_utils_1.logger.newline();
|
|
25
|
+
flex_dev_utils_1.logger.info('**Local Plugins:**');
|
|
26
|
+
flex_dev_utils_1.logger.newline();
|
|
27
|
+
var rows = localPlugins.map(function (name) {
|
|
28
|
+
var plugin = fs_1.readPluginsJson().plugins.find(function (p) { return p.name === name; });
|
|
29
|
+
return ["" + plugin.name, "!!" + plugin.dir + "!!"];
|
|
30
|
+
});
|
|
31
|
+
flex_dev_utils_1.logger.columns(rows, { indent: true });
|
|
32
|
+
}
|
|
33
|
+
if (hasRemote) {
|
|
34
|
+
flex_dev_utils_1.logger.newline();
|
|
35
|
+
flex_dev_utils_1.logger.info('**Remote Plugins:**');
|
|
36
|
+
flex_dev_utils_1.logger.newline();
|
|
37
|
+
var rows = remotePlugins.length
|
|
38
|
+
? remotePlugins.map(function (p) { return [p.name + "..@.." + p.version, "!!" + p.src + "!!"]; })
|
|
39
|
+
: [['Will be displayed when you log into your Flex application']];
|
|
40
|
+
flex_dev_utils_1.logger.columns(rows, { indent: true });
|
|
41
|
+
}
|
|
42
|
+
flex_dev_utils_1.logger.newline();
|
|
43
|
+
flex_dev_utils_1.logger.info('This is a development build and is not intended to be used for production.');
|
|
44
|
+
flex_dev_utils_1.logger.info('To create a production build, use:');
|
|
45
|
+
flex_dev_utils_1.logger.newline();
|
|
46
|
+
flex_dev_utils_1.logger.installInfo('twilio', 'flex:plugins:build');
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=devServerSuccessful.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devServerSuccessful.js","sourceRoot":"","sources":["../../src/prints/devServerSuccessful.ts"],"names":[],"mappings":";;AAAA,yDAAgD;AAEhD,qDAA0F;AAI1F;;;;;;;GAOG;AACH,mBAAe,UACb,KAAiB,EACjB,OAAmB,EACnB,YAAsB,EACtB,aAAuB,EACvB,SAAkB;IAElB,uBAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAEzC,uBAAM,CAAC,OAAO,EAAE,CAAC;IACjB,uBAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IAC7D,uBAAM,CAAC,OAAO,EAAE,CAAC;IACjB,IAAM,IAAI,GAAG;QACX,CAAC,OAAO,EAAE,OAAK,KAAK,CAAC,GAAG,OAAI,CAAC;QAC7B,CAAC,SAAS,EAAE,OAAK,OAAO,CAAC,GAAG,OAAI,CAAC;KACl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,uBAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;IAC1F,uBAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IAClD,uBAAM,CAAC,OAAO,EAAE,CAAC;IACjB,uBAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AACrD,CAAC,EAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
4
|
+
exports.default = (function (filename, key) {
|
|
5
|
+
flex_dev_utils_1.env.persistTerminal();
|
|
6
|
+
var isQuiet = flex_dev_utils_1.env.isQuiet();
|
|
7
|
+
flex_dev_utils_1.env.setQuiet(false);
|
|
8
|
+
flex_dev_utils_1.logger.warning("Unsupported variable **" + key + "** provided in **" + filename + "** file. Variables must start with either FLEX_APP_ or REACT_APP_.");
|
|
9
|
+
flex_dev_utils_1.env.setQuiet(isQuiet);
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=dotEnvIncorrectVariable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotEnvIncorrectVariable.js","sourceRoot":"","sources":["../../src/prints/dotEnvIncorrectVariable.ts"],"names":[],"mappings":";;AAAA,yDAAqD;AAErD,mBAAe,UAAC,QAAgB,EAAE,GAAW;IAC3C,oBAAG,CAAC,eAAe,EAAE,CAAC;IAEtB,IAAM,OAAO,GAAG,oBAAG,CAAC,OAAO,EAAE,CAAC;IAC9B,oBAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpB,uBAAM,CAAC,OAAO,CACZ,4BAA0B,GAAG,yBAAoB,QAAQ,uEAAoE,CAC9H,CAAC;IACF,oBAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC,EAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.dotEnvIncorrectVariable = exports.remotePluginNotFound = exports.devServerSuccessful = void 0;
|
|
7
|
+
var devServerSuccessful_1 = require("./devServerSuccessful");
|
|
8
|
+
Object.defineProperty(exports, "devServerSuccessful", { enumerable: true, get: function () { return __importDefault(devServerSuccessful_1).default; } });
|
|
9
|
+
var remotePluginNotFound_1 = require("./remotePluginNotFound");
|
|
10
|
+
Object.defineProperty(exports, "remotePluginNotFound", { enumerable: true, get: function () { return __importDefault(remotePluginNotFound_1).default; } });
|
|
11
|
+
var dotEnvIncorrectVariable_1 = require("./dotEnvIncorrectVariable");
|
|
12
|
+
Object.defineProperty(exports, "dotEnvIncorrectVariable", { enumerable: true, get: function () { return __importDefault(dotEnvIncorrectVariable_1).default; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prints/index.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAuE;AAA9D,2IAAA,OAAO,OAAuB;AACvC,+DAAyE;AAAhE,6IAAA,OAAO,OAAwB;AACxC,qEAA+E;AAAtE,mJAAA,OAAO,OAA2B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from '..';
|
|
2
|
+
declare const _default: (notFoundPlugins: string[], remotePlugins: Plugin[]) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Error message for when a remote plugin is not found
|
|
5
|
+
*
|
|
6
|
+
* @param notFoundPlugins name of the plugin
|
|
7
|
+
* @param remotePlugins array of remote plugins
|
|
8
|
+
*/
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
15
|
+
/**
|
|
16
|
+
* Error message for when a remote plugin is not found
|
|
17
|
+
*
|
|
18
|
+
* @param notFoundPlugins name of the plugin
|
|
19
|
+
* @param remotePlugins array of remote plugins
|
|
20
|
+
*/
|
|
21
|
+
exports.default = (function (notFoundPlugins, remotePlugins) {
|
|
22
|
+
var e_1, _a, e_2, _b;
|
|
23
|
+
flex_dev_utils_1.logger.clearTerminal();
|
|
24
|
+
flex_dev_utils_1.logger.error('Server not loading because these plugins were not found remotely:');
|
|
25
|
+
flex_dev_utils_1.logger.newline();
|
|
26
|
+
try {
|
|
27
|
+
for (var notFoundPlugins_1 = __values(notFoundPlugins), notFoundPlugins_1_1 = notFoundPlugins_1.next(); !notFoundPlugins_1_1.done; notFoundPlugins_1_1 = notFoundPlugins_1.next()) {
|
|
28
|
+
var plugin = notFoundPlugins_1_1.value;
|
|
29
|
+
flex_dev_utils_1.logger.error('\t', flex_dev_utils_1.logger.colors.bold(plugin));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
33
|
+
finally {
|
|
34
|
+
try {
|
|
35
|
+
if (notFoundPlugins_1_1 && !notFoundPlugins_1_1.done && (_a = notFoundPlugins_1.return)) _a.call(notFoundPlugins_1);
|
|
36
|
+
}
|
|
37
|
+
finally { if (e_1) throw e_1.error; }
|
|
38
|
+
}
|
|
39
|
+
flex_dev_utils_1.logger.newline();
|
|
40
|
+
flex_dev_utils_1.logger.error('Your remote plugins are:');
|
|
41
|
+
flex_dev_utils_1.logger.newline();
|
|
42
|
+
try {
|
|
43
|
+
for (var remotePlugins_1 = __values(remotePlugins), remotePlugins_1_1 = remotePlugins_1.next(); !remotePlugins_1_1.done; remotePlugins_1_1 = remotePlugins_1.next()) {
|
|
44
|
+
var plugin = remotePlugins_1_1.value;
|
|
45
|
+
flex_dev_utils_1.logger.info("\t--**" + plugin.name + "**..@..**" + plugin.version + "**--");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
49
|
+
finally {
|
|
50
|
+
try {
|
|
51
|
+
if (remotePlugins_1_1 && !remotePlugins_1_1.done && (_b = remotePlugins_1.return)) _b.call(remotePlugins_1);
|
|
52
|
+
}
|
|
53
|
+
finally { if (e_2) throw e_2.error; }
|
|
54
|
+
}
|
|
55
|
+
flex_dev_utils_1.logger.newline();
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=remotePluginNotFound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remotePluginNotFound.js","sourceRoot":"","sources":["../../src/prints/remotePluginNotFound.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAgD;AAIhD;;;;;GAKG;AACH,mBAAe,UAAC,eAAyB,EAAE,aAAuB;;IAChE,uBAAM,CAAC,aAAa,EAAE,CAAC;IAEvB,uBAAM,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;IAClF,uBAAM,CAAC,OAAO,EAAE,CAAC;;QACjB,KAAqB,IAAA,oBAAA,SAAA,eAAe,CAAA,gDAAA,6EAAE;YAAjC,IAAM,MAAM,4BAAA;YACf,uBAAM,CAAC,KAAK,CAAC,IAAI,EAAE,uBAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;SAChD;;;;;;;;;IAED,uBAAM,CAAC,OAAO,EAAE,CAAC;IACjB,uBAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACzC,uBAAM,CAAC,OAAO,EAAE,CAAC;;QACjB,KAAqB,IAAA,kBAAA,SAAA,aAAa,CAAA,4CAAA,uEAAE;YAA/B,IAAM,MAAM,0BAAA;YACf,uBAAM,CAAC,IAAI,CAAC,WAAS,MAAM,CAAC,IAAI,iBAAY,MAAM,CAAC,OAAO,SAAM,CAAC,CAAC;SACnE;;;;;;;;;IAED,uBAAM,CAAC,OAAO,EAAE,CAAC;AACnB,CAAC,EAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DefinePlugin } from 'webpack';
|
|
2
|
+
declare type CodeValueObject = {
|
|
3
|
+
[key: string]: DefinePlugin.CodeValueObject;
|
|
4
|
+
};
|
|
5
|
+
declare type ProcessEnv = {
|
|
6
|
+
[key: string]: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
interface SanitizedProcessEnv {
|
|
9
|
+
'process.env': CodeValueObject;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reads the .env file and process it. It will print warning messages if the format is invalid
|
|
13
|
+
* @param filename the filename to read
|
|
14
|
+
* @param path the path to the file
|
|
15
|
+
*/
|
|
16
|
+
export declare const _readEnvFile: (filename: string, path: string) => ProcessEnv;
|
|
17
|
+
/**
|
|
18
|
+
* Filters and sanitizes the variables
|
|
19
|
+
* @param variables the variables to read
|
|
20
|
+
*/
|
|
21
|
+
export declare const _filterVariables: (variables: CodeValueObject) => CodeValueObject;
|
|
22
|
+
/**
|
|
23
|
+
* Reads the .env files and sanitizes and only returns allowed keys
|
|
24
|
+
*/
|
|
25
|
+
export declare const getSanitizedProcessEnv: () => SanitizedProcessEnv;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getSanitizedProcessEnv = exports._filterVariables = exports._readEnvFile = void 0;
|
|
18
|
+
var dotenv_1 = __importDefault(require("dotenv"));
|
|
19
|
+
var fs_1 = require("@twilio/flex-dev-utils/dist/fs");
|
|
20
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
21
|
+
var prints_1 = require("../prints");
|
|
22
|
+
var REACT_APP_REGEX = /^REACT_APP_/i;
|
|
23
|
+
var FLEX_APP_REGEX = /^FLEX_APP_/i;
|
|
24
|
+
/**
|
|
25
|
+
* Checks whether the variable is of correct format
|
|
26
|
+
* @param key
|
|
27
|
+
*/
|
|
28
|
+
var isValid = function (key) { return FLEX_APP_REGEX.test(key) || REACT_APP_REGEX.test(key); };
|
|
29
|
+
/**
|
|
30
|
+
* Reads the .env file and process it. It will print warning messages if the format is invalid
|
|
31
|
+
* @param filename the filename to read
|
|
32
|
+
* @param path the path to the file
|
|
33
|
+
*/
|
|
34
|
+
var _readEnvFile = function (filename, path) {
|
|
35
|
+
var newVars = dotenv_1.default.parse(fs_1.readFileSync(path));
|
|
36
|
+
Object.keys(newVars)
|
|
37
|
+
.filter(function (key) { return !isValid(key); })
|
|
38
|
+
.forEach(function (key) { return prints_1.dotEnvIncorrectVariable(filename, key); });
|
|
39
|
+
return newVars;
|
|
40
|
+
};
|
|
41
|
+
exports._readEnvFile = _readEnvFile;
|
|
42
|
+
/**
|
|
43
|
+
* Filters and sanitizes the variables
|
|
44
|
+
* @param variables the variables to read
|
|
45
|
+
*/
|
|
46
|
+
var _filterVariables = function (variables) {
|
|
47
|
+
return Object.keys(variables)
|
|
48
|
+
.filter(isValid)
|
|
49
|
+
.reduce(function (newEnvs, key) {
|
|
50
|
+
newEnvs[key] = JSON.stringify(variables[key]);
|
|
51
|
+
return newEnvs;
|
|
52
|
+
}, {});
|
|
53
|
+
};
|
|
54
|
+
exports._filterVariables = _filterVariables;
|
|
55
|
+
/**
|
|
56
|
+
* Reads the .env files and sanitizes and only returns allowed keys
|
|
57
|
+
*/
|
|
58
|
+
var getSanitizedProcessEnv = function () {
|
|
59
|
+
var _a = fs_1.getPaths(), appPaths = _a.app, cwd = _a.cwd;
|
|
60
|
+
var variables = process.env;
|
|
61
|
+
// Support .env file if provided
|
|
62
|
+
if (appPaths.hasEnvFile()) {
|
|
63
|
+
variables = __assign(__assign({}, variables), exports._readEnvFile('.env', appPaths.envPath));
|
|
64
|
+
}
|
|
65
|
+
// Support for profile specific .env file (this should come after .env to allow overwrite)
|
|
66
|
+
if (flex_dev_utils_1.env.getTwilioProfile()) {
|
|
67
|
+
var filename = "." + flex_dev_utils_1.env.getTwilioProfile() + ".env";
|
|
68
|
+
var profileEnvPath = fs_1.resolveRelative(cwd, "/" + filename);
|
|
69
|
+
if (fs_1.checkAFileExists(profileEnvPath)) {
|
|
70
|
+
variables = __assign(__assign({}, variables), exports._readEnvFile(filename, profileEnvPath));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
'process.env': exports._filterVariables(variables),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
exports.getSanitizedProcessEnv = getSanitizedProcessEnv;
|
|
78
|
+
//# sourceMappingURL=clientVariables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientVariables.js","sourceRoot":"","sources":["../../src/webpack/clientVari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,aAAQ,EAAE,EAA5B,QAAQ,SAAA,EAAE,GAAG,SAAe,CAAC;IACpC,IAAK,SAAS,GAAK,OAAO,IAAZ,CAAa;IAEjC,gCAAgC;IAChC,IAAI,QAAQ,CAAC,UAAU,EAAE,EAAE;QACzB,SAAS,yBAAQ,SAAS,GAAK,oBAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAE,CAAC;KACzE;IACD,0FAA0F;IAC1F,IAAI,oBAAG,CAAC,gBAAgB,EAAE,EAAE;QAC1B,IAAM,QAAQ,GAAG,MAAI,oBAAG,CAAC,gBAAgB,EAAE,SAAM,CAAC;QAClD,IAAM,cAAc,GAAG,oBAAe,CAAC,GAAG,EAAE,MAAI,QAAU,CAAC,CAAC;QAC5D,IAAI,qBAAgB,CAAC,cAAc,CAAC,EAAE;YACpC,SAAS,yBAAQ,SAAS,GAAK,oBAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAE,CAAC;SACzE;KACF;IAED,OAAO;QACL,aAAa,EAAE,wBAAgB,CAAC,SAAS,CAAC;KAC3C,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,sBAAsB,0BAoBjC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CompilerOptions, ModuleResolutionHost, ResolvedModuleWithFailedLookupLocations } from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* This is taken from https://github.com/TypeStrong/fork-ts-checker-webpack-plugin documentation
|
|
4
|
+
*/
|
|
5
|
+
interface TS {
|
|
6
|
+
resolveModuleName: (moduleName: string, containingFile: string, options: CompilerOptions, moduleResolutionHost: ResolvedModuleWithFailedLookupLocations) => ResolvedModuleWithFailedLookupLocations;
|
|
7
|
+
}
|
|
8
|
+
export declare const resolveModuleName: (typescript: TS, moduleName: string, containingFile: string, compilerOptions: CompilerOptions, resolutionHost: ModuleResolutionHost) => ResolvedModuleWithFailedLookupLocations;
|
|
9
|
+
export declare const resolveTypeReferenceDirective: (typescript: TS, moduleName: string, containingFile: string, compilerOptions: CompilerOptions, resolutionHost: ModuleResolutionHost) => ResolvedModuleWithFailedLookupLocations;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTypeReferenceDirective = exports.resolveModuleName = void 0;
|
|
4
|
+
var ts_pnp_1 = require("ts-pnp");
|
|
5
|
+
var resolveModuleName = function (typescript, moduleName, containingFile, compilerOptions, resolutionHost) {
|
|
6
|
+
return ts_pnp_1.resolveModuleName(moduleName, containingFile, compilerOptions, resolutionHost, typescript.resolveModuleName);
|
|
7
|
+
};
|
|
8
|
+
exports.resolveModuleName = resolveModuleName;
|
|
9
|
+
var resolveTypeReferenceDirective = function (typescript, moduleName, containingFile, compilerOptions, resolutionHost) {
|
|
10
|
+
return ts_pnp_1.resolveModuleName(moduleName, containingFile, compilerOptions, resolutionHost, typescript.resolveModuleName);
|
|
11
|
+
};
|
|
12
|
+
exports.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
13
|
+
//# sourceMappingURL=pnpTs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpTs.js","sourceRoot":"","sources":["../../src/webpack/pnpTs.ts"],"names":[],"mappings":";;;AAGA,iCAAuD;AAgBhD,IAAM,iBAAiB,GAAG,UAC/B,UAAc,EACd,UAAkB,EAClB,cAAsB,EACtB,eAAgC,EAChC,cAAoC;IAEpC,OAAO,0BAAQ,CAAC,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAC7G,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B;AAEK,IAAM,6BAA6B,GAAG,UAC3C,UAAc,EACd,UAAkB,EAClB,cAAsB,EACtB,eAAgC,EAChC,cAAoC;IAEpC,OAAO,0BAAQ,CAAC,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAC7G,CAAC,CAAC;AARW,QAAA,6BAA6B,iCAQxC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="src/module" />
|
|
2
|
+
import { Environment } from '@twilio/flex-dev-utils/dist/env';
|
|
3
|
+
import webpack, { Configuration, Plugin, Resolve, RuleSetRule } from 'webpack';
|
|
4
|
+
import { WebpackType } from '..';
|
|
5
|
+
import Optimization = webpack.Options.Optimization;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the JS scripts to inject into the index.html file
|
|
8
|
+
* @param flexUIVersion the flex-ui version
|
|
9
|
+
* @param reactVersion the react version
|
|
10
|
+
* @param reactDOMVersion the react-dom version
|
|
11
|
+
*/
|
|
12
|
+
export declare const _getJSScripts: (flexUIVersion: string, reactVersion: string, reactDOMVersion: string) => string[];
|
|
13
|
+
/**
|
|
14
|
+
* Gets the image loader
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
export declare const _getImageLoader: () => RuleSetRule;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the styles loader
|
|
20
|
+
* @param isProd whether this is a production build
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
export declare const _getStyleLoaders: (isProd: boolean) => RuleSetRule[];
|
|
24
|
+
/**
|
|
25
|
+
* Returns an array of {@link Plugin} for Webpack
|
|
26
|
+
* @param environment the environment
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
export declare const _getBasePlugins: (environment: Environment) => Plugin[];
|
|
30
|
+
/**
|
|
31
|
+
* Returns an array of {@link Plugin} for Webpack Static
|
|
32
|
+
* @param environment
|
|
33
|
+
*/
|
|
34
|
+
export declare const _getStaticPlugins: (environment: Environment) => Plugin[];
|
|
35
|
+
/**
|
|
36
|
+
* Returns an array of {@link Plugin} for Webpack Javascript
|
|
37
|
+
* @param environment
|
|
38
|
+
*/
|
|
39
|
+
export declare const _getJSPlugins: (environment: Environment) => Plugin[];
|
|
40
|
+
/**
|
|
41
|
+
* Returns the `entry` key of the webpack
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
export declare const _getJavaScriptEntries: () => string[];
|
|
45
|
+
/**
|
|
46
|
+
* Returns the `optimization` key of webpack
|
|
47
|
+
* @param environment the environment
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
export declare const _getOptimization: (environment: Environment) => Optimization;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the `resolve` key of webpack
|
|
53
|
+
* @param environment the environment
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
export declare const _getResolve: (environment: Environment) => Resolve;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the base {@link Configuration}
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
export declare const _getBase: (environment: Environment) => Configuration;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the {@link Configuration} for static type
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
export declare const _getStaticConfiguration: (config: Configuration, environment: Environment) => Configuration;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the {@link Configuration} for JS type
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
export declare const _getJavaScriptConfiguration: (config: Configuration, environment: Environment) => Configuration;
|
|
72
|
+
declare const _default: (environment: Environment, type: WebpackType) => Configuration;
|
|
73
|
+
/**
|
|
74
|
+
* Main method for generating a webpack configuration
|
|
75
|
+
* @param environment
|
|
76
|
+
* @param type
|
|
77
|
+
*/
|
|
78
|
+
export default _default;
|