@twilio/flex-plugin-webpack5 0.0.1 → 7.1.4-alpha.202610140448
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 +39 -3
- package/dist/compiler.d.ts +38 -0
- package/dist/compiler.js +252 -0
- package/dist/compiler.js.map +1 -0
- package/dist/devServer/ipcServer.d.ts +73 -0
- package/dist/devServer/ipcServer.js +253 -0
- package/dist/devServer/ipcServer.js.map +1 -0
- package/dist/devServer/pluginServer.d.ts +79 -0
- package/dist/devServer/pluginServer.js +313 -0
- package/dist/devServer/pluginServer.js.map +1 -0
- package/dist/devServer/webpackDevServer.d.ts +11 -0
- package/dist/devServer/webpackDevServer.js +110 -0
- package/dist/devServer/webpackDevServer.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/DelayRenderStaticPlugin.d.ts +4 -0
- package/dist/plugins/DelayRenderStaticPlugin.js +64 -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 +25 -0
- package/dist/webpack/clientVariables.js +107 -0
- package/dist/webpack/clientVariables.js.map +1 -0
- package/dist/webpack/pnpTs.d.ts +10 -0
- package/dist/webpack/pnpTs.js +14 -0
- package/dist/webpack/pnpTs.js.map +1 -0
- package/dist/webpack/webpack.config.d.ts +74 -0
- package/dist/webpack/webpack.config.js +569 -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 +80 -0
- package/dist/webpack/webpack.dev.js.map +1 -0
- package/package.json +78 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Configuration } from 'webpack-dev-server-wp5';
|
|
2
|
+
import { Compiler } from '../compiler';
|
|
3
|
+
import { WebpackTypeWp5 } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* Starts a {@link WebpackDevServer}
|
|
6
|
+
* @param devCompiler the {@link Compiler} compiler
|
|
7
|
+
* @param devConfig the dev {@link Configuration}
|
|
8
|
+
* @param type the {@link WebpackType}
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: (devCompiler: Compiler, devConfig: Configuration, type: WebpackTypeWp5) => void;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var webpack_dev_server_wp5_1 = __importDefault(require("webpack-dev-server-wp5"));
|
|
43
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
44
|
+
var urls_1 = require("@twilio/flex-dev-utils/dist/urls");
|
|
45
|
+
var __1 = require("..");
|
|
46
|
+
var termSignals = ['SIGTERM', 'SIGINT'];
|
|
47
|
+
/**
|
|
48
|
+
* Starts a {@link WebpackDevServer}
|
|
49
|
+
* @param devCompiler the {@link Compiler} compiler
|
|
50
|
+
* @param devConfig the dev {@link Configuration}
|
|
51
|
+
* @param type the {@link WebpackType}
|
|
52
|
+
*/
|
|
53
|
+
exports.default = (function (devCompiler, devConfig, type) {
|
|
54
|
+
var port = flex_dev_utils_1.env.getPort();
|
|
55
|
+
var local = (0, urls_1.getLocalAndNetworkUrls)(port).local;
|
|
56
|
+
var isJavaScriptServer = type === __1.WebpackTypeWp5.JavaScript;
|
|
57
|
+
var isStaticServer = type === __1.WebpackTypeWp5.Static;
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
var devServer = new webpack_dev_server_wp5_1.default(devConfig, devCompiler);
|
|
60
|
+
if (!isStaticServer) {
|
|
61
|
+
// Show TS errors on browser
|
|
62
|
+
devCompiler.hooks.tsCompiled.tap('afterTSCompile', function (warnings, errors) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
if (warnings.length) {
|
|
65
|
+
devServer.sendMessage((_a = devServer.webSocketServer) === null || _a === void 0 ? void 0 : _a.clients, 'warnings', warnings);
|
|
66
|
+
}
|
|
67
|
+
if (errors.length) {
|
|
68
|
+
devServer.sendMessage((_b = devServer.webSocketServer) === null || _b === void 0 ? void 0 : _b.clients, 'errors', errors);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// Start the dev-server
|
|
73
|
+
devServer.listen(local.port, local.host, function (err) { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var serverType;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
if (err) {
|
|
79
|
+
flex_dev_utils_1.logger.error(err);
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
serverType = type === __1.WebpackTypeWp5.Complete ? '' : "(".concat(type, ")");
|
|
83
|
+
if (isJavaScriptServer) {
|
|
84
|
+
flex_dev_utils_1.logger.debug('Starting development server %s...', serverType);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
flex_dev_utils_1.logger.clearTerminal();
|
|
88
|
+
flex_dev_utils_1.logger.notice('Starting development server %s...', serverType);
|
|
89
|
+
}
|
|
90
|
+
if (!!isJavaScriptServer) return [3 /*break*/, 2];
|
|
91
|
+
return [4 /*yield*/, (0, flex_dev_utils_1.open)(local.url)];
|
|
92
|
+
case 1:
|
|
93
|
+
_a.sent();
|
|
94
|
+
_a.label = 2;
|
|
95
|
+
case 2: return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}); });
|
|
99
|
+
// Close server and exit
|
|
100
|
+
var cleanUp = function () {
|
|
101
|
+
devServer.close();
|
|
102
|
+
(0, flex_dev_utils_1.exit)(0);
|
|
103
|
+
};
|
|
104
|
+
termSignals.forEach(function (sig) { return process.on(sig, cleanUp); });
|
|
105
|
+
if (!flex_dev_utils_1.env.isCI()) {
|
|
106
|
+
process.stdin.on('end', cleanUp);
|
|
107
|
+
process.stdin.resume();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=webpackDevServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpackDevServer.js","sourceRoot":"","sources":["../../src/devServer/webpackDevServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kFAA2F;AAC3F,yDAAiE;AACjE,yDAA0E;AAG1E,wBAAoC;AAEpC,IAAM,WAAW,GAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAE5D;;;;;GAK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KAAK,CAAC,mCAAmC,EAAE,UAAU,CAAC,CAAC;qBAC/D;yBAAM;wBACL,uBAAM,CAAC,aAAa,EAAE,CAAC;wBACvB,uBAAM,CAAC,MAAM,CAAC,mCAAmC,EAAE,UAAU,CAAC,CAAC;qBAChE;yBAEG,CAAC,kBAAkB,EAAnB,wBAAmB;oBACrB,qBAAM,IAAA,qBAAI,EAAC,KAAK,CAAC,GAAG,CAAC,EAAA;;oBAArB,SAAqB,CAAC;;;;;SAEzB,CAAC,CAAC;IAEH,wBAAwB;IACxB,IAAM,OAAO,GAAG;QACd,SAAS,CAAC,KAAK,EAAE,CAAC;QAClB,IAAA,qBAAI,EAAC,CAAC,CAAC,CAAC;IACV,CAAC,CAAC;IAEF,WAAW,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,EAAxB,CAAwB,CAAC,CAAC;IACvD,IAAI,CAAC,oBAAG,CAAC,IAAI,EAAE,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;KACxB;AACH,CAAC,EAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import webpack from 'webpack5';
|
|
2
|
+
export declare enum WebpackTypeWp5 {
|
|
3
|
+
Static = "static",
|
|
4
|
+
JavaScript = "javascript",
|
|
5
|
+
Complete = "complete"
|
|
6
|
+
}
|
|
7
|
+
export { webpack as webpack5 };
|
|
8
|
+
export { Configuration as WebpackConfigurationsWp5, Stats } from 'webpack5';
|
|
9
|
+
export { Configuration as WebpackDevConfigurationsWp5 } from 'webpack-dev-server-wp5';
|
|
10
|
+
export { default as webpackFactoryWp5 } from './webpack/webpack.config';
|
|
11
|
+
export { default as webpackDevFactoryWp5 } from './webpack/webpack.dev';
|
|
12
|
+
export { default as compilerWp5, compilerRenderer as compilerRendererWp5 } from './compiler';
|
|
13
|
+
export { default as webpackDevServerWp5 } from './devServer/webpackDevServer';
|
|
14
|
+
export { default as pluginServerWp5, Plugin as PluginWp5, PluginsConfig as PluginsConfigWp5, PLUGIN_INPUT_PARSER_REGEX, } from './devServer/pluginServer';
|
|
15
|
+
export { emitCompileComplete as emitCompileCompleteWp5, emitDevServerCrashed as emitDevServerCrashedWp5, emitAllCompilesComplete as emitAllCompilesCompleteWp5, IPCType as IPCTypeWp5, onIPCServerMessage as onIPCServerMessageWp5, OnDevServerCrashedPayload as OnDevServerCrashedPayloadWp5, startIPCClient as startIPCClientWp5, startIPCServer as startIPCServerWp5, } from './devServer/ipcServer';
|
|
16
|
+
export { default as DelayRenderStaticPluginWp5 } from './plugins/DelayRenderStaticPlugin';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable import/no-unused-modules */
|
|
3
|
+
/* c8 ignore start */
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DelayRenderStaticPluginWp5 = exports.startIPCServerWp5 = exports.startIPCClientWp5 = exports.onIPCServerMessageWp5 = exports.IPCTypeWp5 = exports.emitAllCompilesCompleteWp5 = exports.emitDevServerCrashedWp5 = exports.emitCompileCompleteWp5 = exports.PLUGIN_INPUT_PARSER_REGEX = exports.pluginServerWp5 = exports.webpackDevServerWp5 = exports.compilerRendererWp5 = exports.compilerWp5 = exports.webpackDevFactoryWp5 = exports.webpackFactoryWp5 = exports.Stats = exports.webpack5 = exports.WebpackTypeWp5 = void 0;
|
|
9
|
+
var webpack5_1 = __importDefault(require("webpack5"));
|
|
10
|
+
exports.webpack5 = webpack5_1.default;
|
|
11
|
+
var WebpackTypeWp5;
|
|
12
|
+
(function (WebpackTypeWp5) {
|
|
13
|
+
WebpackTypeWp5["Static"] = "static";
|
|
14
|
+
WebpackTypeWp5["JavaScript"] = "javascript";
|
|
15
|
+
WebpackTypeWp5["Complete"] = "complete";
|
|
16
|
+
})(WebpackTypeWp5 = exports.WebpackTypeWp5 || (exports.WebpackTypeWp5 = {}));
|
|
17
|
+
var webpack5_2 = require("webpack5");
|
|
18
|
+
Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return webpack5_2.Stats; } });
|
|
19
|
+
var webpack_config_1 = require("./webpack/webpack.config");
|
|
20
|
+
Object.defineProperty(exports, "webpackFactoryWp5", { enumerable: true, get: function () { return __importDefault(webpack_config_1).default; } });
|
|
21
|
+
var webpack_dev_1 = require("./webpack/webpack.dev");
|
|
22
|
+
Object.defineProperty(exports, "webpackDevFactoryWp5", { enumerable: true, get: function () { return __importDefault(webpack_dev_1).default; } });
|
|
23
|
+
var compiler_1 = require("./compiler");
|
|
24
|
+
Object.defineProperty(exports, "compilerWp5", { enumerable: true, get: function () { return __importDefault(compiler_1).default; } });
|
|
25
|
+
Object.defineProperty(exports, "compilerRendererWp5", { enumerable: true, get: function () { return compiler_1.compilerRenderer; } });
|
|
26
|
+
var webpackDevServer_1 = require("./devServer/webpackDevServer");
|
|
27
|
+
Object.defineProperty(exports, "webpackDevServerWp5", { enumerable: true, get: function () { return __importDefault(webpackDevServer_1).default; } });
|
|
28
|
+
var pluginServer_1 = require("./devServer/pluginServer");
|
|
29
|
+
Object.defineProperty(exports, "pluginServerWp5", { enumerable: true, get: function () { return __importDefault(pluginServer_1).default; } });
|
|
30
|
+
Object.defineProperty(exports, "PLUGIN_INPUT_PARSER_REGEX", { enumerable: true, get: function () { return pluginServer_1.PLUGIN_INPUT_PARSER_REGEX; } });
|
|
31
|
+
var ipcServer_1 = require("./devServer/ipcServer");
|
|
32
|
+
Object.defineProperty(exports, "emitCompileCompleteWp5", { enumerable: true, get: function () { return ipcServer_1.emitCompileComplete; } });
|
|
33
|
+
Object.defineProperty(exports, "emitDevServerCrashedWp5", { enumerable: true, get: function () { return ipcServer_1.emitDevServerCrashed; } });
|
|
34
|
+
Object.defineProperty(exports, "emitAllCompilesCompleteWp5", { enumerable: true, get: function () { return ipcServer_1.emitAllCompilesComplete; } });
|
|
35
|
+
Object.defineProperty(exports, "IPCTypeWp5", { enumerable: true, get: function () { return ipcServer_1.IPCType; } });
|
|
36
|
+
Object.defineProperty(exports, "onIPCServerMessageWp5", { enumerable: true, get: function () { return ipcServer_1.onIPCServerMessage; } });
|
|
37
|
+
Object.defineProperty(exports, "startIPCClientWp5", { enumerable: true, get: function () { return ipcServer_1.startIPCClient; } });
|
|
38
|
+
Object.defineProperty(exports, "startIPCServerWp5", { enumerable: true, get: function () { return ipcServer_1.startIPCServer; } });
|
|
39
|
+
var DelayRenderStaticPlugin_1 = require("./plugins/DelayRenderStaticPlugin");
|
|
40
|
+
Object.defineProperty(exports, "DelayRenderStaticPluginWp5", { enumerable: true, get: function () { return __importDefault(DelayRenderStaticPlugin_1).default; } });
|
|
41
|
+
/* c8 ignore stop */
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,6CAA6C;AAC7C,qBAAqB;;;;;;AAErB,sDAA+B;AAQX,mBARb,kBAAO,CAQc;AAN5B,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;IACzB,uCAAqB,CAAA;AACvB,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB;AAGD,qCAA4E;AAAxB,iGAAA,KAAK,OAAA;AAEzD,2DAAwE;AAA/D,oIAAA,OAAO,OAAqB;AACrC,qDAAwE;AAA/D,oIAAA,OAAO,OAAwB;AACxC,uCAA6F;AAApF,wHAAA,OAAO,OAAe;AAAE,+GAAA,gBAAgB,OAAuB;AACxE,iEAA8E;AAArE,wIAAA,OAAO,OAAuB;AACvC,yDAKkC;AAJhC,gIAAA,OAAO,OAAmB;AAG1B,yHAAA,yBAAyB,OAAA;AAE3B,mDAS+B;AAR7B,mHAAA,mBAAmB,OAA0B;AAC7C,oHAAA,oBAAoB,OAA2B;AAC/C,uHAAA,uBAAuB,OAA8B;AACrD,uGAAA,OAAO,OAAc;AACrB,kHAAA,kBAAkB,OAAyB;AAE3C,8GAAA,cAAc,OAAqB;AACnC,8GAAA,cAAc,OAAqB;AAErC,6EAA0F;AAAjF,sJAAA,OAAO,OAA8B;AAE9C,oBAAoB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* c8 ignore start */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
+
function step(op) {
|
|
17
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
20
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
+
switch (op[0]) {
|
|
22
|
+
case 0: case 1: t = op; break;
|
|
23
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
+
default:
|
|
27
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
+
if (t[2]) _.ops.pop();
|
|
32
|
+
_.trys.pop(); continue;
|
|
33
|
+
}
|
|
34
|
+
op = body.call(thisArg, _);
|
|
35
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
var ipcServer_1 = require("../devServer/ipcServer");
|
|
41
|
+
var isCalled = false;
|
|
42
|
+
var DelayRenderStaticPlugin = /** @class */ (function () {
|
|
43
|
+
function DelayRenderStaticPlugin() {
|
|
44
|
+
}
|
|
45
|
+
DelayRenderStaticPlugin.prototype.apply = function (compiler) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
compiler.hooks.beforeCompile.tapAsync('DelayPlugin', function (_, done) { return __awaiter(_this, void 0, void 0, function () {
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
if (isCalled) {
|
|
50
|
+
done();
|
|
51
|
+
}
|
|
52
|
+
(0, ipcServer_1.onIPCServerMessage)(ipcServer_1.IPCType.onEmitAllCompilesComplete, function () {
|
|
53
|
+
isCalled = true;
|
|
54
|
+
done();
|
|
55
|
+
});
|
|
56
|
+
return [2 /*return*/];
|
|
57
|
+
});
|
|
58
|
+
}); });
|
|
59
|
+
};
|
|
60
|
+
return DelayRenderStaticPlugin;
|
|
61
|
+
}());
|
|
62
|
+
exports.default = DelayRenderStaticPlugin;
|
|
63
|
+
/* c8 ignore stop */
|
|
64
|
+
//# sourceMappingURL=DelayRenderStaticPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DelayRenderStaticPlugin.js","sourceRoot":"","sources":["../../src/plugins/DelayRenderStaticPlugin.ts"],"names":[],"mappings":";AAAA,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIrB,oDAAqE;AAErE,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB;IAAA;IAYA,CAAC;IAXC,uCAAK,GAAL,UAAM,QAAkB;QAAxB,iBAUC;QATC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,aAAa,EAAE,UAAO,CAAC,EAAE,IAAI;;gBACjE,IAAI,QAAQ,EAAE;oBACZ,IAAI,EAAE,CAAC;iBACR;gBACD,IAAA,8BAAkB,EAAC,mBAAO,CAAC,yBAAyB,EAAE;oBACpD,QAAQ,GAAG,IAAI,CAAC;oBAChB,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;;;aACJ,CAAC,CAAC;IACL,CAAC;IACH,8BAAC;AAAD,CAAC,AAZD,IAYC;;AAED,oBAAoB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ServiceUrl } from '@twilio/flex-dev-utils/dist/urls';
|
|
2
|
+
import { Plugin } from '../devServer/pluginServer';
|
|
3
|
+
/**
|
|
4
|
+
* Prints the success message when dev-server compiles
|
|
5
|
+
* @param local the local port
|
|
6
|
+
* @param network the local network
|
|
7
|
+
* @param localPlugins the list of local plugins
|
|
8
|
+
* @param remotePlugins the list of remote plugins
|
|
9
|
+
* @param hasRemote whether remote plugins are running
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: (local: ServiceUrl, network: ServiceUrl, localPlugins: string[], remotePlugins: Plugin[], hasRemote: boolean) => void;
|
|
12
|
+
export default _default;
|
|
@@ -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', "!!".concat(local.url, "!!")],
|
|
20
|
+
['Network', "!!".concat(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 = (0, fs_1.readPluginsJson)().plugins.find(function (p) { return p.name === name; });
|
|
29
|
+
return ["".concat(plugin.name), "!!".concat(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 ["".concat(p.name, "..@..").concat(p.version), "!!".concat(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,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AAC,CAAC;QAEpE,uBAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;KACxC;IAED,uBAAM,CAAC,OAAO,EAAE,CAAC;IACjB,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 **".concat(key, "** provided in **").concat(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,iCAA0B,GAAG,8BAAoB,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 { PluginWp5 } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* Error message for when a remote plugin is not found
|
|
4
|
+
*
|
|
5
|
+
* @param notFoundPlugins name of the plugin
|
|
6
|
+
* @param remotePlugins array of remote plugins
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: (notFoundPlugins: string[], remotePlugins: PluginWp5[]) => void;
|
|
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--**".concat(plugin.name, "**..@..**").concat(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,aAA0B;;IACnE,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,gBAAS,MAAM,CAAC,IAAI,sBAAY,MAAM,CAAC,OAAO,SAAM,CAAC,CAAC;SACnE;;;;;;;;;IAED,uBAAM,CAAC,OAAO,EAAE,CAAC;AACnB,CAAC,EAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type CodeValueObject = {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
};
|
|
4
|
+
type ProcessEnv = {
|
|
5
|
+
[key: string]: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
interface SanitizedProcessEnv {
|
|
8
|
+
'process.env': CodeValueObject;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Reads the .env file and process it. It will print warning messages if the format is invalid
|
|
12
|
+
* @param filename the filename to read
|
|
13
|
+
* @param path the path to the file
|
|
14
|
+
*/
|
|
15
|
+
export declare const _readEnvFile: (filename: string, path: string) => ProcessEnv;
|
|
16
|
+
/**
|
|
17
|
+
* Filters and sanitizes the variables
|
|
18
|
+
* @param variables the variables to read
|
|
19
|
+
*/
|
|
20
|
+
export declare const _filterVariables: (variables: CodeValueObject) => CodeValueObject;
|
|
21
|
+
/**
|
|
22
|
+
* Reads the .env files and sanitizes and only returns allowed keys
|
|
23
|
+
*/
|
|
24
|
+
export declare const getSanitizedProcessEnv: () => SanitizedProcessEnv;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.getSanitizedProcessEnv = exports._filterVariables = exports._readEnvFile = void 0;
|
|
41
|
+
var dotenv_1 = __importDefault(require("dotenv"));
|
|
42
|
+
var fs_1 = require("@twilio/flex-dev-utils/dist/fs");
|
|
43
|
+
var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
|
|
44
|
+
var prints_1 = require("../prints");
|
|
45
|
+
/*
|
|
46
|
+
* Self-import so getSanitizedProcessEnv's call to _readEnvFile goes through the (spy-able)
|
|
47
|
+
* module namespace rather than a fixed local binding - lets jest.spyOn intercept it in tests.
|
|
48
|
+
*/
|
|
49
|
+
// eslint-disable-next-line import/no-self-import
|
|
50
|
+
var self = __importStar(require("./clientVariables"));
|
|
51
|
+
var REACT_APP_REGEX = /^REACT_APP_/i;
|
|
52
|
+
var FLEX_APP_REGEX = /^FLEX_APP_/i;
|
|
53
|
+
/**
|
|
54
|
+
* Checks whether the variable is of correct format
|
|
55
|
+
* @param key
|
|
56
|
+
*/
|
|
57
|
+
var isValid = function (key) { return FLEX_APP_REGEX.test(key) || REACT_APP_REGEX.test(key); };
|
|
58
|
+
/**
|
|
59
|
+
* Reads the .env file and process it. It will print warning messages if the format is invalid
|
|
60
|
+
* @param filename the filename to read
|
|
61
|
+
* @param path the path to the file
|
|
62
|
+
*/
|
|
63
|
+
var _readEnvFile = function (filename, path) {
|
|
64
|
+
var newVars = dotenv_1.default.parse((0, fs_1.readFileSync)(path));
|
|
65
|
+
Object.keys(newVars)
|
|
66
|
+
.filter(function (key) { return !isValid(key); })
|
|
67
|
+
.forEach(function (key) { return (0, prints_1.dotEnvIncorrectVariable)(filename, key); });
|
|
68
|
+
return newVars;
|
|
69
|
+
};
|
|
70
|
+
exports._readEnvFile = _readEnvFile;
|
|
71
|
+
/**
|
|
72
|
+
* Filters and sanitizes the variables
|
|
73
|
+
* @param variables the variables to read
|
|
74
|
+
*/
|
|
75
|
+
var _filterVariables = function (variables) {
|
|
76
|
+
return Object.keys(variables)
|
|
77
|
+
.filter(isValid)
|
|
78
|
+
.reduce(function (newEnvs, key) {
|
|
79
|
+
newEnvs[key] = JSON.stringify(variables[key]);
|
|
80
|
+
return newEnvs;
|
|
81
|
+
}, {});
|
|
82
|
+
};
|
|
83
|
+
exports._filterVariables = _filterVariables;
|
|
84
|
+
/**
|
|
85
|
+
* Reads the .env files and sanitizes and only returns allowed keys
|
|
86
|
+
*/
|
|
87
|
+
var getSanitizedProcessEnv = function () {
|
|
88
|
+
var _a = (0, fs_1.getPaths)(), appPaths = _a.app, cwd = _a.cwd;
|
|
89
|
+
var variables = process.env;
|
|
90
|
+
// Support .env file if provided
|
|
91
|
+
if (appPaths.hasEnvFile()) {
|
|
92
|
+
variables = __assign(__assign({}, variables), self._readEnvFile('.env', appPaths.envPath));
|
|
93
|
+
}
|
|
94
|
+
// Support for profile specific .env file (this should come after .env to allow overwrite)
|
|
95
|
+
if (flex_dev_utils_1.env.getTwilioProfile()) {
|
|
96
|
+
var filename = ".".concat(flex_dev_utils_1.env.getTwilioProfile(), ".env");
|
|
97
|
+
var profileEnvPath = (0, fs_1.resolveRelative)(cwd, "/".concat(filename));
|
|
98
|
+
if ((0, fs_1.checkAFileExists)(profileEnvPath)) {
|
|
99
|
+
variables = __assign(__assign({}, variables), self._readEnvFile(filename, profileEnvPath));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
'process.env': (0, exports._filterVariables)(variables),
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
exports.getSanitizedProcessEnv = getSanitizedProcessEnv;
|
|
107
|
+
//# sourceMappingURL=clientVariables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientVariables.js","sourceRoot":"","sources":["../../src/webpack/clientVariables.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4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yB,IAAA,aAAQ,GAAE,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,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAE,CAAC;KAC9E;IACD,0FAA0F;IAC1F,IAAI,oBAAG,CAAC,gBAAgB,EAAE,EAAE;QAC1B,IAAM,QAAQ,GAAG,WAAI,oBAAG,CAAC,gBAAgB,EAAE,SAAM,CAAC;QAClD,IAAM,cAAc,GAAG,IAAA,oBAAe,EAAC,GAAG,EAAE,WAAI,QAAQ,CAAE,CAAC,CAAC;QAC5D,IAAI,IAAA,qBAAgB,EAAC,cAAc,CAAC,EAAE;YACpC,SAAS,yBAAQ,SAAS,GAAK,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAE,CAAC;SAC9E;KACF;IAED,OAAO;QACL,aAAa,EAAE,IAAA,wBAAgB,EAAC,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,14 @@
|
|
|
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 (0, 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 (0, ts_pnp_1.resolveModuleName)(moduleName, containingFile, compilerOptions, resolutionHost, typescript.resolveModuleName);
|
|
11
|
+
};
|
|
12
|
+
exports.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
13
|
+
/* c8 ignore stop */
|
|
14
|
+
//# 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,IAAA,0BAAQ,EAAC,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,IAAA,0BAAQ,EAAC,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAC7G,CAAC,CAAC;AARW,QAAA,6BAA6B,iCAQxC;AAEF,oBAAoB"}
|