UNPKG

32.7 kBJavaScriptView Raw
1module.exports =
2/******/ (function(modules) { // webpackBootstrap
3/******/ // The module cache
4/******/ var installedModules = {};
5/******/
6/******/ // The require function
7/******/ function __webpack_require__(moduleId) {
8/******/
9/******/ // Check if module is in cache
10/******/ if(installedModules[moduleId]) {
11/******/ return installedModules[moduleId].exports;
12/******/ }
13/******/ // Create a new module (and put it into the cache)
14/******/ var module = installedModules[moduleId] = {
15/******/ i: moduleId,
16/******/ l: false,
17/******/ exports: {}
18/******/ };
19/******/
20/******/ // Execute the module function
21/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22/******/
23/******/ // Flag the module as loaded
24/******/ module.l = true;
25/******/
26/******/ // Return the exports of the module
27/******/ return module.exports;
28/******/ }
29/******/
30/******/
31/******/ // expose the modules object (__webpack_modules__)
32/******/ __webpack_require__.m = modules;
33/******/
34/******/ // expose the module cache
35/******/ __webpack_require__.c = installedModules;
36/******/
37/******/ // define getter function for harmony exports
38/******/ __webpack_require__.d = function(exports, name, getter) {
39/******/ if(!__webpack_require__.o(exports, name)) {
40/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41/******/ }
42/******/ };
43/******/
44/******/ // define __esModule on exports
45/******/ __webpack_require__.r = function(exports) {
46/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48/******/ }
49/******/ Object.defineProperty(exports, '__esModule', { value: true });
50/******/ };
51/******/
52/******/ // create a fake namespace object
53/******/ // mode & 1: value is a module id, require it
54/******/ // mode & 2: merge all properties of value into the ns
55/******/ // mode & 4: return value when already ns object
56/******/ // mode & 8|1: behave like require
57/******/ __webpack_require__.t = function(value, mode) {
58/******/ if(mode & 1) value = __webpack_require__(value);
59/******/ if(mode & 8) return value;
60/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61/******/ var ns = Object.create(null);
62/******/ __webpack_require__.r(ns);
63/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65/******/ return ns;
66/******/ };
67/******/
68/******/ // getDefaultExport function for compatibility with non-harmony modules
69/******/ __webpack_require__.n = function(module) {
70/******/ var getter = module && module.__esModule ?
71/******/ function getDefault() { return module['default']; } :
72/******/ function getModuleExports() { return module; };
73/******/ __webpack_require__.d(getter, 'a', getter);
74/******/ return getter;
75/******/ };
76/******/
77/******/ // Object.prototype.hasOwnProperty.call
78/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79/******/
80/******/ // __webpack_public_path__
81/******/ __webpack_require__.p = "";
82/******/
83/******/
84/******/ // Load entry module and return exports
85/******/ return __webpack_require__(__webpack_require__.s = 0);
86/******/ })
87/************************************************************************/
88/******/ ([
89/* 0 */
90/*!**********************!*\
91 !*** ./index.coffee ***!
92 \**********************/
93/*! no static exports found */
94/***/ (function(module, exports, __webpack_require__) {
95
96module.exports = __webpack_require__(/*! ./source/Art.Config */ 1);
97
98
99/***/ }),
100/* 1 */
101/*!************************************!*\
102 !*** ./source/Art.Config/index.js ***!
103 \************************************/
104/*! no static exports found */
105/***/ (function(module, exports, __webpack_require__) {
106
107// generated by Neptune Namespaces v4.x.x
108// file: Art.Config/index.js
109
110(module.exports = __webpack_require__(/*! ./namespace */ 2))
111.includeInNamespace(__webpack_require__(/*! ./Config */ 5))
112.addModules({
113 ConfigRegistry: __webpack_require__(/*! ./ConfigRegistry */ 10),
114 Configurable: __webpack_require__(/*! ./Configurable */ 13),
115 Configuration: __webpack_require__(/*! ./Configuration */ 6),
116 Lib: __webpack_require__(/*! ./Lib */ 12),
117 Main: __webpack_require__(/*! ./Main */ 11)
118});
119
120/***/ }),
121/* 2 */
122/*!****************************************!*\
123 !*** ./source/Art.Config/namespace.js ***!
124 \****************************************/
125/*! no static exports found */
126/***/ (function(module, exports, __webpack_require__) {
127
128// generated by Neptune Namespaces v4.x.x
129// file: Art.Config/namespace.js
130
131module.exports = __webpack_require__(/*! neptune-namespaces */ 3).addNamespace(
132 'Art.Config',
133 (class Config extends Neptune.PackageNamespace {})
134 ._configureNamespace(__webpack_require__(/*! ../../package.json */ 4))
135);
136
137
138/***/ }),
139/* 3 */
140/*!*************************************************************************************!*\
141 !*** external "require('neptune-namespaces' /* ABC - not inlining fellow NPM *_/)" ***!
142 \*************************************************************************************/
143/*! no static exports found */
144/***/ (function(module, exports) {
145
146module.exports = require('neptune-namespaces' /* ABC - not inlining fellow NPM */);
147
148/***/ }),
149/* 4 */
150/*!**********************!*\
151 !*** ./package.json ***!
152 \**********************/
153/*! exports provided: author, bugs, dependencies, description, devDependencies, homepage, license, name, repository, scripts, version, default */
154/***/ (function(module) {
155
156module.exports = JSON.parse("{\"author\":\"Shane Brinkman-Davis Delamore, Imikimi LLC\",\"bugs\":\"https:/github.com/art-suite/art-suite-foundations2/issues\",\"dependencies\":{\"art-build-configurator\":\"*\",\"art-events\":\"*\"},\"description\":\"A powerful yet simple tool for configuring all your libraries consistently.\",\"devDependencies\":{\"art-testbench\":\"*\",\"case-sensitive-paths-webpack-plugin\":\"^2.2.0\",\"chai\":\"^4.2.0\",\"coffee-loader\":\"^0.7.3\",\"css-loader\":\"^3.0.0\",\"json-loader\":\"^0.5.7\",\"mocha\":\"^7.0.0\",\"mock-fs\":\"^4.10.0\",\"script-loader\":\"^0.7.2\",\"style-loader\":\"^1.0.0\",\"webpack\":\"^4.39.1\",\"webpack-cli\":\"*\",\"webpack-dev-server\":\"^3.7.2\",\"webpack-merge\":\"^4.2.1\",\"webpack-node-externals\":\"^1.7.2\",\"webpack-stylish\":\"^0.1.8\"},\"homepage\":\"https://github.com/art-suite/art-suite-foundations2\",\"license\":\"ISC\",\"name\":\"art-config\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/art-suite/art-suite-foundations2.git\"},\"scripts\":{\"build\":\"webpack --progress\",\"start\":\"webpack-dev-server --hot --inline --progress --env.devServer\",\"test\":\"nn -s;mocha -u tdd\",\"testInBrowser\":\"webpack-dev-server --progress --env.devServer\"},\"version\":\"1.13.0\"}");
157
158/***/ }),
159/* 5 */
160/*!*****************************************!*\
161 !*** ./source/Art.Config/Config.coffee ***!
162 \*****************************************/
163/*! no static exports found */
164/***/ (function(module, exports, __webpack_require__) {
165
166var defaultArtConfigName;
167
168module.exports = [
169 {
170 Config: __webpack_require__(/*! ./Configuration */ 6),
171 config: {
172 yesArtConfig: true
173 },
174 configName: defaultArtConfigName = "Development",
175 defaultArtConfigName: defaultArtConfigName
176 }, __webpack_require__(/*! ./Main */ 11)
177];
178
179
180/***/ }),
181/* 6 */
182/*!************************************************!*\
183 !*** ./source/Art.Config/Configuration.coffee ***!
184 \************************************************/
185/*! no static exports found */
186/***/ (function(module, exports, __webpack_require__) {
187
188/* WEBPACK VAR INJECTION */(function(module) {var BaseObject, ConfigRegistry, Configuration, deepMerge, defineModule, log, merge, mergeInto, ref,
189 extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
190 hasProp = {}.hasOwnProperty;
191
192ref = __webpack_require__(/*! art-standard-lib */ 8), defineModule = ref.defineModule, log = ref.log, merge = ref.merge, mergeInto = ref.mergeInto, deepMerge = ref.deepMerge;
193
194BaseObject = __webpack_require__(/*! art-class-system */ 9).BaseObject;
195
196ConfigRegistry = __webpack_require__(/*! ./ConfigRegistry */ 10);
197
198defineModule(module, Configuration = (function(superClass) {
199 extend(Configuration, superClass);
200
201 function Configuration() {
202 return Configuration.__super__.constructor.apply(this, arguments);
203 }
204
205 Configuration.abstractClass();
206
207 Configuration.register = function() {
208 return ConfigRegistry.registerConfig(this.getName(), this.getProps());
209 };
210
211 Configuration.postCreateConcreteClass = function(arg) {
212 var hotReloaded, superclass;
213 hotReloaded = arg.hotReloaded;
214 if (superclass = this.getSuperclass()) {
215 this.deepMergeInDefaults(superclass.getConcretePrototypeProperties());
216 }
217 this.register();
218 if (hotReloaded) {
219 ConfigRegistry.reload();
220 }
221 return Configuration.__super__.constructor.postCreateConcreteClass.apply(this, arguments);
222 };
223
224 Configuration.getProps = function() {
225 return this.getConcretePrototypeProperties();
226 };
227
228 Configuration.deepMergeInDefaults = function(defaults) {
229 return mergeInto(this.prototype, deepMerge(defaults, this.getProps()));
230 };
231
232 Configuration.deepMergeInConfig = function(config) {
233 return mergeInto(this.prototype, deepMerge(this.getProps(), config));
234 };
235
236 return Configuration;
237
238})(BaseObject));
239
240/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ 7)(module)))
241
242/***/ }),
243/* 7 */
244/*!***********************************!*\
245 !*** (webpack)/buildin/module.js ***!
246 \***********************************/
247/*! no static exports found */
248/***/ (function(module, exports) {
249
250module.exports = function(module) {
251 if (!module.webpackPolyfill) {
252 module.deprecate = function() {};
253 module.paths = [];
254 // module.parent = undefined by default
255 if (!module.children) module.children = [];
256 Object.defineProperty(module, "loaded", {
257 enumerable: true,
258 get: function() {
259 return module.l;
260 }
261 });
262 Object.defineProperty(module, "id", {
263 enumerable: true,
264 get: function() {
265 return module.i;
266 }
267 });
268 module.webpackPolyfill = 1;
269 }
270 return module;
271};
272
273
274/***/ }),
275/* 8 */
276/*!***********************************************************************************!*\
277 !*** external "require('art-standard-lib' /* ABC - not inlining fellow NPM *_/)" ***!
278 \***********************************************************************************/
279/*! no static exports found */
280/***/ (function(module, exports) {
281
282module.exports = require('art-standard-lib' /* ABC - not inlining fellow NPM */);
283
284/***/ }),
285/* 9 */
286/*!***********************************************************************************!*\
287 !*** external "require('art-class-system' /* ABC - not inlining fellow NPM *_/)" ***!
288 \***********************************************************************************/
289/*! no static exports found */
290/***/ (function(module, exports) {
291
292module.exports = require('art-class-system' /* ABC - not inlining fellow NPM */);
293
294/***/ }),
295/* 10 */
296/*!*************************************************!*\
297 !*** ./source/Art.Config/ConfigRegistry.coffee ***!
298 \*************************************************/
299/*! no static exports found */
300/***/ (function(module, exports, __webpack_require__) {
301
302/* WEBPACK VAR INJECTION */(function(module) {var BaseObject, ConfigRegistry, Promise, clone, compactFlatten, deepMerge, defineModule, expandPathedProperties, formattedInspect, inspect, isPlainObject, isString, log, merge, mergeInto, parseQuery, pushIfNotPresent, ref, upperCamelCase,
303 extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
304 hasProp = {}.hasOwnProperty,
305 slice = [].slice;
306
307ref = __webpack_require__(/*! art-standard-lib */ 8), defineModule = ref.defineModule, log = ref.log, Promise = ref.Promise, inspect = ref.inspect, formattedInspect = ref.formattedInspect, merge = ref.merge, deepMerge = ref.deepMerge, mergeInto = ref.mergeInto, parseQuery = ref.parseQuery, pushIfNotPresent = ref.pushIfNotPresent, isPlainObject = ref.isPlainObject, isString = ref.isString, upperCamelCase = ref.upperCamelCase, expandPathedProperties = ref.expandPathedProperties, clone = ref.clone, compactFlatten = ref.compactFlatten;
308
309BaseObject = __webpack_require__(/*! art-class-system */ 9).BaseObject;
310
311defineModule(module, ConfigRegistry = (function(superClass) {
312 extend(ConfigRegistry, superClass);
313
314 function ConfigRegistry() {
315 return ConfigRegistry.__super__.constructor.apply(this, arguments);
316 }
317
318 ConfigRegistry.configurables = [];
319
320 ConfigRegistry.configs = {};
321
322 ConfigRegistry.registerConfig = function(name, config) {
323 if (!isPlainObject(config)) {
324 throw new Error("config must be a plain object");
325 }
326 return ConfigRegistry.configs[name] = config;
327 };
328
329 ConfigRegistry.registerConfigurable = function(configurable) {
330 return pushIfNotPresent(ConfigRegistry.configurables, configurable);
331 };
332
333 ConfigRegistry.configure = function() {
334 var args, ref1;
335 args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
336 console.error("DEPRICATED: use Art.Config.configure");
337 return (ref1 = Neptune.Art.Config).configure.apply(ref1, args);
338 };
339
340 return ConfigRegistry;
341
342})(BaseObject));
343
344/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ 7)(module)))
345
346/***/ }),
347/* 11 */
348/*!***************************************!*\
349 !*** ./source/Art.Config/Main.coffee ***!
350 \***************************************/
351/*! no static exports found */
352/***/ (function(module, exports, __webpack_require__) {
353
354/* WEBPACK VAR INJECTION */(function(module) {var ConfigRegistry, Main, Promise, clone, compactFlatten, deepMerge, defineModule, expandPathedProperties, formattedInspect, getExternalEnvironment, inspect, isPlainObject, isString, log, merge, mergeInto, normalizeArtConfigName, parseQuery, pushIfNotPresent, ref, ref1, upperCamelCase,
355 slice = [].slice;
356
357ref = __webpack_require__(/*! art-standard-lib */ 8), defineModule = ref.defineModule, log = ref.log, Promise = ref.Promise, inspect = ref.inspect, formattedInspect = ref.formattedInspect, merge = ref.merge, deepMerge = ref.deepMerge, mergeInto = ref.mergeInto, parseQuery = ref.parseQuery, pushIfNotPresent = ref.pushIfNotPresent, isPlainObject = ref.isPlainObject, isString = ref.isString, upperCamelCase = ref.upperCamelCase, expandPathedProperties = ref.expandPathedProperties, clone = ref.clone, compactFlatten = ref.compactFlatten;
358
359ConfigRegistry = __webpack_require__(/*! ./ConfigRegistry */ 10);
360
361ref1 = __webpack_require__(/*! ./Lib */ 12), normalizeArtConfigName = ref1.normalizeArtConfigName, getExternalEnvironment = ref1.getExternalEnvironment;
362
363defineModule(module, Main = (function() {
364 var getArtConfig, getArtConfigName, getDefaultArtConfigName, setArtConfigName;
365
366 function Main() {}
367
368 Main.getArtConfigName = getArtConfigName = function() {
369 return Neptune.Art.Config.configName;
370 };
371
372 Main.getArtConfig = getArtConfig = function() {
373 return Neptune.Art.Config.config;
374 };
375
376 Main.getDefaultArtConfigName = getDefaultArtConfigName = function() {
377 return Neptune.Art.Config.defaultArtConfigName;
378 };
379
380
381 /* getArtConfigSave
382 OUT: artConfig, but only the non-default values
383 */
384
385 Main.getArtConfigSave = function() {
386 var configurable, i, len, out, ref2, saveConfig;
387 out = {};
388 ref2 = ConfigRegistry.configurables;
389 for (i = 0, len = ref2.length; i < len; i++) {
390 configurable = ref2[i];
391 if (saveConfig = configurable.getConfigSave()) {
392 mergeInto(out, saveConfig);
393 }
394 }
395 return out;
396 };
397
398 setArtConfigName = function(name) {
399 return Neptune.Art.Config.configName = name;
400 };
401
402
403 /*
404 IN: configureOptions:
405 artConfigName: string
406 can be passed in:
407 as an argument
408 via process.env
409 via the browser query string
410
411 default: "Development"
412
413 EFFECT:
414 ArtConfig.configName =
415 externalEnvironment.artConfigName ||
416 artConfigName
417
418 artConfig: JSON string OR plain object structure
419 can be passed in:
420 as an argument
421 via process.env
422 via the browser query string
423
424 default: {}
425
426 EFFECT:
427 mergeInto ArtConfig.config, deepMerge
428 ConfigRegistry.configs[artConfigName]
429 global.artConfig
430 artConfig
431 externalEnvironment.artConfig
432
433 onConfig: (config) ->
434 gets called as soon as config completes with the final config
435
436 EFFECTS:
437 callback @artConfig for callback in ConfigRegistry.configurables
438
439 Note the priority order of artConfig sources:
440
441 Priority:
442 #1. externalEnvironment.artConfig
443 #2. the artConfig passed into configure
444
445
446 EXAMPLES:
447 * artConfig = verbose: true
448 ConfigRegistry.configure
449 verbose: true
450
451 * artConfig = verbose: true
452 * artConfigName = "Production"
453 ConfigRegistry.configure
454 artConfigName: "Production"
455 verbose: true
456
457 * artConfig = verbose: true
458 * artConfigName = "Production"
459 ConfigRegistry.configure
460 artConfigName: "Production"
461 artConfig: verbose: true
462
463 TEST INPUTS: the second and third inputs are env and
464 queryString, and are only there as mocks for testing.
465 */
466
467 Main.configure = function() {
468 var __testEnv, artConfigArgument, artConfigNameArgument, c, conf, config, configName, configurable, configureOptions, defaultArtConfigName, externalEnvironment, i, len, obj, onConfig, ref2, ref3, ref4, verbose;
469 configureOptions = 1 <= arguments.length ? slice.call(arguments, 0) : [];
470 ref2 = Main.configureOptions = deepMerge.apply(null, configureOptions), artConfigNameArgument = ref2.artConfigName, artConfigArgument = ref2.artConfig, __testEnv = ref2.__testEnv, onConfig = ref2.onConfig;
471 externalEnvironment = getExternalEnvironment(__testEnv);
472 config = getArtConfig();
473 defaultArtConfigName = getDefaultArtConfigName();
474 configName = normalizeArtConfigName(externalEnvironment.artConfigName || artConfigNameArgument || global.artConfigName) ? (configName = normalizeArtConfigName(externalEnvironment.artConfigName || artConfigNameArgument || global.artConfigName), configName && !ConfigRegistry.configs[configName] ? log.warn("ArtConfig.configure: no config registered with name: '" + configName + "'") : void 0, configName) : defaultArtConfigName;
475 setArtConfigName(configName);
476 Main.resetCurrentConfig();
477 ref3 = compactFlatten([
478 (function() {
479 var j, len, ref3, results;
480 ref3 = ConfigRegistry.configurables;
481 results = [];
482 for (j = 0, len = ref3.length; j < len; j++) {
483 configurable = ref3[j];
484 results.push(configurable.getPathedDefaultConfig());
485 }
486 return results;
487 })(), ConfigRegistry.configs[configName], global.artConfig, artConfigArgument, externalEnvironment.artConfig
488 ]);
489 for (i = 0, len = ref3.length; i < len; i++) {
490 conf = ref3[i];
491 expandPathedProperties(conf, config);
492 }
493 verbose = config.verbose;
494 verbose || (verbose = (ref4 = Main.configureOptions) != null ? ref4.verbose : void 0);
495 if (verbose) {
496 log("------------- ConfigRegistry: inputs");
497 log({
498 ConfigRegistry: {
499 configNames: Object.keys(ConfigRegistry.configs),
500 configurables: (function() {
501 var j, len1, ref5, results;
502 ref5 = ConfigRegistry.configurables;
503 results = [];
504 for (j = 0, len1 = ref5.length; j < len1; j++) {
505 c = ref5[j];
506 results.push(c.namespacePath);
507 }
508 return results;
509 })(),
510 setConfigName: {
511 algorithm: "select LAST non-null",
512 inputs: {
513 defaultArtConfigName: defaultArtConfigName,
514 "global.artConfigName": global.artConfigName,
515 "arguments.artConfigName": artConfigNameArgument,
516 "environment.artConfigName": externalEnvironment.artConfigName
517 }
518 },
519 setConfig: {
520 algorithm: "deep, pathed merge-all, LAST has priority",
521 inputs: (
522 obj = {
523 defaultConfigs: (function() {
524 var j, len1, ref5, results;
525 ref5 = ConfigRegistry.configurables;
526 results = [];
527 for (j = 0, len1 = ref5.length; j < len1; j++) {
528 configurable = ref5[j];
529 results.push(configurable.getPathedDefaultConfig());
530 }
531 return results;
532 })()
533 },
534 obj["configs." + configName] = ConfigRegistry.configs[configName],
535 obj["global.artConfig"] = global.artConfig,
536 obj["arguments.artConfig"] = artConfigArgument,
537 obj["environment.artConfig"] = externalEnvironment.artConfig,
538 obj
539 )
540 }
541 }
542 });
543 log("------------- ConfigRegistry: configuring Configurables...");
544 }
545 Main._configureAllConfigurables();
546 if (verbose) {
547 log("------------- ConfigRegistry: configured");
548 log({
549 Art: {
550 configName: configName,
551 config: config
552 }
553 });
554 log("------------- ConfigRegistry: done");
555 }
556 if (typeof onConfig === "function") {
557 onConfig(config);
558 }
559 global.artConfig = config;
560 global.artConfigName = configName;
561 return config;
562 };
563
564 Main.resetCurrentConfig = function() {
565 var config, k, results, v;
566 config = getArtConfig();
567 results = [];
568 for (k in config) {
569 v = config[k];
570 results.push(delete config[k]);
571 }
572 return results;
573 };
574
575 Main.reload = function() {
576 return Main.configure(Main.configureOptions);
577 };
578
579 Main._configureAllConfigurables = function() {
580 var configurable, i, len, ref2;
581 ref2 = ConfigRegistry.configurables;
582 for (i = 0, len = ref2.length; i < len; i++) {
583 configurable = ref2[i];
584 configurable.configure(getArtConfig());
585 }
586 return this._notifyConfigurablesConfigured();
587 };
588
589 Main._notifyConfigurablesConfigured = function() {
590 var configurable, i, len, ref2, results;
591 ref2 = ConfigRegistry.configurables;
592 results = [];
593 for (i = 0, len = ref2.length; i < len; i++) {
594 configurable = ref2[i];
595 results.push(configurable.configured());
596 }
597 return results;
598 };
599
600 return Main;
601
602})());
603
604/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ 7)(module)))
605
606/***/ }),
607/* 12 */
608/*!**************************************!*\
609 !*** ./source/Art.Config/Lib.coffee ***!
610 \**************************************/
611/*! no static exports found */
612/***/ (function(module, exports, __webpack_require__) {
613
614/* WEBPACK VAR INJECTION */(function(module) {var Lib, Promise, clone, compactFlatten, deepMerge, defineModule, expandPathedProperties, formattedInspect, getEnv, inspect, isPlainObject, isString, jsonParsableRegexp, log, merge, mergeInto, parseQuery, pushIfNotPresent, ref, upperCamelCase;
615
616ref = __webpack_require__(/*! art-standard-lib */ 8), defineModule = ref.defineModule, log = ref.log, Promise = ref.Promise, inspect = ref.inspect, formattedInspect = ref.formattedInspect, merge = ref.merge, deepMerge = ref.deepMerge, mergeInto = ref.mergeInto, parseQuery = ref.parseQuery, pushIfNotPresent = ref.pushIfNotPresent, isPlainObject = ref.isPlainObject, isString = ref.isString, upperCamelCase = ref.upperCamelCase, expandPathedProperties = ref.expandPathedProperties, clone = ref.clone, compactFlatten = ref.compactFlatten, getEnv = ref.getEnv;
617
618jsonParsableRegexp = /^(\[.*\]|\{.*\}|\".*\"|((-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|true|false|null))$/;
619
620defineModule(module, Lib = (function() {
621 var smartJsonDecode;
622
623 function Lib() {}
624
625 Lib.smartJsonDecode = smartJsonDecode = function(value) {
626 if (isString(value) && jsonParsableRegexp.test(value)) {
627 return JSON.parse(value);
628 } else {
629 return value != null ? value : null;
630 }
631 };
632
633 Lib.getExternalEnvironment = function(externalEnvironment) {
634 var artConfig, artConfigName, e, k, m, v;
635 if (externalEnvironment == null) {
636 externalEnvironment = getEnv();
637 }
638 artConfig = externalEnvironment.artConfig, artConfigName = externalEnvironment.artConfigName;
639 artConfig = (function() {
640 if (isPlainObject(artConfig)) {
641 return artConfig;
642 } else if (isString(artConfig)) {
643 try {
644 return JSON.parse(artConfig);
645 } catch (error) {
646 e = error;
647 log.error("\nInvalid 'artConfig' from externalEnvironment. Must be valid JSON.\n\n" + (formattedInspect({
648 externalEnvironment: externalEnvironment
649 })) + "\n\nartConfig: " + (formattedInspect(artConfig)) + "\n\nerror: " + e + "\n");
650 return null;
651 }
652 } else {
653 return {};
654 }
655 })();
656 for (k in externalEnvironment) {
657 v = externalEnvironment[k];
658 if (m = k.match(/^artConfig([\._])(.+)$/)) {
659 if (m[1] === "_") {
660 artConfig[m[2].replace(/_/g, '.')] = smartJsonDecode(v);
661 } else {
662 artConfig[m[2]] = smartJsonDecode(v);
663 }
664 }
665 }
666 return {
667 artConfig: artConfig,
668 artConfigName: artConfigName
669 };
670 };
671
672
673 /*
674 normalized:
675 map standard aliases (dev and prod)
676 upperCamelCase
677 */
678
679 Lib.normalizeArtConfigName = function(artConfigName) {
680 switch (artConfigName) {
681 case "dev":
682 return "Development";
683 case "prod":
684 return "Production";
685 default:
686 return artConfigName && upperCamelCase(artConfigName);
687 }
688 };
689
690 return Lib;
691
692})());
693
694/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ 7)(module)))
695
696/***/ }),
697/* 13 */
698/*!***********************************************!*\
699 !*** ./source/Art.Config/Configurable.coffee ***!
700 \***********************************************/
701/*! no static exports found */
702/***/ (function(module, exports, __webpack_require__) {
703
704/* WEBPACK VAR INJECTION */(function(module) {var BaseClass, ConfigRegistry, Configurable, ErrorWithInfo, EventedMixin, deepMerge, defineModule, isPlainObject, log, merge, mergeInto, namespace, neq, ref,
705 extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
706 hasProp = {}.hasOwnProperty,
707 slice = [].slice;
708
709ref = __webpack_require__(/*! art-standard-lib */ 8), defineModule = ref.defineModule, log = ref.log, merge = ref.merge, isPlainObject = ref.isPlainObject, mergeInto = ref.mergeInto, deepMerge = ref.deepMerge, isPlainObject = ref.isPlainObject, ErrorWithInfo = ref.ErrorWithInfo, neq = ref.neq;
710
711BaseClass = __webpack_require__(/*! art-class-system */ 9).BaseClass;
712
713namespace = __webpack_require__(/*! ./namespace */ 2);
714
715ConfigRegistry = __webpack_require__(/*! ./ConfigRegistry */ 10);
716
717EventedMixin = __webpack_require__(/*! art-events */ 14).EventedMixin;
718
719
720/*
721
722TO USE:
7231) Inherit from Configurable and
7242) OPTIONAL: call @defaults to set configuration defaults
7253) OPTIONAL, override one of:
726 @configure
727 @preprocessConfig
728 @configured
729 */
730
731defineModule(module, Configurable = (function(superClass) {
732 extend(Configurable, superClass);
733
734 function Configurable() {
735 return Configurable.__super__.constructor.apply(this, arguments);
736 }
737
738 Configurable.abstractClass();
739
740 Configurable.declarable({
741 defaults: {}
742 });
743
744 Configurable.getDefaultConfig = function() {
745 return this.getDefaults();
746 };
747
748 Configurable.extendConfig = function() {
749 if (this.hasOwnProperty("config")) {
750 return this.config;
751 } else {
752 return this.config = {};
753 }
754 };
755
756 Configurable.reset = function() {
757 var config, defaults, k, ref1, v;
758 defaults = this.getDefaults();
759 config = this.extendConfig();
760 for (k in config) {
761 v = config[k];
762 if (defaults[k] == null) {
763 delete config[k];
764 }
765 }
766 mergeInto(config, defaults);
767 if (this.namespace !== namespace) {
768 if ((ref1 = this.namespace) != null) {
769 ref1.config || (ref1.config = config);
770 }
771 }
772 return config;
773 };
774
775 Configurable.getInspectedObjects = function() {
776 var obj;
777 return (
778 obj = {},
779 obj["" + (this.getConfigurationPathString())] = this.config,
780 obj
781 );
782 };
783
784 Configurable.getPathedDefaultConfig = function() {
785 var obj;
786 return (
787 obj = {},
788 obj["" + (this.getConfigurationPathString())] = this.getDefaults(),
789 obj
790 );
791 };
792
793 Configurable.configure = function(globalConfig) {
794 var obj;
795 globalConfig.verbose && log({
796 Configurable: (
797 obj = {},
798 obj["" + (this.getConfigurationPathString())] = this.getConfigurationFromPath(globalConfig),
799 obj
800 )
801 });
802 return mergeInto(this.reset(), this.getConfigurationFromPath(globalConfig));
803 };
804
805 Configurable.getConfigSave = function() {
806 var count, defaults, k, obj, out, ref1, ref2, v;
807 out = {};
808 defaults = this.getDefaults();
809 count = 0;
810 ref2 = (ref1 = this.config) != null ? ref1 : {};
811 for (k in ref2) {
812 v = ref2[k];
813 if (!(neq(v, defaults[k]))) {
814 continue;
815 }
816 count++;
817 out[k] = v;
818 }
819 if (count > 0) {
820 return (
821 obj = {},
822 obj["" + (this.getConfigurationPathString())] = out,
823 obj
824 );
825 }
826 };
827
828 Configurable.on = function() {
829 var a, ref1;
830 a = 1 <= arguments.length ? slice.call(arguments, 0) : [];
831 return (ref1 = this.getSingleton()).on.apply(ref1, a);
832 };
833
834 Configurable.configured = function() {
835 return this.getSingleton().handleEvent("configured", {
836 config: this.config
837 });
838 };
839
840 Configurable.getConfigurationPath = function() {
841 var _Configurable, _Neptune, i, path, ref1;
842 ref1 = this.getNamespacePath().split('.'), _Neptune = ref1[0], path = 3 <= ref1.length ? slice.call(ref1, 1, i = ref1.length - 1) : (i = 1, []), _Configurable = ref1[i++];
843 return path;
844 };
845
846 Configurable.getConfigurationPathString = function() {
847 return this.getConfigurationPath().join('.');
848 };
849
850 Configurable.getConfigurationFromPath = function(config, path) {
851 var el, i, len;
852 if (path == null) {
853 path = this.getConfigurationPath();
854 }
855 for (i = 0, len = path.length; i < len; i++) {
856 el = path[i];
857 config = config != null ? config[el] : void 0;
858 }
859 return config;
860 };
861
862 Configurable._register = function() {
863 this.reset();
864 return ConfigRegistry.registerConfigurable(this);
865 };
866
867 Configurable.postCreateConcreteClass = function(arg) {
868 var hotReloaded;
869 hotReloaded = arg.hotReloaded;
870 if (hotReloaded) {
871 ConfigRegistry.reload();
872 } else {
873 this._register();
874 }
875 return Configurable.__super__.constructor.postCreateConcreteClass.apply(this, arguments);
876 };
877
878 return Configurable;
879
880})(EventedMixin(BaseClass)));
881
882/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ 7)(module)))
883
884/***/ }),
885/* 14 */
886/*!*****************************************************************************!*\
887 !*** external "require('art-events' /* ABC - not inlining fellow NPM *_/)" ***!
888 \*****************************************************************************/
889/*! no static exports found */
890/***/ (function(module, exports) {
891
892module.exports = require('art-events' /* ABC - not inlining fellow NPM */);
893
894/***/ })
895/******/ ]);
\No newline at end of file