diff --git a/.circleci/config.yml b/.circleci/config.yml index a8557a817c..c717e0ef7d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,7 +41,7 @@ run_log_mem_use: &run_log_mem_use # Log memory usage throughout entire build. MEMUSELOG=/tmp/memuse.txt /bin/bash -c '\ while true; do\ - ps -u $USER -e -o pid,%cpu,%mem,rss:10,vsz:10,command:20 \ + ps -e -o user,%cpu,%mem,rss:10,vsz:10,command:20 \ --sort=-%mem >> $MEMUSELOG; \ echo "----------" >> $MEMUSELOG; \ sleep 1; \ @@ -86,11 +86,7 @@ build_machine_environment: &build_machine_environment # These will be evaled before each command. PRE_TEST_COMMANDS: |- ulimit -c unlimited; # Set core dump size as Ubuntu 14.04 lacks prlimit. - ulimit -n 4096; # CircleCI default is soft 1024, hard 4096. Take it all. - - # Enable the Garbage Collection `gc` object to be exposed so we can try - # to our own, hopefully more graceful, technique. - TOOL_NODE_FLAGS: --expose-gc + ulimit -a # Display all ulimit settings for transparency. # This is only to make Meteor self-test not remind us that we can set # this argument for self-tests. @@ -115,22 +111,25 @@ jobs: command: (git submodule sync && git submodule update --init --recursive) || (rm -fr .git/config .git/modules && git submodule deinit -f . && git submodule update --init --recursive) - restore_cache: keys: - - dev-bundle-cache-{{ checksum "meteor" }} - - dev-bundle-cache + - v1-dev-bundle-cache-{{ checksum "meteor" }} + - v1-dev-bundle-cache- - restore_cache: keys: - - other-deps-cache-{{ .Branch }}-{{ .Revision }} - - other-deps-cache-{{ .Branch }} - - other-deps-cache + - v2-other-deps-cache-{{ .Branch }}-{{ .Revision }} + - v2-other-deps-cache-{{ .Branch }}- - restore_cache: keys: - - test-groups-v1-{{ .Branch }} - - test-groups-v1 + - v1-test-groups-{{ .Branch }} + - v1-test-groups- - run: name: Create Test Results Directory command: | sudo mkdir -p ./tmp/results/junit sudo chmod a+rwx ./tmp/results/junit + # Clear dev_bundle/.npm to ensure consistent test runs. + - run: + name: Clear npm cache + command: ./meteor npm cache clear --force - run: name: Get Ready command: | @@ -138,10 +137,6 @@ jobs: ./meteor --get-ready # shouldn't take longer than 20 minutes no_output_timeout: 20m - # Clear dev_bundle/.npm to ensure consistent test runs. - - run: - name: Clear npm cache - command: ./meteor npm cache clear --force - run: <<: *run_save_node_bin - persist_to_workspace: @@ -688,16 +683,16 @@ jobs: npm install --prefix ./scripts/test-balancer npm start --prefix ./scripts/test-balancer --num-groups ${NUM_GROUPS} --running-avg-length ${RUNNING_AVG_LENGTH} - save_cache: - key: test-groups-v1-{{ .Branch }}-{{ .BuildNum }} + key: v1-test-groups-{{ .Branch }}-{{ .BuildNum }} paths: - ./tmp/test-groups when: on_success - save_cache: - key: dev-bundle-cache-{{ checksum "meteor" }} + key: v1-dev-bundle-cache-{{ checksum "meteor" }} paths: - "dev_bundle" - save_cache: - key: other-deps-cache-{{ .Branch }}-{{ .Revision }} + key: v2-other-deps-cache-{{ .Branch }}-{{ .Revision }} paths: - ".babel-cache" - ".meteor" diff --git a/History.md b/History.md index 5de633bb65..09664f6c17 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,143 @@ ## v.NEXT +## v1.7.0.3, 2018-06-13 + +* Fixed [Issue #9991](https://github.com/meteor/meteor/issues/9991), + introduced in + [Meteor 1.7.0.2](https://github.com/meteor/meteor/pull/9990) + by [PR #9977](https://github.com/meteor/meteor/pull/9977). + +## v1.7.0.2, 2018-06-13 + +* Node has been updated to version + [8.11.3](https://nodejs.org/en/blog/release/v8.11.3/), an important + [security release](https://nodejs.org/en/blog/vulnerability/june-2018-security-releases/). + +* The `meteor-babel` npm package has been updated to version + [7.0.0-beta.51](https://github.com/babel/babel/releases/tag/v7.0.0-beta.51). + +* Meteor apps created with `meteor create` or `meteor create --minimal` + will now have a directory called `tests/` rather than `test/`, so that + test code will not be eagerly loaded if you decide to remove the + `meteor.mainModule` configuration from `package.json`, thanks to + [PR #9977](https://github.com/meteor/meteor/pull/9977) by + [@robfallows](https://github.com/robfallows). + [Issue #9961](https://github.com/meteor/meteor/issues/9961) + +## v1.7.0.1, 2018-05-29 + +* Reverted an [optimization](https://github.com/meteor/meteor/pull/9825) + introduced in Meteor 1.7 to stop scanning `node_modules` for files that + might be of interest to compiler plugins, since the intended workarounds + (creating symlinks) did not satisfy all existing use cases. We will + revisit this optimization in Meteor 1.7.1. + [mozfet/meteor-autoform-materialize#43](https://github.com/mozfet/meteor-autoform-materialize/issues/43) + +* After updating to Meteor 1.7 or 1.7.0.1, you should update the + `@babel/runtime` npm package (as well as other Babel-related packages) + to their latest versions, along with the `meteor-node-stubs` package, + by running the following command: + ```sh + meteor npm install @babel/runtime@latest meteor-node-stubs@latest + ``` + +## v1.7, 2018-05-28 + +* More than 80% of internet users worldwide have access to a web browser + that natively supports the latest ECMAScript features and keeps itself + updated automatically, which means new features become available almost + as soon as they ship. In other words, the future we envisioned when we + first began [compiling code with + Babel](https://blog.meteor.com/how-much-does-ecmascript-2015-cost-2ded41d70914) + is finally here, yet most web frameworks and applications still compile + a single client-side JavaScript bundle that must function simultaneously + in the oldest and the newest browsers the application developer wishes + to support. + + That choice is understandable, because the alternative is daunting: not + only must you build multiple JavaScript and CSS bundles for different + browsers, with different dependency graphs and compilation rules and + webpack configurations, but your server must also be able to detect the + capabilities of each visiting client, so that it can deliver the + appropriate assets at runtime. Testing a matrix of different browsers + and application versions gets cumbersome quickly, so it's no surprise + that responsible web developers would rather ship a single, well-tested + bundle, and forget about taking advantage of modern features until + legacy browsers have disappeared completely. + + With Meteor 1.7, this awkward balancing act is no longer necessary, + because Meteor now automatically builds two sets of client-side assets, + one tailored to the capabilities of modern browsers, and the other + designed to work in all supported browsers, thus keeping legacy browsers + working exactly as they did before. Best of all, the entire Meteor + community relies on the same system, so any bugs or differences in + behavior can be identified and fixed quickly. + + In this system, a "modern" browser can be loosely defined as one with + full native support for `async` functions and `await` expressions, which + includes more than 80% of the world market, and 85% of the US market + ([source](https://caniuse.com/#feat=async-functions)). This standard may + seem extremely strict, since `async`/`await` was [just finalized in + ECMAScript 2017](http://2ality.com/2016/10/async-function-tips.html), + but the statistics clearly justify it. As another example, any modern + browser can handle native `class` syntax, though newer syntax like class + fields may still need to be compiled for now, whereas a legacy browser + will need compilation for both advanced and basic `class` syntax. And of + course you can safely assume that any modern browser has a native + `Promise` implementation, because `async` functions must return + `Promise`s. The list goes on and on. + + This boundary between modern and legacy browsers is designed to be tuned + over time, not only by the Meteor framework itself but also by each + individual Meteor application. For example, here's how the minimum + versions for native ECMAScript `class` support might be expressed: + + ```js + import { setMinimumBrowserVersions } from "meteor/modern-browsers"; + + setMinimumBrowserVersions({ + chrome: 49, + firefox: 45, + edge: 12, + ie: Infinity, // Sorry, IE11. + mobile_safari: [9, 2], // 9.2.0+ + opera: 36, + safari: 9, + electron: 1, + }, "classes"); + ``` + + The minimum modern version for each browser is simply the maximum of all + versions passed to `setMinimumBrowserVersions` for that browser. The + Meteor development server decides which assets to deliver to each client + based on the `User-Agent` string of the HTTP request. In production, + different bundles are named with unique hashes, which prevents cache + collisions, though Meteor also sets the `Vary: User-Agent` HTTP response + header to let well-behaved clients know they should cache modern and + legacy resources separately. + + For the most part, the modern/legacy system will transparently determine + how your code is compiled, bundled, and delivered—and yes, it + works with every existing part of Meteor, including dynamic `import()` + and even [the old `appcache` + package](https://github.com/meteor/meteor/pull/9776). However, if you're + writing dynamic code that depends on modern features, you can use the + boolean `Meteor.isModern` flag to detect the status of the current + environment (Node 8 is modern, too, of course). If you're writing a + Meteor package, you can call `api.addFiles(files, "legacy")` in your + `package.js` configuration file to add extra files to the legacy bundle, + or `api.addFiles(files, "client")` to add files to all client bundles, + or `api.addFiles(files, "web.browser")` to add files only to the modern + bundle, and the same rules apply to `api.mainModule`. Just be sure to + call `setMinimumBrowserVersions` (in server startup code) to enforce + your assumptions about ECMAScript feature support. + + We think this modern/legacy system is one of the most powerful features + we've added since we first introduced the `ecmascript` package in Meteor + 1.2, and we look forward to other frameworks attempting to catch up. + + [PR #9439](https://github.com/meteor/meteor/pull/9439) + * Although Meteor does not recompile packages installed in `node_modules` by default, compilation of specific npm packages (for example, to support older browsers that the package author neglected) can now be @@ -20,7 +158,7 @@ import("the-package").then(...) ``` This reuse of compiled code is the critical new feature that was added - in Meteor 1.6.2. + in Meteor 1.7. * Install the package normally with `meteor npm install the-package`, then create a symbolic link *to* the installed package elsewhere in @@ -44,7 +182,22 @@ application code. [PR #9771](https://github.com/meteor/meteor/pull/9771) [Feature #6](https://github.com/meteor/meteor-feature-requests/issues/6) -* The `npm` package has been upgraded to version 5.8.0, and our + > ~Note: since compilation of npm packages can now be enabled using the + techniques described above, Meteor will no longer automatically scan + `node_modules` directories for modules that can be compiled by + compiler plugins. If you have been using that functionality to import + compiled-to-JS modules from `node_modules`, you should start using the + symlinking strategy instead.~ **Follow-up note: this optimization was + reverted in Meteor 1.7.0.1 (see [above](#v1701-2018-05-29)).** + +* Node has been updated to version + [8.11.2](https://nodejs.org/en/blog/release/v8.11.2/), officially fixing + a [cause](https://github.com/nodejs/node/issues/19274) of frequent + segmentation faults in Meteor applications that was introduced in Node + 8.10.0. Meteor 1.6.1.1 shipped with a custom build of Node that patched + this problem, but that approach was never intended to be permanent. + +* The `npm` package has been upgraded to version 5.10.0, and our [fork](https://github.com/meteor/pacote/tree/v7.6.1-meteor) of its `pacote` dependency has been rebased against version 7.6.1. @@ -101,12 +254,32 @@ test files across your codebase; just make sure you import the ones you want to run. [PR #9714](https://github.com/meteor/meteor/pull/9714) +* The `meteor create` command now supports a `--minimal` option, which + creates an app with as few Meteor packages as possible, in order to + minimize client bundle size while still demonstrating advanced features + such as server-side rendering. This starter application is a solid + foundation for any application that doesn't need Mongo or DDP. + * The `meteor-babel` npm package has been updated to version - 7.0.0-beta.46. + 7.0.0-beta.49-1. Note: while Babel has recently implemented support for + a new kind of `babel.config.js` configuration file (see [this + PR](https://github.com/babel/babel/pull/7358)), and future versions of + Meteor will no doubt embrace this functionality, Meteor 1.7 supports + only `.babelrc` files as a means of customizing the default Babel + configuration provided by Meteor. In other words, if your project + contains a `babel.config.js` file, it will be ignored by Meteor 1.7. -* The `reify` npm package has been updated to version 0.15.1. +* The `reify` npm package has been updated to version 0.16.2. -* The `optimism` npm package has been updated to version 0.4.0. +* The `meteor-node-stubs` package, which provides stub implementations for + any Node built-in modules used by the client (such as `path` and + `http`), has a new minor version (0.4.1) that may help with Windows + installation problems. To install the new version, run + ```sh + meteor npm install meteor-node-stubs@latest + ``` + +* The `optimism` npm package has been updated to version 0.6.3. * The `minifier-js` package has been updated to use `uglify-es` 3.3.9. @@ -115,10 +288,10 @@ `selftest.skip.define('some test', ...` will skip running "some test". [PR #9579](https://github.com/meteor/meteor/pull/9579) -* Mongo has been upgraded to version 3.6.3 for 64-bit systems, and 3.2.19 +* Mongo has been upgraded to version 3.6.4 for 64-bit systems, and 3.2.19 for 32-bit systems. [PR #9632](https://github.com/meteor/meteor/pull/9632) - **NOTE:** After upgrading an application to use Mongo 3.6.2, it has been + **NOTE:** After upgrading an application to use Mongo 3.6.4, it has been observed ([#9591](https://github.com/meteor/meteor/issues/9591)) that attempting to run that application with an older version of Meteor (via `meteor --release X`), that uses an older version of Mongo, can @@ -132,10 +305,20 @@ ``` [PR #9632](https://github.com/meteor/meteor/pull/9632) +* The `mongodb` driver package has been updated from version 2.2.34 to + version 3.0.7. [PR #9790](https://github.com/meteor/meteor/pull/9790) + [PR #9831](https://github.com/meteor/meteor/pull/9831) + [Feature #268](https://github.com/meteor/meteor-feature-requests/issues/268) + * The `cordova-plugin-meteor-webapp` package depended on by the Meteor `webapp` package has been updated to version 1.6.0. [PR #9761](https://github.com/meteor/meteor/pull/9761) +* Any settings read from a JSON file passed with the `--settings` option + during Cordova run/build/deploy will be exposed in `mobile-config.js` + via the `App.settings` property, similar to `Meteor.settings`. + [PR #9873](https://github.com/meteor/meteor/pull/9873) + * The `@babel/plugin-proposal-class-properties` plugin provided by `meteor-babel` now runs with the `loose:true` option, as required by other (optional) plugins like `@babel/plugin-proposal-decorators`. @@ -175,6 +358,15 @@ [Feature #24](https://github.com/meteor/meteor-feature-requests/issues/24) [PR #9657](https://github.com/meteor/meteor/pull/9657) +## v1.6.1.2, 2018-05-28 + +* Meteor 1.6.1.2 is a very small release intended to fix + [#9863](https://github.com/meteor/meteor/issues/9863) by making + [#9887](https://github.com/meteor/meteor/pull/9887) available to Windows + users without forcing them to update to Meteor 1.7 (yet). Thanks very + much to [@zodern](https://github.com/zodern) for identifying a solution + to this problem. [PR #9910](https://github.com/meteor/meteor/pull/9910) + ## v1.6.1.1, 2018-04-02 * Node has been updated to version diff --git a/meteor b/meteor index 43eb116bad..206e12b0cc 100755 --- a/meteor +++ b/meteor @@ -1,6 +1,6 @@ #!/usr/bin/env bash -BUNDLE_VERSION=8.11.1.2 +BUNDLE_VERSION=8.11.3.1 # OS Check. Put here because here is where we download the precompiled # bundles that are arch specific. @@ -133,6 +133,6 @@ fi # screw up their meteor installs by have a ~/node_modules exec "$DEV_BUNDLE/bin/node" \ - --expose-gc \ + --max-old-space-size=4096 \ ${TOOL_NODE_FLAGS} \ "$METEOR" "$@" diff --git a/meteor.bat b/meteor.bat index 4487a471a6..6ea71fbe56 100644 --- a/meteor.bat +++ b/meteor.bat @@ -46,7 +46,10 @@ IF EXIST "%~dp0\.git" ( SET NODE_PATH=%~dp0\dev_bundle\lib\node_modules SET BABEL_CACHE_DIR=%~dp0\.babel-cache -"%~dp0\dev_bundle\bin\node.exe" %TOOL_NODE_FLAGS% "%~dp0\tools\index.js" %* +"%~dp0\dev_bundle\bin\node.exe" ^ + %TOOL_NODE_FLAGS% ^ + "%~dp0\tools\index.js" %* + ENDLOCAL EXIT /b %ERRORLEVEL% diff --git a/packages/allow-deny/allow-deny.js b/packages/allow-deny/allow-deny.js index 2bf0aade74..be5483feed 100644 --- a/packages/allow-deny/allow-deny.js +++ b/packages/allow-deny/allow-deny.js @@ -192,7 +192,11 @@ CollectionPrototype._defineMutationMethods = function(options) { throw new Meteor.Error(403, "Access denied"); } } catch (e) { - if (e.name === 'MongoError' || e.name === 'MinimongoError') { + if ( + e.name === 'MongoError' || + e.name === 'BulkWriteError' || + e.name === 'MinimongoError' + ) { throw new Meteor.Error(409, e.toString()); } else { throw e; diff --git a/packages/appcache/appcache-server.js b/packages/appcache/appcache-server.js index 13596e39a4..f0b6957e71 100644 --- a/packages/appcache/appcache-server.js +++ b/packages/appcache/appcache-server.js @@ -1,4 +1,6 @@ import { Meteor } from 'meteor/meteor' +import { isModern } from "meteor/modern-browsers"; +import { WebApp } from "meteor/webapp"; import crypto from 'crypto'; import fs from 'fs'; import path from 'path'; @@ -37,12 +39,14 @@ Meteor.AppCache = { const browserDisabled = request => disabledBrowsers[request.browser.name]; -const isDynamic = resource => +// Cache of previously computed app.manifest files. +const manifestCache = new Map; + +const shouldSkip = resource => resource.type === 'dynamic js' || (resource.type === 'json' && - // TODO Update this test with PR #9439. - resource.url.startsWith('/dynamic/') && - resource.url.endsWith('.map')); + (resource.url.endsWith('.map') || + resource.url.endsWith('.stats.json?meteor_js_resource=true'))); WebApp.addHtmlAttributeHook(request => browserDisabled(request) ? @@ -55,6 +59,8 @@ WebApp.connectHandlers.use((req, res, next) => { return next(); } + const request = WebApp.categorizeRequest(req); + // Browsers will get confused if we unconditionally serve the // manifest and then disable the app cache for that browser. If // the app cache had previously been enabled for a browser, it @@ -65,12 +71,44 @@ WebApp.connectHandlers.use((req, res, next) => { // use"). Returning a 404 gets the browser to really turn off the // app cache. - if (browserDisabled(WebApp.categorizeRequest(req))) { + if (browserDisabled(request)) { res.writeHead(404); res.end(); return; } + const cacheInfo = { + modern: isModern(request.browser), + }; + + cacheInfo.arch = cacheInfo.modern + ? "web.browser" + : "web.browser.legacy"; + + cacheInfo.clientHash = WebApp.clientHash(cacheInfo.arch); + + if (Package.autoupdate) { + const version = Package.autoupdate.Autoupdate.autoupdateVersion; + if (version !== cacheInfo.clientHash) { + cacheInfo.autoupdateVersion = version; + } + } + + const cacheKey = JSON.stringify(cacheInfo); + + if (! manifestCache.has(cacheKey)) { + manifestCache.set(cacheKey, computeManifest(cacheInfo)); + } + + const manifest = manifestCache.get(cacheKey); + + res.setHeader('Content-Type', 'text/cache-manifest'); + res.setHeader('Content-Length', manifest.length); + + return res.end(manifest); +}); + +function computeManifest(cacheInfo) { let manifest = "CACHE MANIFEST\n\n"; // After the browser has downloaded the app files from the server and @@ -80,61 +118,82 @@ WebApp.connectHandlers.use((req, res, next) => { // // So to ensure that the client updates if client resources change, // include a hash of client resources in the manifest. - - manifest += `# ${WebApp.clientHash()}\n`; + manifest += `# ${cacheInfo.clientHash}\n`; // When using the autoupdate package, also include // AUTOUPDATE_VERSION. Otherwise the client will get into an // infinite loop of reloads when the browser doesn't fetch the new // app HTML which contains the new version, and autoupdate will // reload again trying to get the new code. - - if (Package.autoupdate) { - const version = Package.autoupdate.Autoupdate.autoupdateVersion; - if (version !== WebApp.clientHash()) - manifest += `# ${version}\n`; + if (cacheInfo.autoupdateVersion) { + manifest += `# ${cacheInfo.autoupdateVersion}\n`; } manifest += "\n"; manifest += "CACHE:\n"; manifest += "/\n"; - WebApp.clientPrograms[WebApp.defaultArch].manifest.forEach(resource => { - if (resource.where === 'client' && - ! RoutePolicy.classify(resource.url) && - ! isDynamic(resource)) { - manifest += resource.url; - // If the resource is not already cacheable (has a query - // parameter, presumably with a hash or version of some sort), - // put a version with a hash in the cache. - // - // Avoid putting a non-cacheable asset into the cache, otherwise - // the user can't modify the asset until the cache headers - // expire. - if (!resource.cacheable) - manifest += `?${resource.hash}`; - manifest += "\n"; + eachResource(cacheInfo, resource => { + const { url } = resource; + + if (resource.where !== 'client' || + RoutePolicy.classify(url) || + shouldSkip(resource)) { + return; } + + manifest += url; + + // If the resource is not already cacheable (has a query parameter, + // presumably with a hash or version of some sort), put a version with + // a hash in the cache. + // + // Avoid putting a non-cacheable asset into the cache, otherwise the + // user can't modify the asset until the cache headers expire. + if (! resource.cacheable) { + manifest += `?${resource.hash}`; + } + + manifest += "\n"; }); manifest += "\n"; manifest += "FALLBACK:\n"; manifest += "/ /\n"; - // Add a fallback entry for each uncacheable asset we added above. - // - // This means requests for the bare url ("/image.png" instead of - // "/image.png?hash") will work offline. Online, however, the browser - // will send a request to the server. Users can remove this extra - // request to the server and have the asset served from cache by - // specifying the full URL with hash in their code (manually, with - // some sort of URL rewriting helper) - WebApp.clientPrograms[WebApp.defaultArch].manifest.forEach(resource => { - if (resource.where === 'client' && - ! RoutePolicy.classify(resource.url) && - ! resource.cacheable && - ! isDynamic(resource)) { - manifest += `${resource.url} ${resource.url}?${resource.hash}\n`; + eachResource(cacheInfo, (resource, arch, prefix) => { + const { url } = resource; + + if (resource.where !== 'client' || + RoutePolicy.classify(url) || + shouldSkip(resource)) { + return; + } + + if (! resource.cacheable) { + // Add a fallback entry for each uncacheable asset we added above. + // + // This means requests for the bare url ("/image.png" instead of + // "/image.png?hash") will work offline. Online, however, the + // browser will send a request to the server. Users can remove this + // extra request to the server and have the asset served from cache + // by specifying the full URL with hash in their code (manually, + // with some sort of URL rewriting helper) + manifest += `${url} ${url}?${resource.hash}\n`; + } + + if (resource.type === 'asset' && + prefix.length > 0 && + url.startsWith(prefix)) { + // If the URL has a prefix like /__browser.legacy or /__cordova, add + // a fallback from the un-prefixed URL to the fully prefixed URL, so + // that legacy/cordova browsers can load assets offline without + // using an explicit prefix. When the client is online, these assets + // will simply come from the modern web.browser bundle, which does + // not prefix its asset URLs. Using a fallback rather than just + // duplicating the resources in the manifest is important because of + // appcache size limits. + manifest += `${url.slice(prefix.length)} ${url}?${resource.hash}\n`; } }); @@ -151,38 +210,61 @@ WebApp.connectHandlers.use((req, res, next) => { manifest += "*\n"; // content length needs to be based on bytes - const body = Buffer.from(manifest); + return Buffer.from(manifest, "utf8"); +} - res.setHeader('Content-Type', 'text/cache-manifest'); - res.setHeader('Content-Length', body.length); - return res.end(body); -}); +function eachResource({ + modern, + arch, +}, callback) { + const manifest = WebApp.clientPrograms[arch].manifest; -const sizeCheck = () => { - let totalSize = 0; - WebApp.clientPrograms[WebApp.defaultArch].manifest.forEach(resource => { - if (resource.where === 'client' && - ! RoutePolicy.classify(resource.url) && - ! isDynamic(resource)) { - totalSize += resource.size; + let prefix = ""; + if (! modern) { + manifest.some(({ url }) => { + if (url && url.startsWith("/__")) { + prefix = url.split("/", 2).join("/"); + return true; + } + }); + } + + manifest.forEach(resource => { + callback(resource, arch, prefix); + }); +} + +function sizeCheck() { + [ // Check size of each known architecture independently. + "web.browser", + "web.browser.legacy", + ].forEach(arch => { + let totalSize = 0; + + WebApp.clientPrograms[arch].manifest.forEach(resource => { + if (resource.where === 'client' && + ! RoutePolicy.classify(resource.url) && + ! shouldSkip(resource)) { + totalSize += resource.size; + } + }); + + if (totalSize > 5 * 1024 * 1024) { + Meteor._debug([ + "** You are using the appcache package but the total size of the", + `** cached resources is ${(totalSize / 1024 / 1024).toFixed(1)}MB.`, + "**", + "** This is over the recommended maximum of 5MB and may break your", + "** app in some browsers! See http://docs.meteor.com/#appcache", + "** for more information and fixes." + ].join("\n")); } }); - if (totalSize > 5 * 1024 * 1024) { - Meteor._debug( - "** You are using the appcache package but the total size of the\n" + - "** cached resources is " + - `${(totalSize / 1024 / 1024).toFixed(1)}MB.\n` + - "**\n" + - "** This is over the recommended maximum of 5 MB and may break your\n" + - "** app in some browsers! See http://docs.meteor.com/#appcache\n" + - "** for more information and fixes.\n" - ); - } -}; +} // Run the size check after user code has had a chance to run. That way, // the size check can take into account files that the user does not // want cached. Otherwise, the size check warning will still print even // if the user excludes their large files with // `Meteor.AppCache.config({onlineOnly: files})`. -Meteor.startup(() => ! _disableSizeCheck ? sizeCheck() : null); +Meteor.startup(() => _disableSizeCheck || sizeCheck()); diff --git a/packages/appcache/package.js b/packages/appcache/package.js index 8874cc2fe3..17aaa0cdd3 100644 --- a/packages/appcache/package.js +++ b/packages/appcache/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Enable the application cache in the browser", - version: "1.1.2", + version: "1.2.0", }); Package.onUse(api => { diff --git a/packages/babel-compiler/.npm/package/npm-shrinkwrap.json b/packages/babel-compiler/.npm/package/npm-shrinkwrap.json index ac4aa8dfe1..f20eec836b 100644 --- a/packages/babel-compiler/.npm/package/npm-shrinkwrap.json +++ b/packages/babel-compiler/.npm/package/npm-shrinkwrap.json @@ -2,339 +2,344 @@ "lockfileVersion": 1, "dependencies": { "@babel/code-frame": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.46.tgz", - "integrity": "sha512-7BKRkmYaPZm3Yff5HGZJKCz7RqZ5jUjknsXT6Gz5YKG23J3uq9hAj0epncCB0rlqmnZ8Q+UUpQB2tCR5mT37vw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz", + "integrity": "sha1-vXHZsZKvl435FYKdOdQJRFZDmgw=" }, "@babel/core": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.0.0-beta.46.tgz", - "integrity": "sha512-lCDbBSAhNAt+nL98xbgWmuhgrIxKvbvFHf73zlNCuXCHJkdlo7qzTofYK0ZWb+OVce8fQ17fC7DwTIhAwowzMw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.0.0-beta.51.tgz", + "integrity": "sha1-DlS9a2OHNrKuWTwxpH8JaeKyuW0=" }, "@babel/generator": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.46.tgz", - "integrity": "sha512-5VfaEVkPG0gpNSTcf70jvV+MjbMoNn4g2iluwM7MhciedkolEtmG7PcdoUj5W1EmMfngz5cF65V7UMZXJO6y8Q==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.51.tgz", + "integrity": "sha1-bHV1/952HQdIXgS67cA5LG2eMPY=" }, "@babel/helper-annotate-as-pure": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0-beta.46.tgz", - "integrity": "sha512-ej5W347ghJF1p2TM3VcEyds1+o1uy1apaQcHrYFJPus2xCgn5KkHPkBGf+6euLfFaQDtB+eWPVKjiZx/hpYXvA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0-beta.51.tgz", + "integrity": "sha1-OM95IL9fM4oif3VOKGtvut7gS1g=" }, "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.0.0-beta.46.tgz", - "integrity": "sha512-ZCQ62KqFC5R3NPe5ug9pVqIHYJNup8UdEbE4IXw+s7zr4D/7AsKSt3pXA+FbML5AnQXeCSOuUWioggGmKuDV5g==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.0.0-beta.51.tgz", + "integrity": "sha1-ITP//j4vcVkeQhR7lHKRyirTkjc=" }, "@babel/helper-builder-react-jsx": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.0.0-beta.46.tgz", - "integrity": "sha512-4xakEEfimusXNgpSY6rP7robwRcnv1E8OxjkYSfsZCYsomFwN7RXU5S29vGWzxE37Yua4yTFqBwId9lwF84Hzw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.0.0-beta.51.tgz", + "integrity": "sha1-hsctZoO9JZfJOKEhU6bkgL8UASg=" }, "@babel/helper-call-delegate": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.0.0-beta.46.tgz", - "integrity": "sha512-7nhBu/MBlpvZLQsmw/C7VxN14wph+yp+1yxzPEd2oTsHg3oA73tHyguQ6wbtkw+9f1AZtP7ZJCLQ+nGLprF4Fw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.0.0-beta.51.tgz", + "integrity": "sha1-BO1yfJfPBbyy/WRINzMasV1jyBk=" }, "@babel/helper-define-map": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.0.0-beta.46.tgz", - "integrity": "sha512-rhi59ZVj+bhrgxqLi9VQmQOadcK9rLCArY8zqyjPNjDIsCurCwtQztRWhlz6CwBEhE9FO/KbSa9OFQm7Kobk+w==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.0.0-beta.51.tgz", + "integrity": "sha1-2Ixkc36UjHE/nxFTM46EFf7kCxE=" }, "@babel/helper-explode-assignable-expression": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.0.0-beta.46.tgz", - "integrity": "sha512-SW1OUmx2fC2SqL7+vF1N72FITbPuEWGdr/Gm7I3Vqs8p8T1dfGwB9YFsD+tTpfagKXVMiCCuQ06+G0FB8uxg6Q==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.0.0-beta.51.tgz", + "integrity": "sha1-mHUzKti11cmC+kgcuCtzFwPyzS0=" }, "@babel/helper-function-name": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.46.tgz", - "integrity": "sha512-zm4Kc5XB2njGs8PkmjV1zE/g1hBuphbh+VcDyFLaQsxkxSFSUtCbKwFL8AQpL/qPIcGbvX1MBt50a/3ZZH2CQA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz", + "integrity": "sha1-IbSHSiJ8+Z7K/MMKkDAtpaJkBWE=" }, "@babel/helper-get-function-arity": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.46.tgz", - "integrity": "sha512-dPrTb7QHVx44xJLjUl3LGAc13iS7hdXdO0fiOxdRN1suIS91yGGgeuwiQBlrw5SxbFchYtwenhlKbqHdVfGyVA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz", + "integrity": "sha1-MoGy0EWvlcFyzpGyCCXYXqRnZBE=" }, "@babel/helper-hoist-variables": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0-beta.46.tgz", - "integrity": "sha512-9xDHLfaVA445mcHU2OEPwEddiyS0Zxao2WObFR2L/SK5MNOPj2VqVCvivYrO2OpzhnLLCTbOfXRmrwrc9WYN6Q==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0-beta.51.tgz", + "integrity": "sha1-XX68hZZWe2RPyYmRLDo++YvgWPw=" }, "@babel/helper-member-expression-to-functions": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0-beta.46.tgz", - "integrity": "sha512-Xb5iVUHXY8yz4pgGBvtuS1kxZH1oUYcxTcbIW8NFRvgpeH3Zcv4me02bbixsk7nhn8ttE79Lr1g4vrem4k5Z3Q==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0-beta.51.tgz", + "integrity": "sha1-KkJTZXQXZYiAbmAusXpS0yP4KHA=" }, "@babel/helper-module-imports": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.46.tgz", - "integrity": "sha512-xjgpwrqHiKCZgAcqsNIpZ9kOCC5Ty/VYN1H07v21HbAf/dl0/HeUA0taz3EFv6/7lRgS3qThawTSG0POJQX9vQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.51.tgz", + "integrity": "sha1-zgBCgEX7t9XrwOp7+DV4nxU2arI=" }, "@babel/helper-module-transforms": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.0.0-beta.46.tgz", - "integrity": "sha512-IckoWSub3PHNvkWcUEWfKBe8pFUdMhsZMFDcaovcLb+gfxL/zZhQYwedKKKwbzVGIk9k44yjeMQ/OJd4yt4FGQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.0.0-beta.51.tgz", + "integrity": "sha1-E68MjuQfJ3dDyPxD1EQxXbIyb3M=" }, "@babel/helper-optimise-call-expression": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0-beta.46.tgz", - "integrity": "sha512-PVd7/PGxi82pEKyuDcEpMmlenMLhJCII3lIK4MhXGWrT/6cNMpY6ob5rWOarpXgZjy+JNI5uLPOce28bqq0Wtw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0-beta.51.tgz", + "integrity": "sha1-IfIVjvCDoSPOHgRmW1u4TzcAgNc=" }, "@babel/helper-plugin-utils": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.46.tgz", - "integrity": "sha512-eRTFH+/1rqDfzx+Z//CYk4TNwhfPQpM/TCs4CmHu2DwCPrqFnKUZLI1KgStfLf//c8FdOqx/U9EPec7s8CbUIA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.51.tgz", + "integrity": "sha1-D2pfK20cZERBP4+rYJQNebY8IDE=" }, "@babel/helper-regex": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.0.0-beta.46.tgz", - "integrity": "sha512-sPDHBt8Y4i6y9rwtxWMvcprlVHAZOOQK5xpS2Nw2q9QEDHRHwVbEpE6EejoUStSclnfJpPK/7ijFgypwc6rXlA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.0.0-beta.51.tgz", + "integrity": "sha1-mXIqPAxwRZavsSMoSwqIihoAPYI=" }, "@babel/helper-remap-async-to-generator": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.0.0-beta.46.tgz", - "integrity": "sha512-YrqQ98z8AMZx8f2PGJ4YV1MkXtj+qbwbFV7MOLTiavGSFY7UrN4uQfhKEJ/4GUf4QZdTr5NEmRt0AJrWno8y8w==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.0.0-beta.51.tgz", + "integrity": "sha1-DtxX4F3LXd4qC27m+NAmGYLe8l8=" }, "@babel/helper-replace-supers": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.0.0-beta.46.tgz", - "integrity": "sha512-FSpK3QKzb58oMEccanHzg1djsYHhGARl08i8BQGBoOyHS6Df+4/8bsQiTnc59Dz5sJoZdb67nKKFjgMsMYi6Kg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.0.0-beta.51.tgz", + "integrity": "sha1-J5phr7hJR2xsxw1VGfg99KdP+m8=" }, "@babel/helper-simple-access": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.0.0-beta.46.tgz", - "integrity": "sha512-1OEjV/Qnl4u8Dg+jQIYf1TgnfdrYIrdrF7yZwp9mSgsVX2PCyLe7JNTqZ/5v/5RzlF6S+GTe9agkj+EFFTcZUw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.0.0-beta.51.tgz", + "integrity": "sha1-ydf+zYShgdUKOvzEIvyUqWi+MFA=" }, "@babel/helper-split-export-declaration": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.46.tgz", - "integrity": "sha512-UT7acgV7wsnBPwnqslqcnUFvsPBP4TtVaYM82xPGA7+evAa8q8HXOmFk08qsMK/pX/yy4+51gJJwyw2zofnacA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz", + "integrity": "sha1-imw/ZsTSZTUvwHdIT59ugKUauXg=" }, "@babel/helper-wrap-function": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.0.0-beta.46.tgz", - "integrity": "sha512-W87M4bP6veTKK66OjzV/rU47tjsWmKj9J0J5BDmxq5BIJB1M13ouQ2FAURa4jGHwjPFWN3D5njBrsrifSOHzbQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.0.0-beta.51.tgz", + "integrity": "sha1-bFFvsEQQmWTuAxwiUAqDAxOGL7E=" }, "@babel/helpers": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.0.0-beta.46.tgz", - "integrity": "sha512-mbpH9pM3pJzo/tBr75U+zva3pqpyivogt1aofgEoD7bWFAYSuqOudRuz+m4XP6VPxxLoxcA4SFPGkuLRt9+7nQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.0.0-beta.51.tgz", + "integrity": "sha1-lScr4qtGNNaCBCX4klAxqSiRg5c=" }, "@babel/highlight": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.46.tgz", - "integrity": "sha512-r4snW6Q8ICL3Y8hGzYJRvyG/+sc+kvkewXNedG9tQjoHmUFMwMSv/o45GWQUQswevGnWghiGkpRPivFfOuMsOA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.51.tgz", + "integrity": "sha1-6IRK4loVlcz9QriWI7Q3bKBtIl0=" + }, + "@babel/parser": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.0.0-beta.51.tgz", + "integrity": "sha1-J87C30Cd9gr1gnDtj2qlVAnqhvY=" }, "@babel/plugin-proposal-async-generator-functions": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.0.0-beta.46.tgz", - "integrity": "sha512-htHMsLBYkM89CplqHTbbemVvzTXXyXkpihetJZUTPpSayfxEd6oIH5uSM91efcf5Rog+1SC0Oq32q9yF/4W3ig==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.0.0-beta.51.tgz", + "integrity": "sha1-99aS+Uakp/ynjkM2QHoAvq+KTeo=" }, "@babel/plugin-proposal-class-properties": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.0.0-beta.46.tgz", - "integrity": "sha512-kWp3bKibdSeSEvEQWcEcs345KPQYT39uM2edFS78NH3Gu6O9mBcnXh5E2BJ1sbE+jJ6jYPOZz4BK/LR7BiF0jA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.0.0-beta.51.tgz", + "integrity": "sha1-tcZi+GKjCs6U/EhHeDex0lX6ON8=" }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.0.0-beta.46.tgz", - "integrity": "sha512-viGuWOgFT/Tbnn3sYi3g9iJcC3ql7bSjxDs+d+GFgyf3eV2qNIKO/6I+PJAD35fGqDGGBrQhlA6HvW0FzQVtoA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.0.0-beta.51.tgz", + "integrity": "sha1-W8Rp5ebRuEpdYEa1npDKAWwghtY=" }, "@babel/plugin-syntax-async-generators": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.0.0-beta.46.tgz", - "integrity": "sha512-igLQzZYcSrY/W3eACq6Nrf9u9mfw7m5G6+JeTZlyI7w0z+upGvWvrpTaAP1Gni6MckQkx5q+pspgpV+/5ioPXg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.0.0-beta.51.tgz", + "integrity": "sha1-aSGvHcPaD87d4KYQc+7Hl7jKpwc=" }, "@babel/plugin-syntax-class-properties": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.0.0-beta.46.tgz", - "integrity": "sha512-NwtgTQ+I8B2eo5h1mZF64nloLaGQuPM4M/c/swvyvqHoWLissHhm94rOE2Ghte8WMgQ/Nw3bqJd59kpbckqmdQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.0.0-beta.51.tgz", + "integrity": "sha1-8Mv28iqHnFk6B+jhQckI4IdwHpE=" }, "@babel/plugin-syntax-dynamic-import": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.0.0-beta.46.tgz", - "integrity": "sha512-D4ek6tZa80NgaTSprPOVxj8vxjChh6UCWgCT/ZvCwAa6CBe3iqUCuOwZQLjU41aDdeuR7C02wxl3rcb25wCRLA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.0.0-beta.51.tgz", + "integrity": "sha1-nAru9X0GeONybbFxqnPkdKJd5/I=" }, "@babel/plugin-syntax-flow": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0-beta.46.tgz", - "integrity": "sha512-HFChD9R2w+8+Jt5539SVaKKSYuMvbCgYG7LmuISycaJW16aS6fNS6V8jr8U/HKJk3bhIG5SkATBYedy5zGR+sg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0-beta.51.tgz", + "integrity": "sha1-3giDE0QG+Q+Vi2QHPpdJiAIp3lY=" }, "@babel/plugin-syntax-jsx": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.0.0-beta.46.tgz", - "integrity": "sha512-aYN4vmO4nMux1W36F6/YP2ugNQ0cilrs1eU4jClLrlIouxqd9hqBloWtlGmGlyDxIRV5kzr+UWwridLDb+cN5g==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.0.0-beta.51.tgz", + "integrity": "sha1-9nKjNxxro/5Tv/0uirXcQElTgs8=" }, "@babel/plugin-syntax-object-rest-spread": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0-beta.46.tgz", - "integrity": "sha512-MMv6WG69jmcSLXdUeHvoev5RkuP/QuJZwCB4jXp2gtss//avs4Sns+t0VpGKTf9umhvRq44HFO6PVjVG85F+/Q==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0-beta.51.tgz", + "integrity": "sha1-bVehGcHwZMRY5FutRb7wqD7RDAA=" }, "@babel/plugin-transform-arrow-functions": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0-beta.46.tgz", - "integrity": "sha512-GgeFCCMHXWRkPDXWKin76qiZh+DAYdQShmk8SmzDj6IAgPHyNqkxHN/8gsmNe5/7IWFFOKUuM9TNU7fgY7z7Gg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0-beta.51.tgz", + "integrity": "sha1-KbnbbjhoigbsXCVjmZbYml6/2+M=" }, "@babel/plugin-transform-async-to-generator": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.0.0-beta.46.tgz", - "integrity": "sha512-obykYLqAd3tujTjHYE+dln5+nDhm+R5FmUcxXFr/Mx6LK1NgrTQ9TdPPOcMCD08r8SDljFpMopuz9upN/xJlbw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.0.0-beta.51.tgz", + "integrity": "sha1-lFOFBVoubTVmv1WvEnyNclzToXM=" }, "@babel/plugin-transform-block-scoped-functions": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0-beta.46.tgz", - "integrity": "sha512-0paq0AtTp3TXbXdzWwsL8ddacmo/g/14IgIZgs5BzUTrfROKQThYVccEBPqRnprTgvM0JXyDVfNSgLB4akCTjg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0-beta.51.tgz", + "integrity": "sha1-IxKbr4FEcfOeqU7shKsf/nbJ/pY=" }, "@babel/plugin-transform-block-scoping": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.0.0-beta.46.tgz", - "integrity": "sha512-7OwS0ObI6nLacEKP1HCdnoIQnHBqOV6IgtKGiPO+Nj03OnZ1Yo2aeK9sfOtwL43aNztnKqFVt2L5PfZg4VGidA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.0.0-beta.51.tgz", + "integrity": "sha1-vlVcefDaTrFop/4W14eppxc3AeA=" }, "@babel/plugin-transform-classes": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.0.0-beta.46.tgz", - "integrity": "sha512-EDp/qQAURfrX6hNM+VrLSSA+cGiwDeZL0ZTTt6a7PNSFABCw4qwKJHx3Q7me1oV7q3U/GJwPS4Aym2QTDmNGvg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.0.0-beta.51.tgz", + "integrity": "sha1-BD8x+2MnZkoy2Lpl3hV5nv3GXaA=" }, "@babel/plugin-transform-computed-properties": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0-beta.46.tgz", - "integrity": "sha512-0ne9TL53fXH+cBI591R1JSpPhu0d2Wd9dbD8jLCJFV4tlMfqQ+Rcm65RhWWqjEBZfGv2+FuOnwB4HJRHakdW+Q==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0-beta.51.tgz", + "integrity": "sha1-jHKhqz4HZwNP+eZzLSWBwjwDLv4=" }, "@babel/plugin-transform-destructuring": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.0.0-beta.46.tgz", - "integrity": "sha512-l9x0+T29Njwp6smLbTIU2HG2s4ROd9DAIQcfciEfpjAqscXEst0M4X9+UvjQsuaOgPFmQTdAn9xOwNFXnRP7Tg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.0.0-beta.51.tgz", + "integrity": "sha1-1dRU5XTH7zPuSekYsEivspvpNfY=" }, "@babel/plugin-transform-exponentiation-operator": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.0.0-beta.46.tgz", - "integrity": "sha512-acomgoNW/fwWSmBlhH22C9Eyl1Y/vADBSqzyIRWJGpm4frLhd49QQgKXbRGRHUDxyifXuZDF9+3pRhEmi7/HXA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.0.0-beta.51.tgz", + "integrity": "sha1-BLTj5As3AREt1u2jliUTJ1eIH9Q=" }, "@babel/plugin-transform-flow-strip-types": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.0.0-beta.46.tgz", - "integrity": "sha512-ZyMayIXoDPsYYa8FVypQpcxeHX65l6lQ/nA4DRTSJUVvoQDytfNlH3Y3yQhGwyrr2APsCpq4MGmUAp+Id8KWeA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.0.0-beta.51.tgz", + "integrity": "sha1-Z9Q0RZ96eyap8qaFW8EuZ4lOR6Y=" }, "@babel/plugin-transform-for-of": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0-beta.46.tgz", - "integrity": "sha512-a1gpwuO26szyz5K2FrRrI5nUDgvkaJfZ7GeDtFAH8XyrK/pNdtpW/7DFCf1PdQc6SbEMM/1QXsH7Y2YRkWoTeA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0-beta.51.tgz", + "integrity": "sha1-RPR2sGxANVF6hAOiYk+xZMQ3FFU=" }, "@babel/plugin-transform-literals": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.0.0-beta.46.tgz", - "integrity": "sha512-Uuo7pRsBkrLrDg6XpOAMfwhKw56SB5qVBniUVM04uf8wf92S2Z5tSPNNfn1iTgphuckAO9vg86l2XJ0Y/QD4YQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.0.0-beta.51.tgz", + "integrity": "sha1-RbB6lCI8+iJnAaeUYLQrMt8d7AU=" }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.0.0-beta.46.tgz", - "integrity": "sha512-3wLCWVkEhhQiVqqml4y9G6GJT6WA/mkxQ6TRy+4I46z00WWbEDENJcRTS14oNKzeRIo4yJylbVB1wUCW7HuJ9A==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.0.0-beta.51.tgz", + "integrity": "sha1-QDj54VJE4QkAy4n1t5bQUPHrGVs=" }, "@babel/plugin-transform-object-super": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.0.0-beta.46.tgz", - "integrity": "sha512-T+TV4rRuTubvjqEwBF5xib3vnfJgjQ62qJqHprTaJDBtF0ofpbv/A6x86EEr51iPymHc84eM+F1zyFEtJvKYwQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.0.0-beta.51.tgz", + "integrity": "sha1-rBjoi8HXm3GL2vSKdWgzzfW9zr8=" }, "@babel/plugin-transform-parameters": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.0.0-beta.46.tgz", - "integrity": "sha512-RnkdYrayTlQ0VFoyIjvY/cCp/1lJJkYE2lFcRNg6+Skd3g41PnocsHhQ5NUQjMNogL+RnNan3S/2S/i7S4zm+Q==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.0.0-beta.51.tgz", + "integrity": "sha1-mQGVsd/bG8yUkG8wNJUQie0e3U4=" }, "@babel/plugin-transform-property-literals": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.0.0-beta.46.tgz", - "integrity": "sha512-q1jSyGXA4zPWLpJZ7rPLpbQTv27VHSHWeU16xAM5PnmI1ZrL5XmhmhAfZ4D2+W3NfXbvaEUyxPBnwBYyGPKrNA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.0.0-beta.51.tgz", + "integrity": "sha1-52mYp1Xf0svWaAtRNuWz1CSBH1M=" }, "@babel/plugin-transform-react-display-name": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.0.0-beta.46.tgz", - "integrity": "sha512-/a7wwzNrYqReyuOM8rBB9iAOLaubvGHM9w3eUeput/DnEq/V+dJuBgktpF6mw/MQjwjna1B/3BbWsn1PaBw8bw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.0.0-beta.51.tgz", + "integrity": "sha1-G0i9NN+pCHJSyHB9Kb0d8uiCHL4=" }, "@babel/plugin-transform-react-jsx": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.0.0-beta.46.tgz", - "integrity": "sha512-b8VtHVQub3h7lXG1ShaCKgGJdra7fRlUK6hx1eCcIWAPYnJMz4soLMSPiXmyjDA5L0CbYmyTkceU1GjbeJmaaw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.0.0-beta.51.tgz", + "integrity": "sha1-evhJhRi4OQZAVDg3AZiAjKbmOxA=" }, "@babel/plugin-transform-react-jsx-self": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.0.0-beta.46.tgz", - "integrity": "sha512-keXGiKQNzqHXpplpz/Eu+F+OC/k6M3kbEBOqoDbbYeJVmWARVADWwRnCCsW6yevSyON4CTU5mouVadTIY9YSpA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.0.0-beta.51.tgz", + "integrity": "sha1-pPCYWX/nCYVUQ2b4k6xHOJhk2JQ=" }, "@babel/plugin-transform-react-jsx-source": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.0.0-beta.46.tgz", - "integrity": "sha512-vSSghGn+ER6d5gBtNnTZAxPxBSs1ngyyVlHse/geHSv7YnzmrCOUrtVl+t4M2/EO3CW2m8nkMfpnMW5FCmg+Zw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.0.0-beta.51.tgz", + "integrity": "sha1-aZncSRyLRgLvtNC9G6/JNq1pbs8=" }, "@babel/plugin-transform-regenerator": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0-beta.46.tgz", - "integrity": "sha512-P6d8ckSjKlbr/1SL1NBO6ieFxSebTiRWd2R8/styUIizJWQlEB0ITQ7l8vv3jXGjJ0mh7lxBTegXejRkTGKKgw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0-beta.51.tgz", + "integrity": "sha1-U28NWZ0nU9ygor6KZeLCRKe1YSs=" }, "@babel/plugin-transform-runtime": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.0.0-beta.46.tgz", - "integrity": "sha512-mdgrBPXF+7cl+Y8dBynUxK90U17fQdH4zBsNxV6GYyI35WiUUZYFiXG2wKZN+1LClhavD9cOnOLpCxaNQy7g2A==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.0.0-beta.51.tgz", + "integrity": "sha1-DJyrF09OPhMWWf1lxc6OPXM3aCA=" }, "@babel/plugin-transform-shorthand-properties": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0-beta.46.tgz", - "integrity": "sha512-1QkKFWPsjrvMppycLwjPBXF+usSnGvbTxGe0Q+eIzcZyhabwGCsCgkmDIKMisPSAi6F7bM5H1S8VbE85IW3oRg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0-beta.51.tgz", + "integrity": "sha1-3bwLGuHds7z+aWnyyWgQPxHjK9k=" }, "@babel/plugin-transform-spread": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.0.0-beta.46.tgz", - "integrity": "sha512-R0GvFdJnFrgTlmZfFtCXk81uvq5S3FuY38FnRsxDt6Yx/sE8jCmmrRe7XHZOnXXGP3ZWY9icILUmzWHOf91jbA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.0.0-beta.51.tgz", + "integrity": "sha1-EAEpvI19z0vHmtzWEppCFCWdilA=" }, "@babel/plugin-transform-sticky-regex": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0-beta.46.tgz", - "integrity": "sha512-goMgOLODjG1cgFHlKACh/NT/wrnmuRi2CpXsjOan10eZce0fk9kahYz/04cqhppmwtV/vQWwH2ikAHODSD8r5w==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0-beta.51.tgz", + "integrity": "sha1-SMvqzTG9Be6AC1+svLCcV4G9lhk=" }, "@babel/plugin-transform-template-literals": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0-beta.46.tgz", - "integrity": "sha512-2iGMsHWVAQq9X6p3VNjktJCH6ZXHQHi3NTPLKh5d4bEW8+M3H7LXLNqk1yUm/Uwt0tzh1FUfb/EU2sEPbrBrVA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0-beta.51.tgz", + "integrity": "sha1-LQWV9WRh1DRbo1w41zAz+H7Lu8g=" }, "@babel/plugin-transform-typeof-symbol": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.0.0-beta.46.tgz", - "integrity": "sha512-l+CfLR2c5KzZ/uZlkflNe7nK2hiEahc/FeiUCTd5Krj4aCKDdLLSdb4Lowf5hdZbqIPQc9TdL9SZt80YhUlmFw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.0.0-beta.51.tgz", + "integrity": "sha1-SVDAyOPJ4eFB5Fzrq15hSCYyBMM=" }, "@babel/plugin-transform-unicode-regex": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0-beta.46.tgz", - "integrity": "sha512-XWQ7uJ0HL/xdMesKzt1uq5CmZPBqDiEno+FBeYuOJu1IWjpr3yXfEzH/nW17KESXGRv68mLTr+fIeSwcC+qVFg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0-beta.51.tgz", + "integrity": "sha1-kBn5FQj0C1CmRDUEMijEFCws2GQ=" }, "@babel/preset-react": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.0.0-beta.46.tgz", - "integrity": "sha512-+Xl9AH/rhI7FTX0OxNXM4oGljpeCs1nwPm2IjD9+mXO/+dWdGpa+yTcjYYpIWAK4KQrSQ+27T6DtJ6fZPTqYQA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.0.0-beta.51.tgz", + "integrity": "sha1-lX2BKobZbIkhSSi3mAB0j1GTXkk=" }, "@babel/runtime": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.46.tgz", - "integrity": "sha512-/3a3USMKk54BEHhDgY8rtxtaQOs4bp4aQwo6SDtdwmrXmgSgEusWuXNX5oIs/nwzmTD9o8wz2EyAjA+uHDMmJA==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.51.tgz", + "integrity": "sha1-SLjtGDBwNMZiD2Q1FGUMoszAFlo=" }, "@babel/template": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.46.tgz", - "integrity": "sha512-3/qi4m0l6G/vZbEwtqfzJk73mYtuE7nvAO1zT3/ZrTAHy4sHf2vaF9Eh1w+Tau263Yrkh0bjVQPb9zw6G+GeMQ==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.51.tgz", + "integrity": "sha1-lgKkCuvPNXrpZ34lMu9fyBD1+/8=" }, "@babel/traverse": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.46.tgz", - "integrity": "sha512-IU7MTGbcjpfhf5tyCu3sDB7sWYainZQcT+CqOBdVZXZfq5MMr130R7aiZBI2g5dJYUaW1PS81DVNpd0/Sq/Gzg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.51.tgz", + "integrity": "sha1-mB2vLOw0emIx06odnhgDsDqqpKg=" }, "@babel/types": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.46.tgz", - "integrity": "sha512-uA5aruF2KKsJxToWdDpftsrPOIQtoGrGno2hiaeO9JRvfT9xZdK11nPoC+/RF9emNzmNbWn4HCRdCY+McT5Nbw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.51.tgz", + "integrity": "sha1-2AK3tUO1g2x3iqaReXq/APPZfqk=" }, "acorn": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", - "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==" + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.6.2.tgz", + "integrity": "sha512-zUzo1E5dI2Ey8+82egfnttyMlMZ2y0D8xOCO3PNPPlYXpl8NZvF6Qk9L9BEtJs+43FqEmfBViDqc5d1ckRDguw==" }, "ansi-styles": { "version": "3.2.1", @@ -342,19 +347,34 @@ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==" }, "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + }, "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, + "atob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", + "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=" }, "babel-helper-evaluate-path": { "version": "0.2.0", @@ -447,9 +467,9 @@ "integrity": "sha512-NiOvvA9Pq6bki6nP4BayXwT5GZadw7DJFDDzHmkpnOQpENWe8RtHtKZM44MG1R6EQ5XxgbLdsdhswIzTkFlO5g==" }, "babel-plugin-transform-es2015-modules-reify": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-reify/-/babel-plugin-transform-es2015-modules-reify-0.15.1.tgz", - "integrity": "sha512-QO76PVHIApDp3afwjk+VMpymKZhUeo3tZg/b2ND8g8C859h4xaNPdx6QguxrGaf2ch3IsbbcbcgVseIbIHh+MA==" + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-reify/-/babel-plugin-transform-es2015-modules-reify-0.16.0.tgz", + "integrity": "sha512-c0DTHJdkXGE/PcJbPzG9vQ3QEP4kMjoLzs77ulMA7y9iagvsPmmH27PtZGEryubGG/Kiywh9H/JXGovgF+9hig==" }, "babel-plugin-transform-inline-consecutive-adds": { "version": "0.2.0", @@ -457,24 +477,24 @@ "integrity": "sha512-GlhOuLOQ28ua9prg0hT33HslCrEmz9xWXy9ZNZSACppCyRxxRW+haYtRgm7uYXCcd0q8ggCWD2pfWEJp5iiZfQ==" }, "babel-plugin-transform-member-expression-literals": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.1.tgz", - "integrity": "sha1-lr4umWjn9UlzM64DKE7NU0BAVIk=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.4.tgz", + "integrity": "sha1-NwOcmgwzE6OUlfqsL/OmtbnQOL8=" }, "babel-plugin-transform-merge-sibling-variables": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.9.1.tgz", - "integrity": "sha1-kHHkQ7IUWM5rCo04QbpaF09dwoI=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.9.4.tgz", + "integrity": "sha1-hbQi/DN3tEnJ0c3kQIcgNTJAHa4=" }, "babel-plugin-transform-minify-booleans": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.1.tgz", - "integrity": "sha1-UsunnAD6UJc3BkBV76siFm4UDE0=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.4.tgz", + "integrity": "sha1-rLs+VqNVXdI5KOS1gtKFFi3SsZg=" }, "babel-plugin-transform-property-literals": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.9.1.tgz", - "integrity": "sha1-aXD5Oxd5OrzenPJdLozRPgCI5ck=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.9.4.tgz", + "integrity": "sha1-mMHSHiVXNlc/k+zlRFn2ziSYXTk=" }, "babel-plugin-transform-regexp-constructors": { "version": "0.2.0", @@ -482,14 +502,14 @@ "integrity": "sha512-7IsQ6aQx6LAaOqy97/PthTf+5Nx9grZww3r6E62IdWe76Yr8KsuwVjxzqSPQvESJqTE3EMADQ9S0RtwWDGNG9Q==" }, "babel-plugin-transform-remove-console": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.1.tgz", - "integrity": "sha1-QP6V2YyuWBHYoOGImBLXixKFllE=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz", + "integrity": "sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A=" }, "babel-plugin-transform-remove-debugger": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.9.1.tgz", - "integrity": "sha1-dlUtLp1sQ9nGdrv8CPPCoswUvhQ=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.9.4.tgz", + "integrity": "sha1-QrcnYxyXl44estGZp67IShgznvI=" }, "babel-plugin-transform-remove-undefined": { "version": "0.2.0", @@ -497,65 +517,153 @@ "integrity": "sha512-O8v57tPMHkp89kA4ZfQEYds/pzgvz/QYerBJjIuL5/Jc7RnvMVRA5gJY9zFKP7WayW8WOSBV4vh8Y8FJRio+ow==" }, "babel-plugin-transform-simplify-comparison-operators": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.1.tgz", - "integrity": "sha1-Ww0GmAoXp4D1MYsnTAC+L7HHxP4=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz", + "integrity": "sha1-9ir+CWyrDh9ootdT/fKDiIRxzrk=" }, "babel-plugin-transform-undefined-to-void": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.1.tgz", - "integrity": "sha1-19+cHdDsEuD/6JXtFEX2Hxv14iE=" + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz", + "integrity": "sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA=" }, "babel-preset-meteor": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/babel-preset-meteor/-/babel-preset-meteor-7.0.0-beta.46.tgz", - "integrity": "sha512-XrxvtwFrvs046DIQXMkrb0QM5t8xj8YQ8jc9cTOmzL4VHvAEFttlzGkgBfCLa2cKB5nE7dbacxTgDQPKPtC5Lw==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/babel-preset-meteor/-/babel-preset-meteor-7.0.0-beta.51.tgz", + "integrity": "sha512-IUaRprdQQzptcMOPpcL+FCiAVr8Zxq9vht5+ij87CEtgbuhmcr35VuBx2H211melKXgy86P0vvO2AgL0FkJe8A==" }, "babel-preset-minify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.2.0.tgz", "integrity": "sha512-mR8Q44RmMzm18bM2Lqd9uiPopzk5GDCtVuquNbLFmX6lOKnqWoenaNBxnWW0UhBFC75lEHTIgNGCbnsRI0pJVw==" }, - "babylon": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.46.tgz", - "integrity": "sha512-WFJlg2WatdkXRFMpk7BN/Uzzkjkcjk+WaqnrSCpay+RYl4ypW9ZetZyT9kNt22IH/BQNst3M6PaaBn9IXsUNrg==" + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=" + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==" + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==" + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==" + } + } }, "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=" + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=" + } + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==" }, "chalk": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.0.tgz", - "integrity": "sha512-Wr/w0f4o9LuE7K53cD0qmbAMM+2XNLzR29vFn5hqko4sxGlUsyy363NvmyGIyk5tpe9cjTr9SJYbysEyPkRnFw==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==" + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=" + } + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=" }, "color-convert": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==" + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==" }, "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=" + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" }, "convert-source-map": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=" }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + }, "core-js": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", - "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=" + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==" }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==" + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==" + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==" + } + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -567,109 +675,209 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" }, "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=" + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==" + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=" + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=" + } + } }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=" + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==" + } + } }, "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=" - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=" + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=" + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==" + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==" + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==" + } + } }, "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=" + } + } }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=" + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=" }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=" - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=" + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" }, "globals": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.4.0.tgz", - "integrity": "sha512-Dyzmifil8n/TmSqYDEXbm+C8yitzJQqQIlJQLNRMwa+BOUJpRC19pyVeN12JAjt61xonvXjtff+hJruTRXn5HA==" + "version": "11.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.5.0.tgz", + "integrity": "sha512-hYyf+kI8dm3nORsiiXUQigOU62hDLfJ9G01uyGMxhc6BKsircrUhC4uJPQPUSuq2GrTmiiEt7ewxlMdBewfmKQ==" }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=" + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=" + } + } + }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==" }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" + } + } + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=" + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" + } + } }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=" + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } + } }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=" - }, "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" + } + } }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=" - }, - "is-primitive": { + "is-odd": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-2.0.0.tgz", + "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==" + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" }, "isarray": { "version": "1.0.0", @@ -677,9 +885,9 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, "js-tokens": { "version": "3.0.2", @@ -697,14 +905,14 @@ "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" }, "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" }, "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" }, "lodash.isplainobject": { "version": "4.0.6", @@ -721,10 +929,20 @@ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=" }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=" + }, "meteor-babel": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/meteor-babel/-/meteor-babel-7.0.0-beta.46.tgz", - "integrity": "sha512-WbL1SR2kFT8P++eeqdjPhkDKi7zhgtYdr3fT73UdqftYRl0d1FpegzUTW3Rh8HdjS/PlqCQdBIbFa7cjo/uIKg==" + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/meteor-babel/-/meteor-babel-7.0.0-beta.51.tgz", + "integrity": "sha512-J315Kof9+8cjVP53k0lqGfgGq2+jY9b8V7NnbHqjX2kgBvcqHHIpfHslYtSM/4nG0uJdckUeZsB9HQdWtewRHA==" }, "meteor-babel-helpers": { "version": "0.0.3", @@ -732,78 +950,88 @@ "integrity": "sha1-8uXZ+HlvvS6JAQI9dpnlsgLqn7A=" }, "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=" + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==" + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==" + } + } }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=" + "nanomatch": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", + "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==" }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=" + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=" + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" + } + } }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=" + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=" + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=" + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" }, "path-parse": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=" + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, - "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=" - } - } - }, "regenerate": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", - "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==" }, "regenerate-unicode-properties": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-5.1.3.tgz", - "integrity": "sha512-Yjy6t7jFQczDhYE+WVm7pg6gWYE258q4sUkk9qDErwXJIqx7jU9jGrMFHutJK/SRfcg7MEkXjGaYiVlOZyev/A==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz", + "integrity": "sha512-s5NGghCE4itSlUS+0WUj88G6cfMVMmH8boTPNvABf8od+2dhT9WDlWu8n01raQAJZMOK8Ch6jSexaRO7swd6aw==" }, "regenerator-runtime": { "version": "0.11.1", @@ -811,29 +1039,29 @@ "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" }, "regenerator-transform": { - "version": "0.12.3", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.12.3.tgz", - "integrity": "sha512-y2uxO/6u+tVmtEDIKo+tLCtI0GcbQr0OreosKgCd7HP4VypGjtTrw79DezuwT+W5QX0YWuvpeBOgumrepwM1kA==" + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.12.4.tgz", + "integrity": "sha512-p2I0fY+TbSLD2/VFTFb/ypEHxs3e3AjU0DzttdPqk2bSmDhfSh5E54b86Yc6XhUa5KykK1tgbvZ4Nr82oCJWkQ==" }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==" + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==" }, "regexpu-core": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.1.3.tgz", - "integrity": "sha512-mB+njEzO7oezA57IbQxxd6fVPOeWKDmnGvJ485CwmfNchjHe5jWwqKepapmzUEj41yxIAqOg+C4LbXuJlkiO8A==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.2.0.tgz", + "integrity": "sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==" }, "regjsgen": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.3.0.tgz", - "integrity": "sha1-DuSj6SdkMM2iXx54nqbBW4ewy0M=" + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.4.0.tgz", + "integrity": "sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==" }, "regjsparser": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.2.1.tgz", - "integrity": "sha1-w3h1U/rwTndcMCEC7zRtmVAA7Bw=", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.3.0.tgz", + "integrity": "sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==", "dependencies": { "jsesc": { "version": "0.5.0", @@ -843,14 +1071,9 @@ } }, "reify": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/reify/-/reify-0.15.1.tgz", - "integrity": "sha512-XUIO34oFNXyb8cYRw3eVN0oqD3LwxaBFml5cHZf3Uiw6v+pfPB0D7kxKCdBjvaa1cneDtUqqQ94MPQkJt2kEWg==" - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/reify/-/reify-0.16.2.tgz", + "integrity": "sha512-9kL/IYcFiBbwpQFScNcFBJ5zhCEJTNujeDEEv5SoSg5er0V5CDbef2zNEk9FBeI9oehGOG5zM4APXgp5n3Llbw==" }, "repeat-element": { "version": "1.1.2", @@ -867,16 +1090,131 @@ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==" }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=" + }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=" + } + } + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==" + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=" + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=" + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=" + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==" + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==" + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==" + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" + } + } + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==" + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==" + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=" + } + } + }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -887,30 +1225,103 @@ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=" + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==" + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=" + }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, "unicode-canonical-property-names-ecmascript": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.3.tgz", - "integrity": "sha512-iG/2t0F2LAU8aZYPkX5gi7ebukHnr3sWFESpb+zPQeeaQwOkfoO6ZW17YX7MdRPNG9pCy+tjzGill+Ah0Em0HA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==" }, "unicode-match-property-ecmascript": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.3.tgz", - "integrity": "sha512-nFcaBFcr08UQNF15ZgI5ISh3yUnQm7SJRRxwYrL5VYX46pS+6Q7TCTv4zbK+j6/l7rQt0mMiTL2zpmeygny6rA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==" }, "unicode-match-property-value-ecmascript": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.1.tgz", - "integrity": "sha512-lM8B0FDZQh9yYGgiabRQcyWicB27VLOolSBRIxsO7FeQPtg+79Oe7sC8Mzr8BObDs+G9CeYmC/shHo6OggNEog==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz", + "integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==" }, "unicode-property-aliases-ecmascript": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.3.tgz", - "integrity": "sha512-TdDmDOTxEf2ad1g3ZBpM6cqKIb2nJpVlz1Q++casDryKz18tpeMBhSng9hjC1CTQCkOV9Rw2knlSB6iRo7ad1w==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz", + "integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg==" + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=" + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=" + } + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=" + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + }, + "use": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", + "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==" } } } diff --git a/packages/babel-compiler/babel-compiler.js b/packages/babel-compiler/babel-compiler.js index 45d72ede78..14fdee6143 100644 --- a/packages/babel-compiler/babel-compiler.js +++ b/packages/babel-compiler/babel-compiler.js @@ -9,6 +9,7 @@ BabelCompiler = function BabelCompiler(extraFeatures) { this.extraFeatures = extraFeatures; this._babelrcCache = null; this._babelrcWarnings = Object.create(null); + this.cacheDirectory = null; }; var BCp = BabelCompiler.prototype; @@ -20,15 +21,27 @@ var hasOwn = Object.prototype.hasOwnProperty; var isMeteorPre144 = semver.lt(process.version, "4.8.1"); BCp.processFilesForTarget = function (inputFiles) { + var compiler = this; + // Reset this cache for each batch processed. this._babelrcCache = null; inputFiles.forEach(function (inputFile) { - var toBeAdded = this.processOneFileForTarget(inputFile); - if (toBeAdded) { - inputFile.addJavaScript(toBeAdded); + if (inputFile.supportsLazyCompilation) { + inputFile.addJavaScript({ + path: inputFile.getPathInPackage(), + hash: inputFile.getSourceHash(), + bare: !! inputFile.getFileOptions().bare + }, function () { + return compiler.processOneFileForTarget(inputFile); + }); + } else { + var toBeAdded = compiler.processOneFileForTarget(inputFile); + if (toBeAdded) { + inputFile.addJavaScript(toBeAdded); + } } - }, this); + }); }; // Returns an object suitable for passing to inputFile.addJavaScript, or @@ -55,8 +68,11 @@ BCp.processOneFileForTarget = function (inputFile, source) { sourceMap: null, bare: !! fileOptions.bare }; - var cacheDeps = { - sourceHash: toBeAdded.hash + var cacheOptions = { + cacheDirectory: this.cacheDirectory, + cacheDeps: { + sourceHash: toBeAdded.hash, + }, }; // If you need to exclude a specific file within a package from Babel @@ -71,11 +87,14 @@ BCp.processOneFileForTarget = function (inputFile, source) { ! excludedFileExtensionPattern.test(inputFilePath)) { var extraFeatures = Object.assign({}, this.extraFeatures); + var arch = inputFile.getArch(); - if (inputFile.getArch().startsWith("os.")) { + if (arch.startsWith("os.")) { // Start with a much simpler set of Babel presets and plugins if // we're compiling for Node 8. extraFeatures.nodeMajorVersion = parseInt(process.versions.node); + } else if (arch === "web.browser") { + extraFeatures.modernBrowsers = true; } if (! extraFeatures.hasOwnProperty("jscript")) { @@ -87,9 +106,13 @@ BCp.processOneFileForTarget = function (inputFile, source) { var babelOptions = Babel.getDefaultOptions(extraFeatures); - this.inferExtraBabelOptions(inputFile, babelOptions, cacheDeps); + this.inferExtraBabelOptions( + inputFile, + babelOptions, + cacheOptions.cacheDeps, + ); - babelOptions.sourceMap = true; + babelOptions.sourceMaps = true; babelOptions.filename = babelOptions.sourceFileName = packageName ? "packages/" + packageName + "/" + inputFilePath @@ -97,7 +120,7 @@ BCp.processOneFileForTarget = function (inputFile, source) { try { var result = profile('Babel.compile', function () { - return Babel.compile(source, babelOptions, cacheDeps); + return Babel.compile(source, babelOptions, cacheOptions); }); } catch (e) { if (e.loc) { @@ -140,7 +163,7 @@ BCp.processOneFileForTarget = function (inputFile, source) { }; BCp.setDiskCacheDirectory = function (cacheDir) { - Babel.setCacheDir(cacheDir); + this.cacheDirectory = cacheDir; }; function profile(name, func) { @@ -170,57 +193,64 @@ BCp._inferFromBabelRc = function (inputFile, babelOptions, cacheDeps) { if (babelrcPath) { if (! hasOwn.call(this._babelrcCache, babelrcPath)) { try { - this._babelrcCache[babelrcPath] = - JSON.parse(inputFile.readAndWatchFile(babelrcPath)); + this._babelrcCache[babelrcPath] = { + controlFilePath: babelrcPath, + controlFileData: JSON.parse( + inputFile.readAndWatchFile(babelrcPath)), + deps: Object.create(null), + }; } catch (e) { if (e instanceof SyntaxError) { e.message = ".babelrc is not a valid JSON file: " + e.message; } - throw e; } } - return this._inferHelper( - inputFile, - babelOptions, - babelrcPath, - this._babelrcCache[babelrcPath], - cacheDeps - ); + const cacheEntry = this._babelrcCache[babelrcPath]; + + if (this._inferHelper(inputFile, cacheEntry)) { + merge(babelOptions, cacheEntry, "presets"); + merge(babelOptions, cacheEntry, "plugins"); + Object.assign(cacheDeps, cacheEntry.deps); + return true; + } } }; BCp._inferFromPackageJson = function (inputFile, babelOptions, cacheDeps) { var pkgJsonPath = inputFile.findControlFile("package.json"); if (pkgJsonPath) { - if (! hasOwn.call(this._babelrcCache, pkgJsonPath)) { - this._babelrcCache[pkgJsonPath] = JSON.parse( - inputFile.readAndWatchFile(pkgJsonPath) - ).babel || null; - } + const cacheEntry = hasOwn.call(this._babelrcCache, pkgJsonPath) + ? this._babelrcCache[pkgJsonPath] + : this._babelrcCache[pkgJsonPath] = { + controlFilePath: pkgJsonPath, + controlFileData: JSON.parse( + inputFile.readAndWatchFile(pkgJsonPath) + ).babel || null, + deps: Object.create(null), + }; - return this._inferHelper( - inputFile, - babelOptions, - pkgJsonPath, - this._babelrcCache[pkgJsonPath], - cacheDeps - ); + if (this._inferHelper(inputFile, cacheEntry)) { + merge(babelOptions, cacheEntry, "presets"); + merge(babelOptions, cacheEntry, "plugins"); + Object.assign(cacheDeps, cacheEntry.deps); + return true; + } } }; -BCp._inferHelper = function ( - inputFile, - babelOptions, - controlFilePath, - babelrc, - cacheDeps -) { - if (! babelrc) { +BCp._inferHelper = function (inputFile, cacheEntry) { + if (! cacheEntry.controlFileData) { return false; } + if (hasOwn.call(cacheEntry, "finalInferHelperResult")) { + // We've already run _inferHelper and populated + // cacheEntry.{presets,plugins}, so we can return early here. + return cacheEntry.finalInferHelperResult; + } + var compiler = this; function walkBabelRC(obj, path) { @@ -281,7 +311,7 @@ BCp._inferHelper = function ( // The value is a string that we need to require. const result = requireWithPath(value, path); if (result && result.module) { - cacheDeps[result.name] = result.version; + cacheEntry.deps[result.name] = result.version; return walkBabelRC(result.module, path); } @@ -307,20 +337,23 @@ BCp._inferHelper = function ( prefixes.push(""); try { - return requireWithPrefixes(inputFile, id, prefixes, controlFilePath); + return requireWithPrefixes( + inputFile, id, prefixes, + cacheEntry.controlFilePath + ); } catch (e) { if (e.code !== "MODULE_NOT_FOUND") { throw e; } if (! hasOwn.call(compiler._babelrcWarnings, id)) { - compiler._babelrcWarnings[id] = controlFilePath; + compiler._babelrcWarnings[id] = cacheEntry.controlFilePath; console.error( "Warning: unable to resolve " + JSON.stringify(id) + " in " + path.join(".") + - " of " + controlFilePath + ", due to:" + " of " + cacheEntry.controlFilePath + ", due to:" ); console.error(e.stack || e); @@ -330,26 +363,29 @@ BCp._inferHelper = function ( } } - const clean = walkBabelRC(babelrc); - merge(babelOptions, clean, "presets"); - merge(babelOptions, clean, "plugins"); + const { controlFileData } = cacheEntry; + const clean = walkBabelRC(controlFileData); + merge(cacheEntry, clean, "presets"); + merge(cacheEntry, clean, "plugins"); - if (babelrc && babelrc.env) { + if (controlFileData && + controlFileData.env) { const envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development"; - const clean = walkBabelRC(babelrc.env[envKey]); + const clean = walkBabelRC(controlFileData.env[envKey]); if (clean) { - merge(babelOptions, clean, "presets"); - merge(babelOptions, clean, "plugins"); + merge(cacheEntry, clean, "presets"); + merge(cacheEntry, clean, "plugins"); } } - return !! (babelOptions.presets || - babelOptions.plugins); + return cacheEntry.finalInferHelperResult = + !! (cacheEntry.presets || + cacheEntry.plugins); }; function merge(babelOptions, babelrc, name) { @@ -373,12 +409,14 @@ function requireWithPrefixes(inputFile, id, prefixes, controlFilePath) { // Call inputFile.resolve here rather than inputFile.require so // that the import doesn't fail due to missing transitive // dependencies imported by the preset or plugin. - if (inputFile.resolve(prefix + id)) { + if (inputFile.resolve(prefix + id, controlFilePath)) { presetOrPluginId = prefix + id; } presetOrPluginMeta = inputFile.require( - packageNameFromTopLevelModuleId(prefix + id) + "/package.json"); + packageNameFromTopLevelModuleId(prefix + id) + "/package.json", + controlFilePath + ); return true; @@ -403,7 +441,11 @@ function requireWithPrefixes(inputFile, id, prefixes, controlFilePath) { // to compile application code the same way Meteor does. return null; } - presetOrPlugin = inputFile.require(presetOrPluginId); + + presetOrPlugin = inputFile.require( + presetOrPluginId, + controlFilePath + ); } } else { diff --git a/packages/babel-compiler/babel.js b/packages/babel-compiler/babel.js index 90f88704aa..2adbbae925 100644 --- a/packages/babel-compiler/babel.js +++ b/packages/babel-compiler/babel.js @@ -9,13 +9,7 @@ function getMeteorBabel() { function getDefaultOptions(extraFeatures) { // See https://github.com/meteor/babel/blob/master/options.js for more // information about what the default options are. - var options = getMeteorBabel().getDefaultOptions(extraFeatures); - - // The sourceMap option should probably be removed from the default - // options returned by meteorBabel.getDefaultOptions. - delete options.sourceMap; - - return options; + return getMeteorBabel().getDefaultOptions(extraFeatures); } Babel = { @@ -28,11 +22,16 @@ Babel = { return getMeteorBabel().parse(source); }, - compile: function (source, options) { - options = options || getDefaultOptions(); - return getMeteorBabel().compile(source, options); + compile: function (source, babelOptions, cacheOptions) { + return getMeteorBabel().compile( + source, + babelOptions || getDefaultOptions(), + cacheOptions, + ); }, + // This method is deprecated in favor of passing + // cacheDeps.cacheDirectory to Babel.compile (see above). setCacheDir: function (cacheDir) { getMeteorBabel().setCacheDir(cacheDir); }, @@ -44,5 +43,9 @@ Babel = { getMinifierOptions: function (extraFeatures) { return getMeteorBabel().getMinifierOptions(extraFeatures); + }, + + getMinimumModernBrowserVersions: function () { + return Npm.require("meteor-babel/modern-versions.js").get(); } }; diff --git a/packages/babel-compiler/package.js b/packages/babel-compiler/package.js index 089c9708f9..a37b2028f3 100644 --- a/packages/babel-compiler/package.js +++ b/packages/babel-compiler/package.js @@ -6,19 +6,21 @@ Package.describe({ // isn't possible because you can't publish a non-recommended // release with package versions that don't have a pre-release // identifier at the end (eg, -dev) - version: '7.0.8' + version: '7.2.0' }); Npm.depends({ - 'meteor-babel': '7.0.0-beta.46' + 'meteor-babel': '7.0.0-beta.51' }); Package.onUse(function (api) { api.use('ecmascript-runtime', 'server'); + api.use('modern-browsers'); api.addFiles([ 'babel.js', - 'babel-compiler.js' + 'babel-compiler.js', + 'versions.js', ], 'server'); api.export('Babel', 'server'); diff --git a/packages/babel-compiler/versions.js b/packages/babel-compiler/versions.js new file mode 100644 index 0000000000..fddb7c35e8 --- /dev/null +++ b/packages/babel-compiler/versions.js @@ -0,0 +1,11 @@ +// Make sure code compiled with features.modernBrowsers is delivered only +// to browsers that satisfy the assumptions of meteor-babel's modern Babel +// configuration. +Package["modern-browsers"].setMinimumBrowserVersions( + Babel.getMinimumModernBrowserVersions(), + // Although module.id is the recommended source string to pass as the + // second argument to setMinimumBrowserVersions, we can't use module.id + // here because babel-compiler cannot depend on the modules package. We + // can still make this string look like any other module.id, though. + "/node_modules/meteor/babel-compiler/versions.js" +); diff --git a/packages/boilerplate-generator/generator.js b/packages/boilerplate-generator/generator.js index e3c536bf0c..d83ca7b915 100644 --- a/packages/boilerplate-generator/generator.js +++ b/packages/boilerplate-generator/generator.js @@ -22,7 +22,7 @@ let shouldWarnAboutToHTMLDeprecation = ! Meteor.isProduction; export class Boilerplate { constructor(arch, manifest, options = {}) { - const { headTemplate, closeTemplate } = _getTemplate(arch); + const { headTemplate, closeTemplate } = getTemplate(arch); this.headTemplate = headTemplate; this.closeTemplate = closeTemplate; this.baseData = null; @@ -154,12 +154,16 @@ export class Boilerplate { // Returns a template function that, when called, produces the boilerplate // html as a string. -const _getTemplate = arch => { - if (arch === 'web.browser') { +function getTemplate(arch) { + const prefix = arch.split(".", 2).join("."); + + if (prefix === "web.browser") { return WebBrowserTemplate; - } else if (arch === 'web.cordova') { - return WebCordovaTemplate; - } else { - throw new Error('Unsupported arch: ' + arch); } -}; + + if (prefix === "web.cordova") { + return WebCordovaTemplate; + } + + throw new Error("Unsupported arch: " + arch); +} diff --git a/packages/caching-compiler/.npm/package/.gitignore b/packages/caching-compiler/.npm/package/.gitignore deleted file mode 100644 index 3c3629e647..0000000000 --- a/packages/caching-compiler/.npm/package/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/packages/caching-compiler/.npm/package/README b/packages/caching-compiler/.npm/package/README deleted file mode 100644 index 3d492553a4..0000000000 --- a/packages/caching-compiler/.npm/package/README +++ /dev/null @@ -1,7 +0,0 @@ -This directory and the files immediately inside it are automatically generated -when you change this package's NPM dependencies. Commit the files in this -directory (npm-shrinkwrap.json, .gitignore, and this README) to source control -so that others run the same versions of sub-dependencies. - -You should NOT check in the node_modules directory that Meteor automatically -creates; if you are using git, the .gitignore file tells git to ignore it. diff --git a/packages/caching-compiler/.npm/package/npm-shrinkwrap.json b/packages/caching-compiler/.npm/package/npm-shrinkwrap.json deleted file mode 100644 index f0ac52d443..0000000000 --- a/packages/caching-compiler/.npm/package/npm-shrinkwrap.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "lockfileVersion": 1, - "dependencies": { - "async": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/async/-/async-1.4.0.tgz", - "integrity": "sha1-Nfhvg8WeBCHQmc2akdgnj7V4wA0=" - }, - "lru-cache": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.4.tgz", - "integrity": "sha1-JnUZDM0bBwHsL2UqTQ09QA12wN0=" - } - } -} diff --git a/packages/caching-compiler/caching-compiler.js b/packages/caching-compiler/caching-compiler.js index 6c4abd335f..f8198b360c 100644 --- a/packages/caching-compiler/caching-compiler.js +++ b/packages/caching-compiler/caching-compiler.js @@ -2,9 +2,7 @@ const fs = Plugin.fs; const path = Plugin.path; const createHash = Npm.require('crypto').createHash; const assert = Npm.require('assert'); -const Future = Npm.require('fibers/future'); const LRU = Npm.require('lru-cache'); -const async = Npm.require('async'); // Base class for CachingCompiler and MultiFileCachingCompiler. CachingCompilerBase = class CachingCompilerBase { @@ -283,14 +281,12 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase { const cacheMisses = []; const arches = this._cacheDebugEnabled && Object.create(null); - const future = new Future; - async.eachLimit(inputFiles, this._maxParallelism, (inputFile, cb) => { + return Promise.all(inputFiles.map(async (inputFile) => { if (arches) { arches[inputFile.getArch()] = 1; } - let error = null; - try { + const getResult = async () => { const cacheKey = this._deepHash(this.getCacheKey(inputFile)); let compileResult = this._cache.get(cacheKey); @@ -303,7 +299,7 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase { if (! compileResult) { cacheMisses.push(inputFile.getDisplayPath()); - compileResult = this.compileOneFile(inputFile); + compileResult = await this.compileOneFile(inputFile); if (! compileResult) { // compileOneFile should have called inputFile.error. @@ -316,17 +312,27 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase { this._writeCacheAsync(cacheKey, compileResult); } - this.addCompileResult(inputFile, compileResult); - } catch (e) { - error = e; - } finally { - cb(error); - } - }, future.resolver()); - future.wait(); + return compileResult; + }; + + if (this.compileOneFileLater && + inputFile.supportsLazyCompilation && + ! this._cacheDebugEnabled) { + await this.compileOneFileLater(inputFile, getResult); + } else { + const result = await getResult(); + if (result) { + this.addCompileResult(inputFile, result); + } + } + + })).then(() => { + if (! this._cacheDebugEnabled) { + return; + } - if (this._cacheDebugEnabled) { cacheMisses.sort(); + this._cacheDebug( `Ran (#${ ++this._callCount @@ -336,7 +342,7 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase { JSON.stringify(Object.keys(arches).sort()) }` ); - } + }); } _cacheFilename(cacheKey) { diff --git a/packages/caching-compiler/multi-file-caching-compiler.js b/packages/caching-compiler/multi-file-caching-compiler.js index 6cb698cb34..2bc0f41b2c 100644 --- a/packages/caching-compiler/multi-file-caching-compiler.js +++ b/packages/caching-compiler/multi-file-caching-compiler.js @@ -1,7 +1,5 @@ const path = Plugin.path; -const Future = Npm.require('fibers/future'); const LRU = Npm.require('lru-cache'); -const async = Npm.require('async'); // MultiFileCachingCompiler is like CachingCompiler, but for implementing // languages which allow files to reference each other, such as CSS @@ -92,20 +90,12 @@ extends CachingCompilerBase { cacheKeyMap.set(importPath, this._getCacheKeyWithPath(inputFile)); }); - const allProcessedFuture = new Future; - async.eachLimit(inputFiles, this._maxParallelism, (inputFile, cb) => { + return Promise.all(inputFiles.map(async (inputFile) => { if (arches) { arches[inputFile.getArch()] = 1; } - let error = null; - try { - // If this isn't a root, skip it (and definitely don't waste time - // looking for a cache file that won't be there). - if (!this.isRoot(inputFile)) { - return; - } - + const getResult = async () => { const absoluteImportPath = this.getAbsoluteImportPath(inputFile); const cacheKey = cacheKeyMap.get(absoluteImportPath); let cacheEntry = this._cache.get(cacheKey); @@ -119,13 +109,19 @@ extends CachingCompilerBase { if (! (cacheEntry && this._cacheEntryValid(cacheEntry, cacheKeyMap))) { cacheMisses.push(inputFile.getDisplayPath()); - const compileOneFileReturn = this.compileOneFile(inputFile, allFiles); + const compileOneFileReturn = + await this.compileOneFile(inputFile, allFiles); + if (! compileOneFileReturn) { // compileOneFile should have called inputFile.error. - // We don't cache failures for now. + // We don't cache failures for now. return; } - const {compileResult, referencedImportPaths} = compileOneFileReturn; + + const { + compileResult, + referencedImportPaths, + } = compileOneFileReturn; cacheEntry = { compileResult, @@ -148,17 +144,27 @@ extends CachingCompilerBase { this._writeCacheAsync(cacheKey, cacheEntry); } - this.addCompileResult(inputFile, cacheEntry.compileResult); - } catch (e) { - error = e; - } finally { - cb(error); - } - }, allProcessedFuture.resolver()); - allProcessedFuture.wait(); + return cacheEntry.compileResult; + }; + + if (this.compileOneFileLater && + inputFile.supportsLazyCompilation && + ! this._cacheDebugEnabled) { + await this.compileOneFileLater(inputFile, getResult); + } else if (this.isRoot(inputFile)) { + const result = await getResult(); + if (result) { + this.addCompileResult(inputFile, result); + } + } + + })).then(() => { + if (! this._cacheDebugEnabled) { + return; + } - if (this._cacheDebugEnabled) { cacheMisses.sort(); + this._cacheDebug( `Ran (#${ ++this._callCount @@ -166,8 +172,9 @@ extends CachingCompilerBase { JSON.stringify(cacheMisses) } ${ JSON.stringify(Object.keys(arches).sort()) - }`); - } + }` + ); + }); } // Returns a hash that incorporates both this.getCacheKey(inputFile) and diff --git a/packages/caching-compiler/package.js b/packages/caching-compiler/package.js index 37b38bfde1..987d9b7651 100644 --- a/packages/caching-compiler/package.js +++ b/packages/caching-compiler/package.js @@ -1,15 +1,10 @@ Package.describe({ name: 'caching-compiler', - version: '1.1.12', + version: '1.2.0', summary: 'An easy way to make compiler plugins cache', documentation: 'README.md' }); -Npm.depends({ - 'lru-cache': '2.6.4', - 'async': '1.4.0' -}); - Package.onUse(function(api) { api.use(['ecmascript', 'random']); api.addFiles(['caching-compiler.js'], 'server'); diff --git a/packages/ddp-client/.npm/package/npm-shrinkwrap.json b/packages/ddp-client/.npm/package/npm-shrinkwrap.json index 56bebb3f83..83ff1746e4 100644 --- a/packages/ddp-client/.npm/package/npm-shrinkwrap.json +++ b/packages/ddp-client/.npm/package/npm-shrinkwrap.json @@ -2,9 +2,9 @@ "lockfileVersion": 1, "dependencies": { "lolex": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.4.0.tgz", - "integrity": "sha1-LycSsbwYDendzF06epbvPAuxYq0=" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", + "integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==" } } } diff --git a/packages/ddp-client/package.js b/packages/ddp-client/package.js index 7c2ebf8a8f..1605d90820 100644 --- a/packages/ddp-client/package.js +++ b/packages/ddp-client/package.js @@ -5,7 +5,7 @@ Package.describe({ }); Npm.depends({ - lolex: '1.4.0' + lolex: '2.3.1' }); Package.onUse((api) => { diff --git a/packages/ddp-server/crossbar.js b/packages/ddp-server/crossbar.js index a95060c488..6672059f99 100644 --- a/packages/ddp-server/crossbar.js +++ b/packages/ddp-server/crossbar.js @@ -11,6 +11,7 @@ DDPServer._Crossbar = function (options) { // keys 'trigger', 'callback'. As a hack, the empty string means "no // collection". self.listenersByCollection = {}; + self.listenersByCollectionCount = {}; self.factPackage = options.factPackage || "livedata"; self.factName = options.factName || null; }; @@ -48,8 +49,10 @@ _.extend(DDPServer._Crossbar.prototype, { var record = {trigger: EJSON.clone(trigger), callback: callback}; if (! _.has(self.listenersByCollection, collection)) { self.listenersByCollection[collection] = {}; + self.listenersByCollectionCount[collection] = 0; } self.listenersByCollection[collection][id] = record; + self.listenersByCollectionCount[collection]++; if (self.factName && Package['facts-base']) { Package['facts-base'].Facts.incrementServerFact( @@ -63,8 +66,10 @@ _.extend(DDPServer._Crossbar.prototype, { self.factPackage, self.factName, -1); } delete self.listenersByCollection[collection][id]; - if (_.isEmpty(self.listenersByCollection[collection])) { + self.listenersByCollectionCount[collection]--; + if (self.listenersByCollectionCount[collection] === 0) { delete self.listenersByCollection[collection]; + delete self.listenersByCollectionCount[collection]; } } }; diff --git a/packages/ddp-server/package.js b/packages/ddp-server/package.js index adf1a4be58..c738ca316b 100644 --- a/packages/ddp-server/package.js +++ b/packages/ddp-server/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Meteor's latency-compensated distributed data server", - version: '2.1.2', + version: '2.2.0', documentation: null }); diff --git a/packages/dynamic-import/client.js b/packages/dynamic-import/client.js index d34aef856f..7b71af3f18 100644 --- a/packages/dynamic-import/client.js +++ b/packages/dynamic-import/client.js @@ -121,11 +121,15 @@ var fetchURL = require("./common.js").fetchURL; function fetchMissing(missingTree) { return new Promise(function (resolve, reject) { - // Always match the protocol (http or https) and the domain:port of - // the current page. - var url = "//" + location.host + fetchURL; - - HTTP.call("POST", url, { + // If the hostname of the URL returned by Meteor.absoluteUrl differs + // from location.host, then we'll be making a cross-origin request + // here, but that's fine because the dynamic-import server sets + // appropriate CORS headers to enable fetching dynamic modules from + // any origin. Browsers that check CORS do so by sending an additional + // preflight OPTIONS request, which may add latency to the first + // dynamic import() request, so it's a good idea for ROOT_URL to match + // location.host if possible, though not strictly necessary. + HTTP.call("POST", Meteor.absoluteUrl(fetchURL), { query: secretKey ? "key=" + secretKey : void 0, data: missingTree }, function (error, result) { diff --git a/packages/dynamic-import/package.js b/packages/dynamic-import/package.js index 0249edb785..dd99bbd177 100644 --- a/packages/dynamic-import/package.js +++ b/packages/dynamic-import/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "dynamic-import", - version: "0.3.0", + version: "0.4.1", summary: "Runtime support for Meteor 1.5 dynamic import(...) syntax", documentation: "README.md" }); @@ -12,6 +12,7 @@ Package.onUse(function (api) { api.use("modules"); api.use("promise"); api.use("http"); + api.use("modern-browsers"); api.mainModule("client.js", "client"); api.mainModule("server.js", "server"); diff --git a/packages/dynamic-import/server.js b/packages/dynamic-import/server.js index 5c8fd7e78e..ed29b51767 100644 --- a/packages/dynamic-import/server.js +++ b/packages/dynamic-import/server.js @@ -7,6 +7,7 @@ const { normalize: pathNormalize, } = require("path"); const { fetchURL } = require("./common.js"); +const { isModern } = require("meteor/modern-browsers"); const hasOwn = Object.prototype.hasOwnProperty; require("./security.js"); @@ -61,20 +62,41 @@ function randomId(n) { } function middleware(request, response) { - assert.strictEqual(request.method, "POST"); - const chunks = []; - request.on("data", chunk => chunks.push(chunk)); - request.on("end", () => { - response.setHeader("Content-Type", "application/json"); - response.end(JSON.stringify(readTree( - JSON.parse(Buffer.concat(chunks)), - getPlatform(request) - ))); - }); + // Allow dynamic import() requests from any origin. + response.setHeader("Access-Control-Allow-Origin", "*"); + + if (request.method === "OPTIONS") { + const acrh = request.headers["access-control-request-headers"]; + response.setHeader( + "Access-Control-Allow-Headers", + typeof acrh === "string" ? acrh : "*" + ); + response.setHeader("Access-Control-Allow-Methods", "POST"); + response.end(); + } else if (request.method === "POST") { + const chunks = []; + request.on("data", chunk => chunks.push(chunk)); + request.on("end", () => { + response.setHeader("Content-Type", "application/json"); + response.end(JSON.stringify(readTree( + JSON.parse(Buffer.concat(chunks)), + getPlatform(request) + ), null, 2)); + }); + } else { + response.writeHead(405, { + "Cache-Control": "no-cache" + }); + response.end(`method ${request.method} not allowed`); + } } function getPlatform(request) { - let platform = "web.browser"; + const { identifyBrowser } = Package.webapp.WebAppInternals; + const browser = identifyBrowser(request.headers["user-agent"]); + let platform = isModern(browser) + ? "web.browser" + : "web.browser.legacy"; // If the __dynamicImport request includes a secret key, and it matches // dynamicImportInfo[platform].key, use platform instead of the default diff --git a/packages/ecmascript-runtime-client/runtime.js b/packages/ecmascript-runtime-client/legacy.js similarity index 98% rename from packages/ecmascript-runtime-client/runtime.js rename to packages/ecmascript-runtime-client/legacy.js index ca34e191b7..51eded6eeb 100644 --- a/packages/ecmascript-runtime-client/runtime.js +++ b/packages/ecmascript-runtime-client/legacy.js @@ -64,3 +64,5 @@ require('core-js/modules/es6.number.parse-int'); // Typed Arrays require('core-js/modules/es6.typed.uint8-array'); require('core-js/modules/es6.typed.uint32-array'); + +require("./modern.js"); diff --git a/packages/ecmascript-runtime-client/modern.js b/packages/ecmascript-runtime-client/modern.js new file mode 100644 index 0000000000..0453acf40e --- /dev/null +++ b/packages/ecmascript-runtime-client/modern.js @@ -0,0 +1,11 @@ +require("core-js/modules/es6.object.is"); +require("core-js/modules/es6.function.name"); +require("core-js/modules/es6.number.is-finite"); +require("core-js/modules/es6.number.is-nan"); +require("core-js/modules/es7.array.flatten"); +require("core-js/modules/es7.array.flat-map"); +require("core-js/modules/es7.object.values"); +require("core-js/modules/es7.object.entries"); +require("core-js/modules/es7.object.get-own-property-descriptors"); +require("core-js/modules/es7.string.pad-start"); +require("core-js/modules/es7.string.pad-end"); diff --git a/packages/ecmascript-runtime-client/package.js b/packages/ecmascript-runtime-client/package.js index fbfb5bd71c..d70ddb9cce 100644 --- a/packages/ecmascript-runtime-client/package.js +++ b/packages/ecmascript-runtime-client/package.js @@ -1,16 +1,26 @@ Package.describe({ name: "ecmascript-runtime-client", - version: "0.6.2", + version: "0.7.1", summary: "Polyfills for new ECMAScript 2015 APIs like Map and Set", git: "https://github.com/meteor/meteor/tree/devel/packages/ecmascript-runtime-client", documentation: "README.md" }); Package.onUse(function(api) { - api.use("modules", "client"); - api.use("promise", "client"); - api.mainModule("runtime.js", "client"); - api.export("Symbol", "client"); - api.export("Map", "client"); - api.export("Set", "client"); + // If the es5-shim package is installed, make sure it loads before + // ecmascript-runtime-server, since the runtime uses some ES5 APIs like + // Object.defineProperties that are buggy in older browsers. + api.use("es5-shim", { weak: true }); + + api.use("modules"); + api.use("promise"); + api.use("modern-browsers"); + + api.mainModule("versions.js", "server"); + api.mainModule("modern.js", "client"); + + api.mainModule("legacy.js", "legacy"); + api.export("Symbol", "legacy"); + api.export("Map", "legacy"); + api.export("Set", "legacy"); }); diff --git a/packages/ecmascript-runtime-client/versions.js b/packages/ecmascript-runtime-client/versions.js new file mode 100644 index 0000000000..1bced38a73 --- /dev/null +++ b/packages/ecmascript-runtime-client/versions.js @@ -0,0 +1,18 @@ +const { + setMinimumBrowserVersions, +} = require("meteor/modern-browsers"); + +setMinimumBrowserVersions({ + chrome: 49, + edge: 12, + // Since there is no IE11, this effectively excludes Internet Explorer + // (pre-Edge) from the modern classification. #9818 #9839 + ie: 12, + firefox: 45, + mobileSafari: 10, + opera: 38, + safari: 10, + // Electron 1.6.0+ matches Chromium 55, per + // https://github.com/Kilian/electron-to-chromium/blob/master/full-versions.js + electron: [1, 6], +}, module.id); diff --git a/packages/ecmascript-runtime-server/.npm/package/npm-shrinkwrap.json b/packages/ecmascript-runtime-server/.npm/package/npm-shrinkwrap.json index a06fe210bc..f2b94f68ee 100644 --- a/packages/ecmascript-runtime-server/.npm/package/npm-shrinkwrap.json +++ b/packages/ecmascript-runtime-server/.npm/package/npm-shrinkwrap.json @@ -2,9 +2,9 @@ "lockfileVersion": 1, "dependencies": { "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=" + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=" } } } diff --git a/packages/ecmascript-runtime-server/package.js b/packages/ecmascript-runtime-server/package.js index c5ab694565..c9709f5bc7 100644 --- a/packages/ecmascript-runtime-server/package.js +++ b/packages/ecmascript-runtime-server/package.js @@ -1,16 +1,16 @@ Package.describe({ name: "ecmascript-runtime-server", - version: "0.5.0", + version: "0.7.0", summary: "Polyfills for new ECMAScript 2015 APIs like Map and Set", git: "https://github.com/meteor/meteor/tree/devel/packages/ecmascript-runtime-client", documentation: "README.md" }); Npm.depends({ - "core-js": "2.4.1" + "core-js": "2.5.1" }); Package.onUse(function(api) { - api.use("modules", "server"); + api.use("modules"); api.mainModule("runtime.js", "server"); }); diff --git a/packages/ecmascript-runtime/package.js b/packages/ecmascript-runtime/package.js index 1552886ba0..6f2e54e0f0 100644 --- a/packages/ecmascript-runtime/package.js +++ b/packages/ecmascript-runtime/package.js @@ -1,13 +1,13 @@ Package.describe({ name: "ecmascript-runtime", - version: "0.5.0", + version: "0.7.0", summary: "Polyfills for new ECMAScript 2015 APIs like Map and Set", git: "https://github.com/meteor/ecmascript-runtime", documentation: "README.md" }); Package.onUse(function(api) { - api.imply("ecmascript-runtime-client", "client"); + api.imply("ecmascript-runtime-client"); api.imply("ecmascript-runtime-server", "server"); }); diff --git a/packages/ecmascript/ecmascript.js b/packages/ecmascript/ecmascript.js index 62212909da..ac258d6283 100644 --- a/packages/ecmascript/ecmascript.js +++ b/packages/ecmascript/ecmascript.js @@ -1,7 +1,8 @@ ECMAScript = { compileForShell(command) { const babelOptions = Babel.getDefaultOptions(); - babelOptions.sourceMap = false; + delete babelOptions.sourceMap; + delete babelOptions.sourceMaps; babelOptions.ast = false; return Babel.compile(command, babelOptions).code; } diff --git a/packages/ecmascript/package.js b/packages/ecmascript/package.js index 27f4c3279c..63c03acaf7 100644 --- a/packages/ecmascript/package.js +++ b/packages/ecmascript/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'ecmascript', - version: '0.10.8', + version: '0.11.1', summary: 'Compiler plugin that supports ES2015+ in all .js files', documentation: 'README.md' }); diff --git a/packages/ecmascript/runtime-tests.js b/packages/ecmascript/runtime-tests.js index 556f011d4f..4ff00aa91e 100644 --- a/packages/ecmascript/runtime-tests.js +++ b/packages/ecmascript/runtime-tests.js @@ -2,30 +2,24 @@ const isNode8OrLater = Meteor.isServer && parseInt(process.versions.node) >= 8; Tinytest.add("ecmascript - runtime - template literals", (test) => { - function dump(pieces) { - var copy = {}; - // Can't use _.extend({}, pieces) because es5-shim adds enumerable - // methods to Array.prototype, and _.extend has no own property check. - _.each(_.keys(pieces), key => copy[key] = pieces[key]); - return [copy, _.toArray(arguments).slice(1)]; + function dump(strings, ...expressions) { + const copy = Object.create(null); + Object.assign(copy, strings); + copy.raw = strings.raw; + return [copy, expressions]; }; - const foo = 'B'; - // uses `babelHelpers.taggedTemplateLiteralLoose` - test.equal(`\u0041${foo}C`, 'ABC'); - const expected = [{ - 0: 'A', - 1: 'C', - raw: ['\\u0041', 'C'] + const foo = "B"; + + test.equal(`\u0041${foo}C`, "ABC"); + + test.equal(dump`\u0041${foo}C`, [{ + 0: "A", + 1: "C", + raw: ["\\u0041", "C"] }, [ - 'B' - ]]; - - if (isNode8OrLater) { - delete expected[0].raw; - } - - test.equal(dump`\u0041${foo}C`, expected); + "B" + ]]); }); Tinytest.add("ecmascript - runtime - classes - basic", (test) => { diff --git a/packages/es5-shim/client.js b/packages/es5-shim/client.js new file mode 100644 index 0000000000..aa0d54b091 --- /dev/null +++ b/packages/es5-shim/client.js @@ -0,0 +1,5 @@ +require("./import_globals.js"); +require("es5-shim/es5-shim.js"); +require("es5-shim/es5-sham.js"); +require("./console.js"); +require("./export_globals.js"); diff --git a/packages/es5-shim/es5-shim-sham.js b/packages/es5-shim/es5-shim-sham.js deleted file mode 100644 index 9134f10840..0000000000 --- a/packages/es5-shim/es5-shim-sham.js +++ /dev/null @@ -1,2629 +0,0 @@ -/*! - * https://github.com/es-shims/es5-shim - * @license es5-shim Copyright 2009-2015 by contributors, MIT License - * see https://github.com/es-shims/es5-shim/blob/master/LICENSE - * @version 4.5.9 - */ - -// vim: ts=4 sts=4 sw=4 expandtab - -// Add semicolon to prevent IIFE from being passed as argument to concatenated code. -; - -// UMD (Universal Module Definition) -// see https://github.com/umdjs/umd/blob/master/templates/returnExports.js -(function (root, factory) { - 'use strict'; - - /* global define, exports, module */ - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(factory); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like enviroments that support module.exports, - // like Node. - module.exports = factory(); - } else { - // Browser globals (root is window) - root.returnExports = factory(); - } -}(this, function () { - /** - * Brings an environment as close to ECMAScript 5 compliance - * as is possible with the facilities of erstwhile engines. - * - * Annotated ES5: http://es5.github.com/ (specific links below) - * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf - * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/ - */ - - // Shortcut to an often accessed properties, in order to avoid multiple - // dereference that costs universally. This also holds a reference to known-good - // functions. - var $Array = Array; - var ArrayPrototype = $Array.prototype; - var $Object = Object; - var ObjectPrototype = $Object.prototype; - var $Function = Function; - var FunctionPrototype = $Function.prototype; - var $String = String; - var StringPrototype = $String.prototype; - var $Number = Number; - var NumberPrototype = $Number.prototype; - var array_slice = ArrayPrototype.slice; - var array_splice = ArrayPrototype.splice; - var array_push = ArrayPrototype.push; - var array_unshift = ArrayPrototype.unshift; - var array_concat = ArrayPrototype.concat; - var array_join = ArrayPrototype.join; - var call = FunctionPrototype.call; - var apply = FunctionPrototype.apply; - var max = Math.max; - var min = Math.min; - - // Having a toString local variable name breaks in Opera so use to_string. - var to_string = ObjectPrototype.toString; - - /* global Symbol */ - /* eslint-disable one-var-declaration-per-line, no-redeclare, max-statements-per-line */ - var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; - var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, constructorRegex = /^\s*class /, isES6ClassFn = function isES6ClassFn(value) { try { var fnStr = fnToStr.call(value); var singleStripped = fnStr.replace(/\/\/.*\n/g, ''); var multiStripped = singleStripped.replace(/\/\*[.\s\S]*\*\//g, ''); var spaceStripped = multiStripped.replace(/\n/mg, ' ').replace(/ {2}/g, ' '); return constructorRegex.test(spaceStripped); } catch (e) { return false; /* not a function */ } }, tryFunctionObject = function tryFunctionObject(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]', isCallable = function isCallable(value) { if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; }; - - var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }, regexClass = '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : to_string.call(value) === regexClass; }; - var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; }; - /* eslint-enable one-var-declaration-per-line, no-redeclare, max-statements-per-line */ - - /* inlined from http://npmjs.com/define-properties */ - var supportsDescriptors = $Object.defineProperty && (function () { - try { - var obj = {}; - $Object.defineProperty(obj, 'x', { enumerable: false, value: obj }); - for (var _ in obj) { // jscs:ignore disallowUnusedVariables - return false; - } - return obj.x === obj; - } catch (e) { /* this is ES3 */ - return false; - } - }()); - var defineProperties = (function (has) { - // Define configurable, writable, and non-enumerable props - // if they don't exist. - var defineProperty; - if (supportsDescriptors) { - defineProperty = function (object, name, method, forceAssign) { - if (!forceAssign && (name in object)) { - return; - } - $Object.defineProperty(object, name, { - configurable: true, - enumerable: false, - writable: true, - value: method - }); - }; - } else { - defineProperty = function (object, name, method, forceAssign) { - if (!forceAssign && (name in object)) { - return; - } - object[name] = method; - }; - } - return function defineProperties(object, map, forceAssign) { - for (var name in map) { - if (has.call(map, name)) { - defineProperty(object, name, map[name], forceAssign); - } - } - }; - }(ObjectPrototype.hasOwnProperty)); - - // - // Util - // ====== - // - - /* replaceable with https://npmjs.com/package/es-abstract /helpers/isPrimitive */ - var isPrimitive = function isPrimitive(input) { - var type = typeof input; - return input === null || (type !== 'object' && type !== 'function'); - }; - - var isActualNaN = $Number.isNaN || function isActualNaN(x) { - return x !== x; - }; - - var ES = { - // ES5 9.4 - // http://es5.github.com/#x9.4 - // http://jsperf.com/to-integer - /* replaceable with https://npmjs.com/package/es-abstract ES5.ToInteger */ - ToInteger: function ToInteger(num) { - var n = +num; - if (isActualNaN(n)) { - n = 0; - } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - return n; - }, - - /* replaceable with https://npmjs.com/package/es-abstract ES5.ToPrimitive */ - ToPrimitive: function ToPrimitive(input) { - var val, valueOf, toStr; - if (isPrimitive(input)) { - return input; - } - valueOf = input.valueOf; - if (isCallable(valueOf)) { - val = valueOf.call(input); - if (isPrimitive(val)) { - return val; - } - } - toStr = input.toString; - if (isCallable(toStr)) { - val = toStr.call(input); - if (isPrimitive(val)) { - return val; - } - } - throw new TypeError(); - }, - - // ES5 9.9 - // http://es5.github.com/#x9.9 - /* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */ - ToObject: function (o) { - if (o == null) { // this matches both null and undefined - throw new TypeError("can't convert " + o + ' to object'); - } - return $Object(o); - }, - - /* replaceable with https://npmjs.com/package/es-abstract ES5.ToUint32 */ - ToUint32: function ToUint32(x) { - return x >>> 0; - } - }; - - // - // Function - // ======== - // - - // ES-5 15.3.4.5 - // http://es5.github.com/#x15.3.4.5 - - var Empty = function Empty() {}; - - defineProperties(FunctionPrototype, { - bind: function bind(that) { // .length is 1 - // 1. Let Target be the this value. - var target = this; - // 2. If IsCallable(Target) is false, throw a TypeError exception. - if (!isCallable(target)) { - throw new TypeError('Function.prototype.bind called on incompatible ' + target); - } - // 3. Let A be a new (possibly empty) internal list of all of the - // argument values provided after thisArg (arg1, arg2 etc), in order. - // XXX slicedArgs will stand in for "A" if used - var args = array_slice.call(arguments, 1); // for normal call - // 4. Let F be a new native ECMAScript object. - // 11. Set the [[Prototype]] internal property of F to the standard - // built-in Function prototype object as specified in 15.3.3.1. - // 12. Set the [[Call]] internal property of F as described in - // 15.3.4.5.1. - // 13. Set the [[Construct]] internal property of F as described in - // 15.3.4.5.2. - // 14. Set the [[HasInstance]] internal property of F as described in - // 15.3.4.5.3. - var bound; - var binder = function () { - - if (this instanceof bound) { - // 15.3.4.5.2 [[Construct]] - // When the [[Construct]] internal method of a function object, - // F that was created using the bind function is called with a - // list of arguments ExtraArgs, the following steps are taken: - // 1. Let target be the value of F's [[TargetFunction]] - // internal property. - // 2. If target has no [[Construct]] internal method, a - // TypeError exception is thrown. - // 3. Let boundArgs be the value of F's [[BoundArgs]] internal - // property. - // 4. Let args be a new list containing the same values as the - // list boundArgs in the same order followed by the same - // values as the list ExtraArgs in the same order. - // 5. Return the result of calling the [[Construct]] internal - // method of target providing args as the arguments. - - var result = apply.call( - target, - this, - array_concat.call(args, array_slice.call(arguments)) - ); - if ($Object(result) === result) { - return result; - } - return this; - - } else { - // 15.3.4.5.1 [[Call]] - // When the [[Call]] internal method of a function object, F, - // which was created using the bind function is called with a - // this value and a list of arguments ExtraArgs, the following - // steps are taken: - // 1. Let boundArgs be the value of F's [[BoundArgs]] internal - // property. - // 2. Let boundThis be the value of F's [[BoundThis]] internal - // property. - // 3. Let target be the value of F's [[TargetFunction]] internal - // property. - // 4. Let args be a new list containing the same values as the - // list boundArgs in the same order followed by the same - // values as the list ExtraArgs in the same order. - // 5. Return the result of calling the [[Call]] internal method - // of target providing boundThis as the this value and - // providing args as the arguments. - - // equiv: target.call(this, ...boundArgs, ...args) - return apply.call( - target, - that, - array_concat.call(args, array_slice.call(arguments)) - ); - - } - - }; - - // 15. If the [[Class]] internal property of Target is "Function", then - // a. Let L be the length property of Target minus the length of A. - // b. Set the length own property of F to either 0 or L, whichever is - // larger. - // 16. Else set the length own property of F to 0. - - var boundLength = max(0, target.length - args.length); - - // 17. Set the attributes of the length own property of F to the values - // specified in 15.3.5.1. - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - array_push.call(boundArgs, '$' + i); - } - - // XXX Build a dynamic function with desired amount of arguments is the only - // way to set the length property of a function. - // In environments where Content Security Policies enabled (Chrome extensions, - // for ex.) all use of eval or Function costructor throws an exception. - // However in all of these environments Function.prototype.bind exists - // and so this code will never be executed. - bound = $Function('binder', 'return function (' + array_join.call(boundArgs, ',') + '){ return binder.apply(this, arguments); }')(binder); - - if (target.prototype) { - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - // Clean up dangling references. - Empty.prototype = null; - } - - // TODO - // 18. Set the [[Extensible]] internal property of F to true. - - // TODO - // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). - // 20. Call the [[DefineOwnProperty]] internal method of F with - // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: - // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and - // false. - // 21. Call the [[DefineOwnProperty]] internal method of F with - // arguments "arguments", PropertyDescriptor {[[Get]]: thrower, - // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false}, - // and false. - - // TODO - // NOTE Function objects created using Function.prototype.bind do not - // have a prototype property or the [[Code]], [[FormalParameters]], and - // [[Scope]] internal properties. - // XXX can't delete prototype in pure-js. - - // 22. Return F. - return bound; - } - }); - - // _Please note: Shortcuts are defined after `Function.prototype.bind` as we - // use it in defining shortcuts. - var owns = call.bind(ObjectPrototype.hasOwnProperty); - var toStr = call.bind(ObjectPrototype.toString); - var arraySlice = call.bind(array_slice); - var arraySliceApply = apply.bind(array_slice); - var strSlice = call.bind(StringPrototype.slice); - var strSplit = call.bind(StringPrototype.split); - var strIndexOf = call.bind(StringPrototype.indexOf); - var pushCall = call.bind(array_push); - var isEnum = call.bind(ObjectPrototype.propertyIsEnumerable); - var arraySort = call.bind(ArrayPrototype.sort); - - // - // Array - // ===== - // - - var isArray = $Array.isArray || function isArray(obj) { - return toStr(obj) === '[object Array]'; - }; - - // ES5 15.4.4.12 - // http://es5.github.com/#x15.4.4.13 - // Return len+argCount. - // [bugfix, ielt8] - // IE < 8 bug: [].unshift(0) === undefined but should be "1" - var hasUnshiftReturnValueBug = [].unshift(0) !== 1; - defineProperties(ArrayPrototype, { - unshift: function () { - array_unshift.apply(this, arguments); - return this.length; - } - }, hasUnshiftReturnValueBug); - - // ES5 15.4.3.2 - // http://es5.github.com/#x15.4.3.2 - // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray - defineProperties($Array, { isArray: isArray }); - - // The IsCallable() check in the Array functions - // has been replaced with a strict check on the - // internal class of the object to trap cases where - // the provided function was actually a regular - // expression literal, which in V8 and - // JavaScriptCore is a typeof "function". Only in - // V8 are regular expression literals permitted as - // reduce parameters, so it is desirable in the - // general case for the shim to match the more - // strict and common behavior of rejecting regular - // expressions. - - // ES5 15.4.4.18 - // http://es5.github.com/#x15.4.4.18 - // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach - - // Check failure of by-index access of string characters (IE < 9) - // and failure of `0 in boxedString` (Rhino) - var boxedString = $Object('a'); - var splitString = boxedString[0] !== 'a' || !(0 in boxedString); - - var properlyBoxesContext = function properlyBoxed(method) { - // Check node 0.6.21 bug where third parameter is not boxed - var properlyBoxesNonStrict = true; - var properlyBoxesStrict = true; - var threwException = false; - if (method) { - try { - method.call('foo', function (_, __, context) { - if (typeof context !== 'object') { - properlyBoxesNonStrict = false; - } - }); - - method.call([1], function () { - 'use strict'; - - properlyBoxesStrict = typeof this === 'string'; - }, 'x'); - } catch (e) { - threwException = true; - } - } - return !!method && !threwException && properlyBoxesNonStrict && properlyBoxesStrict; - }; - - defineProperties(ArrayPrototype, { - forEach: function forEach(callbackfn/*, thisArg*/) { - var object = ES.ToObject(this); - var self = splitString && isString(this) ? strSplit(this, '') : object; - var i = -1; - var length = ES.ToUint32(self.length); - var T; - if (arguments.length > 1) { - T = arguments[1]; - } - - // If no callback function or if callback is not a callable function - if (!isCallable(callbackfn)) { - throw new TypeError('Array.prototype.forEach callback must be a function'); - } - - while (++i < length) { - if (i in self) { - // Invoke the callback function with call, passing arguments: - // context, property value, property key, thisArg object - if (typeof T === 'undefined') { - callbackfn(self[i], i, object); - } else { - callbackfn.call(T, self[i], i, object); - } - } - } - } - }, !properlyBoxesContext(ArrayPrototype.forEach)); - - // ES5 15.4.4.19 - // http://es5.github.com/#x15.4.4.19 - // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map - defineProperties(ArrayPrototype, { - map: function map(callbackfn/*, thisArg*/) { - var object = ES.ToObject(this); - var self = splitString && isString(this) ? strSplit(this, '') : object; - var length = ES.ToUint32(self.length); - var result = $Array(length); - var T; - if (arguments.length > 1) { - T = arguments[1]; - } - - // If no callback function or if callback is not a callable function - if (!isCallable(callbackfn)) { - throw new TypeError('Array.prototype.map callback must be a function'); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - if (typeof T === 'undefined') { - result[i] = callbackfn(self[i], i, object); - } else { - result[i] = callbackfn.call(T, self[i], i, object); - } - } - } - return result; - } - }, !properlyBoxesContext(ArrayPrototype.map)); - - // ES5 15.4.4.20 - // http://es5.github.com/#x15.4.4.20 - // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter - defineProperties(ArrayPrototype, { - filter: function filter(callbackfn/*, thisArg*/) { - var object = ES.ToObject(this); - var self = splitString && isString(this) ? strSplit(this, '') : object; - var length = ES.ToUint32(self.length); - var result = []; - var value; - var T; - if (arguments.length > 1) { - T = arguments[1]; - } - - // If no callback function or if callback is not a callable function - if (!isCallable(callbackfn)) { - throw new TypeError('Array.prototype.filter callback must be a function'); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - value = self[i]; - if (typeof T === 'undefined' ? callbackfn(value, i, object) : callbackfn.call(T, value, i, object)) { - pushCall(result, value); - } - } - } - return result; - } - }, !properlyBoxesContext(ArrayPrototype.filter)); - - // ES5 15.4.4.16 - // http://es5.github.com/#x15.4.4.16 - // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every - defineProperties(ArrayPrototype, { - every: function every(callbackfn/*, thisArg*/) { - var object = ES.ToObject(this); - var self = splitString && isString(this) ? strSplit(this, '') : object; - var length = ES.ToUint32(self.length); - var T; - if (arguments.length > 1) { - T = arguments[1]; - } - - // If no callback function or if callback is not a callable function - if (!isCallable(callbackfn)) { - throw new TypeError('Array.prototype.every callback must be a function'); - } - - for (var i = 0; i < length; i++) { - if (i in self && !(typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) { - return false; - } - } - return true; - } - }, !properlyBoxesContext(ArrayPrototype.every)); - - // ES5 15.4.4.17 - // http://es5.github.com/#x15.4.4.17 - // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some - defineProperties(ArrayPrototype, { - some: function some(callbackfn/*, thisArg */) { - var object = ES.ToObject(this); - var self = splitString && isString(this) ? strSplit(this, '') : object; - var length = ES.ToUint32(self.length); - var T; - if (arguments.length > 1) { - T = arguments[1]; - } - - // If no callback function or if callback is not a callable function - if (!isCallable(callbackfn)) { - throw new TypeError('Array.prototype.some callback must be a function'); - } - - for (var i = 0; i < length; i++) { - if (i in self && (typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) { - return true; - } - } - return false; - } - }, !properlyBoxesContext(ArrayPrototype.some)); - - // ES5 15.4.4.21 - // http://es5.github.com/#x15.4.4.21 - // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce - var reduceCoercesToObject = false; - if (ArrayPrototype.reduce) { - reduceCoercesToObject = typeof ArrayPrototype.reduce.call('es5', function (_, __, ___, list) { - return list; - }) === 'object'; - } - defineProperties(ArrayPrototype, { - reduce: function reduce(callbackfn/*, initialValue*/) { - var object = ES.ToObject(this); - var self = splitString && isString(this) ? strSplit(this, '') : object; - var length = ES.ToUint32(self.length); - - // If no callback function or if callback is not a callable function - if (!isCallable(callbackfn)) { - throw new TypeError('Array.prototype.reduce callback must be a function'); - } - - // no value to return if no initial value and an empty array - if (length === 0 && arguments.length === 1) { - throw new TypeError('reduce of empty array with no initial value'); - } - - var i = 0; - var result; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i++]; - break; - } - - // if array contains no values, no initial value to return - if (++i >= length) { - throw new TypeError('reduce of empty array with no initial value'); - } - } while (true); - } - - for (; i < length; i++) { - if (i in self) { - result = callbackfn(result, self[i], i, object); - } - } - - return result; - } - }, !reduceCoercesToObject); - - // ES5 15.4.4.22 - // http://es5.github.com/#x15.4.4.22 - // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight - var reduceRightCoercesToObject = false; - if (ArrayPrototype.reduceRight) { - reduceRightCoercesToObject = typeof ArrayPrototype.reduceRight.call('es5', function (_, __, ___, list) { - return list; - }) === 'object'; - } - defineProperties(ArrayPrototype, { - reduceRight: function reduceRight(callbackfn/*, initial*/) { - var object = ES.ToObject(this); - var self = splitString && isString(this) ? strSplit(this, '') : object; - var length = ES.ToUint32(self.length); - - // If no callback function or if callback is not a callable function - if (!isCallable(callbackfn)) { - throw new TypeError('Array.prototype.reduceRight callback must be a function'); - } - - // no value to return if no initial value, empty array - if (length === 0 && arguments.length === 1) { - throw new TypeError('reduceRight of empty array with no initial value'); - } - - var result; - var i = length - 1; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i--]; - break; - } - - // if array contains no values, no initial value to return - if (--i < 0) { - throw new TypeError('reduceRight of empty array with no initial value'); - } - } while (true); - } - - if (i < 0) { - return result; - } - - do { - if (i in self) { - result = callbackfn(result, self[i], i, object); - } - } while (i--); - - return result; - } - }, !reduceRightCoercesToObject); - - // ES5 15.4.4.14 - // http://es5.github.com/#x15.4.4.14 - // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf - var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== -1; - defineProperties(ArrayPrototype, { - indexOf: function indexOf(searchElement/*, fromIndex */) { - var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); - var length = ES.ToUint32(self.length); - - if (length === 0) { - return -1; - } - - var i = 0; - if (arguments.length > 1) { - i = ES.ToInteger(arguments[1]); - } - - // handle negative indices - i = i >= 0 ? i : max(0, length + i); - for (; i < length; i++) { - if (i in self && self[i] === searchElement) { - return i; - } - } - return -1; - } - }, hasFirefox2IndexOfBug); - - // ES5 15.4.4.15 - // http://es5.github.com/#x15.4.4.15 - // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf - var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 1].lastIndexOf(0, -3) !== -1; - defineProperties(ArrayPrototype, { - lastIndexOf: function lastIndexOf(searchElement/*, fromIndex */) { - var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); - var length = ES.ToUint32(self.length); - - if (length === 0) { - return -1; - } - var i = length - 1; - if (arguments.length > 1) { - i = min(i, ES.ToInteger(arguments[1])); - } - // handle negative indices - i = i >= 0 ? i : length - Math.abs(i); - for (; i >= 0; i--) { - if (i in self && searchElement === self[i]) { - return i; - } - } - return -1; - } - }, hasFirefox2LastIndexOfBug); - - // ES5 15.4.4.12 - // http://es5.github.com/#x15.4.4.12 - var spliceNoopReturnsEmptyArray = (function () { - var a = [1, 2]; - var result = a.splice(); - return a.length === 2 && isArray(result) && result.length === 0; - }()); - defineProperties(ArrayPrototype, { - // Safari 5.0 bug where .splice() returns undefined - splice: function splice(start, deleteCount) { - if (arguments.length === 0) { - return []; - } else { - return array_splice.apply(this, arguments); - } - } - }, !spliceNoopReturnsEmptyArray); - - var spliceWorksWithEmptyObject = (function () { - var obj = {}; - ArrayPrototype.splice.call(obj, 0, 0, 1); - return obj.length === 1; - }()); - defineProperties(ArrayPrototype, { - splice: function splice(start, deleteCount) { - if (arguments.length === 0) { - return []; - } - var args = arguments; - this.length = max(ES.ToInteger(this.length), 0); - if (arguments.length > 0 && typeof deleteCount !== 'number') { - args = arraySlice(arguments); - if (args.length < 2) { - pushCall(args, this.length - start); - } else { - args[1] = ES.ToInteger(deleteCount); - } - } - return array_splice.apply(this, args); - } - }, !spliceWorksWithEmptyObject); - var spliceWorksWithLargeSparseArrays = (function () { - // Per https://github.com/es-shims/es5-shim/issues/295 - // Safari 7/8 breaks with sparse arrays of size 1e5 or greater - var arr = new $Array(1e5); - // note: the index MUST be 8 or larger or the test will false pass - arr[8] = 'x'; - arr.splice(1, 1); - // note: this test must be defined *after* the indexOf shim - // per https://github.com/es-shims/es5-shim/issues/313 - return arr.indexOf('x') === 7; - }()); - var spliceWorksWithSmallSparseArrays = (function () { - // Per https://github.com/es-shims/es5-shim/issues/295 - // Opera 12.15 breaks on this, no idea why. - var n = 256; - var arr = []; - arr[n] = 'a'; - arr.splice(n + 1, 0, 'b'); - return arr[n] === 'a'; - }()); - defineProperties(ArrayPrototype, { - splice: function splice(start, deleteCount) { - var O = ES.ToObject(this); - var A = []; - var len = ES.ToUint32(O.length); - var relativeStart = ES.ToInteger(start); - var actualStart = relativeStart < 0 ? max((len + relativeStart), 0) : min(relativeStart, len); - var actualDeleteCount = min(max(ES.ToInteger(deleteCount), 0), len - actualStart); - - var k = 0; - var from; - while (k < actualDeleteCount) { - from = $String(actualStart + k); - if (owns(O, from)) { - A[k] = O[from]; - } - k += 1; - } - - var items = arraySlice(arguments, 2); - var itemCount = items.length; - var to; - if (itemCount < actualDeleteCount) { - k = actualStart; - var maxK = len - actualDeleteCount; - while (k < maxK) { - from = $String(k + actualDeleteCount); - to = $String(k + itemCount); - if (owns(O, from)) { - O[to] = O[from]; - } else { - delete O[to]; - } - k += 1; - } - k = len; - var minK = len - actualDeleteCount + itemCount; - while (k > minK) { - delete O[k - 1]; - k -= 1; - } - } else if (itemCount > actualDeleteCount) { - k = len - actualDeleteCount; - while (k > actualStart) { - from = $String(k + actualDeleteCount - 1); - to = $String(k + itemCount - 1); - if (owns(O, from)) { - O[to] = O[from]; - } else { - delete O[to]; - } - k -= 1; - } - } - k = actualStart; - for (var i = 0; i < items.length; ++i) { - O[k] = items[i]; - k += 1; - } - O.length = len - actualDeleteCount + itemCount; - - return A; - } - }, !spliceWorksWithLargeSparseArrays || !spliceWorksWithSmallSparseArrays); - - var originalJoin = ArrayPrototype.join; - var hasStringJoinBug; - try { - hasStringJoinBug = Array.prototype.join.call('123', ',') !== '1,2,3'; - } catch (e) { - hasStringJoinBug = true; - } - if (hasStringJoinBug) { - defineProperties(ArrayPrototype, { - join: function join(separator) { - var sep = typeof separator === 'undefined' ? ',' : separator; - return originalJoin.call(isString(this) ? strSplit(this, '') : this, sep); - } - }, hasStringJoinBug); - } - - var hasJoinUndefinedBug = [1, 2].join(undefined) !== '1,2'; - if (hasJoinUndefinedBug) { - defineProperties(ArrayPrototype, { - join: function join(separator) { - var sep = typeof separator === 'undefined' ? ',' : separator; - return originalJoin.call(this, sep); - } - }, hasJoinUndefinedBug); - } - - var pushShim = function push(item) { - var O = ES.ToObject(this); - var n = ES.ToUint32(O.length); - var i = 0; - while (i < arguments.length) { - O[n + i] = arguments[i]; - i += 1; - } - O.length = n + i; - return n + i; - }; - - var pushIsNotGeneric = (function () { - var obj = {}; - var result = Array.prototype.push.call(obj, undefined); - return result !== 1 || obj.length !== 1 || typeof obj[0] !== 'undefined' || !owns(obj, 0); - }()); - defineProperties(ArrayPrototype, { - push: function push(item) { - if (isArray(this)) { - return array_push.apply(this, arguments); - } - return pushShim.apply(this, arguments); - } - }, pushIsNotGeneric); - - // This fixes a very weird bug in Opera 10.6 when pushing `undefined - var pushUndefinedIsWeird = (function () { - var arr = []; - var result = arr.push(undefined); - return result !== 1 || arr.length !== 1 || typeof arr[0] !== 'undefined' || !owns(arr, 0); - }()); - defineProperties(ArrayPrototype, { push: pushShim }, pushUndefinedIsWeird); - - // ES5 15.2.3.14 - // http://es5.github.io/#x15.4.4.10 - // Fix boxed string bug - defineProperties(ArrayPrototype, { - slice: function (start, end) { - var arr = isString(this) ? strSplit(this, '') : this; - return arraySliceApply(arr, arguments); - } - }, splitString); - - var sortIgnoresNonFunctions = (function () { - try { - [1, 2].sort(null); - [1, 2].sort({}); - return true; - } catch (e) {} - return false; - }()); - var sortThrowsOnRegex = (function () { - // this is a problem in Firefox 4, in which `typeof /a/ === 'function'` - try { - [1, 2].sort(/a/); - return false; - } catch (e) {} - return true; - }()); - var sortIgnoresUndefined = (function () { - // applies in IE 8, for one. - try { - [1, 2].sort(undefined); - return true; - } catch (e) {} - return false; - }()); - defineProperties(ArrayPrototype, { - sort: function sort(compareFn) { - if (typeof compareFn === 'undefined') { - return arraySort(this); - } - if (!isCallable(compareFn)) { - throw new TypeError('Array.prototype.sort callback must be a function'); - } - return arraySort(this, compareFn); - } - }, sortIgnoresNonFunctions || !sortIgnoresUndefined || !sortThrowsOnRegex); - - // - // Object - // ====== - // - - // ES5 15.2.3.14 - // http://es5.github.com/#x15.2.3.14 - - // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation - var hasDontEnumBug = !isEnum({ 'toString': null }, 'toString'); - var hasProtoEnumBug = isEnum(function () {}, 'prototype'); - var hasStringEnumBug = !owns('x', '0'); - var equalsConstructorPrototype = function (o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - var blacklistedKeys = { - $window: true, - $console: true, - $parent: true, - $self: true, - $frame: true, - $frames: true, - $frameElement: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $external: true - }; - var hasAutomationEqualityBug = (function () { - /* globals window */ - if (typeof window === 'undefined') { - return false; - } - for (var k in window) { - try { - if (!blacklistedKeys['$' + k] && owns(window, k) && window[k] !== null && typeof window[k] === 'object') { - equalsConstructorPrototype(window[k]); - } - } catch (e) { - return true; - } - } - return false; - }()); - var equalsConstructorPrototypeIfNotBuggy = function (object) { - if (typeof window === 'undefined' || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(object); - } - try { - return equalsConstructorPrototype(object); - } catch (e) { - return false; - } - }; - var dontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ]; - var dontEnumsLength = dontEnums.length; - - // taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js - // can be replaced with require('is-arguments') if we ever use a build process instead - var isStandardArguments = function isArguments(value) { - return toStr(value) === '[object Arguments]'; - }; - var isLegacyArguments = function isArguments(value) { - return value !== null && - typeof value === 'object' && - typeof value.length === 'number' && - value.length >= 0 && - !isArray(value) && - isCallable(value.callee); - }; - var isArguments = isStandardArguments(arguments) ? isStandardArguments : isLegacyArguments; - - defineProperties($Object, { - keys: function keys(object) { - var isFn = isCallable(object); - var isArgs = isArguments(object); - var isObject = object !== null && typeof object === 'object'; - var isStr = isObject && isString(object); - - if (!isObject && !isFn && !isArgs) { - throw new TypeError('Object.keys called on a non-object'); - } - - var theKeys = []; - var skipProto = hasProtoEnumBug && isFn; - if ((isStr && hasStringEnumBug) || isArgs) { - for (var i = 0; i < object.length; ++i) { - pushCall(theKeys, $String(i)); - } - } - - if (!isArgs) { - for (var name in object) { - if (!(skipProto && name === 'prototype') && owns(object, name)) { - pushCall(theKeys, $String(name)); - } - } - } - - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - for (var j = 0; j < dontEnumsLength; j++) { - var dontEnum = dontEnums[j]; - if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) { - pushCall(theKeys, dontEnum); - } - } - } - return theKeys; - } - }); - - var keysWorksWithArguments = $Object.keys && (function () { - // Safari 5.0 bug - return $Object.keys(arguments).length === 2; - }(1, 2)); - var keysHasArgumentsLengthBug = $Object.keys && (function () { - var argKeys = $Object.keys(arguments); - return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; - }(1)); - var originalKeys = $Object.keys; - defineProperties($Object, { - keys: function keys(object) { - if (isArguments(object)) { - return originalKeys(arraySlice(object)); - } else { - return originalKeys(object); - } - } - }, !keysWorksWithArguments || keysHasArgumentsLengthBug); - - // - // Date - // ==== - // - - var hasNegativeMonthYearBug = new Date(-3509827329600292).getUTCMonth() !== 0; - var aNegativeTestDate = new Date(-1509842289600292); - var aPositiveTestDate = new Date(1449662400000); - var hasToUTCStringFormatBug = aNegativeTestDate.toUTCString() !== 'Mon, 01 Jan -45875 11:59:59 GMT'; - var hasToDateStringFormatBug; - var hasToStringFormatBug; - var timeZoneOffset = aNegativeTestDate.getTimezoneOffset(); - if (timeZoneOffset < -720) { - hasToDateStringFormatBug = aNegativeTestDate.toDateString() !== 'Tue Jan 02 -45875'; - hasToStringFormatBug = !(/^Thu Dec 10 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/).test(aPositiveTestDate.toString()); - } else { - hasToDateStringFormatBug = aNegativeTestDate.toDateString() !== 'Mon Jan 01 -45875'; - hasToStringFormatBug = !(/^Wed Dec 09 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/).test(aPositiveTestDate.toString()); - } - - var originalGetFullYear = call.bind(Date.prototype.getFullYear); - var originalGetMonth = call.bind(Date.prototype.getMonth); - var originalGetDate = call.bind(Date.prototype.getDate); - var originalGetUTCFullYear = call.bind(Date.prototype.getUTCFullYear); - var originalGetUTCMonth = call.bind(Date.prototype.getUTCMonth); - var originalGetUTCDate = call.bind(Date.prototype.getUTCDate); - var originalGetUTCDay = call.bind(Date.prototype.getUTCDay); - var originalGetUTCHours = call.bind(Date.prototype.getUTCHours); - var originalGetUTCMinutes = call.bind(Date.prototype.getUTCMinutes); - var originalGetUTCSeconds = call.bind(Date.prototype.getUTCSeconds); - var originalGetUTCMilliseconds = call.bind(Date.prototype.getUTCMilliseconds); - var dayName = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; - var monthName = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; - var daysInMonth = function daysInMonth(month, year) { - return originalGetDate(new Date(year, month, 0)); - }; - - defineProperties(Date.prototype, { - getFullYear: function getFullYear() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var year = originalGetFullYear(this); - if (year < 0 && originalGetMonth(this) > 11) { - return year + 1; - } - return year; - }, - getMonth: function getMonth() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var year = originalGetFullYear(this); - var month = originalGetMonth(this); - if (year < 0 && month > 11) { - return 0; - } - return month; - }, - getDate: function getDate() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var year = originalGetFullYear(this); - var month = originalGetMonth(this); - var date = originalGetDate(this); - if (year < 0 && month > 11) { - if (month === 12) { - return date; - } - var days = daysInMonth(0, year + 1); - return (days - date) + 1; - } - return date; - }, - getUTCFullYear: function getUTCFullYear() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var year = originalGetUTCFullYear(this); - if (year < 0 && originalGetUTCMonth(this) > 11) { - return year + 1; - } - return year; - }, - getUTCMonth: function getUTCMonth() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var year = originalGetUTCFullYear(this); - var month = originalGetUTCMonth(this); - if (year < 0 && month > 11) { - return 0; - } - return month; - }, - getUTCDate: function getUTCDate() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var year = originalGetUTCFullYear(this); - var month = originalGetUTCMonth(this); - var date = originalGetUTCDate(this); - if (year < 0 && month > 11) { - if (month === 12) { - return date; - } - var days = daysInMonth(0, year + 1); - return (days - date) + 1; - } - return date; - } - }, hasNegativeMonthYearBug); - - defineProperties(Date.prototype, { - toUTCString: function toUTCString() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var day = originalGetUTCDay(this); - var date = originalGetUTCDate(this); - var month = originalGetUTCMonth(this); - var year = originalGetUTCFullYear(this); - var hour = originalGetUTCHours(this); - var minute = originalGetUTCMinutes(this); - var second = originalGetUTCSeconds(this); - return dayName[day] + ', ' + - (date < 10 ? '0' + date : date) + ' ' + - monthName[month] + ' ' + - year + ' ' + - (hour < 10 ? '0' + hour : hour) + ':' + - (minute < 10 ? '0' + minute : minute) + ':' + - (second < 10 ? '0' + second : second) + ' GMT'; - } - }, hasNegativeMonthYearBug || hasToUTCStringFormatBug); - - // Opera 12 has `,` - defineProperties(Date.prototype, { - toDateString: function toDateString() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var day = this.getDay(); - var date = this.getDate(); - var month = this.getMonth(); - var year = this.getFullYear(); - return dayName[day] + ' ' + - monthName[month] + ' ' + - (date < 10 ? '0' + date : date) + ' ' + - year; - } - }, hasNegativeMonthYearBug || hasToDateStringFormatBug); - - // can't use defineProperties here because of toString enumeration issue in IE <= 8 - if (hasNegativeMonthYearBug || hasToStringFormatBug) { - Date.prototype.toString = function toString() { - if (!this || !(this instanceof Date)) { - throw new TypeError('this is not a Date object.'); - } - var day = this.getDay(); - var date = this.getDate(); - var month = this.getMonth(); - var year = this.getFullYear(); - var hour = this.getHours(); - var minute = this.getMinutes(); - var second = this.getSeconds(); - var timezoneOffset = this.getTimezoneOffset(); - var hoursOffset = Math.floor(Math.abs(timezoneOffset) / 60); - var minutesOffset = Math.floor(Math.abs(timezoneOffset) % 60); - return dayName[day] + ' ' + - monthName[month] + ' ' + - (date < 10 ? '0' + date : date) + ' ' + - year + ' ' + - (hour < 10 ? '0' + hour : hour) + ':' + - (minute < 10 ? '0' + minute : minute) + ':' + - (second < 10 ? '0' + second : second) + ' GMT' + - (timezoneOffset > 0 ? '-' : '+') + - (hoursOffset < 10 ? '0' + hoursOffset : hoursOffset) + - (minutesOffset < 10 ? '0' + minutesOffset : minutesOffset); - }; - if (supportsDescriptors) { - $Object.defineProperty(Date.prototype, 'toString', { - configurable: true, - enumerable: false, - writable: true - }); - } - } - - // ES5 15.9.5.43 - // http://es5.github.com/#x15.9.5.43 - // This function returns a String value represent the instance in time - // represented by this Date object. The format of the String is the Date Time - // string format defined in 15.9.1.15. All fields are present in the String. - // The time zone is always UTC, denoted by the suffix Z. If the time value of - // this object is not a finite Number a RangeError exception is thrown. - var negativeDate = -62198755200000; - var negativeYearString = '-000001'; - var hasNegativeDateBug = Date.prototype.toISOString && new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1; - var hasSafari51DateBug = Date.prototype.toISOString && new Date(-1).toISOString() !== '1969-12-31T23:59:59.999Z'; - - var getTime = call.bind(Date.prototype.getTime); - - defineProperties(Date.prototype, { - toISOString: function toISOString() { - if (!isFinite(this) || !isFinite(getTime(this))) { - // Adope Photoshop requires the second check. - throw new RangeError('Date.prototype.toISOString called on non-finite value.'); - } - - var year = originalGetUTCFullYear(this); - - var month = originalGetUTCMonth(this); - // see https://github.com/es-shims/es5-shim/issues/111 - year += Math.floor(month / 12); - month = (month % 12 + 12) % 12; - - // the date time string format is specified in 15.9.1.15. - var result = [month + 1, originalGetUTCDate(this), originalGetUTCHours(this), originalGetUTCMinutes(this), originalGetUTCSeconds(this)]; - year = ( - (year < 0 ? '-' : (year > 9999 ? '+' : '')) + - strSlice('00000' + Math.abs(year), (0 <= year && year <= 9999) ? -4 : -6) - ); - - for (var i = 0; i < result.length; ++i) { - // pad months, days, hours, minutes, and seconds to have two digits. - result[i] = strSlice('00' + result[i], -2); - } - // pad milliseconds to have three digits. - return ( - year + '-' + arraySlice(result, 0, 2).join('-') + - 'T' + arraySlice(result, 2).join(':') + '.' + - strSlice('000' + originalGetUTCMilliseconds(this), -3) + 'Z' - ); - } - }, hasNegativeDateBug || hasSafari51DateBug); - - // ES5 15.9.5.44 - // http://es5.github.com/#x15.9.5.44 - // This function provides a String representation of a Date object for use by - // JSON.stringify (15.12.3). - var dateToJSONIsSupported = (function () { - try { - return Date.prototype.toJSON && - new Date(NaN).toJSON() === null && - new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 && - Date.prototype.toJSON.call({ // generic - toISOString: function () { return true; } - }); - } catch (e) { - return false; - } - }()); - if (!dateToJSONIsSupported) { - Date.prototype.toJSON = function toJSON(key) { - // When the toJSON method is called with argument key, the following - // steps are taken: - - // 1. Let O be the result of calling ToObject, giving it the this - // value as its argument. - // 2. Let tv be ES.ToPrimitive(O, hint Number). - var O = $Object(this); - var tv = ES.ToPrimitive(O); - // 3. If tv is a Number and is not finite, return null. - if (typeof tv === 'number' && !isFinite(tv)) { - return null; - } - // 4. Let toISO be the result of calling the [[Get]] internal method of - // O with argument "toISOString". - var toISO = O.toISOString; - // 5. If IsCallable(toISO) is false, throw a TypeError exception. - if (!isCallable(toISO)) { - throw new TypeError('toISOString property is not callable'); - } - // 6. Return the result of calling the [[Call]] internal method of - // toISO with O as the this value and an empty argument list. - return toISO.call(O); - - // NOTE 1 The argument is ignored. - - // NOTE 2 The toJSON function is intentionally generic; it does not - // require that its this value be a Date object. Therefore, it can be - // transferred to other kinds of objects for use as a method. However, - // it does require that any such object have a toISOString method. An - // object is free to use the argument key to filter its - // stringification. - }; - } - - // ES5 15.9.4.2 - // http://es5.github.com/#x15.9.4.2 - // based on work shared by Daniel Friesen (dantman) - // http://gist.github.com/303249 - var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15; - var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')) || !isNaN(Date.parse('2012-12-31T23:59:60.000Z')); - var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z')); - if (doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) { - // XXX global assignment won't work in embeddings that use - // an alternate object for the context. - /* global Date: true */ - /* eslint-disable no-undef */ - var maxSafeUnsigned32Bit = Math.pow(2, 31) - 1; - var hasSafariSignedIntBug = isActualNaN(new Date(1970, 0, 1, 0, 0, 0, maxSafeUnsigned32Bit + 1).getTime()); - /* eslint-disable no-implicit-globals */ - Date = (function (NativeDate) { - /* eslint-enable no-implicit-globals */ - /* eslint-enable no-undef */ - // Date.length === 7 - var DateShim = function Date(Y, M, D, h, m, s, ms) { - var length = arguments.length; - var date; - if (this instanceof NativeDate) { - var seconds = s; - var millis = ms; - if (hasSafariSignedIntBug && length >= 7 && ms > maxSafeUnsigned32Bit) { - // work around a Safari 8/9 bug where it treats the seconds as signed - var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; - var sToShift = Math.floor(msToShift / 1e3); - seconds += sToShift; - millis -= sToShift * 1e3; - } - date = length === 1 && $String(Y) === Y ? // isString(Y) - // We explicitly pass it through parse: - new NativeDate(DateShim.parse(Y)) : - // We have to manually make calls depending on argument - // length here - length >= 7 ? new NativeDate(Y, M, D, h, m, seconds, millis) : - length >= 6 ? new NativeDate(Y, M, D, h, m, seconds) : - length >= 5 ? new NativeDate(Y, M, D, h, m) : - length >= 4 ? new NativeDate(Y, M, D, h) : - length >= 3 ? new NativeDate(Y, M, D) : - length >= 2 ? new NativeDate(Y, M) : - length >= 1 ? new NativeDate(Y instanceof NativeDate ? +Y : Y) : - new NativeDate(); - } else { - date = NativeDate.apply(this, arguments); - } - if (!isPrimitive(date)) { - // Prevent mixups with unfixed Date object - defineProperties(date, { constructor: DateShim }, true); - } - return date; - }; - - // 15.9.1.15 Date Time String Format. - var isoDateExpression = new RegExp('^' + - '(\\d{4}|[+-]\\d{6})' + // four-digit year capture or sign + - // 6-digit extended year - '(?:-(\\d{2})' + // optional month capture - '(?:-(\\d{2})' + // optional day capture - '(?:' + // capture hours:minutes:seconds.milliseconds - 'T(\\d{2})' + // hours capture - ':(\\d{2})' + // minutes capture - '(?:' + // optional :seconds.milliseconds - ':(\\d{2})' + // seconds capture - '(?:(\\.\\d{1,}))?' + // milliseconds capture - ')?' + - '(' + // capture UTC offset component - 'Z|' + // UTC capture - '(?:' + // offset specifier +/-hours:minutes - '([-+])' + // sign capture - '(\\d{2})' + // hours offset capture - ':(\\d{2})' + // minutes offset capture - ')' + - ')?)?)?)?' + - '$'); - - var months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]; - - var dayFromMonth = function dayFromMonth(year, month) { - var t = month > 1 ? 1 : 0; - return ( - months[month] + - Math.floor((year - 1969 + t) / 4) - - Math.floor((year - 1901 + t) / 100) + - Math.floor((year - 1601 + t) / 400) + - 365 * (year - 1970) - ); - }; - - var toUTC = function toUTC(t) { - var s = 0; - var ms = t; - if (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) { - // work around a Safari 8/9 bug where it treats the seconds as signed - var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; - var sToShift = Math.floor(msToShift / 1e3); - s += sToShift; - ms -= sToShift * 1e3; - } - return $Number(new NativeDate(1970, 0, 1, 0, 0, s, ms)); - }; - - // Copy any custom methods a 3rd party library may have added - for (var key in NativeDate) { - if (owns(NativeDate, key)) { - DateShim[key] = NativeDate[key]; - } - } - - // Copy "native" methods explicitly; they may be non-enumerable - defineProperties(DateShim, { - now: NativeDate.now, - UTC: NativeDate.UTC - }, true); - DateShim.prototype = NativeDate.prototype; - defineProperties(DateShim.prototype, { - constructor: DateShim - }, true); - - // Upgrade Date.parse to handle simplified ISO 8601 strings - var parseShim = function parse(string) { - var match = isoDateExpression.exec(string); - if (match) { - // parse months, days, hours, minutes, seconds, and milliseconds - // provide default values if necessary - // parse the UTC offset component - var year = $Number(match[1]), - month = $Number(match[2] || 1) - 1, - day = $Number(match[3] || 1) - 1, - hour = $Number(match[4] || 0), - minute = $Number(match[5] || 0), - second = $Number(match[6] || 0), - millisecond = Math.floor($Number(match[7] || 0) * 1000), - // When time zone is missed, local offset should be used - // (ES 5.1 bug) - // see https://bugs.ecmascript.org/show_bug.cgi?id=112 - isLocalTime = Boolean(match[4] && !match[8]), - signOffset = match[9] === '-' ? 1 : -1, - hourOffset = $Number(match[10] || 0), - minuteOffset = $Number(match[11] || 0), - result; - var hasMinutesOrSecondsOrMilliseconds = minute > 0 || second > 0 || millisecond > 0; - if ( - hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) && - minute < 60 && second < 60 && millisecond < 1000 && - month > -1 && month < 12 && hourOffset < 24 && - minuteOffset < 60 && // detect invalid offsets - day > -1 && - day < (dayFromMonth(year, month + 1) - dayFromMonth(year, month)) - ) { - result = ( - (dayFromMonth(year, month) + day) * 24 + - hour + - hourOffset * signOffset - ) * 60; - result = ( - (result + minute + minuteOffset * signOffset) * 60 + - second - ) * 1000 + millisecond; - if (isLocalTime) { - result = toUTC(result); - } - if (-8.64e15 <= result && result <= 8.64e15) { - return result; - } - } - return NaN; - } - return NativeDate.parse.apply(this, arguments); - }; - defineProperties(DateShim, { parse: parseShim }); - - return DateShim; - }(Date)); - /* global Date: false */ - } - - // ES5 15.9.4.4 - // http://es5.github.com/#x15.9.4.4 - if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; - } - - // - // Number - // ====== - // - - // ES5.1 15.7.4.5 - // http://es5.github.com/#x15.7.4.5 - var hasToFixedBugs = NumberPrototype.toFixed && ( - (0.00008).toFixed(3) !== '0.000' || - (0.9).toFixed(0) !== '1' || - (1.255).toFixed(2) !== '1.25' || - (1000000000000000128).toFixed(0) !== '1000000000000000128' - ); - - var toFixedHelpers = { - base: 1e7, - size: 6, - data: [0, 0, 0, 0, 0, 0], - multiply: function multiply(n, c) { - var i = -1; - var c2 = c; - while (++i < toFixedHelpers.size) { - c2 += n * toFixedHelpers.data[i]; - toFixedHelpers.data[i] = c2 % toFixedHelpers.base; - c2 = Math.floor(c2 / toFixedHelpers.base); - } - }, - divide: function divide(n) { - var i = toFixedHelpers.size; - var c = 0; - while (--i >= 0) { - c += toFixedHelpers.data[i]; - toFixedHelpers.data[i] = Math.floor(c / n); - c = (c % n) * toFixedHelpers.base; - } - }, - numToString: function numToString() { - var i = toFixedHelpers.size; - var s = ''; - while (--i >= 0) { - if (s !== '' || i === 0 || toFixedHelpers.data[i] !== 0) { - var t = $String(toFixedHelpers.data[i]); - if (s === '') { - s = t; - } else { - s += strSlice('0000000', 0, 7 - t.length) + t; - } - } - } - return s; - }, - pow: function pow(x, n, acc) { - return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc))); - }, - log: function log(x) { - var n = 0; - var x2 = x; - while (x2 >= 4096) { - n += 12; - x2 /= 4096; - } - while (x2 >= 2) { - n += 1; - x2 /= 2; - } - return n; - } - }; - - var toFixedShim = function toFixed(fractionDigits) { - var f, x, s, m, e, z, j, k; - - // Test for NaN and round fractionDigits down - f = $Number(fractionDigits); - f = isActualNaN(f) ? 0 : Math.floor(f); - - if (f < 0 || f > 20) { - throw new RangeError('Number.toFixed called with invalid number of decimals'); - } - - x = $Number(this); - - if (isActualNaN(x)) { - return 'NaN'; - } - - // If it is too big or small, return the string value of the number - if (x <= -1e21 || x >= 1e21) { - return $String(x); - } - - s = ''; - - if (x < 0) { - s = '-'; - x = -x; - } - - m = '0'; - - if (x > 1e-21) { - // 1e-21 < x < 1e21 - // -70 < log2(x) < 70 - e = toFixedHelpers.log(x * toFixedHelpers.pow(2, 69, 1)) - 69; - z = (e < 0 ? x * toFixedHelpers.pow(2, -e, 1) : x / toFixedHelpers.pow(2, e, 1)); - z *= 0x10000000000000; // Math.pow(2, 52); - e = 52 - e; - - // -18 < e < 122 - // x = z / 2 ^ e - if (e > 0) { - toFixedHelpers.multiply(0, z); - j = f; - - while (j >= 7) { - toFixedHelpers.multiply(1e7, 0); - j -= 7; - } - - toFixedHelpers.multiply(toFixedHelpers.pow(10, j, 1), 0); - j = e - 1; - - while (j >= 23) { - toFixedHelpers.divide(1 << 23); - j -= 23; - } - - toFixedHelpers.divide(1 << j); - toFixedHelpers.multiply(1, 1); - toFixedHelpers.divide(2); - m = toFixedHelpers.numToString(); - } else { - toFixedHelpers.multiply(0, z); - toFixedHelpers.multiply(1 << (-e), 0); - m = toFixedHelpers.numToString() + strSlice('0.00000000000000000000', 2, 2 + f); - } - } - - if (f > 0) { - k = m.length; - - if (k <= f) { - m = s + strSlice('0.0000000000000000000', 0, f - k + 2) + m; - } else { - m = s + strSlice(m, 0, k - f) + '.' + strSlice(m, k - f); - } - } else { - m = s + m; - } - - return m; - }; - defineProperties(NumberPrototype, { toFixed: toFixedShim }, hasToFixedBugs); - - var hasToPrecisionUndefinedBug = (function () { - try { - return 1.0.toPrecision(undefined) === '1'; - } catch (e) { - return true; - } - }()); - var originalToPrecision = NumberPrototype.toPrecision; - defineProperties(NumberPrototype, { - toPrecision: function toPrecision(precision) { - return typeof precision === 'undefined' ? originalToPrecision.call(this) : originalToPrecision.call(this, precision); - } - }, hasToPrecisionUndefinedBug); - - // - // String - // ====== - // - - // ES5 15.5.4.14 - // http://es5.github.com/#x15.5.4.14 - - // [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers] - // Many browsers do not split properly with regular expressions or they - // do not perform the split correctly under obscure conditions. - // See http://blog.stevenlevithan.com/archives/cross-browser-split - // I've tested in many browsers and this seems to cover the deviant ones: - // 'ab'.split(/(?:ab)*/) should be ["", ""], not [""] - // '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""] - // 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not - // [undefined, "t", undefined, "e", ...] - // ''.split(/.?/) should be [], not [""] - // '.'.split(/()()/) should be ["."], not ["", "", "."] - - if ( - 'ab'.split(/(?:ab)*/).length !== 2 || - '.'.split(/(.?)(.?)/).length !== 4 || - 'tesst'.split(/(s)*/)[1] === 't' || - 'test'.split(/(?:)/, -1).length !== 4 || - ''.split(/.?/).length || - '.'.split(/()()/).length > 1 - ) { - (function () { - var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group - var maxSafe32BitInt = Math.pow(2, 32) - 1; - - StringPrototype.split = function (separator, limit) { - var string = String(this); - if (typeof separator === 'undefined' && limit === 0) { - return []; - } - - // If `separator` is not a regex, use native split - if (!isRegex(separator)) { - return strSplit(this, separator, limit); - } - - var output = []; - var flags = (separator.ignoreCase ? 'i' : '') + - (separator.multiline ? 'm' : '') + - (separator.unicode ? 'u' : '') + // in ES6 - (separator.sticky ? 'y' : ''), // Firefox 3+ and ES6 - lastLastIndex = 0, - // Make `global` and avoid `lastIndex` issues by working with a copy - separator2, match, lastIndex, lastLength; - var separatorCopy = new RegExp(separator.source, flags + 'g'); - if (!compliantExecNpcg) { - // Doesn't need flags gy, but they don't hurt - separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); - } - /* Values for `limit`, per the spec: - * If undefined: 4294967295 // maxSafe32BitInt - * If 0, Infinity, or NaN: 0 - * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; - * If negative number: 4294967296 - Math.floor(Math.abs(limit)) - * If other: Type-convert, then use the above rules - */ - var splitLimit = typeof limit === 'undefined' ? maxSafe32BitInt : ES.ToUint32(limit); - match = separatorCopy.exec(string); - while (match) { - // `separatorCopy.lastIndex` is not reliable cross-browser - lastIndex = match.index + match[0].length; - if (lastIndex > lastLastIndex) { - pushCall(output, strSlice(string, lastLastIndex, match.index)); - // Fix browsers whose `exec` methods don't consistently return `undefined` for - // nonparticipating capturing groups - if (!compliantExecNpcg && match.length > 1) { - /* eslint-disable no-loop-func */ - match[0].replace(separator2, function () { - for (var i = 1; i < arguments.length - 2; i++) { - if (typeof arguments[i] === 'undefined') { - match[i] = void 0; - } - } - }); - /* eslint-enable no-loop-func */ - } - if (match.length > 1 && match.index < string.length) { - array_push.apply(output, arraySlice(match, 1)); - } - lastLength = match[0].length; - lastLastIndex = lastIndex; - if (output.length >= splitLimit) { - break; - } - } - if (separatorCopy.lastIndex === match.index) { - separatorCopy.lastIndex++; // Avoid an infinite loop - } - match = separatorCopy.exec(string); - } - if (lastLastIndex === string.length) { - if (lastLength || !separatorCopy.test('')) { - pushCall(output, ''); - } - } else { - pushCall(output, strSlice(string, lastLastIndex)); - } - return output.length > splitLimit ? arraySlice(output, 0, splitLimit) : output; - }; - }()); - - // [bugfix, chrome] - // If separator is undefined, then the result array contains just one String, - // which is the this value (converted to a String). If limit is not undefined, - // then the output array is truncated so that it contains no more than limit - // elements. - // "0".split(undefined, 0) -> [] - } else if ('0'.split(void 0, 0).length) { - StringPrototype.split = function split(separator, limit) { - if (typeof separator === 'undefined' && limit === 0) { - return []; - } - return strSplit(this, separator, limit); - }; - } - - var str_replace = StringPrototype.replace; - var replaceReportsGroupsCorrectly = (function () { - var groups = []; - 'x'.replace(/x(.)?/g, function (match, group) { - pushCall(groups, group); - }); - return groups.length === 1 && typeof groups[0] === 'undefined'; - }()); - - if (!replaceReportsGroupsCorrectly) { - StringPrototype.replace = function replace(searchValue, replaceValue) { - var isFn = isCallable(replaceValue); - var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source); - if (!isFn || !hasCapturingGroups) { - return str_replace.call(this, searchValue, replaceValue); - } else { - var wrappedReplaceValue = function (match) { - var length = arguments.length; - var originalLastIndex = searchValue.lastIndex; - searchValue.lastIndex = 0; - var args = searchValue.exec(match) || []; - searchValue.lastIndex = originalLastIndex; - pushCall(args, arguments[length - 2], arguments[length - 1]); - return replaceValue.apply(this, args); - }; - return str_replace.call(this, searchValue, wrappedReplaceValue); - } - }; - } - - // ECMA-262, 3rd B.2.3 - // Not an ECMAScript standard, although ECMAScript 3rd Edition has a - // non-normative section suggesting uniform semantics and it should be - // normalized across all browsers - // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE - var string_substr = StringPrototype.substr; - var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b'; - defineProperties(StringPrototype, { - substr: function substr(start, length) { - var normalizedStart = start; - if (start < 0) { - normalizedStart = max(this.length + start, 0); - } - return string_substr.call(this, normalizedStart, length); - } - }, hasNegativeSubstrBug); - - // ES5 15.5.4.20 - // whitespace from: http://es5.github.io/#x15.5.4.20 - var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + - '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + - '\u2029\uFEFF'; - var zeroWidth = '\u200b'; - var wsRegexChars = '[' + ws + ']'; - var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*'); - var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$'); - var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim()); - defineProperties(StringPrototype, { - // http://blog.stevenlevithan.com/archives/faster-trim-javascript - // http://perfectionkills.com/whitespace-deviations/ - trim: function trim() { - if (typeof this === 'undefined' || this === null) { - throw new TypeError("can't convert " + this + ' to object'); - } - return $String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, ''); - } - }, hasTrimWhitespaceBug); - var trim = call.bind(String.prototype.trim); - - var hasLastIndexBug = StringPrototype.lastIndexOf && 'abcあい'.lastIndexOf('あい', 2) !== -1; - defineProperties(StringPrototype, { - lastIndexOf: function lastIndexOf(searchString) { - if (typeof this === 'undefined' || this === null) { - throw new TypeError("can't convert " + this + ' to object'); - } - var S = $String(this); - var searchStr = $String(searchString); - var numPos = arguments.length > 1 ? $Number(arguments[1]) : NaN; - var pos = isActualNaN(numPos) ? Infinity : ES.ToInteger(numPos); - var start = min(max(pos, 0), S.length); - var searchLen = searchStr.length; - var k = start + searchLen; - while (k > 0) { - k = max(0, k - searchLen); - var index = strIndexOf(strSlice(S, k, start + searchLen), searchStr); - if (index !== -1) { - return k + index; - } - } - return -1; - } - }, hasLastIndexBug); - - var originalLastIndexOf = StringPrototype.lastIndexOf; - defineProperties(StringPrototype, { - lastIndexOf: function lastIndexOf(searchString) { - return originalLastIndexOf.apply(this, arguments); - } - }, StringPrototype.lastIndexOf.length !== 1); - - // ES-5 15.1.2.2 - /* eslint-disable radix */ - if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) { - /* eslint-enable radix */ - /* global parseInt: true */ - parseInt = (function (origParseInt) { - var hexRegex = /^[\-+]?0[xX]/; - return function parseInt(str, radix) { - var string = trim(String(str)); - var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10); - return origParseInt(string, defaultedRadix); - }; - }(parseInt)); - } - - // https://es5.github.io/#x15.1.2.3 - if (1 / parseFloat('-0') !== -Infinity) { - /* global parseFloat: true */ - parseFloat = (function (origParseFloat) { - return function parseFloat(string) { - var inputString = trim(String(string)); - var result = origParseFloat(inputString); - return result === 0 && strSlice(inputString, 0, 1) === '-' ? -0 : result; - }; - }(parseFloat)); - } - - if (String(new RangeError('test')) !== 'RangeError: test') { - var errorToStringShim = function toString() { - if (typeof this === 'undefined' || this === null) { - throw new TypeError("can't convert " + this + ' to object'); - } - var name = this.name; - if (typeof name === 'undefined') { - name = 'Error'; - } else if (typeof name !== 'string') { - name = $String(name); - } - var msg = this.message; - if (typeof msg === 'undefined') { - msg = ''; - } else if (typeof msg !== 'string') { - msg = $String(msg); - } - if (!name) { - return msg; - } - if (!msg) { - return name; - } - return name + ': ' + msg; - }; - // can't use defineProperties here because of toString enumeration issue in IE <= 8 - Error.prototype.toString = errorToStringShim; - } - - if (supportsDescriptors) { - var ensureNonEnumerable = function (obj, prop) { - if (isEnum(obj, prop)) { - var desc = Object.getOwnPropertyDescriptor(obj, prop); - if (desc.configurable) { - desc.enumerable = false; - Object.defineProperty(obj, prop, desc); - } - } - }; - ensureNonEnumerable(Error.prototype, 'message'); - if (Error.prototype.message !== '') { - Error.prototype.message = ''; - } - ensureNonEnumerable(Error.prototype, 'name'); - } - - if (String(/a/mig) !== '/a/gim') { - var regexToString = function toString() { - var str = '/' + this.source + '/'; - if (this.global) { - str += 'g'; - } - if (this.ignoreCase) { - str += 'i'; - } - if (this.multiline) { - str += 'm'; - } - return str; - }; - // can't use defineProperties here because of toString enumeration issue in IE <= 8 - RegExp.prototype.toString = regexToString; - } -})); -/*! - * https://github.com/es-shims/es5-shim - * @license es5-shim Copyright 2009-2015 by contributors, MIT License - * see https://github.com/es-shims/es5-shim/blob/master/LICENSE - */ - -// vim: ts=4 sts=4 sw=4 expandtab - -// Add semicolon to prevent IIFE from being passed as argument to concatenated code. -; - -// UMD (Universal Module Definition) -// see https://github.com/umdjs/umd/blob/master/templates/returnExports.js -(function (root, factory) { - 'use strict'; - - /* global define, exports, module */ - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(factory); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like enviroments that support module.exports, - // like Node. - module.exports = factory(); - } else { - // Browser globals (root is window) - root.returnExports = factory(); - } -}(this, function () { - - var call = Function.call; - var prototypeOfObject = Object.prototype; - var owns = call.bind(prototypeOfObject.hasOwnProperty); - var isEnumerable = call.bind(prototypeOfObject.propertyIsEnumerable); - var toStr = call.bind(prototypeOfObject.toString); - - // If JS engine supports accessors creating shortcuts. - var defineGetter; - var defineSetter; - var lookupGetter; - var lookupSetter; - var supportsAccessors = owns(prototypeOfObject, '__defineGetter__'); - if (supportsAccessors) { - /* eslint-disable no-underscore-dangle */ - defineGetter = call.bind(prototypeOfObject.__defineGetter__); - defineSetter = call.bind(prototypeOfObject.__defineSetter__); - lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); - lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); - /* eslint-enable no-underscore-dangle */ - } - - var isPrimitive = function isPrimitive(o) { - return o == null || (typeof o !== 'object' && typeof o !== 'function'); - }; - - // ES5 15.2.3.2 - // http://es5.github.com/#x15.2.3.2 - if (!Object.getPrototypeOf) { - // https://github.com/es-shims/es5-shim/issues#issue/2 - // http://ejohn.org/blog/objectgetprototypeof/ - // recommended by fschaefer on github - // - // sure, and webreflection says ^_^ - // ... this will nerever possibly return null - // ... Opera Mini breaks here with infinite loops - Object.getPrototypeOf = function getPrototypeOf(object) { - /* eslint-disable no-proto */ - var proto = object.__proto__; - /* eslint-enable no-proto */ - if (proto || proto === null) { - return proto; - } else if (toStr(object.constructor) === '[object Function]') { - return object.constructor.prototype; - } else if (object instanceof Object) { - return prototypeOfObject; - } else { - // Correctly return null for Objects created with `Object.create(null)` - // (shammed or native) or `{ __proto__: null}`. Also returns null for - // cross-realm objects on browsers that lack `__proto__` support (like - // IE <11), but that's the best we can do. - return null; - } - }; - } - - // ES5 15.2.3.3 - // http://es5.github.com/#x15.2.3.3 - - var doesGetOwnPropertyDescriptorWork = function doesGetOwnPropertyDescriptorWork(object) { - try { - object.sentinel = 0; - return Object.getOwnPropertyDescriptor(object, 'sentinel').value === 0; - } catch (exception) { - return false; - } - }; - - // check whether getOwnPropertyDescriptor works if it's given. Otherwise, shim partially. - if (Object.defineProperty) { - var getOwnPropertyDescriptorWorksOnObject = doesGetOwnPropertyDescriptorWork({}); - var getOwnPropertyDescriptorWorksOnDom = typeof document === 'undefined' || - doesGetOwnPropertyDescriptorWork(document.createElement('div')); - if (!getOwnPropertyDescriptorWorksOnDom || !getOwnPropertyDescriptorWorksOnObject) { - var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor; - } - } - - if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) { - var ERR_NON_OBJECT = 'Object.getOwnPropertyDescriptor called on a non-object: '; - - /* eslint-disable no-proto */ - Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { - if (isPrimitive(object)) { - throw new TypeError(ERR_NON_OBJECT + object); - } - - // make a valiant attempt to use the real getOwnPropertyDescriptor - // for I8's DOM elements. - if (getOwnPropertyDescriptorFallback) { - try { - return getOwnPropertyDescriptorFallback.call(Object, object, property); - } catch (exception) { - // try the shim if the real one doesn't work - } - } - - var descriptor; - - // If object does not owns property return undefined immediately. - if (!owns(object, property)) { - return descriptor; - } - - // If object has a property then it's for sure `configurable`, and - // probably `enumerable`. Detect enumerability though. - descriptor = { - enumerable: isEnumerable(object, property), - configurable: true - }; - - // If JS engine supports accessor properties then property may be a - // getter or setter. - if (supportsAccessors) { - // Unfortunately `__lookupGetter__` will return a getter even - // if object has own non getter property along with a same named - // inherited getter. To avoid misbehavior we temporary remove - // `__proto__` so that `__lookupGetter__` will return getter only - // if it's owned by an object. - var prototype = object.__proto__; - var notPrototypeOfObject = object !== prototypeOfObject; - // avoid recursion problem, breaking in Opera Mini when - // Object.getOwnPropertyDescriptor(Object.prototype, 'toString') - // or any other Object.prototype accessor - if (notPrototypeOfObject) { - object.__proto__ = prototypeOfObject; - } - - var getter = lookupGetter(object, property); - var setter = lookupSetter(object, property); - - if (notPrototypeOfObject) { - // Once we have getter and setter we can put values back. - object.__proto__ = prototype; - } - - if (getter || setter) { - if (getter) { - descriptor.get = getter; - } - if (setter) { - descriptor.set = setter; - } - // If it was accessor property we're done and return here - // in order to avoid adding `value` to the descriptor. - return descriptor; - } - } - - // If we got this far we know that object has an own property that is - // not an accessor so we set it as a value and return descriptor. - descriptor.value = object[property]; - descriptor.writable = true; - return descriptor; - }; - /* eslint-enable no-proto */ - } - - // ES5 15.2.3.4 - // http://es5.github.com/#x15.2.3.4 - if (!Object.getOwnPropertyNames) { - Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - return Object.keys(object); - }; - } - - // ES5 15.2.3.5 - // http://es5.github.com/#x15.2.3.5 - if (!Object.create) { - - // Contributed by Brandon Benvie, October, 2012 - var createEmpty; - var supportsProto = !({ __proto__: null } instanceof Object); - // the following produces false positives - // in Opera Mini => not a reliable check - // Object.prototype.__proto__ === null - - // Check for document.domain and active x support - // No need to use active x approach when document.domain is not set - // see https://github.com/es-shims/es5-shim/issues/150 - // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 - /* global ActiveXObject */ - var shouldUseActiveX = function shouldUseActiveX() { - // return early if document.domain not set - if (!document.domain) { - return false; - } - - try { - return !!new ActiveXObject('htmlfile'); - } catch (exception) { - return false; - } - }; - - // This supports IE8 when document.domain is used - // see https://github.com/es-shims/es5-shim/issues/150 - // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 - var getEmptyViaActiveX = function getEmptyViaActiveX() { - var empty; - var xDoc; - - xDoc = new ActiveXObject('htmlfile'); - - var script = 'script'; - xDoc.write('<' + script + '>'); - xDoc.close(); - - empty = xDoc.parentWindow.Object.prototype; - xDoc = null; - - return empty; - }; - - // The original implementation using an iframe - // before the activex approach was added - // see https://github.com/es-shims/es5-shim/issues/150 - var getEmptyViaIFrame = function getEmptyViaIFrame() { - var iframe = document.createElement('iframe'); - var parent = document.body || document.documentElement; - var empty; - - iframe.style.display = 'none'; - parent.appendChild(iframe); - /* eslint-disable no-script-url */ - iframe.src = 'javascript:'; - /* eslint-enable no-script-url */ - - empty = iframe.contentWindow.Object.prototype; - parent.removeChild(iframe); - iframe = null; - - return empty; - }; - - /* global document */ - if (supportsProto || typeof document === 'undefined') { - createEmpty = function () { - return { __proto__: null }; - }; - } else { - // In old IE __proto__ can't be used to manually set `null`, nor does - // any other method exist to make an object that inherits from nothing, - // aside from Object.prototype itself. Instead, create a new global - // object and *steal* its Object.prototype and strip it bare. This is - // used as the prototype to create nullary objects. - createEmpty = function () { - // Determine which approach to use - // see https://github.com/es-shims/es5-shim/issues/150 - var empty = shouldUseActiveX() ? getEmptyViaActiveX() : getEmptyViaIFrame(); - - delete empty.constructor; - delete empty.hasOwnProperty; - delete empty.propertyIsEnumerable; - delete empty.isPrototypeOf; - delete empty.toLocaleString; - delete empty.toString; - delete empty.valueOf; - - var Empty = function Empty() {}; - Empty.prototype = empty; - // short-circuit future calls - createEmpty = function () { - return new Empty(); - }; - return new Empty(); - }; - } - - Object.create = function create(prototype, properties) { - - var object; - var Type = function Type() {}; // An empty constructor. - - if (prototype === null) { - object = createEmpty(); - } else { - if (prototype !== null && isPrimitive(prototype)) { - // In the native implementation `parent` can be `null` - // OR *any* `instanceof Object` (Object|Function|Array|RegExp|etc) - // Use `typeof` tho, b/c in old IE, DOM elements are not `instanceof Object` - // like they are in modern browsers. Using `Object.create` on DOM elements - // is...err...probably inappropriate, but the native version allows for it. - throw new TypeError('Object prototype may only be an Object or null'); // same msg as Chrome - } - Type.prototype = prototype; - object = new Type(); - // IE has no built-in implementation of `Object.getPrototypeOf` - // neither `__proto__`, but this manually setting `__proto__` will - // guarantee that `Object.getPrototypeOf` will work as expected with - // objects created using `Object.create` - /* eslint-disable no-proto */ - object.__proto__ = prototype; - /* eslint-enable no-proto */ - } - - if (properties !== void 0) { - Object.defineProperties(object, properties); - } - - return object; - }; - } - - // ES5 15.2.3.6 - // http://es5.github.com/#x15.2.3.6 - - // Patch for WebKit and IE8 standard mode - // Designed by hax - // related issue: https://github.com/es-shims/es5-shim/issues#issue/5 - // IE8 Reference: - // http://msdn.microsoft.com/en-us/library/dd282900.aspx - // http://msdn.microsoft.com/en-us/library/dd229916.aspx - // WebKit Bugs: - // https://bugs.webkit.org/show_bug.cgi?id=36423 - - var doesDefinePropertyWork = function doesDefinePropertyWork(object) { - try { - Object.defineProperty(object, 'sentinel', {}); - return 'sentinel' in object; - } catch (exception) { - return false; - } - }; - - // check whether defineProperty works if it's given. Otherwise, - // shim partially. - if (Object.defineProperty) { - var definePropertyWorksOnObject = doesDefinePropertyWork({}); - var definePropertyWorksOnDom = typeof document === 'undefined' || - doesDefinePropertyWork(document.createElement('div')); - if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { - var definePropertyFallback = Object.defineProperty, - definePropertiesFallback = Object.defineProperties; - } - } - - if (!Object.defineProperty || definePropertyFallback) { - var ERR_NON_OBJECT_DESCRIPTOR = 'Property description must be an object: '; - var ERR_NON_OBJECT_TARGET = 'Object.defineProperty called on non-object: '; - var ERR_ACCESSORS_NOT_SUPPORTED = 'getters & setters can not be defined on this javascript engine'; - - Object.defineProperty = function defineProperty(object, property, descriptor) { - if (isPrimitive(object)) { - throw new TypeError(ERR_NON_OBJECT_TARGET + object); - } - if (isPrimitive(descriptor)) { - throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); - } - // make a valiant attempt to use the real defineProperty - // for I8's DOM elements. - if (definePropertyFallback) { - try { - return definePropertyFallback.call(Object, object, property, descriptor); - } catch (exception) { - // try the shim if the real one doesn't work - } - } - - // If it's a data property. - if ('value' in descriptor) { - // fail silently if 'writable', 'enumerable', or 'configurable' - // are requested but not supported - /* - // alternate approach: - if ( // can't implement these features; allow false but not true - ('writable' in descriptor && !descriptor.writable) || - ('enumerable' in descriptor && !descriptor.enumerable) || - ('configurable' in descriptor && !descriptor.configurable) - )) - throw new RangeError( - 'This implementation of Object.defineProperty does not support configurable, enumerable, or writable.' - ); - */ - - if (supportsAccessors && (lookupGetter(object, property) || lookupSetter(object, property))) { - // As accessors are supported only on engines implementing - // `__proto__` we can safely override `__proto__` while defining - // a property to make sure that we don't hit an inherited - // accessor. - /* eslint-disable no-proto */ - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - // Deleting a property anyway since getter / setter may be - // defined on object itself. - delete object[property]; - object[property] = descriptor.value; - // Setting original `__proto__` back now. - object.__proto__ = prototype; - /* eslint-enable no-proto */ - } else { - object[property] = descriptor.value; - } - } else { - var hasGetter = 'get' in descriptor; - var hasSetter = 'set' in descriptor; - if (!supportsAccessors && (hasGetter || hasSetter)) { - throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); - } - // If we got that far then getters and setters can be defined !! - if (hasGetter) { - defineGetter(object, property, descriptor.get); - } - if (hasSetter) { - defineSetter(object, property, descriptor.set); - } - } - return object; - }; - } - - // ES5 15.2.3.7 - // http://es5.github.com/#x15.2.3.7 - if (!Object.defineProperties || definePropertiesFallback) { - Object.defineProperties = function defineProperties(object, properties) { - // make a valiant attempt to use the real defineProperties - if (definePropertiesFallback) { - try { - return definePropertiesFallback.call(Object, object, properties); - } catch (exception) { - // try the shim if the real one doesn't work - } - } - - Object.keys(properties).forEach(function (property) { - if (property !== '__proto__') { - Object.defineProperty(object, property, properties[property]); - } - }); - return object; - }; - } - - // ES5 15.2.3.8 - // http://es5.github.com/#x15.2.3.8 - if (!Object.seal) { - Object.seal = function seal(object) { - if (Object(object) !== object) { - throw new TypeError('Object.seal can only be called on Objects.'); - } - // this is misleading and breaks feature-detection, but - // allows "securable" code to "gracefully" degrade to working - // but insecure code. - return object; - }; - } - - // ES5 15.2.3.9 - // http://es5.github.com/#x15.2.3.9 - if (!Object.freeze) { - Object.freeze = function freeze(object) { - if (Object(object) !== object) { - throw new TypeError('Object.freeze can only be called on Objects.'); - } - // this is misleading and breaks feature-detection, but - // allows "securable" code to "gracefully" degrade to working - // but insecure code. - return object; - }; - } - - // detect a Rhino bug and patch it - try { - Object.freeze(function () {}); - } catch (exception) { - Object.freeze = (function (freezeObject) { - return function freeze(object) { - if (typeof object === 'function') { - return object; - } else { - return freezeObject(object); - } - }; - }(Object.freeze)); - } - - // ES5 15.2.3.10 - // http://es5.github.com/#x15.2.3.10 - if (!Object.preventExtensions) { - Object.preventExtensions = function preventExtensions(object) { - if (Object(object) !== object) { - throw new TypeError('Object.preventExtensions can only be called on Objects.'); - } - // this is misleading and breaks feature-detection, but - // allows "securable" code to "gracefully" degrade to working - // but insecure code. - return object; - }; - } - - // ES5 15.2.3.11 - // http://es5.github.com/#x15.2.3.11 - if (!Object.isSealed) { - Object.isSealed = function isSealed(object) { - if (Object(object) !== object) { - throw new TypeError('Object.isSealed can only be called on Objects.'); - } - return false; - }; - } - - // ES5 15.2.3.12 - // http://es5.github.com/#x15.2.3.12 - if (!Object.isFrozen) { - Object.isFrozen = function isFrozen(object) { - if (Object(object) !== object) { - throw new TypeError('Object.isFrozen can only be called on Objects.'); - } - return false; - }; - } - - // ES5 15.2.3.13 - // http://es5.github.com/#x15.2.3.13 - if (!Object.isExtensible) { - Object.isExtensible = function isExtensible(object) { - // 1. If Type(O) is not Object throw a TypeError exception. - if (Object(object) !== object) { - throw new TypeError('Object.isExtensible can only be called on Objects.'); - } - // 2. Return the Boolean value of the [[Extensible]] internal property of O. - var name = ''; - while (owns(object, name)) { - name += '?'; - } - object[name] = true; - var returnValue = owns(object, name); - delete object[name]; - return returnValue; - }; - } - -})); diff --git a/packages/es5-shim/es5-shim-sham.min.js b/packages/es5-shim/es5-shim-sham.min.js deleted file mode 100644 index a1ddf1c54c..0000000000 --- a/packages/es5-shim/es5-shim-sham.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"use strict";"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.returnExports=e()}(this,function(){var t=Array,e=t.prototype,r=Object,n=r.prototype,o=Function,i=o.prototype,a=String,c=a.prototype,u=Number,l=u.prototype,f=e.slice,s=e.splice,p=e.push,h=e.unshift,y=e.concat,d=e.join,b=i.call,v=i.apply,g=Math.max,w=Math.min,O=n.toString,j="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,T,m=Function.prototype.toString,D=/^\s*class /,E=function t(e){try{var r=m.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return D.test(r)}catch(t){return!1}},x=function t(e){try{return!E(e)&&(m.call(e),!0)}catch(t){return!1}},S="[object Function]",_="[object GeneratorFunction]",T=function t(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(j)return x(e);if(E(e))return!1;var r=O.call(e);return r===S||r===_},M,I=RegExp.prototype.exec,P=function t(e){try{return I.call(e),!0}catch(t){return!1}},F="[object RegExp]";M=function t(e){return"object"==typeof e&&(j?P(e):O.call(e)===F)};var U,N=String.prototype.valueOf,k=function t(e){try{return N.call(e),!0}catch(t){return!1}},C="[object String]";U=function t(e){return"string"==typeof e||"object"==typeof e&&(j?k(e):O.call(e)===C)};var A=r.defineProperty&&function(){try{var t={};r.defineProperty(t,"x",{enumerable:!1,value:t});for(var e in t)return!1;return t.x===t}catch(t){return!1}}(),R=function(t){var e;return e=A?function(t,e,n,o){!o&&e in t||r.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,r,n){!n&&e in t||(t[e]=r)},function r(n,o,i){for(var a in o)t.call(o,a)&&e(n,a,o[a],i)}}(n.hasOwnProperty),$=function t(e){var r=typeof e;return null===e||"object"!==r&&"function"!==r},z=u.isNaN||function t(e){return e!==e},J={ToInteger:function t(e){var r=+e;return z(r)?r=0:0!==r&&r!==1/0&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r))),r},ToPrimitive:function t(e){var r,n,o;if($(e))return e;if(n=e.valueOf,T(n)&&(r=n.call(e),$(r)))return r;if(o=e.toString,T(o)&&(r=o.call(e),$(r)))return r;throw new TypeError},ToObject:function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return r(t)},ToUint32:function t(e){return e>>>0}},G=function t(){};R(i,{bind:function t(e){var n=this;if(!T(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i=f.call(arguments,1),a,c=function(){if(this instanceof a){var t=v.call(n,this,y.call(i,f.call(arguments)));return r(t)===t?t:this}return v.call(n,e,y.call(i,f.call(arguments)))},u=g(0,n.length-i.length),l=[],s=0;s1&&(a=arguments[1]),!T(e))throw new TypeError("Array.prototype.forEach callback must be a function");for(;++o1&&(c=arguments[1]),!T(r))throw new TypeError("Array.prototype.map callback must be a function");for(var u=0;u1&&(c=arguments[1]),!T(e))throw new TypeError("Array.prototype.filter callback must be a function");for(var u=0;u1&&(i=arguments[1]),!T(e))throw new TypeError("Array.prototype.every callback must be a function");for(var a=0;a1&&(i=arguments[1]),!T(e))throw new TypeError("Array.prototype.some callback must be a function");for(var a=0;a=2)a=arguments[1];else for(;;){if(i in n){a=n[i++];break}if(++i>=o)throw new TypeError("reduce of empty array with no initial value")}for(;i=2)i=arguments[1];else for(;;){if(a in n){i=n[a--];break}if(--a<0)throw new TypeError("reduceRight of empty array with no initial value")}if(a<0)return i;do{a in n&&(i=e(i,n[a],a,r))}while(a--);return i}},!it);var at=e.indexOf&&-1!==[0,1].indexOf(1,2);R(e,{indexOf:function t(e){var r=rt&&U(this)?H(this,""):J.ToObject(this),n=J.ToUint32(r.length);if(0===n)return-1;var o=0;for(arguments.length>1&&(o=J.ToInteger(arguments[1])),o=o>=0?o:g(0,n+o);o1&&(o=w(o,J.ToInteger(arguments[1]))),o=o>=0?o:n-Math.abs(o);o>=0;o--)if(o in r&&e===r[o])return o;return-1}},ct);var ut=function(){var t=[1,2],e=t.splice();return 2===t.length&&V(e)&&0===e.length}();R(e,{splice:function t(e,r){return 0===arguments.length?[]:s.apply(this,arguments)}},!ut);var lt=function(){var t={};return e.splice.call(t,0,0,1),1===t.length}();R(e,{splice:function t(e,r){if(0===arguments.length)return[];var n=arguments;return this.length=g(J.ToInteger(this.length),0),arguments.length>0&&"number"!=typeof r&&((n=W(arguments)).length<2?q(n,this.length-e):n[1]=J.ToInteger(r)),s.apply(this,n)}},!lt);var ft=function(){var e=new t(1e5);return e[8]="x",e.splice(1,1),7===e.indexOf("x")}(),st=function(){var t=256,e=[];return e[t]="a",e.splice(257,0,"b"),"a"===e[t]}();R(e,{splice:function t(e,r){for(var n=J.ToObject(this),o=[],i=J.ToUint32(n.length),c=J.ToInteger(e),u=c<0?g(i+c,0):w(c,i),l=w(g(J.ToInteger(r),0),i-u),f=0,s;fb;)delete n[f-1],f-=1}else if(h>l)for(f=i-l;f>u;)s=a(f+l-1),y=a(f+h-1),Z(n,s)?n[y]=n[s]:delete n[y],f-=1;f=u;for(var v=0;v=0&&!V(e)&&T(e.callee)},Ft=It(arguments)?It:Pt;R(r,{keys:function t(e){var r=T(e),n=Ft(e),o=null!==e&&"object"==typeof e,i=o&&U(e);if(!o&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var c=[],u=Tt&&r;if(i&&mt||n)for(var l=0;l11?e+1:e},getMonth:function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=Gt(this),r=Zt(this);return e<0&&r>11?0:r},getDate:function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=Gt(this),r=Zt(this),n=Yt(this);return e<0&&r>11?12===r?n:ee(0,e+1)-n+1:n},getUTCFullYear:function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=Wt(this);return e<0&&Xt(this)>11?e+1:e},getUTCMonth:function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=Wt(this),r=Xt(this);return e<0&&r>11?0:r},getUTCDate:function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=Wt(this),r=Xt(this),n=Bt(this);return e<0&&r>11?12===r?n:ee(0,e+1)-n+1:n}},Ct),R(Date.prototype,{toUTCString:function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=Ht(this),r=Bt(this),n=Xt(this),o=Wt(this),i=Lt(this),a=qt(this),c=Kt(this);return Vt[e]+", "+(r<10?"0"+r:r)+" "+te[n]+" "+o+" "+(i<10?"0"+i:i)+":"+(a<10?"0"+a:a)+":"+(c<10?"0"+c:c)+" GMT"}},Ct||$t),R(Date.prototype,{toDateString:function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=this.getDay(),r=this.getDate(),n=this.getMonth(),o=this.getFullYear();return Vt[e]+" "+te[n]+" "+(r<10?"0"+r:r)+" "+o}},Ct||zt),(Ct||Jt)&&(Date.prototype.toString=function t(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var e=this.getDay(),r=this.getDate(),n=this.getMonth(),o=this.getFullYear(),i=this.getHours(),a=this.getMinutes(),c=this.getSeconds(),u=this.getTimezoneOffset(),l=Math.floor(Math.abs(u)/60),f=Math.floor(Math.abs(u)%60);return Vt[e]+" "+te[n]+" "+(r<10?"0"+r:r)+" "+o+" "+(i<10?"0"+i:i)+":"+(a<10?"0"+a:a)+":"+(c<10?"0"+c:c)+" GMT"+(u>0?"-":"+")+(l<10?"0"+l:l)+(f<10?"0"+f:f)},A&&r.defineProperty(Date.prototype,"toString",{configurable:!0,enumerable:!1,writable:!0}));var re=-621987552e5,ne="-000001",oe=Date.prototype.toISOString&&-1===new Date(-621987552e5).toISOString().indexOf("-000001"),ie=Date.prototype.toISOString&&"1969-12-31T23:59:59.999Z"!==new Date(-1).toISOString(),ae=b.bind(Date.prototype.getTime);R(Date.prototype,{toISOString:function t(){if(!isFinite(this)||!isFinite(ae(this)))throw new RangeError("Date.prototype.toISOString called on non-finite value.");var e=Wt(this),r=Xt(this);e+=Math.floor(r/12);var n=[(r=(r%12+12)%12)+1,Bt(this),Lt(this),qt(this),Kt(this)];e=(e<0?"-":e>9999?"+":"")+B("00000"+Math.abs(e),0<=e&&e<=9999?-4:-6);for(var o=0;o=7&&f>le){var d=Math.floor(f/le)*le,b=Math.floor(d/1e3);h+=b,y-=1e3*b}p=1===s&&a(n)===n?new t(e.parse(n)):s>=7?new t(n,o,i,c,u,h,y):s>=6?new t(n,o,i,c,u,h):s>=5?new t(n,o,i,c,u):s>=4?new t(n,o,i,c):s>=3?new t(n,o,i):s>=2?new t(n,o):s>=1?new t(n instanceof t?+n:n):new t}else p=t.apply(this,arguments);return $(p)||R(p,{constructor:e},!0),p},r=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),n=[0,31,59,90,120,151,181,212,243,273,304,334,365],o=function t(e,r){var o=r>1?1:0;return n[r]+Math.floor((e-1969+o)/4)-Math.floor((e-1901+o)/100)+Math.floor((e-1601+o)/400)+365*(e-1970)},i=function e(r){var n=0,o=r;if(fe&&o>le){var i=Math.floor(o/le)*le,a=Math.floor(i/1e3);n+=a,o-=1e3*a}return u(new t(1970,0,1,0,0,n,o))};for(var c in t)Z(t,c)&&(e[c]=t[c]);return R(e,{now:t.now,UTC:t.UTC},!0),e.prototype=t.prototype,R(e.prototype,{constructor:e},!0),R(e,{parse:function e(n){var a=r.exec(n);if(a){var c=u(a[1]),l=u(a[2]||1)-1,f=u(a[3]||1)-1,s=u(a[4]||0),p=u(a[5]||0),h=u(a[6]||0),y=Math.floor(1e3*u(a[7]||0)),d=Boolean(a[4]&&!a[8]),b="-"===a[9]?1:-1,v=u(a[10]||0),g=u(a[11]||0),w;return s<(p>0||h>0||y>0?24:25)&&p<60&&h<60&&y<1e3&&l>-1&&l<12&&v<24&&g<60&&f>-1&&f=0;)n+=pe.data[r],pe.data[r]=Math.floor(n/e),n=n%e*pe.base},numToString:function t(){for(var e=pe.size,r="";--e>=0;)if(""!==r||0===e||0!==pe.data[e]){var n=a(pe.data[e]);""===r?r=n:r+=B("0000000",0,7-n.length)+n}return r},pow:function t(e,r,n){return 0===r?n:r%2==1?t(e,r-1,n*e):t(e*e,r/2,n)},log:function t(e){for(var r=0,n=e;n>=4096;)r+=12,n/=4096;for(;n>=2;)r+=1,n/=2;return r}};R(l,{toFixed:function t(e){var r,n,o,i,c,l,f,s;if(r=u(e),(r=z(r)?0:Math.floor(r))<0||r>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(n=u(this),z(n))return"NaN";if(n<=-1e21||n>=1e21)return a(n);if(o="",n<0&&(o="-",n=-n),i="0",n>1e-21)if(c=pe.log(n*pe.pow(2,69,1))-69,l=c<0?n*pe.pow(2,-c,1):n/pe.pow(2,c,1),l*=4503599627370496,(c=52-c)>0){for(pe.multiply(0,l),f=r;f>=7;)pe.multiply(1e7,0),f-=7;for(pe.multiply(pe.pow(10,f,1),0),f=c-1;f>=23;)pe.divide(1<<23),f-=23;pe.divide(1<0?(s=i.length)<=r?o+B("0.0000000000000000000",0,r-s+2)+i:o+B(i,0,s-r)+"."+B(i,s-r):o+i}},se);var he=function(){try{return"1"===1..toPrecision(void 0)}catch(t){return!0}}(),ye=l.toPrecision;R(l,{toPrecision:function t(e){return void 0===e?ye.call(this):ye.call(this,e)}},he),2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?function(){var t=void 0===/()??/.exec("")[1],e=Math.pow(2,32)-1;c.split=function(r,n){var o=String(this);if(void 0===r&&0===n)return[];if(!M(r))return H(this,r,n);var i=[],a=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.unicode?"u":"")+(r.sticky?"y":""),c=0,u,l,f,s,h=new RegExp(r.source,a+"g");t||(u=new RegExp("^"+h.source+"$(?!\\s)",a));var y=void 0===n?e:J.ToUint32(n);for(l=h.exec(o);l&&!((f=l.index+l[0].length)>c&&(q(i,B(o,c,l.index)),!t&&l.length>1&&l[0].replace(u,function(){for(var t=1;t1&&l.index=y));)h.lastIndex===l.index&&h.lastIndex++,l=h.exec(o);return c===o.length?!s&&h.test("")||q(i,""):q(i,B(o,c)),i.length>y?W(i,0,y):i}}():"0".split(void 0,0).length&&(c.split=function t(e,r){return void 0===e&&0===r?[]:H(this,e,r)});var de=c.replace;(function(){var t=[];return"x".replace(/x(.)?/g,function(e,r){q(t,r)}),1===t.length&&void 0===t[0]})()||(c.replace=function t(e,r){var n=T(r),o=M(e)&&/\)[*?]/.test(e.source);if(n&&o){var i=function(t){var n=arguments.length,o=e.lastIndex;e.lastIndex=0;var i=e.exec(t)||[];return e.lastIndex=o,q(i,arguments[n-2],arguments[n-1]),r.apply(this,i)};return de.call(this,e,i)}return de.call(this,e,r)});var be=c.substr,ve="".substr&&"b"!=="0b".substr(-1);R(c,{substr:function t(e,r){var n=e;return e<0&&(n=g(this.length+e,0)),be.call(this,n,r)}},ve);var ge="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff",we="​",Oe="["+ge+"]",je=new RegExp("^"+Oe+Oe+"*"),Te=new RegExp(Oe+Oe+"*$"),me=c.trim&&(ge.trim()||!"​".trim());R(c,{trim:function t(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return a(this).replace(je,"").replace(Te,"")}},me);var De=b.bind(String.prototype.trim),Ee=c.lastIndexOf&&-1!=="abcあい".lastIndexOf("あい",2);R(c,{lastIndexOf:function t(e){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");for(var r=a(this),n=a(e),o=arguments.length>1?u(arguments[1]):NaN,i=z(o)?1/0:J.ToInteger(o),c=w(g(i,0),r.length),l=n.length,f=c+l;f>0;){f=g(0,f-l);var s=L(B(r,f,c+l),n);if(-1!==s)return f+s}return-1}},Ee);var xe=c.lastIndexOf;if(R(c,{lastIndexOf:function t(e){return xe.apply(this,arguments)}},1!==c.lastIndexOf.length),8===parseInt(ge+"08")&&22===parseInt(ge+"0x16")||(parseInt=function(t){var e=/^[\-+]?0[xX]/;return function r(n,o){var i=De(String(n)),a=u(o)||(e.test(i)?16:10);return t(i,a)}}(parseInt)),1/parseFloat("-0")!=-1/0&&(parseFloat=function(t){return function e(r){var n=De(String(r)),o=t(n);return 0===o&&"-"===B(n,0,1)?-0:o}}(parseFloat)),"RangeError: test"!==String(new RangeError("test"))){var Se=function t(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");var e=this.name;void 0===e?e="Error":"string"!=typeof e&&(e=a(e));var r=this.message;return void 0===r?r="":"string"!=typeof r&&(r=a(r)),e?r?e+": "+r:e:r};Error.prototype.toString=Se}if(A){var _e=function(t,e){if(K(t,e)){var r=Object.getOwnPropertyDescriptor(t,e);r.configurable&&(r.enumerable=!1,Object.defineProperty(t,e,r))}};_e(Error.prototype,"message"),""!==Error.prototype.message&&(Error.prototype.message=""),_e(Error.prototype,"name")}if("/a/gim"!==String(/a/gim)){var Me=function t(){var e="/"+this.source+"/";return this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),e};RegExp.prototype.toString=Me}}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.returnExports=e()}(this,function(){var t=Function.call,e=Object.prototype,r=t.bind(e.hasOwnProperty),n=t.bind(e.propertyIsEnumerable),o=t.bind(e.toString),i,a,c,u,l=r(e,"__defineGetter__");l&&(i=t.bind(e.__defineGetter__),a=t.bind(e.__defineSetter__),c=t.bind(e.__lookupGetter__),u=t.bind(e.__lookupSetter__));var f=function t(e){return null==e||"object"!=typeof e&&"function"!=typeof e};Object.getPrototypeOf||(Object.getPrototypeOf=function t(r){var n=r.__proto__;return n||null===n?n:"[object Function]"===o(r.constructor)?r.constructor.prototype:r instanceof Object?e:null});var s=function t(e){try{return e.sentinel=0,0===Object.getOwnPropertyDescriptor(e,"sentinel").value}catch(t){return!1}};if(Object.defineProperty){var p=s({});if(!("undefined"==typeof document||s(document.createElement("div")))||!p)var h=Object.getOwnPropertyDescriptor}if(!Object.getOwnPropertyDescriptor||h){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function t(o,i){if(f(o))throw new TypeError(y+o);if(h)try{return h.call(Object,o,i)}catch(t){}var a;if(!r(o,i))return a;if(a={enumerable:n(o,i),configurable:!0},l){var s=o.__proto__,p=o!==e;p&&(o.__proto__=e);var d=c(o,i),b=u(o,i);if(p&&(o.__proto__=s),d||b)return d&&(a.get=d),b&&(a.set=b),a}return a.value=o[i],a.writable=!0,a}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function t(e){return Object.keys(e)}),!Object.create){var d,b=!({__proto__:null}instanceof Object),v=function t(){if(!document.domain)return!1;try{return!!new ActiveXObject("htmlfile")}catch(t){return!1}},g=function t(){var e,r,n="script";return(r=new ActiveXObject("htmlfile")).write("'; -} diff --git a/packages/socket-stream-client/browser.js b/packages/socket-stream-client/browser.js index 237a928804..db75e4ddec 100644 --- a/packages/socket-stream-client/browser.js +++ b/packages/socket-stream-client/browser.js @@ -2,9 +2,14 @@ import { toSockjsUrl, toWebsocketUrl, } from "./urls.js"; -import "./sockjs-0.3.4.js"; + import { StreamClientCommon } from "./common.js"; +// Statically importing SockJS here will prevent native WebSocket usage +// below (in favor of SockJS), but will ensure maximum compatibility for +// clients stuck in unusual networking environments. +import "./sockjs-0.3.4.js"; + export class ClientStream extends StreamClientCommon { // @param url {String} URL to Meteor app // "http://subdomain.meteor.com/" or "/" or @@ -184,11 +189,16 @@ export class ClientStream extends StreamClientCommon { }; this.socket.onclose = () => { - if (this.lastError) { - this._lostConnection(this.lastError); - } else { + Promise.resolve( + // If the socket is closing because there was an error, and we + // didn't load SockJS before, try loading it dynamically before + // retrying the connection. + this.lastError && + ! hasSockJS && + import("./sockjs-0.3.4.js") + ).done(() => { this._lostConnection(); - } + }); }; this.socket.onerror = error => { diff --git a/packages/socket-stream-client/package.js b/packages/socket-stream-client/package.js index 543a7950a0..dd9e4a73b4 100644 --- a/packages/socket-stream-client/package.js +++ b/packages/socket-stream-client/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "socket-stream-client", - version: "0.1.0", + version: "0.2.2", summary: "Provides the ClientStream abstraction used by ddp-client", documentation: "README.md" }); @@ -12,8 +12,14 @@ Npm.depends({ Package.onUse(function(api) { api.use("ecmascript"); + api.use("modern-browsers"); api.use("retry"); // TODO Try to remove this. + api.use("dynamic-import"); + + api.addFiles("sockjs-0.3.4.js", "legacy"); api.mainModule("browser.js", "client", { lazy: true }); + + api.addFiles("server.js", "server"); api.mainModule("node.js", "server", { lazy: true }); }); diff --git a/packages/socket-stream-client/server.js b/packages/socket-stream-client/server.js new file mode 100644 index 0000000000..aa28e7d750 --- /dev/null +++ b/packages/socket-stream-client/server.js @@ -0,0 +1,14 @@ +import { + setMinimumBrowserVersions, +} from "meteor/modern-browsers"; + +setMinimumBrowserVersions({ + chrome: 16, + edge: 12, + firefox: 11, + ie: 10, + mobileSafari: [6, 1], + phantomjs: 2, + safari: 7, + electron: [0, 20], +}, module.id); diff --git a/packages/webapp/legacy_test_asset.js b/packages/webapp/legacy_test_asset.js new file mode 100644 index 0000000000..e889f09131 --- /dev/null +++ b/packages/webapp/legacy_test_asset.js @@ -0,0 +1 @@ +console.log("LEGACY"); diff --git a/packages/webapp/modern_test_asset.js b/packages/webapp/modern_test_asset.js new file mode 100644 index 0000000000..c30017283a --- /dev/null +++ b/packages/webapp/modern_test_asset.js @@ -0,0 +1 @@ +console.log("MODERN"); diff --git a/packages/webapp/package.js b/packages/webapp/package.js index 381e71ec8a..c65234f9e7 100644 --- a/packages/webapp/package.js +++ b/packages/webapp/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Serves a Meteor app over HTTP", - version: '1.5.0' + version: '1.6.1' }); Npm.depends({"basic-auth-connect": "1.0.0", @@ -27,8 +27,14 @@ Cordova.depends({ Package.onUse(function (api) { api.use('ecmascript'); - api.use(['logging', 'underscore', 'routepolicy', 'boilerplate-generator', - 'webapp-hashing'], 'server'); + api.use([ + 'logging', + 'underscore', + 'routepolicy', + 'modern-browsers', + 'boilerplate-generator', + 'webapp-hashing' + ], 'server'); // At response serving time, webapp uses browser-policy if it is loaded. If // browser-policy is loaded, then it must be loaded after webapp @@ -51,4 +57,7 @@ Package.onTest(function (api) { api.addFiles('webapp_tests.js', 'server'); api.addFiles('webapp_client_tests.js', 'client'); api.addFiles('socket_file_tests.js', 'server'); + + api.addAssets('modern_test_asset.js', 'web.browser'); + api.addAssets('legacy_test_asset.js', 'legacy'); }); diff --git a/packages/webapp/webapp_server.js b/packages/webapp/webapp_server.js index 7a1d3b3d5f..870b31c96b 100644 --- a/packages/webapp/webapp_server.js +++ b/packages/webapp/webapp_server.js @@ -14,6 +14,7 @@ import query from "qs-middleware"; import parseRequest from "parseurl"; import basicAuth from "basic-auth-connect"; import { lookup as lookupUserAgent } from "useragent"; +import { isModern } from "meteor/modern-browsers"; import send from "send"; import { removeExistingSocketFile, @@ -26,6 +27,8 @@ var LONG_SOCKET_TIMEOUT = 120*1000; export const WebApp = {}; export const WebAppInternals = {}; +const hasOwn = Object.prototype.hasOwnProperty; + // backwards compat to 2.0 of connect connect.basicAuth = basicAuth; @@ -36,7 +39,9 @@ WebAppInternals.NpmModules = { } }; -WebApp.defaultArch = 'web.browser'; +// Though we might prefer to use web.browser (modern) as the default +// architecture, safety requires a more compatible defaultArch. +WebApp.defaultArch = 'web.browser.legacy'; // XXX maps archs to manifests WebApp.clientPrograms = {}; @@ -321,38 +326,39 @@ WebAppInternals.generateBoilerplateInstance = function (arch, _.clone(__meteor_runtime_config__), additionalOptions.runtimeConfigOverrides || {} ); - return new Boilerplate(arch, manifest, - _.extend({ - pathMapper: function (itemPath) { - return pathJoin(archPath[arch], itemPath); }, - baseDataExtension: { - additionalStaticJs: _.map( - additionalStaticJs || [], - function (contents, pathname) { - return { - pathname: pathname, - contents: contents - }; - } - ), - // Convert to a JSON string, then get rid of most weird characters, then - // wrap in double quotes. (The outermost JSON.stringify really ought to - // just be "wrap in double quotes" but we use it to be safe.) This might - // end up inside a ", but normal {{spacebars}} escaping escapes too much! See - // https://github.com/meteor/meteor/issues/3730 - meteorRuntimeConfig: JSON.stringify( - encodeURIComponent(JSON.stringify(runtimeConfig))), - rootUrlPathPrefix: __meteor_runtime_config__.ROOT_URL_PATH_PREFIX || '', - bundledJsCssUrlRewriteHook: bundledJsCssUrlRewriteHook, - inlineScriptsAllowed: WebAppInternals.inlineScriptsAllowed(), - inline: additionalOptions.inline - } - }, additionalOptions) - ); + + return new Boilerplate(arch, manifest, _.extend({ + pathMapper(itemPath) { + return pathJoin(archPath[arch], itemPath); + }, + baseDataExtension: { + additionalStaticJs: _.map( + additionalStaticJs || [], + function (contents, pathname) { + return { + pathname: pathname, + contents: contents + }; + } + ), + // Convert to a JSON string, then get rid of most weird characters, then + // wrap in double quotes. (The outermost JSON.stringify really ought to + // just be "wrap in double quotes" but we use it to be safe.) This might + // end up inside a ", but normal {{spacebars}} escaping escapes too much! See + // https://github.com/meteor/meteor/issues/3730 + meteorRuntimeConfig: JSON.stringify( + encodeURIComponent(JSON.stringify(runtimeConfig))), + rootUrlPathPrefix: __meteor_runtime_config__.ROOT_URL_PATH_PREFIX || '', + bundledJsCssUrlRewriteHook: bundledJsCssUrlRewriteHook, + inlineScriptsAllowed: WebAppInternals.inlineScriptsAllowed(), + inline: additionalOptions.inline + } + }, additionalOptions)); }; -// A mapping from url path to "info". Where "info" has the following fields: +// A mapping from url path to architecture (e.g. "web.browser") to static +// file information with the following fields: // - type: the type of file to be served // - cacheable: optionally, whether the file should be cached or not // - sourceMapUrl: optionally, the url of the source map @@ -361,11 +367,11 @@ WebAppInternals.generateBoilerplateInstance = function (arch, // - content: the stringified content that should be served at this path // - absolutePath: the absolute path on disk to the file -var staticFiles; +var staticFilesByArch; // Serve static files from the manifest or added with // `addStaticJs`. Exported for tests. -WebAppInternals.staticFilesMiddleware = function (staticFiles, req, res, next) { +WebAppInternals.staticFilesMiddleware = function (staticFilesByArch, req, res, next) { if ('GET' != req.method && 'HEAD' != req.method && 'OPTIONS' != req.method) { next(); return; @@ -397,7 +403,12 @@ WebAppInternals.staticFilesMiddleware = function (staticFiles, req, res, next) { return; } - if (!_.has(staticFiles, pathname)) { + const info = getStaticFileInfo( + pathname, + identifyBrowser(req.headers["user-agent"]), + ); + + if (! info) { next(); return; } @@ -406,14 +417,20 @@ WebAppInternals.staticFilesMiddleware = function (staticFiles, req, res, next) { // 'send' and yield to the event loop, we never call another handler with // 'next'. - var info = staticFiles[pathname]; - // Cacheable files are files that should never change. Typically // named by their hash (eg meteor bundled js and css files). // We cache them ~forever (1yr). - var maxAge = info.cacheable - ? 1000 * 60 * 60 * 24 * 365 - : 0; + const maxAge = info.cacheable + ? 1000 * 60 * 60 * 24 * 365 + : 0; + + if (info.cacheable) { + // Since we use req.headers["user-agent"] to determine whether the + // client should receive modern or legacy resources, tell the client + // to invalidate cached resources when/if its user agent string + // changes in the future. + res.setHeader("Vary", "User-Agent"); + } // Set the X-SourceMap header, which current Chrome, FireFox, and Safari // understand. (The SourceMap header is slightly more spec-correct but FF @@ -445,32 +462,87 @@ WebAppInternals.staticFilesMiddleware = function (staticFiles, req, res, next) { res.end(); } else { send(req, info.absolutePath, { - maxage: maxAge, - dotfiles: 'allow', // if we specified a dotfile in the manifest, serve it - lastModified: false // don't set last-modified based on the file date - }).on('error', function (err) { - Log.error("Error serving static file " + err); - res.writeHead(500); - res.end(); - }) - .on('directory', function () { - Log.error("Unexpected directory " + info.absolutePath); - res.writeHead(500); - res.end(); - }) - .pipe(res); + maxage: maxAge, + dotfiles: 'allow', // if we specified a dotfile in the manifest, serve it + lastModified: false // don't set last-modified based on the file date + }).on('error', function (err) { + Log.error("Error serving static file " + err); + res.writeHead(500); + res.end(); + }).on('directory', function () { + Log.error("Unexpected directory " + info.absolutePath); + res.writeHead(500); + res.end(); + }).pipe(res); } }; -var getUrlPrefixForArch = function (arch) { - // XXX we rely on the fact that arch names don't contain slashes - // in that case we would need to uri escape it +function getStaticFileInfo(originalPath, browser) { + const { arch, path } = getArchAndPath(originalPath, browser); - // We add '__' to the beginning of non-standard archs to "scope" the url - // to Meteor internals. - return arch === WebApp.defaultArch ? - '' : '/' + '__' + arch.replace(/^web\./, ''); -}; + if (! hasOwn.call(WebApp.clientPrograms, arch)) { + return null; + } + + // Get a list of all available static file architectures, with arch + // first in the list if it exists. + const staticArchList = Object.keys(staticFilesByArch); + const archIndex = staticArchList.indexOf(arch); + if (archIndex > 0) { + staticArchList.unshift(staticArchList.splice(archIndex, 1)[0]); + } + + let info = null; + + staticArchList.some(arch => { + const staticFiles = staticFilesByArch[arch]; + + // If staticFiles contains originalPath with the arch inferred above, + // use that information. + if (hasOwn.call(staticFiles, originalPath)) { + return info = staticFiles[originalPath]; + } + + // If getArchAndPath returned an alternate path, try that instead. + if (path !== originalPath && + hasOwn.call(staticFiles, path)) { + return info = staticFiles[path]; + } + }); + + return info; +} + +function getArchAndPath(path, browser) { + const pathParts = path.split("/"); + const archKey = pathParts[1]; + + if (archKey.startsWith("__")) { + const archCleaned = "web." + archKey.slice(2); + if (hasOwn.call(WebApp.clientPrograms, archCleaned)) { + pathParts.splice(1, 1); // Remove the archKey part. + return { + arch: archCleaned, + path: pathParts.join("/"), + }; + } + } + + // TODO Perhaps one day we could infer Cordova clients here, so that we + // wouldn't have to use prefixed "/__cordova/..." URLs. + const arch = isModern(browser) + ? "web.browser" + : "web.browser.legacy"; + + if (hasOwn.call(WebApp.clientPrograms, arch)) { + return { arch, path }; + } + + return { + arch: WebApp.defaultArch, + path, + }; +} // Parse the passed in port value. Return the port as-is if it's a String // (e.g. a Windows Server style named pipe), otherwise return the port as an @@ -496,8 +568,16 @@ function runWebAppServer() { WebAppInternals.reloadClientPrograms = function () { syncQueue.runTask(function() { - staticFiles = {}; - var generateClientProgram = function (clientPath, arch) { + staticFilesByArch = Object.create(null); + + function generateClientProgram(clientPath, arch) { + function addStaticFile(path, item) { + if (! hasOwn.call(staticFilesByArch, arch)) { + staticFilesByArch[arch] = Object.create(null); + } + staticFilesByArch[arch][path] = item; + } + // read the control for the client we'll be serving up var clientJsonPath = pathJoin(__meteor_bootstrap__.serverDir, clientPath); @@ -510,27 +590,25 @@ function runWebAppServer() { if (! clientJsonPath || ! clientDir || ! clientJson) throw new Error("Client config file not parsed."); - var urlPrefix = getUrlPrefixForArch(arch); - var manifest = clientJson.manifest; _.each(manifest, function (item) { if (item.url && item.where === "client") { - staticFiles[urlPrefix + getItemPathname(item.url)] = { + addStaticFile(getItemPathname(item.url), { absolutePath: pathJoin(clientDir, item.path), cacheable: item.cacheable, hash: item.hash, // Link from source to its map sourceMapUrl: item.sourceMapUrl, type: item.type - }; + }); if (item.sourceMap) { // Serve the source map too, under the specified URL. We assume all // source maps are cacheable. - staticFiles[urlPrefix + getItemPathname(item.sourceMapUrl)] = { + addStaticFile(getItemPathname(item.sourceMapUrl), { absolutePath: pathJoin(clientDir, item.sourceMap), cacheable: true - }; + }); } } }); @@ -556,13 +634,13 @@ function runWebAppServer() { const manifestUrl = manifestUrlPrefix + getItemPathname("/manifest.json"); - staticFiles[manifestUrl] = { + addStaticFile(manifestUrl, { content: JSON.stringify(program), cacheable: false, hash: program.version, type: "json" - }; - }; + }); + } try { var clientPaths = __meteor_bootstrap__.configJson.clientPaths; @@ -572,7 +650,7 @@ function runWebAppServer() { }); // Exported for tests. - WebAppInternals.staticFiles = staticFiles; + WebAppInternals.staticFilesByArch = staticFilesByArch; } catch (e) { Log.error("Error reloading the client program: " + e.stack); process.exit(1); @@ -603,28 +681,41 @@ function runWebAppServer() { ROOT_URL: process.env.MOBILE_ROOT_URL || Meteor.absoluteUrl() } - } + }, + + "web.browser": { + runtimeConfigOverrides: { + isModern: true, + } + }, + + "web.browser.legacy": { + runtimeConfigOverrides: { + isModern: false, + } + }, }; syncQueue.runTask(function() { + const allCss = []; + _.each(WebApp.clientPrograms, function (program, archName) { boilerplateByArch[archName] = WebAppInternals.generateBoilerplateInstance( - archName, program.manifest, - defaultOptionsForArch[archName]); + archName, + program.manifest, + defaultOptionsForArch[archName], + ); + + const cssFiles = boilerplateByArch[archName].baseData.css; + cssFiles.forEach(file => allCss.push({ + url: bundledJsCssUrlRewriteHook(file.url), + })); }); // Clear the memoized boilerplate cache. memoizedBoilerplate = {}; - // Configure CSS injection for the default arch - // XXX implement the CSS injection for all archs? - var cssFiles = boilerplateByArch[WebApp.defaultArch].baseData.css; - // Rewrite all CSS files (which are written directly to