mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-09 20:30:43 +01:00
6ff1386460
Adds the `wp_set_script_translations` function which registers translations for a JavaScript file. This function takes a handle, domain and optionally a path and ensures JavaScript translation files are loaded if they exist. Props atimmer, omarreiss, nerrad, swissspidy, ocean90. Fixes #45103. Built from https://develop.svn.wordpress.org/branches/5.0@43825 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
32 KiB
Plaintext
1 line
32 KiB
Plaintext
{"version":3,"sources":["webpack://wp.[name]/webpack/bootstrap","webpack://wp.[name]/./packages/node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://wp.[name]/./packages/node_modules/is-promise/index.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/controls/async.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/controls/builtin.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/controls/wrap.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/create.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/index.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/utils/dispatcher.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/utils/helpers.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/utils/is.js","webpack://wp.[name]/./packages/node_modules/rungen/dist/utils/keys.js","webpack://wp.[name]/./packages/packages/redux-routine/src/cast-error.js","webpack://wp.[name]/./packages/packages/redux-routine/src/index.js","webpack://wp.[name]/./packages/packages/redux-routine/src/is-action.js","webpack://wp.[name]/./packages/packages/redux-routine/src/is-generator.js","webpack://wp.[name]/./packages/packages/redux-routine/src/runtime.js","webpack://wp.[name]/external \"lodash\""],"names":["castError","error","Error","createMiddleware","controls","store","runtime","createRuntime","dispatch","next","action","isGenerator","isAction","object","isPlainObject","isString","type","isActionOfType","expectedType","Symbol","toStringTag","rungenControls","map","control","actionType","value","iterate","yieldNext","yieldError","routine","isPromise","then","unhandledActionControl","push","rungenRuntime","create","Promise","resolve","reject","result"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAA,wBAAwB,2EAA2E,oCAAoC,mBAAmB,GAAG,EAAE,OAAO,oCAAoC,8HAA8H,GAAG,EAAE,sBAAsB;;AAEpV;AACf;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA,C;;;;;;;;;;;ACdA;;AAEA;AACA;AACA;;;;;;;;;;;;;ACJa;;AAEb;AACA;AACA,CAAC;AACD;;AAEA,UAAU,mBAAO,CAAC,oEAAa;;AAE/B;;AAEA,eAAe,mBAAO,CAAC,8EAAkB;;AAEzC,kBAAkB,mBAAO,CAAC,oFAAqB;;AAE/C;;AAEA,sCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO,IAAI;AACX;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,yD;;;;;;;;;;;;AClHa;;AAEb;AACA;AACA,CAAC;AACD;;AAEA,UAAU,mBAAO,CAAC,oEAAa;;AAE/B;;AAEA,sCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,wD;;;;;;;;;;;;AC7Fa;;AAEb;AACA;AACA,CAAC;AACD;;AAEA,UAAU,mBAAO,CAAC,oEAAa;;AAE/B;;AAEA,sCAAsC,uCAAuC,gBAAgB;;AAE7F,kCAAkC,0BAA0B,0CAA0C,gBAAgB,OAAO,kBAAkB,EAAE,aAAa,EAAE,OAAO,wBAAwB,EAAE;;AAEjM;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,4BAA4B;AAC5B,GAAG;AACH;AACA;;AAEA,8B;;;;;;;;;;;;ACnCa;;AAEb;AACA;AACA,CAAC;;AAED,eAAe,mBAAO,CAAC,mF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AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;;AAEA;AACA,wFAAwF,eAAe;AACvG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wFAAwF,eAAe;AACvG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wFAAwF,eAAe;AACvG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,E;;;;;;;;;;;;ACrIa;;AAEb;AACA;AACA,CAAC;;AAED,oGAAoG,mBAAmB,EAAE,mBAAmB,kGAAkG;;AAE9O,YAAY,mBAAO,CAAC,iEAAQ;;AAE5B;;AAEA,sCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA,qB;;;;;;;;;;;;ACzDa;;AAEb;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uB;;;;;;;;;;;;AChBA;AAAA;AAAA;;;;;;;AAOe,SAASA,SAAT,CAAoBC,KAApB,EAA4B;AAC1C,MAAK,EAAIA,KAAK,YAAYC,KAArB,CAAL,EAAoC;AACnCD,SAAK,GAAG,IAAIC,KAAJ,CAAWD,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AACA;;AACDF,eAAO,CAAEE,MAAF,CAAP;AACA,OALY,EAKVD,MALU,CADoB;AAAA,KAAb,CAAd;AAAA,GAAP;AAQA;;;;;;;;;;;;AC3DD,aAAa,iCAAiC,EAAE,I","file":"redux-routine.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./packages/packages/redux-routine/build-module/index.js\");\n","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nexport default function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}","module.exports = isPromise;\n\nfunction isPromise(obj) {\n return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';\n}\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.race = exports.join = exports.fork = exports.promise = undefined;\n\nvar _is = require('../utils/is');\n\nvar _is2 = _interopRequireDefault(_is);\n\nvar _helpers = require('../utils/helpers');\n\nvar _dispatcher = require('../utils/dispatcher');\n\nvar _dispatcher2 = _interopRequireDefault(_dispatcher);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar promise = exports.promise = function promise(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.promise(value)) return false;\n value.then(next, raiseNext);\n return true;\n};\n\nvar forkedTasks = new Map();\nvar fork = exports.fork = function fork(value, next, rungen) {\n if (!_is2.default.fork(value)) return false;\n var task = Symbol('fork');\n var dispatcher = (0, _dispatcher2.default)();\n forkedTasks.set(task, dispatcher);\n rungen(value.iterator.apply(null, value.args), function (result) {\n return dispatcher.dispatch(result);\n }, function (err) {\n return dispatcher.dispatch((0, _helpers.error)(err));\n });\n var unsubscribe = dispatcher.subscribe(function () {\n unsubscribe();\n forkedTasks.delete(task);\n });\n next(task);\n return true;\n};\n\nvar join = exports.join = function join(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.join(value)) return false;\n var dispatcher = forkedTasks.get(value.task);\n if (!dispatcher) {\n raiseNext('join error : task not found');\n } else {\n (function () {\n var unsubscribe = dispatcher.subscribe(function (result) {\n unsubscribe();\n next(result);\n });\n })();\n }\n return true;\n};\n\nvar race = exports.race = function race(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.race(value)) return false;\n var finished = false;\n var success = function success(result, k, v) {\n if (finished) return;\n finished = true;\n result[k] = v;\n next(result);\n };\n\n var fail = function fail(err) {\n if (finished) return;\n raiseNext(err);\n };\n if (_is2.default.array(value.competitors)) {\n (function () {\n var result = value.competitors.map(function () {\n return false;\n });\n value.competitors.forEach(function (competitor, index) {\n rungen(competitor, function (output) {\n return success(result, index, output);\n }, fail);\n });\n })();\n } else {\n (function () {\n var result = Object.keys(value.competitors).reduce(function (p, c) {\n p[c] = false;\n return p;\n }, {});\n Object.keys(value.competitors).forEach(function (index) {\n rungen(value.competitors[index], function (output) {\n return success(result, index, output);\n }, fail);\n });\n })();\n }\n return true;\n};\n\nvar subscribe = function subscribe(value, next) {\n if (!_is2.default.subscribe(value)) return false;\n if (!_is2.default.channel(value.channel)) {\n throw new Error('the first argument of \"subscribe\" must be a valid channel');\n }\n var unsubscribe = value.channel.subscribe(function (ret) {\n unsubscribe && unsubscribe();\n next(ret);\n });\n\n return true;\n};\n\nexports.default = [promise, fork, join, race, subscribe];","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.iterator = exports.array = exports.object = exports.error = exports.any = undefined;\n\nvar _is = require('../utils/is');\n\nvar _is2 = _interopRequireDefault(_is);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar any = exports.any = function any(value, next, rungen, yieldNext) {\n yieldNext(value);\n return true;\n};\n\nvar error = exports.error = function error(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.error(value)) return false;\n raiseNext(value.error);\n return true;\n};\n\nvar object = exports.object = function object(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.all(value) || !_is2.default.obj(value.value)) return false;\n var result = {};\n var keys = Object.keys(value.value);\n var count = 0;\n var hasError = false;\n var gotResultSuccess = function gotResultSuccess(key, ret) {\n if (hasError) return;\n result[key] = ret;\n count++;\n if (count === keys.length) {\n yieldNext(result);\n }\n };\n\n var gotResultError = function gotResultError(key, error) {\n if (hasError) return;\n hasError = true;\n raiseNext(error);\n };\n\n keys.map(function (key) {\n rungen(value.value[key], function (ret) {\n return gotResultSuccess(key, ret);\n }, function (err) {\n return gotResultError(key, err);\n });\n });\n\n return true;\n};\n\nvar array = exports.array = function array(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.all(value) || !_is2.default.array(value.value)) return false;\n var result = [];\n var count = 0;\n var hasError = false;\n var gotResultSuccess = function gotResultSuccess(key, ret) {\n if (hasError) return;\n result[key] = ret;\n count++;\n if (count === value.value.length) {\n yieldNext(result);\n }\n };\n\n var gotResultError = function gotResultError(key, error) {\n if (hasError) return;\n hasError = true;\n raiseNext(error);\n };\n\n value.value.map(function (v, key) {\n rungen(v, function (ret) {\n return gotResultSuccess(key, ret);\n }, function (err) {\n return gotResultError(key, err);\n });\n });\n\n return true;\n};\n\nvar iterator = exports.iterator = function iterator(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.iterator(value)) return false;\n rungen(value, next, raiseNext);\n return true;\n};\n\nexports.default = [error, iterator, array, object, any];","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.cps = exports.call = undefined;\n\nvar _is = require('../utils/is');\n\nvar _is2 = _interopRequireDefault(_is);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar call = exports.call = function call(value, next, rungen, yieldNext, raiseNext) {\n if (!_is2.default.call(value)) return false;\n try {\n next(value.func.apply(value.context, value.args));\n } catch (err) {\n raiseNext(err);\n }\n return true;\n};\n\nvar cps = exports.cps = function cps(value, next, rungen, yieldNext, raiseNext) {\n var _value$func;\n\n if (!_is2.default.cps(value)) return false;\n (_value$func = value.func).call.apply(_value$func, [null].concat(_toConsumableArray(value.args), [function (err, result) {\n if (err) raiseNext(err);else next(result);\n }]));\n return true;\n};\n\nexports.default = [call, cps];","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _builtin = require('./controls/builtin');\n\nvar _builtin2 = _interopRequireDefault(_builtin);\n\nvar _is = require('./utils/is');\n\nvar _is2 = _interopRequireDefault(_is);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar create = function create() {\n var userControls = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];\n\n var controls = [].concat(_toConsumableArray(userControls), _toConsumableArray(_builtin2.default));\n\n var runtime = function runtime(input) {\n var success = arguments.length <= 1 || arguments[1] === undefined ? function () {} : arguments[1];\n var error = arguments.length <= 2 || arguments[2] === undefined ? function () {} : arguments[2];\n\n var iterate = function iterate(gen) {\n var yieldValue = function yieldValue(isError) {\n return function (ret) {\n try {\n var _ref = isError ? gen.throw(ret) : gen.next(ret);\n\n var value = _ref.value;\n var done = _ref.done;\n\n if (done) return success(value);\n next(value);\n } catch (e) {\n return error(e);\n }\n };\n };\n\n var next = function next(ret) {\n controls.some(function (control) {\n return control(ret, next, runtime, yieldValue(false), yieldValue(true));\n });\n };\n\n yieldValue(false)();\n };\n\n var iterator = _is2.default.iterator(input) ? input : regeneratorRuntime.mark(function _callee() {\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return input;\n\n case 2:\n return _context.abrupt('return', _context.sent);\n\n case 3:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this);\n })();\n\n iterate(iterator, success, error);\n };\n\n return runtime;\n};\n\nexports.default = create;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.wrapControls = exports.asyncControls = exports.create = undefined;\n\nvar _helpers = require('./utils/helpers');\n\nObject.keys(_helpers).forEach(function (key) {\n if (key === \"default\") return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _helpers[key];\n }\n });\n});\n\nvar _create = require('./create');\n\nvar _create2 = _interopRequireDefault(_create);\n\nvar _async = require('./controls/async');\n\nvar _async2 = _interopRequireDefault(_async);\n\nvar _wrap = require('./controls/wrap');\n\nvar _wrap2 = _interopRequireDefault(_wrap);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.create = _create2.default;\nexports.asyncControls = _async2.default;\nexports.wrapControls = _wrap2.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar createDispatcher = function createDispatcher() {\n var listeners = [];\n\n return {\n subscribe: function subscribe(listener) {\n listeners.push(listener);\n return function () {\n listeners = listeners.filter(function (l) {\n return l !== listener;\n });\n };\n },\n dispatch: function dispatch(action) {\n listeners.slice().forEach(function (listener) {\n return listener(action);\n });\n }\n };\n};\n\nexports.default = createDispatcher;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createChannel = exports.subscribe = exports.cps = exports.apply = exports.call = exports.invoke = exports.delay = exports.race = exports.join = exports.fork = exports.error = exports.all = undefined;\n\nvar _keys = require('./keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar all = exports.all = function all(value) {\n return {\n type: _keys2.default.all,\n value: value\n };\n};\n\nvar error = exports.error = function error(err) {\n return {\n type: _keys2.default.error,\n error: err\n };\n};\n\nvar fork = exports.fork = function fork(iterator) {\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return {\n type: _keys2.default.fork,\n iterator: iterator,\n args: args\n };\n};\n\nvar join = exports.join = function join(task) {\n return {\n type: _keys2.default.join,\n task: task\n };\n};\n\nvar race = exports.race = function race(competitors) {\n return {\n type: _keys2.default.race,\n competitors: competitors\n };\n};\n\nvar delay = exports.delay = function delay(timeout) {\n return new Promise(function (resolve) {\n setTimeout(function () {\n return resolve(true);\n }, timeout);\n });\n};\n\nvar invoke = exports.invoke = function invoke(func) {\n for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n return {\n type: _keys2.default.call,\n func: func,\n context: null,\n args: args\n };\n};\n\nvar call = exports.call = function call(func, context) {\n for (var _len3 = arguments.length, args = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {\n args[_key3 - 2] = arguments[_key3];\n }\n\n return {\n type: _keys2.default.call,\n func: func,\n context: context,\n args: args\n };\n};\n\nvar apply = exports.apply = function apply(func, context, args) {\n return {\n type: _keys2.default.call,\n func: func,\n context: context,\n args: args\n };\n};\n\nvar cps = exports.cps = function cps(func) {\n for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n return {\n type: _keys2.default.cps,\n func: func,\n args: args\n };\n};\n\nvar subscribe = exports.subscribe = function subscribe(channel) {\n return {\n type: _keys2.default.subscribe,\n channel: channel\n };\n};\n\nvar createChannel = exports.createChannel = function createChannel(callback) {\n var listeners = [];\n var subscribe = function subscribe(l) {\n listeners.push(l);\n return function () {\n return listeners.splice(listeners.indexOf(l), 1);\n };\n };\n var next = function next(val) {\n return listeners.forEach(function (l) {\n return l(val);\n });\n };\n callback(next);\n\n return {\n subscribe: subscribe\n };\n};","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar _keys = require('./keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar is = {\n obj: function obj(value) {\n return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && !!value;\n },\n all: function all(value) {\n return is.obj(value) && value.type === _keys2.default.all;\n },\n error: function error(value) {\n return is.obj(value) && value.type === _keys2.default.error;\n },\n array: Array.isArray,\n func: function func(value) {\n return typeof value === 'function';\n },\n promise: function promise(value) {\n return value && is.func(value.then);\n },\n iterator: function iterator(value) {\n return value && is.func(value.next) && is.func(value.throw);\n },\n fork: function fork(value) {\n return is.obj(value) && value.type === _keys2.default.fork;\n },\n join: function join(value) {\n return is.obj(value) && value.type === _keys2.default.join;\n },\n race: function race(value) {\n return is.obj(value) && value.type === _keys2.default.race;\n },\n call: function call(value) {\n return is.obj(value) && value.type === _keys2.default.call;\n },\n cps: function cps(value) {\n return is.obj(value) && value.type === _keys2.default.cps;\n },\n subscribe: function subscribe(value) {\n return is.obj(value) && value.type === _keys2.default.subscribe;\n },\n channel: function channel(value) {\n return is.obj(value) && is.func(value.subscribe);\n }\n};\n\nexports.default = is;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar keys = {\n all: Symbol('all'),\n error: Symbol('error'),\n fork: Symbol('fork'),\n join: Symbol('join'),\n race: Symbol('race'),\n call: Symbol('call'),\n cps: Symbol('cps'),\n subscribe: Symbol('subscribe')\n};\n\nexports.default = keys;","/**\n * Casts value as an error if it's not one.\n *\n * @param {*} error The value to cast.\n *\n * @return {Error} The cast error.\n */\nexport default function castError( error ) {\n\tif ( ! ( error instanceof Error ) ) {\n\t\terror = new Error( error );\n\t}\n\n\treturn error;\n}\n","/**\n * Internal dependencies\n */\nimport isGenerator from './is-generator';\nimport createRuntime from './runtime';\n\n/**\n * Creates a Redux middleware, given an object of controls where each key is an\n * action type for which to act upon, the value a function which returns either\n * a promise which is to resolve when evaluation of the action should continue,\n * or a value. The value or resolved promise value is assigned on the return\n * value of the yield assignment. If the control handler returns undefined, the\n * execution is not continued.\n *\n * @param {Object} controls Object of control handlers.\n *\n * @return {Function} Co-routine runtime\n */\nexport default function createMiddleware( controls = {} ) {\n\treturn ( store ) => {\n\t\tconst runtime = createRuntime( controls, store.dispatch );\n\t\treturn ( next ) => ( action ) => {\n\t\t\tif ( ! isGenerator( action ) ) {\n\t\t\t\treturn next( action );\n\t\t\t}\n\n\t\t\treturn runtime( action );\n\t\t};\n\t};\n}\n","/**\n * External imports\n */\nimport { isPlainObject, isString } from 'lodash';\n\n/**\n * Returns true if the given object quacks like an action.\n *\n * @param {*} object Object to test\n *\n * @return {boolean} Whether object is an action.\n */\nexport function isAction( object ) {\n\treturn isPlainObject( object ) && isString( object.type );\n}\n\n/**\n * Returns true if the given object quacks like an action and has a specific\n * action type\n *\n * @param {*} object Object to test\n * @param {string} expectedType The expected type for the action.\n *\n * @return {boolean} Whether object is an action and is of specific type.\n */\nexport function isActionOfType( object, expectedType ) {\n\treturn isAction( object ) && object.type === expectedType;\n}\n","/**\n * Returns true if the given object is a generator, or false otherwise.\n *\n * @link https://www.ecma-international.org/ecma-262/6.0/#sec-generator-objects\n *\n * @param {*} object Object to test.\n *\n * @return {boolean} Whether object is a generator.\n */\nexport default function isGenerator( object ) {\n\treturn (\n\t\t!! object &&\n\t\tobject[ Symbol.toStringTag ] === 'Generator'\n\t);\n}\n","/**\n * External dependencies\n */\nimport { create } from 'rungen';\nimport { map, isString } from 'lodash';\nimport isPromise from 'is-promise';\n\n/**\n * Internal dependencies\n */\nimport castError from './cast-error';\nimport { isActionOfType, isAction } from './is-action';\n\n/**\n * Create a co-routine runtime.\n *\n * @param {Object} controls Object of control handlers.\n * @param {function} dispatch Unhandled action dispatch.\n *\n * @return {function} co-routine runtime\n */\nexport default function createRuntime( controls = {}, dispatch ) {\n\tconst rungenControls = map( controls, ( control, actionType ) => ( value, next, iterate, yieldNext, yieldError ) => {\n\t\tif ( ! isActionOfType( value, actionType ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst routine = control( value );\n\t\tif ( isPromise( routine ) ) {\n\t\t\t// Async control routine awaits resolution.\n\t\t\troutine.then(\n\t\t\t\tyieldNext,\n\t\t\t\t( error ) => yieldError( castError( error ) ),\n\t\t\t);\n\t\t} else {\n\t\t\tnext( routine );\n\t\t}\n\t\treturn true;\n\t} );\n\n\tconst unhandledActionControl = ( value, next ) => {\n\t\tif ( ! isAction( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tdispatch( value );\n\t\tnext();\n\t\treturn true;\n\t};\n\trungenControls.push( unhandledActionControl );\n\n\tconst rungenRuntime = create( rungenControls );\n\n\treturn ( action ) => new Promise( ( resolve, reject ) =>\n\t\trungenRuntime( action, ( result ) => {\n\t\t\tif ( typeof result === 'object' && isString( result.type ) ) {\n\t\t\t\tdispatch( result );\n\t\t\t}\n\t\t\tresolve( result );\n\t\t}, reject )\n\t);\n}\n","(function() { module.exports = this[\"lodash\"]; }());"],"sourceRoot":""} |