UNPKG

22.3 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/******/ // identity function for calling harmony imports with the correct context
38/******/ __webpack_require__.i = function(value) { return value; };
39/******/
40/******/ // define getter function for harmony exports
41/******/ __webpack_require__.d = function(exports, name, getter) {
42/******/ if(!__webpack_require__.o(exports, name)) {
43/******/ Object.defineProperty(exports, name, {
44/******/ configurable: false,
45/******/ enumerable: true,
46/******/ get: getter
47/******/ });
48/******/ }
49/******/ };
50/******/
51/******/ // getDefaultExport function for compatibility with non-harmony modules
52/******/ __webpack_require__.n = function(module) {
53/******/ var getter = module && module.__esModule ?
54/******/ function getDefault() { return module['default']; } :
55/******/ function getModuleExports() { return module; };
56/******/ __webpack_require__.d(getter, 'a', getter);
57/******/ return getter;
58/******/ };
59/******/
60/******/ // Object.prototype.hasOwnProperty.call
61/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
62/******/
63/******/ // __webpack_public_path__
64/******/ __webpack_require__.p = "";
65/******/
66/******/ // Load entry module and return exports
67/******/ return __webpack_require__(__webpack_require__.s = 6);
68/******/ })
69/************************************************************************/
70/******/ ([
71/* 0 */
72/***/ (function(module, exports, __webpack_require__) {
73
74/* 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,
75 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; },
76 hasProp = {}.hasOwnProperty,
77 slice = [].slice;
78
79ref = __webpack_require__(3), 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;
80
81BaseObject = __webpack_require__(2).BaseObject;
82
83defineModule(module, ConfigRegistry = (function(superClass) {
84 var defaultArtConfigName;
85
86 extend(ConfigRegistry, superClass);
87
88 function ConfigRegistry() {
89 return ConfigRegistry.__super__.constructor.apply(this, arguments);
90 }
91
92 ConfigRegistry.artConfigName = defaultArtConfigName = "Development";
93
94 ConfigRegistry.artConfig = {};
95
96 ConfigRegistry.configurables = [];
97
98 ConfigRegistry.configs = {};
99
100 ConfigRegistry.registerConfig = function(name, config) {
101 if (!isPlainObject(config)) {
102 throw new Error("config must be a plain object");
103 }
104 return ConfigRegistry.configs[name] = config;
105 };
106
107 ConfigRegistry.registerConfigurable = function(configurable) {
108 return pushIfNotPresent(ConfigRegistry.configurables, configurable);
109 };
110
111
112 /*
113 IN: configureOptions:
114 artConfigName: string
115 can be passed in:
116 as an argument
117 via process.env
118 via the browser query string
119
120 default: "Development"
121
122 EFFECT:
123 @artConfigName =
124 externalEnvironment.artConfigName ||
125 artConfigName
126
127 artConfig: JSON string OR plain object structure
128 can be passed in:
129 as an argument
130 via process.env
131 via the browser query string
132
133 default: {}
134
135 EFFECT:
136 mergeInto @artConfig, deepMerge
137 @configs[artConfigName]
138 global.artConfig
139 artConfig
140 externalEnvironment.artConfig
141
142 EFFECTS:
143 callback @artConfig for callback in @configurables
144
145 Note the priority order of artConfig sources:
146
147 Priority:
148 #1. externalEnvironment.artConfig
149 #2. the artConfig passed into configure
150
151
152 EXAMPLES:
153 * artConfig = verbose: true
154 ConfigRegistry.configure
155 verbose: true
156
157 * artConfig = verbose: true
158 * artConfigName = "Production"
159 ConfigRegistry.configure
160 artConfigName: "Production"
161 verbose: true
162
163 * artConfig = verbose: true
164 * artConfigName = "Production"
165 ConfigRegistry.configure
166 artConfigName: "Production"
167 artConfig: verbose: true
168
169 TEST INPUTS: the second and third inputs are env and
170 queryString, and are only there as mocks for testing.
171 */
172
173 ConfigRegistry.configure = function() {
174 var __testEnv, __testQueryString, artConfigArgument, artConfigNameArgument, c, conf, configurable, configureOptions, externalEnvironment, i, len, obj, ref1, ref2, verbose;
175 configureOptions = 1 <= arguments.length ? slice.call(arguments, 0) : [];
176 ref1 = ConfigRegistry.configureOptions = deepMerge.apply(null, configureOptions), artConfigNameArgument = ref1.artConfigName, artConfigArgument = ref1.artConfig, __testEnv = ref1.__testEnv, __testQueryString = ref1.__testQueryString;
177 externalEnvironment = ConfigRegistry.getExternalEnvironment(__testEnv, __testQueryString);
178 ConfigRegistry.artConfigName = externalEnvironment.artConfigName || artConfigNameArgument || global.artConfigName;
179 ConfigRegistry.artConfigName = ConfigRegistry.normalizeArtConfigName(ConfigRegistry.artConfigName);
180 if (ConfigRegistry.artConfigName && !ConfigRegistry.configs[ConfigRegistry.artConfigName]) {
181 throw new Error("no config registered with name: " + ConfigRegistry.artConfigName);
182 }
183 ConfigRegistry.artConfigName || (ConfigRegistry.artConfigName = defaultArtConfigName);
184 Neptune.Art.configName = ConfigRegistry.artConfigName;
185 Neptune.Art.config = ConfigRegistry.artConfig;
186 ConfigRegistry.resetCurrentConfig();
187 ref2 = compactFlatten([
188 (function() {
189 var j, len, ref2, results;
190 ref2 = this.configurables;
191 results = [];
192 for (j = 0, len = ref2.length; j < len; j++) {
193 configurable = ref2[j];
194 results.push(configurable.getPathedDefaultConfig());
195 }
196 return results;
197 }).call(ConfigRegistry), ConfigRegistry.configs[ConfigRegistry.artConfigName], global.artConfig, artConfigArgument, externalEnvironment.artConfig
198 ]);
199 for (i = 0, len = ref2.length; i < len; i++) {
200 conf = ref2[i];
201 expandPathedProperties(conf, ConfigRegistry.artConfig);
202 }
203 verbose = ConfigRegistry.artConfig.verbose;
204 if (verbose) {
205 log("------------- ConfigRegistry: inputs");
206 log({
207 ConfigRegistry: {
208 configNames: Object.keys(ConfigRegistry.configs),
209 configurables: (function() {
210 var j, len1, ref3, results;
211 ref3 = this.configurables;
212 results = [];
213 for (j = 0, len1 = ref3.length; j < len1; j++) {
214 c = ref3[j];
215 results.push(c.namespacePath);
216 }
217 return results;
218 }).call(ConfigRegistry),
219 setConfigName: {
220 algorithm: "select LAST non-null",
221 inputs: {
222 defaultArtConfigName: defaultArtConfigName,
223 "global.artConfigName": global.artConfigName,
224 "arguments.artConfigName": artConfigNameArgument,
225 "environment.artConfigName": externalEnvironment.artConfigName
226 }
227 },
228 setConfig: {
229 algorithm: "deep, pathed merge-all, LAST has priority",
230 inputs: (
231 obj = {
232 defaultConfigs: (function() {
233 var j, len1, ref3, results;
234 ref3 = this.configurables;
235 results = [];
236 for (j = 0, len1 = ref3.length; j < len1; j++) {
237 configurable = ref3[j];
238 results.push(configurable.getPathedDefaultConfig());
239 }
240 return results;
241 }).call(ConfigRegistry)
242 },
243 obj["configs." + ConfigRegistry.artConfigName] = ConfigRegistry.configs[ConfigRegistry.artConfigName],
244 obj["global.artConfig"] = global.artConfig,
245 obj["arguments.artConfig"] = artConfigArgument,
246 obj["environment.artConfig"] = externalEnvironment.artConfig,
247 obj
248 )
249 }
250 }
251 });
252 }
253 verbose && log("------------- ConfigRegistry: configuring Configurables...");
254 ConfigRegistry._configureAllConfigurables();
255 verbose && log("------------- ConfigRegistry: configured");
256 verbose && log({
257 Art: {
258 configName: ConfigRegistry.artConfigName,
259 config: ConfigRegistry.artConfig
260 }
261 });
262 return verbose && log("------------- ConfigRegistry: done");
263 };
264
265 ConfigRegistry.resetCurrentConfig = function() {
266 var k, ref1, results, v;
267 ref1 = ConfigRegistry.artConfig;
268 results = [];
269 for (k in ref1) {
270 v = ref1[k];
271 results.push(delete ConfigRegistry.artConfig[k]);
272 }
273 return results;
274 };
275
276 ConfigRegistry.reload = function() {
277 return ConfigRegistry.configure(ConfigRegistry.configureOptions);
278 };
279
280 ConfigRegistry.getExternalEnvironment = function(env, queryString) {
281 var artConfig, artConfigName, e, externalEnvironment, ref1, ref2, ref3;
282 if (env == null) {
283 env = (ref1 = global.process) != null ? ref1.env : void 0;
284 }
285 if (queryString == null) {
286 queryString = (ref2 = global.location) != null ? ref2.search : void 0;
287 }
288 ref3 = externalEnvironment = merge(env, parseQuery(queryString)), artConfig = ref3.artConfig, artConfigName = ref3.artConfigName;
289 artConfig = (function() {
290 if (isPlainObject(artConfig)) {
291 return artConfig;
292 } else if (isString(artConfig)) {
293 try {
294 return JSON.parse(artConfig);
295 } catch (error) {
296 e = error;
297 log.error("\nInvalid 'artConfig' from externalEnvironment. Must be valid JSON.\n\n" + (formattedInspect({
298 externalEnvironment: externalEnvironment
299 })) + "\n\nartConfig: " + (formattedInspect(artConfig)) + "\n\nerror: " + e + "\n");
300 return null;
301 }
302 }
303 })();
304 return {
305 artConfig: artConfig,
306 artConfigName: artConfigName
307 };
308 };
309
310
311 /*
312 normalized:
313 map standard aliases (dev and prod)
314 upperCamelCase
315 */
316
317 ConfigRegistry.normalizeArtConfigName = function(artConfigName) {
318 switch (artConfigName) {
319 case "dev":
320 return "Development";
321 case "prod":
322 return "Production";
323 default:
324 return artConfigName && upperCamelCase(artConfigName);
325 }
326 };
327
328 ConfigRegistry._configureAllConfigurables = function() {
329 var configurable, i, len, ref1;
330 ref1 = this.configurables;
331 for (i = 0, len = ref1.length; i < len; i++) {
332 configurable = ref1[i];
333 configurable.configure(this.artConfig);
334 }
335 return this._notifyConfigurablesConfigured();
336 };
337
338 ConfigRegistry._notifyConfigurablesConfigured = function() {
339 var configurable, i, len, ref1, results;
340 ref1 = this.configurables;
341 results = [];
342 for (i = 0, len = ref1.length; i < len; i++) {
343 configurable = ref1[i];
344 results.push(configurable.configured());
345 }
346 return results;
347 };
348
349 return ConfigRegistry;
350
351})(BaseObject));
352
353/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)(module)))
354
355/***/ }),
356/* 1 */
357/***/ (function(module, exports) {
358
359module.exports = function(module) {
360 if(!module.webpackPolyfill) {
361 module.deprecate = function() {};
362 module.paths = [];
363 // module.parent = undefined by default
364 if(!module.children) module.children = [];
365 Object.defineProperty(module, "loaded", {
366 enumerable: true,
367 get: function() {
368 return module.l;
369 }
370 });
371 Object.defineProperty(module, "id", {
372 enumerable: true,
373 get: function() {
374 return module.i;
375 }
376 });
377 module.webpackPolyfill = 1;
378 }
379 return module;
380};
381
382
383/***/ }),
384/* 2 */
385/***/ (function(module, exports) {
386
387module.exports = require("art-class-system");
388
389/***/ }),
390/* 3 */
391/***/ (function(module, exports) {
392
393module.exports = require("art-standard-lib");
394
395/***/ }),
396/* 4 */
397/***/ (function(module, exports, __webpack_require__) {
398
399/* WEBPACK VAR INJECTION */(function(module) {var BaseObject, ConfigRegistry, Configuration, defineModule, log, merge, ref,
400 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; },
401 hasProp = {}.hasOwnProperty;
402
403ref = __webpack_require__(3), defineModule = ref.defineModule, log = ref.log, merge = ref.merge;
404
405BaseObject = __webpack_require__(2).BaseObject;
406
407ConfigRegistry = __webpack_require__(0);
408
409defineModule(module, Configuration = (function(superClass) {
410 extend(Configuration, superClass);
411
412 function Configuration() {
413 return Configuration.__super__.constructor.apply(this, arguments);
414 }
415
416 Configuration.abstractClass();
417
418 Configuration.register = function() {
419 return ConfigRegistry.registerConfig(this.getName(), this.getProps());
420 };
421
422 Configuration.postCreateConcreteClass = function(arg) {
423 var hotReloaded;
424 hotReloaded = arg.hotReloaded;
425 this.register();
426 if (hotReloaded) {
427 ConfigRegistry.reload();
428 }
429 return Configuration.__super__.constructor.postCreateConcreteClass.apply(this, arguments);
430 };
431
432 Configuration.getProps = function() {
433 return this.getConcretePrototypeProperties();
434 };
435
436 return Configuration;
437
438})(BaseObject));
439
440/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)(module)))
441
442/***/ }),
443/* 5 */
444/***/ (function(module, exports, __webpack_require__) {
445
446module.exports = __webpack_require__(9);
447
448module.exports.includeInNamespace(__webpack_require__(7)).addModules({
449 ConfigRegistry: __webpack_require__(0),
450 Configurable: __webpack_require__(8),
451 Configuration: __webpack_require__(4)
452});
453
454
455/***/ }),
456/* 6 */
457/***/ (function(module, exports, __webpack_require__) {
458
459module.exports = __webpack_require__(5);
460
461
462/***/ }),
463/* 7 */
464/***/ (function(module, exports, __webpack_require__) {
465
466module.exports = [
467 {
468 Config: __webpack_require__(4)
469 }, [__webpack_require__(0), "configure"]
470];
471
472
473/***/ }),
474/* 8 */
475/***/ (function(module, exports, __webpack_require__) {
476
477/* WEBPACK VAR INJECTION */(function(module) {var BaseClass, ConfigRegistry, Configurable, EventedMixin, deepMerge, defineModule, isPlainObject, log, merge, mergeInto, ref,
478 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; },
479 hasProp = {}.hasOwnProperty,
480 slice = [].slice;
481
482ref = __webpack_require__(3), defineModule = ref.defineModule, log = ref.log, merge = ref.merge, isPlainObject = ref.isPlainObject, mergeInto = ref.mergeInto, deepMerge = ref.deepMerge, isPlainObject = ref.isPlainObject;
483
484BaseClass = __webpack_require__(2).BaseClass;
485
486ConfigRegistry = __webpack_require__(0);
487
488EventedMixin = __webpack_require__(11).EventedMixin;
489
490
491/*
492
493TO USE:
4941) Inherit from Configurable and
4952) OPTIONAL: call @defaults to set configuration defaults
4963) OPTIONAL, override one of:
497 @configure
498 @preprocessConfig
499 @configured
500 */
501
502defineModule(module, Configurable = (function(superClass) {
503 extend(Configurable, superClass);
504
505 function Configurable() {
506 return Configurable.__super__.constructor.apply(this, arguments);
507 }
508
509 Configurable.abstractClass();
510
511 Configurable.defaults = function() {
512 var defaults;
513 defaults = 1 <= arguments.length ? slice.call(arguments, 0) : [];
514 return this.defaultConfig = merge.apply(null, defaults);
515 };
516
517 Configurable.getDefaultConfig = function() {
518 return this.defaultConfig;
519 };
520
521 Configurable.reset = function() {
522 var k, ref1, ref2, v;
523 if (this.config) {
524 ref1 = this.config;
525 for (k in ref1) {
526 v = ref1[k];
527 delete this.config[k];
528 }
529 } else {
530 this.config = {};
531 }
532 if (this.defaultConfig) {
533 mergeInto(this.config, this.defaultConfig);
534 }
535 if ((ref2 = this.namespace) != null) {
536 ref2.config = this.config;
537 }
538 return this.config;
539 };
540
541 Configurable.getInspectedObjects = function() {
542 var obj;
543 return (
544 obj = {},
545 obj["" + (this.getConfigurationPath().join('.'))] = this.config,
546 obj
547 );
548 };
549
550 Configurable.getPathedDefaultConfig = function() {
551 var obj;
552 return (
553 obj = {},
554 obj["" + (this.getConfigurationPath().join('.'))] = this.getDefaultConfig(),
555 obj
556 );
557 };
558
559 Configurable.configure = function(globalConfig) {
560 this.reset();
561 return mergeInto(this.config, this.getConfigurationFromPath(globalConfig));
562 };
563
564 Configurable.on = function() {
565 var a, ref1;
566 a = 1 <= arguments.length ? slice.call(arguments, 0) : [];
567 return (ref1 = this.getSingleton()).on.apply(ref1, a);
568 };
569
570 Configurable.configured = function() {
571 return this.getSingleton().handleEvent("configured");
572 };
573
574 Configurable.getConfigurationPath = function() {
575 var _Configurable, _Neptune, i, path, ref1;
576 ref1 = this.getNamespacePath().split('.'), _Neptune = ref1[0], path = 3 <= ref1.length ? slice.call(ref1, 1, i = ref1.length - 1) : (i = 1, []), _Configurable = ref1[i++];
577 return path;
578 };
579
580 Configurable.getConfigurationFromPath = function(config, path) {
581 var el, i, len;
582 if (path == null) {
583 path = this.getConfigurationPath();
584 }
585 for (i = 0, len = path.length; i < len; i++) {
586 el = path[i];
587 config = config != null ? config[el] : void 0;
588 }
589 return config;
590 };
591
592 Configurable._register = function() {
593 this.reset();
594 return ConfigRegistry.registerConfigurable(this);
595 };
596
597 Configurable.postCreateConcreteClass = function(arg) {
598 var hotReloaded;
599 hotReloaded = arg.hotReloaded;
600 if (hotReloaded) {
601 ConfigRegistry.reload();
602 } else {
603 this._register();
604 }
605 return Configurable.__super__.constructor.postCreateConcreteClass.apply(this, arguments);
606 };
607
608 return Configurable;
609
610})(EventedMixin(BaseClass)));
611
612/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)(module)))
613
614/***/ }),
615/* 9 */
616/***/ (function(module, exports, __webpack_require__) {
617
618var Config,
619 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; },
620 hasProp = {}.hasOwnProperty;
621
622module.exports = (__webpack_require__(12)).addNamespace('Art.Config', Config = (function(superClass) {
623 extend(Config, superClass);
624
625 function Config() {
626 return Config.__super__.constructor.apply(this, arguments);
627 }
628
629 Config.version = __webpack_require__(10).version;
630
631 return Config;
632
633})(Neptune.PackageNamespace));
634
635
636/***/ }),
637/* 10 */
638/***/ (function(module, exports) {
639
640module.exports = {
641 "author": "Shane Brinkman-Davis Delamore, Imikimi LLC",
642 "dependencies": {
643 "art-build-configurator": "*",
644 "art-class-system": "*",
645 "art-config": "*",
646 "art-events": "*",
647 "art-standard-lib": "*",
648 "art-testbench": "*",
649 "bluebird": "^3.5.0",
650 "caffeine-script": "*",
651 "caffeine-script-runtime": "*",
652 "case-sensitive-paths-webpack-plugin": "^2.1.1",
653 "chai": "^4.0.1",
654 "coffee-loader": "^0.7.3",
655 "coffee-script": "^1.12.6",
656 "colors": "^1.1.2",
657 "commander": "^2.9.0",
658 "css-loader": "^0.28.4",
659 "dateformat": "^2.0.0",
660 "detect-node": "^2.0.3",
661 "fs-extra": "^3.0.1",
662 "glob": "^7.1.2",
663 "glob-promise": "^3.1.0",
664 "json-loader": "^0.5.4",
665 "mocha": "^3.4.2",
666 "neptune-namespaces": "*",
667 "script-loader": "^0.7.0",
668 "style-loader": "^0.18.1",
669 "webpack": "^2.6.1",
670 "webpack-dev-server": "^2.4.5",
671 "webpack-merge": "^4.1.0",
672 "webpack-node-externals": "^1.6.0"
673 },
674 "description": "A powerful yet simple tool for configuring all your libraries consistently.",
675 "license": "ISC",
676 "name": "art-config",
677 "scripts": {
678 "build": "webpack --progress",
679 "start": "webpack-dev-server --hot --inline --progress",
680 "test": "nn -s;mocha -u tdd --compilers coffee:coffee-script/register",
681 "testInBrowser": "webpack-dev-server --progress"
682 },
683 "version": "1.6.3"
684};
685
686/***/ }),
687/* 11 */
688/***/ (function(module, exports) {
689
690module.exports = require("art-events");
691
692/***/ }),
693/* 12 */
694/***/ (function(module, exports) {
695
696module.exports = require("neptune-namespaces");
697
698/***/ })
699/******/ ]);
\No newline at end of file