[
  {
    "path": ".gitignore",
    "content": ".DS_Store\n.idea\n.vscode\nbuild\nnode_modules\nnpm-debug.log\ntemp\ntmp-*\n.esm-cache/\ndist\nlerna-debug.log\n*.d.ts\n\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\nnode_js: stable\nos: linux\nsudo: required\n\ninstall:\n  - npm run bootstrap\nscript:\n  - npm run build\n  - npm run test:ci\n  - npm run e2e\n\ngit:\n  depth: 5\n\ncache:\n  directories:\n    - node_modules\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to Guess.js\n\nPlease contribute to this repository if any of the following is true:\n\n- You are interested in improving the Guess.js source, docs or one of our related projects\n- You have expertise in community development, communication, or education\n- You want open source communities to be more collaborative and inclusive\n- You want to help lower the burden to first time contributors\n\n# How to contribute to our source code\n\nPrerequisites:\n\n- familiarity with [GitHub PRs](https://help.github.com/articles/using-pull-requests) (pull requests) and issues\n- knowledge of JavaScript and some [TypeScript](https://www.typescriptlang.org/)\n\n## Submitting a Pull Request\n\nAll submissions, including submissions by project members, require review. We use Github pull requests for this purpose. See our [developer guide](DEVELOPING.md) for instructions on building the project.\n\nPull requests (fixes, new features, tests) are a great way to contribute to\nthe project and help us make it better. Ideally, try to keep your PRs as\nfocused as possible and keep your commits atomic and readable.\n\nTo avoid disappointment when working on a PR, please ask us first in case\nsomeone else is already working on a PR for a change you wished to make. It's always a good idea to file an issue before starting work on a PR unless\nit's for something minor (such as a typo fix).\n\nWe greatly appreciate any attention to tests. These help us validate that\nnew work continues to function as expected over time.\n\n# How to contribute to our README or docs\n\nPrerequisites:\n\n- familiarity with [GitHub PRs](https://help.github.com/articles/using-pull-requests) (pull requests) and issues\n- knowledge of Markdown for editing `.md` documents\n\nIn particular, this community seeks the following types of contributions:\n\n- ideas: participate in an Issues thread or start your own to have your voice\nheard\n- resources: submit a PR to add to our README with links to related content\n- outline sections: help us ensure that this repository is comprehensive. If\nthere is a topic that is overlooked, please add it, even if it is just a stub\nin the form of a header and single sentence. Initially, most things fall into\nthis category\n- write: contribute your expertise in an area by helping us expand the included\ncontent\n- copy editing: fix typos, clarify language, and generally improve the quality\nof the content\n- formatting: help keep content easy to read with consistent formatting\n- code: Fix issues or contribute new features to this or any related projects\n\nThis contribution guide was inspired by others including contributing to\nGoogle open-source, React, Gulp and Babel."
  },
  {
    "path": "DEVELOPING.md",
    "content": "# Developer's Guide\n\nThis document explains how to build, test, and publish the packages from the monorepo.\n\n## Installation\n\nIn order to install all the dependencies run:\n\n```bash\nnpm run bootstrap\n```\n\nThis will download all development dependencies for the monorepo and download the dependencies for each individual package. It will also call `lerna bootstrap` which will create symlinks for the cross-package dependencies.\n\n## Build\n\nIn order to build the packages run:\n\n```bash\nnpm run build\n```\n\nThe command will build all the packages, topologically sorted.\n\n## Publish\n\nTo publish the packages, run:\n\n```bash\nnpm run publish\n```\n\nThe `publish` script will delegate the execution to `lerna publish` which will take care of updating the dependencies' versions and publishing them to npm.\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018 Minko Gechev <mgechev@gmail.com> and the Guess \ncontributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
  },
  {
    "path": "README.md",
    "content": "[![Build Status](https://travis-ci.com/guess-js/guess.svg?branch=master)](https://travis-ci.com/guess-js/guess)\n\n# Guess.js (alpha)\n\nLibraries and tools for enabling data-driven user-experiences on the web.\n\n## Quickstart\n\n***For Webpack users:***\n### :black_circle: Data-driven bundling\n\nInstall and configure [GuessPlugin](https://github.com/guess-js/guess/tree/master/packages/guess-webpack) - the Guess.js webpack plugin which automates as much of the setup process for you as possible. \n\nShould you wish to try out the modules we offer individually, the `packages` directory contains three packages:\n\n* [`ga`](https://github.com/guess-js/guess/tree/master/packages/guess-ga) - a module for fetching structured data from the Google Analytics API to learn about user navigation patterns. \n* [`parser`](https://github.com/guess-js/guess/tree/master/packages/guess-parser) - a module providing JavaScript framework parsing. This powers the route-parsing capabilities implemented in the Guess webpack plugin.\n* [`webpack`](https://github.com/guess-js/guess/tree/master/packages/guess-webpack) - a webpack plugin for setting up predictive fetching in your application. It consumes the `ga` and `parser` modules and offers a large number of options for configuring how predictive fetching should work in your application. \n\n***For non-Webpack users:***\n### :black_circle: Data-driven loading\n\nOur [predictive-fetching for sites](https://github.com/guess-js/guess/tree/master/experiments/guess-static-sites) workflow provides a set of steps you can follow to integrate predictive fetching using the Google Analytics API to your site. \n\nThis repo uses [Google Analytics](http://analytics.google.com) data to determine which page a user is mostly likely to visit next from a given page. A client-side script (which you'll add to your application) sends a request to the server to get the URL of the page it should fetch, then prefetches this resource.\n\n## Learn More\n### What is Guess.js?\n\nGuess.js provides libraries & tools to simplify predictive data-analytics driven approaches to improving user-experiences on the web. This data can be driven from any number of sources, including analytics or [machine learning](https://en.wikipedia.org/wiki/Machine_learning?sa=D&ust=1522637949792000) models. Guess.js aims to lower the friction of consuming and applying this thinking to all modern sites and apps, including building libraries & tools for popular workflows.\n\nApplying predictive data-analytics thinking to sites could be applied in a number of contexts:\n\n* **Predict the next page (or pages) a user is likely to visit and prefetch these pages, improving perceived page load performance and user happiness.**\n  * Page-level: Prerender/Prefetch the page which is most likely to be visited next\n  * Bundle-level: Prefetch the bundles associated with the top _N_ pages. On each page navigation, at all the neighbors of the current page, sorted in descending order by the probability to be visited. Fetch assets (JavaScript chunks) for the top N pages, depending on the current connection effective type.\n* **Predict the next piece of content (article, product, video) a user is likely to want to view and adjust or filter the user experience to account for this.**\n* **Predict the types of widgets an individual user is likely to interact with more (e.g games) and use this data to tailor a more custom experience.**\n\nBy collaborating across different touch-points in the ecosystem where data-driven approaches could be easily applied, we hope to generalize common pieces of infrastructure to maximize their applicability in different tech stacks.\n\n\n### Problems we're looking to solve\n\n\n\n* Developers using [`<link rel=prefetch>`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefetching_FAQ?sa=D&ust=1522637949794000) for future navigations heavily rely on manually reading descriptive analytics to inform their decisions for what to prefetch.\n* These decisions are often made at a point in time and..\n  * (1) are often not revisited as data trends change\n  * (2) are very limited in how they are used. Implementations will often only prefetch content from a homepage or very small set of hero pages, but otherwise not do this for all of the possible entry points on a site. This can leave performance opportunities on the table.\n  * (3) Require some amount of confidence about the data being used to drive decisions around using prefetching means that developers may not be adopting it out of worry they will waste bandwidth. `<link rel=prefetch>` is [currently used on 5%](https://www.chromestatus.com/metrics/feature/timeline/popularity/917) of total Chrome pageloads, but this could be higher.\n* Implementing predictive analytics is too complex for the average web developer.\n  * Most developers are unfamiliar with how to leverage the [Google Analytics API](https://developers.google.com/analytics/devguides/reporting/core/v4/?sa=D&ust=1522637949796000) to determine the probability a page will be visited next. We lack:\n  * (1) Page-level solution: a drop-in client-side solution for prefetching pages a user will likely visit\n  * (2) Bundling-level solution: a set of plugins/tools that work with today’s JavaScript bundlers (e.g webpack) to cluster and generate the bundles/chunks a particular set of navigation paths could load quicker were they to be prefetched ahead of time.\n* Most developers are not yet familiar with how [Machine Learning](https://en.wikipedia.org/wiki/Machine_learning?sa=D&ust=1522637949797000) works. They are generally:\n  * (1) Unsure how (and why) ML could be integrated into their existing (web) tech stacks\n  * (2) What the value proposition of [TensorFlow](https://www.tensorflow.org/?sa=D&ust=1522637949797000) is or where solutions like the [CloudML](https://cloud.google.com/ml-engine/?sa=D&ust=1522637949798000) engine fit in. We have an opportunity to simplify the overhead associated with leveraging some of these solutions.\n* Best-in-class / low-friction approaches in this space are still slowly emerging and are not yet as accessible to web developers without ML or data-science backgrounds.\n  * [Machine Learning meets Cloud: Intelligent Prefetching](https://iihnordic.com/blog/machine-learning-meets-the-cloud-intelligent-prefetching/?sa=D&ust=1522637949798000) by IIH Nordic\n    * Tag Managers like [Google Tag Manager](https://www.google.com/analytics/tag-manager/?sa=D&ust=1522637949799000) can be used to decouple page content from the code tracking how the content is used. This allows web analysts to upgrade the tracking code in real-time with no site downtime. Tag managers allow a general solution for code injection and can be used to deploy intelligent prefetching. The advantages: analytics used to build the model comes from the tag manager. We can also send data live to the predictor without additional tracker overhead. After adding a few (of IIH Nordic’s) tags to a GTM install, a site can start to prefetch resources of the next pages and track load time saving opportunities.\n    * IIH Nordic moved the predictive prefetching model to a web service the browser queries when a user visits a new page. The service responds to each request and takes advantage of Google Cloud, App Engine and [Cloud ML](https://cloud.google.com/ml-engine/?sa=D&ust=1522637949799000). Their solution chooses the most accurate model, choices include a [Markov model](https://en.wikipedia.org/wiki/Markov_model?sa=D&ust=1522637949800000) or most often a deep neural net in [TensorFlow](https://www.tensorflow.org/?sa=D&ust=1522637949800000).\n    * With user behavior changing over time, predictive models require updating (training) from time to time. Training a model involves collecting and transforming data and fitting the parameters of the model accordingly. IIH Nordic use Google Cloud to pull data from a customer’s analytics service into a private data bucket in [BigQuery](https://cloud.google.com/bigquery/?sa=D&ust=1522637949800000). They process this data, train and test predictive models, updating the prediction service seamlessly.\n    * IIH Nordic suggest small/slow sites update their models monthly. Larger sites may need to retrain daily or even hourly for news websites.\n    * The benefit of training ML models in the cloud is ease of scale as additional machines, GPUs and processors can be added as needed.\n    * [Machine Learning-Driven Bundling. The Future of JavaScript Tooling](http://blog.mgechev.com/2018/03/18/machine-learning-data-driven-bundling-webpack-javascript-markov-chain-angular-react/?sa=D&ust=1522637949801000) by Minko\n\n#### Initial priority: Improved Performance through Data-driven Prefetching\n\nThe first large priority for Guess.js will be improving web performance through predictive prefetching of content.\n\nBy building a model of pages a user is likely to visit, given an arbitrary entry-page, a solution could calculate the likelihood a user will visit a given next page or set of pages and prefetch resources for them while the user is still viewing their current page. This has the possibility of improving page-load performance for subsequent page visits as there's a strong chance a page will already be in the user's cache.\n\n### Possible approaches to predictive fetching\n\nIn order to predict the next page a user is likely to visit, solutions could use the [Google Analytics API](https://developers.google.com/analytics/devguides/reporting/core/v4/?sa=D&ust=1522637949828000). Google Analytics session data can be used to create a model to predict the most likely page a user is going to visit next on a site. The benefit of this session data is that it can evolve over time, so that if particular navigation paths change, the predictions can stay up to date too.\n\nWith the availability of this data, an engine could insert `<link rel=\"[prerender/prefetch/preload]\">` tags to speed up the load time for the next page request. In some tests, such as Mark Edmondson's [Supercharging Page-Loads with R](http://code.markedmondson.me/predictClickOpenCPU/supercharge.html?sa=D&ust=1522637949828000), this led to a 30% improvement in page load times. The approach Mark used in his research involved using GTM tags and machine-learning to train a model for page predictions. This is an idea Mark continued in [Machine Learning meets the Cloud - Intelligent Prefetching](https://iihnordic.com/blog/machine-learning-meets-the-cloud-intelligent-prefetching/?sa=D&ust=1522637949828000).\n\nWhile this approach is sound, the methodology used could be deemed a little complex. Another approach that could be taken (which is simpler) is attempting to get accurate prediction data from the Google Analytics API. If you ran a report for the [Page](https://developers.google.com/analytics/devguides/reporting/core/dimsmets%23view%3Ddetail%26group%3Dpage_tracking%26jump%3Dga_pagepath?sa=D&ust=1522637949829000) and [Previous Page Path](https://developers.google.com/analytics/devguides/reporting/core/dimsmets%23view%3Ddetail%26group%3Dpage_tracking%26jump%3Dga_previouspagepath?sa=D&ust=1522637949829000) dimension combined with the [Pageviews](https://developers.google.com/analytics/devguides/reporting/core/dimsmets%23view%3Ddetail%26group%3Dpage_tracking%26jump%3Dga_pageviews?sa=D&ust=1522637949830000) and [Exits](https://developers.google.com/analytics/devguides/reporting/core/dimsmets%23view%3Ddetail%26group%3Dpage_tracking%26jump%3Dga_exits?sa=D&ust=1522637949830000) metrics this should provide enough data to wire up prefetches for most popular pages.\n\n#### Machine Learning for predictive fetching\n\nML could help improve the overall accuracy of a solution's predictions, but is not a necessity for an initial implementation. Predictive fetching could be accomplished by training a model on the pages users are likely to visit and improving on this model over time.\n\nDeep neural networks are particularly good at teasing out the complexities that may lead to a user choosing one page over another, in particular, if we wanted to attempt a version of the solution that was catered to the pages an individual user might visit vs. the pages a \"general/median\" user might visit next. Fixed page sequences (prev, current, next) might be the easiest to begin dealing with initially. This means building a model that is unique to your set of documents.\n\nModel updates tend to be done periodically, so one might setup a nightly/weekly job to refresh based on new user behaviour. This could be done in real-time, but is likely complex, so doing it periodically might be sufficient. One could imagine a generic model representing behavioural patterns for users on a site that can either be driven by a trained status set, Google Analytics, or a custom description you plugin using a new layer into a router giving the site the ability to predictively fetch future pages, improving page load performance.\n\n### Possible approaches to speculative prefetch\n\n#### Speculative prefetch on page load\n\nSpeculative prefetch can prefetch pages likely be navigated to on page load. This assumes the existence of knowledge about the probability a page will need a certain next page or set of pages, or a training model that can provide a data-driven approach to determining such probabilities.\n\nPrefetching on page load can be accomplished in a number of ways, from deferring to the UA to decide when to prefetch resources (e.g at low priority with `<link rel=prefetch>`), during page idle time (via [requestIdleCallback()](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback?sa=D&ust=1522637949834000)()) or at some other interval. No further interaction is required by the user.\n\n#### Speculative prefetch when links come into the viewport\n\nA page could speculatively begin prefetching content when links in the page are visible in the viewport, signifying that the user may have a higher chance of wanting to click on them.\n\nThis is an approach used by [Gatsby](https://www.gatsbyjs.org/?sa=D&ust=1522637949834000) (which uses [React](https://reactjs.org/?sa=D&ust=1522637949835000) and [React Router](https://github.com/ReactTraining/react-router?sa=D&ust=1522637949835000)). Their specific implementation is as follows:\n\n* In browsers that support [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API?sa=D&ust=1522637949836000), whenever a `<Link>` component becomes invisible, the link \"votes\" for the page linked to to be prefetched votes are worth slightly less points each time so links at the top of the page are prioritized over ones lower down\n* e.g. the top nav if a page is linked to multiple times, its vote count goes higher the prefetcher takes the top page and starts prefetching resources.\n* It's restricted to prefetching one page at a time so as to reduce contention over bandwidth with on page stuff (not a problem on fast networks. If a user visits a page and its resources haven't been fully downloaded, prefetching stops until the page is loaded to ensure the user waits as little time as possible.\n\n#### Speculative prefetch on user interaction\n\nA page could begin speculatively prefetching resources when a user indicates they are interested in some content. This can take many forms, including when a user chooses to hover over a link or some portion of UI that would navigate them to a separate page. The browser could begin fetching content for the link as soon as there was a clear indication of interest. This is an approach taken by JavaScript libraries such as [InstantClick](http://instantclick.io/?sa=D&ust=1522637949837000).\n\n### Risks\n\n#### Data consumption\n\nAs with any mechanism for prefetching content ahead of time, this needs to be approached very carefully. A user on a restricted data-plan may not appreciate or benefit as much from pages being fetched ahead of time, in particular if they start to eat up their data. There are mechanisms a site/solution could take to be mindful of this concern, such as respecting the [Save-Data](https://developers.google.com/web/updates/2016/02/save-data?sa=D&ust=1522637949832000) header.\n\n#### Prefetching undesirable pages\n\nPrefetching links to \"logout\" pages is likely undesirable. The same could be said of any pages that trigger an action on page-load (e.g one-click purchase). Solutions may wish to include a blacklist of URLs which are never prefetched to increase the likelihood of a prefetched page being useful.\n\n#### Web Standards\n\n##### Future of rel=prerender\n\nSome of the attempts to accomplish similar proposals in the past have relied on `<link rel=prerender>`. The Chrome team is currently exploring [deprecating rel=prerender](https://groups.google.com/a/chromium.org/forum/%23!topic/blink-dev/0nSxuuv9bBw?sa=D&ust=1522637949833000) in favor of [NoStatePrefetch](https://docs.google.com/document/d/16VCYGGWau483IMSxODpg5faZny1FJ6vNK2v-BuM5EhU/edit%23?sa=D&ust=1522637949833000) - a lighter version of this mechanism that only prefetches to the HTTP cache but uses no other state of the web platform. A solution should factor in whether it will be relying on the replacement to rel=prerender or using prefetch/preload/other approaches.\n\nThere are two key differences between NoStatePrefetch and Prefetch: \n\n1. nostate-prefetch is a mechanism, and `<link rel=prefetch>` is an API. The nostate-prefetch can be requested by other entry points: omnibox prediction, custom tabs, `<link rel=prerender>`.\n\n2.  The implementation is different: `<link rel=prefetch>` prefetches one resource, but nostate-prefetch on top of that runs the preload scanner on the resource (in a fresh new renderer), discovers subresources and prefetches them as well (without recursing into preload scanner).\n\n\n\n### Relevant Data Analytics\n\nThere are [three primary types](https://halobi.com/blog/descriptive-predictive-and-prescriptive-analytics-explained/?sa=D&ust=1522637949802000) of data analytics worth being aware of in this problem space: descriptive, predictive and prescriptive. Each type is related and help teams leverage different kinds of insight.\n\n#### Descriptive - what has happened?\n\nDescriptive analytics summarizes raw data and turns it into something interpretable by humans. It can look at past events, regardless of when the events have occurred. Descriptive analytics allow teams to learn from past behaviors and this can help them influence future outcomes. Descriptive analytics could determine what pages on a site users have previously viewed and what navigation paths they have taken given any given entry page.\n\n#### Predictive - what will happen?\n\nPredictive analytics “predicts” what can happen next. Predictive analytics helps us understand the future and gives teams actionable insights using data. It provides estimates of the likelihood of a future outcome being useful. It’s important to keep in mind, few algorithms can predict future events with complete accuracy, but we can use as many signals that are available to us as possible to help improve baseline accuracy. The foundation of predictive analytics is based on probabilities we determine from data. Predictive analytics could predict the next page or set of pages a user is likely to visit given an arbitrary entry page.\n\n#### Prescriptive - what should we do?\n\nPrescriptive analytics enables prescribing different possible actions to guide towards a solution. Prescriptive analytics provides advice, attempting to quantify the impact future decisions may have to advise on possible outcomes before these decisions are made. Prescriptive analytics aims to not just predict what is going to happen but goes further; informing why it will happen and providing recommendations about actions that can take advantage of such predictions. Prescriptive analytics could predict the next page a user will visit, but also suggest actions such as informing you of ways you can customize their experience to take advantage of this knowledge.\n\n### Relevant Prediction Models\n\n#### Markov Models\n\nThe key objective of a prediction model in the prefetching problem space is to identify what the subsequent requests a user may need, given a specific page request. This allows a server or client to pre-fetch the next set of pages and attempt to ensure they are in a user’s cache before they directly navigate to the page. The idea is to reduce overall loading time. When this is implemented with care, this technique can reduce page access times and latency, improving the overall user experience.\n\n[Markov models](https://en.wikipedia.org/wiki/Markov_model?sa=D&ust=1522637949805000) have been widely used for researching and understanding stochastic (random probability distribution) process [[Ref](http://citeseerx.ist.psu.edu/viewdoc/download?doi%3D10.1.1.436.2396%26rep%3Drep1%26type%3Dpdf?sa=D&ust=1522637949806000), [Ref](https://www.researchgate.net/publication/266568034_Effective_Web_Cache_Pre-fetching_technique_using_Markov_Chain?sa=D&ust=1522637949806000)] . They have been demonstrated to be well-suited for modeling and predicting a user’s browsing behavior. The input for these problems tends to be the sequence of web pages accessed by a user or set of users (site-wide) with the goal of building Markov models we can use to model and predict the pages a user will most likely access next. A Markov process has states representing accessed pages and edges representing transition probabilities between states which are computed from a given sequence in an analytics log. A trained Markov model can be used to predict the next state given a set of k previous states.\n\nIn some applications, first-order Markov models aren’t as accurate in predicting user browsing behaviors as these do not always look into the past to make a distinction between different patterns that have been observed. This is one reason higher-order models are often used. These higher-order models have limitations with state-space complexity, less broad coverage and sometimes reduced prediction accuracy.\n\n#### All-Kth-Order Markov Model\n\nOne way [[Ref](http://www.siam.org/meetings/sdm01/pdf/sdm01_04.pdf?sa=D&ust=1522637949807000)] to overcome this problem is to train varying order Markov models, which we then use during the prediction phase. This was attempted in the [All-Kth-Order Markov model](http://www.siam.org/meetings/sdm01/pdf/sdm01_04.pdf?sa=D&ust=1522637949808000) proposed in this [Ref](https://dl.acm.org/citation.cfm?id%3D1251493?sa=D&ust=1522637949808000). This can make state-space complexity worse, however. Another approach is to identify frequent access patterns (longest repeating subsequences) and use this set of sequences for predictions. Although this approach can have an order of magnitude reduction on state-space complexity, it can reduce prediction accuracy.\n\n#### Selective Markov Models\n\n[Selective Markov models](http://www.siam.org/meetings/sdm01/pdf/sdm01_04.pdf?sa=D&ust=1522637949808000) (SMM) which only store some states within the model have also been proposed as a solution to state-space complexity tradeoffs. They begin with a All-Kth-Order Markov Model - a post-pruning approach is then used to prune states that are not expected to be accurate predictors. The result of this is a model which has the same prediction power of All-Kth-Order models with less space complexity and higher prediction accuracy. In [Deshpane and Karpis](http://www.siam.org/meetings/sdm01/pdf/sdm01_04.pdf?sa=D&ust=1522637949809000), different criteria to prune states in the model before prediction (frequency, confidence, error) are looked at.\n\n#### Semantic-pruned Selective Markov Models\n\nIn [Mabroukeh and Ezeife](http://ieeexplore.ieee.org/document/5360449/?reload%3Dtrue?sa=D&ust=1522637949809000), the performance of semantic-rich 1st and 2nd order Markov models was studied and compared with that of higher-order SMM and semantic-pruned SMM. They discovered that semantic-pruned SMM have a 16% smaller size than frequency-pruned SMM and provide nearly an equal accuracy.\n\n#### Clustering\n\nObserving navigation patterns can allow us to analyze user behavior. This approach requires access to user-session identification, clustering sessions into similar clusters and developing a model for prediction using current and earlier access patterns. Much of the previous work in this field has relied on clustering schemes like the [K-means clustering](https://en.wikipedia.org/wiki/K-means_clustering?sa=D&ust=1522637949810000) technique with [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance?sa=D&ust=1522637949810000) for improving confidence of predictions. One of the drawbacks to using K-means is difficulty deciding on the number of clusters, selecting the initial random center and the order of page visits is not always considered. [Kumar et al](http://ieeexplore.ieee.org/document/7519368/?sa=D&ust=1522637949811000) investigated this, proposing a hierarchical clustering technique with a modified [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance?sa=D&ust=1522637949811000), pagerank using access time length, frequency and higher order Markov models for prediction.\n\n### Research review\n\nMany of the papers referenced in the following section are centered around the Markov model, association rules and clustering. Papers highlighting relevant work related to pattern discovery for evolving page prediction accuracy are our focus.\n\n#### Sarukkai [2000] “[Link prediction and path analysis using Markov chains](https://www.sciencedirect.com/science/article/pii/S138912860000044X?sa=D&ust=1522637949813000)”.\n\nUses first-order Markov models to model the sequence of web-pages requested by a user for predicting the next page they are likely to access. Markov chains allow the system to dynamically model URL access patterns observed in navigation logs based on previous state. A “personalized” Markov model is trained for each user and used to predict a user’s future sessions. In practice, it’s overly expensive to construct a unique model for each user and the cost of scaling this becomes more challenging when a site has a large user-base.\n\n#### Chun-Jung Lin [2005] ”[Using Hidden Markov Model to Predict the Surfing User’s Intention of Cyber Purchase on the Web](https://www.researchgate.net/publication/260319657_Using_Hidden_Markov_Model_to_Predict_the_Surfing_User's_Intention_of_Cyber_Purchase_on_the_Web?sa=D&ust=1522637949814000)”\n\nFirst paper to investigate Hidden Markov Models (HMM). Author collected web server logs, pruned the data and patched the paths users passed by. Based on HMM, author constructed a specific model for web browsing that predicts whether the users have the intention to purchase in real-time. Related measures, like speeding up the operation and their impact when in a purchasing mode are investigated.\n\n#### Elli Voudigari [2010-2011] ” [A Framework for Web Page Rank Prediction](https://link.springer.com/chapter/10.1007/978-3-642-23960-1_29?sa=D&ust=1522637949814000)”.\n\nProposes a framework to predict ranking positions of a page based on their previous rankings. Assuming a set of successive Top-K rankings, the author identifies predictors based on different methodologies. Prediction quality is quantified as the similarity between predicted and actual rankings. Exhaustive experiments were performed on a real-world large scale dataset for both global and query-based top-K rankings. A variety of existing similarity measures for comparing Top-K ranked lists including a novel one captured in the paper.\n\n#### Mogul [1996] “ [Using predictive prefetching to improve World Wide Web latency](https://www.semanticscholar.org/paper/Using-predictive-prefetching-to-improve-World-Wide-Padmanabhan-Mogul/4d7e5e430bec3db4044b13ce8da7411f09c745f3?sa=D&ust=1522637949815000)”.\n\nProposes using N-hop Markov models to predict the next web page users are likely to access. Pattern matches the user’s current access sequence with the user’s historical web access sequences to improve the prediction accuracy for prefetches.\n\n#### Borges, Levene [2007] “[Evaluating Variable-Length Markov Chain Models for Analysis of User Web Navigation Sessions](http://ieeexplore.ieee.org/document/4118703/?sa=D&ust=1522637949816000)”.\n\nProposes dynamic clustering-based methods to increase Markov model accuracy in representing a collection of web navigation sessions. Uses a state cloning concept to duplicate states in a way separating in-links whose corresponding second-order probabilities diverge. The method proposed includes a clustering technique determining a way to assign in-links with similar second-order probabilities to the same clone.\n\n#### Banu Deniz Gunel [2010] ” [Investigating the Effect of Duration, Page Size and Frequency on Next Page Recommendation with Page Rank Algorithm](https://www.researchgate.net/publication/268366760_Investigating_the_Effect_of_Duration_Page_Size_and_Frequency_on_Next_Page_Recommendation_with_Page_Rank_Algorithm?sa=D&ust=1522637949817000)”.\n\nExtends the use of a page-rank algorithm with numerous navigational attributes: size of the page, duration time of the page, duration of transition (two page visits sequentially), frequency of page and transition. Defines a Duration Based Rank (DPR) and Popularity Based Page Rank (PPR). Author looked at the popularity of transitions and pages using duration information, using it with page size and visit frequency. Using the popularity value of pages, this paper attempts to improve conventional page rank algorithms and model a next page prediction under a given Top-N value.\n\n## References\n\n* [Supercharging page-loads with R](http://code.markedmondson.me/predictClickOpenCPU/supercharge.html?sa=D&ust=1522637949840000)\n* [Using Google Analytics to predict clicks](https://www.noisetosignal.io/2016/11/using-google-analytics-to-predict-clicks-and-speed-up-your-website/?sa=D&ust=1522637949841000)\n* [Gatsby's Link](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-link?sa=D&ust=1522637949841000)\n* [Eve Dynamic Prerender](https://wordpress.org/plugins/eve-dynamic-prerender/?sa=D&ust=1522637949841000)\n* [InstartLogic - Multi-page Predictive Prefetching](https://www.instartlogic.com/blog/predicting-future-multi-page-predictive-prefetching?sa=D&ust=1522637949841000)\n* [Sirko Engine](https://github.com/sirko-io/engine?sa=D&ust=1522637949842000) - relies on Service Worker\n\n<h2>Team</h2>\n\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\" valign=\"top\">\n        <img width=\"100\" height=\"100\" src=\"https://github.com/mgechev.png?s=150\">\n        <br>\n        <a href=\"https://github.com/mgechev\">Minko Gechev</a>\n      </td>\n      <td align=\"center\" valign=\"top\">\n        <img width=\"100\" height=\"100\" src=\"https://github.com/addyosmani.png?s=150\">\n        <br>\n        <a href=\"https://github.com/addyosmani\">Addy Osmani</a>\n      </td>\n      <td align=\"center\" width=\"20%\" valign=\"top\">\n        <img width=\"100\" height=\"100\" src=\"https://github.com/khempenius.png?s=150\">\n        <br>\n        <a href=\"https://github.com/khempenius\">Katie Hempenius</a>\n      </td>\n      <td align=\"center\" valign=\"top\">\n        <img width=\"100\" height=\"100\" src=\"https://github.com/kyleamathews.png?s=150\">\n        <br>\n        <a href=\"https://github.com/kyleamathews\">Kyle Mathews</a>\n      </td>\n     </tr>\n  </tbody>\n</table>\n"
  },
  {
    "path": "experiments/guess-static-sites/.gitignore",
    "content": "*.env\n*.pem\n*.p12\nnode_modules/\n*.swp\n"
  },
  {
    "path": "experiments/guess-static-sites/README.md",
    "content": "# guess-static-sites\n\nGuess.js for non-Webpack sites.\n\n*Automatic, dynamic, intelligent prefetching for faster page loads.*\n\n:heavy_check_mark: **Automatic:** Once you've setup predictive fetching you'll automatically be using it on all your pages. (No more forgetting to take advantage of prefetch.)\n\n:heavy_check_mark: **Dynamic:** As your site changes, prefetch links will adjust accordingly. (No more hardcoded prefetch URLs.) \n\n:heavy_check_mark: **Intelligent:** Predictive fetching uses the client's connection type to determine whether a resource should be prefetched.\n\n## How guess-static-sites works\n\nThis directory uses Google Analytics data to determine which page a user is mostly likely to visit next from a given page (***generatePredictions.js***).\n\nA client-side script (which you'll add to your application) sends a request to the server you are running to get the URL of the page it should fetch, it then prefetches this resource (***script.js & server.js***).\n\nIf a user is on a poor connection, prefetching will only occur if there's a high level of certainty that a user will go to a particular page next. If a client is using the Save-Data header, no prefetching will occur.\n\n## Setup\nAfter downloading the Guess.js repo, cd to this directory and install the dependencies:\n```\n$ cd experiments/guess-static-sites\n$ npm install\n```\n\n## A) Server setup\nUse this command to run the server:\n```\n$ node server.js\n```\n\n## B) Script setup\n1. Add predictiveFetching.js to your pages.\n2. In predictiveFetching.js, replace ```'http://YOUR_SERVER_ENDPOINT/'``` with the server endpoint you'll be using.\n\n\n## C) Database setup\n\n**Prerequisites:**\n- A Google Analytics account\n- Mongo installed on your computer/server [(Instructions)](https://docs.mongodb.com/manual/installation/)\n\nThis is the final, and lengthiest, part of the setup process - but it should only take about 5-10 minutes to complete if you already have Mongo and a Google Analytics account. Afterwards you'll be ready to consume and analyze your Google Analytics data.\n\n### Create Your Credentials\n\n#### i) Create a Service Account\n\n1. Go to the [Credentials](https://console.developers.google.com/apis/credentials) page in the Google APIs console. \n\n2. If you don't have an existing Google Cloud project, click \"Create\" to create a new project. Otherwise, use the dropdown in the upper left corner to select the existing project that you'd like to use.\n\n3. Select \"Service Account key\" from the \"Create credentials\" dropdown.\n\n4. Fill out the form for creating a service account key:\n- **Service account dropdown:** Select \"New Service Account\".\n- **Service account name:** Give your service account a name.\n- **Role:** Select \"Service Account User\" (\"Service Accounts\" > \"Service Account User\").\n- **Service account ID:** This field will automatically be pre-filled, but you can change this if you would like.\n- **Key type:** Select P12 key.\n\n5. Click Create.\n\n#### ii) Setup Your Private Key\n\nYour private key should have started downloading when you clicked the \"Create\" button for creating your service account.\n1. Note the private key password. You'll be prompted for this password in Step 3.\n2. Move this key into the directory for this project.\n3. Generate a *.p12 certificate by running this command from the directory for this project: \n```\n$ openssl pkcs12 -in *.p12 -out key.pem -nodes -clcerts\n```\n\n### Configure Google Analytics\n\n#### i) Add service account to Google Analytics\nThe service account that you just created needs to be added as a user to your Google analytics account.\n1. Login to your [Google Analytics](https://analytics.google.com/analytics/web/) account.\n2. Add a new user. (Admin > User Management > + > Add New Users)\n- **Email Address** The email address of the service account you created. It should look something like this: example@example-project-123456.iam.gserviceaccount.com.\n- **Permissions:** Select \"Read & Analyze.\"\n\n*Note: A service account can only be associated with one Google Analytics account at a time. Thus, if you want to use predictive fetching on multiple sites, you'll need to create a separate service account for each.*\n\n#### ii) Enable the Google Analytics Reporting API\nYou can enable this [here.](https://console.developers.google.com/flows/enableapi?apiid=analyticsreporting.googleapis.com&credential=client_key)\n\n### Create your .env file\n\nThis file will hold your confidential configuration details.\n\n#### i) Create the file\n\n```\n$ touch .env\n```\n\n#### ii) Add your information\nYour file should look like this (replace with your own values):\n\n```bash\nVIEW_ID=12345678\nSERVICE_ACCOUNT_EMAIL=example@example-project-123456.iam.gserviceaccount.com\n```\n\nTo find your view ID, go to [Google Analytics](https://analytics.google.com/analytics/web/).\nClick the accounts dropdown (it's located in the upper lefthand corner  of the screen, right next to the Google Analytics logo). The dialog that opens will have three columns: Analytics Accounts, Properties & Apps, & Views. The far right column (\"Views\") will contain the View ID for your site.\n\n### Generate predictions\n\n#### i) Start mongod\nIf mongod is not running, start it:\n```\n$ mongod\n```\n\n#### ii) Run script\n```\n$ node generatePredictions.js\n```\n\nIf this is successful, you should see something like this in the console for each page:\n```\n{ pagePath: 'dogs/poodle.html',\n  pageviews: 300,\n  exits: 200,\n  nextPageviews: 100,\n  nextExits: 100,\n  nextPages:\n   [ { pagePath: '/dogs/puppies/', pageviews: 100 } ],\n  percentExits: 0.6666666666666666,\n  topNextPageProbability: 0.3333333333333333 }\n```\n\nYou can also explore the results in Mongo:\n```\n$ mongo\n$ use guessjs_dev\n$ db.predictions.find()\n```\n\n#### iii) (Optional) Setup a cron job\nIt is recommended that you set up a cron job to periodically re-run generatePredictions.js. This will ensure that the prefetch links are as accurate as possible. The ideal frequency of this cron job depends on how frequently your site changes.\n\nYou can also experiment with the date range of data that is used to generate predictions. By default, GuessJS uses the last 30 days of traffic to generate predictions, but this value can be changed (this is located in file: *src/queryParams.js*). It's important to have a sufficiently large data set, so the ideal date range will largely depend on a site's traffic volume. A very high-traffic site might find that using the last 1-7 days of traffic works best, while a low-traffic site find that using the last 30 days works best.\n"
  },
  {
    "path": "experiments/guess-static-sites/config.js",
    "content": "const env = process.env.NODE_ENV\n\nrequire('dotenv').config()\n\nconst dev = {\n  auth: {\n    keyFileName: 'key.pem',\n    viewID: process.env.VIEW_ID,\n    serviceAccountEmail: process.env.SERVICE_ACCOUNT_EMAIL\n  },\n  db: {\n    mongoURL: 'mongodb://localhost:27017/guessjs_dev'\n  },\n  server: {\n    port: 3000,\n    url: 'http://localhost:3000'\n  }\n}\n\nconst test = {\n  auth: {\n    keyFileName: 'key.pem',\n    viewID: process.env.VIEW_ID,\n    serviceAccountEmail: process.env.SERVICE_ACCOUNT_EMAIL\n  },\n  db: {\n    mongoURL: 'mongodb://localhost:27017/guessjs_test'\n  },\n  server: {\n    port: 3000,\n    url: 'http://localhost:3000'\n  }\n}\n\nconst prod = {\n  auth: {\n    keyFileName: 'key.pem',\n    viewID: process.env.VIEW_ID,\n    serviceAccountEmail: process.env.SERVICE_ACCOUNT_EMAIL\n  },\n  db: {\n    mongoURL: 'mongodb://localhost:27017/guessjs_prod'\n  },\n  server: {\n    port: 3000,\n    url: 'http://localhost:3000'\n  }\n}\n\nconst config = {\n  dev,\n  test,\n  prod\n}\n\nmodule.exports = config[env] || config['dev']\n"
  },
  {
    "path": "experiments/guess-static-sites/generatePredictions.js",
    "content": "/*\nThis scripts retrieves recent reporting data from Google Analytics\nand uses this to determine the \"Most Likely Next Page\" for each page on your site.\nThis data is saved in Mongo.\n*/\nconst {google} = require('googleapis')\nconst fs = require('fs')\nconst queryParams = require('./src/queryParams')\nconst parser = require('./src/parser')\nconst config = require('./config')\nconst path = require('path')\n\nconst authClient = new google.auth.JWT({\n  email: config.auth.serviceAccountEmail,\n  key: fs.readFileSync(path.join(__dirname, config.auth.keyFileName), 'utf8'),\n  scopes: ['https://www.googleapis.com/auth/analytics.readonly']\n})\n\nconst getData = async (authClient) => {\n  await authClient.authorize()\n  const analytics = google.analyticsreporting({\n    version: 'v4',\n    auth: authClient\n  })\n  const response = await analytics.reports.batchGet(queryParams)\n  await parser.saveReports(response.data.reports)\n  process.exit()\n}\n\ngetData(authClient)\n"
  },
  {
    "path": "experiments/guess-static-sites/package.json",
    "content": "{\n  \"name\": \"guess-static-sites\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"server.js\",\n  \"scripts\": {\n    \"generate-predictions-tests\": \"NODE_ENV=test mocha ./test/gaClientTests.js\",\n    \"client-tests\": \"NODE_ENV=test mocha ./test/clientTests.js\",\n    \"server-tests\": \"NODE_ENV=test mocha ./test/serverTests.js\",\n    \"build\": \"babel src/client.js --out-file dist/client.js --presets minify\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"body-parser\": \"^1.18.2\",\n    \"dotenv\": \"^8.0.0\",\n    \"express\": \"^4.16.3\",\n    \"fs\": \"0.0.2\",\n    \"googleapis\": \"^67.0.0\",\n    \"mongoose\": \"^5.0.14\"\n  },\n  \"devDependencies\": {\n    \"babel-cli\": \"6.26.0\",\n    \"babel-minify\": \"0.5.1\",\n    \"babel-preset-es2015\": \"6.24.1\",\n    \"babel-preset-minify\": \"0.5.1\",\n    \"chai\": \"4.3.0\",\n    \"cors\": \"2.8.5\",\n    \"http-server\": \"0.12.1\",\n    \"mocha\": \"8.3.1\",\n    \"path\": \"0.12.7\",\n    \"puppeteer\": \"7.1.0\",\n    \"standard\": \"16.0.3\",\n    \"supertest\": \"6.1.3\"\n  }\n}\n"
  },
  {
    "path": "experiments/guess-static-sites/predictiveFetching.js",
    "content": "const ENDPOINT = 'http://YOUR_SERVER_ENDPOINT/'\n\nconst setCookie = function (obj) {\n  const cookieStr = obj.name + '=' + obj.value + '; max-age=' + obj.maxAge\n  document.cookie = cookieStr\n}\n\nconst appendLinkTo = function (url) {\n  const linkTag = document.createElement('link')\n  linkTag.rel = 'prefetch'\n  linkTag.href = url\n  document.head.appendChild(linkTag)\n}\n\nconst getConnectionType = function () {\n  return window.navigator.connection ? window.navigator.connection.effectiveType : ''\n}\n\nconst getUserFlow = function () {\n  const result = []\n  document.cookie.split(';').forEach(c => {\n    const prefix = c.trim().substr(0, 3)\n    if (prefix === 'pf_') {\n      result.push(c.trim())\n    }\n  })\n  return result\n}\n\nif (!document.hidden) {\n  xhr = new XMLHttpRequest()\n  xhr.open('POST', ENDPOINT)\n  xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')\n  xhr.onreadystatechange = function () {\n    if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {\n      const data = JSON.parse(xhr.responseText)\n      if (data['prefetchPath'] !== '') {\n        appendLinkTo(window.location.origin + data.prefetchPath)\n      }\n      setCookie({\n        name: 'pf_' + data['pageViewId'],\n        value: Math.round(new Date() / 1000),\n        maxAge: 300\n      })\n    }\n  }\n\n  const requestBody = {\n    'pagePath': window.location.pathname,\n    'userFlow': getUserFlow(),\n    'clientInfo': {\n      'connectionType': getConnectionType(),\n      'platform': window.navigator.platform,\n      'language': window.navigator.language\n    }\n  }\n  xhr.send(JSON.stringify(requestBody))\n}\n"
  },
  {
    "path": "experiments/guess-static-sites/server.js",
    "content": "const express = require('express')\nconst bodyParser = require('body-parser')\nconst cors = require('cors')\nconst mongoose = require('mongoose')\nconst Prediction = require('./src/models/prediction')\nconst PageView = require('./src/models/pageView')\nconst config = require('./config')\n\nconst app = express()\n\napp.use(bodyParser.json())\napp.use(bodyParser.urlencoded({ extended: true }))\napp.use(cors())\n\napp.all('/', function (req, res, next) {\n  res.header('Access-Control-Allow-Origin', '*')\n  res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS')\n  res.header('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type')\n  next()\n})\n\nconst certaintyThresholdsByConnectionType = {\n  'slow-2g': 0.95,\n  '2g': 0.9,\n  '3g': 0.5,\n  '4g': 0.2\n}\n\nconst shouldPrefetch = function (request, prediction) {\n  if (prediction === null) { return false }\n  if (request.header('Save-Data')) { return false }\n  const connectionType = request.body.clientInfo.connectionType\n  const threshold = certaintyThresholdsByConnectionType[connectionType]\n  if (threshold === undefined) {\n    return false\n  } else {\n    return parseFloat(prediction.nextPageCertainty) > parseFloat(threshold)\n  }\n}\n\nconst getPreviousPageId = function (cookies) {\n  let latestTimestamp = 0\n  let latestId\n  cookies.forEach(c => {\n    const timestamp = parseInt(c.split('=')[1])\n    if (timestamp > latestTimestamp) {\n      latestTimestamp = timestamp\n      latestId = c.substring(c.indexOf('_') + 1, c.indexOf('='))\n    }\n  })\n  return latestId\n}\n\napp.post('/', async (req, res) => {\n  mongoose.connect(config.db.mongoURL)\n  const prediction = await Prediction.findOne({'pagePath': req.body['pagePath']})\n  const prefetchPath = shouldPrefetch(req, prediction) ? prediction['nextPagePath'] : ''\n\n  const pageView = await PageView.create({\n    pagePath: req.body['pagePath'],\n    clientInfo: req.body['clientInfo'],\n    userFlow: req.body['userFlow'],\n    prefetchPath: prefetchPath\n  })\n\n  // Update data about previous page view\n  if (req.body.userFlow.length > 0) {\n    const id = getPreviousPageId(req.body.userFlow)\n    await PageView.findByIdAndUpdate(id, {'actualNextPagePath': req.body.pagePath})\n  }\n\n  res.json({\n    'pageViewId': pageView._id,\n    'prefetchPath': prefetchPath\n  })\n})\n\napp.listen(config.server.port)\n\nmodule.exports = app\n"
  },
  {
    "path": "experiments/guess-static-sites/src/models/pageView.js",
    "content": "const mongoose = require('mongoose')\n\nconst pageViewSchema = mongoose.Schema({\n  pagePath: String,\n  clientInfo: Object,\n  userFlow: Array,\n  prefetchPath: String,\n  actualNextPagePath: String\n})\nconst PageView = mongoose.model('PageView', pageViewSchema)\n\nmodule.exports = PageView\n"
  },
  {
    "path": "experiments/guess-static-sites/src/models/prediction.js",
    "content": "const mongoose = require('mongoose')\n\nconst predictionSchema = mongoose.Schema({\n  pagePath: String,\n  nextPagePath: String,\n  nextPageCertainty: Number\n})\nconst Prediction = mongoose.model('Prediction', predictionSchema)\n\nmodule.exports = Prediction\n"
  },
  {
    "path": "experiments/guess-static-sites/src/parser.js",
    "content": "const mongoose = require('mongoose')\nconst Prediction = require('./models/prediction')\nconst config = require('../config')\n\n// Generates & saves predictions based off Google Analytics response\nconst saveReports = async (reports) => {\n  let [report] = reports\n  let {rows} = report.data\n  const data = {}\n\n  for (let row of rows) {\n    let [previousPagePath, pagePath] = row.dimensions\n    let pageviews = +row.metrics[0].values[0]\n    let exits = +row.metrics[0].values[1]\n\n    if (/\\?.*$/.test(pagePath) || /\\?.*$/.test(previousPagePath)) {\n      pagePath = pagePath.replace(/\\?.*$/, '')\n      previousPagePath = previousPagePath.replace(/\\?.*$/, '')\n    }\n\n    // Ignore pageviews where the current and previous pages are the same.\n    if (previousPagePath == pagePath) continue\n\n    if (previousPagePath != '(entrance)') {\n      data[previousPagePath] = data[previousPagePath] || {\n        pagePath: previousPagePath,\n        pageviews: 0,\n        exits: 0,\n        nextPageviews: 0,\n        nextExits: 0,\n        nextPages: {}\n      }\n\n      data[previousPagePath].nextPageviews += pageviews\n      data[previousPagePath].nextExits += exits\n\n      if (data[previousPagePath].nextPages[pagePath]) {\n        data[previousPagePath].nextPages[pagePath] += pageviews\n      } else {\n        data[previousPagePath].nextPages[pagePath] = pageviews\n      }\n    }\n\n    data[pagePath] = data[pagePath] || {\n      pagePath: pagePath,\n      pageviews: 0,\n      exits: 0,\n      nextPageviews: 0,\n      nextExits: 0,\n      nextPages: {}\n    }\n\n    data[pagePath].pageviews += pageviews\n    data[pagePath].exits += exits\n  }\n\n  // Converts each pages `nextPages` object into a sorted array.\n  Object.keys(data).forEach((pagePath) => {\n    const page = data[pagePath]\n    page.nextPages = Object.keys(page.nextPages)\n      .map((pagePath) => ({\n        pagePath,\n        pageviews: page.nextPages[pagePath]\n      }))\n      .sort((a, b) => b.pageviews - a.pageviews)\n  })\n\n  // Creates a sorted array of pages from the data object.\n  const pages = Object.keys(data)\n    .filter((pagePath) => data[pagePath].nextPageviews > 0)\n    .map((pagePath) => {\n      const page = data[pagePath]\n      const {exits, nextPageviews, nextPages} = page\n      page.percentExits = exits / (exits + nextPageviews)\n      page.topNextPageProbability =\n                nextPages[0].pageviews / (exits + nextPageviews)\n      return page\n    })\n    .sort((a, b) => {\n      // return b.topNextPageProbability - a.topNextPageProbability\n      return b.pageviews - a.pageviews\n    })\n  for (let page of pages) {\n    // TODO - remove console logs\n    console.log(page)\n    console.log('\\n')\n  }\n\n  await savePagesToDatabase(pages)\n}\n\n// Adds each page (and its associated prediction) to the database.\n// If a page already exists, its record is updated based on the most recent Google Analytics data.\nconst savePagesToDatabase = async (pages) => {\n  mongoose.connect(config.db.mongoURL)\n  for (let page of pages) {\n    const prediction = {\n      pagePath: page.pagePath,\n      nextPagePath: page.nextPages[0] ? page.nextPages[0].pagePath : '',\n      nextPageCertainty: page.nextPages[0] ? page.topNextPageProbability : ''\n    }\n    await Prediction.update({'pagePath': prediction.pagePath}, prediction, {'upsert': true})\n  }\n}\n\nmodule.exports = {saveReports: saveReports}\n"
  },
  {
    "path": "experiments/guess-static-sites/src/queryParams.js",
    "content": "const config = require('../config')\n\nconst queryParams = {\n  resource: {\n    reportRequests: [\n      {\n        viewId: config.auth.viewID,\n        dateRanges: [{startDate: '30daysAgo', endDate: 'yesterday'}],\n        metrics: [\n          {expression: 'ga:pageviews'},\n          {expression: 'ga:exits'}\n        ],\n        dimensions: [\n          {name: 'ga:previousPagePath'},\n          {name: 'ga:pagePath'}\n        ],\n        orderBys: [\n          {fieldName: 'ga:previousPagePath', sortOrder: 'ASCENDING'},\n          {fieldName: 'ga:pageviews', sortOrder: 'DESCENDING'}\n        ],\n        pageSize: 10000\n      }\n    ]\n  }\n}\n\nmodule.exports = queryParams\n"
  },
  {
    "path": "experiments/guess-static-sites/test/clientTests.js",
    "content": "// To run tests: $ npm run script-tests\n// Server responses are stubbed, but test server needs to be running\n// ($ NODE_ENV=test node ./fixtures/server.js)\n// Mongod should be running\n// Tests run against dist/client.js; to regenerate this: $ npm run build\n\nconst puppeteer = require('puppeteer')\nconst { expect } = require('chai')\nconst globalVariables = {'browser': global['browser'], 'expect': global['expect']}\nconst should = require('chai').should()\n\n// TODO - Use config\nconst SERVER_URL = 'http://localhost:3000/'\nconst PAGE_URL = 'http://localhost:8080/test.html'\n\nbefore(async () => {\n  global.expect = expect\n  global.browser = await puppeteer.launch({\n    headless: false,\n    slowMo: 100,\n    timeout: 10000\n  })\n})\n\nafter(() => {\n  browser.close()\n  global.browser = globalVariables.browser\n  global.expect = globalVariables.expect\n})\n\ndescribe('Predictve fetching script ', function () {\n  let page\n\n  before(async function () {\n    page = await browser.newPage()\n    await page._client.send('Network.clearBrowserCookies')\n    page.on('console', msg => console.log('PAGE LOG:', msg.text()))\n  })\n\n  after(async function () {\n    await page.close()\n  })\n\n  describe('makes a request', async function () {\n    it('should have the correct request body', async function () {\n      let requests = []\n\n      page.on('request', interceptedRequest => {\n        requests.push(interceptedRequest)\n      })\n\n      const unrelatedCookie = {\n        'name': 'some_other_cookie',\n        'value': 'abc',\n        'domain': 'localhost',\n        'path': '/test.html',\n        'expires': (Date.now() / 1000) + 100\n      }\n\n      const cookie1 = {\n        'name': 'pf_cookie1',\n        'value': '111',\n        'domain': 'localhost',\n        'path': '/test.html',\n        'expires': (Date.now() / 1000) + 100\n      }\n\n      const cookie2 = {\n        'name': 'pf_cookie2',\n        'value': '222',\n        'domain': 'localhost',\n        'path': '/test.html',\n        'expires': (Date.now() / 1000) + 100\n      }\n\n      await page.setCookie(unrelatedCookie)\n      await page.setCookie(cookie1)\n      await page.setCookie(cookie2)\n\n      await page.goto(PAGE_URL)\n\n      request = requests.find(req => {\n        let URL = SERVER_URL\n        return req.url() === URL && req.method() === 'POST'\n      })\n\n      page.waitForNavigation({waitUntil: 'networkidle2'})\n      expect(request).to.exist\n\n      const actualResponseBody = JSON.parse(request.postData())\n      expect(actualResponseBody['pagePath']).to.equal('/test.html')\n\n      // not.be.empty (vs. a particular value like \"4g\" or \"MacIntel\")\n      // is used so these tests will work cross-environment\n      expect(actualResponseBody['clientInfo']['connectionType']).to.not.be.empty\n      expect(actualResponseBody['clientInfo']['platform']).to.not.be.empty\n      expect(actualResponseBody['clientInfo']['language']).to.not.be.empty\n\n      expect(actualResponseBody['userFlow'].length).to.equal(2)\n      expect(actualResponseBody['userFlow']).to.contain('pf_cookie1=111')\n      expect(actualResponseBody['userFlow']).to.contain('pf_cookie2=222')\n    })\n  })\n\n  describe('request callback', function () {\n    const setupResponse = async (page, responseBody) => {\n      await page.setRequestInterception(true)\n      page.on('request', req => {\n        if (req.url() === SERVER_URL && req.method() === 'POST') {\n          req.respond({\n            status: 200,\n            contentType: 'application/json',\n            headers: {'Access-Control-Allow-Origin': '*'},\n            body: JSON.stringify(responseBody)\n          })\n        } else {\n          req.continue()\n        }\n      })\n    }\n    before(async function () {\n      page = await browser.newPage()\n      setupResponse(page, {'pageViewId': '123', 'prefetchPath': ''})\n      await page._client.send('Network.clearBrowserCookies')\n      await page.goto(PAGE_URL)\n      await page.waitFor(100)\n    })\n    describe(\"when there's no matching prefetch\", function () {\n      it('should not append a link', async function () {\n        const link = await page.evaluate(() => {\n          return document.querySelector('link')\n        })\n        expect(link).to.be.null\n      })\n      it('should set prefetch cookies', async function () {\n        const cookies = await page.cookies()\n        expect(cookies.length).to.equal(1)\n        expect(cookies[0].name).to.equal('pf_123')\n\n        const currentTime = new Date() / 1000\n        // Buffer user to account for slight timestamp difference\n        // between when cookie was created and when this test runs\n        const buffer = 5\n        const cookieValue = parseInt(cookies[0].value)\n        expect(cookieValue).to.be.closeTo(currentTime, buffer)\n\n        const cookieMaxAge = 300\n        expect(cookies[0].expires).to.be.closeTo(currentTime + cookieMaxAge, buffer)\n      })\n    })\n    describe(\"when there's a matching prefetch\", function () {\n      before(async function () {\n        page = await browser.newPage()\n        setupResponse(page, {'pageViewId': '123', 'prefetchPath': '/nextpage.html'})\n        await page._client.send('Network.clearBrowserCookies')\n        await page.goto(PAGE_URL)\n        await page.waitFor('link')\n      })\n\n      it('should append a link', async function () {\n        const link = await page.evaluate(() => {\n          return document.querySelector('link')\n        })\n        expect(link).to.exist\n      })\n\n      it('should use prefetch', async function () {\n        const resourceHint = await page.evaluate(() => {\n          return document.querySelector('link').rel\n        })\n        expect(resourceHint).to.equal('prefetch')\n      })\n\n      it('should load the correct resource', async function () {\n        const href = await page.evaluate(() => {\n          return document.querySelector('link').href\n        })\n        // Regex matches that \"/nextpage.html\" apears at the end of the string\n        expect(href).to.match(/\\/nextpage\\.html$/)\n      })\n\n      it('should set prefetch cookies', async function () {\n        const cookies = await page.cookies()\n\n        expect(cookies[0].name).to.equal('pf_123')\n\n        const currentTime = new Date() / 1000\n        // Buffer user to account for slight timestamp difference\n        // between when cookie was created and when this test runs\n        const buffer = 5\n        const cookieValue = parseInt(cookies[0].value)\n        expect(cookieValue).to.be.closeTo(currentTime, buffer)\n\n        const cookieMaxAge = 300\n        expect(cookies[0].expires).to.be.closeTo(currentTime + cookieMaxAge, buffer)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "experiments/guess-static-sites/test/fixtures/gaResponse.json",
    "content": "{\"testData\": [{\n\t\"columnHeader\": {\n\t\t\"dimensions\": [\"ga:previousPagePath\", \"ga:pagePath\"],\n\t\t\"metricHeader\": {\n\t\t\t\"metricHeaderEntries\": [{\n\t\t\t\t\"name\": \"ga:pageviews\",\n\t\t\t\t\"type\": \"INTEGER\"\n\t\t\t}, {\n\t\t\t\t\"name\": \"ga:exits\",\n\t\t\t\t\"type\": \"INTEGER\"\n\t\t\t}]\n\t\t}\n\t},\n\t\"data\": {\n\t\t\"rows\": [{\n\t\t\t\"dimensions\": [\"(entrance)\", \"/page/turtles/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"13\", \"9\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"(entrance)\", \"/page/dogs/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"6\", \"5\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"(entrance)\", \"/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"(entrance)\", \"/page/cats/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/turtles/turtle1.html\", \"/page/turtles/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"3\", \"3\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/page/turtles/\", \"/turtles/turtle1.html\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"3\", \"0\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/page/turtles/\", \"/turtles/tortise.html\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/page/dogs/\", \"/dogs/dog_photo2.html\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"0\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/dogs/dog_photo2.html\", \"/page/dogs/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}],\n\t\t\"totals\": [{\n\t\t\t\"values\": [\"30\", \"21\"]\n\t\t}],\n\t\t\"rowCount\": 9,\n\t\t\"minimums\": [{\n\t\t\t\"values\": [\"0\", \"0\"]\n\t\t}],\n\t\t\"maximums\": [{\n\t\t\t\"values\": [\"13\", \"9\"]\n\t\t}]\n\t}\n}, {\n\t\"columnHeader\": {\n\t\t\"dimensions\": [\"ga:previousPagePath\", \"ga:pagePath\"],\n\t\t\"metricHeader\": {\n\t\t\t\"metricHeaderEntries\": [{\n\t\t\t\t\"name\": \"ga:pageviews\",\n\t\t\t\t\"type\": \"INTEGER\"\n\t\t\t}, {\n\t\t\t\t\"name\": \"ga:exits\",\n\t\t\t\t\"type\": \"INTEGER\"\n\t\t\t}]\n\t\t}\n\t},\n\t\"data\": {\n\t\t\"rows\": [{\n\t\t\t\"dimensions\": [\"(entrance)\", \"/page/turtles/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"13\", \"9\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"(entrance)\", \"/page/dogs/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"6\", \"5\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"(entrance)\", \"/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"(entrance)\", \"/page/cats/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/turtles/turtle1.html\", \"/page/turtles/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"3\", \"3\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/page/turtles/\", \"/turtles/turtle1.html\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"3\", \"0\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/page/turtles/\", \"/turtles/tortise.html\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/page/dogs/\", \"/dogs/dog_photo2.html\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"0\"]\n\t\t\t}]\n\t\t}, {\n\t\t\t\"dimensions\": [\"/dogs/dog_photo2.html\", \"/page/dogs/\"],\n\t\t\t\"metrics\": [{\n\t\t\t\t\"values\": [\"1\", \"1\"]\n\t\t\t}]\n\t\t}],\n\t\t\"totals\": [{\n\t\t\t\"values\": [\"30\", \"21\"]\n\t\t}],\n\t\t\"rowCount\": 9,\n\t\t\"minimums\": [{\n\t\t\t\"values\": [\"0\", \"0\"]\n\t\t}],\n\t\t\"maximums\": [{\n\t\t\t\"values\": [\"13\", \"9\"]\n\t\t}]\n\t}\n}]}"
  },
  {
    "path": "experiments/guess-static-sites/test/fixtures/server.js",
    "content": "// Simple static server for serving a page for testing front-end script\nconst express = require('express')\nconst cors = require('cors')\nconst path = require('path')\nconst fs = require('fs')\n\nconst app = express()\nconst PORT = 8080\n\napp.use(cors())\n\napp.get('/test.html', function (req, res) {\n  res.sendFile(path.join(__dirname + '/test.html'))\n})\n\napp.get('/predictiveFetching.js', async (req, res) => {\n  fs.readFile(path.join(__dirname + '/../../predictiveFetching.js'), 'utf8', (err, data) => {\n    const response = data.replace(/http:\\/\\/YOUR_SERVER_ENDPOINT\\//g, 'http://localhost:3000/')\n    res.send(response)\n  })\n})\n\napp.listen(PORT, function () {\n  console.log('Test web server listening on port ' + PORT)\n})\n"
  },
  {
    "path": "experiments/guess-static-sites/test/fixtures/test.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <title>Next Page Predictor</title>\n</head>\n<body>\nPage for testing predictive fetching.\n<script src=\"/predictiveFetching.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "experiments/guess-static-sites/test/gaClientTests.js",
    "content": "// To run tests: $ npm run generate-predictions-tests\n// mongod should be running\n\nconst chai = require('chai')\nconst expect = chai.expect\n\nconst mongoose = require('mongoose')\nconst config = require('../config')\n\nconst parser = require('../src/parser')\nconst fakeResponse = require('./fixtures/gaResponse.json')\nconst Prediction = require('../src/models/prediction')\n\ndescribe('#SaveReports', function () {\n  beforeEach(async () => {\n    await mongoose.connect(config.db.mongoURL)\n    await mongoose.connection.db.dropDatabase()\n  })\n  afterEach(async () => {\n    mongoose.disconnect()\n  })\n  it('should save API response as predictions', async () => {\n    await parser.saveReports(fakeResponse['testData'])\n\n    const predictions = await Prediction.find({})\n  \texpect(await predictions.length).to.equal(4)\n\n  \tconst prediction1 = predictions.find((p) => { return p.pagePath === '/page/turtles/' })\n  \texpect(prediction1.nextPageCertainty).to.equal(0.1875)\n  \texpect(prediction1.nextPagePath).to.equal('/turtles/turtle1.html')\n\n  \tconst prediction2 = predictions.find((p) => { return p.pagePath === '/page/dogs/' })\n  \texpect(prediction2.nextPageCertainty).to.equal(0.14285714285714285)\n  \texpect(prediction2.nextPagePath).to.equal('/dogs/dog_photo2.html')\n  })\n})\n"
  },
  {
    "path": "experiments/guess-static-sites/test/serverTests.js",
    "content": "// $ npm run server-tests\nconst request = require('supertest')\nconst express = require('express')\nconst chai = require('chai')\nconst mongoose = require('mongoose')\n\nconst Prediction = require('../src/models/prediction')\nconst PageView = require('../src/models/pageView')\n\nconst expect = chai.expect\nconst app = require('../server.js')\n\nconst config = require('../config')\n\ndescribe('POST /', function () {\n  beforeEach(async () => {\n    await mongoose.connect(config.db.mongoURL)\n    await mongoose.connection.db.dropDatabase()\n  })\n  afterEach(async () => {\n    mongoose.disconnect()\n  })\n  describe('response', function () {\n    describe('when a prediction for that page exists in the database', async () => {\n      const makeRequest = function () {\n        return request(app)\n          .post('/')\n          .send({\n            pagePath: '/page/1',\n            userFlow: ['pf_123', 'pf_456'],\n            clientInfo: {\n              connectionType: '4g',\n              platform: 'MacIntel',\n              language: 'en-US'\n            }\n          })\n      }\n      beforeEach(async () => {\n        await Prediction.create({\n          pagePath: '/page/1',\n          nextPagePath: '/page/2',\n          nextPageCertainty: 0.75\n        })\n      })\n      it('should create a new PageView record', async () => {\n        await makeRequest()\n        const pageView = await PageView.findOne({})\n\n        expect(pageView.pagePath).to.equal('/page/1')\n\n        expect(pageView.clientInfo.connectionType).to.equal('4g')\n        expect(pageView.clientInfo.platform).to.equal('MacIntel')\n        expect(pageView.clientInfo.language).to.equal('en-US')\n\n        expect(pageView.userFlow[0]).to.equal('pf_123')\n        expect(pageView.userFlow[1]).to.equal('pf_456')\n\n        expect(pageView.prefetchPath).to.equal('/page/2')\n        expect(pageView.actualNextPagePath).to.equal(undefined)\n      })\n      it('should have the correct response body', async () => {\n        const response = await makeRequest()\n        const pageView = await PageView.findOne({pagePath: '/page/1'})\n        expect(response.body['pageViewId']).to.equal(pageView._id.toString())\n        expect(response.body['prefetchPath']).to.equal('/page/2')\n        expect(200)\n      })\n    })\n    describe('when a prediction for that page does not exist in the database', async () => {\n      const makeRequest = function () {\n        return request(app)\n          .post('/')\n          .send({\n            pagePath: '/no/matches',\n            userFlow: [],\n            clientInfo: {\n              connectionType: '4g'\n            }\n          })\n      }\n      it('should create a new PageView record', async () => {\n        await makeRequest()\n\n        const pageView = await PageView.findOne({})\n        expect(pageView.prefetchPath).to.equal('')\n\n        expect(pageView.pagePath).to.equal('/no/matches')\n        expect(pageView.clientInfo.connectionType).to.equal('4g')\n        expect(pageView.userFlow.length).to.equal(0)\n        expect(pageView.actualNextPagePath).to.equal(undefined)\n      })\n      it('should have the correct response body', async () => {\n        const response = await makeRequest()\n        const pageView = await PageView.findOne({pagePath: '/no/matches'})\n        expect(response.body['pageViewId']).to.equal(pageView._id.toString())\n        expect(response.body['prefetchPath']).to.equal('')\n        expect(200)\n      })\n    })\n  })\n  describe('using connectionType to determine whether page should be prefetched', async () => {\n    const makeRequestOnConnectionType = function (connectionType) {\n      return request(app)\n        .post('/')\n        .send({\n          pagePath: '/page/1',\n          userFlow: ['pf_123', 'pf_456'],\n          clientInfo: {\n            connectionType: connectionType,\n            platform: 'MacIntel',\n            language: 'en-US'\n          }\n        })\n    }\n    beforeEach(async () => {\n      await Prediction.create({\n        pagePath: '/page/1',\n        nextPagePath: '/page/2',\n        nextPageCertainty: 0.75\n      })\n    })\n    describe('when client is on a fast connection', async () => {\n      it('should respond with a page to prefetch', async () => {\n        const response = await makeRequestOnConnectionType('4g')\n        expect(response.body['prefetchPath']).to.equal('/page/2')\n        expect(200)\n      })\n    })\n    describe('when client is on a slow connection', async () => {\n      it('should not respond with a page to prefetch', async () => {\n        const response = await makeRequestOnConnectionType('slow-2g')\n        expect(response.body['prefetchPath']).to.equal('')\n        expect(200)\n      })\n    })\n    describe('when client is on an unknown connection', async () => {\n      it('should not respond with a page to prefetch', async () => {\n        const response = await makeRequestOnConnectionType('foobar')\n        expect(response.body['prefetchPath']).to.equal('')\n        expect(200)\n      })\n    })\n    describe('when client is using Save-Data header', async () => {\n      it('should not respond with a page to prefetch', async () => {\n        const response = await request(app)\n          .post('/')\n          .set('Save-Data', true)\n          .send({\n            pagePath: '/page/1',\n            userFlow: ['pf_123', 'pf_456'],\n            clientInfo: {\n              connectionType: '4g',\n              platform: 'MacIntel',\n              language: 'en-US'\n            }\n          })\n        expect(response.body['prefetchPath']).to.equal('')\n        expect(200)\n      })\n    })\n  })\n  describe('previous pageviews', async () => {\n    it('updates existing previous page record', async () => {\n      const existingPageView = await PageView.create({\n        pagePath: '/old.html',\n        clientInfo: {\n          connectionType: '3g'\n        },\n        userFlow: [],\n        prefetchPath: '',\n        actualNextPagePath: ''\n      })\n      await request(app)\n        .post('/')\n        .send({\n          pagePath: '/this/page',\n          userFlow: ['pf_5ad567927c8db21eec4ae909=1523890000', 'pf_' + existingPageView._id + '=1523891234'],\n          clientInfo: {\n            connectionType: '4g'\n          }\n        })\n      const updatedRecord = await PageView.findById(existingPageView._id)\n      expect(updatedRecord.actualNextPagePath).to.equal('/this/page')\n    })\n  })\n})\n"
  },
  {
    "path": "infra/e2e.ts",
    "content": "import { execSync } from 'child_process';\nimport { readFileSync } from 'fs';\n\nconst enterTest = 'cd packages/guess-webpack/test/fixtures/angular';\nconsole.log(execSync(`${enterTest} && npm i`).toString());\nconsole.log(execSync(\n  `${enterTest} && ./node_modules/.bin/ng build --extra-webpack-config webpack.extra.js`\n).toString());\n\n// Prefetching instruction for baz\nconst fooModule = readFileSync('packages/guess-webpack/test/fixtures/angular/dist/angular/foo-foo-module.js').toString();\nif (fooModule.indexOf(`__GUESS__.p([0.6,'baz-baz-module.js'],[0.4,'qux-qux-module.js'])`) < 0) {\n  console.error('Problem with the ordering, or cannot find prefetching instructions');\n  process.exit(1);\n}\n\n// Proper filtering of the instructions\nconst quxModule = readFileSync('packages/guess-webpack/test/fixtures/angular/dist/angular/qux-qux-module.js').toString();\nif (quxModule.indexOf(`__GUESS__.p([0.99,'foo-foo-module.js'])`) < 0) {\n  console.error('Problem with filtering prefetching instructions');\n  process.exit(1);\n}\n\n// No prefetching instructions\nconst bazModule = readFileSync('packages/guess-webpack/test/fixtures/angular/dist/angular/baz-baz-module.js').toString();\nif (bazModule.indexOf('__GUESS__') >= 0) {\n  console.error('Found prefetching instructions in bundle with no neighbors');\n  process.exit(1);\n}\n\n// No runtime\nconst mainModule = readFileSync('packages/guess-webpack/test/fixtures/angular/dist/angular/main.js').toString();\nif (mainModule.indexOf('__GUESS__.p(') < 0 || mainModule.indexOf('__GUESS__.p=') < 0) {\n  console.error('Unable to find runtime or initial prefetching instruction');\n  process.exit(1);\n}\n\n// No base\nif (mainModule.indexOf('\"http://localhost:1337\"') < 0) {\n  console.error('Unable to find the base path');\n  process.exit(1);\n}\n\n// Prod build should work\nconsole.log(execSync(\n  `${enterTest} && ./node_modules/.bin/ng build --prod --extra-webpack-config webpack.extra.js`\n).toString());\n"
  },
  {
    "path": "infra/install.ts",
    "content": "import { join } from 'path';\nimport { execSync } from 'child_process';\n\nconst PackagesDir = join(process.cwd(), 'packages');\nconsole.log(\n  execSync(\n    `cd ${join(PackagesDir, 'guess-parser', 'test', 'fixtures', 'angular')} && npm i`\n  ).toString()\n);\n"
  },
  {
    "path": "infra/pretest.ts",
    "content": "import { readdirSync } from 'fs';\nimport { join } from 'path';\nimport { execSync } from 'child_process';\n\nconst cwd = process.cwd();\nconst base = join(cwd, 'packages', 'guess-webpack', 'test', 'fixtures');\n\nreaddirSync(base).forEach(dir => {\n  if (dir === '.' || dir === '..') {\n    return;\n  }\n  execSync(`cd ${join(base, dir)} && rm -rf dist && npm i && npm run build`);\n});\n"
  },
  {
    "path": "infra/test.ts",
    "content": "import { join } from 'path';\nimport { spawn } from 'child_process';\nimport chalk from 'chalk';\n\nconst StaticServer = require('static-server');\nconst port = 5122;\n\nconst setupMockServers = () =>\n  new Promise(resolve => {\n    const server = new StaticServer({\n      rootPath: join(process.cwd(), 'packages', 'guess-webpack', 'test', 'fixtures'),\n      port\n    });\n\n    server.start(() => {\n      console.log(chalk.yellow('Test server started on port', server.port));\n      resolve(server);\n    });\n  });\n\nasync function main() {\n  await setupMockServers();\n  const options = process.argv.filter(a => a === '--watch');\n  const jest = spawn(`${process.cwd()}/node_modules/.bin/jest`, options, { stdio: 'inherit' });\n  return new Promise<number>(resolve => {\n    jest.on('exit', code => resolve(code));\n    jest.on('close', code => resolve(code));\n  });\n}\n\nmain().then(code => process.exit(code));\n"
  },
  {
    "path": "jest-puppeteer.config.js",
    "content": "module.exports = {\n  launch: {\n    args: ['--no-sandbox', '--disable-setuid-sandbox'],\n    headless: true\n  }\n};\n"
  },
  {
    "path": "jest.config.js",
    "content": "module.exports = {\n  transform: {\n    '^.+\\\\.tsx?$': 'ts-jest'\n  },\n  testRegex: '(/test/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$',\n  testPathIgnorePatterns: [\n    '<rootDir>/packages/guess-parser/test/fixtures',\n    '<rootDir>/infra/test.ts',\n    '<rootDir>/experiments/guess-static-sites/test',\n    '<rootDir>/packages/guess-webpack/test/fixtures'\n  ],\n  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],\n  preset: '<rootDir>/node_modules/jest-puppeteer',\n  globals: {\n    window: {}\n  }\n};\n"
  },
  {
    "path": "lerna.json",
    "content": "{\n  \"lerna\": \"2.11.0\",\n  \"packages\": [\n    \"packages/*\"\n  ],\n  \"version\": \"0.4.22\"\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"guess\",\n  \"version\": \"0.0.0\",\n  \"description\": \"Smart bundling\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"bootstrap\": \"npm i && lerna bootstrap\",\n    \"build\": \"lerna run build\",\n    \"publish\": \"lerna publish\",\n    \"e2e\": \"ts-node infra/e2e.ts\",\n    \"test\": \"ts-node infra/test.ts --watch\",\n    \"pretest\": \"ts-node infra/pretest.ts\",\n    \"test:ci\": \"ts-node infra/pretest.ts && ts-node infra/test.ts\",\n    \"postinstall\": \"ts-node infra/install.ts\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/guess-js/guess.git\"\n  },\n  \"keywords\": [\n    \"bundling\",\n    \"webpack\",\n    \"ml\",\n    \"ai\",\n    \"analytics\",\n    \"recommendation\"\n  ],\n  \"author\": \"Minko Gechev <mgechev@gmail.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/guess-js/guess/issues\"\n  },\n  \"homepage\": \"https://github.com/guess-js/guess#readme\",\n  \"devDependencies\": {\n    \"@types/jest\": \"25.2.1\",\n    \"@types/meow\": \"5.0.0\",\n    \"@types/node\": \"9.6.60\",\n    \"blund\": \"1.0.0\",\n    \"chalk\": \"2.4.2\",\n    \"copy-webpack-plugin\": \"5.1.2\",\n    \"jest\": \"26.6.3\",\n    \"jest-puppeteer\": \"4.4.0\",\n    \"lerna\": \"4.0.0\",\n    \"meow\": \"10.1.2\",\n    \"prompt-confirm\": \"2.0.4\",\n    \"puppeteer\": \"7.1.0\",\n    \"raw-loader\": \"4.0.1\",\n    \"static-server\": \"2.2.1\",\n    \"ts-jest\": \"26.5.1\",\n    \"ts-loader\": \"7.0.0\",\n    \"ts-node\": \"8.8.2\",\n    \"tslint\": \"6.1.1\",\n    \"typescript\": \"4.5.4\",\n    \"webpack\": \"4.46.0\",\n    \"webpack-cli\": \"4.5.0\"\n  },\n  \"dependencies\": {\n    \"flat-cache\": \"^3.0.0\",\n    \"googleapis\": \"^67.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/common/interfaces.ts",
    "content": "export interface Neighbors {\n  [key: string]: number;\n}\n\nexport interface Graph {\n  [key: string]: Neighbors;\n}\n\nexport interface Module {\n  modulePath: string;\n  parentModulePath: string;\n}\n\nexport interface RoutingModule {\n  path: string;\n  modulePath: string;\n  parentModulePath: string | null;\n  lazy: boolean;\n  redirectTo?: string;\n}\n\nexport interface Connection {\n  from: string;\n  weight: number;\n  to: string;\n}\n\nexport interface Period {\n  startDate: Date;\n  endDate: Date;\n}\n\nexport enum ProjectType {\n  AngularCLI = 'angular-cli',\n  CreateReactApp = 'create-react-app',\n  PreactCLI = 'preact-cli',\n  Gatsby = 'gatsby',\n  CreateReactAppTypeScript = 'create-react-app-typescript'\n}\n\nexport interface ProjectLayout {\n  typescript?: string;\n  tsconfigPath?: string;\n  sourceDir?: string;\n}\n\nexport interface ProjectMetadata {\n  type: ProjectType;\n  version: string;\n  details?: ProjectLayout;\n}\n"
  },
  {
    "path": "packages/common/logger.ts",
    "content": "export enum LogLevel {\n  DEBUG,\n  INFO,\n  WARN,\n  ERROR,\n  OFF\n}\n\nexport class Logger {\n  constructor(private level = LogLevel.INFO) {}\n\n  setLevel(newLevel: LogLevel) {\n    this.level = newLevel;\n  }\n\n  debug(...msg: any[]) {\n    this.print(LogLevel.DEBUG, 'DEBUG', msg);\n  }\n\n  info(...msg: any[]) {\n    this.print(LogLevel.INFO, 'INFO', msg);\n  }\n\n  warn(...msg: any[]) {\n    this.print(LogLevel.WARN, 'WARN', msg);\n  }\n\n  error(...msg: any[]) {\n    this.print(LogLevel.ERROR, 'ERROR', msg);\n  }\n\n  private print(level: LogLevel, label: string, msg: any[]) {\n    if (level >= this.level) {\n      switch (level) {\n        case LogLevel.DEBUG:\n          console.debug(this.prettify(label), ...msg);\n          break;\n        case LogLevel.INFO:\n          console.info(this.prettify(label), ...msg);\n          break;\n        case LogLevel.WARN:\n          console.warn(this.prettify(label), ...msg);\n          break;\n        case LogLevel.ERROR:\n          console.error(this.prettify(label), ...msg);\n          break;\n        default:\n          console.log(this.prettify(label), ...msg);\n          break;\n      }\n    }\n  }\n\n  private prettify(label: string) {\n    return `${label}::${Date.now()}::`;\n  }\n}\n"
  },
  {
    "path": "packages/guess-ga/.npmignore",
    "content": "node_modules\nsrc\ntest\nindex.ts\ntsconfig.json\nwebpack.config.js\n"
  },
  {
    "path": "packages/guess-ga/README.md",
    "content": "# GA\n\nFetches data from Google analytics.\n\n## Setup\n\n### Create Your Credentials\n\n#### i) Create a Service Account\n\n1. Go to the [Credentials](https://console.developers.google.com/apis/credentials) page in the Google APIs console. \n\n2. If you don't have an existing Google Cloud project, click \"Create\" to create a new project. Otherwise, use the dropdown in the upper left corner to select the existing project that you'd like to use.\n\n3. Select \"Service Account key\" from the \"Create credentials\" dropdown.\n\n4. Fill out the form for creating a service account key:\n- **Service account dropdown:** Select \"New Service Account\".\n- **Service account name:** Give your service account a name.\n- **Role:** Select \"Service Account User\" (\"Service Accounts\" > \"Service Account User\").\n- **Service account ID:** This field will automatically be pre-filled, but you can change this if you would like.\n- **Key type:** Select JSON key.\n\n*This should start a download of the credentials file*\n\n### Configure Google Analytics\n\n#### i) Add service account to Google Analytics\nThe service account that you just created needs to be added as a user to your Google analytics account.\n1. Login to your [Google Analytics](https://analytics.google.com/analytics/web/) account.\n2. Add a new user. (Admin > User Management > + > Add New Users)\n- **Email Address** The email address of the service account you created. It should look something like this: example@example-project-123456.iam.gserviceaccount.com.\n- **Permissions:** Select \"Read & Analyze.\"\n\n*Note: A service account can only be associated with one Google Analytics account at a time. Thus, if you want to use predictive fetching on multiple sites, you'll need to create a separate service account for each.*\n\n#### ii) Enable the Google Analytics Reporting API\nYou can enable this [here.](https://console.developers.google.com/flows/enableapi?apiid=analyticsreporting.googleapis.com&credential=client_key)\n\n### Set up credentials\n\nTo use the credentials in your project, copy it your project,\nand make sure to add it or its folder to gitignore.\nYou can also opt to take `client_email` and `private_key` from the credentials file, and add them to env.\n\n### Get your view ID\nTo find your view ID, go to [Google Analytics](https://analytics.google.com/analytics/web/).\nClick the accounts dropdown (it's located in the upper lefthand corner  of the screen, right next to the Google Analytics logo). The dialog that opens will have three columns: Analytics Accounts, Properties & Apps, & Views. The far right column (\"Views\") will contain the View ID for your site.\n\nYou can opt to save this in an .env file if you do not want to share this information.\n\n## Usage\n\n```bash\nnpm i guess-ga\n```\n\nCombined with `guess-parser` you can aggregate the route information and map it to your application's parametrized routes:\n\n```ts\nconst { fetch } = require('guess-ga');\nconst { parseRoutes, ProjectType } = require('guess-parser');\nconst { JWT } = require('google-auth-library');\nconst { writeFileSync } = require('fs');\n\nconst credentials = require('./secret/credentials.json');\n\nconst auth = new JWT(\n  credentials.client_email,\n  null,\n  credentials.private_key,\n  ['https://www.googleapis.com/auth/analytics.readonly']\n);\n\nconst viewId = '000000000';\n\nconst applicationRoutes = parseRoutes('tsconfig.app.json', ProjectType.Angular);\n\nfetch({\n  auth,\n  viewId,\n  period: {\n    startDate: new Date('2018-1-1'),\n    endDate: new Date(Date.now())\n  },\n  formatter: r => r.replace('/app', ''),\n  routes: applicationRoutes.map(f => f.path)\n}).then(g => {\n  writeFileSync('data.json', JSON.stringify(g, null, 2));\n});\n```\n\nFor more details visit [https://github.com/guess-js/guess](https://github.com/guess-js/guess).\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/guess-ga/index.ts",
    "content": "export * from './src/ga';\n"
  },
  {
    "path": "packages/guess-ga/package.json",
    "content": "{\n  \"name\": \"guess-ga\",\n  \"version\": \"0.4.20\",\n  \"description\": \"Fetch structured data from Google Analytics\",\n  \"main\": \"dist/guess-ga/index.js\",\n  \"types\": \"dist/guess-ga/index.d.ts\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/guess-js/guess\"\n  },\n  \"keywords\": [\n    \"bundling\",\n    \"webpack\",\n    \"ml\",\n    \"ai\",\n    \"google analytics\",\n    \"ga\",\n    \"analytics\",\n    \"recommendation\"\n  ],\n  \"author\": \"Minko Gechev <mgechev@gmail.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/guess-js/guess/issues\"\n  },\n  \"homepage\": \"https://github.com/guess-js/guess#readme\",\n  \"dependencies\": {\n    \"googleapis\": \"^67.0.0\"\n  },\n  \"devDependencies\": {\n    \"ts-loader\": \"7.0.0\",\n    \"typescript\": \"4.5.4\"\n  },\n  \"files\": [\n    \"dist\"\n  ],\n  \"jest\": {\n    \"transform\": {\n      \"^.+\\\\.tsx?$\": \"ts-jest\"\n    },\n    \"testRegex\": \"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$\",\n    \"moduleFileExtensions\": [\n      \"ts\",\n      \"tsx\",\n      \"js\",\n      \"jsx\",\n      \"json\",\n      \"node\"\n    ]\n  },\n  \"scripts\": {\n    \"build\": \"webpack\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-ga/src/client.ts",
    "content": "import { Period } from '../../common/interfaces';\n\ninterface PageConfig {\n  pageToken: number | undefined;\n  pageSize: number;\n}\n\ninterface AnalyticsResult {\n  report: any;\n  nextPage: number;\n}\n\nconst formatNumber = (n: number) => (n.toString().length === 1 ? '0' + n : n);\n\nconst formatDate = (d: Date) => `${d.getFullYear()}-${formatNumber(d.getMonth() + 1)}-${formatNumber(d.getDate())}`;\n\nfunction requestBuilder(jwtClient: any, viewId: string, pageConfig: PageConfig, period: Period, expression: string) {\n  return {\n    auth: jwtClient,\n    resource: {\n      reportRequests: {\n        pageSize: pageConfig.pageSize,\n        pageToken: pageConfig.pageToken,\n        viewId,\n        dateRanges: [\n          {\n            startDate: formatDate(period.startDate),\n            endDate: formatDate(period.endDate)\n          }\n        ],\n        dimensions: [{ name: 'ga:previousPagePath' }, { name: 'ga:pagePath' }],\n        metrics: [{ expression }],\n        orderBys: [{ fieldName: expression, sortOrder: 'DESCENDING' }]\n      }\n    }\n  };\n}\n\nasync function fetchReport(\n  client: any,\n  jwtClient: any,\n  viewId: string,\n  pageConfig: PageConfig,\n  period: Period,\n  expression: string\n) {\n  return new Promise<AnalyticsResult>((resolve, reject) => {\n    client.reports.batchGet(requestBuilder(jwtClient, viewId, pageConfig, period, expression), function(\n      err: any,\n      response: any\n    ) {\n      if (err) {\n        reject(err);\n        return;\n      }\n      const nextPage = response.data.reports[0].nextPageToken;\n      const report = response.data.reports[0];\n      resolve({\n        report,\n        nextPage\n      });\n    });\n  });\n}\n\nif (typeof (Symbol as any).asyncIterator === 'undefined') {\n  (Symbol as any).asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator');\n}\n\nexport type GaResult = any;\n\nexport interface ClientResult {\n  error?: GaResult;\n  report?: any;\n}\n\nexport function getClient(jwtClient: any, pageSize: number, viewId: string, period: Period, expression: string) {\n  const { google } = require('googleapis');\n  const client = google.analyticsreporting('v4');\n  const pageConfig: PageConfig = {\n    pageSize,\n    pageToken: undefined\n  };\n\n  async function* reportGenerator(): AsyncIterableIterator<ClientResult> {\n    while (true) {\n      const clientResult: ClientResult = {};\n      try {\n        const result = await fetchReport(client, jwtClient, viewId, pageConfig, period, expression);\n        clientResult.report = result.report;\n        pageConfig.pageToken = result.nextPage;\n      } catch (e) {\n        clientResult.error = e;\n      }\n      yield clientResult;\n      if (!pageConfig.pageToken) {\n        break;\n      }\n    }\n  }\n\n  return reportGenerator;\n}\n"
  },
  {
    "path": "packages/guess-ga/src/ga.ts",
    "content": "import { getClient } from './client';\nimport { normalize } from './normalize';\nimport { Graph, Period } from '../../common/interfaces';\n\nconst PageSize = 10000;\nconst id = (r: string) => r;\nconst DefaultExpression = 'ga:pageviews';\n\nexport interface FetchConfig {\n  auth: any;\n  viewId: string;\n  period: Period;\n  formatter?: (route: string) => string;\n  routes?: string[];\n  expression?: string;\n}\n\nexport async function fetch(config: FetchConfig) {\n  const client = getClient(config.auth, PageSize, config.viewId, config.period, config.expression || DefaultExpression);\n  const graph: Graph = {};\n  for await (const val of client()) {\n    if (val.error) {\n      throw val.error;\n    }\n    const result = val.report;\n    normalize(result.data, config.formatter || id, config.routes || []).forEach((n: any) => {\n      const r = graph[n.from] || {};\n      r[n.to] = n.weight + (r[n.to] || 0);\n      graph[n.from] = r;\n    });\n  }\n  return graph;\n}\n"
  },
  {
    "path": "packages/guess-ga/src/normalize.ts",
    "content": "import { Connection } from '../../common/interfaces';\n\nexport const matchRoute = (route: string, declaration: string): boolean => {\n  const routeParts: string[] = route.split('/');\n  const declarationParts: string[] = declaration.split('/');\n\n  if (routeParts.length !== declarationParts.length) {\n    return false;\n  } else {\n    return declarationParts.reduce((a: boolean, p: string, i: number) => {\n      if (p.startsWith(':')) {\n        return a;\n      }\n      return a && p === routeParts[i];\n    }, true);\n  }\n};\n\nconst findRoute = (d: string[], r: string) =>\n  d.filter(def => def.indexOf(':') < 0).find(c => matchRoute(r, c)) || d.find(c => matchRoute(r, c)) || r;\n\nconst processRoute = (declarations: string[], route: string) => findRoute(declarations, route.split('?')[0]);\n\nexport const normalize = (data: any, formatter: (s: string) => string, declarations: string[]) => {\n  return (data.rows || [])\n    .map((r: any) => {\n      return {\n        from: processRoute(declarations, formatter(r.dimensions[0])),\n        to: processRoute(declarations, formatter(r.dimensions[1])),\n        weight: parseInt(r.metrics[0].values[0], 10)\n      };\n    })\n    .filter((node: Connection) => node.from !== '(entrance)' && node.from !== node.to);\n};\n"
  },
  {
    "path": "packages/guess-ga/test/normalize.spec.ts",
    "content": "import { matchRoute, normalize } from '../src/normalize';\n\nconst GAData = {\n  rows: [\n    {\n      dimensions: ['/a', '/b'],\n      metrics: [\n        {\n          values: [1]\n        }\n      ]\n    },\n    {\n      dimensions: ['/a/4', '/c'],\n      metrics: [\n        {\n          values: [1]\n        }\n      ]\n    },\n    {\n      dimensions: ['/a/3', '/c'],\n      metrics: [\n        {\n          values: [1]\n        }\n      ]\n    },\n    {\n      dimensions: ['/a', '/a/3'],\n      metrics: [\n        {\n          values: [1]\n        }\n      ]\n    }\n  ]\n};\n\ndescribe('matchRoute', () => {\n  it('should work simple routes', () => {\n    expect(matchRoute('/', '/')).toBeTruthy();\n    expect(matchRoute('/foo', '/foo')).toBeTruthy();\n    expect(matchRoute('/bar/baz', '/bar/baz')).toBeTruthy();\n  });\n\n  it('should work with parameters', () => {\n    expect(matchRoute('/bar', '/:random')).toBeTruthy();\n    expect(matchRoute('/foo/1', '/foo/:id')).toBeTruthy();\n  });\n\n  it('should fail with trailing slash', () => {\n    expect(matchRoute('/foo', '/foo/')).toBeFalsy();\n  });\n});\n\ndescribe('normalize', () => {\n  it('should work without a trailing slash', () => {\n    const normalized = normalize(GAData, a => a, ['/a/', '/b', '/a/:id', 'c']);\n    expect(normalized).toEqual([\n      { from: '/a', to: '/b', weight: 1 },\n      { from: '/a/:id', to: '/c', weight: 1 },\n      { from: '/a/:id', to: '/c', weight: 1 },\n      { from: '/a', to: '/a/:id', weight: 1 }\n    ]);\n  });\n});\n"
  },
  {
    "path": "packages/guess-ga/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"module\": \"commonjs\",\n    \"sourceMap\": true,\n    \"declaration\": true,\n    \"experimentalDecorators\": true,\n    \"strict\": true,\n    \"outDir\": \"dist\",\n    \"downlevelIteration\": true,\n    \"lib\": [\"es2015\", \"esnext\", \"dom\"]\n  },\n  \"files\": [\"index.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-ga/webpack.config.js",
    "content": "module.exports = {\n  mode: 'production',\n  entry: './index.ts',\n  target: 'node',\n  output: {\n    filename: './guess-ga/index.js',\n    libraryTarget: 'umd'\n  },\n  externals: [/^(@|\\w{3}(?<!\\w:\\\\)).*$/i],\n  resolve: {\n    // Add `.ts` and `.tsx` as a resolvable extension.\n    extensions: ['.ts', '.js', '.json']\n  },\n  module: {\n    rules: [\n      // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`\n      { test: /\\.tsx?$/, loader: 'ts-loader' }\n    ]\n  }\n};\n"
  },
  {
    "path": "packages/guess-parser/.npmignore",
    "content": "node_modules\nsrc\ntest\nindex.ts\ntsconfig.json\nwebpack.config.js\n"
  },
  {
    "path": "packages/guess-parser/README.md",
    "content": "# guess-parser\n\nThis module is used for route extraction by the `GuessPlugin`. The module exports several functions:\n\n## Usage\n\n```bash\nnpm i guess-parser --save-dev\n```\n\n## API\n\n* `detect(path: string)` - Detects the project type and returns metadata. For the currently supported projects see the `ProjectMetadata` interface.\n* `parseRoutes(path: string)` - Extracts the routes of the application in `path`. Internally uses the `detect` function.\n* `parseAngularRoutes(tsconfig: string)` - Extracts the routes of an Angular application. As arguments the function accepts path to the `tsconfig.json` file of the project.\n* `parseReactJSXRoutes(path: string)` - Extracts the routes from React JSX project. See the supported syntax below.\n* `parseReactTSXRoutes(tsconfig: string)` - Extracts the routes from React TypeScript projects which uses JSX by `tsconfig.json` file. See the supported syntax below.\n\n```ts\nexport interface ProjectMetadata {\n  type: ProjectType;\n  version: string;\n  details?: ProjectLayout;\n}\n\nexport enum ProjectType {\n  AngularCLI = 'angular-cli',\n  CreateReactApp = 'create-react-app',\n  Gatsby = 'gatsby',\n  CreateReactAppTypeScript = 'create-react-app-typescript'\n}\n\nexport interface ProjectLayout {\n  typescript?: string;\n  tsconfigPath?: string;\n  sourceDir?: string;\n}\n```\n\n## Supported Syntax\n\n### Angular\n\nBecause of the produced summaries by the Angular compiler the Angular parser supports most Angular CLI applications as well as most starters.\n\n### React\n\nBecause of the dynamic nature of React and lack of standard route definition syntax, only applications using the following convention can be successfully parsed:\n\n```jsx\n<Router history={history}>\n  <div className=\"App\">\n    <Link to=\"/intro\">Intro</Link>\n    <Link to=\"/main\">Main</Link>\n    <div>\n      <Switch>\n        <Redirect exact={true} from=\"/\" to=\"/intro\" />\n        <Route path=\"/intro\" component={AsyncComponent(() => import('./intro/Intro'))} />\n        <Route path=\"/main\" component={Main} />\n      </Switch>\n    </div>\n  </div>\n</Router>\n```\n\nCurrently, there are several important conventions:\n\n* Support only for JSX syntax\n* Support only for `react-router`-like syntax\n* The path attribute of the `<Route/>` element must have value of type string literal.\n* The lazy-loaded components should have dynamic import with the following structure of the AST:\n  * `CallExpression` (e.g. `AsyncComponent`) with a single argument\n  * The type of the argument should be an `ArrowFunction`\n  * The arrow function should have an expression as body (e.g. `CallExpression`)\n  * To the `CallExpression` should be passed a `StringLiteral` which points to the lazy-loaded module\n\n**Contributions aiming to extend the supported syntax are very welcome!**\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/guess-parser/index.ts",
    "content": "export { parseRoutes } from './src/parser';\nexport { detect } from './src/detector';\nexport { parseRoutes as parseAngularRoutes } from './src/angular';\nexport * from './src/react';\nexport * from './src/preact';\n"
  },
  {
    "path": "packages/guess-parser/package.json",
    "content": "{\n  \"name\": \"guess-parser\",\n  \"version\": \"0.4.22\",\n  \"description\": \"Finds the route declarations in your application.\",\n  \"main\": \"dist/guess-parser/index.js\",\n  \"types\": \"dist/guess-parser/index.d.ts\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/guess-js/guess\"\n  },\n  \"keywords\": [\n    \"bundling\",\n    \"webpack\",\n    \"ml\",\n    \"ai\",\n    \"analytics\",\n    \"recommendation\"\n  ],\n  \"author\": \"Minko Gechev <mgechev@gmail.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/guess-js/guess/issues\"\n  },\n  \"homepage\": \"https://github.com/guess-js/guess#readme\",\n  \"dependencies\": {\n    \"ts-evaluator\": \"0.1.0\"\n  },\n  \"devDependencies\": {\n    \"ts-loader\": \"7.0.0\"\n  },\n  \"peerDependencies\": {\n    \"typescript\": \">=3.7.5\"\n  },\n  \"files\": [\n    \"dist\"\n  ],\n  \"jest\": {\n    \"transform\": {\n      \"^.+\\\\.tsx?$\": \"ts-jest\"\n    },\n    \"testRegex\": \"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$\",\n    \"moduleFileExtensions\": [\n      \"ts\",\n      \"tsx\",\n      \"js\",\n      \"jsx\",\n      \"json\",\n      \"node\"\n    ]\n  },\n  \"scripts\": {\n    \"build\": \"webpack\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/src/angular/index.ts",
    "content": "export * from './route-parser';\n"
  },
  {
    "path": "packages/guess-parser/src/angular/modules.ts",
    "content": "import * as ts from 'typescript';\nimport { resolve, join, dirname, sep } from 'path';\nimport { existsSync } from 'fs';\nimport { LazyRoute, Route, readLoadChildren } from './routes';\nimport { RoutingModule } from '../../../common/interfaces';\n\n\ninterface RoutesDeclaration {\n  lazyRoutes: LazyRoute[];\n  eagerRoutes: Route[];\n}\n\nexport interface Registry {\n  [path: string]: RoutesDeclaration;\n}\n\nexport const findRootModule = (registry: Registry): string => {\n  const childModules = new Set<string>();\n  const traverseRoute = (route: Route) => {\n    if ((route as LazyRoute).module) {\n      childModules.add((route as LazyRoute).module);\n    }\n    route.children.forEach(traverseRoute);\n  };\n  const allModulePaths = Object.keys(registry);\n  allModulePaths.forEach(path => {\n    const declaration = registry[path];\n    // It's possible if the declaration does not exist\n    // See https://github.com/guess-js/guess/issues/311\n    if (declaration) {\n      declaration.eagerRoutes.forEach(traverseRoute);\n      declaration.lazyRoutes.forEach(traverseRoute);\n    }\n  });\n  const roots = allModulePaths.filter(m => !childModules.has(m));\n  if (roots.length > 1) {\n    throw new Error('Multiple root routing modules found ' + roots.join(', '));\n  }\n  return roots[0];\n};\n\nexport const collectRoutingModules = (\n  rootFile: string,\n  registry: Registry,\n  result: RoutingModule[],\n  parentFilePath: string = rootFile,\n  currentRoutePath: string = '',\n  existing = new Set<string>()\n) => {\n  const declaration = registry[rootFile];\n\n  // It's possible if the declaration does not exist\n  // See https://github.com/guess-js/guess/issues/311\n  if (!declaration) {\n    return;\n  }\n\n  const process = (r: Route, routePath = currentRoutePath) => {\n    if ((r as LazyRoute).module) {\n      // tslint:disable-next-line: no-use-before-declare\n      return processLazyRoute(r as LazyRoute, routePath);\n    }\n    // tslint:disable-next-line: no-use-before-declare\n    return processRoute(r, routePath);\n  };\n\n  const processRoute = (r: Route, routePath = currentRoutePath) => {\n    const path = (routePath + '/' + r.path).replace(/\\/$/, '');\n    r.children.forEach(route => process(route, path));\n    if (!existing.has(path)) {\n      const routingModule: RoutingModule = {\n        path,\n        lazy: parentFilePath !== rootFile && r.redirectTo === undefined,\n        modulePath: rootFile,\n        parentModulePath: parentFilePath,\n      };\n      if (r.redirectTo !== undefined) {\n        routingModule.redirectTo = r.redirectTo;\n      }\n      result.push(routingModule);\n      existing.add(path);\n    }\n  };\n\n  const processLazyRoute = (r: LazyRoute, routePath = currentRoutePath) => {\n    const path = (routePath + '/' + r.path).replace(/\\/$/, '');\n    r.children.forEach(route => process(route, path));\n    collectRoutingModules(r.module, registry, result, rootFile, path);\n  };\n\n  declaration.eagerRoutes.forEach(r => processRoute(r));\n  declaration.lazyRoutes.forEach(r => processLazyRoute(r));\n};\n\nexport const findMainModule = (program: ts.Program) => {\n  const tryFindMainModule = (n: ts.Node, sf: ts.SourceFile) => {\n    if (\n      n.kind === ts.SyntaxKind.Identifier &&\n      (n as ts.Identifier).text === 'bootstrapModule'\n    ) {\n      const propAccess = (n as ts.Identifier).parent;\n      if (\n        !propAccess ||\n        propAccess.kind !== ts.SyntaxKind.PropertyAccessExpression\n      ) {\n        return null;\n      }\n      const tempExpr = propAccess.parent;\n      if (!tempExpr || tempExpr.kind !== ts.SyntaxKind.CallExpression) {\n        return null;\n      }\n      const expr = tempExpr as ts.CallExpression;\n      const module = expr.arguments[0];\n      const tc = program.getTypeChecker();\n      const symbol = tc.getTypeAtLocation(module).getSymbol();\n      if (!symbol) {\n        return null;\n      }\n      const decl = symbol.getDeclarations();\n      if (!decl) {\n        return null;\n      }\n      return resolve(decl[0].getSourceFile().fileName);\n    }\n    let mainPath: null | string = null;\n    n.forEachChild(c => {\n      if (mainPath) {\n        return mainPath;\n      }\n      mainPath = tryFindMainModule(c, sf);\n    });\n    return mainPath;\n  };\n  return program.getSourceFiles().reduce((a, sf) => {\n    if (a) {\n      return a;\n    }\n    let mainPath: null | string = null;\n    sf.forEachChild(n => {\n      if (mainPath) {\n        return;\n      }\n      mainPath = tryFindMainModule(n, sf);\n    });\n    return mainPath;\n  }, null);\n};\n\nconst isImportDeclaration = (node: ts.Node): node is ts.ImportDeclaration => {\n  return node.kind === ts.SyntaxKind.ImportDeclaration;\n};\n\nconst isReExportDeclaration = (node: ts.Node): node is ts.ExportDeclaration => {\n  return (node.kind === ts.SyntaxKind.ExportDeclaration && (node as ts.ExportDeclaration).exportClause === undefined);\n};\n\nconst normalizeFilePath = (path: string): string => {\n  return join(...path.split(/\\//).map((part, index) => (part === '' && index === 0) ? sep : part));\n};\n\nexport const getModulePathFromRoute = (parentPath: string, loadChildren: string, program: ts.Program, host: ts.CompilerHost) => {\n  const childModule = loadChildren.split('#')[0];\n  const { resolvedModule } = ts.resolveModuleName(childModule, parentPath, program.getCompilerOptions(), host);\n  if (resolvedModule) {\n    return normalizeFilePath(resolvedModule.resolvedFileName);\n  }\n  const childModuleFile = childModule + '.ts';\n  const parentSegments = dirname(parentPath).split(sep);\n  const childSegments = childModuleFile.split('/');\n  const max = Math.min(parentSegments.length, childSegments.length);\n  let maxCommon = 0;\n  for (let i = 1; i < max; i += 1) {\n    for (let j = 0; j < i; j += 1) {\n      let common = 0;\n      if (parentSegments[parentSegments.length - 1 - j] === childSegments[j]) {\n        common++;\n        maxCommon = Math.max(maxCommon, common);\n      } else {\n        // breaking here\n        common = 0;\n        j = i;\n      }\n    }\n  }\n\n  const path = join(\n    dirname(parentPath),\n    childModuleFile\n      .split('/')\n      .slice(maxCommon, childSegments.length)\n      .join('/')\n  );\n\n  // This early failure provides better error message compared to the\n  // generic \"Multiple root routing modules\" error.\n  if (!existsSync(path)) {\n    throw new Error(`The relative path \"${loadChildren}\" to \"${parentPath}\" cannot be resolved to a module`);\n  }\n  return path;\n};\n\nconst imports = (\n  parent: string,\n  child: string,\n  program: ts.Program,\n  host: ts.CompilerHost,\n  importCache: {[parent: string]: {[child: string]: boolean}},\n  visited: { [key: string]: boolean } = {}\n) => {\n  if (importCache[parent] && importCache[parent][child] !== undefined) {\n    return importCache[parent][child];\n  }\n  importCache[parent] = importCache[parent] || {};\n  const sf = program.getSourceFile(parent);\n  if (!sf) {\n    importCache[parent][child] = false;\n    return false;\n  }\n  if (visited[parent]) {\n    importCache[parent][child] = false;\n    return false;\n  }\n  visited[parent] = true;\n  let found = false;\n  sf.forEachChild(n => {\n    if (found) {\n      return;\n    }\n    if (!isImportDeclaration(n) && !isReExportDeclaration(n)) {\n      return;\n    }\n    const path = (n.moduleSpecifier as ts.StringLiteral).text;\n    const { resolvedModule } = ts.resolveModuleName(path, parent, program.getCompilerOptions(), host);\n    if (resolvedModule === undefined) {\n      return;\n    }\n\n    const fullPath = normalizeFilePath(resolvedModule.resolvedFileName);\n    if (fullPath === child) {\n      found = true;\n    }\n    // We don't want to dig into node_modules to find an entry point.\n    if (!found && existsSync(fullPath) && !fullPath.includes('node_modules')) {\n      found = imports(fullPath, child, program, host, importCache, visited);\n    }\n  });\n  importCache[parent][child] = found;\n  return found;\n};\n\n\nlet cache: { [parent: string]: { [child: string]: boolean } } = {};\n\nexport const cleanModuleCache = () => (cache = {});\n\n// This can potentially break if there's a lazy module\n// that is not only loaded lazily but also imported\n// inside of a parent module.\n//\n// For example, `app.module.ts` lazily loads `bar.module.ts`\n// in the same time `app.module.ts` imports `bar.module.ts`\n// this way the module entry point will be `app.module.ts`.\nexport const getModuleEntryPoint = (\n  path: string,\n  entryPoints: Set<string>,\n  program: ts.Program,\n  host: ts.CompilerHost\n): string => {\n  const parents = [...entryPoints].filter(e => imports(e, path, program, host, cache));\n  // If no parents, this could be the root module\n  if (parents.length === 0) {\n    return path;\n  }\n  if (parents.length > 1) {\n    throw new Error(\n      `Module ${path} belongs to more than one module: ${parents.join(', ')}`\n    );\n  }\n  return parents[0];\n};\n\nexport const getLazyEntryPoints = (\n  node: ts.ObjectLiteralExpression,\n  program: ts.Program,\n  host: ts.CompilerHost\n) => {\n  const value = readLoadChildren(node, program.getTypeChecker());\n  if (!value) {\n    return null;\n  }\n\n  const parent = resolve(node.getSourceFile().fileName);\n  const module = getModulePathFromRoute(parent, value, program, host);\n  return module;\n};\n"
  },
  {
    "path": "packages/guess-parser/src/angular/route-parser.ts",
    "content": "import * as ts from 'typescript';\nimport { RoutingModule } from '../../../common/interfaces';\nimport { existsSync, readFileSync } from 'fs';\nimport { dirname, resolve, join } from 'path';\nimport {\n  findMainModule,\n  getLazyEntryPoints,\n  getModuleEntryPoint,\n  Registry,\n  collectRoutingModules,\n  findRootModule,\n  cleanModuleCache\n} from './modules';\nimport { LazyRoute, isRoute, getRoute, readChildren } from './routes';\n\nexport interface Options {\n  redirects: boolean;\n}\n\nconst defaultOptions: Options = {\n  redirects: false,\n};\n\nconst normalizeOptions = (options: Partial<Options>) => ({\n  ...defaultOptions,\n  ...options,\n});\n\nexport const parseRoutes = (\n  tsconfig: string,\n  exclude: string[] = [],\n  inputOptions: Partial<Options> = {}\n): RoutingModule[] => {\n\n  const options = normalizeOptions(inputOptions);\n  cleanModuleCache();\n  const parseConfigHost: ts.ParseConfigHost = {\n    fileExists: existsSync,\n    readDirectory: ts.sys.readDirectory,\n    readFile: file => readFileSync(file, 'utf8'),\n    useCaseSensitiveFileNames: true\n  };\n  const config = ts.readConfigFile(tsconfig, path =>\n    readFileSync(path).toString()\n  );\n  const parsed = ts.parseJsonConfigFileContent(\n    config.config,\n    parseConfigHost,\n    resolve(dirname(tsconfig)),\n    {\n      noEmit: true\n    }\n  );\n\n  const host = ts.createCompilerHost(parsed.options, true);\n  const program = ts.createProgram(parsed.fileNames, parsed.options, host);\n  const typeChecker = program.getTypeChecker();\n\n  const toAbsolute = (file: string) =>\n    file.startsWith('/') || file.startsWith(process.cwd()) ? file : join(process.cwd(), file);\n  const excludeFiles = new Set<string>(exclude.map(toAbsolute));\n\n  const visitTopLevelRoutes = (\n    s: ts.SourceFile,\n    callback: (routeObj: ts.Node) => void,\n    n: ts.Node\n  ) => {\n    if (excludeFiles.has(resolve(s.fileName))) {\n      return;\n    }\n    if (!n) {\n      return;\n    }\n    if (isRoute(n, typeChecker, options.redirects)) {\n      callback(n);\n    } else {\n      n.forEachChild(visitTopLevelRoutes.bind(null, s, callback));\n    }\n  };\n\n  const mainPath = findMainModule(program);\n  if (!mainPath) {\n    throw new Error('Cannot find the main application module');\n  }\n\n  const entryPoints: Set<string> = new Set([mainPath]);\n  const collectEntryPoints = (n: ts.Node) => {\n    const path = getLazyEntryPoints(\n      n as ts.ObjectLiteralExpression,\n      program,\n      host\n    );\n    if (!path) {\n      const childrenArray = readChildren(n as ts.ObjectLiteralExpression);\n      if (childrenArray) {\n        childrenArray.forEach(collectEntryPoints);\n      }\n      return;\n    }\n    entryPoints.add(path);\n  };\n  program.getSourceFiles().map(s => {\n    s.forEachChild(\n      visitTopLevelRoutes.bind(null, s, collectEntryPoints)\n    );\n  });\n\n  const registry: Registry = {};\n\n  program.getSourceFiles().map(s => {\n    s.forEachChild(\n      visitTopLevelRoutes.bind(null, s, (n: ts.Node) => {\n        const path = resolve(n.getSourceFile().fileName);\n        const route = getRoute(\n          n as ts.ObjectLiteralExpression,\n          entryPoints,\n          program,\n          host\n        );\n        if (!route) {\n          return;\n        }\n\n        const modulePath = getModuleEntryPoint(path, entryPoints, program, host);\n        const current = registry[modulePath] || {\n          lazyRoutes: [],\n          eagerRoutes: []\n        };\n        if ((route as LazyRoute).module) {\n          current.lazyRoutes.push(route as LazyRoute);\n        } else {\n          current.eagerRoutes.push(route);\n        }\n        registry[modulePath] = current;\n      })\n    );\n  });\n\n  const result: RoutingModule[] = [];\n  if (Object.keys(registry).length > 0) {\n    collectRoutingModules(findRootModule(registry), registry, result);\n  }\n\n  return result;\n};\n"
  },
  {
    "path": "packages/guess-parser/src/angular/routes.ts",
    "content": "import * as ts from 'typescript';\nimport { evaluate } from 'ts-evaluator';\nimport { getModuleEntryPoint, getModulePathFromRoute } from './modules';\nimport { resolve } from 'path';\n\nconst getObjectProp = (\n  node: ts.ObjectLiteralExpression,\n  prop: string\n): ts.Expression | null => {\n  const vals = node.properties.values();\n  for (const val of vals) {\n    if (val.kind !== ts.SyntaxKind.PropertyAssignment) {\n      continue;\n    }\n    const value = val as ts.PropertyAssignment;\n    if (value.name.kind !== ts.SyntaxKind.Identifier) {\n      continue;\n    }\n    const name = value.name.text;\n    if (name === prop) {\n      return value.initializer;\n    }\n  }\n  return null;\n};\n\nexport const readLoadChildren = (\n  node: ts.ObjectLiteralExpression,\n  typeChecker: ts.TypeChecker\n): string | null => {\n  const expr = getObjectProp(node, 'loadChildren');\n  if (!expr) {\n    return null;\n  }\n  if (expr.kind === ts.SyntaxKind.StringLiteral) {\n    return (expr as ts.StringLiteral).text;\n  }\n  let result: string | null = null;\n  const visitor = (n: ts.Node) => {\n    if (n.kind === ts.SyntaxKind.ImportKeyword) {\n      const parent = n.parent as ts.CallExpression;\n      const arg = parent.arguments[0];\n      const res = evaluate({\n        node: arg,\n        typeChecker: typeChecker\n      });\n      if (res.success) {\n        result = res.value as string;\n      }\n    }\n    if (result) {\n      return;\n    }\n    n.forEachChild(visitor);\n  };\n  expr.forEachChild(visitor);\n  // Fallback to when loadChildren looks like:\n  // loadChildren: 'foo' + '/' + 'bar'\n  if (!result) {\n    const res = evaluate({\n      node: expr,\n      typeChecker: typeChecker\n    });\n    if (res.success) {\n      result = res.value as string;\n    }\n  }\n  return result;\n};\n\nconst readPath = (\n  node: ts.ObjectLiteralExpression,\n  typeChecker: ts.TypeChecker\n): string | null => {\n  const expr = getObjectProp(node, 'path');\n  if (!expr) {\n    return null;\n  }\n  const val = evaluate({\n    node: expr,\n    typeChecker\n  });\n  if (val.success) {\n    return val.value as string;\n  }\n  return null;\n};\n\nconst readRedirect = (\n  node: ts.ObjectLiteralExpression,\n  typeChecker: ts.TypeChecker\n): string | null => {\n  const expr = getObjectProp(node, 'redirectTo');\n  if (!expr) {\n    return null;\n  }\n  const val = evaluate({\n    node: expr,\n    typeChecker\n  });\n  if (val.success) {\n    return val.value as string;\n  }\n  return null;\n};\n\nexport const readChildren = (\n  node: ts.ObjectLiteralExpression,\n): ts.NodeArray<ts.Node> | null => {\n  const expr = getObjectProp(node, 'children');\n  if (!expr) {\n    return null;\n  }\n  return (expr as ts.ArrayLiteralExpression).elements;\n};\n\nexport interface Route {\n  path: string;\n  children: Route[];\n  redirectTo?: string;\n}\n\nexport interface LazyRoute extends Route {\n  module: string;\n}\n\nexport const getRoute = (\n  node: ts.ObjectLiteralExpression,\n  entryPoints: Set<string>,\n  program: ts.Program,\n  host: ts.CompilerHost\n): Route | null => {\n  const path = readPath(node, program.getTypeChecker());\n  if (path === null) {\n    return null;\n  }\n\n  const childrenArray = readChildren(node);\n  let children: Route[] = [];\n  if (childrenArray) {\n    children = childrenArray\n      .map(c => {\n        if (c.kind !== ts.SyntaxKind.ObjectLiteralExpression) {\n          return null;\n        }\n        return getRoute(c as ts.ObjectLiteralExpression, entryPoints, program, host);\n      })\n      .filter(e => e !== null) as Route[];\n  }\n\n  const route: Route = { path, children };\n\n  const redirectTo = readRedirect(node, program.getTypeChecker());\n  if (redirectTo) {\n    route.redirectTo = redirectTo;\n  }\n\n  const loadChildren = readLoadChildren(node, program.getTypeChecker());\n  if (loadChildren) {\n    const parent = getModuleEntryPoint(\n      resolve(node.getSourceFile().fileName),\n      entryPoints,\n      program,\n      host\n    );\n    const module = getModulePathFromRoute(parent, loadChildren, program, host);\n    return {\n      ...route,\n      module\n    } as LazyRoute;\n  }\n\n  return route;\n};\n\nexport const isRoute = (n: ts.Node, typeChecker: ts.TypeChecker, redirects: boolean): boolean => {\n  if (\n    n.kind !== ts.SyntaxKind.ObjectLiteralExpression ||\n    !n.parent ||\n    n.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression\n  ) {\n    return false;\n  }\n\n  const objLiteral = n as ts.ObjectLiteralExpression;\n  const path = readPath(objLiteral, typeChecker) !== null;\n  const redirectTo = redirects && readRedirect(objLiteral, typeChecker) !== null;\n  const children = !!readChildren(objLiteral);\n  const loadChildren = !!readLoadChildren(objLiteral, typeChecker);\n  const component = !!getObjectProp(objLiteral, 'component');\n\n  return (path && children) || (path && component) || (path && loadChildren) || (path && redirectTo);\n};\n"
  },
  {
    "path": "packages/guess-parser/src/detector/detect.ts",
    "content": "import { readFileSync, existsSync } from 'fs';\nimport { join } from 'path';\nimport { ProjectType, ProjectMetadata } from '../../../common/interfaces';\n\nconst dep = (p: any) => (name: string) => (p.dependencies ? p.dependencies[name] : undefined);\nconst devDep = (p: any) => (name: string) => (p.devDependencies ? p.devDependencies[name] : undefined);\n\nexport const detect = (base: string): ProjectMetadata | undefined => {\n  const path = ['package.json', '../package.json']\n    .map(p => join(base, p))\n    .filter(existsSync)\n    .pop();\n\n  if (!path) {\n    throw new Error('Unable to discover the project type');\n  }\n  const content = JSON.parse(readFileSync(path).toString()) as any;\n  const exists = (file: string) => existsSync(join(base, file));\n  const d = dep(content);\n  const dd = devDep(content);\n  const tsconfig = 'tsconfig.app.json';\n  const srcTsConfig = join('src', tsconfig);\n  if (dd('@angular/cli') && (exists(srcTsConfig) || exists(tsconfig))) {\n    let tsconfigPath = tsconfig;\n    if (exists(srcTsConfig)) {\n      tsconfigPath = srcTsConfig;\n    }\n    return {\n      type: ProjectType.AngularCLI,\n      version: dd('@angular/cli'),\n      details: {\n        typescript: dd('typescript'),\n        tsconfigPath,\n        sourceDir: 'src'\n      }\n    };\n  }\n  if (d('gatsby')) {\n    return {\n      type: ProjectType.Gatsby,\n      version: d('gatsby')\n    };\n  }\n  if (d('react') && d('react-scripts-ts') && exists('tsconfig.json')) {\n    return {\n      type: ProjectType.CreateReactAppTypeScript,\n      version: d('react-scripts-ts'),\n      details: {\n        typescript: dd('typescript'),\n        tsconfigPath: join(base, 'tsconfig.json'),\n        sourceDir: 'src'\n      }\n    };\n  }\n  if (d('react') && d('react-scripts')) {\n    return {\n      type: ProjectType.CreateReactApp,\n      version: d('react-scripts'),\n      details: {\n        sourceDir: 'src'\n      }\n    };\n  }\n  if (d('preact') && dd('preact-cli')) {\n    return {\n      type: ProjectType.PreactCLI,\n      version: dd('preact-cli'),\n      details: {\n        sourceDir: '.'\n      }\n    };\n  }\n  return undefined;\n};\n"
  },
  {
    "path": "packages/guess-parser/src/detector/index.ts",
    "content": "export * from './detect';\n"
  },
  {
    "path": "packages/guess-parser/src/language-service.ts",
    "content": "import { existsSync, readFileSync } from 'fs';\nimport * as ts from 'typescript';\n\nexport const getLanguageService = (rootFileNames: string[], options: ts.CompilerOptions) => {\n  const files: ts.MapLike<{ version: number }> = {};\n\n  // initialize the list of files\n  rootFileNames.forEach(fileName => {\n    files[fileName] = { version: 0 };\n  });\n  const servicesHost: ts.LanguageServiceHost = {\n    getScriptFileNames: () => rootFileNames,\n    getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(),\n    getScriptSnapshot: fileName => {\n      if (!existsSync(fileName)) {\n        return undefined;\n      }\n\n      return ts.ScriptSnapshot.fromString(readFileSync(fileName).toString());\n    },\n    getCurrentDirectory: () => process.cwd(),\n    getCompilationSettings: () => options,\n    getDefaultLibFileName: o => ts.getDefaultLibFilePath(o)\n  };\n\n  return ts.createLanguageService(servicesHost, ts.createDocumentRegistry());\n};\n"
  },
  {
    "path": "packages/guess-parser/src/parser.ts",
    "content": "import { parseRoutes as ngParseRoutes } from './angular';\nimport { parseReactTSXRoutes, parseReactJSXRoutes } from './react';\nimport { parsePreactJSXRoutes } from './preact';\nimport { RoutingModule, ProjectType } from '../../common/interfaces';\nimport { detect } from './detector';\nimport { join } from 'path';\n\nconst unique = (a: RoutingModule[]) => {\n  const map: { [path: string]: RoutingModule } = {};\n  a.forEach(r => (map[r.path] = r));\n  return Object.keys(map).map(k => map[k]);\n};\n\nexport const parseRoutes = (base: string) => {\n  let result: RoutingModule[] | undefined = undefined;\n  const app = detect(base);\n  if (!app) {\n    throw new Error('Cannot detect the application type');\n  }\n  if (app.type === ProjectType.AngularCLI && app.details && app.details.tsconfigPath) {\n    result = ngParseRoutes(join(base, app.details.tsconfigPath));\n  }\n  if (app.type === ProjectType.CreateReactAppTypeScript && app.details && app.details.tsconfigPath) {\n    result = parseReactTSXRoutes(app.details.tsconfigPath);\n  }\n  if (app.type === ProjectType.CreateReactApp && app.details && app.details.sourceDir) {\n    result = parseReactJSXRoutes(join(base, app.details.sourceDir));\n  }\n  if (app.type === ProjectType.PreactCLI && app.details && app.details.sourceDir) {\n    result = parsePreactJSXRoutes(join(base, app.details.sourceDir));\n  }\n  if (!result) {\n    throw new Error('Unknown project type');\n  }\n  const res = unique(result);\n  res.filter(r => !r.parentModulePath || r.path === '/').forEach(r => (r.parentModulePath = null));\n  return res;\n};\n"
  },
  {
    "path": "packages/guess-parser/src/preact/index.ts",
    "content": "import * as ts from 'typescript';\nimport * as path from 'path';\nimport { RoutingModule } from '../../../common/interfaces';\nimport { readFiles } from '../utils';\nimport { getLanguageService } from '../language-service';\n\nconst LazyRe = /routes\\/((\\w+\\/index)|\\w+)\\.(js|jsx|ts|tsx)$/;\n\nconst getLazyDefinition = (\n  filename: string,\n  identifier: ts.Node,\n  ls: ts.LanguageService\n): ts.DefinitionInfo | undefined => {\n  const defs = ls.getDefinitionAtPosition(filename, identifier.pos + 1);\n  if (!defs) {\n    return undefined;\n  }\n  return defs.filter(d => LazyRe.test(d.fileName) && d.kind === 'class').pop();\n};\n\nconst extractModule = (a: ts.JsxAttribute) => {\n  const init = a.initializer as ts.JsxExpression | null;\n  if (!init) {\n    return null;\n  }\n  const arrow = init.expression as ts.ArrowFunction | null;\n  if (!arrow) {\n    return '';\n  }\n  const body = arrow.body as ts.CallExpression | null;\n  if (!body) {\n    return '';\n  }\n  const temp = body.expression as ts.CallExpression | null;\n  if (!temp) {\n    return '';\n  }\n  const internalExpr = temp.expression as ts.CallExpression | null;\n  if (!internalExpr) {\n    return '';\n  }\n  const arg = internalExpr.arguments[0] as ts.StringLiteral | null;\n  if (!arg || arg.kind !== ts.SyntaxKind.StringLiteral) {\n    return '';\n  }\n  return (arg as ts.StringLiteral).text;\n};\n\nconst extractRoute = (c: ts.Node, file: ts.SourceFile, ls: ts.LanguageService) => {\n  if (c.kind !== ts.SyntaxKind.JsxElement && c.kind !== ts.SyntaxKind.JsxSelfClosingElement) {\n    return;\n  }\n  let el: ts.JsxSelfClosingElement | ts.JsxOpeningElement = (c as ts.JsxElement).openingElement;\n  if (c.kind === ts.SyntaxKind.JsxSelfClosingElement) {\n    el = c as ts.JsxSelfClosingElement;\n  }\n\n  const module: Partial<RoutingModule> = {\n    lazy: (el.tagName as ts.Identifier).text === 'AsyncRoute',\n    parentModulePath: file.fileName,\n    modulePath: file.fileName\n  };\n  const def = getLazyDefinition(file.getSourceFile().fileName, el, ls);\n  if (def) {\n    module.lazy = true;\n    module.modulePath = def.fileName;\n  }\n  el.attributes.properties.forEach(p => {\n    const { text } = p.name as ts.Identifier;\n    if (text === 'path') {\n      module.path = ((p as ts.JsxAttribute).initializer as ts.StringLiteral).text;\n    }\n    if (text === 'getComponent') {\n      const parts = file.fileName.split('/');\n      parts.pop();\n      const tempName = extractModule(p as ts.JsxAttribute);\n      if (tempName) {\n        const name = tempName + '.tsx';\n        module.modulePath = '/' + path.join(...parts.concat([name]));\n        module.lazy = true;\n      }\n    }\n  });\n  return module as RoutingModule;\n};\n\nconst extractRoutes = (file: ts.SourceFile, ls: ts.LanguageService): RoutingModule[] => {\n  const result: RoutingModule[] = [];\n  const stack: ts.Node[] = [file];\n\n  while (stack.length) {\n    const c = stack.pop();\n    if (!c) {\n      return result;\n    }\n    const el: ts.JsxSelfClosingElement | ts.JsxOpeningElement = (c as ts.JsxElement).openingElement;\n    if (c.kind === ts.SyntaxKind.JsxElement && (el.tagName as ts.Identifier).text === 'Router') {\n      (c as ts.JsxElement).children.forEach((e: ts.Node) => {\n        const route = extractRoute(e, file, ls);\n        if (route) {\n          result.push(route);\n        }\n      });\n    } else {\n      c.getChildren(file).forEach(child => stack.push(child));\n    }\n  }\n  return result;\n};\n\nexport const parsePreactJSXRoutes = (base: string): RoutingModule[] => {\n  const options = {\n    jsx: ts.JsxEmit.React,\n    allowJs: true\n  };\n  const rootFileNames = readFiles(base);\n  const program = ts.createProgram(rootFileNames, options);\n  const jsxFiles = program\n    .getSourceFiles()\n    .filter(f => f.fileName.endsWith('.tsx') || f.fileName.endsWith('.jsx') || f.fileName.endsWith('.js'));\n\n  const routes = jsxFiles.reduce(\n    (a, f) => a.concat(extractRoutes(f, getLanguageService(rootFileNames, options))),\n    [] as RoutingModule[]\n  );\n\n  const routeMap = routes.reduce(\n    (a, m) => {\n      a[m.path] = m;\n      return a;\n    },\n    {} as { [key: string]: RoutingModule }\n  );\n  return Object.keys(routeMap).map(k => routeMap[k]);\n};\n"
  },
  {
    "path": "packages/guess-parser/src/react/base.ts",
    "content": "import * as ts from 'typescript';\nimport * as path from 'path';\nimport { RoutingModule } from '../../../common/interfaces';\n\nconst extractRoutes = (file: ts.SourceFile): RoutingModule[] => {\n  const result: RoutingModule[] = [];\n  const stack: ts.Node[] = [file];\n\n  const extractModule = (a: ts.JsxAttribute) => {\n    const init = a.initializer as ts.JsxExpression | null;\n    if (!init) {\n      return null;\n    }\n    const expr = init.expression as ts.CallExpression | null;\n    if (!expr) {\n      return '';\n    }\n    if (!expr.arguments) {\n      return '';\n    }\n    const arrow = expr.arguments[0] as ts.ArrowFunction | null;\n    if (!arrow) {\n      return '';\n    }\n    const body = arrow.body as ts.CallExpression;\n    if (!body) {\n      return '';\n    }\n    const arg = body.arguments[0];\n    if (!arg || arg.kind !== ts.SyntaxKind.StringLiteral) {\n      return '';\n    }\n    return (arg as ts.StringLiteral).text;\n  };\n\n  while (stack.length) {\n    const c = stack.pop();\n    if (!c) {\n      return result;\n    }\n    if (c.kind === ts.SyntaxKind.JsxElement || c.kind === ts.SyntaxKind.JsxSelfClosingElement) {\n      let el: ts.JsxSelfClosingElement | ts.JsxOpeningElement = (c as ts.JsxElement).openingElement;\n      if (c.kind === ts.SyntaxKind.JsxSelfClosingElement) {\n        el = c as ts.JsxSelfClosingElement;\n      }\n      if ((el.tagName as ts.Identifier).text === 'Route') {\n        const module: Partial<RoutingModule> = {\n          lazy: false,\n          parentModulePath: file.fileName,\n          modulePath: file.fileName\n        };\n        el.attributes.properties.forEach(p => {\n          const { text } = p.name as ts.Identifier;\n          if (text === 'path') {\n            module.path = ((p as ts.JsxAttribute).initializer as ts.StringLiteral).text;\n          }\n          if (text === 'component') {\n            const parts = file.fileName.split('/');\n            parts.pop();\n            const tempName = extractModule(p as ts.JsxAttribute);\n            if (tempName) {\n              const name = tempName + '.tsx';\n              module.modulePath = '/' + path.join(...parts.concat([name]));\n              module.lazy = true;\n            }\n          }\n          result.push(module as RoutingModule);\n        });\n      }\n    }\n    c.getChildren(file).forEach(child => {\n      stack.push(child);\n    });\n  }\n  return result;\n};\n\nexport const parseReactRoutes = (files: string[], options: ts.CompilerOptions) => {\n  const program = ts.createProgram(files, options);\n  const jsxFiles = program.getSourceFiles().filter(f => f.fileName.endsWith('.tsx') || f.fileName.endsWith('.jsx'));\n  const routes = jsxFiles.reduce((a, f) => a.concat(extractRoutes(f)), [] as RoutingModule[]);\n  const modules = routes.reduce(\n    (a, r) => {\n      a[r.modulePath] = true;\n      return a;\n    },\n    {} as { [key: string]: boolean }\n  );\n  const rootModule = routes.filter(r => r.parentModulePath && !modules[r.parentModulePath]).pop();\n  if (rootModule) {\n    routes.push({\n      path: '/',\n      parentModulePath: null,\n      modulePath: rootModule.parentModulePath,\n      lazy: false\n    } as RoutingModule);\n  }\n  const routeMap = routes.reduce(\n    (a, m) => {\n      a[m.path] = m;\n      return a;\n    },\n    {} as { [key: string]: RoutingModule }\n  );\n  return Object.keys(routeMap).map(k => routeMap[k]);\n};\n"
  },
  {
    "path": "packages/guess-parser/src/react/index.ts",
    "content": "export { parseReactRoutes } from './base';\nexport { parseRoutes as parseReactTSXRoutes } from './react-tsx';\nexport { parseRoutes as parseReactJSXRoutes } from './react-jsx';\n"
  },
  {
    "path": "packages/guess-parser/src/react/react-jsx.ts",
    "content": "import { parseReactRoutes } from '.';\nimport { JsxEmit } from 'typescript';\nimport { RoutingModule } from '../../../common/interfaces';\nimport { readFiles } from '../utils';\n\nexport const parseRoutes = (base: string): RoutingModule[] => {\n  return parseReactRoutes(readFiles(base), {\n    jsx: JsxEmit.React,\n    allowJs: true\n  });\n};\n"
  },
  {
    "path": "packages/guess-parser/src/react/react-tsx.ts",
    "content": "import { readFileSync, lstatSync, existsSync } from 'fs';\nimport * as ts from 'typescript';\nimport { join, dirname, resolve } from 'path';\nimport { parseReactRoutes } from './';\nimport { RoutingModule } from '../../../common/interfaces';\n\nconst parseConfigHost = {\n  useCaseSensitiveFileNames: true,\n  fileExists: existsSync,\n  readDirectory: ts.sys.readDirectory,\n  readFile: ts.sys.readFile\n};\n\nconst calcProjectFileAndBasePath = (project: string): { projectFile: string; basePath: string } => {\n  const projectIsDir = lstatSync(project).isDirectory();\n  const projectFile = projectIsDir ? join(project, 'tsconfig.json') : project;\n  const projectDir = projectIsDir ? project : dirname(project);\n  const basePath = resolve(process.cwd(), projectDir);\n  return { projectFile, basePath };\n};\n\nexport const parseRoutes = (tsconfig: string): RoutingModule[] => {\n  const { config, error } = ts.readConfigFile(tsconfig, (f: string) => readFileSync(f).toString());\n  if (error) {\n    throw error;\n  }\n  const { basePath } = calcProjectFileAndBasePath(tsconfig);\n  const parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, basePath);\n  return parseReactRoutes(parsed.fileNames, parsed.options);\n};\n"
  },
  {
    "path": "packages/guess-parser/src/utils.ts",
    "content": "import { statSync, readdirSync } from 'fs';\nimport { join } from 'path';\n\nexport const readFiles = (dir: string): string[] => {\n  if (dir === 'node_modules') {\n    return [];\n  }\n  const result = readdirSync(dir).map(node => join(dir, node));\n  const files = result.filter(\n    node => statSync(node).isFile() && (node.endsWith('.jsx') || node.endsWith('.js'))\n  );\n  const dirs = result.filter(node => statSync(node).isDirectory());\n  return [].concat.apply(files, (dirs.map(readFiles) as unknown) as ConcatArray<never>[]);\n};\n"
  },
  {
    "path": "packages/guess-parser/test/angular.spec.ts",
    "content": "import { parseRoutes } from '../src/angular';\n\nconst fixtureRoutes = new Set([\n  '/foo',\n  '/foo/baz',\n  '/foo/index',\n  '/foo/baz/index',\n  '/bar/baz',\n  '/qux',\n  '/library',\n  '/bar-simple',\n  '/foo/child1',\n  '/foo/foo-parent',\n  '/foo/foo-parent/child2',\n  '/eager',\n  '/eager/lazy',\n]);\n\nconst fixtureRoutesWithRedirects = new Set([\n  ...fixtureRoutes,\n  ''\n]);\n\nconst nxRoutes = new Set([\n  '/login',\n  '/home',\n  '/customers/list',\n  '/customers'\n]);\n\nconst nxRoutesWithRedirects = new Set([\n  ...nxRoutes,\n  ''\n]);\n\ndescribe('Angular parser', () => {\n  it('should parse an app', () => {\n    expect(() =>\n      parseRoutes(\n        'packages/guess-parser/test/fixtures/angular/src/tsconfig.app.json'\n      )\n    ).not.toThrow();\n  });\n\n  it('should produce routes', () => {\n    const routes = parseRoutes(\n      'packages/guess-parser/test/fixtures/angular/src/tsconfig.app.json'\n    );\n    expect(routes instanceof Array).toBeTruthy();\n    const allRoutes = new Set(routes.map(r => r.path));\n    [...allRoutes].forEach(r => expect(fixtureRoutes).toContain(r));\n    expect(allRoutes.size).toEqual(fixtureRoutes.size);\n  });\n\n  it('should consider redirects', () => {\n    const routes = parseRoutes(\n      'packages/guess-parser/test/fixtures/angular/src/tsconfig.app.json'\n    , undefined, { redirects: true });\n    expect(routes instanceof Array).toBeTruthy();\n    const allRoutes = new Set(routes.map(r => r.path));\n    [...allRoutes].forEach(r => expect(fixtureRoutesWithRedirects).toContain(r));\n    expect(allRoutes.size).toEqual(fixtureRoutesWithRedirects.size);\n    const redirect = routes.filter(route => route.path === '').pop();\n    expect(redirect?.redirectTo).toEqual('bar');\n    expect(redirect?.lazy).toEqual(false);\n  });\n\n  it('should produce routes with proper paths', () => {\n    const routes = parseRoutes(\n      'packages/guess-parser/test/fixtures/angular/src/tsconfig.app.json'\n    );\n    const route = routes.find(r => r.path === '/foo');\n    expect(route!.modulePath.endsWith('foo.module.ts')).toBeTruthy();\n    expect(route!.lazy).toBeTruthy();\n    expect(route!.parentModulePath!.endsWith('app.module.ts')).toBeTruthy();\n  });\n\n  it('should work with nx monorepo with path mappings', () => {\n    const routes = parseRoutes(\n      'packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/tsconfig.app.json'\n    ).map(r => r.path);\n    [...routes].forEach(r => expect(nxRoutes).toContain(r));\n  });\n\n  it('should discover redirects', () => {\n    const routes = parseRoutes(\n      'packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/tsconfig.app.json'\n    , undefined, { redirects: true }).map(r => r.path);\n    [...routes].forEach(r => expect(nxRoutesWithRedirects).toContain(r));\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/detect.spec.ts",
    "content": "import { detect } from '../src/detector';\nimport { ProjectType } from '../../common/interfaces';\n\ndescribe('detect', () => {\n  describe('angular', () => {\n    it('should detect an Angular app', () => {\n      expect(detect('packages/guess-parser/test/fixtures/angular')!.type).toBe(ProjectType.AngularCLI);\n    });\n\n    it('should detect an Angular version 8 app', () => {\n      expect(detect('packages/guess-parser/test/fixtures/ng8')!.type).toBe(ProjectType.AngularCLI);\n    });\n  });\n\n  describe('create-react-app', () => {\n    it('should detect an create-react-app', () => {\n      expect(detect('packages/guess-parser/test/fixtures/react-app')!.type).toBe(ProjectType.CreateReactApp);\n    });\n  });\n\n  describe('create-react-app-ts', () => {\n    it('should detect an create-react-app-ts', () => {\n      expect(detect('packages/guess-parser/test/fixtures/react-app-ts')!.type).toBe(\n        ProjectType.CreateReactAppTypeScript\n      );\n    });\n  });\n\n  describe('gatsby', () => {\n    it('should detect an gatsby', () => {\n      expect(detect('packages/guess-parser/test/fixtures/gatsby')!.type).toBe(ProjectType.Gatsby);\n    });\n  });\n\n  describe('unknown', () => {\n    it('should not detect unknown app', () => {\n      expect(detect('packages/guess-parser/test/fixtures/unknown')).toBe(undefined);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/.angular-cli.json",
    "content": "{\n  \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n  \"project\": {\n    \"name\": \"angular\"\n  },\n  \"apps\": [\n    {\n      \"root\": \"src\",\n      \"outDir\": \"dist\",\n      \"assets\": [\n        \"assets\",\n        \"favicon.ico\"\n      ],\n      \"index\": \"index.html\",\n      \"main\": \"main.ts\",\n      \"polyfills\": \"polyfills.ts\",\n      \"test\": \"test.ts\",\n      \"tsconfig\": \"tsconfig.app.json\",\n      \"testTsconfig\": \"tsconfig.spec.json\",\n      \"prefix\": \"app\",\n      \"styles\": [\n        \"styles.css\"\n      ],\n      \"scripts\": [],\n      \"environmentSource\": \"environments/environment.ts\",\n      \"environments\": {\n        \"dev\": \"environments/environment.ts\",\n        \"prod\": \"environments/environment.prod.ts\"\n      }\n    }\n  ],\n  \"e2e\": {\n    \"protractor\": {\n      \"config\": \"./protractor.conf.js\"\n    }\n  },\n  \"lint\": [\n    {\n      \"project\": \"src/tsconfig.app.json\",\n      \"exclude\": \"**/node_modules/**\"\n    },\n    {\n      \"project\": \"src/tsconfig.spec.json\",\n      \"exclude\": \"**/node_modules/**\"\n    },\n    {\n      \"project\": \"e2e/tsconfig.e2e.json\",\n      \"exclude\": \"**/node_modules/**\"\n    }\n  ],\n  \"test\": {\n    \"karma\": {\n      \"config\": \"./karma.conf.js\"\n    }\n  },\n  \"defaults\": {\n    \"styleExt\": \"css\",\n    \"component\": {}\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/library/index.ts",
    "content": "export * from './nested/library.module';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/library/library.module.ts",
    "content": "import { NgModule, Component } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@Component({\n\n})\nclass LibraryComponent {}\n\n@NgModule({\n  declarations: [LibraryComponent],\n  imports: [RouterModule.forChild([\n    {\n      path: '',\n      component: LibraryComponent,\n      pathMatch: 'full'\n    }\n  ])],\n  bootstrap: [LibraryComponent]\n})\nexport class LibraryModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/library/nested/library.module.ts",
    "content": "import { NgModule, Component } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@Component({\n\n})\nclass LibraryComponent {}\n\n@NgModule({\n  declarations: [LibraryComponent],\n  imports: [RouterModule.forChild([\n    {\n      path: '',\n      component: LibraryComponent,\n      pathMatch: 'full'\n    }\n  ])],\n  bootstrap: [LibraryComponent]\n})\nexport class LibraryModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/library/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../out-tsc/library\",\n    \"module\": \"es2015\",\n    \"types\": []\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/package.json",
    "content": "{\n  \"name\": \"angular\",\n  \"version\": \"0.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"ng\": \"ng\",\n    \"start\": \"ng serve\",\n    \"build\": \"ng build --prod\",\n    \"test\": \"ng test\",\n    \"lint\": \"ng lint\",\n    \"e2e\": \"ng e2e\"\n  },\n  \"private\": true,\n  \"dependencies\": {\n    \"@angular/animations\": \"^5.2.0\",\n    \"@angular/common\": \"^5.2.0\",\n    \"@angular/compiler\": \"^5.2.0\",\n    \"@angular/core\": \"^5.2.0\",\n    \"@angular/forms\": \"^5.2.0\",\n    \"@angular/http\": \"^5.2.0\",\n    \"@angular/platform-browser\": \"^5.2.0\",\n    \"@angular/platform-browser-dynamic\": \"^5.2.0\",\n    \"@angular/router\": \"^5.2.0\",\n    \"core-js\": \"^2.4.1\",\n    \"rxjs\": \"^5.5.6\",\n    \"zone.js\": \"^0.8.19\"\n  },\n  \"devDependencies\": {\n    \"@angular/cli\": \"~1.7.1\",\n    \"@angular/compiler-cli\": \"^5.2.0\",\n    \"@angular/language-service\": \"^5.2.0\",\n    \"@types/jasmine\": \"~2.8.3\",\n    \"@types/jasminewd2\": \"~2.0.2\",\n    \"@types/node\": \"~6.0.60\",\n    \"codelyzer\": \"^4.0.1\",\n    \"jasmine-core\": \"~2.8.0\",\n    \"jasmine-spec-reporter\": \"~4.2.1\",\n    \"karma\": \"~2.0.0\",\n    \"karma-chrome-launcher\": \"~2.2.0\",\n    \"karma-coverage-istanbul-reporter\": \"^1.2.1\",\n    \"karma-jasmine\": \"~1.1.0\",\n    \"karma-jasmine-html-reporter\": \"^0.2.2\",\n    \"protractor\": \"~5.1.2\",\n    \"ts-node\": \"~4.1.0\",\n    \"tslint\": \"~5.9.1\",\n    \"typescript\": \"~2.5.3\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/about/about-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\n\nconst routes: Routes = [];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class AboutRoutingModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/about/about.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { AboutRoutingModule } from './about-routing.module';\n\n@NgModule({\n  declarations: [],\n  imports: [\n    CommonModule,\n    AboutRoutingModule\n  ]\n})\nexport class AboutModule { }\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/app-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { BarSimpleComponent } from './bar-simple.component';\n\nconst module = './foo/foo.module';\nconst routes: Routes = [\n  // {\n  //   path: 'foo',\n  //   component: BarSimpleComponent,\n  //   children: [\n  //     {\n  //       path: 'qux',\n  //       component: BarSimpleComponent,\n  //       children: [\n  //         {\n  //           path: 'bar',\n  //           loadChildren: () => import('./bar/bar.module').then(m => m.BarModule)\n  //         }\n  //       ]\n  //     }\n  //   ]\n  // },\n  {\n    path: 'fo' + 'o',\n    loadChildren: () => import(module).then(e => e.FooModule)\n  },\n  {\n    path: 'bar',\n    loadChildren: () => import('./bar/bar.module').then(m => m.BarModule)\n  },\n  {\n    path: 'qux',\n    loadChildren: 'app/qux/qux.module#QuxModule'\n  },\n  {\n    path: 'library',\n    loadChildren: 'app/wrapper/wrapper.module#WrapperModule'\n  },\n  {\n    path: 'bar-simple',\n    component: BarSimpleComponent\n  },\n  {\n    path: 'about',\n    loadChildren: () => import('./about/about.module').then(m => m.AboutModule)\n  },\n  {\n    path: 'eager',\n    children: [\n      {\n        path: 'lazy',\n        loadChildren: () => import('./lazy/lazy.module').then(m => m.LazyModule)\n      }\n    ]\n  },\n  {\n    path: '',\n    pathMatch: 'full',\n    redirectTo: 'bar'\n  }\n];\n\n@NgModule({\n  declarations: [BarSimpleComponent],\n  imports: [RouterModule.forRoot(routes)],\n  exports: [RouterModule]\n})\nexport class AppRoutingModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/app.component.css",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/app.component.html",
    "content": "<a routerLink=\"/foo\">Foo</a>\n<a routerLink=\"/bar-simple\">Bar</a>\n<a routerLink=\"/bar/baz\">Baz</a>\n\n<router-outlet></router-outlet>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/app.component.spec.ts",
    "content": "import { TestBed, async } from '@angular/core/testing';\nimport { AppComponent } from './app.component';\ndescribe('AppComponent', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      declarations: [\n        AppComponent\n      ],\n    }).compileComponents();\n  }));\n  it('should create the app', async(() => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.debugElement.componentInstance;\n    expect(app).toBeTruthy();\n  }));\n  it(`should have as title 'app'`, async(() => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.debugElement.componentInstance;\n    expect(app.title).toEqual('app');\n  }));\n  it('should render title in a h1 tag', async(() => {\n    const fixture = TestBed.createComponent(AppComponent);\n    fixture.detectChanges();\n    const compiled = fixture.debugElement.nativeElement;\n    expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');\n  }));\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/app.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css']\n})\nexport class AppComponent {\n  title = 'app';\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/app.module.ts",
    "content": "import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppComponent } from './app.component';\nimport { AppRoutingModule } from './app-routing.module';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [BrowserModule, AppRoutingModule],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/bar/bar.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@NgModule({\n  imports: [\n    RouterModule.forChild([\n      {\n        path: 'baz',\n        loadChildren: () => import('./baz/baz.module').then(m => m.BazModule)\n      }\n    ])\n  ]\n})\nexport class BarModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/bar/baz/baz.module.ts",
    "content": "import { NgModule, Component } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport './cycle-parent';\n\n@Component({\n  selector: 'app-baz',\n  template: 'Baz'\n})\nexport class BazComponent {}\n\nconst routes: Routes = [\n  {\n    path: '',\n    pathMatch: 'full',\n    component: BazComponent\n  }\n];\n\n@NgModule({\n  declarations: [BazComponent],\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class BazModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/bar/baz/cycle-parent.ts",
    "content": "import './baz.module';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/bar-simple.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-component',\n  template: 'Bar Simple'\n})\nexport class BarSimpleComponent {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/foo/baz/baz-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { BazComponent } from './baz.component';\n\nconst routes: Routes = [\n  {\n    path: '',\n    component: BazComponent\n  },\n  {\n    path: 'index',\n    component: BazComponent\n  }\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class BazRoutingModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/foo/baz/baz.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-baz',\n  template: 'baz-component'\n})\nexport class BazComponent {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/foo/baz/baz.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { BazComponent } from './baz.component';\nimport { BazRoutingModule } from './baz-routing.module';\n\n@NgModule({\n  declarations: [BazComponent],\n  imports: [BazRoutingModule],\n  bootstrap: [BazComponent]\n})\nexport class FooModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/foo/foo-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { FooComponent } from './foo.component';\n\nconst baz = 'baz';\nconst routes: Routes = [\n  {\n    path: '',\n    pathMatch: 'full',\n    component: FooComponent\n  },\n  {\n    path: 'index',\n    component: FooComponent\n  },\n  {\n    path: 'baz',\n    loadChildren: baz + '/baz.module#BazModule'\n  },\n  {\n    path: '',\n    children: [\n      {\n        path: 'child1',\n        component: FooComponent\n      }\n    ]\n  },\n  {\n    path: 'foo-parent',\n    children: [\n      {\n        path: 'child2',\n        component: FooComponent\n      }\n    ]\n  }\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class FooRoutingModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/foo/foo.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-foo',\n  template: 'foo-component'\n})\nexport class FooComponent {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/foo/foo.module.ts",
    "content": "import { NgModule, Component } from '@angular/core';\nimport { FooComponent } from './foo.component';\nimport { FooRoutingModule } from './foo-routing.module';\n\n@NgModule({\n  declarations: [FooComponent],\n  imports: [FooRoutingModule],\n  bootstrap: [FooComponent]\n})\nexport class FooModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/lazy/lazy-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\n\nimport { LazyComponent } from './lazy.component';\n\nconst routes: Routes = [{ path: '', component: LazyComponent }];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class LazyRoutingModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/lazy/lazy.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  template: '',\n})\nexport class LazyComponent { }\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/lazy/lazy.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { LazyRoutingModule } from './lazy-routing.module';\nimport { LazyComponent } from './lazy.component';\n\n@NgModule({\n  declarations: [\n    LazyComponent\n  ],\n  imports: [\n    CommonModule,\n    LazyRoutingModule\n  ]\n})\nexport class LazyModule { }\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/qux/qux.module.ts",
    "content": "import { NgModule, Component } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@Component({\n\n})\nclass QuxComponent {}\n\n\n@NgModule({\n  declarations: [QuxComponent],\n  imports: [RouterModule.forChild([\n    {\n      path: '',\n      component: QuxComponent,\n      pathMatch: 'full'\n    }\n  ])],\n  bootstrap: [QuxComponent]\n})\nexport class QuxModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/app/wrapper/wrapper.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { LibraryModule } from '~library';\n\n@NgModule({\n  imports: [LibraryModule]\n})\nexport class WrapperModule {}\n\nimport { Component } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/environments/environment.prod.ts",
    "content": "export const environment = {\n  production: true\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/environments/environment.ts",
    "content": "// The file contents for the current environment will overwrite these during build.\n// The build system defaults to the dev environment which uses `environment.ts`, but if you do\n// `ng build --env=prod` then `environment.prod.ts` will be used instead.\n// The list of which env maps to which file can be found in `.angular-cli.json`.\n\nexport const environment = {\n  production: false\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <title>Angular</title>\n  <base href=\"/\">\n\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\">\n</head>\n<body>\n  <app-root></app-root>\n</body>\n</html>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/main.ts",
    "content": "import { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n  enableProdMode();\n}\n\nplatformBrowserDynamic().bootstrapModule(AppModule)\n  .catch(err => console.log(err));\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/polyfills.ts",
    "content": "/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfills to this file.\n *\n * This file is divided into 2 sections:\n *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.\n *   2. Application imports. Files imported after ZoneJS that should be loaded before your main\n *      file.\n *\n * The current setup is for so-called \"evergreen\" browsers; the last versions of browsers that\n * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),\n * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.\n *\n * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html\n */\n\n/***************************************************************************************************\n * BROWSER POLYFILLS\n */\n\n/** IE9, IE10 and IE11 requires all of the following polyfills. **/\n// import 'core-js/es6/symbol';\n// import 'core-js/es6/object';\n// import 'core-js/es6/function';\n// import 'core-js/es6/parse-int';\n// import 'core-js/es6/parse-float';\n// import 'core-js/es6/number';\n// import 'core-js/es6/math';\n// import 'core-js/es6/string';\n// import 'core-js/es6/date';\n// import 'core-js/es6/array';\n// import 'core-js/es6/regexp';\n// import 'core-js/es6/map';\n// import 'core-js/es6/weak-map';\n// import 'core-js/es6/set';\n\n/** IE10 and IE11 requires the following for NgClass support on SVG elements */\n// import 'classlist.js';  // Run `npm install --save classlist.js`.\n\n/** IE10 and IE11 requires the following for the Reflect API. */\n// import 'core-js/es6/reflect';\n\n\n/** Evergreen browsers require these. **/\n// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.\nimport 'core-js/es7/reflect';\n\n\n/**\n * Required to support Web Animations `@angular/platform-browser/animations`.\n * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation\n **/\n// import 'web-animations-js';  // Run `npm install --save web-animations-js`.\n\n/**\n * By default, zone.js will patch all possible macroTask and DomEvents\n * user can disable parts of macroTask/DomEvents patch by setting following flags\n */\n\n // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame\n // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick\n // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames\n\n /*\n * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js\n * with the following flag, it will bypass `zone.js` patch for IE/Edge\n */\n// (window as any).__Zone_enable_cross_context_check = true;\n\n/***************************************************************************************************\n * Zone JS is required by default for Angular itself.\n */\nimport 'zone.js/dist/zone';  // Included with Angular CLI.\n\n\n\n/***************************************************************************************************\n * APPLICATION IMPORTS\n */\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/styles.css",
    "content": "/* You can add global styles to this file, and also import other style files */\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/test.ts",
    "content": "// This file is required by karma.conf.js and loads recursively all the .spec and framework files\n\nimport 'zone.js/dist/zone-testing';\nimport { getTestBed } from '@angular/core/testing';\nimport {\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\n\ndeclare const require: any;\n\n// First, initialize the Angular testing environment.\ngetTestBed().initTestEnvironment(\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting()\n);\n// Then we find all the tests.\nconst context = require.context('./', true, /\\.spec\\.ts$/);\n// And load the modules.\ncontext.keys().map(context);\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/tsconfig.app.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../out-tsc/app\",\n    \"module\": \"es2015\",\n    \"types\": []\n  },\n  \"exclude\": [\n    \"test.ts\",\n    \"**/*.spec.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/src/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../out-tsc/spec\",\n    \"module\": \"commonjs\",\n    \"types\": [\n      \"jasmine\",\n      \"node\"\n    ]\n  },\n  \"files\": [\n    \"test.ts\"\n  ],\n  \"include\": [\n    \"**/*.spec.ts\",\n    \"**/*.d.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/angular/tsconfig.json",
    "content": "{\n  \"compileOnSave\": false,\n  \"compilerOptions\": {\n    \"outDir\": \"./dist/out-tsc\",\n    \"sourceMap\": true,\n    \"declaration\": false,\n    \"moduleResolution\": \"node\",\n    \"emitDecoratorMetadata\": true,\n    \"experimentalDecorators\": true,\n    \"target\": \"es5\",\n    \"typeRoots\": [\n      \"node_modules/@types\"\n    ],\n    \"lib\": [\n      \"es2017\",\n      \"dom\"\n    ],\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~library\": [\"library/index.ts\"],\n    }\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/.gitignore",
    "content": "# Project dependencies\n.cache\nnode_modules\nyarn-error.log\n\n# Build directory\n/public\n.DS_Store\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/.prettierrc",
    "content": "{\n  \"semi\": false,\n  \"singleQuote\": true,\n  \"trailingComma\": \"es5\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 gatsbyjs\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/README.md",
    "content": "# gatsby-starter-default\nThe default Gatsby starter.\n\nFor an overview of the project structure please refer to the [Gatsby documentation - Building with Components](https://www.gatsbyjs.org/docs/building-with-components/).\n\n## Install\n\nMake sure that you have the Gatsby CLI program installed:\n```sh\nnpm install --global gatsby-cli\n```\n\nAnd run from your CLI:\n```sh\ngatsby new gatsby-example-site\n```\n\nThen you can run it by:\n```sh\ncd gatsby-example-site\nnpm run develop\n```\n\n## Deploy\n\n[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/gatsby-browser.js",
    "content": "/**\n * Implement Gatsby's Browser APIs in this file.\n *\n * See: https://www.gatsbyjs.org/docs/browser-apis/\n */\n\n // You can delete this file if you're not using it"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/gatsby-config.js",
    "content": "module.exports = {\n  siteMetadata: {\n    title: 'Gatsby Default Starter',\n  },\n  plugins: ['gatsby-plugin-react-helmet'],\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/gatsby-node.js",
    "content": "/**\n * Implement Gatsby's Node APIs in this file.\n *\n * See: https://www.gatsbyjs.org/docs/node-apis/\n */\n\n // You can delete this file if you're not using it"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/gatsby-ssr.js",
    "content": "/**\n * Implement Gatsby's SSR (Server Side Rendering) APIs in this file.\n *\n * See: https://www.gatsbyjs.org/docs/ssr-apis/\n */\n\n // You can delete this file if you're not using it"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/package.json",
    "content": "{\n  \"name\": \"gatsby-starter-default\",\n  \"description\": \"Gatsby default starter\",\n  \"version\": \"1.0.0\",\n  \"author\": \"Kyle Mathews <mathews.kyle@gmail.com>\",\n  \"dependencies\": {\n    \"gatsby\": \"^1.9.247\",\n    \"gatsby-link\": \"^1.6.40\",\n    \"gatsby-plugin-react-helmet\": \"^2.0.10\",\n    \"react-helmet\": \"^5.2.0\"\n  },\n  \"keywords\": [\n    \"gatsby\"\n  ],\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"build\": \"gatsby build\",\n    \"develop\": \"gatsby develop\",\n    \"format\": \"prettier --write 'src/**/*.js'\",\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"devDependencies\": {\n    \"prettier\": \"^1.12.0\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/src/components/header.js",
    "content": "import React from 'react'\nimport Link from 'gatsby-link'\n\nconst Header = ({ siteTitle }) => (\n  <div\n    style={{\n      background: 'rebeccapurple',\n      marginBottom: '1.45rem',\n    }}\n  >\n    <div\n      style={{\n        margin: '0 auto',\n        maxWidth: 960,\n        padding: '1.45rem 1.0875rem',\n      }}\n    >\n      <h1 style={{ margin: 0 }}>\n        <Link\n          to=\"/\"\n          style={{\n            color: 'white',\n            textDecoration: 'none',\n          }}\n        >\n          {siteTitle}\n        </Link>\n      </h1>\n    </div>\n  </div>\n)\n\nexport default Header\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/src/layouts/index.css",
    "content": "html {\n  font-family: sans-serif;\n  -ms-text-size-adjust: 100%;\n  -webkit-text-size-adjust: 100%;\n}\nbody {\n  margin: 0;\n}\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n  display: block;\n}\naudio,\ncanvas,\nprogress,\nvideo {\n  display: inline-block;\n}\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\nprogress {\n  vertical-align: baseline;\n}\n[hidden],\ntemplate {\n  display: none;\n}\na {\n  background-color: transparent;\n  -webkit-text-decoration-skip: objects;\n}\na:active,\na:hover {\n  outline-width: 0;\n}\nabbr[title] {\n  border-bottom: none;\n  text-decoration: underline;\n  text-decoration: underline dotted;\n}\nb,\nstrong {\n  font-weight: inherit;\n  font-weight: bolder;\n}\ndfn {\n  font-style: italic;\n}\nh1 {\n  font-size: 2em;\n  margin: .67em 0;\n}\nmark {\n  background-color: #ff0;\n  color: #000;\n}\nsmall {\n  font-size: 80%;\n}\nsub,\nsup {\n  font-size: 75%;\n  line-height: 0;\n  position: relative;\n  vertical-align: baseline;\n}\nsub {\n  bottom: -.25em;\n}\nsup {\n  top: -.5em;\n}\nimg {\n  border-style: none;\n}\nsvg:not(:root) {\n  overflow: hidden;\n}\ncode,\nkbd,\npre,\nsamp {\n  font-family: monospace, monospace;\n  font-size: 1em;\n}\nfigure {\n  margin: 1em 40px;\n}\nhr {\n  box-sizing: content-box;\n  height: 0;\n  overflow: visible;\n}\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n  font: inherit;\n  margin: 0;\n}\noptgroup {\n  font-weight: 700;\n}\nbutton,\ninput {\n  overflow: visible;\n}\nbutton,\nselect {\n  text-transform: none;\n}\n[type=reset],\n[type=submit],\nbutton,\nhtml [type=button] {\n  -webkit-appearance: button;\n}\n[type=button]::-moz-focus-inner,\n[type=reset]::-moz-focus-inner,\n[type=submit]::-moz-focus-inner,\nbutton::-moz-focus-inner {\n  border-style: none;\n  padding: 0;\n}\n[type=button]:-moz-focusring,\n[type=reset]:-moz-focusring,\n[type=submit]:-moz-focusring,\nbutton:-moz-focusring {\n  outline: 1px dotted ButtonText;\n}\nfieldset {\n  border: 1px solid silver;\n  margin: 0 2px;\n  padding: .35em .625em .75em;\n}\nlegend {\n  box-sizing: border-box;\n  color: inherit;\n  display: table;\n  max-width: 100%;\n  padding: 0;\n  white-space: normal;\n}\ntextarea {\n  overflow: auto;\n}\n[type=checkbox],\n[type=radio] {\n  box-sizing: border-box;\n  padding: 0;\n}\n[type=number]::-webkit-inner-spin-button,\n[type=number]::-webkit-outer-spin-button {\n  height: auto;\n}\n[type=search] {\n  -webkit-appearance: textfield;\n  outline-offset: -2px;\n}\n[type=search]::-webkit-search-cancel-button,\n[type=search]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n::-webkit-input-placeholder {\n  color: inherit;\n  opacity: .54;\n}\n::-webkit-file-upload-button {\n  -webkit-appearance: button;\n  font: inherit;\n}\nhtml {\n  font: 112.5%/1.45em georgia, serif;\n  box-sizing: border-box;\n  overflow-y: scroll;\n}\n* {\n  box-sizing: inherit;\n}\n*:before {\n  box-sizing: inherit;\n}\n*:after {\n  box-sizing: inherit;\n}\nbody {\n  color: hsla(0, 0%, 0%, 0.8);\n  font-family: georgia, serif;\n  font-weight: normal;\n  word-wrap: break-word;\n  font-kerning: normal;\n  -moz-font-feature-settings: \"kern\", \"liga\", \"clig\", \"calt\";\n  -ms-font-feature-settings: \"kern\", \"liga\", \"clig\", \"calt\";\n  -webkit-font-feature-settings: \"kern\", \"liga\", \"clig\", \"calt\";\n  font-feature-settings: \"kern\", \"liga\", \"clig\", \"calt\";\n}\nimg {\n  max-width: 100%;\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nh1 {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  color: inherit;\n  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,\n    Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n  font-weight: bold;\n  text-rendering: optimizeLegibility;\n  font-size: 2.25rem;\n  line-height: 1.1;\n}\nh2 {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  color: inherit;\n  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,\n    Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n  font-weight: bold;\n  text-rendering: optimizeLegibility;\n  font-size: 1.62671rem;\n  line-height: 1.1;\n}\nh3 {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  color: inherit;\n  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,\n    Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n  font-weight: bold;\n  text-rendering: optimizeLegibility;\n  font-size: 1.38316rem;\n  line-height: 1.1;\n}\nh4 {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  color: inherit;\n  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,\n    Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n  font-weight: bold;\n  text-rendering: optimizeLegibility;\n  font-size: 1rem;\n  line-height: 1.1;\n}\nh5 {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  color: inherit;\n  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,\n    Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n  font-weight: bold;\n  text-rendering: optimizeLegibility;\n  font-size: 0.85028rem;\n  line-height: 1.1;\n}\nh6 {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  color: inherit;\n  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,\n    Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n  font-weight: bold;\n  text-rendering: optimizeLegibility;\n  font-size: 0.78405rem;\n  line-height: 1.1;\n}\nhgroup {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nul {\n  margin-left: 1.45rem;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  list-style-position: outside;\n  list-style-image: none;\n}\nol {\n  margin-left: 1.45rem;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  list-style-position: outside;\n  list-style-image: none;\n}\ndl {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\ndd {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\np {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nfigure {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\npre {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  font-size: 0.85rem;\n  line-height: 1.42;\n  background: hsla(0, 0%, 0%, 0.04);\n  border-radius: 3px;\n  overflow: auto;\n  word-wrap: normal;\n  padding: 1.45rem;\n}\ntable {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n  font-size: 1rem;\n  line-height: 1.45rem;\n  border-collapse: collapse;\n  width: 100%;\n}\nfieldset {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nblockquote {\n  margin-left: 1.45rem;\n  margin-right: 1.45rem;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nform {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nnoscript {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\niframe {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nhr {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: calc(1.45rem - 1px);\n  background: hsla(0, 0%, 0%, 0.2);\n  border: none;\n  height: 1px;\n}\naddress {\n  margin-left: 0;\n  margin-right: 0;\n  margin-top: 0;\n  padding-bottom: 0;\n  padding-left: 0;\n  padding-right: 0;\n  padding-top: 0;\n  margin-bottom: 1.45rem;\n}\nb {\n  font-weight: bold;\n}\nstrong {\n  font-weight: bold;\n}\ndt {\n  font-weight: bold;\n}\nth {\n  font-weight: bold;\n}\nli {\n  margin-bottom: calc(1.45rem / 2);\n}\nol li {\n  padding-left: 0;\n}\nul li {\n  padding-left: 0;\n}\nli > ol {\n  margin-left: 1.45rem;\n  margin-bottom: calc(1.45rem / 2);\n  margin-top: calc(1.45rem / 2);\n}\nli > ul {\n  margin-left: 1.45rem;\n  margin-bottom: calc(1.45rem / 2);\n  margin-top: calc(1.45rem / 2);\n}\nblockquote *:last-child {\n  margin-bottom: 0;\n}\nli *:last-child {\n  margin-bottom: 0;\n}\np *:last-child {\n  margin-bottom: 0;\n}\nli > p {\n  margin-bottom: calc(1.45rem / 2);\n}\ncode {\n  font-size: 0.85rem;\n  line-height: 1.45rem;\n}\nkbd {\n  font-size: 0.85rem;\n  line-height: 1.45rem;\n}\nsamp {\n  font-size: 0.85rem;\n  line-height: 1.45rem;\n}\nabbr {\n  border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);\n  cursor: help;\n}\nacronym {\n  border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);\n  cursor: help;\n}\nabbr[title] {\n  border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);\n  cursor: help;\n  text-decoration: none;\n}\nthead {\n  text-align: left;\n}\ntd,\nth {\n  text-align: left;\n  border-bottom: 1px solid hsla(0, 0%, 0%, 0.12);\n  font-feature-settings: \"tnum\";\n  -moz-font-feature-settings: \"tnum\";\n  -ms-font-feature-settings: \"tnum\";\n  -webkit-font-feature-settings: \"tnum\";\n  padding-left: 0.96667rem;\n  padding-right: 0.96667rem;\n  padding-top: 0.725rem;\n  padding-bottom: calc(0.725rem - 1px);\n}\nth:first-child,\ntd:first-child {\n  padding-left: 0;\n}\nth:last-child,\ntd:last-child {\n  padding-right: 0;\n}\ntt,\ncode {\n  background-color: hsla(0, 0%, 0%, 0.04);\n  border-radius: 3px;\n  font-family: \"SFMono-Regular\", Consolas, \"Roboto Mono\", \"Droid Sans Mono\",\n    \"Liberation Mono\", Menlo, Courier, monospace;\n  padding: 0;\n  padding-top: 0.2em;\n  padding-bottom: 0.2em;\n}\npre code {\n  background: none;\n  line-height: 1.42;\n}\ncode:before,\ncode:after,\ntt:before,\ntt:after {\n  letter-spacing: -0.2em;\n  content: \" \";\n}\npre code:before,\npre code:after,\npre tt:before,\npre tt:after {\n  content: \"\";\n}\n@media only screen and (max-width: 480px) {\n  html {\n    font-size: 100%;\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/src/layouts/index.js",
    "content": "import React from 'react'\nimport PropTypes from 'prop-types'\nimport Helmet from 'react-helmet'\n\nimport Header from '../components/header'\nimport './index.css'\n\nconst Layout = ({ children, data }) => (\n  <div>\n    <Helmet\n      title={data.site.siteMetadata.title}\n      meta={[\n        { name: 'description', content: 'Sample' },\n        { name: 'keywords', content: 'sample, something' },\n      ]}\n    />\n    <Header siteTitle={data.site.siteMetadata.title} />\n    <div\n      style={{\n        margin: '0 auto',\n        maxWidth: 960,\n        padding: '0px 1.0875rem 1.45rem',\n        paddingTop: 0,\n      }}\n    >\n      {children()}\n    </div>\n  </div>\n)\n\nLayout.propTypes = {\n  children: PropTypes.func,\n}\n\nexport default Layout\n\nexport const query = graphql`\n  query SiteTitleQuery {\n    site {\n      siteMetadata {\n        title\n      }\n    }\n  }\n`\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/src/pages/404.js",
    "content": "import React from 'react'\n\nconst NotFoundPage = () => (\n  <div>\n    <h1>NOT FOUND</h1>\n    <p>You just hit a route that doesn&#39;t exist... the sadness.</p>\n  </div>\n)\n\nexport default NotFoundPage\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/src/pages/index.js",
    "content": "import React from 'react'\nimport Link from 'gatsby-link'\n\nconst IndexPage = () => (\n  <div>\n    <h1>Hi people</h1>\n    <p>Welcome to your new Gatsby site.</p>\n    <p>Now go build something great.</p>\n    <Link to=\"/page-2/\">Go to page 2</Link>\n  </div>\n)\n\nexport default IndexPage\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/gatsby/src/pages/page-2.js",
    "content": "import React from 'react'\nimport Link from 'gatsby-link'\n\nconst SecondPage = () => (\n  <div>\n    <h1>Hi from the second page</h1>\n    <p>Welcome to page 2</p>\n    <Link to=\"/\">Go back to the homepage</Link>\n  </div>\n)\n\nexport default SecondPage\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/.editorconfig",
    "content": "# Editor configuration, see https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\nmax_line_length = off\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/.gitignore",
    "content": "# See http://help.github.com/ignore-files/ for more about ignoring files.\n\n# compiled output\n/dist\n/tmp\n/out-tsc\n# Only exists if Bazel was run\n/bazel-out\n\n# dependencies\n/node_modules\n\n# profiling files\nchrome-profiler-events.json\nspeed-measure-plugin.json\n\n# IDEs and editors\n/.idea\n.project\n.classpath\n.c9/\n*.launch\n.settings/\n*.sublime-workspace\n\n# IDE - VSCode\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json\n.history/*\n\n# misc\n/.sass-cache\n/connect.lock\n/coverage\n/libpeerconnection.log\nnpm-debug.log\nyarn-error.log\ntestem.log\n/typings\n\n# System Files\n.DS_Store\nThumbs.db\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/README.md",
    "content": "# Ng8\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.0.1.\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/angular.json",
    "content": "{\n  \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n  \"version\": 1,\n  \"newProjectRoot\": \"projects\",\n  \"projects\": {\n    \"ng8\": {\n      \"projectType\": \"application\",\n      \"schematics\": {},\n      \"root\": \"\",\n      \"sourceRoot\": \"src\",\n      \"prefix\": \"app\",\n      \"architect\": {\n        \"build\": {\n          \"builder\": \"@angular-devkit/build-angular:browser\",\n          \"options\": {\n            \"outputPath\": \"dist/ng8\",\n            \"index\": \"src/index.html\",\n            \"main\": \"src/main.ts\",\n            \"polyfills\": \"src/polyfills.ts\",\n            \"tsConfig\": \"tsconfig.app.json\",\n            \"assets\": [\n              \"src/favicon.ico\",\n              \"src/assets\"\n            ],\n            \"styles\": [\n              \"src/styles.css\"\n            ],\n            \"scripts\": []\n          },\n          \"configurations\": {\n            \"production\": {\n              \"fileReplacements\": [\n                {\n                  \"replace\": \"src/environments/environment.ts\",\n                  \"with\": \"src/environments/environment.prod.ts\"\n                }\n              ],\n              \"optimization\": true,\n              \"outputHashing\": \"all\",\n              \"sourceMap\": false,\n              \"extractCss\": true,\n              \"namedChunks\": false,\n              \"aot\": true,\n              \"extractLicenses\": true,\n              \"vendorChunk\": false,\n              \"buildOptimizer\": true,\n              \"budgets\": [\n                {\n                  \"type\": \"initial\",\n                  \"maximumWarning\": \"2mb\",\n                  \"maximumError\": \"5mb\"\n                }\n              ]\n            }\n          }\n        },\n        \"serve\": {\n          \"builder\": \"@angular-devkit/build-angular:dev-server\",\n          \"options\": {\n            \"browserTarget\": \"ng8:build\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"browserTarget\": \"ng8:build:production\"\n            }\n          }\n        },\n        \"extract-i18n\": {\n          \"builder\": \"@angular-devkit/build-angular:extract-i18n\",\n          \"options\": {\n            \"browserTarget\": \"ng8:build\"\n          }\n        },\n        \"test\": {\n          \"builder\": \"@angular-devkit/build-angular:karma\",\n          \"options\": {\n            \"main\": \"src/test.ts\",\n            \"polyfills\": \"src/polyfills.ts\",\n            \"tsConfig\": \"tsconfig.spec.json\",\n            \"karmaConfig\": \"karma.conf.js\",\n            \"assets\": [\n              \"src/favicon.ico\",\n              \"src/assets\"\n            ],\n            \"styles\": [\n              \"src/styles.css\"\n            ],\n            \"scripts\": []\n          }\n        },\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"tsconfig.app.json\",\n              \"tsconfig.spec.json\",\n              \"e2e/tsconfig.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\"\n            ]\n          }\n        },\n        \"e2e\": {\n          \"builder\": \"@angular-devkit/build-angular:protractor\",\n          \"options\": {\n            \"protractorConfig\": \"e2e/protractor.conf.js\",\n            \"devServerTarget\": \"ng8:serve\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"devServerTarget\": \"ng8:serve:production\"\n            }\n          }\n        }\n      }\n    }},\n  \"defaultProject\": \"ng8\"\n}"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/browserslist",
    "content": "# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.\n# For additional information regarding the format and rule options, please see:\n# https://github.com/browserslist/browserslist#queries\n\n# You can see what browsers were selected by your queries by running:\n#   npx browserslist\n\n> 0.5%\nlast 2 versions\nFirefox ESR\nnot dead\nnot IE 9-11 # For IE 9-11 support, remove 'not'."
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/e2e/protractor.conf.js",
    "content": "// @ts-check\n// Protractor configuration file, see link for more information\n// https://github.com/angular/protractor/blob/master/lib/config.ts\n\nconst { SpecReporter } = require('jasmine-spec-reporter');\n\n/**\n * @type { import(\"protractor\").Config }\n */\nexports.config = {\n  allScriptsTimeout: 11000,\n  specs: [\n    './src/**/*.e2e-spec.ts'\n  ],\n  capabilities: {\n    'browserName': 'chrome'\n  },\n  directConnect: true,\n  baseUrl: 'http://localhost:4200/',\n  framework: 'jasmine',\n  jasmineNodeOpts: {\n    showColors: true,\n    defaultTimeoutInterval: 30000,\n    print: function() {}\n  },\n  onPrepare() {\n    require('ts-node').register({\n      project: require('path').join(__dirname, './tsconfig.json')\n    });\n    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));\n  }\n};"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/e2e/src/app.e2e-spec.ts",
    "content": "import { AppPage } from './app.po';\nimport { browser, logging } from 'protractor';\n\ndescribe('workspace-project App', () => {\n  let page: AppPage;\n\n  beforeEach(() => {\n    page = new AppPage();\n  });\n\n  it('should display welcome message', () => {\n    page.navigateTo();\n    expect(page.getTitleText()).toEqual('Welcome to ng8!');\n  });\n\n  afterEach(async () => {\n    // Assert that there are no errors emitted from the browser\n    const logs = await browser.manage().logs().get(logging.Type.BROWSER);\n    expect(logs).not.toContain(jasmine.objectContaining({\n      level: logging.Level.SEVERE,\n    } as logging.Entry));\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/e2e/src/app.po.ts",
    "content": "import { browser, by, element } from 'protractor';\n\nexport class AppPage {\n  navigateTo() {\n    return browser.get(browser.baseUrl) as Promise<any>;\n  }\n\n  getTitleText() {\n    return element(by.css('app-root h1')).getText() as Promise<string>;\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/e2e/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../out-tsc/e2e\",\n    \"module\": \"commonjs\",\n    \"target\": \"es5\",\n    \"types\": [\n      \"jasmine\",\n      \"jasminewd2\",\n      \"node\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/karma.conf.js",
    "content": "// Karma configuration file, see link for more information\n// https://karma-runner.github.io/1.0/config/configuration-file.html\n\nmodule.exports = function (config) {\n  config.set({\n    basePath: '',\n    frameworks: ['jasmine', '@angular-devkit/build-angular'],\n    plugins: [\n      require('karma-jasmine'),\n      require('karma-chrome-launcher'),\n      require('karma-jasmine-html-reporter'),\n      require('karma-coverage-istanbul-reporter'),\n      require('@angular-devkit/build-angular/plugins/karma')\n    ],\n    client: {\n      clearContext: false // leave Jasmine Spec Runner output visible in browser\n    },\n    coverageIstanbulReporter: {\n      dir: require('path').join(__dirname, './coverage/ng8'),\n      reports: ['html', 'lcovonly', 'text-summary'],\n      fixWebpackSourcePaths: true\n    },\n    reporters: ['progress', 'kjhtml'],\n    port: 9876,\n    colors: true,\n    logLevel: config.LOG_INFO,\n    autoWatch: true,\n    browsers: ['Chrome'],\n    singleRun: false,\n    restartOnFileChange: true\n  });\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/package.json",
    "content": "{\n  \"name\": \"ng8\",\n  \"version\": \"0.0.0\",\n  \"scripts\": {\n    \"ng\": \"ng\",\n    \"start\": \"ng serve\",\n    \"build\": \"ng build\",\n    \"test\": \"ng test\",\n    \"lint\": \"ng lint\",\n    \"e2e\": \"ng e2e\"\n  },\n  \"private\": true,\n  \"dependencies\": {\n    \"@angular/animations\": \"~8.0.0\",\n    \"@angular/common\": \"~8.0.0\",\n    \"@angular/compiler\": \"~8.0.0\",\n    \"@angular/core\": \"~8.0.0\",\n    \"@angular/forms\": \"~8.0.0\",\n    \"@angular/platform-browser\": \"~8.0.0\",\n    \"@angular/platform-browser-dynamic\": \"~8.0.0\",\n    \"@angular/router\": \"~8.0.0\",\n    \"rxjs\": \"~6.4.0\",\n    \"tslib\": \"^1.9.0\",\n    \"zone.js\": \"~0.9.1\"\n  },\n  \"devDependencies\": {\n    \"@angular-devkit/build-angular\": \"~0.800.0\",\n    \"@angular/cli\": \"~8.0.1\",\n    \"@angular/compiler-cli\": \"~8.0.0\",\n    \"@angular/language-service\": \"~8.0.0\",\n    \"@types/node\": \"~8.9.4\",\n    \"@types/jasmine\": \"~3.3.8\",\n    \"@types/jasminewd2\": \"~2.0.3\",\n    \"codelyzer\": \"^5.0.0\",\n    \"jasmine-core\": \"~3.4.0\",\n    \"jasmine-spec-reporter\": \"~4.2.1\",\n    \"karma\": \"~4.1.0\",\n    \"karma-chrome-launcher\": \"~2.2.0\",\n    \"karma-coverage-istanbul-reporter\": \"~2.0.1\",\n    \"karma-jasmine\": \"~2.0.1\",\n    \"karma-jasmine-html-reporter\": \"^1.4.0\",\n    \"protractor\": \"~5.4.0\",\n    \"ts-node\": \"~7.0.0\",\n    \"tslint\": \"~5.15.0\",\n    \"typescript\": \"~3.4.3\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/app/app-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\n\nconst routes: Routes = [];\n\n@NgModule({\n  imports: [RouterModule.forRoot(routes)],\n  exports: [RouterModule]\n})\nexport class AppRoutingModule { }\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/app/app.component.css",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/app/app.component.html",
    "content": "<!--The content below is only a placeholder and can be replaced.-->\n<div style=\"text-align:center\">\n  <h1>\n    Welcome to {{ title }}!\n  </h1>\n  <img width=\"300\" alt=\"Angular Logo\" src=\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==\">\n</div>\n<h2>Here are some links to help you start: </h2>\n<ul>\n  <li>\n    <h2><a target=\"_blank\" rel=\"noopener\" href=\"https://angular.io/tutorial\">Tour of Heroes</a></h2>\n  </li>\n  <li>\n    <h2><a target=\"_blank\" rel=\"noopener\" href=\"https://angular.io/cli\">CLI Documentation</a></h2>\n  </li>\n  <li>\n    <h2><a target=\"_blank\" rel=\"noopener\" href=\"https://blog.angular.io/\">Angular blog</a></h2>\n  </li>\n</ul>\n\n<router-outlet></router-outlet>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/app/app.component.spec.ts",
    "content": "import { TestBed, async } from '@angular/core/testing';\nimport { RouterTestingModule } from '@angular/router/testing';\nimport { AppComponent } from './app.component';\n\ndescribe('AppComponent', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [\n        RouterTestingModule\n      ],\n      declarations: [\n        AppComponent\n      ],\n    }).compileComponents();\n  }));\n\n  it('should create the app', () => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.debugElement.componentInstance;\n    expect(app).toBeTruthy();\n  });\n\n  it(`should have as title 'ng8'`, () => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.debugElement.componentInstance;\n    expect(app.title).toEqual('ng8');\n  });\n\n  it('should render title in a h1 tag', () => {\n    const fixture = TestBed.createComponent(AppComponent);\n    fixture.detectChanges();\n    const compiled = fixture.debugElement.nativeElement;\n    expect(compiled.querySelector('h1').textContent).toContain('Welcome to ng8!');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/app/app.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css']\n})\nexport class AppComponent {\n  title = 'ng8';\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/app/app.module.ts",
    "content": "import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppRoutingModule } from './app-routing.module';\nimport { AppComponent } from './app.component';\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n    AppRoutingModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/assets/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/environments/environment.prod.ts",
    "content": "export const environment = {\n  production: true\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/environments/environment.ts",
    "content": "// This file can be replaced during build by using the `fileReplacements` array.\n// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.\n// The list of file replacements can be found in `angular.json`.\n\nexport const environment = {\n  production: false\n};\n\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/dist/zone-error';  // Included with Angular CLI.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <title>Ng8</title>\n  <base href=\"/\">\n\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\">\n</head>\n<body>\n  <app-root></app-root>\n</body>\n</html>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/main.ts",
    "content": "import { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n  enableProdMode();\n}\n\nplatformBrowserDynamic().bootstrapModule(AppModule)\n  .catch(err => console.error(err));\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/polyfills.ts",
    "content": "/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfills to this file.\n *\n * This file is divided into 2 sections:\n *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.\n *   2. Application imports. Files imported after ZoneJS that should be loaded before your main\n *      file.\n *\n * The current setup is for so-called \"evergreen\" browsers; the last versions of browsers that\n * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),\n * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.\n *\n * Learn more in https://angular.io/guide/browser-support\n */\n\n/***************************************************************************************************\n * BROWSER POLYFILLS\n */\n\n/** IE10 and IE11 requires the following for NgClass support on SVG elements */\n// import 'classlist.js';  // Run `npm install --save classlist.js`.\n\n/**\n * Web Animations `@angular/platform-browser/animations`\n * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.\n * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).\n */\n// import 'web-animations-js';  // Run `npm install --save web-animations-js`.\n\n/**\n * By default, zone.js will patch all possible macroTask and DomEvents\n * user can disable parts of macroTask/DomEvents patch by setting following flags\n * because those flags need to be set before `zone.js` being loaded, and webpack\n * will put import in the top of bundle, so user need to create a separate file\n * in this directory (for example: zone-flags.ts), and put the following flags\n * into that file, and then add the following code before importing zone.js.\n * import './zone-flags.ts';\n *\n * The flags allowed in zone-flags.ts are listed here.\n *\n * The following flags will work for all browsers.\n *\n * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame\n * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick\n * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames\n *\n *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js\n *  with the following flag, it will bypass `zone.js` patch for IE/Edge\n *\n *  (window as any).__Zone_enable_cross_context_check = true;\n *\n */\n\n/***************************************************************************************************\n * Zone JS is required by default for Angular itself.\n */\nimport 'zone.js/dist/zone';  // Included with Angular CLI.\n\n\n/***************************************************************************************************\n * APPLICATION IMPORTS\n */\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/styles.css",
    "content": "/* You can add global styles to this file, and also import other style files */\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/src/test.ts",
    "content": "// This file is required by karma.conf.js and loads recursively all the .spec and framework files\n\nimport 'zone.js/dist/zone-testing';\nimport { getTestBed } from '@angular/core/testing';\nimport {\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\n\ndeclare const require: any;\n\n// First, initialize the Angular testing environment.\ngetTestBed().initTestEnvironment(\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting()\n);\n// Then we find all the tests.\nconst context = require.context('./', true, /\\.spec\\.ts$/);\n// And load the modules.\ncontext.keys().map(context);\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/tsconfig.app.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"./out-tsc/app\",\n    \"types\": []\n  },\n  \"include\": [\n    \"src/**/*.ts\"\n  ],\n  \"exclude\": [\n    \"src/test.ts\",\n    \"src/**/*.spec.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/tsconfig.json",
    "content": "{\n  \"compileOnSave\": false,\n  \"compilerOptions\": {\n    \"baseUrl\": \"./\",\n    \"outDir\": \"./dist/out-tsc\",\n    \"sourceMap\": true,\n    \"declaration\": false,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"emitDecoratorMetadata\": true,\n    \"experimentalDecorators\": true,\n    \"importHelpers\": true,\n    \"target\": \"es2015\",\n    \"typeRoots\": [\n      \"node_modules/@types\"\n    ],\n    \"lib\": [\n      \"es2018\",\n      \"dom\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"./out-tsc/spec\",\n    \"types\": [\n      \"jasmine\",\n      \"node\"\n    ]\n  },\n  \"files\": [\n    \"src/test.ts\",\n    \"src/polyfills.ts\"\n  ],\n  \"include\": [\n    \"src/**/*.spec.ts\",\n    \"src/**/*.d.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/ng8/tslint.json",
    "content": "{\n  \"extends\": \"tslint:recommended\",\n  \"rules\": {\n    \"array-type\": false,\n    \"arrow-parens\": false,\n    \"deprecation\": {\n      \"severity\": \"warn\"\n    },\n    \"component-class-suffix\": true,\n    \"contextual-lifecycle\": true,\n    \"directive-class-suffix\": true,\n    \"directive-selector\": [\n      true,\n      \"attribute\",\n      \"app\",\n      \"camelCase\"\n    ],\n    \"component-selector\": [\n      true,\n      \"element\",\n      \"app\",\n      \"kebab-case\"\n    ],\n    \"import-blacklist\": [\n      true,\n      \"rxjs/Rx\"\n    ],\n    \"interface-name\": false,\n    \"max-classes-per-file\": false,\n    \"max-line-length\": [\n      true,\n      140\n    ],\n    \"member-access\": false,\n    \"member-ordering\": [\n      true,\n      {\n        \"order\": [\n          \"static-field\",\n          \"instance-field\",\n          \"static-method\",\n          \"instance-method\"\n        ]\n      }\n    ],\n    \"no-consecutive-blank-lines\": false,\n    \"no-console\": [\n      true,\n      \"debug\",\n      \"info\",\n      \"time\",\n      \"timeEnd\",\n      \"trace\"\n    ],\n    \"no-empty\": false,\n    \"no-inferrable-types\": [\n      true,\n      \"ignore-params\"\n    ],\n    \"no-non-null-assertion\": true,\n    \"no-redundant-jsdoc\": true,\n    \"no-switch-case-fall-through\": true,\n    \"no-use-before-declare\": true,\n    \"no-var-requires\": false,\n    \"object-literal-key-quotes\": [\n      true,\n      \"as-needed\"\n    ],\n    \"object-literal-sort-keys\": false,\n    \"ordered-imports\": false,\n    \"quotemark\": [\n      true,\n      \"single\"\n    ],\n    \"trailing-comma\": false,\n    \"no-conflicting-lifecycle\": true,\n    \"no-host-metadata-property\": true,\n    \"no-input-rename\": true,\n    \"no-inputs-metadata-property\": true,\n    \"no-output-native\": true,\n    \"no-output-on-prefix\": true,\n    \"no-output-rename\": true,\n    \"no-outputs-metadata-property\": true,\n    \"template-banana-in-box\": true,\n    \"template-no-negated-async\": true,\n    \"use-lifecycle-interface\": true,\n    \"use-pipe-transform-interface\": true\n  },\n  \"rulesDirectory\": [\n    \"codelyzer\"\n  ]\n}"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 Christian Janz\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/README.md",
    "content": "# Angular monorepo example using Nx\n\nThis app shows the process of refactoring an Angular app to a monorepo with the help of [Nx](https://nx.dev/angular)\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/angular.json",
    "content": "{\n  \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n  \"version\": 1,\n  \"newProjectRoot\": \"\",\n  \"projects\": {\n    \"ng-cli-app\": {\n      \"projectType\": \"application\",\n      \"schematics\": {\n        \"@schematics/angular:component\": {\n          \"style\": \"scss\"\n        }\n      },\n      \"root\": \"apps/ng-cli-app\",\n      \"sourceRoot\": \"apps/ng-cli-app/src\",\n      \"prefix\": \"app\",\n      \"architect\": {\n        \"build\": {\n          \"builder\": \"@angular-devkit/build-angular:browser\",\n          \"options\": {\n            \"outputPath\": \"dist/apps/ng-cli-app\",\n            \"index\": \"apps/ng-cli-app/src/index.html\",\n            \"main\": \"apps/ng-cli-app/src/main.ts\",\n            \"polyfills\": \"apps/ng-cli-app/src/polyfills.ts\",\n            \"tsConfig\": \"apps/ng-cli-app/tsconfig.app.json\",\n            \"aot\": false,\n            \"assets\": [\n              \"apps/ng-cli-app/src/favicon.ico\",\n              \"apps/ng-cli-app/src/assets\"\n            ],\n            \"styles\": [\n              \"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css\",\n              \"apps/ng-cli-app/src/styles.scss\"\n            ],\n            \"scripts\": []\n          },\n          \"configurations\": {\n            \"production\": {\n              \"fileReplacements\": [\n                {\n                  \"replace\": \"apps/ng-cli-app/src/environments/environment.ts\",\n                  \"with\": \"apps/ng-cli-app/src/environments/environment.prod.ts\"\n                }\n              ],\n              \"optimization\": true,\n              \"outputHashing\": \"all\",\n              \"sourceMap\": false,\n              \"extractCss\": true,\n              \"namedChunks\": false,\n              \"aot\": true,\n              \"extractLicenses\": true,\n              \"vendorChunk\": false,\n              \"buildOptimizer\": true,\n              \"budgets\": [\n                {\n                  \"type\": \"initial\",\n                  \"maximumWarning\": \"2mb\",\n                  \"maximumError\": \"5mb\"\n                },\n                {\n                  \"type\": \"anyComponentStyle\",\n                  \"maximumWarning\": \"6kb\",\n                  \"maximumError\": \"10kb\"\n                }\n              ]\n            }\n          }\n        },\n        \"serve\": {\n          \"builder\": \"@angular-devkit/build-angular:dev-server\",\n          \"options\": {\n            \"browserTarget\": \"ng-cli-app:build\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"browserTarget\": \"ng-cli-app:build:production\"\n            }\n          }\n        },\n        \"extract-i18n\": {\n          \"builder\": \"@angular-devkit/build-angular:extract-i18n\",\n          \"options\": {\n            \"browserTarget\": \"ng-cli-app:build\"\n          }\n        },\n        \"test\": {\n          \"builder\": \"@angular-devkit/build-angular:karma\",\n          \"options\": {\n            \"main\": \"apps/ng-cli-app/src/test.ts\",\n            \"polyfills\": \"apps/ng-cli-app/src/polyfills.ts\",\n            \"tsConfig\": \"apps/ng-cli-app/tsconfig.spec.json\",\n            \"karmaConfig\": \"apps/ng-cli-app/karma.conf.js\",\n            \"assets\": [\n              \"apps/ng-cli-app/src/favicon.ico\",\n              \"apps/ng-cli-app/src/assets\"\n            ],\n            \"styles\": [\n              \"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css\",\n              \"apps/ng-cli-app/src/styles.scss\"\n            ],\n            \"scripts\": []\n          }\n        },\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"apps/ng-cli-app/tsconfig.app.json\",\n              \"apps/ng-cli-app/tsconfig.spec.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\"\n            ]\n          }\n        }\n      }\n    },\n    \"ng-cli-app-e2e\": {\n      \"projectType\": \"application\",\n      \"root\": \"apps/ng-cli-app-e2e\",\n      \"architect\": {\n        \"e2e\": {\n          \"builder\": \"@nrwl/cypress:cypress\",\n          \"options\": {\n            \"cypressConfig\": \"apps/ng-cli-app-e2e/cypress.json\",\n            \"devServerTarget\": \"ng-cli-app:serve\",\n            \"tsConfig\": \"apps/ng-cli-app-e2e/tsconfig.e2e.json\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"devServerTarget\": \"ng-cli-app:serve:production\"\n            }\n          }\n        },\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": \"apps/ng-cli-app-e2e/tsconfig.json\",\n            \"exclude\": [\n              \"**/node_modules/**\"\n            ]\n          }\n        }\n      }\n    },\n    \"shared-components\": {\n      \"projectType\": \"library\",\n      \"root\": \"libs/shared/components\",\n      \"sourceRoot\": \"libs/shared/components/src\",\n      \"prefix\": \"ng-cli-app\",\n      \"architect\": {\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"libs/shared/components/tsconfig.lib.json\",\n              \"libs/shared/components/tsconfig.spec.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\",\n              \"!libs/shared/components/**\"\n            ]\n          }\n        },\n        \"test\": {\n          \"builder\": \"@nrwl/jest:jest\",\n          \"options\": {\n            \"jestConfig\": \"libs/shared/components/jest.config.js\",\n            \"tsConfig\": \"libs/shared/components/tsconfig.spec.json\",\n            \"setupFile\": \"libs/shared/components/src/test-setup.ts\"\n          }\n        },\n        \"storybook\": {\n          \"builder\": \"@nrwl/storybook:storybook\",\n          \"options\": {\n            \"uiFramework\": \"@storybook/angular\",\n            \"port\": 4400,\n            \"config\": {\n              \"configFolder\": \"libs/shared/components/.storybook\"\n            }\n          },\n          \"configurations\": {\n            \"ci\": {\n              \"quiet\": true\n            }\n          }\n        }\n      },\n      \"schematics\": {\n        \"@nrwl/angular:component\": {\n          \"styleext\": \"scss\"\n        }\n      }\n    },\n    \"auth\": {\n      \"projectType\": \"library\",\n      \"root\": \"libs/auth\",\n      \"sourceRoot\": \"libs/auth/src\",\n      \"prefix\": \"app\",\n      \"architect\": {\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"libs/auth/tsconfig.lib.json\",\n              \"libs/auth/tsconfig.spec.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\",\n              \"!libs/auth/**\"\n            ]\n          }\n        },\n        \"test\": {\n          \"builder\": \"@nrwl/jest:jest\",\n          \"options\": {\n            \"jestConfig\": \"libs/auth/jest.config.js\",\n            \"tsConfig\": \"libs/auth/tsconfig.spec.json\",\n            \"setupFile\": \"libs/auth/src/test-setup.ts\"\n          }\n        }\n      },\n      \"schematics\": {\n        \"@nrwl/angular:component\": {\n          \"styleext\": \"scss\"\n        }\n      }\n    },\n    \"feat-customers\": {\n      \"projectType\": \"library\",\n      \"root\": \"libs/customers/ui\",\n      \"sourceRoot\": \"libs/customers/ui/src\",\n      \"prefix\": \"app\",\n      \"architect\": {\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"libs/customers/ui/tsconfig.lib.json\",\n              \"libs/customers/ui/tsconfig.spec.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\",\n              \"!libs/customers/ui/**\"\n            ]\n          }\n        },\n        \"test\": {\n          \"builder\": \"@nrwl/jest:jest\",\n          \"options\": {\n            \"jestConfig\": \"libs/customers/ui/jest.config.js\",\n            \"tsConfig\": \"libs/customers/ui/tsconfig.spec.json\",\n            \"setupFile\": \"libs/customers/ui/src/test-setup.ts\"\n          }\n        }\n      },\n      \"schematics\": {\n        \"@nrwl/angular:component\": {\n          \"styleext\": \"scss\"\n        }\n      }\n    },\n    \"customers-data\": {\n      \"projectType\": \"library\",\n      \"root\": \"libs/customers/data\",\n      \"sourceRoot\": \"libs/customers/data/src\",\n      \"prefix\": \"app\",\n      \"architect\": {\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"libs/customers/data/tsconfig.lib.json\",\n              \"libs/customers/data/tsconfig.spec.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\",\n              \"!libs/customers/data/**\"\n            ]\n          }\n        },\n        \"test\": {\n          \"builder\": \"@nrwl/jest:jest\",\n          \"options\": {\n            \"jestConfig\": \"libs/customers/data/jest.config.js\",\n            \"tsConfig\": \"libs/customers/data/tsconfig.spec.json\",\n            \"setupFile\": \"libs/customers/data/src/test-setup.ts\"\n          }\n        }\n      },\n      \"schematics\": {\n        \"@nrwl/angular:component\": {\n          \"styleext\": \"scss\"\n        }\n      }\n    },\n    \"feat-home\": {\n      \"projectType\": \"library\",\n      \"root\": \"libs/home/ui\",\n      \"sourceRoot\": \"libs/home/ui/src\",\n      \"prefix\": \"app\",\n      \"architect\": {\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"libs/home/ui/tsconfig.lib.json\",\n              \"libs/home/ui/tsconfig.spec.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\",\n              \"!libs/home/ui/**\"\n            ]\n          }\n        },\n        \"test\": {\n          \"builder\": \"@nrwl/jest:jest\",\n          \"options\": {\n            \"jestConfig\": \"libs/home/ui/jest.config.js\",\n            \"tsConfig\": \"libs/home/ui/tsconfig.spec.json\",\n            \"setupFile\": \"libs/home/ui/src/test-setup.ts\"\n          }\n        },\n        \"storybook\": {\n          \"builder\": \"@nrwl/storybook:storybook\",\n          \"options\": {\n            \"uiFramework\": \"@storybook/angular\",\n            \"port\": 4400,\n            \"config\": {\n              \"configFolder\": \"libs/home/ui/.storybook\"\n            }\n          },\n          \"configurations\": {\n            \"ci\": {\n              \"quiet\": true\n            }\n          }\n        }\n      },\n      \"schematics\": {\n        \"@nrwl/angular:component\": {\n          \"styleext\": \"scss\"\n        }\n      }\n    },\n    \"shared-components-e2e\": {\n      \"root\": \"apps/shared-components-e2e\",\n      \"sourceRoot\": \"apps/shared-components-e2e/src\",\n      \"projectType\": \"application\",\n      \"architect\": {\n        \"e2e\": {\n          \"builder\": \"@nrwl/cypress:cypress\",\n          \"options\": {\n            \"cypressConfig\": \"apps/shared-components-e2e/cypress.json\",\n            \"tsConfig\": \"apps/shared-components-e2e/tsconfig.e2e.json\",\n            \"devServerTarget\": \"shared-components:storybook\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"devServerTarget\": \"shared-components:serve:production\"\n            }\n          }\n        },\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"apps/shared-components-e2e/tsconfig.e2e.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\",\n              \"!apps/shared-components-e2e/**\"\n            ]\n          }\n        }\n      }\n    },\n    \"feat-home-e2e\": {\n      \"root\": \"apps/feat-home-e2e\",\n      \"sourceRoot\": \"apps/feat-home-e2e/src\",\n      \"projectType\": \"application\",\n      \"architect\": {\n        \"e2e\": {\n          \"builder\": \"@nrwl/cypress:cypress\",\n          \"options\": {\n            \"cypressConfig\": \"apps/feat-home-e2e/cypress.json\",\n            \"tsConfig\": \"apps/feat-home-e2e/tsconfig.e2e.json\",\n            \"devServerTarget\": \"feat-home:storybook\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"devServerTarget\": \"feat-home:serve:production\"\n            }\n          }\n        },\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"apps/feat-home-e2e/tsconfig.e2e.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\",\n              \"!apps/feat-home-e2e/**\"\n            ]\n          }\n        }\n      }\n    }\n  },\n  \"defaultProject\": \"ng-cli-app\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/customers-ui-e2e/src/integration/customers.component.spec.ts",
    "content": "describe('feat-customers', () => {\n  beforeEach(() => cy.visit('/iframe.html?id=customerscomponent--primary'));\n\n  it('should display correctly', () => {\n    cy.wait(30000);\n    cy.findByText('Customer Data');\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '1')\n      .should('contain', 'Waulker');\n  });\n  it('should sort by first name', () => {\n    cy.findByText('first_name').click();\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '22')\n      .should('contain', 'Scattergood');\n\n    cy.findByText('first_name').click();\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '25')\n      .should('contain', 'Getley');\n\n    cy.findByText('first_name').click();\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '1')\n      .should('contain', 'Waulker');\n  });\n\n  it('should render the component', () => {\n    cy.get('app-customers').should('exist');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/cypress.json",
    "content": "{\n  \"fileServerFolder\": \".\",\n  \"fixturesFolder\": \"./src/fixtures\",\n  \"integrationFolder\": \"./src/integration\",\n  \"modifyObstructiveCode\": false,\n  \"pluginsFile\": \"./src/plugins/index\",\n  \"supportFile\": \"./src/support/index.ts\",\n  \"video\": true,\n  \"videosFolder\": \"../../dist/cypress/apps/feat-home-e2e/videos\",\n  \"screenshotsFolder\": \"../../dist/cypress/apps/feat-home-e2e/screenshots\",\n  \"chromeWebSecurity\": false,\n  \"baseUrl\": \"http://localhost:4400\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/fixtures/example.json",
    "content": "{\n  \"name\": \"Using fixtures to represent data\",\n  \"email\": \"hello@cypress.io\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/integration/home.component.spec.ts",
    "content": "describe('feat-home', () => {\n  beforeEach(() => cy.visit('/iframe.html?id=homecomponent--primary'));\n\n  it('should display correctly', () => {\n    cy.wait(30000);\n    cy.findByText('Welcome to the Demo App');\n    cy.findByText('🥳 Customer of the day');\n    cy.contains('mat-icon', 'person');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/plugins/index.js",
    "content": "// ***********************************************************\n// This example plugins/index.js can be used to load plugins\n//\n// You can change the location of this file or turn off loading\n// the plugins file with the 'pluginsFile' configuration option.\n//\n// You can read more here:\n// https://on.cypress.io/plugins-guide\n// ***********************************************************\n\n// This function is called when a project is opened or re-opened (e.g. due to\n// the project's config changing)\n\nconst { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor');\n\nmodule.exports = (on, config) => {\n  // `on` is used to hook into various events Cypress emits\n  // `config` is the resolved Cypress config\n\n  // Preprocess Typescript\n  on('file:preprocessor', preprocessTypescript(config));\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/support/commands.ts",
    "content": "// ***********************************************\n// This example commands.js shows you how to\n// create various custom commands and overwrite\n// existing commands.\n//\n// For more comprehensive examples of custom\n// commands please read more here:\n// https://on.cypress.io/custom-commands\n// ***********************************************\n// eslint-disable-next-line @typescript-eslint/no-namespace\nimport '@testing-library/cypress/add-commands';\n\ndeclare namespace Cypress {\n  interface Chainable<Subject> {\n    login(email: string, password: string): void;\n  }\n}\n//\n// -- This is a parent command --\nCypress.Commands.add('login', (email, password) => {\n  console.log('Custom command example: Login', email, password);\n});\n//\n// -- This is a child command --\n// Cypress.Commands.add(\"drag\", { prevSubject: 'element'}, (subject, options) => { ... })\n//\n//\n// -- This is a dual command --\n// Cypress.Commands.add(\"dismiss\", { prevSubject: 'optional'}, (subject, options) => { ... })\n//\n//\n// -- This will overwrite an existing command --\n// Cypress.Commands.overwrite(\"visit\", (originalFn, url, options) => { ... })\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/support/index.ts",
    "content": "// ***********************************************************\n// This example support/index.js is processed and\n// loaded automatically before your test files.\n//\n// This is a great place to put global configuration and\n// behavior that modifies Cypress.\n//\n// You can change the location of this file or turn off\n// automatically serving support files with the\n// 'supportFile' configuration option.\n//\n// You can read more here:\n// https://on.cypress.io/configuration\n// ***********************************************************\n\n// Import commands.js using ES2015 syntax:\nimport './commands';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/tsconfig.e2e.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"sourceMap\": false,\n    \"outDir\": \"../../dist/out-tsc\"\n  },\n  \"include\": [\"src/**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"cypress\", \"node\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/tslint.json",
    "content": "{\"extends\":\"../../tslint.json\",\"rules\":[]}"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/browserslist",
    "content": "# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.\n# For additional information regarding the format and rule options, please see:\n# https://github.com/browserslist/browserslist#queries\n\n# You can see what browsers were selected by your queries by running:\n#   npx browserslist\n\n> 0.5%\nlast 2 versions\nFirefox ESR\nnot dead\nnot IE 9-11 # For IE 9-11 support, remove 'not'."
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/karma.conf.js",
    "content": "// Karma configuration file, see link for more information\n// https://karma-runner.github.io/1.0/config/configuration-file.html\n\nmodule.exports = function(config) {\n  config.set({\n    basePath: '',\n    frameworks: ['jasmine', '@angular-devkit/build-angular'],\n    plugins: [\n      require('karma-jasmine'),\n      require('karma-chrome-launcher'),\n      require('karma-jasmine-html-reporter'),\n      require('karma-coverage-istanbul-reporter'),\n      require('@angular-devkit/build-angular/plugins/karma')\n    ],\n    client: {\n      clearContext: false // leave Jasmine Spec Runner output visible in browser\n    },\n    coverageIstanbulReporter: {\n      dir: require('path').join(__dirname, './coverage/ng-cli-app'),\n      reports: ['html', 'lcovonly', 'text-summary'],\n      fixWebpackSourcePaths: true\n    },\n    reporters: ['progress', 'kjhtml'],\n    port: 9876,\n    colors: true,\n    logLevel: config.LOG_INFO,\n    autoWatch: true,\n    browsers: ['Chrome'],\n    singleRun: true,\n    restartOnFileChange: true\n  });\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.html",
    "content": "<app-navigation>\n  <header>\n    <ng-container *ngIf=\"user$ | async as user\">\n      <span>{{ user.fullName }}</span>\n      <button mat-button (click)=\"logout()\">Logout</button>\n    </ng-container>\n  </header>\n  <router-outlet></router-outlet>\n</app-navigation>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.scss",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.spec.ts",
    "content": "import { TestBed, async } from '@angular/core/testing';\nimport { RouterTestingModule } from '@angular/router/testing';\nimport { AppComponent } from './app.component';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SharedComponentsModule } from '@ng-cli-app/shared/components';\n\ndescribe('AppComponent', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [\n        RouterTestingModule,\n        NoopAnimationsModule,\n        SharedComponentsModule\n      ],\n      declarations: [AppComponent]\n    }).compileComponents();\n  }));\n\n  it('should create the app', () => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.debugElement.componentInstance;\n    expect(app).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.ts",
    "content": "import { IdleMonitorService } from '@scullyio/ng-lib';\nimport { Component, OnInit } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AuthService, User } from '@ng-cli-app/auth';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.scss']\n})\nexport class AppComponent implements OnInit {\n  public user$: Observable<User>;\n\n  constructor(\n    private idle: IdleMonitorService,\n    private authService: AuthService\n  ) {}\n\n  ngOnInit(): void {\n    this.user$ = this.authService.currentUser$;\n  }\n\n  public logout() {\n    this.authService.logout();\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.module.ts",
    "content": "import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppComponent } from './app.component';\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\nimport { HttpClientModule } from '@angular/common/http';\n\nimport { SharedComponentsModule } from '@ng-cli-app/shared/components';\nimport { MatButtonModule } from '@angular/material/button';\nimport { AuthModule, AUTH_ROUTES, AuthGuard } from '@ng-cli-app/auth';\nimport { Routes, RouterModule } from '@angular/router';\n\nexport const routes: Routes = [\n  { path: '', pathMatch: 'full', redirectTo: '/home' },\n  { path: 'auth', children: AUTH_ROUTES },\n  {\n    path: 'home',\n    loadChildren: () => import('@ng-cli-app/home/ui').then(m => m.HomeUiModule),\n    canActivate: [AuthGuard]\n  },\n  {\n    path: 'customers',\n    loadChildren: () =>\n      import('@ng-cli-app/customers/ui').then(m => m.CustomersUiModule),\n    canActivate: [AuthGuard]\n  }\n];\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [\n    BrowserModule,\n    HttpClientModule,\n    RouterModule.forRoot(routes),\n    BrowserAnimationsModule,\n    SharedComponentsModule,\n    MatButtonModule,\n    AuthModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/assets/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/assets/customers.json",
    "content": "[\n  {\n    \"id\": 1,\n    \"first_name\": \"Leigha\",\n    \"last_name\": \"Waulker\",\n    \"email\": \"lwaulker0@disqus.com\",\n    \"street\": \"73587 Dunning Hill\",\n    \"city\": \"Newark\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 2,\n    \"first_name\": \"Wilek\",\n    \"last_name\": \"Warke\",\n    \"email\": \"wwarke1@canalblog.com\",\n    \"street\": \"89992 Blaine Drive\",\n    \"city\": \"Fresno\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 3,\n    \"first_name\": \"Malory\",\n    \"last_name\": \"Gobolos\",\n    \"email\": \"mgobolos2@devhub.com\",\n    \"street\": \"786 Westport Place\",\n    \"city\": \"Hamburg Winterhude\",\n    \"country\": \"Germany\"\n  },\n  {\n    \"id\": 4,\n    \"first_name\": \"Idette\",\n    \"last_name\": \"Ferris\",\n    \"email\": \"iferris3@imgur.com\",\n    \"street\": \"24859 Bobwhite Circle\",\n    \"city\": \"Honolulu\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 5,\n    \"first_name\": \"Tierney\",\n    \"last_name\": \"Baude\",\n    \"email\": \"tbaude4@biblegateway.com\",\n    \"street\": \"6738 Golden Leaf Avenue\",\n    \"city\": \"Charlotte\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 6,\n    \"first_name\": \"Philipa\",\n    \"last_name\": \"Wimsett\",\n    \"email\": \"pwimsett5@etsy.com\",\n    \"street\": \"820 Oneill Street\",\n    \"city\": \"Duluth\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 7,\n    \"first_name\": \"Sheilakathryn\",\n    \"last_name\": \"Bealton\",\n    \"email\": \"sbealton6@tripadvisor.com\",\n    \"street\": \"57245 Jana Place\",\n    \"city\": \"Portland\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 8,\n    \"first_name\": \"Glyn\",\n    \"last_name\": \"Pyer\",\n    \"email\": \"gpyer7@sbwire.com\",\n    \"street\": \"3242 Reinke Junction\",\n    \"city\": \"Toledo\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 9,\n    \"first_name\": \"Rahel\",\n    \"last_name\": \"Bowker\",\n    \"email\": \"rbowker8@narod.ru\",\n    \"street\": \"4415 Rutledge Center\",\n    \"city\": \"Washington\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 10,\n    \"first_name\": \"Harriette\",\n    \"last_name\": \"Dany\",\n    \"email\": \"hdany9@rakuten.co.jp\",\n    \"street\": \"3479 Sage Court\",\n    \"city\": \"Milwaukee\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 11,\n    \"first_name\": \"Janot\",\n    \"last_name\": \"Seekings\",\n    \"email\": \"jseekingsa@java.com\",\n    \"street\": \"46885 Village Parkway\",\n    \"city\": \"New Haven\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 12,\n    \"first_name\": \"Ede\",\n    \"last_name\": \"Joss\",\n    \"email\": \"ejossb@nhs.uk\",\n    \"street\": \"54317 Forster Street\",\n    \"city\": \"Fort Wayne\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 13,\n    \"first_name\": \"Brina\",\n    \"last_name\": \"Kerslake\",\n    \"email\": \"bkerslakec@issuu.com\",\n    \"street\": \"66 Ohio Road\",\n    \"city\": \"Atlanta\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 14,\n    \"first_name\": \"Fayth\",\n    \"last_name\": \"Duchart\",\n    \"email\": \"fduchartd@nymag.com\",\n    \"street\": \"69126 Green Ridge Drive\",\n    \"city\": \"Scranton\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 15,\n    \"first_name\": \"Olivie\",\n    \"last_name\": \"Archibald\",\n    \"email\": \"oarchibalde@vkontakte.ru\",\n    \"street\": \"155 Mccormick Center\",\n    \"city\": \"Shreveport\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 16,\n    \"first_name\": \"Ree\",\n    \"last_name\": \"Wiles\",\n    \"email\": \"rwilesf@narod.ru\",\n    \"street\": \"8 Marcy Terrace\",\n    \"city\": \"Amsterdam Nieuw West\",\n    \"country\": \"Netherlands\"\n  },\n  {\n    \"id\": 17,\n    \"first_name\": \"Coleen\",\n    \"last_name\": \"Bardell\",\n    \"email\": \"cbardellg@ustream.tv\",\n    \"street\": \"18310 Kensington Way\",\n    \"city\": \"Columbus\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 18,\n    \"first_name\": \"Camilla\",\n    \"last_name\": \"Crissil\",\n    \"email\": \"ccrissilh@narod.ru\",\n    \"street\": \"5751 Mallory Crossing\",\n    \"city\": \"Chicago\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 19,\n    \"first_name\": \"Gallagher\",\n    \"last_name\": \"McKennan\",\n    \"email\": \"gmckennani@wikipedia.org\",\n    \"street\": \"443 Lerdahl Point\",\n    \"city\": \"Fort Worth\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 20,\n    \"first_name\": \"Gretal\",\n    \"last_name\": \"Laughren\",\n    \"email\": \"glaughrenj@dot.gov\",\n    \"street\": \"950 Debra Trail\",\n    \"city\": \"Bryan\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 21,\n    \"first_name\": \"Celina\",\n    \"last_name\": \"Piddocke\",\n    \"email\": \"cpiddockek@microsoft.com\",\n    \"street\": \"28111 Twin Pines Pass\",\n    \"city\": \"Greensboro\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 22,\n    \"first_name\": \"Alverta\",\n    \"last_name\": \"Scattergood\",\n    \"email\": \"ascattergoodl@w3.org\",\n    \"street\": \"44397 Pankratz Court\",\n    \"city\": \"Sioux Falls\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 23,\n    \"first_name\": \"Codee\",\n    \"last_name\": \"Brugden\",\n    \"email\": \"cbrugdenm@google.fr\",\n    \"street\": \"4643 Fuller Alley\",\n    \"city\": \"Oklahoma City\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 24,\n    \"first_name\": \"Olivero\",\n    \"last_name\": \"Linfield\",\n    \"email\": \"olinfieldn@vistaprint.com\",\n    \"street\": \"4903 Pepper Wood Street\",\n    \"city\": \"Austin\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 25,\n    \"first_name\": \"Zorine\",\n    \"last_name\": \"Getley\",\n    \"email\": \"zgetleyo@nps.gov\",\n    \"street\": \"51120 Comanche Junction\",\n    \"city\": \"Woerden\",\n    \"country\": \"Netherlands\"\n  },\n  {\n    \"id\": 26,\n    \"first_name\": \"Rafael\",\n    \"last_name\": \"MacGraith\",\n    \"email\": \"rmacgraithp@whitehouse.gov\",\n    \"street\": \"46 Mallard Drive\",\n    \"city\": \"New York City\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 27,\n    \"first_name\": \"Kaine\",\n    \"last_name\": \"Fantini\",\n    \"email\": \"kfantiniq@feedburner.com\",\n    \"street\": \"842 Annamark Alley\",\n    \"city\": \"Orlando\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 28,\n    \"first_name\": \"Dorthea\",\n    \"last_name\": \"Carlet\",\n    \"email\": \"dcarletr@last.fm\",\n    \"street\": \"46600 Ilene Point\",\n    \"city\": \"Pittsburgh\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 29,\n    \"first_name\": \"Velvet\",\n    \"last_name\": \"Kielty\",\n    \"email\": \"vkieltys@last.fm\",\n    \"street\": \"495 Dapin Park\",\n    \"city\": \"Las Vegas\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 30,\n    \"first_name\": \"Elfie\",\n    \"last_name\": \"Wickey\",\n    \"email\": \"ewickeyt@blog.com\",\n    \"street\": \"12968 Mandrake Park\",\n    \"city\": \"Kerkrade\",\n    \"country\": \"Netherlands\"\n  },\n  {\n    \"id\": 31,\n    \"first_name\": \"Ivan\",\n    \"last_name\": \"Prigmore\",\n    \"email\": \"iprigmoreu@narod.ru\",\n    \"street\": \"82693 Mitchell Pass\",\n    \"city\": \"Omaha\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 32,\n    \"first_name\": \"Christos\",\n    \"last_name\": \"Daughton\",\n    \"email\": \"cdaughtonv@si.edu\",\n    \"street\": \"78 Dexter Crossing\",\n    \"city\": \"Vlissingen\",\n    \"country\": \"Netherlands\"\n  },\n  {\n    \"id\": 33,\n    \"first_name\": \"Bethina\",\n    \"last_name\": \"Yarnton\",\n    \"email\": \"byarntonw@istockphoto.com\",\n    \"street\": \"4140 Loeprich Junction\",\n    \"city\": \"Bradenton\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 34,\n    \"first_name\": \"Erwin\",\n    \"last_name\": \"Toland\",\n    \"email\": \"etolandx@cnet.com\",\n    \"street\": \"624 Blue Bill Park Park\",\n    \"city\": \"Boise\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 35,\n    \"first_name\": \"Durand\",\n    \"last_name\": \"Henrot\",\n    \"email\": \"dhenroty@surveymonkey.com\",\n    \"street\": \"00231 Southridge Hill\",\n    \"city\": \"Houston\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 36,\n    \"first_name\": \"Frederik\",\n    \"last_name\": \"Penkethman\",\n    \"email\": \"fpenkethmanz@amazon.co.jp\",\n    \"street\": \"42 Goodland Street\",\n    \"city\": \"Colorado Springs\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 37,\n    \"first_name\": \"Jacquie\",\n    \"last_name\": \"Scrivinor\",\n    \"email\": \"jscrivinor10@wikipedia.org\",\n    \"street\": \"18040 Anhalt Park\",\n    \"city\": \"Midland\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 38,\n    \"first_name\": \"Herta\",\n    \"last_name\": \"Trengrouse\",\n    \"email\": \"htrengrouse11@tiny.cc\",\n    \"street\": \"70124 Hoepker Point\",\n    \"city\": \"'s-Hertogenbosch\",\n    \"country\": \"Netherlands\"\n  },\n  {\n    \"id\": 39,\n    \"first_name\": \"Babita\",\n    \"last_name\": \"Tott\",\n    \"email\": \"btott12@i2i.jp\",\n    \"street\": \"8439 Portage Alley\",\n    \"city\": \"Boulder\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 40,\n    \"first_name\": \"Raquel\",\n    \"last_name\": \"Doram\",\n    \"email\": \"rdoram13@360.cn\",\n    \"street\": \"6 Crownhardt Hill\",\n    \"city\": \"Brooklyn\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 41,\n    \"first_name\": \"Iolande\",\n    \"last_name\": \"Gouldbourn\",\n    \"email\": \"igouldbourn14@adobe.com\",\n    \"street\": \"125 Logan Trail\",\n    \"city\": \"Asheville\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 42,\n    \"first_name\": \"Alwin\",\n    \"last_name\": \"Corss\",\n    \"email\": \"acorss15@wiley.com\",\n    \"street\": \"26 Arizona Park\",\n    \"city\": \"Boston\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 43,\n    \"first_name\": \"Glen\",\n    \"last_name\": \"Frentz\",\n    \"email\": \"gfrentz16@princeton.edu\",\n    \"street\": \"836 Butternut Court\",\n    \"city\": \"Hannover\",\n    \"country\": \"Germany\"\n  },\n  {\n    \"id\": 44,\n    \"first_name\": \"Betsey\",\n    \"last_name\": \"Morgen\",\n    \"email\": \"bmorgen17@berkeley.edu\",\n    \"street\": \"343 American Ash Circle\",\n    \"city\": \"Herne\",\n    \"country\": \"Germany\"\n  },\n  {\n    \"id\": 45,\n    \"first_name\": \"Georgeanne\",\n    \"last_name\": \"Gherardini\",\n    \"email\": \"ggherardini18@patch.com\",\n    \"street\": \"8 Glendale Drive\",\n    \"city\": \"Portland\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 46,\n    \"first_name\": \"Wes\",\n    \"last_name\": \"Stuttard\",\n    \"email\": \"wstuttard19@paginegialle.it\",\n    \"street\": \"810 Randy Avenue\",\n    \"city\": \"Dayton\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 47,\n    \"first_name\": \"Manuel\",\n    \"last_name\": \"Hummerston\",\n    \"email\": \"mhummerston1a@unicef.org\",\n    \"street\": \"9 Delaware Road\",\n    \"city\": \"Wichita\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 48,\n    \"first_name\": \"Netty\",\n    \"last_name\": \"Santry\",\n    \"email\": \"nsantry1b@people.com.cn\",\n    \"street\": \"7830 North Point\",\n    \"city\": \"Rotterdam postbusnummers\",\n    \"country\": \"Netherlands\"\n  },\n  {\n    \"id\": 49,\n    \"first_name\": \"Tansy\",\n    \"last_name\": \"Mazzilli\",\n    \"email\": \"tmazzilli1c@t-online.de\",\n    \"street\": \"8152 Buhler Avenue\",\n    \"city\": \"Annapolis\",\n    \"country\": \"United States\"\n  },\n  {\n    \"id\": 50,\n    \"first_name\": \"Remus\",\n    \"last_name\": \"Coultar\",\n    \"email\": \"rcoultar1d@ovh.net\",\n    \"street\": \"5935 Ohio Avenue\",\n    \"city\": \"Elmira\",\n    \"country\": \"United States\"\n  }\n]\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/environments/environment.prod.ts",
    "content": "export const environment = {\n  production: true\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/environments/environment.ts",
    "content": "// This file can be replaced during build by using the `fileReplacements` array.\n// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.\n// The list of file replacements can be found in `angular.json`.\n\nexport const environment = {\n  production: false\n};\n\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/dist/zone-error';  // Included with Angular CLI.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Demo App</title>\n    <base href=\"/\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\n    <link\n      href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\"\n      rel=\"stylesheet\"\n    />\n    <link\n      href=\"https://fonts.googleapis.com/icon?family=Material+Icons\"\n      rel=\"stylesheet\"\n    />\n  </head>\n  <body>\n    <app-root></app-root>\n  </body>\n</html>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/main.ts",
    "content": "import 'hammerjs';\nimport { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n  enableProdMode();\n}\n\nplatformBrowserDynamic()\n  .bootstrapModule(AppModule)\n  .catch(err => console.error(err));\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/polyfills.ts",
    "content": "/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfills to this file.\n *\n * This file is divided into 2 sections:\n *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.\n *   2. Application imports. Files imported after ZoneJS that should be loaded before your main\n *      file.\n *\n * The current setup is for so-called \"evergreen\" browsers; the last versions of browsers that\n * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),\n * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.\n *\n * Learn more in https://angular.io/guide/browser-support\n */\n\n/***************************************************************************************************\n * BROWSER POLYFILLS\n */\n\n/** IE10 and IE11 requires the following for NgClass support on SVG elements */\n// import 'classlist.js';  // Run `npm install --save classlist.js`.\n\n/**\n * Web Animations `@angular/platform-browser/animations`\n * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.\n * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).\n */\n// import 'web-animations-js';  // Run `npm install --save web-animations-js`.\n\n/**\n * By default, zone.js will patch all possible macroTask and DomEvents\n * user can disable parts of macroTask/DomEvents patch by setting following flags\n * because those flags need to be set before `zone.js` being loaded, and webpack\n * will put import in the top of bundle, so user need to create a separate file\n * in this directory (for example: zone-flags.ts), and put the following flags\n * into that file, and then add the following code before importing zone.js.\n * import './zone-flags.ts';\n *\n * The flags allowed in zone-flags.ts are listed here.\n *\n * The following flags will work for all browsers.\n *\n * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame\n * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick\n * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames\n *\n *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js\n *  with the following flag, it will bypass `zone.js` patch for IE/Edge\n *\n *  (window as any).__Zone_enable_cross_context_check = true;\n *\n */\n\n/***************************************************************************************************\n * Zone JS is required by default for Angular itself.\n */\nimport 'zone.js/dist/zone'; // Included with Angular CLI.\n\n/***************************************************************************************************\n * APPLICATION IMPORTS\n */\n\n/***************************************************************************************************\n * SCULLY IMPORTS\n */\n\n// tslint:disable-next-line: align\nimport 'zone.js/dist/task-tracking';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/styles.scss",
    "content": "/* You can add global styles to this file, and also import other style files */\n\nhtml,\nbody {\n  height: 100%;\n}\nbody {\n  margin: 0;\n  font-family: Roboto, 'Helvetica Neue', sans-serif;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/test.ts",
    "content": "// This file is required by karma.conf.js and loads recursively all the .spec and framework files\n\nimport 'zone.js/dist/zone-testing';\nimport { getTestBed } from '@angular/core/testing';\nimport {\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\n\ndeclare const require: any;\n\n// First, initialize the Angular testing environment.\ngetTestBed().initTestEnvironment(\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting()\n);\n// Then we find all the tests.\nconst context = require.context('./', true, /\\.spec\\.ts$/);\n// And load the modules.\ncontext.keys().map(context);\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/tsconfig.app.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../dist/out-tsc\",\n    \"types\": []\n  },\n  \"files\": [\"src/main.ts\", \"src/polyfills.ts\"],\n  \"include\": [\"src/**/*.ts\"],\n  \"exclude\": [\"src/test.ts\", \"src/**/*.spec.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../dist/out-tsc\",\n    \"types\": [\"jasmine\", \"node\"]\n  },\n  \"files\": [\"src/test.ts\", \"src/polyfills.ts\"],\n  \"include\": [\"src/**/*.spec.ts\", \"src/**/*.d.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/cypress.json",
    "content": "{\n  \"fileServerFolder\": \"./\",\n  \"fixturesFolder\": \"./src/fixtures\",\n  \"integrationFolder\": \"./src/integration\",\n  \"pluginsFile\": \"./src/plugins/index.js\",\n  \"supportFile\": \"./src/support/index.ts\",\n  \"video\": true,\n  \"videosFolder\": \"../../dist/out-tsc/apps/ng-cli-app-e2e/videos\",\n  \"screenshotsFolder\": \"../../dist/out-tsc/apps/ng-cli-app-e2e/screenshots\",\n  \"chromeWebSecurity\": false\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/fixtures/example.json",
    "content": "{\n  \"name\": \"Using fixtures to represent data\",\n  \"email\": \"hello@cypress.io\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/integration/app.spec.ts",
    "content": "describe('app', () => {\n  beforeEach(() => cy.visit('/'));\n\n  it('should list all nav items', () => {\n    cy.findByText('Home').click();\n    cy.findByText('Customers').click();\n    cy.url().should('contain', '/auth/login');\n  });\n\n  it('should fail login', () => {\n    cy.login('something', 'badpass');\n    cy.findByText('Error: Wrong user or password');\n  });\n\n  it('should login', () => {\n    cy.login('test', 'goodpass');\n    cy.url().should('contain', '/home');\n  });\n\n  it('should navigate to routes', () => {\n    cy.login('test', 'goodpass');\n    cy.findByText('Home').click();\n    cy.url().should('contain', '/home');\n    cy.findByText('Customers').click();\n    cy.url().should('contain', '/customers');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/integration/customers.spec.ts",
    "content": "describe('customers', () => {\n  beforeEach(() => {\n    cy.login('test', 'goodpass');\n    cy.findByText('Customers').click();\n  });\n\n  it('should display correctly', () => {\n    cy.wait(30000);\n    cy.findByText('Customer Data');\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '1')\n      .should('contain', 'Waulker');\n  });\n  it('should sort by first name', () => {\n    cy.findByText('first_name').click();\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '22')\n      .should('contain', 'Scattergood');\n\n    cy.findByText('first_name').click();\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '25')\n      .should('contain', 'Getley');\n\n    cy.findByText('first_name').click();\n    cy.findByRole('grid')\n      .get('tbody tr:first-child')\n      .should('contain', '1')\n      .should('contain', 'Waulker');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/integration/home.spec.ts",
    "content": "describe('home', () => {\n  beforeEach(() => cy.login('test', 'goodpass'));\n\n  it('should display correctly', () => {\n    cy.wait(30000);\n    cy.findByText('Welcome to the Demo App');\n    cy.findByText('🥳 Customer of the day');\n    cy.contains('mat-icon', 'person');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/plugins/index.js",
    "content": "const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); // ***********************************************************\n// This example plugins/index.js can be used to load plugins\n//\n// You can change the location of this file or turn off loading\n// the plugins file with the 'pluginsFile' configuration option.\n//\n// You can read more here:\n// https://on.cypress.io/plugins-guide\n// ***********************************************************\n// This function is called when a project is opened or re-opened (e.g. due to\n// the project's config changing)\nmodule.exports = function(on, config) {\n  on('file:preprocessor', preprocessTypescript(config));\n  // `on` is used to hook into various events Cypress emits\n  // `config` is the resolved Cypress config\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/support/app.po.ts",
    "content": "export const getGreeting = () => cy.get('h1');\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/support/commands.ts",
    "content": "// ***********************************************\n// This example commands.js shows you how to\n// create various custom commands and overwrite\n// existing commands.\n//\n// For more comprehensive examples of custom\n// commands please read more here:\n// https://on.cypress.io/custom-commands\n// ***********************************************\n//\n//\n// -- This is a parent command --\n// Cypress.Commands.add(\"login\", (email, password) => { ... })\n//\n//\n// -- This is a child command --\n// Cypress.Commands.add(\"drag\", { prevSubject: 'element'}, (subject, options) => { ... })\n//\n//\n// -- This is a dual command --\n// Cypress.Commands.add(\"dismiss\", { prevSubject: 'optional'}, (subject, options) => { ... })\n//\n//\n// -- This will overwrite an existing command --\n// Cypress.Commands.overwrite(\"visit\", (originalFn, url, options) => { ... })\nimport '@testing-library/cypress/add-commands';\n\n// tslint:disable-next-line: no-namespace\ndeclare global {\n  namespace Cypress {\n    interface Chainable<Subject> {\n      login(email: string, password: string): void;\n    }\n  }\n}\n\nCypress.Commands.add('login', (email, password) => {\n  cy.visit('/auth/login');\n  cy.findByLabelText('Username').type(email);\n  cy.findByLabelText('Password').type(password);\n  cy.contains('button', 'Login').click();\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/support/index.ts",
    "content": "// ***********************************************************\n// This example support/index.js is processed and\n// loaded automatically before your test files.\n//\n// This is a great place to put global configuration and\n// behavior that modifies Cypress.\n//\n// You can change the location of this file or turn off\n// automatically serving support files with the\n// 'supportFile' configuration option.\n//\n// You can read more here:\n// https://on.cypress.io/configuration\n// ***********************************************************\n\n// Import commands.js using ES2015 syntax:\nimport './commands';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/tsconfig.e2e.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"sourceMap\": false,\n    \"outDir\": \"../../dist/out-tsc\"\n  },\n  \"include\": [\"src/**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"cypress\", \"@types/testing-library__cypress\", \"node\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/cypress.json",
    "content": "{\n  \"fileServerFolder\": \".\",\n  \"fixturesFolder\": \"./src/fixtures\",\n  \"integrationFolder\": \"./src/integration\",\n  \"modifyObstructiveCode\": false,\n  \"pluginsFile\": \"./src/plugins/index\",\n  \"supportFile\": \"./src/support/index.ts\",\n  \"video\": true,\n  \"videosFolder\": \"../../dist/cypress/apps/shared-components-e2e/videos\",\n  \"screenshotsFolder\": \"../../dist/cypress/apps/shared-components-e2e/screenshots\",\n  \"chromeWebSecurity\": false,\n  \"baseUrl\": \"http://localhost:4400\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/fixtures/example.json",
    "content": "{\n  \"name\": \"Using fixtures to represent data\",\n  \"email\": \"hello@cypress.io\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/integration/info-box/info-box.component.spec.ts",
    "content": "describe('shared-components', () => {\n  it('should render the component', () => {\n    cy.visit(\n      '/iframe.html?id=infoboxcomponent--primary&knob-icon=person&knob-message=O-H-I-O'\n    );\n    cy.get('app-info-box').should('exist');\n    cy.contains('Go Bucks');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/integration/navigation/navigation.component.spec.ts",
    "content": "describe('shared-components', () => {\n  beforeEach(() => cy.visit('/iframe.html?id=navigationcomponent--primary'));\n\n  it('should render the component', () => {\n    cy.get('app-navigation').should('exist');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/plugins/index.js",
    "content": "// ***********************************************************\n// This example plugins/index.js can be used to load plugins\n//\n// You can change the location of this file or turn off loading\n// the plugins file with the 'pluginsFile' configuration option.\n//\n// You can read more here:\n// https://on.cypress.io/plugins-guide\n// ***********************************************************\n\n// This function is called when a project is opened or re-opened (e.g. due to\n// the project's config changing)\n\nconst { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor');\n\nmodule.exports = (on, config) => {\n  // `on` is used to hook into various events Cypress emits\n  // `config` is the resolved Cypress config\n\n  // Preprocess Typescript\n  on('file:preprocessor', preprocessTypescript(config));\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/support/commands.ts",
    "content": "// ***********************************************\n// This example commands.js shows you how to\n// create various custom commands and overwrite\n// existing commands.\n//\n// For more comprehensive examples of custom\n// commands please read more here:\n// https://on.cypress.io/custom-commands\n// ***********************************************\n// eslint-disable-next-line @typescript-eslint/no-namespace\ndeclare namespace Cypress {\n  interface Chainable<Subject> {\n    login(email: string, password: string): void;\n  }\n}\n//\n// -- This is a parent command --\nCypress.Commands.add('login', (email, password) => {\n  console.log('Custom command example: Login', email, password);\n});\n//\n// -- This is a child command --\n// Cypress.Commands.add(\"drag\", { prevSubject: 'element'}, (subject, options) => { ... })\n//\n//\n// -- This is a dual command --\n// Cypress.Commands.add(\"dismiss\", { prevSubject: 'optional'}, (subject, options) => { ... })\n//\n//\n// -- This will overwrite an existing command --\n// Cypress.Commands.overwrite(\"visit\", (originalFn, url, options) => { ... })\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/support/index.ts",
    "content": "// ***********************************************************\n// This example support/index.js is processed and\n// loaded automatically before your test files.\n//\n// This is a great place to put global configuration and\n// behavior that modifies Cypress.\n//\n// You can change the location of this file or turn off\n// automatically serving support files with the\n// 'supportFile' configuration option.\n//\n// You can read more here:\n// https://on.cypress.io/configuration\n// ***********************************************************\n\n// Import commands.js using ES2015 syntax:\nimport './commands';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/tsconfig.e2e.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"sourceMap\": false,\n    \"outDir\": \"../../dist/out-tsc\"\n  },\n  \"include\": [\"src/**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"cypress\", \"node\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/tslint.json",
    "content": "{\"extends\":\"../../tslint.json\",\"rules\":[]}"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/docs/_config.yml",
    "content": "theme: jekyll-theme-minimal\ntitle: Angular monorepo example using Nx\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/docs/index.md",
    "content": "---\nlayout: default\n---\n\n# Angular monorepo example using Nx\n\nThis app shows the process of refactoring an Angular app to a monorepo with the help of [Nx](https://nx.dev/angular)\n\n# Slides\n\nThe slides for the corresponding sessions of these samples can be found here: [Slides](./scalable_angular_architecture_with_nx.pdf).\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/index.js",
    "content": "const { parseAngularRoutes } = require('guess-parser');\n\nconsole.log(parseAngularRoutes('apps/ng-cli-app/tsconfig.app.json'));\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/jest.config.js",
    "content": "module.exports = {\n  testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],\n  transform: {\n    '^.+\\\\.(ts|js|html)$': 'ts-jest'\n  },\n  resolver: '@nrwl/jest/plugins/resolver',\n  moduleFileExtensions: ['ts', 'js', 'html'],\n  coverageReporters: ['html'],\n  passWithNoTests: true\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/karma.conf.js",
    "content": "// Karma configuration file, see link for more information\n// https://karma-runner.github.io/1.0/config/configuration-file.html\n\nconst { join } = require('path');\nconst { constants } = require('karma');\n\nmodule.exports = () => {\n  return {\n    basePath: '',\n    frameworks: ['jasmine', '@angular-devkit/build-angular'],\n    plugins: [\n      require('karma-jasmine'),\n      require('karma-chrome-launcher'),\n      require('karma-jasmine-html-reporter'),\n      require('karma-coverage-istanbul-reporter'),\n      require('@angular-devkit/build-angular/plugins/karma')\n    ],\n    client: {\n      clearContext: false // leave Jasmine Spec Runner output visible in browser\n    },\n    coverageIstanbulReporter: {\n      dir: join(__dirname, '../../coverage'),\n      reports: ['html', 'lcovonly'],\n      fixWebpackSourcePaths: true\n    },\n    reporters: ['progress', 'kjhtml'],\n    port: 9876,\n    colors: true,\n    logLevel: constants.LOG_INFO,\n    autoWatch: true,\n    browsers: ['Chrome'],\n    singleRun: true\n  };\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/README.md",
    "content": "# auth\n\nThis library was generated with [Nx](https://nx.dev).\n\n## Running unit tests\n\nRun `nx test auth` to execute the unit tests.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/jest.config.js",
    "content": "module.exports = {\n  name: 'auth',\n  preset: '../../jest.config.js',\n  coverageDirectory: '../../coverage/libs/auth',\n  snapshotSerializers: [\n    'jest-preset-angular/AngularSnapshotSerializer.js',\n    'jest-preset-angular/HTMLCommentSerializer.js'\n  ]\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/index.ts",
    "content": "export * from './lib/auth.module';\nexport * from './lib/auth-routing.module';\nexport * from './lib/auth.guard';\nexport * from './lib/auth.service';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { LoginComponent } from './login/login.component';\n\nexport const AUTH_ROUTES: Routes = [\n  { path: 'login', component: LoginComponent }\n];\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.guard.spec.ts",
    "content": "import { TestBed, async, inject } from '@angular/core/testing';\n\nimport { AuthGuard } from './auth.guard';\nimport { RouterTestingModule } from '@angular/router/testing';\n\ndescribe('AuthGuard', () => {\n  beforeEach(() => {\n    TestBed.configureTestingModule({\n      imports: [RouterTestingModule],\n      providers: [AuthGuard]\n    });\n  });\n\n  it('should ...', inject([AuthGuard], (guard: AuthGuard) => {\n    expect(guard).toBeTruthy();\n  }));\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.guard.ts",
    "content": "import { Injectable } from '@angular/core';\nimport {\n  CanActivate,\n  ActivatedRouteSnapshot,\n  RouterStateSnapshot,\n  UrlTree,\n  Router\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { AuthService } from './auth.service';\nimport { take, map } from 'rxjs/operators';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class AuthGuard implements CanActivate {\n  constructor(private authService: AuthService, private router: Router) {}\n\n  canActivate(\n    next: ActivatedRouteSnapshot,\n    state: RouterStateSnapshot\n  ): Observable<boolean | UrlTree> {\n    return this.authService.isAuthenticated$.pipe(\n      take(1),\n      map(authenticated =>\n        authenticated ? true : this.router.parseUrl('/auth/login')\n      )\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.module.spec.ts",
    "content": "import { async, TestBed } from '@angular/core/testing';\nimport { AuthModule } from './auth.module';\n\ndescribe('AuthModule', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [AuthModule]\n    }).compileComponents();\n  }));\n\n  it('should create', () => {\n    expect(AuthModule).toBeDefined();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatInputModule } from '@angular/material/input';\nimport { LoginComponent } from './login/login.component';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { SharedComponentsModule } from '@ng-cli-app/shared/components';\n\n@NgModule({\n  declarations: [LoginComponent],\n  imports: [\n    CommonModule,\n    SharedComponentsModule,\n    MatInputModule,\n    MatButtonModule,\n    ReactiveFormsModule,\n    MatCardModule,\n    MatIconModule\n  ]\n})\nexport class AuthModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.service.spec.ts",
    "content": "import { TestBed } from '@angular/core/testing';\n\nimport { AuthService } from './auth.service';\nimport { RouterTestingModule } from '@angular/router/testing';\n\ndescribe('AuthService', () => {\n  beforeEach(() =>\n    TestBed.configureTestingModule({\n      imports: [RouterTestingModule]\n    })\n  );\n\n  it('should be created', () => {\n    const service: AuthService = TestBed.get(AuthService);\n    expect(service).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.service.ts",
    "content": "import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable, of, throwError } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { Router } from '@angular/router';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class AuthService {\n  private userSubject: BehaviorSubject<User> = new BehaviorSubject(null);\n\n  public currentUser$ = this.userSubject.asObservable();\n\n  public isAuthenticated$ = this.currentUser$.pipe(map(user => !!user));\n\n  constructor(private router: Router) {}\n\n  public login(username: string, password: string): Observable<User> {\n    if ('test' === username) {\n      const user = { username, fullName: 'Test User' };\n\n      this.userSubject.next(user);\n      this.router.navigateByUrl('/');\n\n      return of(user);\n    }\n\n    return throwError(new Error('Wrong user or password'));\n  }\n\n  public logout() {\n    this.userSubject.next(null);\n    this.router.navigateByUrl('/auth/login');\n  }\n}\n\nexport interface User {\n  username: string;\n  fullName: string;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/login/login.component.html",
    "content": "<h1>Login</h1>\n\n<app-info-box *ngIf=\"error\" [icon]=\"'error'\" [message]=\"error\"></app-info-box>\n\n<form class=\"example-form\" [formGroup]=\"form\" (submit)=\"onSubmit()\">\n  <mat-form-field>\n    <input matInput placeholder=\"Username\" formControlName=\"username\" />\n  </mat-form-field>\n\n  <mat-form-field>\n    <input\n      type=\"password\"\n      matInput\n      placeholder=\"Password\"\n      formControlName=\"password\"\n    />\n  </mat-form-field>\n\n  <button type=\"submit\" mat-flat-button color=\"primary\">Login</button>\n</form>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/login/login.component.scss",
    "content": ":host {\n  display: flex;\n  flex-direction: column;\n}\n\nform {\n  display: flex;\n  flex-direction: column;\n  max-width: 250px;\n}\n\napp-info-box {\n  margin-bottom: 2rem;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/login/login.component.spec.ts",
    "content": "import { async, ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatButtonModule } from '@angular/material/button';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { LoginComponent } from './login.component';\nimport { AuthService } from '../auth.service';\nimport { SharedComponentsModule } from '@ng-cli-app/shared/components';\n\ndescribe('LoginComponent', () => {\n  let component: LoginComponent;\n  let fixture: ComponentFixture<LoginComponent>;\n\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [\n        NoopAnimationsModule,\n        SharedComponentsModule,\n        MatInputModule,\n        MatButtonModule,\n        ReactiveFormsModule,\n        MatCardModule,\n        MatIconModule\n      ],\n      declarations: [LoginComponent],\n      providers: [\n        {\n          provide: AuthService,\n          useValue: {}\n        }\n      ]\n    }).compileComponents();\n  }));\n\n  beforeEach(() => {\n    fixture = TestBed.createComponent(LoginComponent);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n\n  it('should create', () => {\n    expect(component).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/login/login.component.ts",
    "content": "import { Component, OnInit } from '@angular/core';\nimport { FormGroup, FormBuilder, Validators } from '@angular/forms';\nimport { AuthService } from '../auth.service';\nimport { catchError, tap, take } from 'rxjs/operators';\n\n@Component({\n  selector: 'app-login',\n  templateUrl: './login.component.html',\n  styleUrls: ['./login.component.scss']\n})\nexport class LoginComponent implements OnInit {\n  public form: FormGroup;\n\n  public error: string;\n\n  constructor(fb: FormBuilder, private authService: AuthService) {\n    this.form = fb.group({\n      username: ['', Validators.required],\n      password: ['', Validators.required]\n    });\n  }\n\n  ngOnInit() {}\n\n  public onSubmit() {\n    if (this.form.valid) {\n      this.authService\n        .login(this.form.value.username, this.form.value.password)\n        .pipe(\n          take(1),\n          catchError(error => (this.error = error.toString()))\n        )\n        .subscribe();\n    }\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/src/test-setup.ts",
    "content": "import 'jest-preset-angular';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"jest\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/tsconfig.lib.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../dist/out-tsc\",\n    \"target\": \"es2015\",\n    \"declaration\": true,\n    \"inlineSources\": true,\n    \"types\": [],\n    \"lib\": [\"dom\", \"es2018\"]\n  },\n  \"angularCompilerOptions\": {\n    \"annotateForClosureCompiler\": true,\n    \"skipTemplateCodegen\": true,\n    \"strictMetadataEmit\": true,\n    \"fullTemplateTypeCheck\": true,\n    \"strictInjectionParameters\": true,\n    \"enableResourceInlining\": true\n  },\n  \"exclude\": [\"src/test-setup.ts\", \"**/*.spec.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../dist/out-tsc\",\n    \"module\": \"commonjs\",\n    \"types\": [\"jest\", \"node\"],\n    \"emitDecoratorMetadata\": true\n  },\n  \"files\": [\"src/test-setup.ts\"],\n  \"include\": [\"**/*.spec.ts\", \"**/*.d.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/auth/tslint.json",
    "content": "{\n  \"extends\": \"../../tslint.json\",\n  \"rules\": {\n    \"directive-selector\": [true, \"attribute\", \"app\", \"camelCase\"],\n    \"component-selector\": [true, \"element\", \"app\", \"kebab-case\"]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/README.md",
    "content": "# customers-data\n\nThis library was generated with [Nx](https://nx.dev).\n\n## Running unit tests\n\nRun `nx test customers-data` to execute the unit tests.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/jest.config.js",
    "content": "module.exports = {\n  name: 'customers-data',\n  preset: '../../../jest.config.js',\n  coverageDirectory: '../../../coverage/libs/customers/data',\n  snapshotSerializers: [\n    'jest-preset-angular/AngularSnapshotSerializer.js',\n    'jest-preset-angular/HTMLCommentSerializer.js'\n  ]\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/src/index.ts",
    "content": "export * from './lib/customer.service';\nexport * from './lib/customer.model';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/src/lib/customer.model.ts",
    "content": "export interface Customer {\n  id: number;\n  first_name: string;\n  last_name: string;\n  email: string;\n  street: string;\n  city: string;\n  country: string;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/src/lib/customer.service.spec.ts",
    "content": "import { TestBed } from '@angular/core/testing';\n\nimport { CustomerService } from './customer.service';\nimport { HttpClientTestingModule } from '@angular/common/http/testing';\n\ndescribe('CustomerService', () => {\n  beforeEach(() =>\n    TestBed.configureTestingModule({\n      imports: [HttpClientTestingModule]\n    })\n  );\n\n  it('should be created', () => {\n    const service: CustomerService = TestBed.get(CustomerService);\n    expect(service).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/src/lib/customer.service.ts",
    "content": "import { Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { Customer } from './customer.model';\nimport { shareReplay, map } from 'rxjs/operators';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class CustomerService {\n  constructor(private httpClient: HttpClient) {}\n\n  public getCustomers(): Observable<Customer[]> {\n    return this.httpClient\n      .get<Customer[]>('/assets/customers.json')\n      .pipe(shareReplay(1));\n  }\n\n  public getCustomerOfTheDay(): Observable<Customer> {\n    return this.getCustomers().pipe(\n      map(customers => customers[Math.floor(Math.random() * customers.length)])\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/src/test-setup.ts",
    "content": "import 'jest-preset-angular';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"jest\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/tsconfig.lib.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"target\": \"es2015\",\n    \"declaration\": true,\n    \"inlineSources\": true,\n    \"types\": [],\n    \"lib\": [\"dom\", \"es2018\"]\n  },\n  \"angularCompilerOptions\": {\n    \"annotateForClosureCompiler\": true,\n    \"skipTemplateCodegen\": true,\n    \"strictMetadataEmit\": true,\n    \"fullTemplateTypeCheck\": true,\n    \"strictInjectionParameters\": true,\n    \"enableResourceInlining\": true\n  },\n  \"exclude\": [\"src/test-setup.ts\", \"**/*.spec.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"module\": \"commonjs\",\n    \"types\": [\"jest\", \"node\"],\n    \"emitDecoratorMetadata\": true\n  },\n  \"files\": [\"src/test-setup.ts\"],\n  \"include\": [\"**/*.spec.ts\", \"**/*.d.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/data/tslint.json",
    "content": "{\n  \"extends\": \"../../../tslint.json\",\n  \"rules\": {\n    \"directive-selector\": [true, \"attribute\", \"app\", \"camelCase\"],\n    \"component-selector\": [true, \"element\", \"app\", \"kebab-case\"]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/README.md",
    "content": "# feat-customers\n\nThis library was generated with [Nx](https://nx.dev).\n\n## Running unit tests\n\nRun `nx test feat-customers` to execute the unit tests.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/jest.config.js",
    "content": "module.exports = {\n  name: 'feat-customers',\n  preset: '../../../jest.config.js',\n  coverageDirectory: '../../../coverage/libs/customers/ui',\n  snapshotSerializers: [\n    'jest-preset-angular/AngularSnapshotSerializer.js',\n    'jest-preset-angular/HTMLCommentSerializer.js'\n  ]\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/index.ts",
    "content": "export * from './lib/customers-ui.module';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customer-list/customer-list-datasource.ts",
    "content": "import { DataSource } from '@angular/cdk/collections';\nimport { MatPaginator } from '@angular/material/paginator';\nimport { MatSort } from '@angular/material/sort';\nimport { map } from 'rxjs/operators';\nimport { Observable, merge, Subscription, of } from 'rxjs';\nimport { CustomerService, Customer } from '@ng-cli-app/customers/data';\n\n/**\n * Data source for the CustomerList view. This class should\n * encapsulate all logic for fetching and manipulating the displayed data\n * (including sorting, pagination, and filtering).\n */\nexport class CustomerListDataSource extends DataSource<Customer> {\n  paginator: MatPaginator;\n  sort: MatSort;\n\n  private data: Customer[] = [];\n\n  private subscription = new Subscription();\n\n  constructor(private customerService: CustomerService) {\n    super();\n  }\n\n  /**\n   * Connect this data source to the table. The table will only update when\n   * the returned stream emits new items.\n   * @returns A stream of the items to be rendered.\n   */\n  connect(): Observable<Customer[]> {\n    const data$ = this.customerService.getCustomers();\n\n    this.subscription.add(\n      data$.subscribe(data => {\n        this.data = data;\n        this.paginator.length = data.length;\n      })\n    );\n\n    // Combine everything that affects the rendered data into one update\n    // stream for the data-table to consume.\n    const dataMutations = [data$, this.paginator.page, this.sort.sortChange];\n\n    return merge(...dataMutations).pipe(\n      map(() => {\n        return this.getPagedData(this.getSortedData([...this.data]));\n      })\n    );\n  }\n\n  /**\n   *  Called when the table is being destroyed. Use this function, to clean up\n   * any open connections or free any held resources that were set up during connect.\n   */\n  disconnect() {\n    this.subscription.unsubscribe();\n  }\n\n  /**\n   * Paginate the data (client-side). If you're using server-side pagination,\n   * this would be replaced by requesting the appropriate data from the server.\n   */\n  private getPagedData(data: Customer[]) {\n    const startIndex = this.paginator.pageIndex * this.paginator.pageSize;\n    return data.splice(startIndex, this.paginator.pageSize);\n  }\n\n  /**\n   * Sort the data (client-side). If you're using server-side sorting,\n   * this would be replaced by requesting the appropriate data from the server.\n   */\n  private getSortedData(data: Customer[]) {\n    if (!this.sort.active || this.sort.direction === '') {\n      return data;\n    }\n\n    return data.sort((a, b) => {\n      const isAsc = this.sort.direction === 'asc';\n      switch (this.sort.active) {\n        case 'first_name':\n          return compare(a.first_name, b.first_name, isAsc);\n        case 'id':\n          return compare(+a.id, +b.id, isAsc);\n        default:\n          return 0;\n      }\n    });\n  }\n}\n\n/** Simple sort comparator for example ID/Name columns (for client-side sorting). */\nfunction compare(a, b, isAsc) {\n  return (a < b ? -1 : 1) * (isAsc ? 1 : -1);\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customer-list/customer-list.component.html",
    "content": "<div class=\"mat-elevation-z8\">\n  <table mat-table class=\"full-width-table\" matSort aria-label=\"Elements\">\n    <ng-container [matColumnDef]=\"col\" *ngFor=\"let col of displayedColumns\">\n      <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ col }}</th>\n      <td mat-cell *matCellDef=\"let row\">{{ row[col] }}</td>\n    </ng-container>\n\n    <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n    <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n  </table>\n\n  <mat-paginator\n    #paginator\n    [pageIndex]=\"0\"\n    [pageSize]=\"25\"\n    [pageSizeOptions]=\"[25, 50, 100, 250]\"\n  >\n  </mat-paginator>\n</div>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customer-list/customer-list.component.scss",
    "content": ".full-width-table {\n  width: 100%;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customer-list/customer-list.component.spec.ts",
    "content": "import { async, ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { MatPaginatorModule } from '@angular/material/paginator';\nimport { MatSortModule } from '@angular/material/sort';\nimport { MatTableModule } from '@angular/material/table';\n\nimport { CustomerListComponent } from './customer-list.component';\nimport { CustomerService } from '@ng-cli-app/customers/data';\n\ndescribe('CustomerListComponent', () => {\n  let component: CustomerListComponent;\n  let fixture: ComponentFixture<CustomerListComponent>;\n\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      declarations: [CustomerListComponent],\n      imports: [\n        NoopAnimationsModule,\n        MatPaginatorModule,\n        MatSortModule,\n        MatTableModule\n      ],\n      providers: [{ provide: CustomerService, useValue: {} }]\n    }).compileComponents();\n  }));\n\n  beforeEach(() => {\n    fixture = TestBed.createComponent(CustomerListComponent);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n\n  it('should compile', () => {\n    expect(component).toBeTruthy();\n  });\n\n  new Array(100)\n    .fill('Test')\n    .fill('Test', 0, 1000)\n    .forEach(() => {\n      it('should be a good test', done => {\n        expect(true).toBe(true);\n        setTimeout(() => done(), 100);\n      });\n    });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customer-list/customer-list.component.ts",
    "content": "import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';\nimport { MatPaginator } from '@angular/material/paginator';\nimport { MatSort } from '@angular/material/sort';\nimport { MatTable } from '@angular/material/table';\nimport { CustomerListDataSource } from './customer-list-datasource';\n\nimport { Customer, CustomerService } from '@ng-cli-app/customers/data';\n\n@Component({\n  selector: 'app-customer-list',\n  templateUrl: './customer-list.component.html',\n  styleUrls: ['./customer-list.component.scss']\n})\nexport class CustomerListComponent implements AfterViewInit, OnInit {\n  @ViewChild(MatPaginator) paginator: MatPaginator;\n  @ViewChild(MatSort) sort: MatSort;\n  @ViewChild(MatTable) table: MatTable<Customer>;\n\n  dataSource: CustomerListDataSource;\n\n  /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */\n  displayedColumns: (keyof Customer)[] = [\n    'id',\n    'first_name',\n    'last_name',\n    'email',\n    'city',\n    'country'\n  ];\n\n  constructor(private customerService: CustomerService) {}\n\n  ngOnInit() {\n    this.dataSource = new CustomerListDataSource(this.customerService);\n  }\n\n  ngAfterViewInit() {\n    this.dataSource.sort = this.sort;\n    this.dataSource.paginator = this.paginator;\n    this.table.dataSource = this.dataSource;\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\n\nimport { CustomersComponent } from './customers.component';\nimport { CustomerListComponent } from './customer-list/customer-list.component';\n\nexport const routes: Routes = [\n  {\n    path: '',\n    component: CustomersComponent,\n    children: [\n      { path: '', pathMatch: 'full', redirectTo: 'list' },\n      { path: 'list', component: CustomerListComponent }\n    ]\n  }\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class CustomersRoutingModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers-ui.module.spec.ts",
    "content": "import { async, TestBed } from '@angular/core/testing';\nimport { CustomersUiModule } from './feat-customers.module';\n\ndescribe('CustomersUiModule', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [CustomersUiModule]\n    }).compileComponents();\n  }));\n\n  it('should create', () => {\n    expect(CustomersUiModule).toBeDefined();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers-ui.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { CustomersRoutingModule } from './customers-routing.module';\nimport { CustomersComponent } from './customers.component';\nimport { CustomerListComponent } from './customer-list/customer-list.component';\nimport { MatTableModule } from '@angular/material/table';\nimport { MatPaginatorModule } from '@angular/material/paginator';\nimport { MatSortModule } from '@angular/material/sort';\n\n@NgModule({\n  declarations: [CustomersComponent, CustomerListComponent],\n  imports: [\n    CommonModule,\n    CustomersRoutingModule,\n    MatTableModule,\n    MatPaginatorModule,\n    MatSortModule\n  ],\n  exports: [CustomerListComponent]\n})\nexport class CustomersUiModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.html",
    "content": "<h2>Customer Data</h2>\n<router-outlet></router-outlet>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.scss",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.spec.ts",
    "content": "import { async, ComponentFixture, TestBed } from '@angular/core/testing';\n\nimport { CustomersComponent } from './customers.component';\nimport { RouterTestingModule } from '@angular/router/testing';\n\ndescribe('CustomersComponent', () => {\n  let component: CustomersComponent;\n  let fixture: ComponentFixture<CustomersComponent>;\n\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [RouterTestingModule],\n      declarations: [CustomersComponent]\n    }).compileComponents();\n  }));\n\n  beforeEach(() => {\n    fixture = TestBed.createComponent(CustomersComponent);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n\n  it('should create', () => {\n    expect(component).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.ts",
    "content": "import { Component, OnInit } from '@angular/core';\n\n@Component({\n  selector: 'app-customers',\n  templateUrl: './customers.component.html',\n  styleUrls: ['./customers.component.scss']\n})\nexport class CustomersComponent implements OnInit {\n  constructor() {}\n\n  ngOnInit() {}\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/test-setup.ts",
    "content": "import 'jest-preset-angular';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"jest\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/tsconfig.lib.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"target\": \"es2015\",\n    \"declaration\": true,\n    \"inlineSources\": true,\n    \"types\": [],\n    \"lib\": [\"dom\", \"es2018\"]\n  },\n  \"angularCompilerOptions\": {\n    \"annotateForClosureCompiler\": true,\n    \"skipTemplateCodegen\": true,\n    \"strictMetadataEmit\": true,\n    \"fullTemplateTypeCheck\": true,\n    \"strictInjectionParameters\": true,\n    \"enableResourceInlining\": true\n  },\n  \"exclude\": [\"src/test-setup.ts\", \"**/*.spec.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"module\": \"commonjs\",\n    \"types\": [\"jest\", \"node\"],\n    \"emitDecoratorMetadata\": true\n  },\n  \"files\": [\"src/test-setup.ts\"],\n  \"include\": [\"**/*.spec.ts\", \"**/*.d.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/customers/ui/tslint.json",
    "content": "{\n  \"extends\": \"../../../tslint.json\",\n  \"rules\": {\n    \"directive-selector\": [true, \"attribute\", \"app\", \"camelCase\"],\n    \"component-selector\": [true, \"element\", \"app\", \"kebab-case\"]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/addons.js",
    "content": "import '../../../../.storybook/addons';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/config.js",
    "content": "import { configure, addDecorator } from '@storybook/angular';\nimport { withKnobs } from '@storybook/addon-knobs';\n\naddDecorator(withKnobs);\nconfigure(require.context('../src/lib', true, /\\.stories\\.tsx?$/), module);\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"emitDecoratorMetadata\": true\n  },\n  \"exclude\": [\"../src/test.ts\", \"../**/*.spec.ts\"],\n  \"include\": [\"../src/**/*\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/webpack.config.js",
    "content": "const rootWebpackConfig = require('../../../../.storybook/webpack.config');\n// Export a function. Accept the base config as the only param.\nmodule.exports = async ({ config, mode }) => {\n  config = await rootWebpackConfig({ config, mode });\n  \n  return config;\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/README.md",
    "content": "# feat-home\n\nThis library was generated with [Nx](https://nx.dev).\n\n## Running unit tests\n\nRun `nx test feat-home` to execute the unit tests.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/jest.config.js",
    "content": "module.exports = {\n  name: 'feat-home',\n  preset: '../../../jest.config.js',\n  coverageDirectory: '../../../coverage/libs/home/ui',\n  snapshotSerializers: [\n    'jest-preset-angular/AngularSnapshotSerializer.js',\n    'jest-preset-angular/HTMLCommentSerializer.js'\n  ]\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/index.ts",
    "content": "export * from './lib/home-ui.module';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home-ui.module.spec.ts",
    "content": "import { async, TestBed } from '@angular/core/testing';\nimport { HomeUiModule } from './feat-home.module';\n\ndescribe('HomeUiModule', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [HomeUiModule]\n    }).compileComponents();\n  }));\n\n  it('should create', () => {\n    expect(HomeUiModule).toBeDefined();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home-ui.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { HomeComponent } from './home.component';\nimport { SharedComponentsModule } from '@ng-cli-app/shared/components';\nimport { Routes, RouterModule } from '@angular/router';\n\nexport const routes: Routes = [{ path: '', component: HomeComponent }];\n\n@NgModule({\n  declarations: [HomeComponent],\n  imports: [CommonModule, SharedComponentsModule, RouterModule.forChild(routes)]\n})\nexport class HomeUiModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.html",
    "content": "<h1>Welcome to the Demo App</h1>\n<hr />\n<h2>🥳 Customer of the day</h2>\n<app-info-box\n  [icon]=\"'person'\"\n  [message]=\"customerOfTheDay$ | async\"\n></app-info-box>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.scss",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.spec.ts",
    "content": "import { async, ComponentFixture, TestBed } from '@angular/core/testing';\n\nimport { HomeComponent } from './home.component';\nimport { EMPTY } from 'rxjs';\nimport { SharedComponentsModule } from '@ng-cli-app/shared/components';\nimport { CustomerService } from '@ng-cli-app/customers/data';\n\ndescribe('HomeComponent', () => {\n  let component: HomeComponent;\n  let fixture: ComponentFixture<HomeComponent>;\n\n  beforeEach(async(() => {\n    const customerServiceMock = {\n      getCustomerOfTheDay: () => EMPTY\n    };\n\n    TestBed.configureTestingModule({\n      imports: [SharedComponentsModule],\n      declarations: [HomeComponent],\n      providers: [{ provide: CustomerService, useValue: customerServiceMock }]\n    }).compileComponents();\n  }));\n\n  beforeEach(() => {\n    fixture = TestBed.createComponent(HomeComponent);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n\n  it('should create', () => {\n    expect(component).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.stories.ts",
    "content": "import { HomeComponent } from './home.component';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\nimport { HttpClientModule } from '@angular/common/http';\n\nimport { SharedComponentsModule } from '@ng-cli-app/shared/components';\nimport { MatButtonModule } from '@angular/material/button';\nimport { AuthModule } from '@ng-cli-app/auth';\nimport { RouterModule } from '@angular/router';\nimport { APP_BASE_HREF } from '@angular/common';\n\nexport default {\n  title: 'HomeComponent'\n};\n\nexport const primary = () => ({\n  moduleMetadata: {\n    imports: [\n      BrowserModule,\n      HttpClientModule,\n      RouterModule.forRoot([\n        {\n          path: '**',\n          component: HomeComponent\n        }\n      ]),\n      BrowserAnimationsModule,\n      SharedComponentsModule,\n      MatButtonModule,\n      AuthModule\n    ],\n    providers: [\n      {\n        provide: APP_BASE_HREF,\n        useValue: '/'\n      }\n    ]\n  },\n  component: HomeComponent,\n  props: {}\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.ts",
    "content": "import { Component, OnInit } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { map, filter } from 'rxjs/operators';\nimport { CustomerService, Customer } from '@ng-cli-app/customers/data';\n\n@Component({\n  selector: 'app-home',\n  templateUrl: './home.component.html',\n  styleUrls: ['./home.component.scss']\n})\nexport class HomeComponent implements OnInit {\n  public customerOfTheDay$: Observable<string>;\n\n  constructor(private customerService: CustomerService) {}\n\n  ngOnInit() {\n    this.customerOfTheDay$ = this.customerService.getCustomerOfTheDay().pipe(\n      filter(customer => !!customer),\n      map(\n        (customer: Customer) => customer.first_name + ' ' + customer.last_name\n      )\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/src/test-setup.ts",
    "content": "import 'jest-preset-angular';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"jest\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/tsconfig.lib.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"target\": \"es2015\",\n    \"declaration\": true,\n    \"inlineSources\": true,\n    \"types\": [],\n    \"lib\": [\n      \"dom\",\n      \"es2018\"\n    ]\n  },\n  \"angularCompilerOptions\": {\n    \"annotateForClosureCompiler\": true,\n    \"skipTemplateCodegen\": true,\n    \"strictMetadataEmit\": true,\n    \"fullTemplateTypeCheck\": true,\n    \"strictInjectionParameters\": true,\n    \"enableResourceInlining\": true\n  },\n  \"exclude\": [\n    \"src/test-setup.ts\",\n    \"**/*.spec.ts\",\n    \"**/*.stories.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"module\": \"commonjs\",\n    \"types\": [\"jest\", \"node\"],\n    \"emitDecoratorMetadata\": true\n  },\n  \"files\": [\"src/test-setup.ts\"],\n  \"include\": [\"**/*.spec.ts\", \"**/*.d.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/home/ui/tslint.json",
    "content": "{\n  \"extends\": \"../../../tslint.json\",\n  \"rules\": {\n    \"directive-selector\": [true, \"attribute\", \"app\", \"camelCase\"],\n    \"component-selector\": [true, \"element\", \"app\", \"kebab-case\"]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/addons.js",
    "content": "import '../../../../.storybook/addons';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/config.js",
    "content": "import { configure, addDecorator } from '@storybook/angular';\nimport { withKnobs } from '@storybook/addon-knobs';\n\naddDecorator(withKnobs);\nconfigure(require.context('../src/lib', true, /\\.stories\\.tsx?$/), module);\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/preview-head.html",
    "content": "<link\n  href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\"\n  rel=\"stylesheet\"\n/>\n<link\n  href=\"https://fonts.googleapis.com/icon?family=Material+Icons\"\n  rel=\"stylesheet\"\n/>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"emitDecoratorMetadata\": true\n  },\n  \"exclude\": [\"../src/test.ts\", \"../**/*.spec.ts\"],\n  \"include\": [\"../src/**/*\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/webpack.config.js",
    "content": "const rootWebpackConfig = require('../../../../.storybook/webpack.config');\n// Export a function. Accept the base config as the only param.\nmodule.exports = async ({ config, mode }) => {\n  config = await rootWebpackConfig({ config, mode });\n  \n  return config;\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/README.md",
    "content": "# shared-components\n\nThis library was generated with [Nx](https://nx.dev).\n\n## Running unit tests\n\nRun `nx test shared-components` to execute the unit tests.\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/jest.config.js",
    "content": "module.exports = {\n  name: 'shared-components',\n  preset: '../../../jest.config.js',\n  coverageDirectory: '../../../coverage/libs/shared/components',\n  snapshotSerializers: [\n    'jest-preset-angular/AngularSnapshotSerializer.js',\n    'jest-preset-angular/HTMLCommentSerializer.js'\n  ]\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/index.ts",
    "content": "export * from './lib/shared-components.module';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.html",
    "content": "<mat-card>\n  <div class=\"box\">\n    <mat-icon *ngIf=\"icon\">{{ icon }}</mat-icon\n    ><span>{{ message }}</span>\n  </div>\n</mat-card>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.scss",
    "content": ".box {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n\n  span {\n    margin-left: 1rem;\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.spec.ts",
    "content": "import { async, ComponentFixture, TestBed } from '@angular/core/testing';\n\nimport { InfoBoxComponent } from './info-box.component';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\n\ndescribe('InfoBoxComponent', () => {\n  let component: InfoBoxComponent;\n  let fixture: ComponentFixture<InfoBoxComponent>;\n\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [MatCardModule, MatIconModule],\n      declarations: [InfoBoxComponent]\n    }).compileComponents();\n  }));\n\n  beforeEach(() => {\n    fixture = TestBed.createComponent(InfoBoxComponent);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n\n  it('should create', () => {\n    expect(component).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.stories.ts",
    "content": "import { text, number, boolean } from '@storybook/addon-knobs';\nimport { SharedComponentsModule } from '../shared-components.module';\nimport { InfoBoxComponent } from './info-box.component';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\n\nexport default {\n  title: 'InfoBoxComponent'\n};\n\nexport const primary = () => ({\n  moduleMetadata: {\n    imports: [MatCardModule, MatIconModule]\n  },\n  component: InfoBoxComponent,\n  props: {\n    icon: text('icon', ''),\n    message: text('message', '')\n  }\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.ts",
    "content": "import { Component, OnInit, Input } from '@angular/core';\n\n@Component({\n  selector: 'app-info-box',\n  templateUrl: './info-box.component.html',\n  styleUrls: ['./info-box.component.scss']\n})\nexport class InfoBoxComponent implements OnInit {\n  @Input() icon: string;\n\n  @Input() message: string;\n\n  constructor() {}\n\n  ngOnInit() {}\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.html",
    "content": "<mat-sidenav-container class=\"sidenav-container\">\n  <mat-sidenav\n    #drawer\n    class=\"sidenav\"\n    fixedInViewport\n    [attr.role]=\"(isHandset$ | async) ? 'dialog' : 'navigation'\"\n    [mode]=\"(isHandset$ | async) ? 'over' : 'side'\"\n    [opened]=\"(isHandset$ | async) === false\"\n  >\n    <mat-toolbar><mat-icon>menu</mat-icon>&nbsp;Menu</mat-toolbar>\n    <mat-nav-list>\n      <a mat-list-item routerLink=\"/home\" routerLinkActive=\"active\"\n        ><mat-icon>home</mat-icon>&nbsp;Home</a\n      >\n      <a mat-list-item routerLink=\"/customers\" routerLinkActive=\"active\"\n        ><mat-icon>person</mat-icon>&nbsp;Customers</a\n      >\n    </mat-nav-list>\n  </mat-sidenav>\n  <mat-sidenav-content>\n    <mat-toolbar color=\"primary\">\n      <button\n        type=\"button\"\n        aria-label=\"Toggle sidenav\"\n        mat-icon-button\n        (click)=\"drawer.toggle()\"\n        *ngIf=\"isHandset$ | async\"\n      >\n        <mat-icon aria-label=\"Side nav toggle icon\">menu</mat-icon>\n      </button>\n      <span>Demo App</span>\n      <span class=\"spacer\"></span>\n      <ng-content select=\"header\"></ng-content>\n    </mat-toolbar>\n    <main><ng-content></ng-content></main>\n  </mat-sidenav-content>\n</mat-sidenav-container>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.scss",
    "content": ".sidenav-container {\n  height: 100%;\n}\n\n.sidenav {\n  width: 200px;\n}\n\n.sidenav .mat-toolbar {\n  background: inherit;\n}\n\n.mat-toolbar.mat-primary {\n  position: sticky;\n  top: 0;\n  z-index: 1;\n}\n\n.active {\n  background: rgba(0, 0, 0, 0.04);\n}\n\nmain {\n  padding: 1rem;\n}\n\n.spacer {\n  flex: 1 0 auto;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.spec.ts",
    "content": "import { LayoutModule } from '@angular/cdk/layout';\nimport { async, ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatListModule } from '@angular/material/list';\nimport { MatSidenavModule } from '@angular/material/sidenav';\nimport { MatToolbarModule } from '@angular/material/toolbar';\n\nimport { NavigationComponent } from './navigation.component';\n\ndescribe('NavigationComponent', () => {\n  let component: NavigationComponent;\n  let fixture: ComponentFixture<NavigationComponent>;\n\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      declarations: [NavigationComponent],\n      imports: [\n        NoopAnimationsModule,\n        LayoutModule,\n        MatButtonModule,\n        MatIconModule,\n        MatListModule,\n        MatSidenavModule,\n        MatToolbarModule\n      ],\n      providers: []\n    }).compileComponents();\n  }));\n\n  beforeEach(() => {\n    fixture = TestBed.createComponent(NavigationComponent);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n\n  it('should compile', () => {\n    expect(component).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.stories.ts",
    "content": "\nimport { SharedComponentsModule } from '../shared-components.module';\nimport { NavigationComponent } from './navigation.component';\n\nexport default {\n  title: 'NavigationComponent'\n}\n\nexport const primary = () => ({\n  moduleMetadata: {\n    imports: []\n  },\n  component: NavigationComponent,\n  props: {\n  }\n})\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.ts",
    "content": "import { Component } from '@angular/core';\nimport { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';\nimport { Observable } from 'rxjs';\nimport { map, shareReplay } from 'rxjs/operators';\n\n@Component({\n  selector: 'app-navigation',\n  templateUrl: './navigation.component.html',\n  styleUrls: ['./navigation.component.scss']\n})\nexport class NavigationComponent {\n  isHandset$: Observable<boolean> = this.breakpointObserver\n    .observe(Breakpoints.Handset)\n    .pipe(\n      map(result => result.matches),\n      shareReplay()\n    );\n\n  constructor(private breakpointObserver: BreakpointObserver) {}\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/shared-components.module.spec.ts",
    "content": "import { async, TestBed } from '@angular/core/testing';\nimport { SharedComponentsModule } from './shared-components.module';\n\ndescribe('SharedComponentsModule', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      imports: [SharedComponentsModule]\n    }).compileComponents();\n  }));\n\n  it('should create', () => {\n    expect(SharedComponentsModule).toBeDefined();\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/shared-components.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { LayoutModule } from '@angular/cdk/layout';\nimport { MatToolbarModule } from '@angular/material/toolbar';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatSidenavModule } from '@angular/material/sidenav';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatListModule } from '@angular/material/list';\nimport { MatCardModule } from '@angular/material/card';\nimport { RouterModule } from '@angular/router';\nimport { NavigationComponent } from './navigation/navigation.component';\nimport { InfoBoxComponent } from './info-box/info-box.component';\n\n@NgModule({\n  declarations: [NavigationComponent, InfoBoxComponent],\n  imports: [\n    CommonModule,\n    RouterModule,\n    LayoutModule,\n    MatCardModule,\n    MatToolbarModule,\n    MatButtonModule,\n    MatSidenavModule,\n    MatIconModule,\n    MatListModule\n  ],\n  exports: [NavigationComponent, InfoBoxComponent]\n})\nexport class SharedComponentsModule {}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/src/test-setup.ts",
    "content": "import 'jest-preset-angular';\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"jest\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/tsconfig.lib.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"target\": \"es2015\",\n    \"declaration\": true,\n    \"inlineSources\": true,\n    \"types\": [],\n    \"lib\": [\n      \"dom\",\n      \"es2018\"\n    ]\n  },\n  \"angularCompilerOptions\": {\n    \"annotateForClosureCompiler\": true,\n    \"skipTemplateCodegen\": true,\n    \"strictMetadataEmit\": true,\n    \"fullTemplateTypeCheck\": true,\n    \"strictInjectionParameters\": true,\n    \"enableResourceInlining\": true\n  },\n  \"exclude\": [\n    \"src/test-setup.ts\",\n    \"**/*.spec.ts\",\n    \"**/*.stories.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../../dist/out-tsc\",\n    \"module\": \"commonjs\",\n    \"types\": [\"jest\", \"node\"],\n    \"emitDecoratorMetadata\": true\n  },\n  \"files\": [\"src/test-setup.ts\"],\n  \"include\": [\"**/*.spec.ts\", \"**/*.d.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/libs/shared/components/tslint.json",
    "content": "{\n  \"extends\": \"../../../tslint.json\",\n  \"rules\": {\n    \"directive-selector\": [true, \"attribute\", \"app\", \"camelCase\"],\n    \"component-selector\": [true, \"element\", \"app\", \"kebab-case\"]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/nx.json",
    "content": "{\n  \"npmScope\": \"ng-cli-app\",\n  \"implicitDependencies\": {\n    \"angular.json\": \"*\",\n    \"package.json\": \"*\",\n    \"tsconfig.json\": \"*\",\n    \"tslint.json\": \"*\",\n    \"nx.json\": \"*\"\n  },\n  \"projects\": {\n    \"ng-cli-app\": {\n      \"tags\": [\n        \"scope:app\",\n        \"type:app\"\n      ]\n    },\n    \"ng-cli-app-e2e\": {\n      \"tags\": [\n        \"scope:app\",\n        \"type:e2e\"\n      ]\n    },\n    \"shared-components\": {\n      \"tags\": [\n        \"scope:shared\",\n        \"type:ui\"\n      ]\n    },\n    \"auth\": {\n      \"tags\": [\n        \"scope:auth\",\n        \"type:ui\"\n      ]\n    },\n    \"feat-customers\": {\n      \"tags\": [\n        \"scope:customers\",\n        \"type:ui\"\n      ]\n    },\n    \"customers-data\": {\n      \"tags\": [\n        \"scope:customers\",\n        \"type:data\"\n      ]\n    },\n    \"feat-home\": {\n      \"tags\": [\n        \"scope:home\",\n        \"type:ui\"\n      ]\n    },\n    \"shared-components-e2e\": {\n      \"tags\": []\n    },\n    \"feat-home-e2e\": {\n      \"tags\": []\n    }\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/package.json",
    "content": "{\n  \"name\": \"ng-cli-app\",\n  \"version\": \"0.0.0\",\n  \"scripts\": {\n    \"ng\": \"ng\",\n    \"start\": \"ng serve\",\n    \"build\": \"ng build\",\n    \"test\": \"ng test\",\n    \"lint\": \"nx workspace-lint && ng lint\",\n    \"e2e\": \"ng e2e\",\n    \"nx\": \"nx\",\n    \"affected:apps\": \"nx affected:apps\",\n    \"affected:libs\": \"nx affected:libs\",\n    \"affected:build\": \"nx affected:build\",\n    \"affected:e2e\": \"nx affected:e2e\",\n    \"affected:test\": \"nx affected:test\",\n    \"affected:lint\": \"nx affected:lint\",\n    \"affected:dep-graph\": \"nx affected:dep-graph\",\n    \"affected\": \"nx affected\",\n    \"format\": \"nx format:write\",\n    \"format:write\": \"nx format:write\",\n    \"format:check\": \"nx format:check\",\n    \"update\": \"ng update @nrwl/workspace\",\n    \"update:check\": \"ng update\",\n    \"dep-graph\": \"nx dep-graph\",\n    \"workspace-schematic\": \"nx workspace-schematic\",\n    \"help\": \"nx help\",\n    \"scully\": \"scully\",\n    \"scully:serve\": \"scully serve\"\n  },\n  \"private\": true,\n  \"dependencies\": {\n    \"@angular/animations\": \"~9.0.0-rc.6\",\n    \"@angular/cdk\": \"~8.2.3\",\n    \"@angular/cli\": \"~9.0.0-rc.6\",\n    \"@angular/common\": \"~9.0.0-rc.6\",\n    \"@angular/compiler\": \"~9.0.0-rc.6\",\n    \"@angular/core\": \"~9.0.0-rc.6\",\n    \"@angular/forms\": \"~9.0.0-rc.6\",\n    \"@angular/material\": \"^8.2.3\",\n    \"@angular/platform-browser\": \"~9.0.0-rc.6\",\n    \"@angular/platform-browser-dynamic\": \"~9.0.0-rc.6\",\n    \"@angular/router\": \"~9.0.0-rc.6\",\n    \"@nrwl/angular\": \"8.9.0\",\n    \"@scullyio/init\": \"^0.0.8\",\n    \"@scullyio/ng-lib\": \"latest\",\n    \"@scullyio/scully\": \"latest\",\n    \"guess-parser\": \"^0.4.12\",\n    \"hammerjs\": \"^2.0.8\",\n    \"rxjs\": \"~6.5.3\",\n    \"tslib\": \"^1.10.0\",\n    \"zone.js\": \"~0.10.2\"\n  },\n  \"devDependencies\": {\n    \"@angular-devkit/build-angular\": \"~0.900.0-rc.6\",\n    \"@angular/compiler-cli\": \"~9.0.0-rc.6\",\n    \"@angular/language-service\": \"~9.0.0-rc.6\",\n    \"@babel/core\": \"7.5.4\",\n    \"@nrwl/cypress\": \"8.9.0\",\n    \"@nrwl/jest\": \"8.9.0\",\n    \"@nrwl/storybook\": \"^8.9.0\",\n    \"@nrwl/workspace\": \"8.9.0\",\n    \"@storybook/addon-knobs\": \"5.2.5\",\n    \"@storybook/angular\": \"5.2.5\",\n    \"@storybook/react\": \"5.2.5\",\n    \"@testing-library/cypress\": \"^5.0.2\",\n    \"@types/jasmine\": \"~3.3.8\",\n    \"@types/jasminewd2\": \"~2.0.3\",\n    \"@types/jest\": \"24.0.9\",\n    \"@types/node\": \"~8.9.4\",\n    \"babel-loader\": \"8.0.6\",\n    \"codelyzer\": \"^5.0.0\",\n    \"cypress\": \"3.4.1\",\n    \"jasmine-core\": \"~3.4.0\",\n    \"jasmine-spec-reporter\": \"~4.2.1\",\n    \"jest\": \"24.1.0\",\n    \"jest-preset-angular\": \"7.1.0\",\n    \"karma\": \"~4.1.0\",\n    \"karma-chrome-launcher\": \"~2.2.0\",\n    \"karma-coverage-istanbul-reporter\": \"~2.0.1\",\n    \"karma-jasmine\": \"~2.0.1\",\n    \"karma-jasmine-html-reporter\": \"^1.4.0\",\n    \"prettier\": \"1.18.2\",\n    \"protractor\": \"~5.4.0\",\n    \"ts-jest\": \"24.0.0\",\n    \"ts-node\": \"~7.0.0\",\n    \"tslint\": \"~5.15.0\",\n    \"typescript\": \"~3.6.4\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/scully.config.js",
    "content": "exports.config = {\n  projectRoot: './apps/ng-cli-app/src',\n  routes: {}\n};\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/tools/schematics/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/tools/tsconfig.tools.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../dist/out-tsc/tools\",\n    \"rootDir\": \".\",\n    \"module\": \"commonjs\",\n    \"target\": \"es5\",\n    \"types\": [\"node\"]\n  },\n  \"include\": [\"**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/tsconfig.json",
    "content": "{\n  \"compileOnSave\": false,\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"outDir\": \"./dist/out-tsc\",\n    \"sourceMap\": true,\n    \"declaration\": false,\n    \"downlevelIteration\": true,\n    \"experimentalDecorators\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"importHelpers\": true,\n    \"target\": \"es2015\",\n    \"typeRoots\": [\"node_modules/@types\"],\n    \"lib\": [\"es2018\", \"dom\"],\n    \"paths\": {\n      \"@ng-cli-app/shared/components\": [\"libs/shared/components/src/index.ts\"],\n      \"@ng-cli-app/auth\": [\"libs/auth/src/index.ts\"],\n      \"@ng-cli-app/customers/ui\": [\"libs/customers/ui/src/index.ts\"],\n      \"@ng-cli-app/customers/data\": [\"libs/customers/data/src/index.ts\"],\n      \"@ng-cli-app/home/ui\": [\"libs/home/ui/src/index.ts\"]\n    },\n    \"rootDir\": \".\"\n  },\n  \"angularCompilerOptions\": {\n    \"fullTemplateTypeCheck\": true,\n    \"strictInjectionParameters\": true\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/nx/tslint.json",
    "content": "{\n  \"extends\": \"tslint:recommended\",\n  \"rules\": {\n    \"array-type\": false,\n    \"arrow-parens\": false,\n    \"deprecation\": {\n      \"severity\": \"warning\"\n    },\n    \"component-class-suffix\": true,\n    \"contextual-lifecycle\": true,\n    \"directive-class-suffix\": true,\n    \"directive-selector\": [true, \"attribute\", \"app\", \"camelCase\"],\n    \"component-selector\": [true, \"element\", \"app\", \"kebab-case\"],\n    \"import-blacklist\": [true, \"rxjs/Rx\"],\n    \"interface-name\": false,\n    \"max-classes-per-file\": false,\n    \"max-line-length\": [true, 140],\n    \"member-access\": false,\n    \"member-ordering\": [\n      true,\n      {\n        \"order\": [\n          \"static-field\",\n          \"instance-field\",\n          \"static-method\",\n          \"instance-method\"\n        ]\n      }\n    ],\n    \"no-consecutive-blank-lines\": false,\n    \"no-console\": [true, \"debug\", \"info\", \"time\", \"timeEnd\", \"trace\"],\n    \"no-empty\": false,\n    \"no-inferrable-types\": [true, \"ignore-params\"],\n    \"no-non-null-assertion\": true,\n    \"no-redundant-jsdoc\": true,\n    \"no-switch-case-fall-through\": true,\n    \"no-var-requires\": false,\n    \"object-literal-key-quotes\": [true, \"as-needed\"],\n    \"object-literal-sort-keys\": false,\n    \"ordered-imports\": false,\n    \"quotemark\": [true, \"single\"],\n    \"trailing-comma\": false,\n    \"no-conflicting-lifecycle\": true,\n    \"no-host-metadata-property\": true,\n    \"no-input-rename\": true,\n    \"no-inputs-metadata-property\": true,\n    \"no-output-native\": true,\n    \"no-output-on-prefix\": true,\n    \"no-output-rename\": true,\n    \"no-outputs-metadata-property\": true,\n    \"template-banana-in-box\": true,\n    \"template-no-negated-async\": true,\n    \"use-lifecycle-interface\": true,\n    \"use-pipe-transform-interface\": true,\n    \"nx-enforce-module-boundaries\": [\n      true,\n      {\n        \"allow\": [],\n        \"depConstraints\": [\n          {\n            \"sourceTag\": \"type:app\",\n            \"onlyDependOnLibsWithTags\": [\"type:ui\", \"type:data\"]\n          },\n          {\n            \"sourceTag\": \"type:ui\",\n            \"onlyDependOnLibsWithTags\": [\"type:ui\", \"type:data\"]\n          },\n          {\n            \"sourceTag\": \"type:data\",\n            \"onlyDependOnLibsWithTags\": [\"type:data\"]\n          },\n          {\n            \"sourceTag\": \"scope:app\",\n            \"onlyDependOnLibsWithTags\": [\n              \"scope:auth\",\n              \"scope:customers\",\n              \"scope:home\",\n              \"scope:shared\"\n            ]\n          },\n          {\n            \"sourceTag\": \"scope:auth\",\n            \"onlyDependOnLibsWithTags\": [\"scope:auth\", \"scope:shared\"]\n          },\n          {\n            \"sourceTag\": \"scope:shared\",\n            \"onlyDependOnLibsWithTags\": [\"scope:shared\"]\n          },\n          {\n            \"sourceTag\": \"scope:customers\",\n            \"onlyDependOnLibsWithTags\": [\"scope:customers\", \"scope:shared\"]\n          },\n          {\n            \"sourceTag\": \"scope:home\",\n            \"onlyDependOnLibsWithTags\": [\n              \"scope:home\",\n              \"scope:customers\",\n              \"scope:shared\"\n            ]\n          }\n        ]\n      }\n    ]\n  },\n  \"rulesDirectory\": [\"codelyzer\", \"node_modules/@nrwl/workspace/src/tslint\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/.gitignore",
    "content": "node_modules\n/build\n/*.log\n*.lock\n\npackage-lock.json"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/README.md",
    "content": "# preact-app\n\n## CLI Commands\n\n``` bash\n# install dependencies\nnpm install\n\n# serve with hot reload at localhost:8080\nnpm run dev\n\n# build for production with minification\nnpm run build\n\n# test the production build locally\nnpm run serve\n\n# run tests with jest and preact-render-spy \nnpm run test\n```\n\nFor detailed explanation on how things work, checkout the [CLI Readme](https://github.com/developit/preact-cli/blob/master/README.md).\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/package.json",
    "content": "{\n  \"private\": true,\n  \"name\": \"preact-app\",\n  \"version\": \"0.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"if-env NODE_ENV=production && npm run -s serve || npm run -s dev\",\n    \"build\": \"preact build\",\n    \"serve\": \"preact build && preact serve\",\n    \"dev\": \"preact watch\",\n    \"lint\": \"eslint src\",\n    \"test\": \"jest ./tests\"\n  },\n  \"eslintConfig\": {\n    \"extends\": \"eslint-config-synacor\"\n  },\n  \"eslintIgnore\": [\n    \"build/*\"\n  ],\n  \"devDependencies\": {\n    \"eslint\": \"^4.9.0\",\n    \"eslint-config-synacor\": \"^2.0.2\",\n    \"identity-obj-proxy\": \"^3.0.0\",\n    \"if-env\": \"^1.0.0\",\n    \"jest\": \"^21.2.1\",\n    \"preact-cli\": \"^2.1.0\",\n    \"preact-render-spy\": \"^1.2.1\"\n  },\n  \"dependencies\": {\n    \"preact\": \"^8.2.6\",\n    \"preact-async-route\": \"^2.1.1\",\n    \"preact-compat\": \"^3.17.0\",\n    \"preact-router\": \"^2.5.7\"\n  },\n  \"jest\": {\n    \"verbose\": true,\n    \"setupFiles\": [\n      \"<rootDir>/src/tests/__mocks__/browserMocks.js\"\n    ],\n    \"testURL\": \"http://localhost:8080\",\n    \"moduleFileExtensions\": [\n      \"js\",\n      \"jsx\"\n    ],\n    \"moduleDirectories\": [\n      \"node_modules\"\n    ],\n    \"moduleNameMapper\": {\n      \"\\\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$\": \"<rootDir>/src/tests/__mocks__/fileMock.js\",\n      \"\\\\.(css|less|scss)$\": \"identity-obj-proxy\",\n      \"^./style$\": \"identity-obj-proxy\",\n      \"^preact$\": \"<rootDir>/node_modules/preact/dist/preact.min.js\",\n      \"^react$\": \"preact-compat\",\n      \"^react-dom$\": \"preact-compat\",\n      \"^create-react-class$\": \"preact-compat/lib/create-react-class\",\n      \"^react-addons-css-transition-group$\": \"preact-css-transition-group\"\n    }\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/.babelrc",
    "content": "{\n    \"presets\": [ \n        [\"preact-cli/babel\", { \"modules\": \"commonjs\" }]\n    ]\n}"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/components/app.js",
    "content": "import { h, Component } from 'preact';\nimport { Router } from 'preact-router';\nimport AsyncRoute from 'preact-async-route';\n\nimport Info from './info';\nimport Header from './header';\nimport Home from '../routes/home';\nimport About from '../routes/about';\n// import Home from 'async!../routes/home';\n// import Profile from 'async!../routes/profile';\n\nif (module.hot) {\n  require('preact/debug');\n}\n\nexport default class App extends Component {\n  /** Gets fired when the route changes.\n   *\t@param {Object} event\t\t\"change\" event from [preact-router](http://git.io/preact-router)\n   *\t@param {string} event.url\tThe newly routed URL\n   */\n  handleRoute = e => {\n    this.currentUrl = e.url;\n  };\n\n  render() {\n    return (\n      <div id=\"app\">\n        <Header />\n        <Router onChange={this.handleRoute}>\n          <Home path=\"/\" />\n          <Home path=\"/home\" />\n          <About path=\"/about\" />\n          <Info path=\"/info\" />\n          <AsyncRoute path=\"/profile/\" getComponent={() => import('../routes/profile').then(m => m.default)} />\n          <AsyncRoute path=\"/profile/:user\" getComponent={() => import('../routes/profile').then(m => m.default)} />\n        </Router>\n      </div>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/components/header/index.js",
    "content": "import { h, Component } from 'preact';\nimport { Link } from 'preact-router/match';\nimport style from './style';\n\nexport default class Header extends Component {\n  render() {\n    return (\n      <header class={style.header}>\n        <h1>Preact App</h1>\n        <nav>\n          <Link activeClassName={style.active} href=\"/\">\n            Home\n          </Link>\n          <Link activeClassName={style.active} href=\"/info\">\n            Info\n          </Link>\n          <Link activeClassName={style.active} href=\"/profile\">\n            Me\n          </Link>\n          <Link activeClassName={style.active} href=\"/profile/john\">\n            John\n          </Link>\n          <Link activeClassName={style.active} href=\"/about\">\n            About\n          </Link>\n        </nav>\n      </header>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/components/header/style.css",
    "content": ".header {\n\tposition: fixed;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 56px;\n\tpadding: 0;\n\tbackground: #673AB7;\n\tbox-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n\tz-index: 50;\n}\n\n.header h1 {\n\tfloat: left;\n\tmargin: 0;\n\tpadding: 0 15px;\n\tfont-size: 24px;\n\tline-height: 56px;\n\tfont-weight: 400;\n\tcolor: #FFF;\n}\n\n.header nav {\n\tfloat: right;\n\tfont-size: 100%;\n}\n\n.header nav a {\n\tdisplay: inline-block;\n\theight: 56px;\n\tline-height: 56px;\n\tpadding: 0 15px;\n\tmin-width: 50px;\n\ttext-align: center;\n\tbackground: rgba(255,255,255,0);\n\ttext-decoration: none;\n\tcolor: #FFF;\n\twill-change: background-color;\n}\n\n.header nav a:hover,\n.header nav a:active {\n\tbackground: rgba(0,0,0,0.2);\n}\n\n.header nav a.active {\n\tbackground: rgba(0,0,0,0.4);\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/components/info.js",
    "content": "import { h, Component } from 'preact';\n\nexport default class Info extends Component {\n  render() {\n    return (\n      <div>\n        <h1>Info</h1>\n        <p>This is the Info component.</p>\n      </div>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/index.js",
    "content": "import './style';\nimport App from './components/app';\n\nexport default App;\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/manifest.json",
    "content": "{\n  \"name\": \"preact-app\",\n  \"short_name\": \"preact-app\",\n  \"start_url\": \"/\",\n  \"display\": \"standalone\",\n  \"orientation\": \"portrait\",\n  \"background_color\": \"#fff\",\n  \"theme_color\": \"#673ab8\",\n  \"icons\": [\n    {\n      \"src\": \"/assets/icons/android-chrome-192x192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"/assets/icons/android-chrome-512x512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ]\n}"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/routes/about/index.js",
    "content": "import { h, Component } from 'preact';\n\nexport default class About extends Component {\n  render() {\n    return (\n      <div>\n        <h1>About</h1>\n        <p>This is the About component.</p>\n      </div>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/routes/home/index.js",
    "content": "import { h, Component } from 'preact';\nimport style from './style';\n\nexport default class Home extends Component {\n\trender() {\n\t\treturn (\n\t\t\t<div class={style.home}>\n\t\t\t\t<h1>Home</h1>\n\t\t\t\t<p>This is the Home component.</p>\n\t\t\t</div>\n\t\t);\n\t}\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/routes/home/style.css",
    "content": ".home {\n\tpadding: 56px 20px;\n\tmin-height: 100%;\n\twidth: 100%;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/routes/profile/index.js",
    "content": "import { h, Component } from 'preact';\nimport style from './style';\n\nexport default class Profile extends Component {\n\tstate = {\n\t\ttime: Date.now(),\n\t\tcount: 10\n\t};\n\n\t// gets called when this route is navigated to\n\tcomponentDidMount() {\n\t\t// start a timer for the clock:\n\t\tthis.timer = setInterval(this.updateTime, 1000);\n\t}\n\n\t// gets called just before navigating away from the route\n\tcomponentWillUnmount() {\n\t\tclearInterval(this.timer);\n\t}\n\n\t// update the current time\n\tupdateTime = () => {\n\t\tthis.setState({ time: Date.now() });\n\t};\n\n\tincrement = () => {\n\t\tthis.setState({ count: this.state.count+1 });\n\t};\n\n\t// Note: `user` comes from the URL, courtesy of our router\n\trender({ user }, { time, count }) {\n\t\treturn (\n\t\t\t<div class={style.profile}>\n\t\t\t\t<h1>Profile: {user}</h1>\n\t\t\t\t<p>This is the user profile for a user named { user }.</p>\n\n\t\t\t\t<div>Current time: {new Date(time).toLocaleString()}</div>\n\n\t\t\t\t<p>\n\t\t\t\t\t<button onClick={this.increment}>Click Me</button>\n\t\t\t\t\t{' '}\n\t\t\t\t\tClicked {count} times.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/routes/profile/style.css",
    "content": ".profile {\n\tpadding: 56px 20px;\n\tmin-height: 100%;\n\twidth: 100%;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/style/index.css",
    "content": "html, body {\n\theight: 100%;\n\twidth: 100%;\n\tpadding: 0;\n\tmargin: 0;\n\tbackground: #FAFAFA;\n\tfont-family: 'Helvetica Neue', arial, sans-serif;\n\tfont-weight: 400;\n\tcolor: #444;\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n\n* {\n\tbox-sizing: border-box;\n}\n\n#app {\n\theight: 100%;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/tests/__mocks__/browserMocks.js",
    "content": "// Mock Browser API's which are not supported by JSDOM, e.g. ServiceWorker, LocalStorage\n/**\n * An example how to mock localStorage is given below 👇\n */\n\n/* \n// Mocks localStorage\nconst localStorageMock = (function() {\n\tlet store = {};\n\n\treturn {\n\t\tgetItem: (key) => store[key] || null,\n\t\tsetItem: (key, value) => store[key] = value.toString(),\n\t\tclear: () => store = {}\n\t};\n\n})();\n\nObject.defineProperty(window, 'localStorage', {\n\tvalue: localStorageMock\n}); */\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/preact-app/src/tests/header.test.js",
    "content": "import { h, Component } from 'preact';\nimport Header from '../components/header';\nimport { Link } from 'preact-router/match';\n// See: https://github.com/mzgoddard/preact-render-spy\nimport { shallow, deep } from 'preact-render-spy';\n\ndescribe('Initial Test of the Header', () => {\n\n    test('Header renders 3 nav items', () => {\n        const context = shallow(<Header />);\n        expect(context.find('h1').text()).toBe('Preact App');\n        expect(context.find(<Link />).length).toBe(3);\n    });\n});"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/.gitignore",
    "content": "# See https://help.github.com/ignore-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/README.md",
    "content": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).\n\nBelow you will find some information on how to perform common tasks.<br>\nYou can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).\n\n## Table of Contents\n\n- [Updating to New Releases](#updating-to-new-releases)\n- [Sending Feedback](#sending-feedback)\n- [Folder Structure](#folder-structure)\n- [Available Scripts](#available-scripts)\n  - [npm start](#npm-start)\n  - [npm test](#npm-test)\n  - [npm run build](#npm-run-build)\n  - [npm run eject](#npm-run-eject)\n- [Supported Browsers](#supported-browsers)\n- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills)\n- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor)\n- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)\n- [Debugging in the Editor](#debugging-in-the-editor)\n- [Formatting Code Automatically](#formatting-code-automatically)\n- [Changing the Page `<title>`](#changing-the-page-title)\n- [Installing a Dependency](#installing-a-dependency)\n- [Importing a Component](#importing-a-component)\n- [Code Splitting](#code-splitting)\n- [Adding a Stylesheet](#adding-a-stylesheet)\n- [Post-Processing CSS](#post-processing-css)\n- [Adding a CSS Preprocessor (Sass, Less etc.)](#adding-a-css-preprocessor-sass-less-etc)\n- [Adding Images, Fonts, and Files](#adding-images-fonts-and-files)\n- [Using the `public` Folder](#using-the-public-folder)\n  - [Changing the HTML](#changing-the-html)\n  - [Adding Assets Outside of the Module System](#adding-assets-outside-of-the-module-system)\n  - [When to Use the `public` Folder](#when-to-use-the-public-folder)\n- [Using Global Variables](#using-global-variables)\n- [Adding Bootstrap](#adding-bootstrap)\n  - [Using a Custom Theme](#using-a-custom-theme)\n- [Adding Flow](#adding-flow)\n- [Adding a Router](#adding-a-router)\n- [Adding Custom Environment Variables](#adding-custom-environment-variables)\n  - [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html)\n  - [Adding Temporary Environment Variables In Your Shell](#adding-temporary-environment-variables-in-your-shell)\n  - [Adding Development Environment Variables In `.env`](#adding-development-environment-variables-in-env)\n- [Can I Use Decorators?](#can-i-use-decorators)\n- [Fetching Data with AJAX Requests](#fetching-data-with-ajax-requests)\n- [Integrating with an API Backend](#integrating-with-an-api-backend)\n  - [Node](#node)\n  - [Ruby on Rails](#ruby-on-rails)\n- [Proxying API Requests in Development](#proxying-api-requests-in-development)\n  - [\"Invalid Host Header\" Errors After Configuring Proxy](#invalid-host-header-errors-after-configuring-proxy)\n  - [Configuring the Proxy Manually](#configuring-the-proxy-manually)\n  - [Configuring a WebSocket Proxy](#configuring-a-websocket-proxy)\n- [Using HTTPS in Development](#using-https-in-development)\n- [Generating Dynamic `<meta>` Tags on the Server](#generating-dynamic-meta-tags-on-the-server)\n- [Pre-Rendering into Static HTML Files](#pre-rendering-into-static-html-files)\n- [Injecting Data from the Server into the Page](#injecting-data-from-the-server-into-the-page)\n- [Running Tests](#running-tests)\n  - [Filename Conventions](#filename-conventions)\n  - [Command Line Interface](#command-line-interface)\n  - [Version Control Integration](#version-control-integration)\n  - [Writing Tests](#writing-tests)\n  - [Testing Components](#testing-components)\n  - [Using Third Party Assertion Libraries](#using-third-party-assertion-libraries)\n  - [Initializing Test Environment](#initializing-test-environment)\n  - [Focusing and Excluding Tests](#focusing-and-excluding-tests)\n  - [Coverage Reporting](#coverage-reporting)\n  - [Continuous Integration](#continuous-integration)\n  - [Disabling jsdom](#disabling-jsdom)\n  - [Snapshot Testing](#snapshot-testing)\n  - [Editor Integration](#editor-integration)\n- [Debugging Tests](#debugging-tests)\n  - [Debugging Tests in Chrome](#debugging-tests-in-chrome)\n  - [Debugging Tests in Visual Studio Code](#debugging-tests-in-visual-studio-code)\n- [Developing Components in Isolation](#developing-components-in-isolation)\n  - [Getting Started with Storybook](#getting-started-with-storybook)\n  - [Getting Started with Styleguidist](#getting-started-with-styleguidist)\n- [Publishing Components to npm](#publishing-components-to-npm)\n- [Making a Progressive Web App](#making-a-progressive-web-app)\n  - [Opting Out of Caching](#opting-out-of-caching)\n  - [Offline-First Considerations](#offline-first-considerations)\n  - [Progressive Web App Metadata](#progressive-web-app-metadata)\n- [Analyzing the Bundle Size](#analyzing-the-bundle-size)\n- [Deployment](#deployment)\n  - [Static Server](#static-server)\n  - [Other Solutions](#other-solutions)\n  - [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing)\n  - [Building for Relative Paths](#building-for-relative-paths)\n  - [Azure](#azure)\n  - [Firebase](#firebase)\n  - [GitHub Pages](#github-pages)\n  - [Heroku](#heroku)\n  - [Netlify](#netlify)\n  - [Now](#now)\n  - [S3 and CloudFront](#s3-and-cloudfront)\n  - [Surge](#surge)\n- [Advanced Configuration](#advanced-configuration)\n- [Troubleshooting](#troubleshooting)\n  - [`npm start` doesn’t detect changes](#npm-start-doesnt-detect-changes)\n  - [`npm test` hangs on macOS Sierra](#npm-test-hangs-on-macos-sierra)\n  - [`npm run build` exits too early](#npm-run-build-exits-too-early)\n  - [`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku)\n  - [`npm run build` fails to minify](#npm-run-build-fails-to-minify)\n  - [Moment.js locales are missing](#momentjs-locales-are-missing)\n- [Alternatives to Ejecting](#alternatives-to-ejecting)\n- [Something Missing?](#something-missing)\n\n## Updating to New Releases\n\nCreate React App is divided into two packages:\n\n* `create-react-app` is a global command-line utility that you use to create new projects.\n* `react-scripts` is a development dependency in the generated projects (including this one).\n\nYou almost never need to update `create-react-app` itself: it delegates all the setup to `react-scripts`.\n\nWhen you run `create-react-app`, it always creates the project with the latest version of `react-scripts` so you’ll get all the new features and improvements in newly created apps automatically.\n\nTo update an existing project to a new version of `react-scripts`, [open the changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md), find the version you’re currently on (check `package.json` in this folder if you’re not sure), and apply the migration instructions for the newer versions.\n\nIn most cases bumping the `react-scripts` version in `package.json` and running `npm install` in this folder should be enough, but it’s good to consult the [changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md) for potential breaking changes.\n\nWe commit to keeping the breaking changes minimal so you can upgrade `react-scripts` painlessly.\n\n## Sending Feedback\n\nWe are always open to [your feedback](https://github.com/facebookincubator/create-react-app/issues).\n\n## Folder Structure\n\nAfter creation, your project should look like this:\n\n```\nmy-app/\n  README.md\n  node_modules/\n  package.json\n  public/\n    index.html\n    favicon.ico\n  src/\n    App.css\n    App.js\n    App.test.js\n    index.css\n    index.js\n    logo.svg\n```\n\nFor the project to build, **these files must exist with exact filenames**:\n\n* `public/index.html` is the page template;\n* `src/index.js` is the JavaScript entry point.\n\nYou can delete or rename the other files.\n\nYou may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.<br>\nYou need to **put any JS and CSS files inside `src`**, otherwise Webpack won’t see them.\n\nOnly files inside `public` can be used from `public/index.html`.<br>\nRead instructions below for using assets from JavaScript and HTML.\n\nYou can, however, create more top-level directories.<br>\nThey will not be included in the production build so you can use them for things like documentation.\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.<br>\nOpen [http://localhost:3000](http://localhost:3000) to view it in the browser.\n\nThe page will reload if you make edits.<br>\nYou will also see any lint errors in the console.\n\n### `npm test`\n\nLaunches the test runner in the interactive watch mode.<br>\nSee the section about [running tests](#running-tests) for more information.\n\n### `npm run build`\n\nBuilds the app for production to the `build` folder.<br>\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.<br>\nYour app is ready to be deployed!\n\nSee the section about [deployment](#deployment) for more information.\n\n### `npm run eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can’t go back!**\n\nIf you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.\n\nInstead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.\n\nYou don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.\n\n## Supported Browsers\n\nBy default, the generated project uses the latest version of React.\n\nYou can refer [to the React documentation](https://reactjs.org/docs/react-dom.html#browser-support) for more information about supported browsers.\n\n## Supported Language Features and Polyfills\n\nThis project supports a superset of the latest JavaScript standard.<br>\nIn addition to [ES6](https://github.com/lukehoban/es6features) syntax features, it also supports:\n\n* [Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator) (ES2016).\n* [Async/await](https://github.com/tc39/ecmascript-asyncawait) (ES2017).\n* [Object Rest/Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread) (stage 3 proposal).\n* [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 3 proposal)\n* [Class Fields and Static Properties](https://github.com/tc39/proposal-class-public-fields) (part of stage 3 proposal).\n* [JSX](https://facebook.github.io/react/docs/introducing-jsx.html) and [Flow](https://flowtype.org/) syntax.\n\nLearn more about [different proposal stages](https://babeljs.io/docs/plugins/#presets-stage-x-experimental-presets-).\n\nWhile we recommend using experimental proposals with some caution, Facebook heavily uses these features in the product code, so we intend to provide [codemods](https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb) if any of these proposals change in the future.\n\nNote that **the project only includes a few ES6 [polyfills](https://en.wikipedia.org/wiki/Polyfill)**:\n\n* [`Object.assign()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) via [`object-assign`](https://github.com/sindresorhus/object-assign).\n* [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) via [`promise`](https://github.com/then/promise).\n* [`fetch()`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) via [`whatwg-fetch`](https://github.com/github/fetch).\n\nIf you use any other ES6+ features that need **runtime support** (such as `Array.from()` or `Symbol`), make sure you are including the appropriate polyfills manually, or that the browsers you are targeting already support them.\n\nAlso note that using some newer syntax features like `for...of` or `[...nonArrayValue]` causes Babel to emit code that depends on ES6 runtime features and might not work without a polyfill. When in doubt, use [Babel REPL](https://babeljs.io/repl/) to see what any specific syntax compiles down to.\n\n## Syntax Highlighting in the Editor\n\nTo configure the syntax highlighting in your favorite text editor, head to the [relevant Babel documentation page](https://babeljs.io/docs/editors) and follow the instructions. Some of the most popular editors are covered.\n\n## Displaying Lint Output in the Editor\n\n>Note: this feature is available with `react-scripts@0.2.0` and higher.<br>\n>It also only works with npm 3 or higher.\n\nSome editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.\n\nThey are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do.\n\nYou would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc` to the project root:\n\n```js\n{\n  \"extends\": \"react-app\"\n}\n```\n\nNow your editor should report the linting warnings.\n\nNote that even if you edit your `.eslintrc` file further, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes.\n\nIf you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules.\n\n## Debugging in the Editor\n\n**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).**\n\nVisual Studio Code and WebStorm support debugging out of the box with Create React App. This enables you as a developer to write and debug your React code without leaving the editor, and most importantly it enables you to have a continuous development workflow, where context switching is minimal, as you don’t have to switch between tools.\n\n### Visual Studio Code\n\nYou would need to have the latest version of [VS Code](https://code.visualstudio.com) and VS Code [Chrome Debugger Extension](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) installed.\n\nThen add the block below to your `launch.json` file and put it inside the `.vscode` folder in your app’s root directory.\n\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [{\n    \"name\": \"Chrome\",\n    \"type\": \"chrome\",\n    \"request\": \"launch\",\n    \"url\": \"http://localhost:3000\",\n    \"webRoot\": \"${workspaceRoot}/src\",\n    \"sourceMapPathOverrides\": {\n      \"webpack:///src/*\": \"${webRoot}/*\"\n    }\n  }]\n}\n```\n>Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).\n\nStart your app by running `npm start`, and start debugging in VS Code by pressing `F5` or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor.\n\nHaving problems with VS Code Debugging? Please see their [troubleshooting guide](https://github.com/Microsoft/vscode-chrome-debug/blob/master/README.md#troubleshooting).\n\n### WebStorm\n\nYou would need to have [WebStorm](https://www.jetbrains.com/webstorm/) and [JetBrains IDE Support](https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji) Chrome extension installed.\n\nIn the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and select `JavaScript Debug`. Paste `http://localhost:3000` into the URL field and save the configuration.\n\n>Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).\n\nStart your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm.\n\nThe same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine.\n\n## Formatting Code Automatically\n\nPrettier is an opinionated code formatter with support for JavaScript, CSS and JSON. With Prettier you can format the code you write automatically to ensure a code style within your project. See the [Prettier's GitHub page](https://github.com/prettier/prettier) for more information, and look at this [page to see it in action](https://prettier.github.io/prettier/).\n\nTo format our code whenever we make a commit in git, we need to install the following dependencies:\n\n```sh\nnpm install --save husky lint-staged prettier\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add husky lint-staged prettier\n```\n\n* `husky` makes it easy to use githooks as if they are npm scripts.\n* `lint-staged` allows us to run scripts on staged files in git. See this [blog post about lint-staged to learn more about it](https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8).\n* `prettier` is the JavaScript formatter we will run before commits.\n\nNow we can make sure every file is formatted correctly by adding a few lines to the `package.json` in the project root.\n\nAdd the following line to `scripts` section:\n\n```diff\n  \"scripts\": {\n+   \"precommit\": \"lint-staged\",\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n```\n\nNext we add a 'lint-staged' field to the `package.json`, for example:\n\n```diff\n  \"dependencies\": {\n    // ...\n  },\n+ \"lint-staged\": {\n+   \"src/**/*.{js,jsx,json,css}\": [\n+     \"prettier --single-quote --write\",\n+     \"git add\"\n+   ]\n+ },\n  \"scripts\": {\n```\n\nNow, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --single-quote --write \"src/**/*.{js,jsx,json,css}\"` to format your entire project for the first time.\n\nNext you might want to integrate Prettier in your favorite editor. Read the section on [Editor Integration](https://prettier.io/docs/en/editors.html) on the Prettier GitHub page.\n\n## Changing the Page `<title>`\n\nYou can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “React App” to anything else.\n\nNote that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](#adding-a-stylesheet) is done without touching the HTML.\n\nIf you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library.\n\nIf you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](#generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](#pre-rendering-into-static-html-files).\n\n## Installing a Dependency\n\nThe generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with `npm`:\n\n```sh\nnpm install --save react-router\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-router\n```\n\nThis works for any library, not just `react-router`.\n\n## Importing a Component\n\nThis project setup supports ES6 modules thanks to Babel.<br>\nWhile you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.\n\nFor example:\n\n### `Button.js`\n\n```js\nimport React, { Component } from 'react';\n\nclass Button extends Component {\n  render() {\n    // ...\n  }\n}\n\nexport default Button; // Don’t forget to use export default!\n```\n\n### `DangerButton.js`\n\n\n```js\nimport React, { Component } from 'react';\nimport Button from './Button'; // Import a component from another file\n\nclass DangerButton extends Component {\n  render() {\n    return <Button color=\"red\" />;\n  }\n}\n\nexport default DangerButton;\n```\n\nBe aware of the [difference between default and named exports](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281). It is a common source of mistakes.\n\nWe suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use `export default Button` and `import Button from './Button'`.\n\nNamed exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like.\n\nLearn more about ES6 modules:\n\n* [When to use the curly braces?](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281)\n* [Exploring ES6: Modules](http://exploringjs.com/es6/ch_modules.html)\n* [Understanding ES6: Modules](https://leanpub.com/understandinges6/read#leanpub-auto-encapsulating-code-with-modules)\n\n## Code Splitting\n\nInstead of downloading the entire app before users can use it, code splitting allows you to split your code into small chunks which you can then load on demand.\n\nThis project setup supports code splitting via [dynamic `import()`](http://2ality.com/2017/01/import-operator.html#loading-code-on-demand). Its [proposal](https://github.com/tc39/proposal-dynamic-import) is in stage 3. The `import()` function-like form takes the module name as an argument and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which always resolves to the namespace object of the module.\n\nHere is an example:\n\n### `moduleA.js`\n\n```js\nconst moduleA = 'Hello';\n\nexport { moduleA };\n```\n### `App.js`\n\n```js\nimport React, { Component } from 'react';\n\nclass App extends Component {\n  handleClick = () => {\n    import('./moduleA')\n      .then(({ moduleA }) => {\n        // Use moduleA\n      })\n      .catch(err => {\n        // Handle failure\n      });\n  };\n\n  render() {\n    return (\n      <div>\n        <button onClick={this.handleClick}>Load</button>\n      </div>\n    );\n  }\n}\n\nexport default App;\n```\n\nThis will make `moduleA.js` and all its unique dependencies as a separate chunk that only loads after the user clicks the 'Load' button.\n\nYou can also use it with `async` / `await` syntax if you prefer it.\n\n### With React Router\n\nIf you are using React Router check out [this tutorial](http://serverless-stack.com/chapters/code-splitting-in-create-react-app.html) on how to use code splitting with it. You can find the companion GitHub repository [here](https://github.com/AnomalyInnovations/serverless-stack-demo-client/tree/code-splitting-in-create-react-app).\n\nAlso check out the [Code Splitting](https://reactjs.org/docs/code-splitting.html) section in React documentation.\n\n## Adding a Stylesheet\n\nThis project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:\n\n### `Button.css`\n\n```css\n.Button {\n  padding: 20px;\n}\n```\n\n### `Button.js`\n\n```js\nimport React, { Component } from 'react';\nimport './Button.css'; // Tell Webpack that Button.js uses these styles\n\nclass Button extends Component {\n  render() {\n    // You can use them as regular CSS styles\n    return <div className=\"Button\" />;\n  }\n}\n```\n\n**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.\n\nIn development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output.\n\nIf you are concerned about using Webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool.\n\n## Post-Processing CSS\n\nThis project setup minifies your CSS and adds vendor prefixes to it automatically through [Autoprefixer](https://github.com/postcss/autoprefixer) so you don’t need to worry about it.\n\nFor example, this:\n\n```css\n.App {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n}\n```\n\nbecomes this:\n\n```css\n.App {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: horizontal;\n  -webkit-box-direction: normal;\n      -ms-flex-direction: row;\n          flex-direction: row;\n  -webkit-box-align: center;\n      -ms-flex-align: center;\n          align-items: center;\n}\n```\n\nIf you need to disable autoprefixing for some reason, [follow this section](https://github.com/postcss/autoprefixer#disabling).\n\n## Adding a CSS Preprocessor (Sass, Less etc.)\n\nGenerally, we recommend that you don’t reuse the same CSS classes across different components. For example, instead of using a `.Button` CSS class in `<AcceptButton>` and `<RejectButton>` components, we recommend creating a `<Button>` component with its own `.Button` styles, that both `<AcceptButton>` and `<RejectButton>` can render (but [not inherit](https://facebook.github.io/react/docs/composition-vs-inheritance.html)).\n\nFollowing this rule often makes CSS preprocessors less useful, as features like mixins and nesting are replaced by component composition. You can, however, integrate a CSS preprocessor if you find it valuable. In this walkthrough, we will be using Sass, but you can also use Less, or another alternative.\n\nFirst, let’s install the command-line interface for Sass:\n\n```sh\nnpm install --save node-sass-chokidar\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add node-sass-chokidar\n```\n\nThen in `package.json`, add the following lines to `scripts`:\n\n```diff\n   \"scripts\": {\n+    \"build-css\": \"node-sass-chokidar src/ -o src/\",\n+    \"watch-css\": \"npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive\",\n     \"start\": \"react-scripts start\",\n     \"build\": \"react-scripts build\",\n     \"test\": \"react-scripts test --env=jsdom\",\n```\n\n>Note: To use a different preprocessor, replace `build-css` and `watch-css` commands according to your preprocessor’s documentation.\n\nNow you can rename `src/App.css` to `src/App.scss` and run `npm run watch-css`. The watcher will find every Sass file in `src` subdirectories, and create a corresponding CSS file next to it, in our case overwriting `src/App.css`. Since `src/App.js` still imports `src/App.css`, the styles become a part of your application. You can now edit `src/App.scss`, and `src/App.css` will be regenerated.\n\nTo share variables between Sass files, you can use Sass imports. For example, `src/App.scss` and other component style files could include `@import \"./shared.scss\";` with variable definitions.\n\nTo enable importing files without using relative paths, you can add the  `--include-path` option to the command in `package.json`.\n\n```\n\"build-css\": \"node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/\",\n\"watch-css\": \"npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive\",\n```\n\nThis will allow you to do imports like\n\n```scss\n@import 'styles/_colors.scss'; // assuming a styles directory under src/\n@import 'nprogress/nprogress'; // importing a css file from the nprogress node module\n```\n\nAt this point you might want to remove all CSS files from the source control, and add `src/**/*.css` to your `.gitignore` file. It is generally a good practice to keep the build products outside of the source control.\n\nAs a final step, you may find it convenient to run `watch-css` automatically with `npm start`, and run `build-css` as a part of `npm run build`. You can use the `&&` operator to execute two scripts sequentially. However, there is no cross-platform way to run two scripts in parallel, so we will install a package for this:\n\n```sh\nnpm install --save npm-run-all\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add npm-run-all\n```\n\nThen we can change `start` and `build` scripts to include the CSS preprocessor commands:\n\n```diff\n   \"scripts\": {\n     \"build-css\": \"node-sass-chokidar src/ -o src/\",\n     \"watch-css\": \"npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive\",\n-    \"start\": \"react-scripts start\",\n-    \"build\": \"react-scripts build\",\n+    \"start-js\": \"react-scripts start\",\n+    \"start\": \"npm-run-all -p watch-css start-js\",\n+    \"build-js\": \"react-scripts build\",\n+    \"build\": \"npm-run-all build-css build-js\",\n     \"test\": \"react-scripts test --env=jsdom\",\n     \"eject\": \"react-scripts eject\"\n   }\n```\n\nNow running `npm start` and `npm run build` also builds Sass files.\n\n**Why `node-sass-chokidar`?**\n\n`node-sass` has been reported as having the following issues:\n\n- `node-sass --watch` has been reported to have *performance issues* in certain conditions when used in a virtual machine or with docker.\n\n- Infinite styles compiling [#1939](https://github.com/facebookincubator/create-react-app/issues/1939)\n\n- `node-sass` has been reported as having issues with detecting new files in a directory [#1891](https://github.com/sass/node-sass/issues/1891)\n\n `node-sass-chokidar` is used here as it addresses these issues.\n\n## Adding Images, Fonts, and Files\n\nWith Webpack, using static assets like images and fonts works similarly to CSS.\n\nYou can **`import` a file right in a JavaScript module**. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF.\n\nTo reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebookincubator/create-react-app/issues/1153).\n\nHere is an example:\n\n```js\nimport React from 'react';\nimport logo from './logo.png'; // Tell Webpack this JS file uses this image\n\nconsole.log(logo); // /logo.84287d09.png\n\nfunction Header() {\n  // Import result is the URL of your image\n  return <img src={logo} alt=\"Logo\" />;\n}\n\nexport default Header;\n```\n\nThis ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths.\n\nThis works in CSS too:\n\n```css\n.Logo {\n  background-image: url(./logo.png);\n}\n```\n\nWebpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.\n\nPlease be advised that this is also a custom feature of Webpack.\n\n**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).<br>\nAn alternative way of handling static assets is described in the next section.\n\n## Using the `public` Folder\n\n>Note: this feature is available with `react-scripts@0.5.0` and higher.\n\n### Changing the HTML\n\nThe `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](#changing-the-page-title).\nThe `<script>` tag with the compiled code will be added to it automatically during the build process.\n\n### Adding Assets Outside of the Module System\n\nYou can also add other assets to the `public` folder.\n\nNote that we normally encourage you to `import` assets in JavaScript files instead.\nFor example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-fonts-and-files).\nThis mechanism provides a number of benefits:\n\n* Scripts and stylesheets get minified and bundled together to avoid extra network requests.\n* Missing files cause compilation errors instead of 404 errors for your users.\n* Result filenames include content hashes so you don’t need to worry about browsers caching their old versions.\n\nHowever there is an **escape hatch** that you can use to add an asset outside of the module system.\n\nIf you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched.   To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`.\n\nInside `index.html`, you can use it like this:\n\n```html\n<link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n```\n\nOnly files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build.\n\nWhen you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.\n\nIn JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes:\n\n```js\nrender() {\n  // Note: this is an escape hatch and should be used sparingly!\n  // Normally we recommend using `import` for getting asset URLs\n  // as described in “Adding Images and Fonts” above this section.\n  return <img src={process.env.PUBLIC_URL + '/img/logo.png'} />;\n}\n```\n\nKeep in mind the downsides of this approach:\n\n* None of the files in `public` folder get post-processed or minified.\n* Missing files will not be called at compilation time, and will cause 404 errors for your users.\n* Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change.\n\n### When to Use the `public` Folder\n\nNormally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-fonts-and-files) from JavaScript.\nThe `public` folder is useful as a workaround for a number of less common cases:\n\n* You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest).\n* You have thousands of images and need to dynamically reference their paths.\n* You want to include a small script like [`pace.js`](http://github.hubspot.com/pace/docs/welcome/) outside of the bundled code.\n* Some library may be incompatible with Webpack and you have no other option but to include it as a `<script>` tag.\n\nNote that if you add a `<script>` that declares global variables, you also need to read the next section on using them.\n\n## Using Global Variables\n\nWhen you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable.\n\nYou can avoid this by reading the global variable explicitly from the `window` object, for example:\n\n```js\nconst $ = window.$;\n```\n\nThis makes it obvious you are using a global variable intentionally rather than because of a typo.\n\nAlternatively, you can force the linter to ignore any line by adding `// eslint-disable-line` after it.\n\n## Adding Bootstrap\n\nYou don’t have to use [React Bootstrap](https://react-bootstrap.github.io) together with React but it is a popular library for integrating Bootstrap with React apps. If you need it, you can integrate it with Create React App by following these steps:\n\nInstall React Bootstrap and Bootstrap from npm. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well:\n\n```sh\nnpm install --save react-bootstrap bootstrap@3\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-bootstrap bootstrap@3\n```\n\nImport Bootstrap CSS and optionally Bootstrap theme CSS in the beginning of your ```src/index.js``` file:\n\n```js\nimport 'bootstrap/dist/css/bootstrap.css';\nimport 'bootstrap/dist/css/bootstrap-theme.css';\n// Put any other imports below so that CSS from your\n// components takes precedence over default styles.\n```\n\nImport required React Bootstrap components within ```src/App.js``` file or your custom component files:\n\n```js\nimport { Navbar, Jumbotron, Button } from 'react-bootstrap';\n```\n\nNow you are ready to use the imported React Bootstrap components within your component hierarchy defined in the render method. Here is an example [`App.js`](https://gist.githubusercontent.com/gaearon/85d8c067f6af1e56277c82d19fd4da7b/raw/6158dd991b67284e9fc8d70b9d973efe87659d72/App.js) redone using React Bootstrap.\n\n### Using a Custom Theme\n\nSometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).<br>\nWe suggest the following approach:\n\n* Create a new package that depends on the package you wish to customize, e.g. Bootstrap.\n* Add the necessary build steps to tweak the theme, and publish your package on npm.\n* Install your own theme npm package as a dependency of your app.\n\nHere is an example of adding a [customized Bootstrap](https://medium.com/@tacomanator/customizing-create-react-app-aa9ffb88165) that follows these steps.\n\n## Adding Flow\n\nFlow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept.\n\nRecent versions of [Flow](http://flowtype.org/) work with Create React App projects out of the box.\n\nTo add Flow to a Create React App project, follow these steps:\n\n1. Run `npm install --save flow-bin` (or `yarn add flow-bin`).\n2. Add `\"flow\": \"flow\"` to the `scripts` section of your `package.json`.\n3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flowtype.org/docs/advanced-configuration.html) in the root directory.\n4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).\n\nNow you can run `npm run flow` (or `yarn flow`) to check the files for type errors.\nYou can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.\nIn the future we plan to integrate it into Create React App even more closely.\n\nTo learn more about Flow, check out [its documentation](https://flowtype.org/).\n\n## Adding a Router\n\nCreate React App doesn't prescribe a specific routing solution, but [React Router](https://reacttraining.com/react-router/) is the most popular one.\n\nTo add it, run:\n\n```sh\nnpm install --save react-router-dom\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-router-dom\n```\n\nTo try it, delete all the code in `src/App.js` and replace it with any of the examples on its website. The [Basic Example](https://reacttraining.com/react-router/web/example/basic) is a good place to get started.\n\nNote that [you may need to configure your production server to support client-side routing](#serving-apps-with-client-side-routing) before deploying your app.\n\n## Adding Custom Environment Variables\n\n>Note: this feature is available with `react-scripts@0.2.3` and higher.\n\nYour project can consume variables declared in your environment as if they were declared locally in your JS files. By\ndefault you will have `NODE_ENV` defined for you, and any other environment variables starting with\n`REACT_APP_`.\n\n**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them.\n\n>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running.\n\nThese environment variables will be defined for you on `process.env`. For example, having an environment\nvariable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`.\n\nThere is also a special built-in environment variable called `NODE_ENV`. You can read it from `process.env.NODE_ENV`. When you run `npm start`, it is always equal to `'development'`, when you run `npm test` it is always equal to `'test'`, and when you run `npm run build` to make a production bundle, it is always equal to `'production'`. **You cannot override `NODE_ENV` manually.** This prevents developers from accidentally deploying a slow development build to production.\n\nThese environment variables can be useful for displaying information conditionally based on where the project is\ndeployed or consuming sensitive data that lives outside of version control.\n\nFirst, you need to have environment variables defined. For example, let’s say you wanted to consume a secret defined\nin the environment inside a `<form>`:\n\n```jsx\nrender() {\n  return (\n    <div>\n      <small>You are running this application in <b>{process.env.NODE_ENV}</b> mode.</small>\n      <form>\n        <input type=\"hidden\" defaultValue={process.env.REACT_APP_SECRET_CODE} />\n      </form>\n    </div>\n  );\n}\n```\n\nDuring the build, `process.env.REACT_APP_SECRET_CODE` will be replaced with the current value of the `REACT_APP_SECRET_CODE` environment variable. Remember that the `NODE_ENV` variable will be set for you automatically.\n\nWhen you load the app in the browser and inspect the `<input>`, you will see its value set to `abcdef`, and the bold text will show the environment provided when using `npm start`:\n\n```html\n<div>\n  <small>You are running this application in <b>development</b> mode.</small>\n  <form>\n    <input type=\"hidden\" value=\"abcdef\" />\n  </form>\n</div>\n```\n\nThe above form is looking for a variable called `REACT_APP_SECRET_CODE` from the environment. In order to consume this\nvalue, we need to have it defined in the environment. This can be done using two ways: either in your shell or in\na `.env` file. Both of these ways are described in the next few sections.\n\nHaving access to the `NODE_ENV` is also useful for performing actions conditionally:\n\n```js\nif (process.env.NODE_ENV !== 'production') {\n  analytics.disable();\n}\n```\n\nWhen you compile the app with `npm run build`, the minification step will strip out this condition, and the resulting bundle will be smaller.\n\n### Referencing Environment Variables in the HTML\n\n>Note: this feature is available with `react-scripts@0.9.0` and higher.\n\nYou can also access the environment variables starting with `REACT_APP_` in the `public/index.html`. For example:\n\n```html\n<title>%REACT_APP_WEBSITE_NAME%</title>\n```\n\nNote that the caveats from the above section apply:\n\n* Apart from a few built-in variables (`NODE_ENV` and `PUBLIC_URL`), variable names must start with `REACT_APP_` to work.\n* The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](#generating-dynamic-meta-tags-on-the-server).\n\n### Adding Temporary Environment Variables In Your Shell\n\nDefining environment variables can vary between OSes. It’s also important to know that this manner is temporary for the\nlife of the shell session.\n\n#### Windows (cmd.exe)\n\n```cmd\nset \"REACT_APP_SECRET_CODE=abcdef\" && npm start\n```\n\n(Note: Quotes around the variable assignment are required to avoid a trailing whitespace.)\n\n#### Windows (Powershell)\n\n```Powershell\n($env:REACT_APP_SECRET_CODE = \"abcdef\") -and (npm start)\n```\n\n#### Linux, macOS (Bash)\n\n```bash\nREACT_APP_SECRET_CODE=abcdef npm start\n```\n\n### Adding Development Environment Variables In `.env`\n\n>Note: this feature is available with `react-scripts@0.5.0` and higher.\n\nTo define permanent environment variables, create a file called `.env` in the root of your project:\n\n```\nREACT_APP_SECRET_CODE=abcdef\n```\n>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid [accidentally exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running.\n\n`.env` files **should be** checked into source control (with the exclusion of `.env*.local`).\n\n#### What other `.env` files can be used?\n\n>Note: this feature is **available with `react-scripts@1.0.0` and higher**.\n\n* `.env`: Default.\n* `.env.local`: Local overrides. **This file is loaded for all environments except test.**\n* `.env.development`, `.env.test`, `.env.production`: Environment-specific settings.\n* `.env.development.local`, `.env.test.local`, `.env.production.local`: Local overrides of environment-specific settings.\n\nFiles on the left have more priority than files on the right:\n\n* `npm start`: `.env.development.local`, `.env.development`, `.env.local`, `.env`\n* `npm run build`: `.env.production.local`, `.env.production`, `.env.local`, `.env`\n* `npm test`: `.env.test.local`, `.env.test`, `.env` (note `.env.local` is missing)\n\nThese variables will act as the defaults if the machine does not explicitly set them.<br>\nPlease refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.\n\n>Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need\nthese defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars).\n\n#### Expanding Environment Variables In `.env`\n\n>Note: this feature is available with `react-scripts@1.1.0` and higher.\n\nExpand variables already on your machine for use in your `.env` file (using [dotenv-expand](https://github.com/motdotla/dotenv-expand)).\n\nFor example, to get the environment variable `npm_package_version`:\n\n```\nREACT_APP_VERSION=$npm_package_version\n# also works:\n# REACT_APP_VERSION=${npm_package_version}\n```\n\nOr expand variables local to the current `.env` file:\n\n```\nDOMAIN=www.example.com\nREACT_APP_FOO=$DOMAIN/foo\nREACT_APP_BAR=$DOMAIN/bar\n```\n\n## Can I Use Decorators?\n\nMany popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.<br>\nCreate React App doesn’t support decorator syntax at the moment because:\n\n* It is an experimental proposal and is subject to change.\n* The current specification version is not officially supported by Babel.\n* If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook.\n\nHowever in many cases you can rewrite decorator-based code without decorators just as fine.<br>\nPlease refer to these two threads for reference:\n\n* [#214](https://github.com/facebookincubator/create-react-app/issues/214)\n* [#411](https://github.com/facebookincubator/create-react-app/issues/411)\n\nCreate React App will add decorator support when the specification advances to a stable stage.\n\n## Fetching Data with AJAX Requests\n\nReact doesn't prescribe a specific approach to data fetching, but people commonly use either a library like [axios](https://github.com/axios/axios) or the [`fetch()` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) provided by the browser. Conveniently, Create React App includes a polyfill for `fetch()` so you can use it without worrying about the browser support.\n\nThe global `fetch` function allows to easily makes AJAX requests. It takes in a URL as an input and returns a `Promise` that resolves to a `Response` object. You can find more information about `fetch` [here](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).\n\nThis project also includes a [Promise polyfill](https://github.com/then/promise) which provides a full implementation of Promises/A+. A Promise represents the eventual result of an asynchronous operation, you can find more information about Promises [here](https://www.promisejs.org/) and [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Both axios and `fetch()` use Promises under the hood. You can also use the [`async / await`](https://davidwalsh.name/async-await) syntax to reduce the callback nesting.\n\nYou can learn more about making AJAX requests from React components in [the FAQ entry on the React website](https://reactjs.org/docs/faq-ajax.html).\n\n## Integrating with an API Backend\n\nThese tutorials will help you to integrate your app with an API backend running on another port,\nusing `fetch()` to access it.\n\n### Node\nCheck out [this tutorial](https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/).\nYou can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo).\n\n### Ruby on Rails\n\nCheck out [this tutorial](https://www.fullstackreact.com/articles/how-to-get-create-react-app-to-work-with-your-rails-api/).\nYou can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo-rails).\n\n## Proxying API Requests in Development\n\n>Note: this feature is available with `react-scripts@0.2.3` and higher.\n\nPeople often serve the front-end React app from the same host and port as their backend implementation.<br>\nFor example, a production setup might look like this after the app is deployed:\n\n```\n/             - static server returns index.html with React app\n/todos        - static server returns index.html with React app\n/api/todos    - server handles any /api/* requests using the backend implementation\n```\n\nSuch setup is **not** required. However, if you **do** have a setup like this, it is convenient to write requests like `fetch('/api/todos')` without worrying about redirecting them to another host or port during development.\n\nTo tell the development server to proxy any unknown requests to your API server in development, add a `proxy` field to your `package.json`, for example:\n\n```js\n  \"proxy\": \"http://localhost:4000\",\n```\n\nThis way, when you `fetch('/api/todos')` in development, the development server will recognize that it’s not a static asset, and will proxy your request to `http://localhost:4000/api/todos` as a fallback. The development server will **only** attempt to send requests without `text/html` in its `Accept` header to the proxy.\n\nConveniently, this avoids [CORS issues](http://stackoverflow.com/questions/21854516/understanding-ajax-cors-and-security-considerations) and error messages like this in development:\n\n```\nFetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.\n```\n\nKeep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`.\n\nThe `proxy` option supports HTTP, HTTPS and WebSocket connections.<br>\nIf the `proxy` option is **not** flexible enough for you, alternatively you can:\n\n* [Configure the proxy yourself](#configuring-the-proxy-manually)\n* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)).\n* Use [environment variables](#adding-custom-environment-variables) to inject the right server host and port into your app.\n\n### \"Invalid Host Header\" Errors After Configuring Proxy\n\nWhen you enable the `proxy` option, you opt into a more strict set of host checks. This is necessary because leaving the backend open to remote hosts makes your computer vulnerable to DNS rebinding attacks. The issue is explained in [this article](https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a) and [this issue](https://github.com/webpack/webpack-dev-server/issues/887).\n\nThis shouldn’t affect you when developing on `localhost`, but if you develop remotely like [described here](https://github.com/facebookincubator/create-react-app/issues/2271), you will see this error in the browser after enabling the `proxy` option:\n\n>Invalid Host header\n\nTo work around it, you can specify your public development host in a file called `.env.development` in the root of your project:\n\n```\nHOST=mypublicdevhost.com\n```\n\nIf you restart the development server now and load the app from the specified host, it should work.\n\nIf you are still having issues or if you’re using a more exotic environment like a cloud editor, you can bypass the host check completely by adding a line to `.env.development.local`. **Note that this is dangerous and exposes your machine to remote code execution from malicious websites:**\n\n```\n# NOTE: THIS IS DANGEROUS!\n# It exposes your machine to attacks from the websites you visit.\nDANGEROUSLY_DISABLE_HOST_CHECK=true\n```\n\nWe don’t recommend this approach.\n\n### Configuring the Proxy Manually\n\n>Note: this feature is available with `react-scripts@1.0.0` and higher.\n\nIf the `proxy` option is **not** flexible enough for you, you can specify an object in the following form (in `package.json`).<br>\nYou may also specify any configuration value [`http-proxy-middleware`](https://github.com/chimurai/http-proxy-middleware#options) or [`http-proxy`](https://github.com/nodejitsu/node-http-proxy#options) supports.\n```js\n{\n  // ...\n  \"proxy\": {\n    \"/api\": {\n      \"target\": \"<url>\",\n      \"ws\": true\n      // ...\n    }\n  }\n  // ...\n}\n```\n\nAll requests matching this path will be proxies, no exceptions. This includes requests for `text/html`, which the standard `proxy` option does not proxy.\n\nIf you need to specify multiple proxies, you may do so by specifying additional entries.\nMatches are regular expressions, so that you can use a regexp to match multiple paths.\n```js\n{\n  // ...\n  \"proxy\": {\n    // Matches any request starting with /api\n    \"/api\": {\n      \"target\": \"<url_1>\",\n      \"ws\": true\n      // ...\n    },\n    // Matches any request starting with /foo\n    \"/foo\": {\n      \"target\": \"<url_2>\",\n      \"ssl\": true,\n      \"pathRewrite\": {\n        \"^/foo\": \"/foo/beta\"\n      }\n      // ...\n    },\n    // Matches /bar/abc.html but not /bar/sub/def.html\n    \"/bar/[^/]*[.]html\": {\n      \"target\": \"<url_3>\",\n      // ...\n    },\n    // Matches /baz/abc.html and /baz/sub/def.html\n    \"/baz/.*/.*[.]html\": {\n      \"target\": \"<url_4>\"\n      // ...\n    }\n  }\n  // ...\n}\n```\n\n### Configuring a WebSocket Proxy\n\nWhen setting up a WebSocket proxy, there are a some extra considerations to be aware of.\n\nIf you’re using a WebSocket engine like [Socket.io](https://socket.io/), you must have a Socket.io server running that you can use as the proxy target. Socket.io will not work with a standard WebSocket server. Specifically, don't expect Socket.io to work with [the websocket.org echo test](http://websocket.org/echo.html).\n\nThere’s some good documentation available for [setting up a Socket.io server](https://socket.io/docs/).\n\nStandard WebSockets **will** work with a standard WebSocket server as well as the websocket.org echo test. You can use libraries like [ws](https://github.com/websockets/ws) for the server, with [native WebSockets in the browser](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).\n\nEither way, you can proxy WebSocket requests manually in `package.json`:\n\n```js\n{\n  // ...\n  \"proxy\": {\n    \"/socket\": {\n      // Your compatible WebSocket server\n      \"target\": \"ws://<socket_url>\",\n      // Tell http-proxy-middleware that this is a WebSocket proxy.\n      // Also allows you to proxy WebSocket requests without an additional HTTP request\n      // https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade\n      \"ws\": true\n      // ...\n    }\n  }\n  // ...\n}\n```\n\n## Using HTTPS in Development\n\n>Note: this feature is available with `react-scripts@0.4.0` and higher.\n\nYou may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the \"proxy\" feature](#proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS.\n\nTo do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`:\n\n#### Windows (cmd.exe)\n\n```cmd\nset HTTPS=true&&npm start\n```\n\n#### Windows (Powershell)\n\n```Powershell\n($env:HTTPS = $true) -and (npm start)\n```\n\n(Note: the lack of whitespace is intentional.)\n\n#### Linux, macOS (Bash)\n\n```bash\nHTTPS=true npm start\n```\n\nNote that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page.\n\n## Generating Dynamic `<meta>` Tags on the Server\n\nSince Create React App doesn’t support server rendering, you might be wondering how to make `<meta>` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this:\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta property=\"og:title\" content=\"__OG_TITLE__\">\n    <meta property=\"og:description\" content=\"__OG_DESCRIPTION__\">\n```\n\nThen, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML!\n\nIf you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases.\n\n## Pre-Rendering into Static HTML Files\n\nIf you’re hosting your `build` with a static hosting provider you can use [react-snapshot](https://www.npmjs.com/package/react-snapshot) or [react-snap](https://github.com/stereobooster/react-snap) to generate HTML pages for each route, or relative link, in your application. These pages will then seamlessly become active, or “hydrated”, when the JavaScript bundle has loaded.\n\nThere are also opportunities to use this outside of static hosting, to take the pressure off the server when generating and caching routes.\n\nThe primary benefit of pre-rendering is that you get the core content of each page _with_ the HTML payload—regardless of whether or not your JavaScript bundle successfully downloads. It also increases the likelihood that each route of your application will be picked up by search engines.\n\nYou can read more about [zero-configuration pre-rendering (also called snapshotting) here](https://medium.com/superhighfives/an-almost-static-stack-6df0a2791319).\n\n## Injecting Data from the Server into the Page\n\nSimilarly to the previous section, you can leave some placeholders in the HTML that inject global variables, for example:\n\n```js\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <script>\n      window.SERVER_DATA = __SERVER_DATA__;\n    </script>\n```\n\nThen, on the server, you can replace `__SERVER_DATA__` with a JSON of real data right before sending the response. The client code can then read `window.SERVER_DATA` to use it. **Make sure to [sanitize the JSON before sending it to the client](https://medium.com/node-security/the-most-common-xss-vulnerability-in-react-js-applications-2bdffbcc1fa0) as it makes your app vulnerable to XSS attacks.**\n\n## Running Tests\n\n>Note: this feature is available with `react-scripts@0.3.0` and higher.<br>\n>[Read the migration guide to learn how to enable it in older projects!](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#migrating-from-023-to-030)\n\nCreate React App uses [Jest](https://facebook.github.io/jest/) as its test runner. To prepare for this integration, we did a [major revamp](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html) of Jest so if you heard bad things about it years ago, give it another try.\n\nJest is a Node-based runner. This means that the tests always run in a Node environment and not in a real browser. This lets us enable fast iteration speed and prevent flakiness.\n\nWhile Jest provides browser globals such as `window` thanks to [jsdom](https://github.com/tmpvar/jsdom), they are only approximations of the real browser behavior. Jest is intended to be used for unit tests of your logic and your components rather than the DOM quirks.\n\nWe recommend that you use a separate tool for browser end-to-end tests if you need them. They are beyond the scope of Create React App.\n\n### Filename Conventions\n\nJest will look for test files with any of the following popular naming conventions:\n\n* Files with `.js` suffix in `__tests__` folders.\n* Files with `.test.js` suffix.\n* Files with `.spec.js` suffix.\n\nThe `.test.js` / `.spec.js` files (or the `__tests__` folders) can be located at any depth under the `src` top level folder.\n\nWe recommend to put the test files (or `__tests__` folders) next to the code they are testing so that relative imports appear shorter. For example, if `App.test.js` and `App.js` are in the same folder, the test just needs to `import App from './App'` instead of a long relative path. Colocation also helps find tests more quickly in larger projects.\n\n### Command Line Interface\n\nWhen you run `npm test`, Jest will launch in the watch mode. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code.\n\nThe watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run:\n\n![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif)\n\n### Version Control Integration\n\nBy default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests run fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests.\n\nJest will always explicitly mention that it only ran tests related to the files changed since the last commit. You can also press `a` in the watch mode to force Jest to run all tests.\n\nJest will always run all tests on a [continuous integration](#continuous-integration) server or if the project is not inside a Git or Mercurial repository.\n\n### Writing Tests\n\nTo create tests, add `it()` (or `test()`) blocks with the name of the test and its code. You may optionally wrap them in `describe()` blocks for logical grouping but this is neither required nor recommended.\n\nJest provides a built-in `expect()` global function for making assertions. A basic test could look like this:\n\n```js\nimport sum from './sum';\n\nit('sums numbers', () => {\n  expect(sum(1, 2)).toEqual(3);\n  expect(sum(2, 2)).toEqual(4);\n});\n```\n\nAll `expect()` matchers supported by Jest are [extensively documented here](https://facebook.github.io/jest/docs/en/expect.html#content).<br>\nYou can also use [`jest.fn()` and `expect(fn).toBeCalled()`](https://facebook.github.io/jest/docs/en/expect.html#tohavebeencalled) to create “spies” or mock functions.\n\n### Testing Components\n\nThere is a broad spectrum of component testing techniques. They range from a “smoke test” verifying that a component renders without throwing, to shallow rendering and testing some of the output, to full rendering and testing component lifecycle and state changes.\n\nDifferent projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating simple smoke tests for your components:\n\n```js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\n\nit('renders without crashing', () => {\n  const div = document.createElement('div');\n  ReactDOM.render(<App />, div);\n});\n```\n\nThis test mounts a component and makes sure that it didn’t throw during rendering. Tests like this provide a lot of value with very little effort so they are great as a starting point, and this is the test you will find in `src/App.test.js`.\n\nWhen you encounter bugs caused by changing components, you will gain a deeper insight into which parts of them are worth testing in your application. This might be a good time to introduce more specific tests asserting specific expected output or behavior.\n\nIf you’d like to test components in isolation from the child components they render, we recommend using [`shallow()` rendering API](http://airbnb.io/enzyme/docs/api/shallow.html) from [Enzyme](http://airbnb.io/enzyme/). To install it, run:\n\n```sh\nnpm install --save enzyme enzyme-adapter-react-16 react-test-renderer\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add enzyme enzyme-adapter-react-16 react-test-renderer\n```\n\nAs of Enzyme 3, you will need to install Enzyme along with an Adapter corresponding to the version of React you are using. (The examples above use the adapter for React 16.)\n\nThe adapter will also need to be configured in your [global setup file](#initializing-test-environment):\n\n#### `src/setupTests.js`\n```js\nimport { configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nconfigure({ adapter: new Adapter() });\n```\n\n>Note: Keep in mind that if you decide to \"eject\" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it. [Read here](#initializing-test-environment) to learn how to add this after ejecting.\n\nNow you can write a smoke test with it:\n\n```js\nimport React from 'react';\nimport { shallow } from 'enzyme';\nimport App from './App';\n\nit('renders without crashing', () => {\n  shallow(<App />);\n});\n```\n\nUnlike the previous smoke test using `ReactDOM.render()`, this test only renders `<App>` and doesn’t go deeper. For example, even if `<App>` itself renders a `<Button>` that throws, this test will pass. Shallow rendering is great for isolated unit tests, but you may still want to create some full rendering tests to ensure the components integrate correctly. Enzyme supports [full rendering with `mount()`](http://airbnb.io/enzyme/docs/api/mount.html), and you can also use it for testing state changes and component lifecycle.\n\nYou can read the [Enzyme documentation](http://airbnb.io/enzyme/) for more testing techniques. Enzyme documentation uses Chai and Sinon for assertions but you don’t have to use them because Jest provides built-in `expect()` and `jest.fn()` for spies.\n\nHere is an example from Enzyme documentation that asserts specific output, rewritten to use Jest matchers:\n\n```js\nimport React from 'react';\nimport { shallow } from 'enzyme';\nimport App from './App';\n\nit('renders welcome message', () => {\n  const wrapper = shallow(<App />);\n  const welcome = <h2>Welcome to React</h2>;\n  // expect(wrapper.contains(welcome)).to.equal(true);\n  expect(wrapper.contains(welcome)).toEqual(true);\n});\n```\n\nAll Jest matchers are [extensively documented here](http://facebook.github.io/jest/docs/en/expect.html).<br>\nNevertheless you can use a third-party assertion library like [Chai](http://chaijs.com/) if you want to, as described below.\n\nAdditionally, you might find [jest-enzyme](https://github.com/blainekasten/enzyme-matchers) helpful to simplify your tests with readable matchers. The above `contains` code can be written more simply with jest-enzyme.\n\n```js\nexpect(wrapper).toContainReact(welcome)\n```\n\nTo enable this, install `jest-enzyme`:\n\n```sh\nnpm install --save jest-enzyme\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add jest-enzyme\n```\n\nImport it in [`src/setupTests.js`](#initializing-test-environment) to make its matchers available in every test:\n\n```js\nimport 'jest-enzyme';\n```\n\n### Using Third Party Assertion Libraries\n\nWe recommend that you use `expect()` for assertions and `jest.fn()` for spies. If you are having issues with them please [file those against Jest](https://github.com/facebook/jest/issues/new), and we’ll fix them. We intend to keep making them better for React, supporting, for example, [pretty-printing React elements as JSX](https://github.com/facebook/jest/pull/1566).\n\nHowever, if you are used to other libraries, such as [Chai](http://chaijs.com/) and [Sinon](http://sinonjs.org/), or if you have existing code using them that you’d like to port over, you can import them normally like this:\n\n```js\nimport sinon from 'sinon';\nimport { expect } from 'chai';\n```\n\nand then use them in your tests like you normally do.\n\n### Initializing Test Environment\n\n>Note: this feature is available with `react-scripts@0.4.0` and higher.\n\nIf your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests, add a `src/setupTests.js` to your project. It will be automatically executed before running your tests.\n\nFor example:\n\n#### `src/setupTests.js`\n```js\nconst localStorageMock = {\n  getItem: jest.fn(),\n  setItem: jest.fn(),\n  clear: jest.fn()\n};\nglobal.localStorage = localStorageMock\n```\n\n>Note: Keep in mind that if you decide to \"eject\" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it, so you should manually create the property `setupTestFrameworkScriptFile` in the configuration for Jest, something like the following:\n\n>```js\n>\"jest\": {\n>   // ...\n>   \"setupTestFrameworkScriptFile\": \"<rootDir>/src/setupTests.js\"\n>  }\n>  ```\n\n### Focusing and Excluding Tests\n\nYou can replace `it()` with `xit()` to temporarily exclude a test from being executed.<br>\nSimilarly, `fit()` lets you focus on a specific test without running any other tests.\n\n### Coverage Reporting\n\nJest has an integrated coverage reporter that works well with ES6 and requires no configuration.<br>\nRun `npm test -- --coverage` (note extra `--` in the middle) to include a coverage report like this:\n\n![coverage report](http://i.imgur.com/5bFhnTS.png)\n\nNote that tests run much slower with coverage so it is recommended to run it separately from your normal workflow.\n\n#### Configuration\n\nThe default Jest coverage configuration can be overridden by adding any of the following supported keys to a Jest config in your package.json.\n\nSupported overrides:\n - [`collectCoverageFrom`](https://facebook.github.io/jest/docs/en/configuration.html#collectcoveragefrom-array)\n - [`coverageReporters`](https://facebook.github.io/jest/docs/en/configuration.html#coveragereporters-array-string)\n - [`coverageThreshold`](https://facebook.github.io/jest/docs/en/configuration.html#coveragethreshold-object)\n - [`snapshotSerializers`](https://facebook.github.io/jest/docs/en/configuration.html#snapshotserializers-array-string)\n\nExample package.json:\n\n```json\n{\n  \"name\": \"your-package\",\n  \"jest\": {\n    \"collectCoverageFrom\" : [\n      \"src/**/*.{js,jsx}\",\n      \"!<rootDir>/node_modules/\",\n      \"!<rootDir>/path/to/dir/\"\n    ],\n    \"coverageThreshold\": {\n      \"global\": {\n        \"branches\": 90,\n        \"functions\": 90,\n        \"lines\": 90,\n        \"statements\": 90\n      }\n    },\n    \"coverageReporters\": [\"text\"],\n    \"snapshotSerializers\": [\"my-serializer-module\"]\n  }\n}\n```\n\n### Continuous Integration\n\nBy default `npm test` runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called `CI`.\n\nWhen creating a build of your application with `npm run build` linter warnings are not checked by default. Like `npm test`, you can force the build to perform a linter warning check by setting the environment variable `CI`. If any warnings are encountered then the build fails.\n\nPopular CI servers already set the environment variable `CI` by default but you can do this yourself too:\n\n### On CI servers\n#### Travis CI\n\n1. Following the [Travis Getting started](https://docs.travis-ci.com/user/getting-started/) guide for syncing your GitHub repository with Travis.  You may need to initialize some settings manually in your [profile](https://travis-ci.org/profile) page.\n1. Add a `.travis.yml` file to your git repository.\n```\nlanguage: node_js\nnode_js:\n  - 6\ncache:\n  directories:\n    - node_modules\nscript:\n  - npm run build\n  - npm test\n```\n1. Trigger your first build with a git push.\n1. [Customize your Travis CI Build](https://docs.travis-ci.com/user/customizing-the-build/) if needed.\n\n#### CircleCI\n\nFollow [this article](https://medium.com/@knowbody/circleci-and-zeits-now-sh-c9b7eebcd3c1) to set up CircleCI with a Create React App project.\n\n### On your own environment\n##### Windows (cmd.exe)\n\n```cmd\nset CI=true&&npm test\n```\n\n```cmd\nset CI=true&&npm run build\n```\n\n(Note: the lack of whitespace is intentional.)\n\n##### Windows (Powershell)\n\n```Powershell\n($env:CI = $true) -and (npm test)\n```\n\n```Powershell\n($env:CI = $true) -and (npm run build)\n```\n\n##### Linux, macOS (Bash)\n\n```bash\nCI=true npm test\n```\n\n```bash\nCI=true npm run build\n```\n\nThe test command will force Jest to run tests once instead of launching the watcher.\n\n>  If you find yourself doing this often in development, please [file an issue](https://github.com/facebookincubator/create-react-app/issues/new) to tell us about your use case because we want to make watcher the best experience and are open to changing how it works to accommodate more workflows.\n\nThe build command will check for linter warnings and fail if any are found.\n\n### Disabling jsdom\n\nBy default, the `package.json` of the generated project looks like this:\n\n```js\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n    \"test\": \"react-scripts test --env=jsdom\"\n```\n\nIf you know that none of your tests depend on [jsdom](https://github.com/tmpvar/jsdom), you can safely remove `--env=jsdom`, and your tests will run faster:\n\n```diff\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n-   \"test\": \"react-scripts test --env=jsdom\"\n+   \"test\": \"react-scripts test\"\n```\n\nTo help you make up your mind, here is a list of APIs that **need jsdom**:\n\n* Any browser globals like `window` and `document`\n* [`ReactDOM.render()`](https://facebook.github.io/react/docs/top-level-api.html#reactdom.render)\n* [`TestUtils.renderIntoDocument()`](https://facebook.github.io/react/docs/test-utils.html#renderintodocument) ([a shortcut](https://github.com/facebook/react/blob/34761cf9a252964abfaab6faf74d473ad95d1f21/src/test/ReactTestUtils.js#L83-L91) for the above)\n* [`mount()`](http://airbnb.io/enzyme/docs/api/mount.html) in [Enzyme](http://airbnb.io/enzyme/index.html)\n\nIn contrast, **jsdom is not needed** for the following APIs:\n\n* [`TestUtils.createRenderer()`](https://facebook.github.io/react/docs/test-utils.html#shallow-rendering) (shallow rendering)\n* [`shallow()`](http://airbnb.io/enzyme/docs/api/shallow.html) in [Enzyme](http://airbnb.io/enzyme/index.html)\n\nFinally, jsdom is also not needed for [snapshot testing](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html).\n\n### Snapshot Testing\n\nSnapshot testing is a feature of Jest that automatically generates text snapshots of your components and saves them on the disk so if the UI output changes, you get notified without manually writing any assertions on the component output. [Read more about snapshot testing.](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html)\n\n### Editor Integration\n\nIf you use [Visual Studio Code](https://code.visualstudio.com), there is a [Jest extension](https://github.com/orta/vscode-jest) which works with Create React App out of the box. This provides a lot of IDE-like features while using a text editor: showing the status of a test run with potential fail messages inline, starting and stopping the watcher automatically, and offering one-click snapshot updates.\n\n![VS Code Jest Preview](https://cloud.githubusercontent.com/assets/49038/20795349/a032308a-b7c8-11e6-9b34-7eeac781003f.png)\n\n## Debugging Tests\n\nThere are various ways to setup a debugger for your Jest tests. We cover debugging in Chrome and [Visual Studio Code](https://code.visualstudio.com/).\n\n>Note: debugging tests requires Node 8 or higher.\n\n### Debugging Tests in Chrome\n\nAdd the following to the `scripts` section in your project's `package.json`\n```json\n\"scripts\": {\n    \"test:debug\": \"react-scripts --inspect-brk test --runInBand --env=jsdom\"\n  }\n```\nPlace `debugger;` statements in any test and run:\n```bash\n$ npm run test:debug\n```\n\nThis will start running your Jest tests, but pause before executing to allow a debugger to attach to the process.\n\nOpen the following in Chrome\n```\nabout:inspect\n```\n\nAfter opening that link, the Chrome Developer Tools will be displayed. Select `inspect` on your process and a breakpoint will be set at the first line of the react script (this is done simply to give you time to open the developer tools and to prevent Jest from executing before you have time to do so). Click the button that looks like a \"play\" button in the upper right hand side of the screen to continue execution. When Jest executes the test that contains the debugger statement, execution will pause and you can examine the current scope and call stack.\n\n>Note: the --runInBand cli option makes sure Jest runs test in the same process rather than spawning processes for individual tests. Normally Jest parallelizes test runs across processes but it is hard to debug many processes at the same time.\n\n### Debugging Tests in Visual Studio Code\n\nDebugging Jest tests is supported out of the box for [Visual Studio Code](https://code.visualstudio.com).\n\nUse the following [`launch.json`](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) configuration file:\n```\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug CRA Tests\",\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"runtimeExecutable\": \"${workspaceRoot}/node_modules/.bin/react-scripts\",\n      \"args\": [\n        \"test\",\n        \"--runInBand\",\n        \"--no-cache\",\n        \"--env=jsdom\"\n      ],\n      \"cwd\": \"${workspaceRoot}\",\n      \"protocol\": \"inspector\",\n      \"console\": \"integratedTerminal\",\n      \"internalConsoleOptions\": \"neverOpen\"\n    }\n  ]\n}\n```\n\n## Developing Components in Isolation\n\nUsually, in an app, you have a lot of UI components, and each of them has many different states.\nFor an example, a simple button component could have following states:\n\n* In a regular state, with a text label.\n* In the disabled mode.\n* In a loading state.\n\nUsually, it’s hard to see these states without running a sample app or some examples.\n\nCreate React App doesn’t include any tools for this by default, but you can easily add [Storybook for React](https://storybook.js.org) ([source](https://github.com/storybooks/storybook)) or [React Styleguidist](https://react-styleguidist.js.org/) ([source](https://github.com/styleguidist/react-styleguidist)) to your project. **These are third-party tools that let you develop components and see all their states in isolation from your app**.\n\n![Storybook for React Demo](http://i.imgur.com/7CIAWpB.gif)\n\nYou can also deploy your Storybook or style guide as a static app. This way, everyone in your team can view and review different states of UI components without starting a backend server or creating an account in your app.\n\n### Getting Started with Storybook\n\nStorybook is a development environment for React UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.\n\nFirst, install the following npm package globally:\n\n```sh\nnpm install -g @storybook/cli\n```\n\nThen, run the following command inside your app’s directory:\n\n```sh\ngetstorybook\n```\n\nAfter that, follow the instructions on the screen.\n\nLearn more about React Storybook:\n\n* Screencast: [Getting Started with React Storybook](https://egghead.io/lessons/react-getting-started-with-react-storybook)\n* [GitHub Repo](https://github.com/storybooks/storybook)\n* [Documentation](https://storybook.js.org/basics/introduction/)\n* [Snapshot Testing UI](https://github.com/storybooks/storybook/tree/master/addons/storyshots) with Storybook + addon/storyshot\n\n### Getting Started with Styleguidist\n\nStyleguidist combines a style guide, where all your components are presented on a single page with their props documentation and usage examples, with an environment for developing components in isolation, similar to Storybook. In Styleguidist you write examples in Markdown, where each code snippet is rendered as a live editable playground.\n\nFirst, install Styleguidist:\n\n```sh\nnpm install --save react-styleguidist\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-styleguidist\n```\n\nThen, add these scripts to your `package.json`:\n\n```diff\n   \"scripts\": {\n+    \"styleguide\": \"styleguidist server\",\n+    \"styleguide:build\": \"styleguidist build\",\n     \"start\": \"react-scripts start\",\n```\n\nThen, run the following command inside your app’s directory:\n\n```sh\nnpm run styleguide\n```\n\nAfter that, follow the instructions on the screen.\n\nLearn more about React Styleguidist:\n\n* [GitHub Repo](https://github.com/styleguidist/react-styleguidist)\n* [Documentation](https://react-styleguidist.js.org/docs/getting-started.html)\n\n## Publishing Components to npm\n\nCreate React App doesn't provide any built-in functionality to publish a component to npm. If you're ready to extract a component from your project so other people can use it, we recommend moving it to a separate directory outside of your project and then using a tool like [nwb](https://github.com/insin/nwb#react-components-and-libraries) to prepare it for publishing.\n\n## Making a Progressive Web App\n\nBy default, the production build is a fully functional, offline-first\n[Progressive Web App](https://developers.google.com/web/progressive-web-apps/).\n\nProgressive Web Apps are faster and more reliable than traditional web pages, and provide an engaging mobile experience:\n\n * All static site assets are cached so that your page loads fast on subsequent visits, regardless of network connectivity (such as 2G or 3G). Updates are downloaded in the background.\n * Your app will work regardless of network state, even if offline. This means your users will be able to use your app at 10,000 feet and on the subway.\n * On mobile devices, your app can be added directly to the user's home screen, app icon and all. You can also re-engage users using web **push notifications**. This eliminates the need for the app store.\n\nThe [`sw-precache-webpack-plugin`](https://github.com/goldhand/sw-precache-webpack-plugin)\nis integrated into production configuration,\nand it will take care of generating a service worker file that will automatically\nprecache all of your local assets and keep them up to date as you deploy updates.\nThe service worker will use a [cache-first strategy](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network)\nfor handling all requests for local assets, including the initial HTML, ensuring\nthat your web app is reliably fast, even on a slow or unreliable network.\n\n### Opting Out of Caching\n\nIf you would prefer not to enable service workers prior to your initial\nproduction deployment, then remove the call to `registerServiceWorker()`\nfrom [`src/index.js`](src/index.js).\n\nIf you had previously enabled service workers in your production deployment and\nhave decided that you would like to disable them for all your existing users,\nyou can swap out the call to `registerServiceWorker()` in\n[`src/index.js`](src/index.js) first by modifying the service worker import:\n```javascript\nimport { unregister } from './registerServiceWorker';\n```\nand then call `unregister()` instead.\nAfter the user visits a page that has `unregister()`,\nthe service worker will be uninstalled. Note that depending on how `/service-worker.js` is served,\nit may take up to 24 hours for the cache to be invalidated.\n\n### Offline-First Considerations\n\n1. Service workers [require HTTPS](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers#you_need_https),\nalthough to facilitate local testing, that policy\n[does not apply to `localhost`](http://stackoverflow.com/questions/34160509/options-for-testing-service-workers-via-http/34161385#34161385).\nIf your production web server does not support HTTPS, then the service worker\nregistration will fail, but the rest of your web app will remain functional.\n\n1. Service workers are [not currently supported](https://jakearchibald.github.io/isserviceworkerready/)\nin all web browsers. Service worker registration [won't be attempted](src/registerServiceWorker.js)\non browsers that lack support.\n\n1. The service worker is only enabled in the [production environment](#deployment),\ne.g. the output of `npm run build`. It's recommended that you do not enable an\noffline-first service worker in a development environment, as it can lead to\nfrustration when previously cached assets are used and do not include the latest\nchanges you've made locally.\n\n1. If you *need* to test your offline-first service worker locally, build\nthe application (using `npm run build`) and run a simple http server from your\nbuild directory. After running the build script, `create-react-app` will give\ninstructions for one way to test your production build locally and the [deployment instructions](#deployment) have\ninstructions for using other methods. *Be sure to always use an\nincognito window to avoid complications with your browser cache.*\n\n1. If possible, configure your production environment to serve the generated\n`service-worker.js` [with HTTP caching disabled](http://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours).\nIf that's not possible—[GitHub Pages](#github-pages), for instance, does not\nallow you to change the default 10 minute HTTP cache lifetime—then be aware\nthat if you visit your production site, and then revisit again before\n`service-worker.js` has expired from your HTTP cache, you'll continue to get\nthe previously cached assets from the service worker. If you have an immediate\nneed to view your updated production deployment, performing a shift-refresh\nwill temporarily disable the service worker and retrieve all assets from the\nnetwork.\n\n1. Users aren't always familiar with offline-first web apps. It can be useful to\n[let the user know](https://developers.google.com/web/fundamentals/instant-and-offline/offline-ux#inform_the_user_when_the_app_is_ready_for_offline_consumption)\nwhen the service worker has finished populating your caches (showing a \"This web\napp works offline!\" message) and also let them know when the service worker has\nfetched the latest updates that will be available the next time they load the\npage (showing a \"New content is available; please refresh.\" message). Showing\nthis messages is currently left as an exercise to the developer, but as a\nstarting point, you can make use of the logic included in [`src/registerServiceWorker.js`](src/registerServiceWorker.js), which\ndemonstrates which service worker lifecycle events to listen for to detect each\nscenario, and which as a default, just logs appropriate messages to the\nJavaScript console.\n\n1. By default, the generated service worker file will not intercept or cache any\ncross-origin traffic, like HTTP [API requests](#integrating-with-an-api-backend),\nimages, or embeds loaded from a different domain. If you would like to use a\nruntime caching strategy for those requests, you can [`eject`](#npm-run-eject)\nand then configure the\n[`runtimeCaching`](https://github.com/GoogleChrome/sw-precache#runtimecaching-arrayobject)\noption in the `SWPrecacheWebpackPlugin` section of\n[`webpack.config.prod.js`](../config/webpack.config.prod.js).\n\n### Progressive Web App Metadata\n\nThe default configuration includes a web app manifest located at\n[`public/manifest.json`](public/manifest.json), that you can customize with\ndetails specific to your web application.\n\nWhen a user adds a web app to their homescreen using Chrome or Firefox on\nAndroid, the metadata in [`manifest.json`](public/manifest.json) determines what\nicons, names, and branding colors to use when the web app is displayed.\n[The Web App Manifest guide](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/)\nprovides more context about what each field means, and how your customizations\nwill affect your users' experience.\n\n## Analyzing the Bundle Size\n\n[Source map explorer](https://www.npmjs.com/package/source-map-explorer) analyzes\nJavaScript bundles using the source maps. This helps you understand where code\nbloat is coming from.\n\nTo add Source map explorer to a Create React App project, follow these steps:\n\n```sh\nnpm install --save source-map-explorer\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add source-map-explorer\n```\n\nThen in `package.json`, add the following line to `scripts`:\n\n```diff\n   \"scripts\": {\n+    \"analyze\": \"source-map-explorer build/static/js/main.*\",\n     \"start\": \"react-scripts start\",\n     \"build\": \"react-scripts build\",\n     \"test\": \"react-scripts test --env=jsdom\",\n```\n\nThen to analyze the bundle run the production build then run the analyze\nscript.\n\n```\nnpm run build\nnpm run analyze\n```\n\n## Deployment\n\n`npm run build` creates a `build` directory with a production build of your app. Set up your favorite HTTP server so that a visitor to your site is served `index.html`, and requests to static paths like `/static/js/main.<hash>.js` are served with the contents of the `/static/js/main.<hash>.js` file.\n\n### Static Server\n\nFor environments using [Node](https://nodejs.org/), the easiest way to handle this would be to install [serve](https://github.com/zeit/serve) and let it handle the rest:\n\n```sh\nnpm install -g serve\nserve -s build\n```\n\nThe last command shown above will serve your static site on the port **5000**. Like many of [serve](https://github.com/zeit/serve)’s internal settings, the port can be adjusted using the `-p` or `--port` flags.\n\nRun this command to get a full list of the options available:\n\n```sh\nserve -h\n```\n\n### Other Solutions\n\nYou don’t necessarily need a static server in order to run a Create React App project in production. It works just as fine integrated into an existing dynamic one.\n\nHere’s a programmatic example using [Node](https://nodejs.org/) and [Express](http://expressjs.com/):\n\n```javascript\nconst express = require('express');\nconst path = require('path');\nconst app = express();\n\napp.use(express.static(path.join(__dirname, 'build')));\n\napp.get('/', function (req, res) {\n  res.sendFile(path.join(__dirname, 'build', 'index.html'));\n});\n\napp.listen(9000);\n```\n\nThe choice of your server software isn’t important either. Since Create React App is completely platform-agnostic, there’s no need to explicitly use Node.\n\nThe `build` folder with static assets is the only output produced by Create React App.\n\nHowever this is not quite enough if you use client-side routing. Read the next section if you want to support URLs like `/todos/42` in your single-page app.\n\n### Serving Apps with Client-Side Routing\n\nIf you use routers that use the HTML5 [`pushState` history API](https://developer.mozilla.org/en-US/docs/Web/API/History_API#Adding_and_modifying_history_entries) under the hood (for example, [React Router](https://github.com/ReactTraining/react-router) with `browserHistory`), many static file servers will fail. For example, if you used React Router with a route for `/todos/42`, the development server will respond to `localhost:3000/todos/42` properly, but an Express serving a production build as above will not.\n\nThis is because when there is a fresh page load for a `/todos/42`, the server looks for the file `build/todos/42` and does not find it. The server needs to be configured to respond to a request to `/todos/42` by serving `index.html`. For example, we can amend our Express example above to serve `index.html` for any unknown paths:\n\n```diff\n app.use(express.static(path.join(__dirname, 'build')));\n\n-app.get('/', function (req, res) {\n+app.get('/*', function (req, res) {\n   res.sendFile(path.join(__dirname, 'build', 'index.html'));\n });\n```\n\nIf you’re using [Apache HTTP Server](https://httpd.apache.org/), you need to create a `.htaccess` file in the `public` folder that looks like this:\n\n```\n    Options -MultiViews\n    RewriteEngine On\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteRule ^ index.html [QSA,L]\n```\n\nIt will get copied to the `build` folder when you run `npm run build`.\n\nIf you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow [this Stack Overflow answer](https://stackoverflow.com/a/41249464/4878474).\n\nNow requests to `/todos/42` will be handled correctly both in development and in production.\n\nOn a production build, and in a browser that supports [service workers](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers),\nthe service worker will automatically handle all navigation requests, like for\n`/todos/42`, by serving the cached copy of your `index.html`. This\nservice worker navigation routing can be configured or disabled by\n[`eject`ing](#npm-run-eject) and then modifying the\n[`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string)\nand [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp)\noptions of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js).\n\nWhen users install your app to the homescreen of their device the default configuration will make a shortcut to `/index.html`. This may not work for client-side routers which expect the app to be served from `/`. Edit the web app manifest at [`public/manifest.json`](public/manifest.json) and change `start_url` to match the required URL scheme, for example:\n\n```js\n  \"start_url\": \".\",\n```\n\n### Building for Relative Paths\n\nBy default, Create React App produces a build assuming your app is hosted at the server root.<br>\nTo override this, specify the `homepage` in your `package.json`, for example:\n\n```js\n  \"homepage\": \"http://mywebsite.com/relativepath\",\n```\n\nThis will let Create React App correctly infer the root path to use in the generated HTML file.\n\n**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.<br>\nMore information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>\n<br>\nFor example:\n```js\n<BrowserRouter basename=\"/calendar\"/>\n<Link to=\"/today\"/> // renders <a href=\"/calendar/today\">\n```\n\n#### Serving the Same Build from Different Paths\n\n>Note: this feature is available with `react-scripts@0.9.0` and higher.\n\nIf you are not using the HTML5 `pushState` history API or not using client-side routing at all, it is unnecessary to specify the URL from which your app will be served. Instead, you can put this in your `package.json`:\n\n```js\n  \"homepage\": \".\",\n```\n\nThis will make sure that all the asset paths are relative to `index.html`. You will then be able to move your app from `http://mywebsite.com` to `http://mywebsite.com/relativepath` or even `http://mywebsite.com/relative/path` without having to rebuild it.\n\n### [Azure](https://azure.microsoft.com/)\n\nSee [this](https://medium.com/@to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321) blog post on how to deploy your React app to Microsoft Azure.\n\nSee [this](https://medium.com/@strid/host-create-react-app-on-azure-986bc40d5bf2#.pycfnafbg) blog post or [this](https://github.com/ulrikaugustsson/azure-appservice-static) repo for a way to use automatic deployment to Azure App Service.\n\n### [Firebase](https://firebase.google.com/)\n\nInstall the Firebase CLI if you haven’t already by running `npm install -g firebase-tools`. Sign up for a [Firebase account](https://console.firebase.google.com/) and create a new project. Run `firebase login` and login with your previous created Firebase account.\n\nThen run the `firebase init` command from your project’s root. You need to choose the **Hosting: Configure and deploy Firebase Hosting sites** and choose the Firebase project you created in the previous step. You will need to agree with `database.rules.json` being created, choose `build` as the public directory, and also agree to **Configure as a single-page app** by replying with `y`.\n\n```sh\n    === Project Setup\n\n    First, let's associate this project directory with a Firebase project.\n    You can create multiple project aliases by running firebase use --add,\n    but for now we'll just set up a default project.\n\n    ? What Firebase project do you want to associate as default? Example app (example-app-fd690)\n\n    === Database Setup\n\n    Firebase Realtime Database Rules allow you to define how your data should be\n    structured and when your data can be read from and written to.\n\n    ? What file should be used for Database Rules? database.rules.json\n    ✔  Database Rules for example-app-fd690 have been downloaded to database.rules.json.\n    Future modifications to database.rules.json will update Database Rules when you run\n    firebase deploy.\n\n    === Hosting Setup\n\n    Your public directory is the folder (relative to your project directory) that\n    will contain Hosting assets to uploaded with firebase deploy. If you\n    have a build process for your assets, use your build's output directory.\n\n    ? What do you want to use as your public directory? build\n    ? Configure as a single-page app (rewrite all urls to /index.html)? Yes\n    ✔  Wrote build/index.html\n\n    i  Writing configuration info to firebase.json...\n    i  Writing project information to .firebaserc...\n\n    ✔  Firebase initialization complete!\n```\n\nIMPORTANT: you need to set proper HTTP caching headers for `service-worker.js` file in `firebase.json` file or you will not be able to see changes after first deployment ([issue #2440](https://github.com/facebookincubator/create-react-app/issues/2440)). It should be added inside `\"hosting\"` key like next:\n\n```\n{\n  \"hosting\": {\n    ...\n    \"headers\": [\n      {\"source\": \"/service-worker.js\", \"headers\": [{\"key\": \"Cache-Control\", \"value\": \"no-cache\"}]}\n    ]\n    ...\n```\n\nNow, after you create a production build with `npm run build`, you can deploy it by running `firebase deploy`.\n\n```sh\n    === Deploying to 'example-app-fd690'...\n\n    i  deploying database, hosting\n    ✔  database: rules ready to deploy.\n    i  hosting: preparing build directory for upload...\n    Uploading: [==============================          ] 75%✔  hosting: build folder uploaded successfully\n    ✔  hosting: 8 files uploaded successfully\n    i  starting release process (may take several minutes)...\n\n    ✔  Deploy complete!\n\n    Project Console: https://console.firebase.google.com/project/example-app-fd690/overview\n    Hosting URL: https://example-app-fd690.firebaseapp.com\n```\n\nFor more information see [Add Firebase to your JavaScript Project](https://firebase.google.com/docs/web/setup).\n\n### [GitHub Pages](https://pages.github.com/)\n\n>Note: this feature is available with `react-scripts@0.2.0` and higher.\n\n#### Step 1: Add `homepage` to `package.json`\n\n**The step below is important!**<br>\n**If you skip it, your app will not deploy correctly.**\n\nOpen your `package.json` and add a `homepage` field for your project:\n\n```json\n  \"homepage\": \"https://myusername.github.io/my-app\",\n```\n\nor for a GitHub user page:\n\n```json\n  \"homepage\": \"https://myusername.github.io\",\n```\n\nCreate React App uses the `homepage` field to determine the root URL in the built HTML file.\n\n#### Step 2: Install `gh-pages` and add `deploy` to `scripts` in `package.json`\n\nNow, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub Pages.\n\nTo publish it at [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run:\n\n```sh\nnpm install --save gh-pages\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add gh-pages\n```\n\nAdd the following scripts in your `package.json`:\n\n```diff\n  \"scripts\": {\n+   \"predeploy\": \"npm run build\",\n+   \"deploy\": \"gh-pages -d build\",\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n```\n\nThe `predeploy` script will run automatically before `deploy` is run.\n\nIf you are deploying to a GitHub user page instead of a project page you'll need to make two\nadditional modifications:\n\n1. First, change your repository's source branch to be any branch other than **master**.\n1. Additionally, tweak your `package.json` scripts to push deployments to **master**:\n```diff\n  \"scripts\": {\n    \"predeploy\": \"npm run build\",\n-   \"deploy\": \"gh-pages -d build\",\n+   \"deploy\": \"gh-pages -b master -d build\",\n```\n\n#### Step 3: Deploy the site by running `npm run deploy`\n\nThen run:\n\n```sh\nnpm run deploy\n```\n\n#### Step 4: Ensure your project’s settings use `gh-pages`\n\nFinally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:\n\n<img src=\"http://i.imgur.com/HUjEr9l.png\" width=\"500\" alt=\"gh-pages branch setting\">\n\n#### Step 5: Optionally, configure the domain\n\nYou can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder.\n\n#### Notes on client-side routing\n\nGitHub Pages doesn’t support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions:\n\n* You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://reacttraining.com/react-router/web/api/Router) about different history implementations in React Router.\n* Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).\n\n#### Troubleshooting\n\n##### \"/dev/tty: No such a device or address\"\n\nIf, when deploying, you get `/dev/tty: No such a device or address` or a similar error, try the following:\n\n1. Create a new [Personal Access Token](https://github.com/settings/tokens)\n2. `git remote set-url origin https://<user>:<token>@github.com/<user>/<repo>` .\n3. Try `npm run deploy again`\n\n### [Heroku](https://www.heroku.com/)\n\nUse the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).<br>\nYou can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).\n\n#### Resolving Heroku Deployment Errors\n\nSometimes `npm run build` works locally but fails during deploy via Heroku. Following are the most common cases.\n\n##### \"Module not found: Error: Cannot resolve 'file' or 'directory'\"\n\nIf you get something like this:\n\n```\nremote: Failed to create a production build. Reason:\nremote: Module not found: Error: Cannot resolve 'file' or 'directory'\nMyDirectory in /tmp/build_1234/src\n```\n\nIt means you need to ensure that the lettercase of the file or directory you `import` matches the one you see on your filesystem or on GitHub.\n\nThis is important because Linux (the operating system used by Heroku) is case sensitive. So `MyDirectory` and `mydirectory` are two distinct directories and thus, even though the project builds locally, the difference in case breaks the `import` statements on Heroku remotes.\n\n##### \"Could not find a required file.\"\n\nIf you exclude or ignore necessary files from the package you will see a error similar this one:\n\n```\nremote: Could not find a required file.\nremote:   Name: `index.html`\nremote:   Searched in: /tmp/build_a2875fc163b209225122d68916f1d4df/public\nremote:\nremote: npm ERR! Linux 3.13.0-105-generic\nremote: npm ERR! argv \"/tmp/build_a2875fc163b209225122d68916f1d4df/.heroku/node/bin/node\" \"/tmp/build_a2875fc163b209225122d68916f1d4df/.heroku/node/bin/npm\" \"run\" \"build\"\n```\n\nIn this case, ensure that the file is there with the proper lettercase and that’s not ignored on your local `.gitignore` or `~/.gitignore_global`.\n\n### [Netlify](https://www.netlify.com/)\n\n**To do a manual deploy to Netlify’s CDN:**\n\n```sh\nnpm install netlify-cli -g\nnetlify deploy\n```\n\nChoose `build` as the path to deploy.\n\n**To setup continuous delivery:**\n\nWith this setup Netlify will build and deploy when you push to git or open a pull request:\n\n1. [Start a new netlify project](https://app.netlify.com/signup)\n2. Pick your Git hosting service and select your repository\n3. Set `yarn build` as the build command and `build` as the publish directory\n4. Click `Deploy site`\n\n**Support for client-side routing:**\n\nTo support `pushState`, make sure to create a `public/_redirects` file with the following rewrite rules:\n\n```\n/*  /index.html  200\n```\n\nWhen you build the project, Create React App will place the `public` folder contents into the build output.\n\n### [Now](https://zeit.co/now)\n\nNow offers a zero-configuration single-command deployment. You can use `now` to deploy your app for free.\n\n1. Install the `now` command-line tool either via the recommended [desktop tool](https://zeit.co/download) or via node with `npm install -g now`.\n\n2. Build your app by running `npm run build`.\n\n3. Move into the build directory by running `cd build`.\n\n4. Run `now --name your-project-name` from within the build directory. You will see a **now.sh** URL in your output like this:\n\n    ```\n    > Ready! https://your-project-name-tpspyhtdtk.now.sh (copied to clipboard)\n    ```\n\n    Paste that URL into your browser when the build is complete, and you will see your deployed app.\n\nDetails are available in [this article.](https://zeit.co/blog/unlimited-static)\n\n### [S3](https://aws.amazon.com/s3) and [CloudFront](https://aws.amazon.com/cloudfront/)\n\nSee this [blog post](https://medium.com/@omgwtfmarc/deploying-create-react-app-to-s3-or-cloudfront-48dae4ce0af) on how to deploy your React app to Amazon Web Services S3 and CloudFront.\n\n### [Surge](https://surge.sh/)\n\nInstall the Surge CLI if you haven’t already by running `npm install -g surge`. Run the `surge` command and log in you or create a new account.\n\nWhen asked about the project path, make sure to specify the `build` folder, for example:\n\n```sh\n       project path: /path/to/project/build\n```\n\nNote that in order to support routers that use HTML5 `pushState` API, you may want to rename the `index.html` in your build folder to `200.html` before deploying to Surge. This [ensures that every URL falls back to that file](https://surge.sh/help/adding-a-200-page-for-client-side-routing).\n\n## Advanced Configuration\n\nYou can adjust various development and production settings by setting environment variables in your shell or with [.env](#adding-development-environment-variables-in-env).\n\nVariable | Development | Production | Usage\n:--- | :---: | :---: | :---\nBROWSER | :white_check_mark: | :x: | By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a [browser](https://github.com/sindresorhus/opn#app) to override this behavior, or set it to `none` to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to `npm start` will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the `.js` extension.\nHOST | :white_check_mark: | :x: | By default, the development web server binds to `localhost`. You may use this variable to specify a different host.\nPORT | :white_check_mark: | :x: | By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port.\nHTTPS | :white_check_mark: | :x: | When set to `true`, Create React App will run the development server in `https` mode.\nPUBLIC_URL | :x: | :white_check_mark: | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application.\nCI | :large_orange_diamond: | :white_check_mark: | When set to `true`, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default.\nREACT_EDITOR | :white_check_mark: | :x: | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebookincubator/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely.\nCHOKIDAR_USEPOLLING | :white_check_mark: | :x: | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes.\nGENERATE_SOURCEMAP | :x: | :white_check_mark: | When set to `false`, source maps are not generated for a production build. This solves OOM issues on some smaller machines.\nNODE_PATH | :white_check_mark: |  :white_check_mark: | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`.\n\n## Troubleshooting\n\n### `npm start` doesn’t detect changes\n\nWhen you save a file while `npm start` is running, the browser should refresh with the updated code.<br>\nIf this doesn’t happen, try one of the following workarounds:\n\n* If your project is in a Dropbox folder, try moving it out.\n* If the watcher doesn’t see a file called `index.js` and you’re referencing it by the folder name, you [need to restart the watcher](https://github.com/facebookincubator/create-react-app/issues/1164) due to a Webpack bug.\n* Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in [“Adjusting Your Text Editor”](https://webpack.js.org/guides/development/#adjusting-your-text-editor).\n* If your project path contains parentheses, try moving the project to a path without them. This is caused by a [Webpack watcher bug](https://github.com/webpack/watchpack/issues/42).\n* On Linux and macOS, you might need to [tweak system settings](https://github.com/webpack/docs/wiki/troubleshooting#not-enough-watchers) to allow more watchers.\n* If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an `.env` file in your project directory if it doesn’t exist, and add `CHOKIDAR_USEPOLLING=true` to it. This ensures that the next time you run `npm start`, the watcher uses the polling mode, as necessary inside a VM.\n\nIf none of these solutions help please leave a comment [in this thread](https://github.com/facebookincubator/create-react-app/issues/659).\n\n### `npm test` hangs on macOS Sierra\n\nIf you run `npm test` and the console gets stuck after printing `react-scripts test --env=jsdom` to the console there might be a problem with your [Watchman](https://facebook.github.io/watchman/) installation as described in [facebookincubator/create-react-app#713](https://github.com/facebookincubator/create-react-app/issues/713).\n\nWe recommend deleting `node_modules` in your project and running `npm install` (or `yarn` if you use it) first. If it doesn't help, you can try one of the numerous workarounds mentioned in these issues:\n\n* [facebook/jest#1767](https://github.com/facebook/jest/issues/1767)\n* [facebook/watchman#358](https://github.com/facebook/watchman/issues/358)\n* [ember-cli/ember-cli#6259](https://github.com/ember-cli/ember-cli/issues/6259)\n\nIt is reported that installing Watchman 4.7.0 or newer fixes the issue. If you use [Homebrew](http://brew.sh/), you can run these commands to update it:\n\n```\nwatchman shutdown-server\nbrew update\nbrew reinstall watchman\n```\n\nYou can find [other installation methods](https://facebook.github.io/watchman/docs/install.html#build-install) on the Watchman documentation page.\n\nIf this still doesn’t help, try running `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist`.\n\nThere are also reports that *uninstalling* Watchman fixes the issue. So if nothing else helps, remove it from your system and try again.\n\n### `npm run build` exits too early\n\nIt is reported that `npm run build` can fail on machines with limited memory and no swap space, which is common in cloud environments. Even with small projects this command can increase RAM usage in your system by hundreds of megabytes, so if you have less than 1 GB of available memory your build is likely to fail with the following message:\n\n>  The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.\n\nIf you are completely sure that you didn't terminate the process, consider [adding some swap space](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04) to the machine you’re building on, or build the project locally.\n\n### `npm run build` fails on Heroku\n\nThis may be a problem with case sensitive filenames.\nPlease refer to [this section](#resolving-heroku-deployment-errors).\n\n### Moment.js locales are missing\n\nIf you use a [Moment.js](https://momentjs.com/), you might notice that only the English locale is available by default. This is because the locale files are large, and you probably only need a subset of [all the locales provided by Moment.js](https://momentjs.com/#multiple-locale-support).\n\nTo add a specific Moment.js locale to your bundle, you need to import it explicitly.<br>\nFor example:\n\n```js\nimport moment from 'moment';\nimport 'moment/locale/fr';\n```\n\nIf import multiple locales this way, you can later switch between them by calling `moment.locale()` with the locale name:\n\n```js\nimport moment from 'moment';\nimport 'moment/locale/fr';\nimport 'moment/locale/es';\n\n// ...\n\nmoment.locale('fr');\n```\n\nThis will only work for locales that have been explicitly imported before.\n\n### `npm run build` fails to minify\n\nSome third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.\n\n<br>\nTo resolve this:\n\n1. Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.\n  * Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the `module` field in `package.json`. Note that **even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers**.\n\n2. Fork the package and publish a corrected version yourself.\n\n3. If the dependency is small enough, copy it to your `src/` folder and treat it as application code.\n\nIn the future, we might start automatically compiling incompatible third-party modules, but it is not currently supported. This approach would also slow down the production builds.\n\n## Alternatives to Ejecting\n\n[Ejecting](#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to *fork* `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebookincubator/create-react-app/issues/682).\n\n## Something Missing?\n\nIf you have ideas for more “How To” recipes that should be on this page, [let us know](https://github.com/facebookincubator/create-react-app/issues) or [contribute some!](https://github.com/facebookincubator/create-react-app/edit/master/packages/react-scripts/template/README.md)\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/package.json",
    "content": "{\n  \"name\": \"react-app\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"dependencies\": {\n    \"react\": \"^16.3.2\",\n    \"react-dom\": \"^16.3.2\",\n    \"react-loadable\": \"^5.3.1\",\n    \"react-router\": \"^4.2.0\",\n    \"react-router-dom\": \"^4.2.2\",\n    \"react-scripts\": \"1.1.4\"\n  },\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n    \"test\": \"react-scripts test --env=jsdom\",\n    \"eject\": \"react-scripts eject\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n    <meta name=\"theme-color\" content=\"#000000\">\n    <!--\n      manifest.json provides metadata used when your web app is added to the\n      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\">\n    <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n    <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n    <title>React App</title>\n  </head>\n  <body>\n    <noscript>\n      You need to enable JavaScript to run this app.\n    </noscript>\n    <div id=\"root\"></div>\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/public/manifest.json",
    "content": "{\n  \"short_name\": \"React App\",\n  \"name\": \"Create React App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    }\n  ],\n  \"start_url\": \"./index.html\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/App.css",
    "content": ".App {\n  text-align: center;\n}\n\n.App-logo {\n  animation: App-logo-spin infinite 20s linear;\n  height: 80px;\n}\n\n.App-header {\n  background-color: #222;\n  height: 150px;\n  padding: 20px;\n  color: white;\n}\n\n.App-title {\n  font-size: 1.5em;\n}\n\n.App-intro {\n  font-size: large;\n}\n\n@keyframes App-logo-spin {\n  from { transform: rotate(0deg); }\n  to { transform: rotate(360deg); }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/App.jsx",
    "content": "import createBrowserHistory from 'history/createBrowserHistory';\nimport * as React from 'react';\nimport { Redirect, Route, Router, Switch } from 'react-router';\nimport { Link } from 'react-router-dom';\nimport './App.css';\nimport { AsyncComponent } from './LazyRoute';\n\nconst history = createBrowserHistory();\n\nclass App extends React.Component {\n  render() {\n    return (\n      <Router history={history}>\n        <div className=\"App\">\n          <Link to=\"/intro\">Intro</Link>\n          <Link to=\"/main\">Main</Link>\n          <div>\n            <Switch>\n              <Redirect exact={true} from=\"/\" to=\"/intro\" />\n              <Route path=\"/intro\" component={AsyncComponent(() => import('./intro/Intro'))} />\n              <Route path=\"/main\" component={AsyncComponent(() => import('./main/Main'))} />\n            </Switch>\n          </div>\n        </div>\n      </Router>\n    );\n  }\n}\n\nexport default App;\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/LazyRoute.jsx",
    "content": "import * as React from 'react';\nimport * as Loadable from 'react-loadable';\n\nconst loading = ({ isLoading, error }) => {\n  if (isLoading) {\n    return <div>Loading...</div>;\n  } else if (error) {\n    return <div>Sorry, there was a problem loading the page.</div>;\n  } else {\n    return null;\n  }\n};\n\nexport const AsyncComponent = loader => Loadable({ loader, loading });\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/index.css",
    "content": "body {\n  margin: 0;\n  padding: 0;\n  font-family: sans-serif;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/index.js",
    "content": "import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport App from './App';\nimport './index.css';\n\nReactDOM.render(<App />, document.getElementById('root'));\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/intro/Intro.jsx",
    "content": "import * as React from 'react';\nimport { Switch } from 'react-router';\n\nexport default class Intro extends React.Component {\n  render() {\n    return (\n      <React.Fragment>\n        <p>Intro</p>\n        <Switch>\n          {/* <Route path=\"/intro/login\" component={AsyncComponent(() => import('./login/Login'))} />\n          <Route path=\"/intro/parent\" component={AsyncComponent(() => import('./parent/Parent'))} /> */}\n        </Switch>\n      </React.Fragment>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/main/Main.jsx",
    "content": "import * as React from 'react';\nimport { Route, Switch } from 'react-router';\nimport { Link } from 'react-router-dom';\nimport { AsyncComponent } from '../LazyRoute';\nimport Kid from './kid/Kid';\n\nexport default class Main extends React.Component {\n  render() {\n    return (\n      <React.Fragment>\n        <React.Fragment>\n          <Link to=\"/main/kid\">Kid</Link>\n          <Link to=\"/main/parent\">Parent</Link>\n        </React.Fragment>\n        <p>Main</p>\n        <Switch>\n          <Route path=\"/main/kid\" component={Kid} />\n          <Route path=\"/main/parent\" component={AsyncComponent(() => import('./parent/Parent'))} />\n        </Switch>\n      </React.Fragment>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/main/kid/Kid.jsx",
    "content": "import * as React from 'react';\n\nexport default class Kid extends React.Component {\n  render() {\n    return (\n      <React.Fragment>\n        <p>Kid</p>\n      </React.Fragment>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app/src/main/parent/Parent.jsx",
    "content": "import * as React from 'react';\n\nexport default class Parent extends React.Component {\n  render() {\n    return (\n      <React.Fragment>\n        <p>Parent</p>\n      </React.Fragment>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/.gitignore",
    "content": "# See https://help.github.com/ignore-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/README.md",
    "content": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).\n\nBelow you will find some information on how to perform common tasks.<br>\nYou can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).\n\n## Table of Contents\n\n- [Updating to New Releases](#updating-to-new-releases)\n- [Sending Feedback](#sending-feedback)\n- [Folder Structure](#folder-structure)\n- [Available Scripts](#available-scripts)\n  - [npm start](#npm-start)\n  - [npm test](#npm-test)\n  - [npm run build](#npm-run-build)\n  - [npm run eject](#npm-run-eject)\n- [Supported Browsers](#supported-browsers)\n- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills)\n- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor)\n- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)\n- [Debugging in the Editor](#debugging-in-the-editor)\n- [Formatting Code Automatically](#formatting-code-automatically)\n- [Changing the Page `<title>`](#changing-the-page-title)\n- [Installing a Dependency](#installing-a-dependency)\n- [Importing a Component](#importing-a-component)\n- [Code Splitting](#code-splitting)\n- [Adding a Stylesheet](#adding-a-stylesheet)\n- [Post-Processing CSS](#post-processing-css)\n- [Adding a CSS Preprocessor (Sass, Less etc.)](#adding-a-css-preprocessor-sass-less-etc)\n- [Adding Images, Fonts, and Files](#adding-images-fonts-and-files)\n- [Using the `public` Folder](#using-the-public-folder)\n  - [Changing the HTML](#changing-the-html)\n  - [Adding Assets Outside of the Module System](#adding-assets-outside-of-the-module-system)\n  - [When to Use the `public` Folder](#when-to-use-the-public-folder)\n- [Using Global Variables](#using-global-variables)\n- [Adding Bootstrap](#adding-bootstrap)\n  - [Using a Custom Theme](#using-a-custom-theme)\n- [Adding Flow](#adding-flow)\n- [Adding a Router](#adding-a-router)\n- [Adding Custom Environment Variables](#adding-custom-environment-variables)\n  - [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html)\n  - [Adding Temporary Environment Variables In Your Shell](#adding-temporary-environment-variables-in-your-shell)\n  - [Adding Development Environment Variables In `.env`](#adding-development-environment-variables-in-env)\n- [Can I Use Decorators?](#can-i-use-decorators)\n- [Fetching Data with AJAX Requests](#fetching-data-with-ajax-requests)\n- [Integrating with an API Backend](#integrating-with-an-api-backend)\n  - [Node](#node)\n  - [Ruby on Rails](#ruby-on-rails)\n- [Proxying API Requests in Development](#proxying-api-requests-in-development)\n  - [\"Invalid Host Header\" Errors After Configuring Proxy](#invalid-host-header-errors-after-configuring-proxy)\n  - [Configuring the Proxy Manually](#configuring-the-proxy-manually)\n  - [Configuring a WebSocket Proxy](#configuring-a-websocket-proxy)\n- [Using HTTPS in Development](#using-https-in-development)\n- [Generating Dynamic `<meta>` Tags on the Server](#generating-dynamic-meta-tags-on-the-server)\n- [Pre-Rendering into Static HTML Files](#pre-rendering-into-static-html-files)\n- [Injecting Data from the Server into the Page](#injecting-data-from-the-server-into-the-page)\n- [Running Tests](#running-tests)\n  - [Filename Conventions](#filename-conventions)\n  - [Command Line Interface](#command-line-interface)\n  - [Version Control Integration](#version-control-integration)\n  - [Writing Tests](#writing-tests)\n  - [Testing Components](#testing-components)\n  - [Using Third Party Assertion Libraries](#using-third-party-assertion-libraries)\n  - [Initializing Test Environment](#initializing-test-environment)\n  - [Focusing and Excluding Tests](#focusing-and-excluding-tests)\n  - [Coverage Reporting](#coverage-reporting)\n  - [Continuous Integration](#continuous-integration)\n  - [Disabling jsdom](#disabling-jsdom)\n  - [Snapshot Testing](#snapshot-testing)\n  - [Editor Integration](#editor-integration)\n- [Debugging Tests](#debugging-tests)\n  - [Debugging Tests in Chrome](#debugging-tests-in-chrome)\n  - [Debugging Tests in Visual Studio Code](#debugging-tests-in-visual-studio-code)\n- [Developing Components in Isolation](#developing-components-in-isolation)\n  - [Getting Started with Storybook](#getting-started-with-storybook)\n  - [Getting Started with Styleguidist](#getting-started-with-styleguidist)\n- [Publishing Components to npm](#publishing-components-to-npm)\n- [Making a Progressive Web App](#making-a-progressive-web-app)\n  - [Opting Out of Caching](#opting-out-of-caching)\n  - [Offline-First Considerations](#offline-first-considerations)\n  - [Progressive Web App Metadata](#progressive-web-app-metadata)\n- [Analyzing the Bundle Size](#analyzing-the-bundle-size)\n- [Deployment](#deployment)\n  - [Static Server](#static-server)\n  - [Other Solutions](#other-solutions)\n  - [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing)\n  - [Building for Relative Paths](#building-for-relative-paths)\n  - [Azure](#azure)\n  - [Firebase](#firebase)\n  - [GitHub Pages](#github-pages)\n  - [Heroku](#heroku)\n  - [Netlify](#netlify)\n  - [Now](#now)\n  - [S3 and CloudFront](#s3-and-cloudfront)\n  - [Surge](#surge)\n- [Advanced Configuration](#advanced-configuration)\n- [Troubleshooting](#troubleshooting)\n  - [`npm start` doesn’t detect changes](#npm-start-doesnt-detect-changes)\n  - [`npm test` hangs on macOS Sierra](#npm-test-hangs-on-macos-sierra)\n  - [`npm run build` exits too early](#npm-run-build-exits-too-early)\n  - [`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku)\n  - [`npm run build` fails to minify](#npm-run-build-fails-to-minify)\n  - [Moment.js locales are missing](#momentjs-locales-are-missing)\n- [Alternatives to Ejecting](#alternatives-to-ejecting)\n- [Something Missing?](#something-missing)\n\n## Updating to New Releases\n\nCreate React App is divided into two packages:\n\n* `create-react-app` is a global command-line utility that you use to create new projects.\n* `react-scripts` is a development dependency in the generated projects (including this one).\n\nYou almost never need to update `create-react-app` itself: it delegates all the setup to `react-scripts`.\n\nWhen you run `create-react-app`, it always creates the project with the latest version of `react-scripts` so you’ll get all the new features and improvements in newly created apps automatically.\n\nTo update an existing project to a new version of `react-scripts`, [open the changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md), find the version you’re currently on (check `package.json` in this folder if you’re not sure), and apply the migration instructions for the newer versions.\n\nIn most cases bumping the `react-scripts` version in `package.json` and running `npm install` in this folder should be enough, but it’s good to consult the [changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md) for potential breaking changes.\n\nWe commit to keeping the breaking changes minimal so you can upgrade `react-scripts` painlessly.\n\n## Sending Feedback\n\nWe are always open to [your feedback](https://github.com/facebookincubator/create-react-app/issues).\n\n## Folder Structure\n\nAfter creation, your project should look like this:\n\n```\nmy-app/\n  README.md\n  node_modules/\n  package.json\n  public/\n    index.html\n    favicon.ico\n  src/\n    App.css\n    App.js\n    App.test.js\n    index.css\n    index.js\n    logo.svg\n```\n\nFor the project to build, **these files must exist with exact filenames**:\n\n* `public/index.html` is the page template;\n* `src/index.js` is the JavaScript entry point.\n\nYou can delete or rename the other files.\n\nYou may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.<br>\nYou need to **put any JS and CSS files inside `src`**, otherwise Webpack won’t see them.\n\nOnly files inside `public` can be used from `public/index.html`.<br>\nRead instructions below for using assets from JavaScript and HTML.\n\nYou can, however, create more top-level directories.<br>\nThey will not be included in the production build so you can use them for things like documentation.\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.<br>\nOpen [http://localhost:3000](http://localhost:3000) to view it in the browser.\n\nThe page will reload if you make edits.<br>\nYou will also see any lint errors in the console.\n\n### `npm test`\n\nLaunches the test runner in the interactive watch mode.<br>\nSee the section about [running tests](#running-tests) for more information.\n\n### `npm run build`\n\nBuilds the app for production to the `build` folder.<br>\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.<br>\nYour app is ready to be deployed!\n\nSee the section about [deployment](#deployment) for more information.\n\n### `npm run eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can’t go back!**\n\nIf you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.\n\nInstead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.\n\nYou don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.\n\n## Supported Browsers\n\nBy default, the generated project uses the latest version of React.\n\nYou can refer [to the React documentation](https://reactjs.org/docs/react-dom.html#browser-support) for more information about supported browsers.\n\n## Supported Language Features and Polyfills\n\nThis project supports a superset of the latest JavaScript standard.<br>\nIn addition to [ES6](https://github.com/lukehoban/es6features) syntax features, it also supports:\n\n* [Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator) (ES2016).\n* [Async/await](https://github.com/tc39/ecmascript-asyncawait) (ES2017).\n* [Object Rest/Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread) (stage 3 proposal).\n* [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 3 proposal)\n* [Class Fields and Static Properties](https://github.com/tc39/proposal-class-public-fields) (stage 2 proposal).\n* [JSX](https://facebook.github.io/react/docs/introducing-jsx.html) and [Flow](https://flowtype.org/) syntax.\n\nLearn more about [different proposal stages](https://babeljs.io/docs/plugins/#presets-stage-x-experimental-presets-).\n\nWhile we recommend to use experimental proposals with some caution, Facebook heavily uses these features in the product code, so we intend to provide [codemods](https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb) if any of these proposals change in the future.\n\nNote that **the project only includes a few ES6 [polyfills](https://en.wikipedia.org/wiki/Polyfill)**:\n\n* [`Object.assign()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) via [`object-assign`](https://github.com/sindresorhus/object-assign).\n* [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) via [`promise`](https://github.com/then/promise).\n* [`fetch()`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) via [`whatwg-fetch`](https://github.com/github/fetch).\n\nIf you use any other ES6+ features that need **runtime support** (such as `Array.from()` or `Symbol`), make sure you are including the appropriate polyfills manually, or that the browsers you are targeting already support them.\n\nAlso note that using some newer syntax features like `for...of` or `[...nonArrayValue]` causes Babel to emit code that depends on ES6 runtime features and might not work without a polyfill. When in doubt, use [Babel REPL](https://babeljs.io/repl/) to see what any specific syntax compiles down to.\n\n## Syntax Highlighting in the Editor\n\nTo configure the syntax highlighting in your favorite text editor, head to the [relevant Babel documentation page](https://babeljs.io/docs/editors) and follow the instructions. Some of the most popular editors are covered.\n\n## Displaying Lint Output in the Editor\n\n>Note: this feature is available with `react-scripts@0.2.0` and higher.<br>\n>It also only works with npm 3 or higher.\n\nSome editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.\n\nThey are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do.\n\nYou would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc` to the project root:\n\n```js\n{\n  \"extends\": \"react-app\"\n}\n```\n\nNow your editor should report the linting warnings.\n\nNote that even if you edit your `.eslintrc` file further, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes.\n\nIf you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules.\n\n## Debugging in the Editor\n\n**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).**\n\nVisual Studio Code and WebStorm support debugging out of the box with Create React App. This enables you as a developer to write and debug your React code without leaving the editor, and most importantly it enables you to have a continuous development workflow, where context switching is minimal, as you don’t have to switch between tools.\n\n### Visual Studio Code\n\nYou would need to have the latest version of [VS Code](https://code.visualstudio.com) and VS Code [Chrome Debugger Extension](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) installed.\n\nThen add the block below to your `launch.json` file and put it inside the `.vscode` folder in your app’s root directory.\n\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [{\n    \"name\": \"Chrome\",\n    \"type\": \"chrome\",\n    \"request\": \"launch\",\n    \"url\": \"http://localhost:3000\",\n    \"webRoot\": \"${workspaceRoot}/src\",\n    \"userDataDir\": \"${workspaceRoot}/.vscode/chrome\",\n    \"sourceMapPathOverrides\": {\n      \"webpack:///src/*\": \"${webRoot}/*\"\n    }\n  }]\n}\n```\n>Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).\n\nStart your app by running `npm start`, and start debugging in VS Code by pressing `F5` or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor.\n\n### WebStorm\n\nYou would need to have [WebStorm](https://www.jetbrains.com/webstorm/) and [JetBrains IDE Support](https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji) Chrome extension installed.\n\nIn the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and select `JavaScript Debug`. Paste `http://localhost:3000` into the URL field and save the configuration.\n\n>Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).\n\nStart your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm.\n\nThe same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine.\n\n## Formatting Code Automatically\n\nPrettier is an opinionated code formatter with support for JavaScript, CSS and JSON. With Prettier you can format the code you write automatically to ensure a code style within your project. See the [Prettier's GitHub page](https://github.com/prettier/prettier) for more information, and look at this [page to see it in action](https://prettier.github.io/prettier/).\n\nTo format our code whenever we make a commit in git, we need to install the following dependencies:\n\n```sh\nnpm install --save husky lint-staged prettier\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add husky lint-staged prettier\n```\n\n* `husky` makes it easy to use githooks as if they are npm scripts.\n* `lint-staged` allows us to run scripts on staged files in git. See this [blog post about lint-staged to learn more about it](https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8).\n* `prettier` is the JavaScript formatter we will run before commits.\n\nNow we can make sure every file is formatted correctly by adding a few lines to the `package.json` in the project root.\n\nAdd the following line to `scripts` section:\n\n```diff\n  \"scripts\": {\n+   \"precommit\": \"lint-staged\",\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n```\n\nNext we add a 'lint-staged' field to the `package.json`, for example:\n\n```diff\n  \"dependencies\": {\n    // ...\n  },\n+ \"lint-staged\": {\n+   \"src/**/*.{js,jsx,json,css}\": [\n+     \"prettier --single-quote --write\",\n+     \"git add\"\n+   ]\n+ },\n  \"scripts\": {\n```\n\nNow, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --single-quote --write \"src/**/*.{js,jsx,json,css}\"` to format your entire project for the first time.\n\nNext you might want to integrate Prettier in your favorite editor. Read the section on [Editor Integration](https://prettier.io/docs/en/editors.html) on the Prettier GitHub page.\n\n## Changing the Page `<title>`\n\nYou can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “React App” to anything else.\n\nNote that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](#adding-a-stylesheet) is done without touching the HTML.\n\nIf you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library.\n\nIf you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](#generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](#pre-rendering-into-static-html-files).\n\n## Installing a Dependency\n\nThe generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with `npm`:\n\n```sh\nnpm install --save react-router\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-router\n```\n\nThis works for any library, not just `react-router`.\n\n## Importing a Component\n\nThis project setup supports ES6 modules thanks to Babel.<br>\nWhile you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.\n\nFor example:\n\n### `Button.js`\n\n```js\nimport React, { Component } from 'react';\n\nclass Button extends Component {\n  render() {\n    // ...\n  }\n}\n\nexport default Button; // Don’t forget to use export default!\n```\n\n### `DangerButton.js`\n\n\n```js\nimport React, { Component } from 'react';\nimport Button from './Button'; // Import a component from another file\n\nclass DangerButton extends Component {\n  render() {\n    return <Button color=\"red\" />;\n  }\n}\n\nexport default DangerButton;\n```\n\nBe aware of the [difference between default and named exports](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281). It is a common source of mistakes.\n\nWe suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use `export default Button` and `import Button from './Button'`.\n\nNamed exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like.\n\nLearn more about ES6 modules:\n\n* [When to use the curly braces?](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281)\n* [Exploring ES6: Modules](http://exploringjs.com/es6/ch_modules.html)\n* [Understanding ES6: Modules](https://leanpub.com/understandinges6/read#leanpub-auto-encapsulating-code-with-modules)\n\n## Code Splitting\n\nInstead of downloading the entire app before users can use it, code splitting allows you to split your code into small chunks which you can then load on demand.\n\nThis project setup supports code splitting via [dynamic `import()`](http://2ality.com/2017/01/import-operator.html#loading-code-on-demand). Its [proposal](https://github.com/tc39/proposal-dynamic-import) is in stage 3. The `import()` function-like form takes the module name as an argument and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which always resolves to the namespace object of the module.\n\nHere is an example:\n\n### `moduleA.js`\n\n```js\nconst moduleA = 'Hello';\n\nexport { moduleA };\n```\n### `App.js`\n\n```js\nimport React, { Component } from 'react';\n\nclass App extends Component {\n  handleClick = () => {\n    import('./moduleA')\n      .then(({ moduleA }) => {\n        // Use moduleA\n      })\n      .catch(err => {\n        // Handle failure\n      });\n  };\n\n  render() {\n    return (\n      <div>\n        <button onClick={this.handleClick}>Load</button>\n      </div>\n    );\n  }\n}\n\nexport default App;\n```\n\nThis will make `moduleA.js` and all its unique dependencies as a separate chunk that only loads after the user clicks the 'Load' button.\n\nYou can also use it with `async` / `await` syntax if you prefer it.\n\n### With React Router\n\nIf you are using React Router check out [this tutorial](http://serverless-stack.com/chapters/code-splitting-in-create-react-app.html) on how to use code splitting with it. You can find the companion GitHub repository [here](https://github.com/AnomalyInnovations/serverless-stack-demo-client/tree/code-splitting-in-create-react-app).\n\nAlso check out the [Code Splitting](https://reactjs.org/docs/code-splitting.html) section in React documentation.\n\n## Adding a Stylesheet\n\nThis project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:\n\n### `Button.css`\n\n```css\n.Button {\n  padding: 20px;\n}\n```\n\n### `Button.js`\n\n```js\nimport React, { Component } from 'react';\nimport './Button.css'; // Tell Webpack that Button.js uses these styles\n\nclass Button extends Component {\n  render() {\n    // You can use them as regular CSS styles\n    return <div className=\"Button\" />;\n  }\n}\n```\n\n**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.\n\nIn development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output.\n\nIf you are concerned about using Webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool.\n\n## Post-Processing CSS\n\nThis project setup minifies your CSS and adds vendor prefixes to it automatically through [Autoprefixer](https://github.com/postcss/autoprefixer) so you don’t need to worry about it.\n\nFor example, this:\n\n```css\n.App {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n}\n```\n\nbecomes this:\n\n```css\n.App {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: horizontal;\n  -webkit-box-direction: normal;\n      -ms-flex-direction: row;\n          flex-direction: row;\n  -webkit-box-align: center;\n      -ms-flex-align: center;\n          align-items: center;\n}\n```\n\nIf you need to disable autoprefixing for some reason, [follow this section](https://github.com/postcss/autoprefixer#disabling).\n\n## Adding a CSS Preprocessor (Sass, Less etc.)\n\nGenerally, we recommend that you don’t reuse the same CSS classes across different components. For example, instead of using a `.Button` CSS class in `<AcceptButton>` and `<RejectButton>` components, we recommend creating a `<Button>` component with its own `.Button` styles, that both `<AcceptButton>` and `<RejectButton>` can render (but [not inherit](https://facebook.github.io/react/docs/composition-vs-inheritance.html)).\n\nFollowing this rule often makes CSS preprocessors less useful, as features like mixins and nesting are replaced by component composition. You can, however, integrate a CSS preprocessor if you find it valuable. In this walkthrough, we will be using Sass, but you can also use Less, or another alternative.\n\nFirst, let’s install the command-line interface for Sass:\n\n```sh\nnpm install --save node-sass-chokidar\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add node-sass-chokidar\n```\n\nThen in `package.json`, add the following lines to `scripts`:\n\n```diff\n   \"scripts\": {\n+    \"build-css\": \"node-sass-chokidar src/ -o src/\",\n+    \"watch-css\": \"npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive\",\n     \"start\": \"react-scripts start\",\n     \"build\": \"react-scripts build\",\n     \"test\": \"react-scripts test --env=jsdom\",\n```\n\n>Note: To use a different preprocessor, replace `build-css` and `watch-css` commands according to your preprocessor’s documentation.\n\nNow you can rename `src/App.css` to `src/App.scss` and run `npm run watch-css`. The watcher will find every Sass file in `src` subdirectories, and create a corresponding CSS file next to it, in our case overwriting `src/App.css`. Since `src/App.js` still imports `src/App.css`, the styles become a part of your application. You can now edit `src/App.scss`, and `src/App.css` will be regenerated.\n\nTo share variables between Sass files, you can use Sass imports. For example, `src/App.scss` and other component style files could include `@import \"./shared.scss\";` with variable definitions.\n\nTo enable importing files without using relative paths, you can add the  `--include-path` option to the command in `package.json`.\n\n```\n\"build-css\": \"node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/\",\n\"watch-css\": \"npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive\",\n```\n\nThis will allow you to do imports like\n\n```scss\n@import 'styles/_colors.scss'; // assuming a styles directory under src/\n@import 'nprogress/nprogress'; // importing a css file from the nprogress node module\n```\n\nAt this point you might want to remove all CSS files from the source control, and add `src/**/*.css` to your `.gitignore` file. It is generally a good practice to keep the build products outside of the source control.\n\nAs a final step, you may find it convenient to run `watch-css` automatically with `npm start`, and run `build-css` as a part of `npm run build`. You can use the `&&` operator to execute two scripts sequentially. However, there is no cross-platform way to run two scripts in parallel, so we will install a package for this:\n\n```sh\nnpm install --save npm-run-all\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add npm-run-all\n```\n\nThen we can change `start` and `build` scripts to include the CSS preprocessor commands:\n\n```diff\n   \"scripts\": {\n     \"build-css\": \"node-sass-chokidar src/ -o src/\",\n     \"watch-css\": \"npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive\",\n-    \"start\": \"react-scripts-ts start\",\n-    \"build\": \"react-scripts-ts build\",\n+    \"start-js\": \"react-scripts-ts start\",\n+    \"start\": \"npm-run-all -p watch-css start-js\",\n+    \"build\": \"npm run build-css && react-scripts-ts build\",\n     \"test\": \"react-scripts test --env=jsdom\",\n     \"eject\": \"react-scripts eject\"\n   }\n```\n\nNow running `npm start` and `npm run build` also builds Sass files.\n\n**Why `node-sass-chokidar`?**\n\n`node-sass` has been reported as having the following issues:\n\n- `node-sass --watch` has been reported to have *performance issues* in certain conditions when used in a virtual machine or with docker.\n\n- Infinite styles compiling [#1939](https://github.com/facebookincubator/create-react-app/issues/1939)\n\n- `node-sass` has been reported as having issues with detecting new files in a directory [#1891](https://github.com/sass/node-sass/issues/1891)\n\n `node-sass-chokidar` is used here as it addresses these issues.\n\n## Adding Images, Fonts, and Files\n\nWith Webpack, using static assets like images and fonts works similarly to CSS.\n\nYou can **`import` a file right in a TypeScript module**. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF.\n\nTo reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebookincubator/create-react-app/issues/1153).\n\nBefore getting started, you must define each type of asset as a valid module format. Otherwise, the TypeScript compiler will generate an error like this:\n\n>Cannot find module './logo.png'.\n\nTo import asset files in TypeScript, create a new type definition file in your project, and name it something like `assets.d.ts`. Then, add a line for each type of asset that you need to import:\n\n```ts\ndeclare module \"*.gif\";\ndeclare module \"*.jpg\";\ndeclare module \"*.jpeg\";\ndeclare module \"*.png\";\ndeclare module \"*.svg\";\n```\n(you'll have to restart the compiler in order the changes to take place)\n\nIn this case, we've added several image file extensions as valid module formats.\n\nNow that the compiler is configured, here is an example of importing an image file:\n\n```js\nimport React from 'react';\nimport logo from './logo.svg'; // Tell Webpack this JS file uses this image\n\nconsole.log(logo); // /logo.84287d09.png\n\nfunction Header() {\n  // Import result is the URL of your image\n  return <img src={logo} alt=\"Logo\" />;\n}\n\nexport default Header;\n```\n\nThis ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths.\n\nThis works in CSS too:\n\n```css\n.Logo {\n  background-image: url(./logo.png);\n}\n```\n\nWebpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.\n\nPlease be advised that this is also a custom feature of Webpack.\n\n**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).<br>\nAn alternative way of handling static assets is described in the next section.\n\n## Using the `public` Folder\n\n>Note: this feature is available with `react-scripts@0.5.0` and higher.\n\n### Changing the HTML\n\nThe `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](#changing-the-page-title).\nThe `<script>` tag with the compiled code will be added to it automatically during the build process.\n\n### Adding Assets Outside of the Module System\n\nYou can also add other assets to the `public` folder.\n\nNote that we normally encourage you to `import` assets in JavaScript files instead.\nFor example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-fonts-and-files).\nThis mechanism provides a number of benefits:\n\n* Scripts and stylesheets get minified and bundled together to avoid extra network requests.\n* Missing files cause compilation errors instead of 404 errors for your users.\n* Result filenames include content hashes so you don’t need to worry about browsers caching their old versions.\n\nHowever there is an **escape hatch** that you can use to add an asset outside of the module system.\n\nIf you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched.   To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`.\n\nInside `index.html`, you can use it like this:\n\n```html\n<link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n```\n\nOnly files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build.\n\nWhen you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.\n\nIn JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes:\n\n```js\nrender() {\n  // Note: this is an escape hatch and should be used sparingly!\n  // Normally we recommend using `import` for getting asset URLs\n  // as described in “Adding Images and Fonts” above this section.\n  return <img src={process.env.PUBLIC_URL + '/img/logo.png'} />;\n}\n```\n\nKeep in mind the downsides of this approach:\n\n* None of the files in `public` folder get post-processed or minified.\n* Missing files will not be called at compilation time, and will cause 404 errors for your users.\n* Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change.\n\n### When to Use the `public` Folder\n\nNormally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-fonts-and-files) from JavaScript.\nThe `public` folder is useful as a workaround for a number of less common cases:\n\n* You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest).\n* You have thousands of images and need to dynamically reference their paths.\n* You want to include a small script like [`pace.js`](http://github.hubspot.com/pace/docs/welcome/) outside of the bundled code.\n* Some library may be incompatible with Webpack and you have no other option but to include it as a `<script>` tag.\n\nNote that if you add a `<script>` that declares global variables, you also need to read the next section on using them.\n\n## Using Global Variables\n\nWhen you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable.\n\nYou can avoid this by reading the global variable explicitly from the `window` object, for example:\n\n```js\nconst $ = window.$;\n```\n\nThis makes it obvious you are using a global variable intentionally rather than because of a typo.\n\nAlternatively, you can force the linter to ignore any line by adding `// eslint-disable-line` after it.\n\n## Adding Bootstrap\n\nYou don’t have to use [React Bootstrap](https://react-bootstrap.github.io) together with React but it is a popular library for integrating Bootstrap with React apps. If you need it, you can integrate it with Create React App by following these steps:\n\nInstall React Bootstrap and Bootstrap from npm. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well:\n\n```sh\nnpm install --save react-bootstrap bootstrap@3\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-bootstrap bootstrap@3\n```\n\nImport Bootstrap CSS and optionally Bootstrap theme CSS in the beginning of your ```src/index.js``` file:\n\n```js\nimport 'bootstrap/dist/css/bootstrap.css';\nimport 'bootstrap/dist/css/bootstrap-theme.css';\n// Put any other imports below so that CSS from your\n// components takes precedence over default styles.\n```\n\nImport required React Bootstrap components within ```src/App.js``` file or your custom component files:\n\n```js\nimport { Navbar, Jumbotron, Button } from 'react-bootstrap';\n```\n\nNow you are ready to use the imported React Bootstrap components within your component hierarchy defined in the render method. Here is an example [`App.js`](https://gist.githubusercontent.com/gaearon/85d8c067f6af1e56277c82d19fd4da7b/raw/6158dd991b67284e9fc8d70b9d973efe87659d72/App.js) redone using React Bootstrap.\n\n### Using a Custom Theme\n\nSometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).<br>\nWe suggest the following approach:\n\n* Create a new package that depends on the package you wish to customize, e.g. Bootstrap.\n* Add the necessary build steps to tweak the theme, and publish your package on npm.\n* Install your own theme npm package as a dependency of your app.\n\nHere is an example of adding a [customized Bootstrap](https://medium.com/@tacomanator/customizing-create-react-app-aa9ffb88165) that follows these steps.\n\n## Adding Flow\n\nFlow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept.\n\nRecent versions of [Flow](http://flowtype.org/) work with Create React App projects out of the box.\n\nTo add Flow to a Create React App project, follow these steps:\n\n1. Run `npm install --save flow-bin` (or `yarn add flow-bin`).\n2. Add `\"flow\": \"flow\"` to the `scripts` section of your `package.json`.\n3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flowtype.org/docs/advanced-configuration.html) in the root directory.\n4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).\n\nNow you can run `npm run flow` (or `yarn flow`) to check the files for type errors.\nYou can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.\nIn the future we plan to integrate it into Create React App even more closely.\n\nTo learn more about Flow, check out [its documentation](https://flowtype.org/).\n\n## Adding a Router\n\nCreate React App doesn't prescribe a specific routing solution, but [React Router](https://reacttraining.com/react-router/) is the most popular one.\n\nTo add it, run:\n\n```sh\nnpm install --save react-router-dom\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-router-dom\n```\n\nTo try it, delete all the code in `src/App.js` and replace it with any of the examples on its website. The [Basic Example](https://reacttraining.com/react-router/web/example/basic) is a good place to get started.\n\nNote that [you may need to configure your production server to support client-side routing](#serving-apps-with-client-side-routing) before deploying your app.\n\n## Adding Custom Environment Variables\n\n>Note: this feature is available with `react-scripts@0.2.3` and higher.\n\nYour project can consume variables declared in your environment as if they were declared locally in your JS files. By\ndefault you will have `NODE_ENV` defined for you, and any other environment variables starting with\n`REACT_APP_`.\n\n**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them.\n\n>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running.\n\nThese environment variables will be defined for you on `process.env`. For example, having an environment\nvariable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`.\n\nThere is also a special built-in environment variable called `NODE_ENV`. You can read it from `process.env.NODE_ENV`. When you run `npm start`, it is always equal to `'development'`, when you run `npm test` it is always equal to `'test'`, and when you run `npm run build` to make a production bundle, it is always equal to `'production'`. **You cannot override `NODE_ENV` manually.** This prevents developers from accidentally deploying a slow development build to production.\n\nThese environment variables can be useful for displaying information conditionally based on where the project is\ndeployed or consuming sensitive data that lives outside of version control.\n\nFirst, you need to have environment variables defined. For example, let’s say you wanted to consume a secret defined\nin the environment inside a `<form>`:\n\n```jsx\nrender() {\n  return (\n    <div>\n      <small>You are running this application in <b>{process.env.NODE_ENV}</b> mode.</small>\n      <form>\n        <input type=\"hidden\" defaultValue={process.env.REACT_APP_SECRET_CODE} />\n      </form>\n    </div>\n  );\n}\n```\n\nDuring the build, `process.env.REACT_APP_SECRET_CODE` will be replaced with the current value of the `REACT_APP_SECRET_CODE` environment variable. Remember that the `NODE_ENV` variable will be set for you automatically.\n\nWhen you load the app in the browser and inspect the `<input>`, you will see its value set to `abcdef`, and the bold text will show the environment provided when using `npm start`:\n\n```html\n<div>\n  <small>You are running this application in <b>development</b> mode.</small>\n  <form>\n    <input type=\"hidden\" value=\"abcdef\" />\n  </form>\n</div>\n```\n\nThe above form is looking for a variable called `REACT_APP_SECRET_CODE` from the environment. In order to consume this\nvalue, we need to have it defined in the environment. This can be done using two ways: either in your shell or in\na `.env` file. Both of these ways are described in the next few sections.\n\nHaving access to the `NODE_ENV` is also useful for performing actions conditionally:\n\n```js\nif (process.env.NODE_ENV !== 'production') {\n  analytics.disable();\n}\n```\n\nWhen you compile the app with `npm run build`, the minification step will strip out this condition, and the resulting bundle will be smaller.\n\n### Referencing Environment Variables in the HTML\n\n>Note: this feature is available with `react-scripts@0.9.0` and higher.\n\nYou can also access the environment variables starting with `REACT_APP_` in the `public/index.html`. For example:\n\n```html\n<title>%REACT_APP_WEBSITE_NAME%</title>\n```\n\nNote that the caveats from the above section apply:\n\n* Apart from a few built-in variables (`NODE_ENV` and `PUBLIC_URL`), variable names must start with `REACT_APP_` to work.\n* The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](#generating-dynamic-meta-tags-on-the-server).\n\n### Adding Temporary Environment Variables In Your Shell\n\nDefining environment variables can vary between OSes. It’s also important to know that this manner is temporary for the\nlife of the shell session.\n\n#### Windows (cmd.exe)\n\n```cmd\nset \"REACT_APP_SECRET_CODE=abcdef\" && npm start\n```\n\n(Note: Quotes around the variable assignment are required to avoid a trailing whitespace.)\n\n#### Windows (Powershell)\n\n```Powershell\n($env:REACT_APP_SECRET_CODE = \"abcdef\") -and (npm start)\n```\n\n#### Linux, macOS (Bash)\n\n```bash\nREACT_APP_SECRET_CODE=abcdef npm start\n```\n\n### Adding Development Environment Variables In `.env`\n\n>Note: this feature is available with `react-scripts@0.5.0` and higher.\n\nTo define permanent environment variables, create a file called `.env` in the root of your project:\n\n```\nREACT_APP_SECRET_CODE=abcdef\n```\n>Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid [accidentally exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running.\n\n`.env` files **should be** checked into source control (with the exclusion of `.env*.local`).\n\n#### What other `.env` files are can be used?\n\n>Note: this feature is **available with `react-scripts@1.0.0` and higher**.\n\n* `.env`: Default.\n* `.env.local`: Local overrides. **This file is loaded for all environments except test.**\n* `.env.development`, `.env.test`, `.env.production`: Environment-specific settings.\n* `.env.development.local`, `.env.test.local`, `.env.production.local`: Local overrides of environment-specific settings.\n\nFiles on the left have more priority than files on the right:\n\n* `npm start`: `.env.development.local`, `.env.development`, `.env.local`, `.env`\n* `npm run build`: `.env.production.local`, `.env.production`, `.env.local`, `.env`\n* `npm test`: `.env.test.local`, `.env.test`, `.env` (note `.env.local` is missing)\n\nThese variables will act as the defaults if the machine does not explicitly set them.<br>\nPlease refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.\n\n>Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need\nthese defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars).\n\n#### Expanding Environment Variables In `.env`\n\n>Note: this feature is available with `react-scripts@1.1.0` and higher.\n\nExpand variables already on your machine for use in your `.env` file (using [dotenv-expand](https://github.com/motdotla/dotenv-expand)).\n\nFor example, to get the environment variable `npm_package_version`:\n\n```\nREACT_APP_VERSION=$npm_package_version\n# also works:\n# REACT_APP_VERSION=${npm_package_version}\n```\n\nOr expand variables local to the current `.env` file:\n\n```\nDOMAIN=www.example.com\nREACT_APP_FOO=$DOMAIN/foo\nREACT_APP_BAR=$DOMAIN/bar\n```\n\n## Can I Use Decorators?\n\nMany popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.<br>\nCreate React App doesn’t support decorator syntax at the moment because:\n\n* It is an experimental proposal and is subject to change.\n* The current specification version is not officially supported by Babel.\n* If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook.\n\nHowever in many cases you can rewrite decorator-based code without decorators just as fine.<br>\nPlease refer to these two threads for reference:\n\n* [#214](https://github.com/facebookincubator/create-react-app/issues/214)\n* [#411](https://github.com/facebookincubator/create-react-app/issues/411)\n\nCreate React App will add decorator support when the specification advances to a stable stage.\n\n## Fetching Data with AJAX Requests\n\nReact doesn't prescribe a specific approach to data fetching, but people commonly use either a library like [axios](https://github.com/axios/axios) or the [`fetch()` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) provided by the browser. Conveniently, Create React App includes a polyfill for `fetch()` so you can use it without worrying about the browser support.\n\nThe global `fetch` function allows to easily makes AJAX requests. It takes in a URL as an input and returns a `Promise` that resolves to a `Response` object. You can find more information about `fetch` [here](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).\n\nThis project also includes a [Promise polyfill](https://github.com/then/promise) which provides a full implementation of Promises/A+. A Promise represents the eventual result of an asynchronous operation, you can find more information about Promises [here](https://www.promisejs.org/) and [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Both axios and `fetch()` use Promises under the hood. You can also use the [`async / await`](https://davidwalsh.name/async-await) syntax to reduce the callback nesting.\n\nYou can learn more about making AJAX requests from React components in [the FAQ entry on the React website](https://reactjs.org/docs/faq-ajax.html).\n\n## Integrating with an API Backend\n\nThese tutorials will help you to integrate your app with an API backend running on another port,\nusing `fetch()` to access it.\n\n### Node\nCheck out [this tutorial](https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/).\nYou can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo).\n\n### Ruby on Rails\n\nCheck out [this tutorial](https://www.fullstackreact.com/articles/how-to-get-create-react-app-to-work-with-your-rails-api/).\nYou can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo-rails).\n\n## Proxying API Requests in Development\n\n>Note: this feature is available with `react-scripts@0.2.3` and higher.\n\nPeople often serve the front-end React app from the same host and port as their backend implementation.<br>\nFor example, a production setup might look like this after the app is deployed:\n\n```\n/             - static server returns index.html with React app\n/todos        - static server returns index.html with React app\n/api/todos    - server handles any /api/* requests using the backend implementation\n```\n\nSuch setup is **not** required. However, if you **do** have a setup like this, it is convenient to write requests like `fetch('/api/todos')` without worrying about redirecting them to another host or port during development.\n\nTo tell the development server to proxy any unknown requests to your API server in development, add a `proxy` field to your `package.json`, for example:\n\n```js\n  \"proxy\": \"http://localhost:4000\",\n```\n\nThis way, when you `fetch('/api/todos')` in development, the development server will recognize that it’s not a static asset, and will proxy your request to `http://localhost:4000/api/todos` as a fallback. The development server will only attempt to send requests without a `text/html` accept header to the proxy.\n\nConveniently, this avoids [CORS issues](http://stackoverflow.com/questions/21854516/understanding-ajax-cors-and-security-considerations) and error messages like this in development:\n\n```\nFetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.\n```\n\nKeep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`.\n\nThe `proxy` option supports HTTP, HTTPS and WebSocket connections.<br>\nIf the `proxy` option is **not** flexible enough for you, alternatively you can:\n\n* [Configure the proxy yourself](#configuring-the-proxy-manually)\n* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)).\n* Use [environment variables](#adding-custom-environment-variables) to inject the right server host and port into your app.\n\n### \"Invalid Host Header\" Errors After Configuring Proxy\n\nWhen you enable the `proxy` option, you opt into a more strict set of host checks. This is necessary because leaving the backend open to remote hosts makes your computer vulnerable to DNS rebinding attacks. The issue is explained in [this article](https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a) and [this issue](https://github.com/webpack/webpack-dev-server/issues/887).\n\nThis shouldn’t affect you when developing on `localhost`, but if you develop remotely like [described here](https://github.com/facebookincubator/create-react-app/issues/2271), you will see this error in the browser after enabling the `proxy` option:\n\n>Invalid Host header\n\nTo work around it, you can specify your public development host in a file called `.env.development` in the root of your project:\n\n```\nHOST=mypublicdevhost.com\n```\n\nIf you restart the development server now and load the app from the specified host, it should work.\n\nIf you are still having issues or if you’re using a more exotic environment like a cloud editor, you can bypass the host check completely by adding a line to `.env.development.local`. **Note that this is dangerous and exposes your machine to remote code execution from malicious websites:**\n\n```\n# NOTE: THIS IS DANGEROUS!\n# It exposes your machine to attacks from the websites you visit.\nDANGEROUSLY_DISABLE_HOST_CHECK=true\n```\n\nWe don’t recommend this approach.\n\n### Configuring the Proxy Manually\n\n>Note: this feature is available with `react-scripts@1.0.0` and higher.\n\nIf the `proxy` option is **not** flexible enough for you, you can specify an object in the following form (in `package.json`).<br>\nYou may also specify any configuration value [`http-proxy-middleware`](https://github.com/chimurai/http-proxy-middleware#options) or [`http-proxy`](https://github.com/nodejitsu/node-http-proxy#options) supports.\n```js\n{\n  // ...\n  \"proxy\": {\n    \"/api\": {\n      \"target\": \"<url>\",\n      \"ws\": true\n      // ...\n    }\n  }\n  // ...\n}\n```\n\nAll requests matching this path will be proxies, no exceptions. This includes requests for `text/html`, which the standard `proxy` option does not proxy.\n\nIf you need to specify multiple proxies, you may do so by specifying additional entries.\nYou may also narrow down matches using `*` and/or `**`, to match the path exactly or any subpath.\n```js\n{\n  // ...\n  \"proxy\": {\n    // Matches any request starting with /api\n    \"/api\": {\n      \"target\": \"<url_1>\",\n      \"ws\": true\n      // ...\n    },\n    // Matches any request starting with /foo\n    \"/foo\": {\n      \"target\": \"<url_2>\",\n      \"ssl\": true,\n      \"pathRewrite\": {\n        \"^/foo\": \"/foo/beta\"\n      }\n      // ...\n    },\n    // Matches /bar/abc.html but not /bar/sub/def.html\n    \"/bar/*.html\": {\n      \"target\": \"<url_3>\",\n      // ...\n    },\n    // Matches /baz/abc.html and /baz/sub/def.html\n    \"/baz/**/*.html\": {\n      \"target\": \"<url_4>\"\n      // ...\n    }\n  }\n  // ...\n}\n```\n\n### Configuring a WebSocket Proxy\n\nWhen setting up a WebSocket proxy, there are a some extra considerations to be aware of.\n\nIf you’re using a WebSocket engine like [Socket.io](https://socket.io/), you must have a Socket.io server running that you can use as the proxy target. Socket.io will not work with a standard WebSocket server. Specifically, don't expect Socket.io to work with [the websocket.org echo test](http://websocket.org/echo.html).\n\nThere’s some good documentation available for [setting up a Socket.io server](https://socket.io/docs/).\n\nStandard WebSockets **will** work with a standard WebSocket server as well as the websocket.org echo test. You can use libraries like [ws](https://github.com/websockets/ws) for the server, with [native WebSockets in the browser](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).\n\nEither way, you can proxy WebSocket requests manually in `package.json`:\n\n```js\n{\n  // ...\n  \"proxy\": {\n    \"/socket\": {\n      // Your compatible WebSocket server\n      \"target\": \"ws://<socket_url>\",\n      // Tell http-proxy-middleware that this is a WebSocket proxy.\n      // Also allows you to proxy WebSocket requests without an additional HTTP request\n      // https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade\n      \"ws\": true\n      // ...\n    }\n  }\n  // ...\n}\n```\n\n## Using HTTPS in Development\n\n>Note: this feature is available with `react-scripts@0.4.0` and higher.\n\nYou may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the \"proxy\" feature](#proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS.\n\nTo do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`:\n\n#### Windows (cmd.exe)\n\n```cmd\nset HTTPS=true&&npm start\n```\n\n#### Windows (Powershell)\n\n```Powershell\n($env:HTTPS = $true) -and (npm start)\n```\n\n(Note: the lack of whitespace is intentional.)\n\n#### Linux, macOS (Bash)\n\n```bash\nHTTPS=true npm start\n```\n\nNote that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page.\n\n## Generating Dynamic `<meta>` Tags on the Server\n\nSince Create React App doesn’t support server rendering, you might be wondering how to make `<meta>` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this:\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta property=\"og:title\" content=\"__OG_TITLE__\">\n    <meta property=\"og:description\" content=\"__OG_DESCRIPTION__\">\n```\n\nThen, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML!\n\nIf you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases.\n\n## Pre-Rendering into Static HTML Files\n\nIf you’re hosting your `build` with a static hosting provider you can use [react-snapshot](https://www.npmjs.com/package/react-snapshot) to generate HTML pages for each route, or relative link, in your application. These pages will then seamlessly become active, or “hydrated”, when the JavaScript bundle has loaded.\n\nThere are also opportunities to use this outside of static hosting, to take the pressure off the server when generating and caching routes.\n\nThe primary benefit of pre-rendering is that you get the core content of each page _with_ the HTML payload—regardless of whether or not your JavaScript bundle successfully downloads. It also increases the likelihood that each route of your application will be picked up by search engines.\n\nYou can read more about [zero-configuration pre-rendering (also called snapshotting) here](https://medium.com/superhighfives/an-almost-static-stack-6df0a2791319).\n\n## Injecting Data from the Server into the Page\n\nSimilarly to the previous section, you can leave some placeholders in the HTML that inject global variables, for example:\n\n```js\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <script>\n      window.SERVER_DATA = __SERVER_DATA__;\n    </script>\n```\n\nThen, on the server, you can replace `__SERVER_DATA__` with a JSON of real data right before sending the response. The client code can then read `window.SERVER_DATA` to use it. **Make sure to [sanitize the JSON before sending it to the client](https://medium.com/node-security/the-most-common-xss-vulnerability-in-react-js-applications-2bdffbcc1fa0) as it makes your app vulnerable to XSS attacks.**\n\n## Running Tests\n\n>Note: this feature is available with `react-scripts@0.3.0` and higher.<br>\n>[Read the migration guide to learn how to enable it in older projects!](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#migrating-from-023-to-030)\n\nCreate React App uses [Jest](https://facebook.github.io/jest/) as its test runner. To prepare for this integration, we did a [major revamp](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html) of Jest so if you heard bad things about it years ago, give it another try.\n\nJest is a Node-based runner. This means that the tests always run in a Node environment and not in a real browser. This lets us enable fast iteration speed and prevent flakiness.\n\nWhile Jest provides browser globals such as `window` thanks to [jsdom](https://github.com/tmpvar/jsdom), they are only approximations of the real browser behavior. Jest is intended to be used for unit tests of your logic and your components rather than the DOM quirks.\n\nWe recommend that you use a separate tool for browser end-to-end tests if you need them. They are beyond the scope of Create React App.\n\n### Filename Conventions\n\nJest will look for test files with any of the following popular naming conventions:\n\n* Files with `.js` suffix in `__tests__` folders.\n* Files with `.test.js` suffix.\n* Files with `.spec.js` suffix.\n\nThe `.test.js` / `.spec.js` files (or the `__tests__` folders) can be located at any depth under the `src` top level folder.\n\nWe recommend to put the test files (or `__tests__` folders) next to the code they are testing so that relative imports appear shorter. For example, if `App.test.js` and `App.js` are in the same folder, the test just needs to `import App from './App'` instead of a long relative path. Colocation also helps find tests more quickly in larger projects.\n\n### Command Line Interface\n\nWhen you run `npm test`, Jest will launch in the watch mode. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code.\n\nThe watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run:\n\n![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif)\n\n### Version Control Integration\n\nBy default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests run fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests.\n\nJest will always explicitly mention that it only ran tests related to the files changed since the last commit. You can also press `a` in the watch mode to force Jest to run all tests.\n\nJest will always run all tests on a [continuous integration](#continuous-integration) server or if the project is not inside a Git or Mercurial repository.\n\n### Writing Tests\n\nTo create tests, add `it()` (or `test()`) blocks with the name of the test and its code. You may optionally wrap them in `describe()` blocks for logical grouping but this is neither required nor recommended.\n\nJest provides a built-in `expect()` global function for making assertions. A basic test could look like this:\n\n```js\nimport sum from './sum';\n\nit('sums numbers', () => {\n  expect(sum(1, 2)).toEqual(3);\n  expect(sum(2, 2)).toEqual(4);\n});\n```\n\nAll `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/expect.html).<br>\nYou can also use [`jest.fn()` and `expect(fn).toBeCalled()`](http://facebook.github.io/jest/docs/expect.html#tohavebeencalled) to create “spies” or mock functions.\n\n### Testing Components\n\nThere is a broad spectrum of component testing techniques. They range from a “smoke test” verifying that a component renders without throwing, to shallow rendering and testing some of the output, to full rendering and testing component lifecycle and state changes.\n\nDifferent projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating simple smoke tests for your components:\n\n```ts\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport App from './App';\n\nit('renders without crashing', () => {\n  const div = document.createElement('div');\n  ReactDOM.render(<App />, div);\n});\n```\n\nThis test mounts a component and makes sure that it didn’t throw during rendering. Tests like this provide a lot of value with very little effort so they are great as a starting point, and this is the test you will find in `src/App.test.tsx`.\n\nWhen you encounter bugs caused by changing components, you will gain a deeper insight into which parts of them are worth testing in your application. This might be a good time to introduce more specific tests asserting specific expected output or behavior.\n\nIf you’d like to test components in isolation from the child components they render, we recommend using [`shallow()` rendering API](http://airbnb.io/enzyme/docs/api/shallow.html) from [Enzyme](http://airbnb.io/enzyme/). To install it, run:\n\n```sh\nnpm install --save-dev enzyme @types/enzyme enzyme-adapter-react-16 @types/enzyme-adapter-react-16 react-test-renderer @types/react-test-renderer\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add --dev enzyme @types/enzyme enzyme-adapter-react-16 @types/enzyme-adapter-react-16 react-test-renderer @types/react-test-renderer\n```\n\n#### `src/setupTests.ts`\n```ts\nimport * as Enzyme from 'enzyme';\nimport * as Adapter from 'enzyme-adapter-react-16';\n\nEnzyme.configure({ adapter: new Adapter() });\n```\n\n>Note: Keep in mind that if you decide to \"eject\" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it. [Read here](#initializing-test-environment) to learn how to add this after ejecting.\n\nNow you can write a smoke test with it:\n\n```ts\nimport * as React from 'react';\nimport { shallow } from 'enzyme';\nimport App from './App';\n\nit('renders without crashing', () => {\n  shallow(<App />);\n});\n```\n\nUnlike the previous smoke test using `ReactDOM.render()`, this test only renders `<App>` and doesn’t go deeper. For example, even if `<App>` itself renders a `<Button>` that throws, this test will pass. Shallow rendering is great for isolated unit tests, but you may still want to create some full rendering tests to ensure the components integrate correctly. Enzyme supports [full rendering with `mount()`](http://airbnb.io/enzyme/docs/api/mount.html), and you can also use it for testing state changes and component lifecycle.\n\nYou can read the [Enzyme documentation](http://airbnb.io/enzyme/) for more testing techniques. Enzyme documentation uses Chai and Sinon for assertions but you don’t have to use them because Jest provides built-in `expect()` and `jest.fn()` for spies.\n\nHere is an example from Enzyme documentation that asserts specific output, rewritten to use Jest matchers:\n\n```ts\nimport * as React from 'react';\nimport { shallow } from 'enzyme';\nimport App from './App';\n\nit('renders welcome message', () => {\n  const wrapper = shallow(<App />);\n  const welcome = <h2>Welcome to React</h2>;\n  // expect(wrapper.contains(welcome)).to.equal(true);\n  expect(wrapper.contains(welcome)).toEqual(true);\n});\n```\n\nAll Jest matchers are [extensively documented here](http://facebook.github.io/jest/docs/expect.html).<br>\nNevertheless you can use a third-party assertion library like [Chai](http://chaijs.com/) if you want to, as described below.\n\nAdditionally, you might find [jest-enzyme](https://github.com/blainekasten/enzyme-matchers) helpful to simplify your tests with readable matchers. The above `contains` code can be written more simply with jest-enzyme.\n\n```js\nexpect(wrapper).toContainReact(welcome)\n```\n\nTo enable this, install `jest-enzyme`:\n\n```sh\nnpm install --save jest-enzyme\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add jest-enzyme\n```\n\nImport it in [`src/setupTests.ts`](#initializing-test-environment) to make its matchers available in every test:\n\n```js\nimport 'jest-enzyme';\n```\n\n### Using Third Party Assertion Libraries\n\nWe recommend that you use `expect()` for assertions and `jest.fn()` for spies. If you are having issues with them please [file those against Jest](https://github.com/facebook/jest/issues/new), and we’ll fix them. We intend to keep making them better for React, supporting, for example, [pretty-printing React elements as JSX](https://github.com/facebook/jest/pull/1566).\n\nHowever, if you are used to other libraries, such as [Chai](http://chaijs.com/) and [Sinon](http://sinonjs.org/), or if you have existing code using them that you’d like to port over, you can import them normally like this:\n\n```js\nimport sinon from 'sinon';\nimport { expect } from 'chai';\n```\n\nand then use them in your tests like you normally do.\n\n### Initializing Test Environment\n\n>Note: this feature is available with `react-scripts@0.4.0` and higher.\n\nIf your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests, add a `src/setupTests.ts` to your project. It will be automatically executed before running your tests.\n\nFor example:\n\n#### `src/setupTests.ts`\n```ts\nconst localStorageMock = {\n  getItem: jest.fn(),\n  setItem: jest.fn(),\n  clear: jest.fn()\n};\nglobal.localStorage = localStorageMock\n```\n\n>Note: Keep in mind that if you decide to \"eject\" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it, so you should manually create the property `setupTestFrameworkScriptFile` in the configuration for Jest, something like the following:\n\n>```js\n>\"jest\": {\n>   // ...\n>   \"setupTestFrameworkScriptFile\": \"<rootDir>/src/setupTests.js\"\n>  }\n>  ```\n\n### Focusing and Excluding Tests\n\nYou can replace `it()` with `xit()` to temporarily exclude a test from being executed.<br>\nSimilarly, `fit()` lets you focus on a specific test without running any other tests.\n\n### Coverage Reporting\n\nJest has an integrated coverage reporter that works well with ES6 and requires no configuration.<br>\nRun `npm test -- --coverage` (note extra `--` in the middle) to include a coverage report like this:\n\n![coverage report](http://i.imgur.com/5bFhnTS.png)\n\nNote that tests run much slower with coverage so it is recommended to run it separately from your normal workflow.\n\n### Continuous Integration\n\nBy default `npm test` runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called `CI`.\n\nWhen creating a build of your application with `npm run build` linter warnings are not checked by default. Like `npm test`, you can force the build to perform a linter warning check by setting the environment variable `CI`. If any warnings are encountered then the build fails.\n\nPopular CI servers already set the environment variable `CI` by default but you can do this yourself too:\n\n### On CI servers\n#### Travis CI\n\n1. Following the [Travis Getting started](https://docs.travis-ci.com/user/getting-started/) guide for syncing your GitHub repository with Travis.  You may need to initialize some settings manually in your [profile](https://travis-ci.org/profile) page.\n1. Add a `.travis.yml` file to your git repository.\n```\nlanguage: node_js\nnode_js:\n  - 6\ncache:\n  directories:\n    - node_modules\nscript:\n  - npm run build\n  - npm test\n```\n1. Trigger your first build with a git push.\n1. [Customize your Travis CI Build](https://docs.travis-ci.com/user/customizing-the-build/) if needed.\n\n#### CircleCI\n\nFollow [this article](https://medium.com/@knowbody/circleci-and-zeits-now-sh-c9b7eebcd3c1) to set up CircleCI with a Create React App project.\n\n### On your own environment\n##### Windows (cmd.exe)\n\n```cmd\nset CI=true&&npm test\n```\n\n```cmd\nset CI=true&&npm run build\n```\n\n(Note: the lack of whitespace is intentional.)\n\n##### Windows (Powershell)\n\n```Powershell\n($env:CI = $true) -and (npm test)\n```\n\n```Powershell\n($env:CI = $true) -and (npm run build)\n```\n\n##### Linux, macOS (Bash)\n\n```bash\nCI=true npm test\n```\n\n```bash\nCI=true npm run build\n```\n\nThe test command will force Jest to run tests once instead of launching the watcher.\n\n>  If you find yourself doing this often in development, please [file an issue](https://github.com/facebookincubator/create-react-app/issues/new) to tell us about your use case because we want to make watcher the best experience and are open to changing how it works to accommodate more workflows.\n\nThe build command will check for linter warnings and fail if any are found.\n\n### Disabling jsdom\n\nBy default, the `package.json` of the generated project looks like this:\n\n```js\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n    \"test\": \"react-scripts test --env=jsdom\"\n```\n\nIf you know that none of your tests depend on [jsdom](https://github.com/tmpvar/jsdom), you can safely remove `--env=jsdom`, and your tests will run faster:\n\n```diff\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n-   \"test\": \"react-scripts test --env=jsdom\"\n+   \"test\": \"react-scripts test\"\n```\n\nTo help you make up your mind, here is a list of APIs that **need jsdom**:\n\n* Any browser globals like `window` and `document`\n* [`ReactDOM.render()`](https://facebook.github.io/react/docs/top-level-api.html#reactdom.render)\n* [`TestUtils.renderIntoDocument()`](https://facebook.github.io/react/docs/test-utils.html#renderintodocument) ([a shortcut](https://github.com/facebook/react/blob/34761cf9a252964abfaab6faf74d473ad95d1f21/src/test/ReactTestUtils.js#L83-L91) for the above)\n* [`mount()`](http://airbnb.io/enzyme/docs/api/mount.html) in [Enzyme](http://airbnb.io/enzyme/index.html)\n\nIn contrast, **jsdom is not needed** for the following APIs:\n\n* [`TestUtils.createRenderer()`](https://facebook.github.io/react/docs/test-utils.html#shallow-rendering) (shallow rendering)\n* [`shallow()`](http://airbnb.io/enzyme/docs/api/shallow.html) in [Enzyme](http://airbnb.io/enzyme/index.html)\n\nFinally, jsdom is also not needed for [snapshot testing](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html).\n\n### Snapshot Testing\n\nSnapshot testing is a feature of Jest that automatically generates text snapshots of your components and saves them on the disk so if the UI output changes, you get notified without manually writing any assertions on the component output. [Read more about snapshot testing.](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html)\n\n### Editor Integration\n\nIf you use [Visual Studio Code](https://code.visualstudio.com), there is a [Jest extension](https://github.com/orta/vscode-jest) which works with Create React App out of the box. This provides a lot of IDE-like features while using a text editor: showing the status of a test run with potential fail messages inline, starting and stopping the watcher automatically, and offering one-click snapshot updates.\n\n![VS Code Jest Preview](https://cloud.githubusercontent.com/assets/49038/20795349/a032308a-b7c8-11e6-9b34-7eeac781003f.png)\n\n## Debugging Tests\n\nThere are various ways to setup a debugger for your Jest tests. We cover debugging in Chrome and [Visual Studio Code](https://code.visualstudio.com/).\n\n>Note: debugging tests requires Node 8 or higher.\n\n### Debugging Tests in Chrome\n\nAdd the following to the `scripts` section in your project's `package.json`\n```json\n\"scripts\": {\n    \"test:debug\": \"react-scripts --inspect-brk test --runInBand --env=jsdom\"\n  }\n```\nPlace `debugger;` statements in any test and run:\n```bash\n$ npm run test:debug\n```\n\nThis will start running your Jest tests, but pause before executing to allow a debugger to attach to the process.\n\nOpen the following in Chrome\n```\nabout:inspect\n```\n\nAfter opening that link, the Chrome Developer Tools will be displayed. Select `inspect` on your process and a breakpoint will be set at the first line of the react script (this is done simply to give you time to open the developer tools and to prevent Jest from executing before you have time to do so). Click the button that looks like a \"play\" button in the upper right hand side of the screen to continue execution. When Jest executes the test that contains the debugger statement, execution will pause and you can examine the current scope and call stack.\n\n>Note: the --runInBand cli option makes sure Jest runs test in the same process rather than spawning processes for individual tests. Normally Jest parallelizes test runs across processes but it is hard to debug many processes at the same time.\n\n### Debugging Tests in Visual Studio Code\n\nDebugging Jest tests is supported out of the box for [Visual Studio Code](https://code.visualstudio.com).\n\nUse the following [`launch.json`](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) configuration file:\n```\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug CRA Tests\",\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"runtimeExecutable\": \"${workspaceRoot}/node_modules/.bin/react-scripts\",\n      \"args\": [\n        \"test\",\n        \"--runInBand\",\n        \"--no-cache\",\n        \"--env=jsdom\"\n      ],\n      \"cwd\": \"${workspaceRoot}\",\n      \"protocol\": \"inspector\",\n      \"console\": \"integratedTerminal\",\n      \"internalConsoleOptions\": \"neverOpen\"\n    }\n  ]\n}\n```\n\n## Developing Components in Isolation\n\nUsually, in an app, you have a lot of UI components, and each of them has many different states.\nFor an example, a simple button component could have following states:\n\n* In a regular state, with a text label.\n* In the disabled mode.\n* In a loading state.\n\nUsually, it’s hard to see these states without running a sample app or some examples.\n\nCreate React App doesn’t include any tools for this by default, but you can easily add [Storybook for React](https://storybook.js.org) ([source](https://github.com/storybooks/storybook)) or [React Styleguidist](https://react-styleguidist.js.org/) ([source](https://github.com/styleguidist/react-styleguidist)) to your project. **These are third-party tools that let you develop components and see all their states in isolation from your app**.\n\n![Storybook for React Demo](http://i.imgur.com/7CIAWpB.gif)\n\nYou can also deploy your Storybook or style guide as a static app. This way, everyone in your team can view and review different states of UI components without starting a backend server or creating an account in your app.\n\n### Getting Started with Storybook\n\nStorybook is a development environment for React UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.\n\nFirst, install the following npm package globally:\n\n```sh\nnpm install -g @storybook/cli\n```\n\nThen, run the following command inside your app’s directory:\n\n```sh\ngetstorybook\n```\n\nAfter that, follow the instructions on the screen.\n\nLearn more about React Storybook:\n\n* Screencast: [Getting Started with React Storybook](https://egghead.io/lessons/react-getting-started-with-react-storybook)\n* [GitHub Repo](https://github.com/storybooks/storybook)\n* [Documentation](https://storybook.js.org/basics/introduction/)\n* [Snapshot Testing UI](https://github.com/storybooks/storybook/tree/master/addons/storyshots) with Storybook + addon/storyshot\n\n### Getting Started with Styleguidist\n\nStyleguidist combines a style guide, where all your components are presented on a single page with their props documentation and usage examples, with an environment for developing components in isolation, similar to Storybook. In Styleguidist you write examples in Markdown, where each code snippet is rendered as a live editable playground.\n\nFirst, install Styleguidist:\n\n```sh\nnpm install --save react-styleguidist\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-styleguidist\n```\n\nThen, add these scripts to your `package.json`:\n\n```diff\n   \"scripts\": {\n+    \"styleguide\": \"styleguidist server\",\n+    \"styleguide:build\": \"styleguidist build\",\n     \"start\": \"react-scripts start\",\n```\n\nThen, run the following command inside your app’s directory:\n\n```sh\nnpm run styleguide\n```\n\nAfter that, follow the instructions on the screen.\n\nLearn more about React Styleguidist:\n\n* [GitHub Repo](https://github.com/styleguidist/react-styleguidist)\n* [Documentation](https://react-styleguidist.js.org/docs/getting-started.html)\n\n## Publishing Components to npm\n\nCreate React App doesn't provide any built-in functionality to publish a component to npm. If you're ready to extract a component from your project so other people can use it, we recommend moving it to a separate directory outside of your project and then using a tool like [nwb](https://github.com/insin/nwb#react-components-and-libraries) to prepare it for publishing.\n\n## Making a Progressive Web App\n\nBy default, the production build is a fully functional, offline-first\n[Progressive Web App](https://developers.google.com/web/progressive-web-apps/).\n\nProgressive Web Apps are faster and more reliable than traditional web pages, and provide an engaging mobile experience:\n\n * All static site assets are cached so that your page loads fast on subsequent visits, regardless of network connectivity (such as 2G or 3G). Updates are downloaded in the background.\n * Your app will work regardless of network state, even if offline. This means your users will be able to use your app at 10,000 feet and on the Subway.\n * On mobile devices, your app can be added directly to the user's home screen, app icon and all. You can also re-engage users using web **push notifications**. This eliminates the need for the app store.\n\nThe [`sw-precache-webpack-plugin`](https://github.com/goldhand/sw-precache-webpack-plugin)\nis integrated into production configuration,\nand it will take care of generating a service worker file that will automatically\nprecache all of your local assets and keep them up to date as you deploy updates.\nThe service worker will use a [cache-first strategy](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network)\nfor handling all requests for local assets, including the initial HTML, ensuring\nthat your web app is reliably fast, even on a slow or unreliable network.\n\n### Opting Out of Caching\n\nIf you would prefer not to enable service workers prior to your initial\nproduction deployment, then remove the call to `serviceWorkerRegistration.register()`\nfrom [`src/index.js`](src/index.js).\n\nIf you had previously enabled service workers in your production deployment and\nhave decided that you would like to disable them for all your existing users,\nyou can swap out the call to `serviceWorkerRegistration.register()` in\n[`src/index.js`](src/index.js) with a call to `serviceWorkerRegistration.unregister()`.\nAfter the user visits a page that has `serviceWorkerRegistration.unregister()`,\nthe service worker will be uninstalled. Note that depending on how `/service-worker.js` is served,\nit may take up to 24 hours for the cache to be invalidated.\n\n### Offline-First Considerations\n\n1. Service workers [require HTTPS](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers#you_need_https),\nalthough to facilitate local testing, that policy\n[does not apply to `localhost`](http://stackoverflow.com/questions/34160509/options-for-testing-service-workers-via-http/34161385#34161385).\nIf your production web server does not support HTTPS, then the service worker\nregistration will fail, but the rest of your web app will remain functional.\n\n1. Service workers are [not currently supported](https://jakearchibald.github.io/isserviceworkerready/)\nin all web browsers. Service worker registration [won't be attempted](src/registerServiceWorker.js)\non browsers that lack support.\n\n1. The service worker is only enabled in the [production environment](#deployment),\ne.g. the output of `npm run build`. It's recommended that you do not enable an\noffline-first service worker in a development environment, as it can lead to\nfrustration when previously cached assets are used and do not include the latest\nchanges you've made locally.\n\n1. If you *need* to test your offline-first service worker locally, build\nthe application (using `npm run build`) and run a simple http server from your\nbuild directory. After running the build script, `create-react-app` will give\ninstructions for one way to test your production build locally and the [deployment instructions](#deployment) have\ninstructions for using other methods. *Be sure to always use an\nincognito window to avoid complications with your browser cache.*\n\n1. If possible, configure your production environment to serve the generated\n`service-worker.js` [with HTTP caching disabled](http://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours).\nIf that's not possible—[GitHub Pages](#github-pages), for instance, does not\nallow you to change the default 10 minute HTTP cache lifetime—then be aware\nthat if you visit your production site, and then revisit again before\n`service-worker.js` has expired from your HTTP cache, you'll continue to get\nthe previously cached assets from the service worker. If you have an immediate\nneed to view your updated production deployment, performing a shift-refresh\nwill temporarily disable the service worker and retrieve all assets from the\nnetwork.\n\n1. Users aren't always familiar with offline-first web apps. It can be useful to\n[let the user know](https://developers.google.com/web/fundamentals/instant-and-offline/offline-ux#inform_the_user_when_the_app_is_ready_for_offline_consumption)\nwhen the service worker has finished populating your caches (showing a \"This web\napp works offline!\" message) and also let them know when the service worker has\nfetched the latest updates that will be available the next time they load the\npage (showing a \"New content is available; please refresh.\" message). Showing\nthis messages is currently left as an exercise to the developer, but as a\nstarting point, you can make use of the logic included in [`src/registerServiceWorker.js`](src/registerServiceWorker.js), which\ndemonstrates which service worker lifecycle events to listen for to detect each\nscenario, and which as a default, just logs appropriate messages to the\nJavaScript console.\n\n1. By default, the generated service worker file will not intercept or cache any\ncross-origin traffic, like HTTP [API requests](#integrating-with-an-api-backend),\nimages, or embeds loaded from a different domain. If you would like to use a\nruntime caching strategy for those requests, you can [`eject`](#npm-run-eject)\nand then configure the\n[`runtimeCaching`](https://github.com/GoogleChrome/sw-precache#runtimecaching-arrayobject)\noption in the `SWPrecacheWebpackPlugin` section of\n[`webpack.config.prod.js`](../config/webpack.config.prod.js).\n\n### Progressive Web App Metadata\n\nThe default configuration includes a web app manifest located at\n[`public/manifest.json`](public/manifest.json), that you can customize with\ndetails specific to your web application.\n\nWhen a user adds a web app to their homescreen using Chrome or Firefox on\nAndroid, the metadata in [`manifest.json`](public/manifest.json) determines what\nicons, names, and branding colors to use when the web app is displayed.\n[The Web App Manifest guide](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/)\nprovides more context about what each field means, and how your customizations\nwill affect your users' experience.\n\n## Analyzing the Bundle Size\n\n[Source map explorer](https://www.npmjs.com/package/source-map-explorer) analyzes\nJavaScript bundles using the source maps. This helps you understand where code\nbloat is coming from.\n\nTo add Source map explorer to a Create React App project, follow these steps:\n\n```sh\nnpm install --save source-map-explorer\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add source-map-explorer\n```\n\nThen in `package.json`, add the following line to `scripts`:\n\n```diff\n   \"scripts\": {\n+    \"analyze\": \"source-map-explorer build/static/js/main.*\",\n     \"start\": \"react-scripts start\",\n     \"build\": \"react-scripts build\",\n     \"test\": \"react-scripts test --env=jsdom\",\n```\n\nThen to analyze the bundle run the production build then run the analyze\nscript.\n\n```\nnpm run build\nnpm run analyze\n```\n\n## Deployment\n\n`npm run build` creates a `build` directory with a production build of your app. Set up your favorite HTTP server so that a visitor to your site is served `index.html`, and requests to static paths like `/static/js/main.<hash>.js` are served with the contents of the `/static/js/main.<hash>.js` file.\n\n### Static Server\n\nFor environments using [Node](https://nodejs.org/), the easiest way to handle this would be to install [serve](https://github.com/zeit/serve) and let it handle the rest:\n\n```sh\nnpm install -g serve\nserve -s build\n```\n\nThe last command shown above will serve your static site on the port **5000**. Like many of [serve](https://github.com/zeit/serve)’s internal settings, the port can be adjusted using the `-p` or `--port` flags.\n\nRun this command to get a full list of the options available:\n\n```sh\nserve -h\n```\n\n### Other Solutions\n\nYou don’t necessarily need a static server in order to run a Create React App project in production. It works just as fine integrated into an existing dynamic one.\n\nHere’s a programmatic example using [Node](https://nodejs.org/) and [Express](http://expressjs.com/):\n\n```javascript\nconst express = require('express');\nconst path = require('path');\nconst app = express();\n\napp.use(express.static(path.join(__dirname, 'build')));\n\napp.get('/', function (req, res) {\n  res.sendFile(path.join(__dirname, 'build', 'index.html'));\n});\n\napp.listen(9000);\n```\n\nThe choice of your server software isn’t important either. Since Create React App is completely platform-agnostic, there’s no need to explicitly use Node.\n\nThe `build` folder with static assets is the only output produced by Create React App.\n\nHowever this is not quite enough if you use client-side routing. Read the next section if you want to support URLs like `/todos/42` in your single-page app.\n\n### Serving Apps with Client-Side Routing\n\nIf you use routers that use the HTML5 [`pushState` history API](https://developer.mozilla.org/en-US/docs/Web/API/History_API#Adding_and_modifying_history_entries) under the hood (for example, [React Router](https://github.com/ReactTraining/react-router) with `browserHistory`), many static file servers will fail. For example, if you used React Router with a route for `/todos/42`, the development server will respond to `localhost:3000/todos/42` properly, but an Express serving a production build as above will not.\n\nThis is because when there is a fresh page load for a `/todos/42`, the server looks for the file `build/todos/42` and does not find it. The server needs to be configured to respond to a request to `/todos/42` by serving `index.html`. For example, we can amend our Express example above to serve `index.html` for any unknown paths:\n\n```diff\n app.use(express.static(path.join(__dirname, 'build')));\n\n-app.get('/', function (req, res) {\n+app.get('/*', function (req, res) {\n   res.sendFile(path.join(__dirname, 'build', 'index.html'));\n });\n```\n\nIf you’re using [Apache HTTP Server](https://httpd.apache.org/), you need to create a `.htaccess` file in the `public` folder that looks like this:\n\n```\n    Options -MultiViews\n    RewriteEngine On\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteRule ^ index.html [QSA,L]\n```\n\nIt will get copied to the `build` folder when you run `npm run build`.\n\nIf you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow [this Stack Overflow answer](https://stackoverflow.com/a/41249464/4878474).\n\nNow requests to `/todos/42` will be handled correctly both in development and in production.\n\nOn a production build, and in a browser that supports [service workers](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers),\nthe service worker will automatically handle all navigation requests, like for\n`/todos/42`, by serving the cached copy of your `index.html`. This\nservice worker navigation routing can be configured or disabled by\n[`eject`ing](#npm-run-eject) and then modifying the\n[`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string)\nand [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp)\noptions of the `SWPrecachePlugin` [configuration](../config/webpack.config.prod.js).\n\n### Building for Relative Paths\n\nBy default, Create React App produces a build assuming your app is hosted at the server root.<br>\nTo override this, specify the `homepage` in your `package.json`, for example:\n\n```js\n  \"homepage\": \"http://mywebsite.com/relativepath\",\n```\n\nThis will let Create React App correctly infer the root path to use in the generated HTML file.\n\n**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.<br>\nMore information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>\n<br>\nFor example:\n```js\n<BrowserRouter basename=\"/calendar\"/>\n<Link to=\"/today\"/> // renders <a href=\"/calendar/today\">\n```\n\n#### Serving the Same Build from Different Paths\n\n>Note: this feature is available with `react-scripts@0.9.0` and higher.\n\nIf you are not using the HTML5 `pushState` history API or not using client-side routing at all, it is unnecessary to specify the URL from which your app will be served. Instead, you can put this in your `package.json`:\n\n```js\n  \"homepage\": \".\",\n```\n\nThis will make sure that all the asset paths are relative to `index.html`. You will then be able to move your app from `http://mywebsite.com` to `http://mywebsite.com/relativepath` or even `http://mywebsite.com/relative/path` without having to rebuild it.\n\n### Azure\n\nSee [this](https://medium.com/@to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321) blog post on how to deploy your React app to [Microsoft Azure](https://azure.microsoft.com/).\n\n### Firebase\n\nSee [this](https://medium.com/@strid/host-create-react-app-on-azure-986bc40d5bf2#.pycfnafbg) blog post or [this](https://github.com/ulrikaugustsson/azure-appservice-static) repo for a way to use automatic deployment to Azure App Service.\n\n\nInstall the Firebase CLI if you haven’t already by running `npm install -g firebase-tools`. Sign up for a [Firebase account](https://console.firebase.google.com/) and create a new project. Run `firebase login` and login with your previous created Firebase account.\n\nThen run the `firebase init` command from your project’s root. You need to choose the **Hosting: Configure and deploy Firebase Hosting sites** and choose the Firebase project you created in the previous step. You will need to agree with `database.rules.json` being created, choose `build` as the public directory, and also agree to **Configure as a single-page app** by replying with `y`.\n\n```sh\n    === Project Setup\n\n    First, let's associate this project directory with a Firebase project.\n    You can create multiple project aliases by running firebase use --add,\n    but for now we'll just set up a default project.\n\n    ? What Firebase project do you want to associate as default? Example app (example-app-fd690)\n\n    === Database Setup\n\n    Firebase Realtime Database Rules allow you to define how your data should be\n    structured and when your data can be read from and written to.\n\n    ? What file should be used for Database Rules? database.rules.json\n    ✔  Database Rules for example-app-fd690 have been downloaded to database.rules.json.\n    Future modifications to database.rules.json will update Database Rules when you run\n    firebase deploy.\n\n    === Hosting Setup\n\n    Your public directory is the folder (relative to your project directory) that\n    will contain Hosting assets to uploaded with firebase deploy. If you\n    have a build process for your assets, use your build's output directory.\n\n    ? What do you want to use as your public directory? build\n    ? Configure as a single-page app (rewrite all urls to /index.html)? Yes\n    ✔  Wrote build/index.html\n\n    i  Writing configuration info to firebase.json...\n    i  Writing project information to .firebaserc...\n\n    ✔  Firebase initialization complete!\n```\n\nIMPORTANT: you need to set proper HTTP caching headers for `service-worker.js` file in `firebase.json` file or you will not be able to see changes after first deployment ([issue #2440](https://github.com/facebookincubator/create-react-app/issues/2440)). It should be added inside `\"hosting\"` key like next:\n\n```\n{\n  \"hosting\": {\n    ...\n    \"headers\": [\n      {\"source\": \"/service-worker.js\", \"headers\": [{\"key\": \"Cache-Control\", \"value\": \"no-cache\"}]}\n    ]\n    ...\n```\n\nNow, after you create a production build with `npm run build`, you can deploy it by running `firebase deploy`.\n\n```sh\n    === Deploying to 'example-app-fd690'...\n\n    i  deploying database, hosting\n    ✔  database: rules ready to deploy.\n    i  hosting: preparing build directory for upload...\n    Uploading: [==============================          ] 75%✔  hosting: build folder uploaded successfully\n    ✔  hosting: 8 files uploaded successfully\n    i  starting release process (may take several minutes)...\n\n    ✔  Deploy complete!\n\n    Project Console: https://console.firebase.google.com/project/example-app-fd690/overview\n    Hosting URL: https://example-app-fd690.firebaseapp.com\n```\n\nFor more information see [Add Firebase to your JavaScript Project](https://firebase.google.com/docs/web/setup).\n\n### GitHub Pages\n\n>Note: this feature is available with `react-scripts@0.2.0` and higher.\n\n#### Step 1: Add `homepage` to `package.json`\n\n**The step below is important!**<br>\n**If you skip it, your app will not deploy correctly.**\n\nOpen your `package.json` and add a `homepage` field for your project:\n\n```json\n  \"homepage\": \"https://myusername.github.io/my-app\",\n```\n\nor for a GitHub user page:\n\n```json\n  \"homepage\": \"https://myusername.github.io\",\n```\n\nCreate React App uses the `homepage` field to determine the root URL in the built HTML file.\n\n#### Step 2: Install `gh-pages` and add `deploy` to `scripts` in `package.json`\n\nNow, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub Pages.\n\nTo publish it at [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run:\n\n```sh\nnpm install --save gh-pages\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add gh-pages\n```\n\nAdd the following scripts in your `package.json`:\n\n```diff\n  \"scripts\": {\n+   \"predeploy\": \"npm run build\",\n+   \"deploy\": \"gh-pages -d build\",\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n```\n\nThe `predeploy` script will run automatically before `deploy` is run.\n\nIf you are deploying to a GitHub user page instead of a project page you'll need to make two\nadditional modifications:\n\n1. First, change your repository's source branch to be any branch other than **master**.\n1. Additionally, tweak your `package.json` scripts to push deployments to **master**:\n```diff\n  \"scripts\": {\n    \"predeploy\": \"npm run build\",\n-   \"deploy\": \"gh-pages -d build\",\n+   \"deploy\": \"gh-pages -b master -d build\",\n```\n\n#### Step 3: Deploy the site by running `npm run deploy`\n\nThen run:\n\n```sh\nnpm run deploy\n```\n\n#### Step 4: Ensure your project’s settings use `gh-pages`\n\nFinally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:\n\n<img src=\"http://i.imgur.com/HUjEr9l.png\" width=\"500\" alt=\"gh-pages branch setting\">\n\n#### Step 5: Optionally, configure the domain\n\nYou can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder.\n\n#### Notes on client-side routing\n\nGitHub Pages doesn’t support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions:\n\n* You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://reacttraining.com/react-router/web/api/Router) about different history implementations in React Router.\n* Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).\n\n<<<<<<< HEAD\n### Heroku\n=======\n#### Troubleshooting\n\n##### \"/dev/tty: No such a device or address\"\n\nIf, when deploying, you get `/dev/tty: No such a device or address` or a similar error, try the follwing:\n\n1. Create a new [Personal Access Token](https://github.com/settings/tokens)\n2. `git remote set-url origin https://<user>:<token>@github.com/<user>/<repo>` .\n3. Try `npm run deploy again`\n\n### [Heroku](https://www.heroku.com/)\n>>>>>>> dfbc71ce2ae07547a8544cce14a1a23fac99e071\n\nUse the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).<br>\nYou can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).\n\n#### Resolving Heroku Deployment Errors\n\nSometimes `npm run build` works locally but fails during deploy via Heroku. Following are the most common cases.\n\n##### \"Module not found: Error: Cannot resolve 'file' or 'directory'\"\n\nIf you get something like this:\n\n```\nremote: Failed to create a production build. Reason:\nremote: Module not found: Error: Cannot resolve 'file' or 'directory'\nMyDirectory in /tmp/build_1234/src\n```\n\nIt means you need to ensure that the lettercase of the file or directory you `import` matches the one you see on your filesystem or on GitHub.\n\nThis is important because Linux (the operating system used by Heroku) is case sensitive. So `MyDirectory` and `mydirectory` are two distinct directories and thus, even though the project builds locally, the difference in case breaks the `import` statements on Heroku remotes.\n\n##### \"Could not find a required file.\"\n\nIf you exclude or ignore necessary files from the package you will see a error similar this one:\n\n```\nremote: Could not find a required file.\nremote:   Name: `index.html`\nremote:   Searched in: /tmp/build_a2875fc163b209225122d68916f1d4df/public\nremote:\nremote: npm ERR! Linux 3.13.0-105-generic\nremote: npm ERR! argv \"/tmp/build_a2875fc163b209225122d68916f1d4df/.heroku/node/bin/node\" \"/tmp/build_a2875fc163b209225122d68916f1d4df/.heroku/node/bin/npm\" \"run\" \"build\"\n```\n\nIn this case, ensure that the file is there with the proper lettercase and that’s not ignored on your local `.gitignore` or `~/.gitignore_global`.\n\n### Netlify\n\n**To do a manual deploy to Netlify’s CDN:**\n\n```sh\nnpm install netlify-cli -g\nnetlify deploy\n```\n\nChoose `build` as the path to deploy.\n\n**To setup continuous delivery:**\n\nWith this setup Netlify will build and deploy when you push to git or open a pull request:\n\n1. [Start a new netlify project](https://app.netlify.com/signup)\n2. Pick your Git hosting service and select your repository\n3. Set `yarn build` as the build command and `build` as the publish directory\n4. Click `Deploy site`\n\n**Support for client-side routing:**\n\nTo support `pushState`, make sure to create a `public/_redirects` file with the following rewrite rules:\n\n```\n/*  /index.html  200\n```\n\nWhen you build the project, Create React App will place the `public` folder contents into the build output.\n\n### Now\n\n[now](https://zeit.co/now) offers a zero-configuration single-command deployment. You can use `now` to deploy your app for free.\n\n1. Install the `now` command-line tool either via the recommended [desktop tool](https://zeit.co/download) or via node with `npm install -g now`.\n\n2. Build your app by running `npm run build`.\n\n3. Move into the build directory by running `cd build`.\n\n4. Run `now --name your-project-name` from within the build directory. You will see a **now.sh** URL in your output like this:\n\n    ```\n    > Ready! https://your-project-name-tpspyhtdtk.now.sh (copied to clipboard)\n    ```\n\n    Paste that URL into your browser when the build is complete, and you will see your deployed app.\n\nDetails are available in [this article.](https://zeit.co/blog/unlimited-static)\n\n### S3 and CloudFront\n\nSee this [blog post](https://medium.com/@omgwtfmarc/deploying-create-react-app-to-s3-or-cloudfront-48dae4ce0af) on how to deploy your React app to Amazon Web Services [S3](https://aws.amazon.com/s3) and [CloudFront](https://aws.amazon.com/cloudfront/).\n\n### Surge\n\nInstall the Surge CLI if you haven’t already by running `npm install -g surge`. Run the `surge` command and log in you or create a new account.\n\nWhen asked about the project path, make sure to specify the `build` folder, for example:\n\n```sh\n       project path: /path/to/project/build\n```\n\nNote that in order to support routers that use HTML5 `pushState` API, you may want to rename the `index.html` in your build folder to `200.html` before deploying to Surge. This [ensures that every URL falls back to that file](https://surge.sh/help/adding-a-200-page-for-client-side-routing).\n\n## Advanced Configuration\n\nYou can adjust various development and production settings by setting environment variables in your shell or with [.env](#adding-development-environment-variables-in-env).\n\nVariable | Development | Production | Usage\n:--- | :---: | :---: | :---\nBROWSER | :white_check_mark: | :x: | By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a [browser](https://github.com/sindresorhus/opn#app) to override this behavior, or set it to `none` to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to `npm start` will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the `.js` extension.\nHOST | :white_check_mark: | :x: | By default, the development web server binds to `localhost`. You may use this variable to specify a different host.\nPORT | :white_check_mark: | :x: | By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port.\nHTTPS | :white_check_mark: | :x: | When set to `true`, Create React App will run the development server in `https` mode.\nPUBLIC_URL | :x: | :white_check_mark: | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application.\nCI | :large_orange_diamond: | :white_check_mark: | When set to `true`, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default.\nREACT_EDITOR | :white_check_mark: | :x: | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebookincubator/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely.\nCHOKIDAR_USEPOLLING | :white_check_mark: | :x: | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes.\nGENERATE_SOURCEMAP | :x: | :white_check_mark: | When set to `false`, source maps are not generated for a production build. This solves OOM issues on some smaller machines.\nNODE_PATH | :white_check_mark: |  :white_check_mark: | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`.\n\n## Troubleshooting\n\n### `npm start` doesn’t detect changes\n\nWhen you save a file while `npm start` is running, the browser should refresh with the updated code.<br>\nIf this doesn’t happen, try one of the following workarounds:\n\n* If your project is in a Dropbox folder, try moving it out.\n* If the watcher doesn’t see a file called `index.js` and you’re referencing it by the folder name, you [need to restart the watcher](https://github.com/facebookincubator/create-react-app/issues/1164) due to a Webpack bug.\n* Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in [“Adjusting Your Text Editor”](https://webpack.js.org/guides/development/#adjusting-your-text-editor).\n* If your project path contains parentheses, try moving the project to a path without them. This is caused by a [Webpack watcher bug](https://github.com/webpack/watchpack/issues/42).\n* On Linux and macOS, you might need to [tweak system settings](https://github.com/webpack/docs/wiki/troubleshooting#not-enough-watchers) to allow more watchers.\n* If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an `.env` file in your project directory if it doesn’t exist, and add `CHOKIDAR_USEPOLLING=true` to it. This ensures that the next time you run `npm start`, the watcher uses the polling mode, as necessary inside a VM.\n\nIf none of these solutions help please leave a comment [in this thread](https://github.com/facebookincubator/create-react-app/issues/659).\n\n### `npm test` hangs on macOS Sierra\n\nIf you run `npm test` and the console gets stuck after printing `react-scripts test --env=jsdom` to the console there might be a problem with your [Watchman](https://facebook.github.io/watchman/) installation as described in [facebookincubator/create-react-app#713](https://github.com/facebookincubator/create-react-app/issues/713).\n\nWe recommend deleting `node_modules` in your project and running `npm install` (or `yarn` if you use it) first. If it doesn't help, you can try one of the numerous workarounds mentioned in these issues:\n\n* [facebook/jest#1767](https://github.com/facebook/jest/issues/1767)\n* [facebook/watchman#358](https://github.com/facebook/watchman/issues/358)\n* [ember-cli/ember-cli#6259](https://github.com/ember-cli/ember-cli/issues/6259)\n\nIt is reported that installing Watchman 4.7.0 or newer fixes the issue. If you use [Homebrew](http://brew.sh/), you can run these commands to update it:\n\n```\nwatchman shutdown-server\nbrew update\nbrew reinstall watchman\n```\n\nYou can find [other installation methods](https://facebook.github.io/watchman/docs/install.html#build-install) on the Watchman documentation page.\n\nIf this still doesn’t help, try running `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist`.\n\nThere are also reports that *uninstalling* Watchman fixes the issue. So if nothing else helps, remove it from your system and try again.\n\n### `npm run build` exits too early\n\nIt is reported that `npm run build` can fail on machines with limited memory and no swap space, which is common in cloud environments. Even with small projects this command can increase RAM usage in your system by hundreds of megabytes, so if you have less than 1 GB of available memory your build is likely to fail with the following message:\n\n>  The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.\n\nIf you are completely sure that you didn't terminate the process, consider [adding some swap space](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04) to the machine you’re building on, or build the project locally.\n\n### `npm run build` fails on Heroku\n\nThis may be a problem with case sensitive filenames.\nPlease refer to [this section](#resolving-heroku-deployment-errors).\n\n### Moment.js locales are missing\n\nIf you use a [Moment.js](https://momentjs.com/), you might notice that only the English locale is available by default. This is because the locale files are large, and you probably only need a subset of [all the locales provided by Moment.js](https://momentjs.com/#multiple-locale-support).\n\nTo add a specific Moment.js locale to your bundle, you need to import it explicitly.<br>\nFor example:\n\n```js\nimport moment from 'moment';\nimport 'moment/locale/fr';\n```\n\nIf import multiple locales this way, you can later switch between them by calling `moment.locale()` with the locale name:\n\n```js\nimport moment from 'moment';\nimport 'moment/locale/fr';\nimport 'moment/locale/es';\n\n// ...\n\nmoment.locale('fr');\n```\n\nThis will only work for locales that have been explicitly imported before.\n\n### `npm run build` fails to minify\n\nYou may occasionally find a package you depend on needs compiled or ships code for a non-browser environment.<br>\nThis is considered poor practice in the ecosystem and does not have an escape hatch in Create React App.<br>\n<br>\nTo resolve this:\n1. Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled (retaining ES6 Modules).\n2. Fork the package and publish a corrected version yourself.\n3. If the dependency is small enough, copy it to your `src/` folder and treat it as application code.\n\nIn the future, we might start automatically compiling incompatible third-party modules, but it is not currently supported. This approach would also slow down the production builds.\n\n## Alternatives to Ejecting\n\n[Ejecting](#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to *fork* `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebookincubator/create-react-app/issues/682).\n\n## Something Missing?\n\nIf you have ideas for more “How To” recipes that should be on this page, [let us know](https://github.com/facebookincubator/create-react-app/issues) or [contribute some!](https://github.com/facebookincubator/create-react-app/edit/master/packages/react-scripts/template/README.md)\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/package.json",
    "content": "{\n  \"name\": \"react-app-ts\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"dependencies\": {\n    \"react\": \"^16.3.2\",\n    \"react-dom\": \"^16.3.2\",\n    \"react-loadable\": \"^5.3.1\",\n    \"react-router\": \"^4.2.0\",\n    \"react-router-dom\": \"^4.2.2\",\n    \"react-scripts-ts\": \"2.15.1\"\n  },\n  \"scripts\": {\n    \"start\": \"react-scripts-ts start\",\n    \"build\": \"react-scripts-ts build\",\n    \"test\": \"react-scripts-ts test --env=jsdom\",\n    \"eject\": \"react-scripts-ts eject\"\n  },\n  \"devDependencies\": {\n    \"@types/jest\": \"^22.2.3\",\n    \"@types/node\": \"^9.6.6\",\n    \"@types/react\": \"^16.3.12\",\n    \"@types/react-dom\": \"^16.0.5\",\n    \"@types/react-loadable\": \"^5.3.4\",\n    \"@types/react-router\": \"^4.0.24\",\n    \"@types/react-router-dom\": \"^4.2.6\",\n    \"typescript\": \"^2.8.3\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n    <meta name=\"theme-color\" content=\"#000000\">\n    <!--\n      manifest.json provides metadata used when your web app is added to the\n      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\">\n    <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n    <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n    <title>mlx</title>\n  </head>\n  <body>\n    <noscript>\n      You need to enable JavaScript to run this app.\n    </noscript>\n    <div id=\"root\"></div>\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/App.css",
    "content": ".App {\n  text-align: center;\n}\n\n.App-logo {\n  animation: App-logo-spin infinite 20s linear;\n  height: 80px;\n}\n\n.App-header {\n  background-color: #222;\n  height: 150px;\n  padding: 20px;\n  color: white;\n}\n\n.App-title {\n  font-size: 1.5em;\n}\n\n.App-intro {\n  font-size: large;\n}\n\n@keyframes App-logo-spin {\n  from { transform: rotate(0deg); }\n  to { transform: rotate(360deg); }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/App.tsx",
    "content": "import createBrowserHistory from 'history/createBrowserHistory';\nimport * as React from 'react';\nimport { Redirect, Route, Router, Switch } from 'react-router';\nimport { Link } from 'react-router-dom';\nimport './App.css';\nimport { AsyncComponent } from './LazyRoute';\n\nconst history = createBrowserHistory();\n\nclass App extends React.Component {\n  public render() {\n    return (\n      <Router history={history}>\n        <div className=\"App\">\n          <Link to=\"/intro\">Intro</Link>\n          <Link to=\"/main\">Main</Link>\n          <div>\n            <Switch>\n              <Redirect exact={true} from=\"/\" to=\"/intro\" />\n              <Route path=\"/intro\" component={AsyncComponent(() => import('./intro/Intro'))} />\n              <Route path=\"/main\" component={AsyncComponent(() => import('./main/Main'))} />\n            </Switch>\n          </div>\n        </div>\n      </Router>\n    );\n  }\n}\n\nexport default App;\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/LazyRoute.tsx",
    "content": "import * as React from 'react';\nimport * as Loadable from 'react-loadable';\n\nconst loading = ({ isLoading, error }: { isLoading: boolean; error: Error }) => {\n  if (isLoading) {\n    return <div>Loading...</div>;\n  } else if (error) {\n    return <div>Sorry, there was a problem loading the page.</div>;\n  } else {\n    return null;\n  }\n};\n\nexport const AsyncComponent = (loader: any) => Loadable({ loader, loading });\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/index.css",
    "content": "body {\n  margin: 0;\n  padding: 0;\n  font-family: sans-serif;\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/index.tsx",
    "content": "import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport App from './App';\nimport './index.css';\nimport registerServiceWorker from './registerServiceWorker';\n\nReactDOM.render(\n  <App />,\n  document.getElementById('root') as HTMLElement\n);\nregisterServiceWorker();\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/intro/Intro.tsx",
    "content": "import * as React from 'react';\nimport { Switch } from 'react-router';\n\nexport default class Intro extends React.Component {\n  public render() {\n    return (\n      <>\n        <p>Intro</p>\n        <Switch>\n          {/* <Route path=\"/intro/login\" component={AsyncComponent(() => import('./login/Login'))} />\n          <Route path=\"/intro/parent\" component={AsyncComponent(() => import('./parent/Parent'))} /> */}\n        </Switch>\n      </>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/main/Main.tsx",
    "content": "import * as React from 'react';\nimport { Route, Switch } from 'react-router';\nimport { Link } from 'react-router-dom';\nimport { AsyncComponent } from '../LazyRoute';\nimport Kid from './kid/Kid';\n\nexport default class Main extends React.Component {\n  public render() {\n    return (\n      <>\n        <>\n          <Link to=\"/main/kid\">Kid</Link>\n          <Link to=\"/main/parent\">Parent</Link>\n        </>\n        <p>Main</p>\n        <Switch>\n          <Route path=\"/main/kid\" component={Kid} />\n          <Route path=\"/main/parent\" component={AsyncComponent(() => import('./parent/Parent'))} />\n        </Switch>\n      </>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/main/kid/Kid.tsx",
    "content": "import * as React from 'react';\n\nexport default class Kid extends React.Component {\n  public render() {\n    return (\n      <>\n        <p>Kid</p>\n      </>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/main/parent/Parent.tsx",
    "content": "import * as React from 'react';\n\nexport default class Parent extends React.Component {\n  public render() {\n    return (\n      <>\n        <p>Parent</p>\n      </>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/src/registerServiceWorker.ts",
    "content": "// tslint:disable:no-console\n// In production, we register a service worker to serve assets from local cache.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on the 'N+1' visit to a page, since previously\n// cached resources are updated in the background.\n\n// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.\n// This link also includes instructions on opting out of this behavior.\n\nconst isLocalhost = Boolean(\n  window.location.hostname === 'localhost' ||\n    // [::1] is the IPv6 localhost address.\n    window.location.hostname === '[::1]' ||\n    // 127.0.0.1/8 is considered localhost for IPv4.\n    window.location.hostname.match(\n      /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n    )\n);\n\nexport default function register() {\n  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n    // The URL constructor is available in all browsers that support SW.\n    const publicUrl = new URL(\n      process.env.PUBLIC_URL!,\n      window.location.toString()\n    );\n    if (publicUrl.origin !== window.location.origin) {\n      // Our service worker won't work if PUBLIC_URL is on a different origin\n      // from what our page is served on. This might happen if a CDN is used to\n      // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374\n      return;\n    }\n\n    window.addEventListener('load', () => {\n      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n      if (isLocalhost) {\n        // This is running on localhost. Lets check if a service worker still exists or not.\n        checkValidServiceWorker(swUrl);\n\n        // Add some additional logging to localhost, pointing developers to the\n        // service worker/PWA documentation.\n        navigator.serviceWorker.ready.then(() => {\n          console.log(\n            'This web app is being served cache-first by a service ' +\n              'worker. To learn more, visit https://goo.gl/SC7cgQ'\n          );\n        });\n      } else {\n        // Is not local host. Just register service worker\n        registerValidSW(swUrl);\n      }\n    });\n  }\n}\n\nfunction registerValidSW(swUrl: string) {\n  navigator.serviceWorker\n    .register(swUrl)\n    .then(registration => {\n      registration.onupdatefound = () => {\n        const installingWorker = registration.installing;\n        if (installingWorker) {\n          installingWorker.onstatechange = () => {\n            if (installingWorker.state === 'installed') {\n              if (navigator.serviceWorker.controller) {\n                // At this point, the old content will have been purged and\n                // the fresh content will have been added to the cache.\n                // It's the perfect time to display a 'New content is\n                // available; please refresh.' message in your web app.\n                console.log('New content is available; please refresh.');\n              } else {\n                // At this point, everything has been precached.\n                // It's the perfect time to display a\n                // 'Content is cached for offline use.' message.\n                console.log('Content is cached for offline use.');\n              }\n            }\n          };\n        }\n      };\n    })\n    .catch(error => {\n      console.error('Error during service worker registration:', error);\n    });\n}\n\nfunction checkValidServiceWorker(swUrl: string) {\n  // Check if the service worker can be found. If it can't reload the page.\n  fetch(swUrl)\n    .then(response => {\n      // Ensure service worker exists, and that we really are getting a JS file.\n      if (\n        response.status === 404 ||\n        response.headers.get('content-type')!.indexOf('javascript') === -1\n      ) {\n        // No service worker found. Probably a different app. Reload the page.\n        navigator.serviceWorker.ready.then(registration => {\n          registration.unregister().then(() => {\n            window.location.reload();\n          });\n        });\n      } else {\n        // Service worker found. Proceed as normal.\n        registerValidSW(swUrl);\n      }\n    })\n    .catch(() => {\n      console.log(\n        'No internet connection found. App is running in offline mode.'\n      );\n    });\n}\n\nexport function unregister() {\n  if ('serviceWorker' in navigator) {\n    navigator.serviceWorker.ready.then(registration => {\n      registration.unregister();\n    });\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"outDir\": \"build/dist\",\n    \"module\": \"esnext\",\n    \"target\": \"es5\",\n    \"baseUrl\": \".\",\n    \"lib\": [\"es6\", \"dom\"],\n    \"sourceMap\": true,\n    \"allowJs\": true,\n    \"jsx\": \"react\",\n    \"moduleResolution\": \"node\",\n    \"rootDir\": \"src\",\n    \"forceConsistentCasingInFileNames\": true,\n    \"noImplicitReturns\": true,\n    \"noImplicitThis\": true,\n    \"noImplicitAny\": true,\n    \"strictNullChecks\": true,\n    \"suppressImplicitAnyIndexErrors\": true,\n    \"noUnusedLocals\": true\n  },\n  \"exclude\": [\"node_modules\", \"build\", \"scripts\", \"acceptance-tests\", \"webpack\", \"jest\", \"src/setupTests.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/tsconfig.test.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"module\": \"commonjs\"\n  }\n}"
  },
  {
    "path": "packages/guess-parser/test/fixtures/react-app-ts/tslint.json",
    "content": "{\n  \"extends\": [\"tslint:recommended\", \"tslint-react\", \"tslint-config-prettier\"],\n  \"linterOptions\": {\n    \"exclude\": [\n      \"config/**/*.js\",\n      \"node_modules/**/*.ts\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/guess-parser/test/fixtures/unknown/package.json",
    "content": "{\n  \"name\": \"unknown\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "packages/guess-parser/test/parser.spec.ts",
    "content": "import { parseRoutes } from '../';\nimport { RoutingModule } from '../../common/interfaces';\n\nconst angularFixtureRoutes = new Set<string>([\n  '/foo',\n  '/foo/baz',\n  '/foo/index',\n  '/foo/baz/index',\n  '/bar/baz',\n  '/qux',\n  '/library',\n  '/bar-simple',\n  '/foo/child1',\n  '/foo/foo-parent',\n  '/foo/foo-parent/child2',\n  '/eager',\n  '/eager/lazy',\n]);\n\nconst reactFixtureRoutes = new Set<string>(['/', '/intro', '/main', '/main/kid', '/main/parent']);\n\ndescribe('parseRoutes', () => {\n  describe('auto detect Angular', () => {\n    it('should recognize an Angular app and return the routes', () => {\n      let routes: RoutingModule[] = [];\n      expect(\n        () => (routes = parseRoutes('packages/guess-parser/test/fixtures/angular'))\n      ).not.toThrow();\n      expect(\n        routes.map(r => r.path).reduce((c, route) => c && angularFixtureRoutes.has(route), true)\n      ).toBe(true);\n      expect(routes.length).toEqual(angularFixtureRoutes.size);\n    });\n  });\n\n  describe('auto detect React', () => {\n    it('should recognize a React app and return the routes', () => {\n      let routes: RoutingModule[] = [];\n      expect(\n        () => (routes = parseRoutes('packages/guess-parser/test/fixtures/react-app'))\n      ).not.toThrow();\n      expect(\n        routes.map(r => r.path).reduce((c, route) => c && reactFixtureRoutes.has(route), true)\n      ).toEqual(true);\n      expect(routes.length).toEqual(reactFixtureRoutes.size);\n    });\n  });\n\n  describe('auto detect React TypeScript', () => {\n    it('should recognize a React TypeScript app and return the routes', () => {\n      let routes: RoutingModule[] = [];\n      expect(\n        () => (routes = parseRoutes('packages/guess-parser/test/fixtures/react-app-ts'))\n      ).not.toThrow();\n      expect(\n        routes.map(r => r.path).reduce((c, route) => c && reactFixtureRoutes.has(route), true)\n      ).toEqual(true);\n      expect(routes.length).toEqual(reactFixtureRoutes.size);\n    });\n  });\n\n  describe('unknown app', () => {\n    it('should throw when cannot recognize the app', () => {\n      expect(() => parseRoutes('packages/guess-parser/test/fixtures/unknown')).toThrow();\n    });\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/preact-jsx.spec.ts",
    "content": "import { parsePreactJSXRoutes } from '../src/preact';\n\nconst fixtureRoutes = new Set<string>(['/', '/info', '/home', '/profile/', '/profile/:user', '/about']);\n\ndescribe('Preact JavaScript parser', () => {\n  it('should parse an app', () => {\n    expect(() => parsePreactJSXRoutes('packages/guess-parser/test/fixtures/preact-app/src')).not.toThrow();\n  });\n\n  it('should discover all routes', () => {\n    const routes = parsePreactJSXRoutes('packages/guess-parser/test/fixtures/preact-app/src');\n    expect(routes).toBeInstanceOf(Array);\n    expect(routes.map(r => r.path).reduce((c, route) => c && fixtureRoutes.has(route), true)).toEqual(true);\n    expect(routes.length).toEqual(fixtureRoutes.size);\n    expect((routes.filter(r => !r.lazy).shift() as any).path).toEqual('/info');\n  });\n\n  it('should discover all lazy loaded routes', () => {\n    const routes = parsePreactJSXRoutes('packages/guess-parser/test/fixtures/preact-app/src');\n    expect(routes).toBeInstanceOf(Array);\n    expect(routes.filter(r => r.lazy).length).toEqual(5);\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/react-jsx.spec.ts",
    "content": "import { parseReactJSXRoutes } from '../src/react';\n\nconst fixtureRoutes = new Set<string>(['/', '/intro', '/main', '/main/kid', '/main/parent']);\n\ndescribe('React TypeScript parser', () => {\n  it('should parse an app', () => {\n    expect(() => parseReactJSXRoutes('packages/guess-parser/test/fixtures/react-app/src')).not.toThrow();\n  });\n\n  it('should produce routes', () => {\n    const routes = parseReactJSXRoutes('packages/guess-parser/test/fixtures/react-app/src');\n    expect(routes).toBeInstanceOf(Array);\n    expect(routes.map(r => r.path).reduce((c, route) => c && fixtureRoutes.has(route), true)).toEqual(true);\n    expect(routes.length).toEqual(fixtureRoutes.size);\n    expect(routes.filter(r => !r.lazy).shift()!.path).toEqual('/main/kid');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/test/react-tsx.spec.ts",
    "content": "import { parseReactTSXRoutes } from '../src/react';\n\nconst fixtureRoutes = new Set<string>(['/', '/intro', '/main', '/main/kid', '/main/parent']);\n\ndescribe('React TypeScript parser', () => {\n  it('should parse an app', () => {\n    expect(() => parseReactTSXRoutes('packages/guess-parser/test/fixtures/react-app-ts/tsconfig.json')).not.toThrow();\n  });\n\n  it('should produce routes', () => {\n    const routes = parseReactTSXRoutes('packages/guess-parser/test/fixtures/react-app-ts/tsconfig.json');\n    expect(routes).toBeInstanceOf(Array);\n    expect(routes.map(r => r.path).reduce((c, route) => c && fixtureRoutes.has(route), true)).toEqual(true);\n    expect(routes.length).toEqual(fixtureRoutes.size);\n    expect(routes.filter(r => !r.lazy).shift()!.path).toEqual('/main/kid');\n  });\n});\n"
  },
  {
    "path": "packages/guess-parser/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"module\": \"commonjs\",\n    \"sourceMap\": true,\n    \"declaration\": true,\n    \"experimentalDecorators\": true,\n    \"strict\": true,\n    \"outDir\": \"dist\",\n    \"downlevelIteration\": true,\n    \"lib\": [\"es2015\", \"esnext\", \"dom\"]\n  },\n  \"files\": [\"index.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-parser/webpack.config.js",
    "content": "module.exports = {\n  mode: 'production',\n  entry: './index.ts',\n  target: 'node',\n  output: {\n    filename: './guess-parser/index.js',\n    libraryTarget: 'umd'\n  },\n  optimization: {\n    minimize: false\n  },\n  externals: [/^(@|\\w{3}(?<!\\w:\\\\)).*$/i],\n  resolve: {\n    // Add `.ts` and `.tsx` as a resolvable extension.\n    extensions: ['.ts', '.js']\n  },\n  module: {\n    rules: [\n      // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`\n      { test: /\\.tsx?$/, loader: 'ts-loader' },\n      {\n        test: /\\.tpl$/,\n        use: 'raw-loader'\n      }\n    ]\n  }\n};\n"
  },
  {
    "path": "packages/guess-webpack/.gitignore",
    "content": "api/index.js\napi/index.d.ts\ncommon\n.next\n"
  },
  {
    "path": "packages/guess-webpack/.npmignore",
    "content": "node_modules\nsrc\ntest\nindex.ts\ntsconfig.json\nwebpack.config.js\n"
  },
  {
    "path": "packages/guess-webpack/README.md",
    "content": "# guess-webpack\n\nThis package exports the `GuessPlugin`\n\n## Quick start (webpack)\n\nInstall `GuessPlugin` - our webpack plugin:\n\n```js\nnpm i guess-webpack --save-dev\n```\n\nImport `GuessPlugin` to your webpack config:\n\n```js\nconst { GuessPlugin } = require('guess-webpack');\n```\n\nAdd this to the end of your webpack config:\n\n```js\nnew GuessPlugin({ GA: 'GOOGLE_ANALYTICS_VIEW_ID'});\n```\n\n## Usage\n\n```bash\nnpm i guess-webpack --save-dev\n```\n\nThis section introduces the configuration properties of the `GuessPlugin`\n\n## Basic Usage\n\nImport the `GuessPlugin`:\n\n```ts\nconst { GuessPlugin } = require('guess-webpack');\n```\n\nAdd the following snippet as last line in your webpack config file:\n\n```ts\nnew GuessPlugin({ GA: 'GA_VIEW_ID' });\n```\n\nWhere `GA_VIEW_ID` is the [Google Analytics view ID](https://ga-dev-tools.appspot.com/query-explorer/). The `guess-ga` plugin will extract report from Google Analytics for the last year. For custom period look at the section below.\n\nFinally, in your application use Guess.js as follows:\n\n```ts\nimport { guess } from 'guess-webpack/api';\n\nguess();\n/**\n {\n   '/foo': 0.1,\n   '/bar': 0.3,\n   '/baz': 0.6\n }\n */\n```\n\nIn the snippet above, we first import `guess` from `guess-webpack/api`. After that we invoke the `guess` function and it returns an object with keys pages in our application and values probabilities the user to visit the corresponding page.\n\nThis way, you can prefetch content associated with the pages which are likely to be visited on the next user navigation. There are plugins for popular frameworks which are going to do this for you! For examples look at the [demo section](#demos).\n\nFor further information on how to use `guess`, look at the \"Advanced Usage\" section below.\n\n## Advanced Usage\n\nThe `guess` function allows you to specify a few optional parameters:\n\n```ts\nimport { guess } from 'guess-webpack/api';\n\nguess('/current/route', ['/link-1', '/link-2', '/unavailable']);\n```\n\nThe first argument that we've passed to the function invocation above is a path. `guess` will return an object which contains the paths which are likely to be visited next from the path that we've specified. If we omit the first argument, `guess` will use `location.pathname`.\n\nThe second argument of `guess` is a whitelist of paths. The returned object from `guess` will contain only keys which are listed in this array.\n\nIf you skip the second argument of `guess` you'll receive an exhaustive list of routes which could be visited next.\n\n### Automatic Prefetching\n\nIn case you're interested in automating the process of prefetching of bundles in your application, you can use the `guess-webpack` package together with `guess-parser`:\n\n```ts\nimport { parseRoutes } from 'guess-parser';\nconst credentials = require('./credentials.json');\n\nGuessPlugin({\n  jwt: credentials,\n  GA: 'XXXXXX',\n  routeProvider() {\n    return parseRoutes('.');\n  },\n  runtime: {\n    delegate: false\n  }\n});\n```\n\nAt build time, the snippet above will first create mapping between paths and lazy-loaded JavaScript bundles. At runtime, while the user is navigating in the application a small runtime will invoke `guess` to make predictions for the pages which are likely to be visited next. At each step, Guess.js will pick the top paths and prefetch their corresponding bundles.\n\nKeep in mind that `parseRoutes` might not be able to properly create the mapping between the routes and the bundles in applications with very dynamic route definition, for example most React and Vue applications are not supported. For further information on `guess-parser` look at the [package's documentation](https://github.com/guess-js/guess/tree/master/packages/guess-parser).\n \nAlso, keep in mind that **authentication** with google (once a GA VIEW_ID is set) can be done by OAuth2 (chrome pop up) \n**OR** with a JWT token (like the example above) download as credentials.json by using: [guess-ga documentation](https://github.com/slavoroi/guess/tree/master/packages/guess-ga) and add it to .gitignore due to security reasons .\n\n### Custom Route Provider\n\nIn case Guess.js cannot manage to parse the routes of your application and create mapping to the corresponding lazy-loaded bundles, you can provide a custom route provider. It should have the following type:\n\n```ts\nexport type RouteProvider = () => Promise<RoutingModule[]>;\n```\n\nWhere `RoutingModule` has the following interface:\n\n```ts\nexport interface RoutingModule {\n  path: string;\n  modulePath: string;\n  parentModulePath: string | null;\n  lazy: boolean;\n}\n```\n\n### Custom report provider\n\nThe `reportProvider` configuration property of `GuessPlugin` is a function which returns promise that resolves to the following data structure:\n\n```ts\nexport interface PageTransitions {\n  [key: string]: number;\n}\n\nexport interface Report {\n  [key: string]: PageTransitions;\n}\n```\n\nHere's an example:\n\n```ts\n{\n  \"foo\": {\n    \"bar\": 5,\n    \"baz\" 2\n  },\n  \"bar\": {\n    \"baz\": 3\n  }\n}\n```\n\nThe meaning of the report above is:\n\n- There are two reported transitions from page `foo`:\n  - Transition to page `bar` which has occurred 5 times.\n  - Transition to page `baz` which has occurred 2 times.\n- There's one reported transition from page `bar`:\n  - Transition to `baz` which has occurred 3 times.\n\n## Demos\n\nA number of sample projects using `GuessPlugin` are available. These include:\n\n- [Gatsby Guess Wikipedia](https://github.com/guess-js/gatsby-guess) - a Wikipedia client built using Gatsby.js (the React static-site framework) and Guess.js. This is the closest example we have of a real-world demo application built using the project.\n- [`guess-js-react-demo`](https://github.com/mgechev/guess-js-react-demo) - a simple demo application using `GuessPlugin` and `create-react-app`\n- [`guess-js-angular-demo`](https://github.com/mgechev/guess-js-angular-demo) - a simple demo application using `GuessPlugin` and Angular CLI\n- [`guess-next`](https://github.com/mgechev/guess-next) - a sample application showing the integration between Next.js and Guess.js\n- [`guess-nuxt`](https://github.com/daliborgogic/guess-nuxt) - a sample application showing the integration between Nuxt.js and Guess.js\n\n**Note:** Predictive fetching relies heavily on the availability of data in a Google Analytics account to drive predictions. You may need to seed some data for this by navigating around your demo project to provide Guess with some early data to guide what to prefetch.\n\n## License\n\nMIT\n"
  },
  {
    "path": "packages/guess-webpack/api/index.ts",
    "content": "export const guess = (params: any) =>\n  ((typeof window === 'undefined' ? global : window) as any).__GUESS__.guess(params);\n"
  },
  {
    "path": "packages/guess-webpack/index.ts",
    "content": "export * from './src/guess-webpack';\n"
  },
  {
    "path": "packages/guess-webpack/package.json",
    "content": "{\n  \"name\": \"guess-webpack\",\n  \"version\": \"0.4.22\",\n  \"description\": \"Webpack plugins for the Machine Learning-driven bundler\",\n  \"main\": \"dist/guess-webpack/main.js\",\n  \"types\": \"dist/guess-webpack/index.d.ts\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/guess-js/guess\"\n  },\n  \"keywords\": [\n    \"bundling\",\n    \"webpack\",\n    \"ml\",\n    \"ai\",\n    \"analytics\",\n    \"recommendation\"\n  ],\n  \"author\": \"Minko Gechev <mgechev@gmail.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/guess-js/guess/issues\"\n  },\n  \"homepage\": \"https://github.com/guess-js/guess#readme\",\n  \"dependencies\": {\n    \"chalk\": \"^2.4.2\",\n    \"copy-webpack-plugin\": \"^5.0.0\",\n    \"flat-cache\": \"^3.0.0\",\n    \"google-oauth2-node\": \"0.0.3\",\n    \"googleapis\": \"^67.0.0\",\n    \"guess-ga\": \"^0.4.20\",\n    \"lodash.template\": \"^4.4.0\",\n    \"rollup\": \"^2.0.0\",\n    \"rollup-plugin-hypothetical\": \"^2.1.0\",\n    \"rollup-plugin-typescript\": \"^1.0.0\",\n    \"table\": \"^5.4.1\",\n    \"webpack\": \"^4.14.0\"\n  },\n  \"files\": [\n    \"dist\",\n    \"api\"\n  ],\n  \"jest\": {\n    \"transform\": {\n      \"^.+\\\\.tsx?$\": \"ts-jest\"\n    },\n    \"testRegex\": \"(/test/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$\",\n    \"moduleFileExtensions\": [\n      \"ts\",\n      \"tsx\",\n      \"js\",\n      \"jsx\",\n      \"json\",\n      \"node\"\n    ]\n  },\n  \"devDependencies\": {\n    \"@types/chalk\": \"2.2.0\",\n    \"@types/table\": \"5.0.0\",\n    \"ts-loader\": \"7.0.0\",\n    \"typescript\": \"4.5.4\"\n  },\n  \"scripts\": {\n    \"build\": \"webpack\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/src/aot/aot.tpl",
    "content": "import { initialize } from './guess-aot';\n\n(function(g, thresholds, base) {\n  initialize(g, thresholds, base);\n})(typeof window === 'undefined' ? global : window, <%= THRESHOLDS %>, '<%= BASE_PATH %>');\n"
  },
  {
    "path": "packages/guess-webpack/src/aot/guess-aot.ts",
    "content": "import { PrefetchConfig } from '../declarations';\n\ntype ConnectionEffectiveType = '4g' | '3g' | '2g' | 'slow-2g';\n\nconst support = (feature: string) => {\n  if (typeof document === 'undefined') {\n    return false;\n  }\n  const fakeLink = document.createElement('link') as any;\n  try {\n    if (fakeLink.relList && typeof fakeLink.relList.supports === 'function') {\n      return fakeLink.relList.supports(feature);\n    }\n  } catch (err) {\n    return false;\n  }\n};\n\nconst linkPrefetchStrategy = (url: string) => {\n  if (typeof document === 'undefined') {\n    return;\n  }\n  const link = document.createElement('link');\n  link.setAttribute('rel', 'prefetch');\n  link.setAttribute('href', url);\n  const parentElement =\n    document.head || document.getElementsByName('script')[0].parentNode;\n  parentElement.appendChild(link);\n};\n\nconst supportedPrefetchStrategy = support('prefetch')\n  ? linkPrefetchStrategy\n  : (url: string) => import(url);\n\nconst preFetched: { [key: string]: boolean } = {};\n\nconst prefetch = (basePath: string, url: string) => {\n  if (basePath) {\n    url = basePath + '/' + url;\n  }\n  if (preFetched[url]) {\n    return;\n  }\n  preFetched[url] = true;\n  supportedPrefetchStrategy(url);\n};\n\nconst getConnection = (global: any): ConnectionEffectiveType => {\n  if (!global.navigator || !global.navigator || !global.navigator.connection) {\n    return '3g';\n  }\n  return global.navigator.connection.effectiveType || '3g';\n};\n\nexport const initialize = (g: any, t: PrefetchConfig, base?: string) => {\n  const idle = g.requestIdleCallback || ((cb: Function) => setTimeout(cb, 0));\n  base = base || '';\n  g.__GUESS__ = {};\n  g.__GUESS__.p = (...p: [number, string][]) => {\n    idle(() => {\n      const speed = getConnection(g);\n      for (let i = 0; i < p.length; i++) {\n        const c = p[i];\n        if (c[0] >= t[speed]) {\n          for (let j = 1; j < c.length; j++) {\n            prefetch(base as string, c[j] as string);\n          }\n        }\n      }\n    });\n  };\n};\n"
  },
  {
    "path": "packages/guess-webpack/src/asset-observer.ts",
    "content": "export interface Asset {\n  name: string;\n  callback: () => void;\n}\n\nexport type AssetCallback = (asset: Asset) => void;\n\nexport class AssetObserver {\n  buffer: Asset[] = [];\n  private _callbacks: AssetCallback[] = [];\n\n  onAsset(cb: AssetCallback) {\n    this._callbacks.push(cb);\n  }\n\n  addAsset(asset: Asset) {\n    this._callbacks.forEach(cb => cb(asset));\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/src/compress.ts",
    "content": "import { CompressedPrefetchGraph, CompressedGraphMap, PrefetchGraph } from './declarations';\n\nexport const compressGraph = (input: PrefetchGraph, precision: number) => {\n  let currentChunk = 0;\n  let currentRoute = 0;\n  const chunks: string[] = [];\n  const routes: string[] = [];\n  const chunkToID: { [chunk: string]: number } = {};\n  const routeToID: { [route: string]: number } = {};\n  const graphMap: CompressedGraphMap = { chunks, routes };\n  const graph: CompressedPrefetchGraph = [];\n  Object.keys(input).forEach(route => {\n    if (routeToID[route] === undefined) {\n      routes[currentRoute] = route;\n      routeToID[route] = currentRoute++;\n    }\n    graph[routeToID[route]] = [];\n    input[route].forEach(n => {\n      if (routeToID[n.route] === undefined) {\n        routes[currentRoute] = n.route;\n        routeToID[n.route] = currentRoute++;\n      }\n      if (chunkToID[n.chunk] === undefined) {\n        chunks[currentChunk] = n.chunk;\n        chunkToID[n.chunk] = currentChunk++;\n      }\n      graph[routeToID[route]].push([\n        parseFloat(n.probability.toFixed(precision)),\n        routeToID[n.route],\n        chunkToID[n.chunk]\n      ]);\n    });\n  });\n  return { graph, graphMap };\n};\n"
  },
  {
    "path": "packages/guess-webpack/src/declarations.ts",
    "content": "import { Graph, RoutingModule } from '../../common/interfaces';\n\nexport enum Mode {\n  Angular = 'angular',\n  ReactTSX = 'react-tsx',\n  ReactJSX = 'react-jsx',\n  PreactJSX = 'preact-jsx',\n  Gatsby = 'gatsby',\n  Auto = 'auto'\n}\n\nexport type RouteProvider = () => Promise<RoutingModule[]>;\n\nexport type Cluster = string[];\nexport type Clusters = Cluster[];\n\nexport type ClusteringAlgorithm = (graph: Graph, modules: Module[], totalClusters: number) => Clusters;\n\nexport interface Module {\n  modulePath: string;\n  parentModulePath: string;\n}\n\nexport type CompressedPrefetchGraph = number[][][];\n\nexport interface CompressedGraphMap {\n  chunks: string[];\n  routes: string[];\n}\n\nexport interface PrefetchConfig {\n  '4g': number;\n  '3g': number;\n  '2g': number;\n  'slow-2g': number;\n}\n\nexport interface PrefetchPluginConfig {\n  debug?: boolean;\n  data: Graph;\n  basePath: string;\n  prefetchConfig?: PrefetchConfig;\n  routes: RoutingModule[];\n  delegate: boolean;\n}\n\nexport interface BundleEntryNeighbor {\n  route: string;\n  probability: number;\n  file: string;\n}\n\nexport interface BundleEntryGraph {\n  [route: string]: BundleEntryNeighbor[];\n}\n\nexport interface PrefetchNeighbor {\n  route: string;\n  probability: number;\n  chunk: string;\n}\n\nexport interface PrefetchGraph {\n  [route: string]: PrefetchNeighbor[];\n}\n\nexport interface PrefetchAotNeighbor {\n  probability: number;\n  chunks: string[];\n}\n\nexport interface FileChunkMap {\n  [path: string]: { file: string, deps: Set<string> } | null\n}\n\nexport interface PrefetchAotGraph {\n  [route: string]: PrefetchAotNeighbor[];\n}\n\nexport interface PrefetchAotPluginConfig {\n  debug?: boolean;\n  data: Graph;\n  base: string;\n  prefetchConfig?: PrefetchConfig;\n  routes: RoutingModule[];\n}\n"
  },
  {
    "path": "packages/guess-webpack/src/ga-provider.ts",
    "content": "import { auth as oauth2 } from 'google-oauth2-node';\nimport { RoutingModule, Period, Graph } from '../../common/interfaces';\nimport { fetch } from 'guess-ga';\n\nconst clientId = '329457372673-hda3mp2vghisfobn213jpj8ck1uohi2d.apps.googleusercontent.com';\nconst clientSecret = '4camaoQPOz9edR-Oz19vg-lN';\nconst scope = 'https://www.googleapis.com/auth/analytics.readonly';\nconst year = 365 * 24 * 60 * 60 * 1000;\n\nconst flatCache = require('flat-cache');\nconst cache = flatCache.load('guess-plugin');\n\nconst id = <T>(r: T) => r;\n\nexport interface Config {\n  jwt?: any;\n  viewId: string;\n  routes: RoutingModule[];\n  formatter?: (path: string) => string;\n  period?: Period;\n}\n\nconst serializePeriod = (period: Period) => `${period.startDate.getTime()}-${period.endDate.getTime()}`;\n\nexport const getReport = (c: Config): Promise<Graph> => {\n  const period = c.period || { startDate: new Date(Date.now() - year), endDate: new Date() };\n  const key = `${c.viewId}-${serializePeriod(period)}`;\n  const report = cache.getKey(key);\n  if (report) {\n    return Promise.resolve(JSON.parse(report));\n  }\n  const { google } = require('googleapis');\n  let client: Promise<{}>;\n  if (!c.jwt) {\n    client = oauth2({\n      clientId,\n      clientSecret,\n      scope\n    }).then((token: any) => {\n      const oauth2Client = new google.auth.OAuth2();\n      oauth2Client.setCredentials(token);\n      return oauth2Client;\n    });\n  } else {\n    client = Promise.resolve(new google.auth.JWT(c.jwt.client_email, null, c.jwt.private_key, [scope], null));\n  }\n  return client\n    .then((auth: any) => {\n      return fetch({\n        viewId: c.viewId,\n        auth,\n        period: period,\n        routes: c.routes.map(r => r.path),\n        formatter: c.formatter || id\n      });\n    })\n    .then(g => {\n      cache.setKey(key, JSON.stringify(g));\n      cache.save();\n      return g;\n    });\n};\n"
  },
  {
    "path": "packages/guess-webpack/src/guess-webpack.ts",
    "content": "import { RouteProvider, PrefetchConfig } from './declarations';\nimport { PrefetchPlugin } from './prefetch-plugin';\nimport { PrefetchAotPlugin } from './prefetch-aot-plugin';\nimport { Graph, RoutingModule, Period } from '../../common/interfaces';\nimport { getReport } from './ga-provider';\nimport { AssetObserver } from './asset-observer';\n\nexport interface RuntimeConfig {\n  /** @internal */\n  base?: string;\n  /** @internal */\n  prefetchConfig?: PrefetchConfig;\n  /** @internal */\n  delegate: boolean;\n}\n\nexport interface GuessPluginConfig {\n  GA?: string;\n  jwt?: any;\n  period?: Period;\n  debug?: boolean;\n  reportProvider?: (...args: any[]) => Promise<Graph>;\n\n  /** @internal */\n  routeProvider?: RouteProvider | boolean;\n  /** @internal */\n  routeFormatter?: (path: string) => string;\n  /** @internal */\n  runtime?: RuntimeConfig;\n}\n\nconst extractRoutes = (config: GuessPluginConfig): Promise<RoutingModule[]> => {\n  if (config.routeProvider === false || config.routeProvider === undefined) {\n    return Promise.resolve([]);\n  }\n  if (typeof config.routeProvider === 'function') {\n    return Promise.resolve(config.routeProvider());\n  }\n  throw new Error(\n    'The routeProvider should be either set to false or a function which returns the routes in the app.'\n  );\n};\n\nexport class GuessPlugin {\n  constructor(private _config: GuessPluginConfig) {\n    if ((this._config.GA || this._config.jwt) && this._config.reportProvider) {\n      throw new Error(\n        'Only a single report provider is allowed. You have specified `GA` and/or ' +\n          'a GA authentication provider (used by Google Analytics provider) and `reportProvider`'\n      );\n    }\n    if (!this._config.GA && !this._config.reportProvider) {\n      throw new Error(\n        'Report provider not specified. You should specify either a `GA` (Google Analytics view ID) or `reportProvider`.'\n      );\n    }\n  }\n\n  apply(compiler: any) {\n    const assetObserver = new AssetObserver();\n    if (!this._config.runtime || !this._config.runtime.delegate) {\n      compiler.hooks.assetEmitted.tapAsync(\n        'GuessPlugin',\n        (file: string, _: any, callback: any) =>\n          assetObserver.addAsset({\n            name: file,\n            callback\n          })\n      );\n    }\n\n    compiler.hooks.emit.tapAsync(\n      {\n        stage: 0,\n        name: 'GuessPlugin'\n      },\n      (compilation: any, cb: any) => this._execute(compiler, compilation, assetObserver, cb)\n    );\n  }\n\n  private _execute(compiler: any, compilation: any, assetObserver: AssetObserver, cb: any) {\n    extractRoutes(this._config).then(async routes => {\n      try {\n        const data = await this._getReport(routes);\n        return this._executePrefetchPlugin(\n          data,\n          routes,\n          compiler,\n          compilation,\n          assetObserver,\n          cb\n        );\n      } catch (err) {\n        console.error(err);\n        cb();\n        throw err;\n      }\n    });\n  }\n\n  private _getReport(routes: RoutingModule[]): Promise<Graph> {\n    if (this._config.GA) {\n      return getReport({\n        jwt: this._config.jwt,\n        viewId: this._config.GA,\n        routes,\n        formatter: this._config.routeFormatter,\n        period: this._config.period\n      });\n    } else {\n      return this._config.reportProvider!();\n    }\n  }\n\n  private _executePrefetchPlugin(\n    data: Graph,\n    routes: RoutingModule[],\n    compiler: any,\n    compilation: any,\n    assetObserver: AssetObserver,\n    cb: any\n  ) {\n    const { runtime } = this._config;\n    if (runtime && runtime.delegate) {\n      new PrefetchPlugin({\n        data,\n        debug: this._config.debug,\n        basePath: runtime\n          ? runtime.base === undefined\n            ? ''\n            : runtime.base\n          : '',\n        prefetchConfig: runtime ? runtime.prefetchConfig : undefined,\n        routes,\n        delegate: runtime ? !!runtime.delegate : true\n      }).execute(compilation, cb);\n    } else {\n      new PrefetchAotPlugin({\n        data,\n        debug: this._config.debug,\n        base: runtime\n          ? runtime.base === undefined\n            ? ''\n            : runtime.base\n          : '',\n        prefetchConfig: runtime ? runtime.prefetchConfig : undefined,\n        routes\n      }).execute(compiler, compilation, assetObserver, cb);\n    }\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/src/prefetch-aot-plugin.ts",
    "content": "import { readFileSync, writeFile } from 'fs';\nimport {\n  PrefetchAotGraph,\n  PrefetchAotNeighbor,\n  PrefetchAotPluginConfig,\n  FileChunkMap\n} from './declarations';\n\nimport { join } from 'path';\nimport chalk from 'chalk';\nimport {\n  buildMap,\n  defaultPrefetchConfig,\n  getCompilationMapping,\n  stripExtension\n} from './utils';\nimport { Logger, LogLevel } from '../../common/logger';\nimport { AssetObserver, Asset } from './asset-observer';\n\nconst template = require('lodash.template');\nconst { table } = require('table');\n\nconst alterChunk = (\n  compiler: any,\n  chunkName: string,\n  original: string,\n  toAlter: string,\n  toBundle: boolean\n): Promise<void> => {\n  const promise: Promise<string> = !toBundle\n    ? Promise.resolve<string>(toAlter)\n    : new Promise<string>((resolve, reject) => {\n        const MemoryFileSystem = require('memory-fs');\n        const memoryFs = new MemoryFileSystem();\n\n        memoryFs.mkdirpSync('/src');\n        memoryFs.writeFileSync('/src/index.js', toAlter, 'utf-8');\n        memoryFs.writeFileSync(\n          '/src/guess-aot.js',\n          readFileSync(join(__dirname, 'guess-aot.js')).toString(),\n          'utf-8'\n        );\n\n        const inMemoryCompiler = require('webpack')({\n          context: '/src/',\n          mode: 'production',\n          entry: './index.js',\n          target: 'node',\n          output: {\n            filename: './output.js'\n          }\n        });\n\n        inMemoryCompiler.inputFileSystem = memoryFs;\n        inMemoryCompiler.outputFileSystem = memoryFs;\n        inMemoryCompiler.resolvers.normal.fileSystem = memoryFs;\n        inMemoryCompiler.resolvers.context.fileSystem = memoryFs;\n\n        inMemoryCompiler.run((err: any, stats: any) => {\n          if (err) {\n            reject();\n            throw err;\n          }\n          resolve(stats.compilation.assets['./output.js'].source() as string);\n        });\n      });\n\n  return promise.then((output: string) => {\n    return new Promise<void>((resolve, reject) => {\n      writeFile(\n        join(compiler.outputPath, chunkName),\n        original + '\\n' + output,\n        err => {\n          if (err) {\n            reject(err);\n          }\n          resolve();\n        }\n      );\n    });\n  });\n};\n\nexport class PrefetchAotPlugin {\n  private logger = new Logger();\n  constructor(private _config: PrefetchAotPluginConfig) {\n    if (!_config.data) {\n      throw new Error('Page graph not provided');\n    }\n    if (this._config.debug) {\n      this.logger.setLevel(LogLevel.DEBUG);\n    }\n  }\n\n  execute(\n    compiler: any,\n    compilation: any,\n    assetObserver: AssetObserver,\n    callback: any\n  ) {\n    this.logger.debug('Inside PrefetchAotPlugin');\n\n    let mainName: string | null = null;\n    let fileChunk: FileChunkMap = {};\n\n    try {\n      const res = getCompilationMapping(\n        compilation,\n        new Set(this._config.routes.map(r => stripExtension(r.modulePath))),\n        this.logger\n      );\n      mainName = res.mainName;\n      fileChunk = res.fileChunk;\n    } catch (e) {\n      callback();\n      this.logger.error(e);\n      return;\n    }\n\n    this.logger.debug(\n      'Mapping between chunk name and entry point',\n      JSON.stringify(fileChunk, null, 2)\n    );\n\n    if (!mainName) {\n      callback();\n      throw new Error('Cannot find the main chunk of the application');\n    }\n\n    const newConfig: PrefetchAotGraph = {};\n    const chunkRoute: { [chunk: string]: string } = {};\n    const initialGraph = buildMap(\n      this._config.routes.map(r => {\n        return {\n          ...r,\n          modulePath: stripExtension(r.modulePath),\n          parentModulePath: r.parentModulePath\n            ? stripExtension(r.parentModulePath)\n            : null\n        };\n      }),\n      this._config.data,\n      this.logger,\n      !!this._config.debug\n    );\n\n    this.logger.debug(\n      'Initial mapping between routes and probability',\n      JSON.stringify(initialGraph, null, 2)\n    );\n\n    Object.keys(initialGraph).forEach(route => {\n      newConfig[route] = [];\n      initialGraph[route].forEach(neighbor => {\n        const node = fileChunk[neighbor.file];\n        if (!node) {\n          this.logger.debug('No chunk for file', neighbor.file);\n          return;\n        }\n        chunkRoute[node.file] = neighbor.route;\n        const newTransition: PrefetchAotNeighbor = {\n          probability: neighbor.probability,\n          chunks: [...new Set([node.file, ...node.deps])]\n        };\n        newConfig[route].push(newTransition);\n      });\n    });\n\n    this.logger.debug('Built the model', JSON.stringify(newConfig, null, 2));\n    this.logger.debug(\n      'File to chunk mapping',\n      JSON.stringify(fileChunk, null, 2)\n    );\n    this.logger.debug(\n      'Chunk to route mapping is',\n      JSON.stringify(chunkRoute, null, 2)\n    );\n\n    chunkRoute[mainName] = '/';\n\n    const tableOutput: any[] = [['Prefetcher', 'Target', 'Probability']];\n    const generateNeighbors = (\n      route: string,\n      currentChunk: string,\n      c: PrefetchAotNeighbor\n    ): false | [number, string] => {\n      if (!c.chunks || !c.chunks.length) {\n        this.logger.debug('Cannot find chunk name for', c, 'from route', route);\n        return false;\n      }\n      tableOutput.push([currentChunk, c.chunks[0], c.probability]);\n      return [\n        c.probability,\n        `[${parseFloat(c.probability.toFixed(2))},${c.chunks\n          .map(chunk => `'${chunk}'`)\n          .join(',')}]`\n      ];\n    };\n\n    let chunksLeft = Object.keys(chunkRoute).length;\n\n    const conf = this._config.prefetchConfig || defaultPrefetchConfig;\n    const minProbability = Math.min(\n      conf['2g'],\n      conf['3g'],\n      conf['4g'],\n      conf['slow-2g']\n    );\n\n    const handleAsset = (asset: Asset) => {\n      const chunkName = asset.name;\n      const route = chunkRoute[chunkName];\n      if (!route) {\n        this.logger.debug(\n          `Cannot find the route \"${route}\" for chunk \"${chunkName}\"`\n        );\n        asset.callback();\n        return;\n      }\n\n      const neighbors = (newConfig[route] || [])\n        .map(generateNeighbors.bind(null, route, chunkName))\n        .filter(Boolean)\n        .sort((a, b) => (a === false || b === false ? 0 : b[0] - a[0]))\n        .filter(n => n === false ? false : n[0] >= minProbability)\n        .map(n => (n === false ? null : n[1]));\n\n      if (newConfig[route]) {\n        this.logger.debug('Adding', neighbors);\n      } else {\n        this.logger.debug('Nothing to prefetch from', route);\n      }\n\n      let newCode = newConfig[route]\n        ? `__GUESS__.p(${neighbors.join(',')})`\n        : '';\n\n      const isMainChunk = mainName === chunkName;\n\n      if (isMainChunk) {\n        this.logger.debug('Adding prefetching logic in', mainName);\n        const codeTemplate = 'aot.tpl';\n        const runtimeTemplate = readFileSync(\n          join(__dirname, codeTemplate)\n        ).toString();\n\n        const prefetchingLogic = template(runtimeTemplate)({\n          THRESHOLDS: JSON.stringify(\n            Object.assign(\n              {},\n              defaultPrefetchConfig,\n              this._config.prefetchConfig\n            )\n          ),\n          BASE_PATH: this._config.base\n        });\n        newCode = prefetchingLogic + ';' + newCode;\n        this.logger.debug('Altering the main chunk');\n      }\n\n      alterChunk(\n        compiler,\n        chunkName,\n        readFileSync(join(compiler.outputPath, chunkName)).toString(),\n        newCode,\n        isMainChunk\n      ).finally(asset.callback);\n\n      chunksLeft -= 1;\n      if (!chunksLeft) {\n        this.logger.info(\n          chalk.blue(\n            '\\n\\n\\n🔮 Guess.js introduced the following prefetching instructions:'\n          )\n        );\n        this.logger.info('\\n\\n' + table(tableOutput));\n      }\n    };\n\n    assetObserver.onAsset(handleAsset);\n    assetObserver.buffer.forEach(handleAsset);\n\n    callback();\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/src/prefetch-plugin.ts",
    "content": "import { readFileSync } from 'fs';\nimport {\n  PrefetchPluginConfig,\n  PrefetchGraph,\n  PrefetchNeighbor,\n  FileChunkMap\n} from './declarations';\nimport { compressGraph } from './compress';\nimport { join } from 'path';\nimport {\n  defaultPrefetchConfig,\n  buildMap,\n  getCompilationMapping,\n  stripExtension\n} from './utils';\nimport { Logger } from '../../common/logger';\n\nconst template = require('lodash.template');\nconst ConcatSource = require('webpack-sources').ConcatSource;\n\nexport class PrefetchPlugin {\n  private logger = new Logger();\n\n  constructor(private _config: PrefetchPluginConfig) {\n    if (!_config.data) {\n      throw new Error('Page graph not provided');\n    }\n  }\n\n  execute(compilation: any, callback: any) {\n    let mainName: string | null = null;\n    let fileChunk: FileChunkMap = {};\n\n    try {\n      const res = getCompilationMapping(\n        compilation,\n        new Set(this._config.routes.map(r => stripExtension(r.modulePath))),\n        this.logger,\n      );\n      mainName = res.mainName;\n      fileChunk = res.fileChunk;\n    } catch (e) {\n      callback();\n      console.error(e);\n    }\n\n    if (mainName === null) {\n      callback();\n      throw new Error('Cannot find the main chunk of the application');\n    }\n\n    const newConfig: PrefetchGraph = {};\n    const initialGraph = buildMap(\n      this._config.routes.map(r => {\n        return {\n          ...r,\n          modulePath: stripExtension(r.modulePath),\n          parentModulePath: r.parentModulePath ? stripExtension(r.parentModulePath) : null\n        };\n      }),\n      this._config.data,\n      this.logger,\n      !!this._config.debug\n    );\n    Object.keys(initialGraph).forEach(c => {\n      newConfig[c] = [];\n      initialGraph[c].forEach(p => {\n        const node = fileChunk[p.file];\n        const newTransition: PrefetchNeighbor = {\n          probability: p.probability,\n          route: p.route,\n          // In delegate mode we don't care about chunks\n          // so it's fine if the mapping file/chunk is missing.\n          chunk: (node || { file: '' }).file\n        };\n        newConfig[c].push(newTransition);\n      });\n    });\n\n    const old = compilation.assets[mainName];\n    const { graph, graphMap } = compressGraph(newConfig, 3);\n\n    const codeTemplate = 'runtime.tpl';\n    const runtimeTemplate = readFileSync(\n      join(__dirname, codeTemplate)\n    ).toString();\n\n    const runtimeLogic = template(runtimeTemplate)({\n      BASE_PATH: this._config.basePath,\n      GRAPH: JSON.stringify(graph),\n      GRAPH_MAP: JSON.stringify(graphMap),\n      THRESHOLDS: JSON.stringify(\n        Object.assign({}, defaultPrefetchConfig, this._config.prefetchConfig)\n      )\n    });\n\n    const MemoryFileSystem = require('memory-fs');\n    const memoryFs = new MemoryFileSystem();\n\n    memoryFs.mkdirpSync('/src');\n    memoryFs.writeFileSync('/src/index.js', runtimeLogic, 'utf-8');\n    memoryFs.writeFileSync(\n      '/src/guess.js',\n      readFileSync(join(__dirname, 'guess.js')).toString(),\n      'utf-8'\n    );\n    memoryFs.writeFileSync(\n      '/src/runtime.js',\n      readFileSync(join(__dirname, 'runtime.js')).toString(),\n      'utf-8'\n    );\n\n    const compiler = require('webpack')({\n      context: '/src/',\n      mode: 'production',\n      entry: './index.js',\n      target: 'node',\n      output: {\n        filename: './output.js'\n      }\n    });\n\n    compiler.inputFileSystem = memoryFs;\n    compiler.outputFileSystem = memoryFs;\n    compiler.resolvers.normal.fileSystem = memoryFs;\n    compiler.resolvers.context.fileSystem = memoryFs;\n\n    compiler.run((err: any, stats: any) => {\n      if (err) {\n        callback();\n        throw err;\n      }\n\n      compilation.assets[mainName!] = new ConcatSource(\n        stats.compilation.assets['./output.js'],\n        '\\n',\n        old.source()\n      );\n      callback();\n    });\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/src/runtime/guess.ts",
    "content": "import { CompressedPrefetchGraph, CompressedGraphMap, PrefetchConfig } from '../declarations';\n\ntype GuessFn = (params?: Partial<GuessFnParams>) => Predictions;\n\ninterface GuessFnParams {\n  path: string;\n  thresholds: ConnectionEffectiveTypeThresholds;\n  connection: ConnectionEffectiveType;\n}\n\ntype Probability = number;\ntype ConnectionEffectiveType = '4g' | '3g' | '2g' | 'slow-2g';\n\ninterface ConnectionEffectiveTypeThresholds {\n  '4g': Probability;\n  '3g': Probability;\n  '2g': Probability;\n  'slow-2g': Probability;\n}\n\ninterface Predictions {\n  [route: string]: Navigation;\n}\n\nexport interface Navigation {\n  probability: Probability;\n  chunk?: string;\n}\n\nexport interface Navigations {\n  [key: string]: Navigation;\n}\n\nconst matchRoute = (route: string, declaration: string) => {\n  const routeParts = route.split('/');\n  const declarationParts = declaration.split('/');\n  if (routeParts.length > 0 && routeParts[routeParts.length - 1] === '') {\n    routeParts.pop();\n  }\n\n  if (declarationParts.length > 0 && declarationParts[declarationParts.length - 1] === '') {\n    declarationParts.pop();\n  }\n\n  if (routeParts.length !== declarationParts.length) {\n    return false;\n  } else {\n    return declarationParts.reduce((a, p, i) => {\n      if (p[0] === ':') {\n        return a;\n      }\n      return a && p === routeParts[i];\n    }, true);\n  }\n};\n\nclass GraphNode {\n  constructor(private _node: number[], private _map: CompressedGraphMap) {}\n\n  get probability() {\n    return this._node[0];\n  }\n\n  get route() {\n    return this._map.routes[this._node[1]];\n  }\n\n  get chunk() {\n    return this._map.chunks[this._node[2]];\n  }\n}\n\nclass Graph {\n  constructor(private _graph: CompressedPrefetchGraph, private _map: CompressedGraphMap) {}\n\n  findMatch(route: string): GraphNode[] {\n    const result = this._graph.filter((_, i) => matchRoute(this._map.routes[i], route)).pop();\n    if (!result) {\n      return [];\n    }\n    return result.map(n => new GraphNode(n, this._map));\n  }\n}\n\nconst guessNavigation = (graph: Graph, params: GuessFnParams): Navigations => {\n  const matches = graph.findMatch(params.path);\n  return matches.reduce(\n    (p: Navigations, n) => {\n      if (n.probability >= params.thresholds[params.connection]) {\n        const nav: Navigation = {\n          probability: n.probability\n        };\n        if (n.chunk) {\n          nav.chunk = n.chunk;\n        }\n        p[n.route] = nav;\n      }\n      return p;\n    },\n    {} as Navigations\n  );\n};\n\nexport let guess: GuessFn = (params?: Partial<GuessFnParams>): Navigations => {\n  throw new Error('Guess is not initialized');\n};\n\nexport const initialize = (\n  global: any,\n  thresholds: PrefetchConfig,\n  compressed: CompressedPrefetchGraph,\n  map: CompressedGraphMap\n) => {\n  const graph = new Graph(compressed, map);\n  global.__GUESS__ = global.__GUESS__ || {};\n  global.__GUESS__.guess = guess = (params?: Partial<GuessFnParams>) => {\n    params = params || {};\n    if (!params.path) {\n      params.path = (global.location || { pathname: '' }).pathname;\n    }\n    if (!params.connection) {\n      params.connection =\n        !global.navigator || !global.navigator || !global.navigator.connection\n          ? '3g'\n          : global.navigator.connection.effectiveType || '3g';\n    }\n    if (!params.thresholds) {\n      params.thresholds = thresholds;\n    }\n    return guessNavigation(graph, params as GuessFnParams);\n  };\n};\n"
  },
  {
    "path": "packages/guess-webpack/src/runtime/runtime.tpl",
    "content": "import { initialize } from './runtime';\n\n(function(g, history, graph, m, basePath, thresholds) {\n  initialize(g, history, graph, m, basePath, thresholds);\n})(typeof window === 'undefined' ? global : window, (typeof window === 'undefined' ? {} : window).history || {}, <%= GRAPH %>, <%= GRAPH_MAP %>, '<%= BASE_PATH %>', <%= THRESHOLDS %>);\n"
  },
  {
    "path": "packages/guess-webpack/src/runtime/runtime.ts",
    "content": "import { CompressedPrefetchGraph, CompressedGraphMap, PrefetchConfig } from '../declarations';\nimport { guess, initialize as initializeGuess } from './guess';\n\nconst support = (feature: string) => {\n  if (typeof document === 'undefined') {\n    return false;\n  }\n  const fakeLink = document.createElement('link') as any;\n  try {\n    if (fakeLink.relList && typeof fakeLink.relList.supports === 'function') {\n      return fakeLink.relList.supports(feature);\n    }\n  } catch (err) {\n    return false;\n  }\n};\n\nconst linkPrefetchStrategy = (url: string) => {\n  if (typeof document === 'undefined') {\n    return;\n  }\n  const link = document.createElement('link');\n  link.setAttribute('rel', 'prefetch');\n  link.setAttribute('href', url);\n  const parentElement =\n    document.getElementsByTagName('head')[0] || document.getElementsByName('script')[0].parentNode;\n  parentElement.appendChild(link);\n};\n\nconst importPrefetchStrategy = (url: string) => import(url);\n\nconst supportedPrefetchStrategy = support('prefetch')\n  ? linkPrefetchStrategy\n  : importPrefetchStrategy;\n\nconst preFetched: { [key: string]: boolean } = {};\n\nconst prefetch = (basePath: string, url: string) => {\n  url = basePath + url;\n  if (preFetched[url]) {\n    return;\n  }\n  preFetched[url] = true;\n  supportedPrefetchStrategy(url);\n};\n\nconst handleNavigationChange = (basePath: string, path: string) => {\n  const predictions = guess({ path });\n  Object.keys(predictions).forEach(currentPath => {\n    const chunk = predictions[currentPath].chunk;\n    if (chunk) {\n      prefetch(basePath, chunk);\n    }\n  });\n};\n\nexport const initialize = (\n  global: any,\n  history: History,\n  graph: CompressedPrefetchGraph,\n  map: CompressedGraphMap,\n  basePath: string,\n  thresholds: PrefetchConfig\n) => {\n  initializeGuess(global, thresholds, graph, map);\n\n  // SSR, we return\n  if (global.constructor.name !== 'Window' || !global.location) {\n    return;\n  }\n\n  if (typeof global.addEventListener === 'function') {\n    global.addEventListener('popstate', (e: any) =>\n      handleNavigationChange(basePath, location.pathname)\n    );\n  }\n\n  const pushState = history.pushState;\n  history.pushState = function(state) {\n    if (typeof (history as any).onpushstate === 'function') {\n      (history as any).onpushstate({ state: state });\n    }\n    handleNavigationChange(basePath, arguments[2]);\n    return pushState.apply(history, arguments as any);\n  };\n  handleNavigationChange(basePath, location.pathname);\n};\n"
  },
  {
    "path": "packages/guess-webpack/src/utils.ts",
    "content": "import { PrefetchConfig, BundleEntryGraph, FileChunkMap } from './declarations';\nimport { Graph, RoutingModule } from '../../common/interfaces';\nimport { join } from 'path';\nimport { Logger } from '../../common/logger';\n\nexport const defaultPrefetchConfig: PrefetchConfig = {\n  '4g': 0.15,\n  '3g': 0.3,\n  '2g': 0.45,\n  'slow-2g': 0.6\n};\n\nconst validateInput = (\n  routes: RoutingModule[],\n  graph: Graph,\n  logger: Logger,\n  debug: boolean\n) => {\n  const routesInReport = new Set();\n  Object.keys(graph).forEach(r => {\n    routesInReport.add(r);\n    Object.keys(graph[r]).forEach(c => routesInReport.add(c));\n  });\n  routes\n    .map(r => r.path)\n    .filter(x => !routesInReport.has(x))\n    .forEach(r => {\n      if (debug) {\n        logger.debug(\n          `The route ${r} is not present in the report or in the route declarations`\n        );\n      }\n    });\n};\n\nexport const buildMap = (\n  routes: RoutingModule[],\n  graph: Graph,\n  logger: Logger,\n  debug: boolean\n): BundleEntryGraph => {\n  validateInput(routes, graph, logger, debug);\n  const result: BundleEntryGraph = {};\n  const routeFile = {} as { [key: string]: string };\n  routes.forEach(r => {\n    routeFile[r.path] = r.modulePath;\n  });\n  Object.keys(graph).forEach(route => {\n    result[route] = [];\n\n    const sum = Object.keys(graph[route]).reduce(\n      (a, n) => a + graph[route][n],\n      0\n    );\n    Object.keys(graph[route]).forEach(n => {\n      result[route].push({\n        route: n,\n        probability: graph[route][n] / sum,\n        file: routeFile[n]\n      });\n    });\n    result[route] = result[route].sort((a, b) => b.probability - a.probability);\n  });\n  return result;\n};\n\nexport const stripExtension = (path: string) => path.replace(/\\.(j|t)sx?$/, '');\n\nexport interface Compilation {\n  getStats(): { toJson(): JSCompilation };\n}\n\nexport interface JSReason {\n  module: string;\n  moduleId: string;\n}\n\nexport interface JSModule {\n  id: string;\n  name: string;\n  reasons: JSReason[];\n  chunks: number[];\n}\n\nexport interface JSOrigin {\n  name: string;\n  moduleName: string;\n  module: string;\n}\n\nexport interface JSChunk {\n  id: number;\n  files: string[];\n  initial: boolean;\n  modules: JSModule[];\n  origins: JSOrigin[];\n}\n\nexport interface JSCompilation {\n  chunks: JSChunk[];\n  modules: JSModule[];\n}\n\ninterface ChunkGraph {\n  [chunk: string]: Set<string>;\n}\n\nconst getChunkJsFile = (chunk: JSChunk) => {\n  return chunk.files.filter(f => f.endsWith('.js')).shift();\n};\n\nconst getChunkDependencyGraph = (stats: JSCompilation): ChunkGraph => {\n  const chunkGraph: ChunkGraph = {};\n\n  const chunkIdToChunk: {[id: number]: JSChunk} = {};\n  stats.chunks.forEach(chunk => chunkIdToChunk[chunk.id] = chunk);\n\n  const moduleIdToModule: {[id: string]: JSModule} = {};\n  stats.modules.forEach(module => moduleIdToModule[module.id] = module);\n\n  stats.modules.forEach(module => {\n    const moduleChunks = module.chunks.map(id => chunkIdToChunk[id]);\n    module.reasons.forEach(reason => {\n      const dependent = moduleIdToModule[reason.moduleId];\n      if (!dependent) {\n        return;\n      }\n      const dependentChunks = dependent.chunks.map(id => chunkIdToChunk[id]);\n      dependentChunks.forEach(dependentChunk => {\n        const file = getChunkJsFile(dependentChunk);\n        if (!file) {\n          return;\n        }\n        chunkGraph[file] = chunkGraph[file] || new Set<string>();\n        moduleChunks.forEach(dependencyChunk => {\n          if (dependencyChunk.initial) {\n            return;\n          }\n          const dependencyFile = getChunkJsFile(dependencyChunk);\n          if (!dependencyFile) {\n            return;\n          }\n          chunkGraph[file].add(dependencyFile);\n        });\n      });\n    });\n  });\n  return chunkGraph;\n};\n\nexport const getCompilationMapping = (\n  compilation: Compilation,\n  entryPoints: Set<string>,\n  logger: Logger,\n): { mainName: string | null; fileChunk: FileChunkMap } => {\n\n  let mainName: string | null = null;\n  let mainPriority = Infinity;\n  function getModulePath(moduleName: string): string | null {\n    const cwd = process.cwd();\n    const relativePath = moduleName\n      .split(' ')\n      .filter(p => /(\\.)?(\\/|\\\\)/.test(p))\n      .pop();\n    if (relativePath === undefined) {\n      return null;\n    }\n    const jsPath = stripExtension(\n      relativePath.replace(/\\.ngfactory\\.js$/, '.js')\n    );\n    return join(cwd, jsPath);\n  }\n\n  const jsonStats = compilation.getStats().toJson();\n\n  const chunkDepGraph = getChunkDependencyGraph(jsonStats);\n  logger.debug('Chunk dependency graph', chunkDepGraph);\n\n  const fileChunk: FileChunkMap = {};\n\n  jsonStats\n    .chunks.forEach(c => {\n      const jsFile = getChunkJsFile(c);\n      if (!jsFile) {\n        return;\n      }\n      if (c.initial) {\n        const pickers = [\n          (f: string) => f.startsWith('main') && f.endsWith('.js'),\n          (f: string) => f.indexOf('/main') >= 0 && f.endsWith('.js'),\n          (f: string) => f.startsWith('runtime') && f.endsWith('.js'),\n          (f: string) => f.indexOf('/runtime') >= 0 && f.endsWith('.js'),\n          (f: string) => f.startsWith('vendor') && f.endsWith('.js'),\n          (f: string) => f.indexOf('/vendor') >= 0 && f.endsWith('.js'),\n          (f: string) => f.startsWith('common') && f.endsWith('.js'),\n          (f: string) => f.endsWith('.js'),\n        ]\n        let currentMain = null;\n        let currentPriority = 0;\n        while (!currentMain && pickers.length) {\n          currentMain = c.files.filter(pickers.shift()!).pop()!;\n          currentPriority++;\n        }\n        if (mainPriority > currentPriority) {\n          mainName = currentMain;\n          mainPriority = currentPriority;\n        }\n      }\n      if (c.modules && c.modules.length) {\n        const existingEntries = c.modules.filter(m => {\n          const path = getModulePath(m.name);\n          if (!path) {\n            return false;\n          }\n          return entryPoints.has(path);\n        });\n        if (existingEntries.length > 1) {\n          logger.debug(\n            'There are more than two entry points associated with chunk',\n            jsFile\n          );\n        } else if (existingEntries.length === 0) {\n          logger.debug('Cannot find entry point for chunk: ' + jsFile);\n        } else {\n          const path = getModulePath(existingEntries[0].name);\n          if (path) {\n            fileChunk[path] = fileChunk[path] || { file: jsFile, deps: chunkDepGraph[jsFile] };\n          }\n        }\n      } else {\n        logger.debug('Cannot find modules for chunk', jsFile);\n      }\n    });\n\n  return { mainName, fileChunk };\n};\n"
  },
  {
    "path": "packages/guess-webpack/test/e2e/delegate.spec.ts",
    "content": "describe('GuessPlugin delegate', () => {\n  const puppeteer = require('puppeteer');\n\n  let browser: any;\n  let page: any;\n\n  beforeAll(async () => {\n    browser = await puppeteer.launch();\n    page = await browser.newPage();\n  });\n\n  it('should export global __GUESS__', async () => {\n    await page.goto('http://localhost:5122/delegate/dist/index.html', {\n      waitUntil: 'networkidle0'\n    });\n\n    const guessGlobal = await page.evaluate(() => {\n      return !!(window as any).__GUESS__;\n    });\n\n    expect(guessGlobal).toBeTruthy();\n  });\n\n  it('should export make predictions', async () => {\n    await page.goto('http://localhost:5122/delegate/dist/index.html', {\n      waitUntil: 'networkidle0'\n    });\n\n    const result = await page.evaluate(() => {\n      return (window as any).__GUESS__.guess({ path: 'foo' }).bar.probability;\n    });\n\n    expect(result).toBe(1);\n  });\n\n  afterAll(async () => {\n    await browser.close();\n  });\n});\n"
  },
  {
    "path": "packages/guess-webpack/test/e2e/next.spec.ts",
    "content": "describe('GuessPlugin integration with Next.js', () => {\n  const puppeteer = require('puppeteer');\n\n  let browser: any;\n  let page: any;\n\n  beforeAll(async () => {\n    browser = await puppeteer.launch();\n    page = await browser.newPage();\n  });\n\n  describe('auto prefetching', () => {\n    it('should prefetch on initial page load', async () => {\n      await page.goto('http://localhost:5122/next/dist/', { waitUntil: 'networkidle0' });\n      await page.waitForSelector('a:nth-of-type(3)');\n      expect((await page.$$('script')).length).toBe(6);\n      const contactsLink = await page.$('a:nth-of-type(3)');\n      await contactsLink.click();\n      await new Promise(resolve => setTimeout(resolve, 1000));\n      expect((await page.$$('script')).length).toBe(7);\n    });\n  });\n\n  afterAll(async () => {\n    await browser.close();\n  });\n});\n"
  },
  {
    "path": "packages/guess-webpack/test/e2e/prefetch.spec.ts",
    "content": "describe('GuessPlugin prefetch', () => {\n  const puppeteer = require('puppeteer');\n\n  let browser: any;\n  let page: any;\n\n  beforeAll(async () => {\n    browser = await puppeteer.launch();\n    page = await browser.newPage();\n  });\n\n  describe('manual predictions', () => {\n    it('should export global __GUESS__', async () => {\n      await page.goto('http://localhost:5122/prefetch/dist/index.html', {\n        waitUntil: 'networkidle0'\n      });\n\n      const guessGlobal = await page.evaluate(() => {\n        return !!(window as any).__GUESS__;\n      });\n\n      expect(guessGlobal).toBeTruthy();\n    });\n\n    it('should export make predictions', async () => {\n      await page.goto('http://localhost:5122/prefetch/dist/index.html', {\n        waitUntil: 'networkidle0'\n      });\n\n      const result = await page.evaluate(() => {\n        return (window as any).__GUESS__.guess({ path: '/home' })['/about'].probability;\n      });\n\n      expect(result).toBe(1);\n    });\n  });\n\n  describe('auto prefetching', () => {\n    it('should prefetch on initial page load', async () => {\n      await page.goto('http://localhost:5122/prefetch/dist/index.html', {\n        waitUntil: 'networkidle0'\n      });\n      await page.click('a');\n      expect((await page.$$('link[rel=\"prefetch\"]')).length).toBe(1);\n      await page.click('a:nth-of-type(2)');\n      expect((await page.$$('link[rel=\"prefetch\"]')).length).toBe(2);\n    });\n  });\n\n  afterAll(async () => {\n    await browser.close();\n  });\n});\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/.editorconfig",
    "content": "# Editor configuration, see https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\nmax_line_length = off\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/.gitignore",
    "content": "# See http://help.github.com/ignore-files/ for more about ignoring files.\n\n# compiled output\n/dist\n/tmp\n/out-tsc\n# Only exists if Bazel was run\n/bazel-out\n\n# dependencies\n/node_modules\n\n# profiling files\nchrome-profiler-events.json\nspeed-measure-plugin.json\n\n# IDEs and editors\n/.idea\n.project\n.classpath\n.c9/\n*.launch\n.settings/\n*.sublime-workspace\n\n# IDE - VSCode\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json\n.history/*\n\n# misc\n/.sass-cache\n/connect.lock\n/coverage\n/libpeerconnection.log\nnpm-debug.log\nyarn-error.log\ntestem.log\n/typings\n\n# System Files\n.DS_Store\nThumbs.db\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/README.md",
    "content": "# Angular\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.9.\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/angular.json",
    "content": "{\n  \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n  \"version\": 1,\n  \"newProjectRoot\": \"projects\",\n  \"projects\": {\n    \"angular\": {\n      \"root\": \"\",\n      \"sourceRoot\": \"src\",\n      \"projectType\": \"application\",\n      \"prefix\": \"app\",\n      \"schematics\": {},\n      \"architect\": {\n        \"build\": {\n          \"builder\": \"ngx-build-plus:build\",\n          \"options\": {\n            \"outputPath\": \"dist/angular\",\n            \"index\": \"src/index.html\",\n            \"main\": \"src/main.ts\",\n            \"polyfills\": \"src/polyfills.ts\",\n            \"tsConfig\": \"src/tsconfig.app.json\",\n            \"assets\": [\n              \"src/favicon.ico\",\n              \"src/assets\"\n            ],\n            \"styles\": [\n              \"src/styles.css\"\n            ],\n            \"scripts\": [],\n            \"es5BrowserSupport\": true\n          },\n          \"configurations\": {\n            \"production\": {\n              \"fileReplacements\": [\n                {\n                  \"replace\": \"src/environments/environment.ts\",\n                  \"with\": \"src/environments/environment.prod.ts\"\n                }\n              ],\n              \"optimization\": true,\n              \"outputHashing\": \"all\",\n              \"sourceMap\": false,\n              \"extractCss\": true,\n              \"namedChunks\": false,\n              \"aot\": true,\n              \"extractLicenses\": true,\n              \"vendorChunk\": false,\n              \"buildOptimizer\": true,\n              \"budgets\": [\n                {\n                  \"type\": \"initial\",\n                  \"maximumWarning\": \"2mb\",\n                  \"maximumError\": \"5mb\"\n                }\n              ]\n            }\n          }\n        },\n        \"serve\": {\n          \"builder\": \"ngx-build-plus:dev-server\",\n          \"options\": {\n            \"browserTarget\": \"angular:build\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"browserTarget\": \"angular:build:production\"\n            }\n          }\n        },\n        \"extract-i18n\": {\n          \"builder\": \"@angular-devkit/build-angular:extract-i18n\",\n          \"options\": {\n            \"browserTarget\": \"angular:build\"\n          }\n        },\n        \"test\": {\n          \"builder\": \"ngx-build-plus:karma\",\n          \"options\": {\n            \"main\": \"src/test.ts\",\n            \"polyfills\": \"src/polyfills.ts\",\n            \"tsConfig\": \"src/tsconfig.spec.json\",\n            \"karmaConfig\": \"src/karma.conf.js\",\n            \"styles\": [\n              \"src/styles.css\"\n            ],\n            \"scripts\": [],\n            \"assets\": [\n              \"src/favicon.ico\",\n              \"src/assets\"\n            ]\n          }\n        },\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": [\n              \"src/tsconfig.app.json\",\n              \"src/tsconfig.spec.json\"\n            ],\n            \"exclude\": [\n              \"**/node_modules/**\"\n            ]\n          }\n        }\n      }\n    },\n    \"angular-e2e\": {\n      \"root\": \"e2e/\",\n      \"projectType\": \"application\",\n      \"prefix\": \"\",\n      \"architect\": {\n        \"e2e\": {\n          \"builder\": \"@angular-devkit/build-angular:protractor\",\n          \"options\": {\n            \"protractorConfig\": \"e2e/protractor.conf.js\",\n            \"devServerTarget\": \"angular:serve\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"devServerTarget\": \"angular:serve:production\"\n            }\n          }\n        },\n        \"lint\": {\n          \"builder\": \"@angular-devkit/build-angular:tslint\",\n          \"options\": {\n            \"tsConfig\": \"e2e/tsconfig.e2e.json\",\n            \"exclude\": [\n              \"**/node_modules/**\"\n            ]\n          }\n        }\n      }\n    }\n  },\n  \"defaultProject\": \"angular\"\n}"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/e2e/protractor.conf.js",
    "content": "// Protractor configuration file, see link for more information\n// https://github.com/angular/protractor/blob/master/lib/config.ts\n\nconst { SpecReporter } = require('jasmine-spec-reporter');\n\nexports.config = {\n  allScriptsTimeout: 11000,\n  specs: [\n    './src/**/*.e2e-spec.ts'\n  ],\n  capabilities: {\n    'browserName': 'chrome'\n  },\n  directConnect: true,\n  baseUrl: 'http://localhost:4200/',\n  framework: 'jasmine',\n  jasmineNodeOpts: {\n    showColors: true,\n    defaultTimeoutInterval: 30000,\n    print: function() {}\n  },\n  onPrepare() {\n    require('ts-node').register({\n      project: require('path').join(__dirname, './tsconfig.e2e.json')\n    });\n    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));\n  }\n};"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/e2e/src/app.e2e-spec.ts",
    "content": "import { AppPage } from './app.po';\nimport { browser, logging } from 'protractor';\n\ndescribe('workspace-project App', () => {\n  let page: AppPage;\n\n  beforeEach(() => {\n    page = new AppPage();\n  });\n\n  it('should display welcome message', () => {\n    page.navigateTo();\n    expect(page.getTitleText()).toEqual('Welcome to angular!');\n  });\n\n  afterEach(async () => {\n    // Assert that there are no errors emitted from the browser\n    const logs = await browser.manage().logs().get(logging.Type.BROWSER);\n    expect(logs).not.toContain(jasmine.objectContaining({\n      level: logging.Level.SEVERE,\n    } as logging.Entry));\n  });\n});\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/e2e/src/app.po.ts",
    "content": "import { browser, by, element } from 'protractor';\n\nexport class AppPage {\n  navigateTo() {\n    return browser.get(browser.baseUrl) as Promise<any>;\n  }\n\n  getTitleText() {\n    return element(by.css('app-root h1')).getText() as Promise<string>;\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/e2e/tsconfig.e2e.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../out-tsc/app\",\n    \"module\": \"commonjs\",\n    \"target\": \"es5\",\n    \"types\": [\n      \"jasmine\",\n      \"jasminewd2\",\n      \"node\"\n    ]\n  }\n}"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/package.json",
    "content": "{\n  \"name\": \"angular\",\n  \"version\": \"0.0.0\",\n  \"scripts\": {\n    \"ng\": \"ng\",\n    \"start\": \"ng serve\",\n    \"build\": \"ng build\",\n    \"test\": \"ng test\",\n    \"lint\": \"ng lint\",\n    \"e2e\": \"ng e2e\"\n  },\n  \"private\": true,\n  \"dependencies\": {\n    \"@angular/animations\": \"9.0.0-next.4\",\n    \"@angular/common\": \"9.0.0-next.4\",\n    \"@angular/compiler\": \"9.0.0-next.4\",\n    \"@angular/core\": \"9.0.0-next.4\",\n    \"@angular/forms\": \"9.0.0-next.4\",\n    \"@angular/platform-browser\": \"9.0.0-next.4\",\n    \"@angular/platform-browser-dynamic\": \"9.0.0-next.4\",\n    \"@angular/router\": \"9.0.0-next.4\",\n    \"core-js\": \"^2.5.4\",\n    \"ngx-build-plus\": \"^8.1.0\",\n    \"rxjs\": \"~6.3.3\",\n    \"tslib\": \"^1.9.0\",\n    \"zone.js\": \"~0.8.26\"\n  },\n  \"devDependencies\": {\n    \"@angular-devkit/build-angular\": \"0.900.0-next.4\",\n    \"@angular/cli\": \"9.0.0-next.4\",\n    \"@angular/compiler-cli\": \"9.0.0-next.4\",\n    \"@angular/language-service\": \"9.0.0-next.4\",\n    \"@types/node\": \"~8.9.4\",\n    \"@types/jasmine\": \"~2.8.8\",\n    \"@types/jasminewd2\": \"~2.0.3\",\n    \"codelyzer\": \"~4.5.0\",\n    \"guess-webpack\": \"../../../\",\n    \"guess-parser\": \"../../../../guess-parser\",\n    \"jasmine-core\": \"~2.99.1\",\n    \"jasmine-spec-reporter\": \"~4.2.1\",\n    \"karma\": \"~4.0.0\",\n    \"karma-chrome-launcher\": \"~2.2.0\",\n    \"karma-coverage-istanbul-reporter\": \"~2.0.1\",\n    \"karma-jasmine\": \"~1.1.2\",\n    \"karma-jasmine-html-reporter\": \"^0.2.2\",\n    \"protractor\": \"~5.4.0\",\n    \"ts-node\": \"~7.0.0\",\n    \"tslint\": \"~5.11.0\",\n    \"typescript\": \"~3.2.2\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/routes.json",
    "content": "{\n  \"/\": {\n    \"/foo\": 1\n  },\n  \"/foo\": {\n    \"/foo/baz\": 0.6,\n    \"/qux\": 0.4\n  },\n  \"/qux\": {\n    \"/foo\": 0.989,\n    \"/foo/baz\": 0.011\n  }\n}\n\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/app-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { BarComponent } from './bar/bar.component';\n\nconst routes: Routes = [\n  {\n    path: 'fo' + 'o',\n    loadChildren: './foo/foo.module#FooModule'\n  },\n  {\n    path: 'qux',\n    loadChildren: './qux/qux.module#QuxModule'\n  },\n  {\n    path: 'bar',\n    component: BarComponent\n  },\n  {\n    path: '',\n    pathMatch: 'full',\n    redirectTo: 'bar'\n  }\n];\n\n@NgModule({\n  imports: [RouterModule.forRoot(routes)],\n  exports: [RouterModule]\n})\nexport class AppRoutingModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/app.component.css",
    "content": ""
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/app.component.html",
    "content": "<a routerLink=\"/foo\">Foo</a>\n<a routerLink=\"/bar\">Bar</a>\n\n<router-outlet></router-outlet>"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/app.component.spec.ts",
    "content": "import { TestBed, async } from '@angular/core/testing';\nimport { AppComponent } from './app.component';\ndescribe('AppComponent', () => {\n  beforeEach(async(() => {\n    TestBed.configureTestingModule({\n      declarations: [\n        AppComponent\n      ],\n    }).compileComponents();\n  }));\n  it('should create the app', async(() => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.debugElement.componentInstance;\n    expect(app).toBeTruthy();\n  }));\n  it(`should have as title 'app'`, async(() => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.debugElement.componentInstance;\n    expect(app.title).toEqual('app');\n  }));\n  it('should render title in a h1 tag', async(() => {\n    const fixture = TestBed.createComponent(AppComponent);\n    fixture.detectChanges();\n    const compiled = fixture.debugElement.nativeElement;\n    expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');\n  }));\n});\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/app.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css']\n})\nexport class AppComponent {\n  title = 'app';\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/app.module.ts",
    "content": "import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppComponent } from './app.component';\nimport { AppRoutingModule } from './app-routing.module';\nimport { BarModule } from './bar/bar.module';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [BrowserModule, BarModule, AppRoutingModule],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/bar/bar.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-component',\n  template: 'bar-component'\n})\nexport class BarComponent {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/bar/bar.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { BarComponent } from './bar.component';\n\n@NgModule({\n  declarations: [BarComponent],\n  providers: []\n})\nexport class BarModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/foo/baz/baz-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { BazComponent } from './baz.component';\n\nconst routes: Routes = [\n  {\n    path: '',\n    component: BazComponent\n  },\n  {\n    path: 'index',\n    component: BazComponent\n  }\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class BazRoutingModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/foo/baz/baz.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-baz',\n  template: 'baz-component'\n})\nexport class BazComponent {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/foo/baz/baz.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { BazComponent } from './baz.component';\nimport { BazRoutingModule } from './baz-routing.module';\n\n@NgModule({\n  declarations: [BazComponent],\n  imports: [BazRoutingModule],\n  bootstrap: [BazComponent]\n})\nexport class BazModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/foo/foo-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { FooComponent } from './foo.component';\n\nconst baz = './baz';\nconst routes: Routes = [\n  {\n    path: '',\n    component: FooComponent\n  },\n  {\n    path: 'index',\n    component: FooComponent\n  },\n  {\n    path: 'baz',\n    loadChildren: baz + '/baz.module#BazModule'\n  }\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class FooRoutingModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/foo/foo.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-foo',\n  template: 'foo-component'\n})\nexport class FooComponent {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/foo/foo.module.ts",
    "content": "import { NgModule, Component } from '@angular/core';\nimport { FooComponent } from './foo.component';\nimport { FooRoutingModule } from './foo-routing.module';\n\n@NgModule({\n  declarations: [FooComponent],\n  imports: [FooRoutingModule],\n  bootstrap: [FooComponent]\n})\nexport class FooModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/qux/qux-routing.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { QuxComponent } from './qux.component';\n\nconst routes: Routes = [\n  {\n    path: '',\n    component: QuxComponent\n  },\n  {\n    path: 'index',\n    component: QuxComponent\n  }\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class QuxRoutingModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/qux/qux.component.ts",
    "content": "import { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-qux',\n  template: 'qux-component'\n})\nexport class QuxComponent {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/app/qux/qux.module.ts",
    "content": "import { NgModule } from '@angular/core';\nimport { QuxComponent } from './qux.component';\nimport { QuxRoutingModule } from './qux-routing.module';\n\n@NgModule({\n  declarations: [QuxComponent],\n  imports: [QuxRoutingModule],\n  bootstrap: [QuxComponent]\n})\nexport class QuxModule {}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/assets/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/browserslist",
    "content": "# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers\n# For additional information regarding the format and rule options, please see:\n# https://github.com/browserslist/browserslist#queries\n#\n# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed\n\n> 0.5%\nlast 2 versions\nFirefox ESR\nnot dead\nnot IE 9-11"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/environments/environment.prod.ts",
    "content": "export const environment = {\n  production: true\n};\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/environments/environment.ts",
    "content": "// This file can be replaced during build by using the `fileReplacements` array.\n// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.\n// The list of file replacements can be found in `angular.json`.\n\nexport const environment = {\n  production: false\n};\n\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/dist/zone-error';  // Included with Angular CLI.\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <title>Angular</title>\n  <base href=\"/\">\n\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\">\n</head>\n<body>\n  <app-root></app-root>\n</body>\n</html>\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/karma.conf.js",
    "content": "// Karma configuration file, see link for more information\n// https://karma-runner.github.io/1.0/config/configuration-file.html\n\nmodule.exports = function (config) {\n  config.set({\n    basePath: '',\n    frameworks: ['jasmine', '@angular-devkit/build-angular'],\n    plugins: [\n      require('karma-jasmine'),\n      require('karma-chrome-launcher'),\n      require('karma-jasmine-html-reporter'),\n      require('karma-coverage-istanbul-reporter'),\n      require('@angular-devkit/build-angular/plugins/karma')\n    ],\n    client: {\n      clearContext: false // leave Jasmine Spec Runner output visible in browser\n    },\n    coverageIstanbulReporter: {\n      dir: require('path').join(__dirname, '../coverage/angular'),\n      reports: ['html', 'lcovonly', 'text-summary'],\n      fixWebpackSourcePaths: true\n    },\n    reporters: ['progress', 'kjhtml'],\n    port: 9876,\n    colors: true,\n    logLevel: config.LOG_INFO,\n    autoWatch: true,\n    browsers: ['Chrome'],\n    singleRun: false,\n    restartOnFileChange: true\n  });\n};\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/main.ts",
    "content": "import { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n  enableProdMode();\n}\n\nplatformBrowserDynamic().bootstrapModule(AppModule)\n  .catch(err => console.error(err));\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/polyfills.ts",
    "content": "/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfills to this file.\n *\n * This file is divided into 2 sections:\n *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.\n *   2. Application imports. Files imported after ZoneJS that should be loaded before your main\n *      file.\n *\n * The current setup is for so-called \"evergreen\" browsers; the last versions of browsers that\n * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),\n * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.\n *\n * Learn more in https://angular.io/guide/browser-support\n */\n\n/***************************************************************************************************\n * BROWSER POLYFILLS\n */\n\n/** IE10 and IE11 requires the following for NgClass support on SVG elements */\n// import 'classlist.js';  // Run `npm install --save classlist.js`.\n\n/**\n * Web Animations `@angular/platform-browser/animations`\n * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.\n * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).\n */\n// import 'web-animations-js';  // Run `npm install --save web-animations-js`.\n\n/**\n * By default, zone.js will patch all possible macroTask and DomEvents\n * user can disable parts of macroTask/DomEvents patch by setting following flags\n * because those flags need to be set before `zone.js` being loaded, and webpack\n * will put import in the top of bundle, so user need to create a separate file\n * in this directory (for example: zone-flags.ts), and put the following flags\n * into that file, and then add the following code before importing zone.js.\n * import './zone-flags.ts';\n *\n * The flags allowed in zone-flags.ts are listed here.\n *\n * The following flags will work for all browsers.\n *\n * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame\n * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick\n * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames\n *\n *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js\n *  with the following flag, it will bypass `zone.js` patch for IE/Edge\n *\n *  (window as any).__Zone_enable_cross_context_check = true;\n *\n */\n\n/***************************************************************************************************\n * Zone JS is required by default for Angular itself.\n */\nimport 'zone.js/dist/zone';  // Included with Angular CLI.\n\n\n/***************************************************************************************************\n * APPLICATION IMPORTS\n */\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/styles.css",
    "content": "/* You can add global styles to this file, and also import other style files */\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/test.ts",
    "content": "// This file is required by karma.conf.js and loads recursively all the .spec and framework files\n\nimport 'zone.js/dist/zone-testing';\nimport { getTestBed } from '@angular/core/testing';\nimport {\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\n\ndeclare const require: any;\n\n// First, initialize the Angular testing environment.\ngetTestBed().initTestEnvironment(\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting()\n);\n// Then we find all the tests.\nconst context = require.context('./', true, /\\.spec\\.ts$/);\n// And load the modules.\ncontext.keys().map(context);\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/tsconfig.app.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../out-tsc/app\",\n    \"types\": []\n  },\n  \"exclude\": [\n    \"test.ts\",\n    \"**/*.spec.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/tsconfig.spec.json",
    "content": "{\n  \"extends\": \"../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../out-tsc/spec\",\n    \"types\": [\n      \"jasmine\",\n      \"node\"\n    ]\n  },\n  \"files\": [\n    \"test.ts\",\n    \"polyfills.ts\"\n  ],\n  \"include\": [\n    \"**/*.spec.ts\",\n    \"**/*.d.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/src/tslint.json",
    "content": "{\n  \"extends\": \"../tslint.json\",\n  \"rules\": {\n    \"directive-selector\": [\n      true,\n      \"attribute\",\n      \"app\",\n      \"camelCase\"\n    ],\n    \"component-selector\": [\n      true,\n      \"element\",\n      \"app\",\n      \"kebab-case\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/tsconfig.json",
    "content": "{\n  \"compileOnSave\": false,\n  \"compilerOptions\": {\n    \"baseUrl\": \"./\",\n    \"outDir\": \"./dist/out-tsc\",\n    \"sourceMap\": true,\n    \"declaration\": false,\n    \"module\": \"es2015\",\n    \"moduleResolution\": \"node\",\n    \"emitDecoratorMetadata\": true,\n    \"experimentalDecorators\": true,\n    \"importHelpers\": true,\n    \"target\": \"es5\",\n    \"typeRoots\": [\n      \"node_modules/@types\"\n    ],\n    \"lib\": [\n      \"es2018\",\n      \"dom\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/tslint.json",
    "content": "{\n  \"extends\": \"tslint:recommended\",\n  \"rulesDirectory\": [\n    \"codelyzer\"\n  ],\n  \"rules\": {\n    \"array-type\": false,\n    \"arrow-parens\": false,\n    \"deprecation\": {\n      \"severity\": \"warn\"\n    },\n    \"import-blacklist\": [\n      true,\n      \"rxjs/Rx\"\n    ],\n    \"interface-name\": false,\n    \"max-classes-per-file\": false,\n    \"max-line-length\": [\n      true,\n      140\n    ],\n    \"member-access\": false,\n    \"member-ordering\": [\n      true,\n      {\n        \"order\": [\n          \"static-field\",\n          \"instance-field\",\n          \"static-method\",\n          \"instance-method\"\n        ]\n      }\n    ],\n    \"no-consecutive-blank-lines\": false,\n    \"no-console\": [\n      true,\n      \"debug\",\n      \"info\",\n      \"time\",\n      \"timeEnd\",\n      \"trace\"\n    ],\n    \"no-empty\": false,\n    \"no-inferrable-types\": [\n      true,\n      \"ignore-params\"\n    ],\n    \"no-non-null-assertion\": true,\n    \"no-redundant-jsdoc\": true,\n    \"no-switch-case-fall-through\": true,\n    \"no-use-before-declare\": true,\n    \"no-var-requires\": false,\n    \"object-literal-key-quotes\": [\n      true,\n      \"as-needed\"\n    ],\n    \"object-literal-sort-keys\": false,\n    \"ordered-imports\": false,\n    \"quotemark\": [\n      true,\n      \"single\"\n    ],\n    \"trailing-comma\": false,\n    \"no-output-on-prefix\": true,\n    \"use-input-property-decorator\": true,\n    \"use-output-property-decorator\": true,\n    \"use-host-property-decorator\": true,\n    \"no-input-rename\": true,\n    \"no-output-rename\": true,\n    \"use-life-cycle-interface\": true,\n    \"use-pipe-transform-interface\": true,\n    \"component-class-suffix\": true,\n    \"directive-class-suffix\": true\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/angular/webpack.extra.js",
    "content": "const { GuessPlugin } = require('../../../');\nconst { parseRoutes } = require('../../../../guess-parser/');\n\nmodule.exports = {\n  plugins: [\n    new GuessPlugin({\n      debug: true,\n      reportProvider() {\n        return Promise.resolve(JSON.parse(require('fs').readFileSync('./routes.json').toString()));\n      },\n      runtime: {\n        base: 'http://localhost:1337'\n      },\n      routeProvider() {\n        return parseRoutes('.');\n      }\n    })\n  ]\n};\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/delegate/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n  <title>Document</title>\n</head>\n<body>\n  <script src=\"./index.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/delegate/index.js",
    "content": "console.log('42');\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/delegate/package.json",
    "content": "{\n  \"scripts\": {\n    \"build\": \"../../../../../node_modules/.bin/webpack\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/delegate/webpack.config.js",
    "content": "const CopyWebpackPlugin = require('copy-webpack-plugin');\nconst { GuessPlugin } = require('../../../dist/guess-webpack/main');\n\nmodule.exports = {\n  mode: 'development',\n  entry: './index.js',\n  target: 'web',\n  output: {\n    filename: './index.js',\n    libraryTarget: 'umd'\n  },\n  resolve: {\n    extensions: ['.js']\n  },\n  plugins: [\n    new CopyWebpackPlugin([{ from: 'index.html', to: 'index.html' }]),\n    new GuessPlugin({\n      runtime: {\n        delegate: true,\n      },\n      routeProvider: false,\n      reportProvider() {\n        return Promise.resolve({\n          foo: {\n            bar: 4\n          }\n        });\n      }\n    })\n  ]\n};\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/next/components/layout.js",
    "content": "import { withRouter } from 'next/router';\nconst { guess } = require('../../../../api');\n\nimport Link from 'next/link';\nimport Head from 'next/head';\n\nconst layout = ({ router, children, title = '🔮 Next.js + Guess.js' }) => {\n  if (typeof window !== 'undefined') {\n    Object.keys(guess()).forEach(p => router.prefetch(p));\n  }\n\n  return (\n    <div>\n      <Head>\n        <title>{title}</title>\n        <meta charSet=\"utf-8\" />\n        <meta name=\"viewport\" content=\"initial-scale=1.0, width=device-width\" />\n        <link rel=\"icon\" href=\"static/favicon.ico\" type=\"image/x-icon\" />\n      </Head>\n      <header>\n        <nav>\n          <Link href=\"/\" prefetch={false}>\n            <a>Home</a>\n          </Link>{' '}\n          |\n          <Link href=\"/about\" prefetch={false}>\n            <a>About</a>\n          </Link>{' '}\n          |\n          <Link href=\"/contact\" prefetch={false}>\n            <a>Contact</a>\n          </Link>\n        </nav>\n      </header>\n\n      {children}\n\n      <footer>{'Navigate through the application to see the magic!'}</footer>\n    </div>\n  );\n};\n\nexport default withRouter(layout);\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/next/next.config.js",
    "content": "const { GuessPlugin } = require('../../../dist/guess-webpack/main');\n\nmodule.exports = {\n  assetPrefix: '/next/dist',\n  webpack: function(config, { isServer }) {\n    if (isServer) return config;\n    config.plugins.push(\n      new GuessPlugin({\n        reportProvider() {\n          return Promise.resolve({\n            '/': {\n              '/contact': 80,\n              '/about': 20\n            },\n            '/contact': {\n              '/': 20,\n              '/about': 80\n            },\n            '/about': {\n              '/': 80,\n              '/contact': 20\n            }\n          });\n        },\n        runtime: {\n          delegate: true,\n          prefetchConfig: {\n            '4g': 0.7,\n            '3g': 0.7,\n            '2g': 0.7,\n            'slow-2g': 0.7\n          }\n        },\n        routeProvider: false\n      })\n    );\n    return config;\n  }\n};\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/next/package.json",
    "content": "{\n  \"name\": \"guess-next\",\n  \"version\": \"0.0.0\",\n  \"description\": \"Experiment for integration of Guess.js with Next.js\",\n  \"scripts\": {\n    \"dev\": \"next\",\n    \"build\": \"next build && next export -o dist\",\n    \"start\": \"next start\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"next\": \"^9.0.0\",\n    \"react\": \"^16.9.0\",\n    \"react-dom\": \"^16.9.0\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/next/pages/about.js",
    "content": "import Layout from '../components/layout';\n\nexport default () => <Layout>About us</Layout>;\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/next/pages/contact.js",
    "content": "import Layout from '../components/layout'\n\nexport default () => (\n  <Layout>\n    This is the contact page.\n  </Layout>\n)\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/next/pages/index.js",
    "content": "import React from 'react';\nimport Layout from '../components/layout';\n\nexport default class Index extends React.Component {\n  render() {\n    return (\n      <Layout>\n        <h1>Next.js + Guess.js 🔮</h1>\n        <p>Welcome, Next.js</p>\n      </Layout>\n    );\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/prefetch/about.js",
    "content": "console.log('about');\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/prefetch/contact.js",
    "content": "console.log('contact');\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/prefetch/home.js",
    "content": "console.log('home');\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/prefetch/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n  <title>Document</title>\n</head>\n<body>\n  <a href=\"#\">/home</a>\n  <a href=\"#\">/about</a>\n  <a href=\"#\">/contact</a>\n  <script src=\"index.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/prefetch/index.js",
    "content": "(function() {\n  [].slice.call(document.querySelectorAll('a')).forEach(n => {\n    n.addEventListener('click', e => {\n      const link = n.innerText;\n      history.pushState({}, link, link);\n      if (link === '/home') {\n        import('./home.js');\n      }\n      if (link === '/about') {\n        import('./about.js');\n      }\n      if (link === '/contact') {\n        import('./contact.js');\n      }\n      e.preventDefault();\n    });\n  });\n})();\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/prefetch/package.json",
    "content": "{\n  \"scripts\": {\n    \"build\": \"../../../../../node_modules/.bin/webpack\"\n  }\n}\n"
  },
  {
    "path": "packages/guess-webpack/test/fixtures/prefetch/webpack.config.js",
    "content": "const { join } = require('path');\nconst CopyWebpackPlugin = require('copy-webpack-plugin');\nconst { GuessPlugin } = require('../../../dist/guess-webpack/main');\n\nconst absolute = path => {\n  return join(__dirname, path);\n};\n\nmodule.exports = [\n  {\n    mode: 'production',\n    entry: './index.js',\n    target: 'web',\n    output: {\n      filename: './index.js',\n      libraryTarget: 'umd'\n    },\n    resolve: {\n      extensions: ['.js']\n    },\n    plugins: [\n      new CopyWebpackPlugin([{ from: 'index.html', to: 'index.html' }]),\n      new GuessPlugin({\n        runtime: {\n          delegate: true,\n          basePath: ''\n        },\n        routeProvider: () => {\n          return Promise.resolve([\n            {\n              path: '/home',\n              modulePath: absolute('home.js'),\n              parentModulePath: absolute('index.js'),\n              lazy: true\n            },\n            {\n              path: '/about',\n              modulePath: absolute('about.js'),\n              parentModulePath: absolute('index.js'),\n              lazy: true\n            },\n            {\n              path: '/contact',\n              modulePath: absolute('contact.js'),\n              parentModulePath: absolute('index.js'),\n              lazy: true\n            }\n          ]);\n        },\n        reportProvider() {\n          return Promise.resolve({\n            '/home': {\n              '/about': 1\n            },\n            '/about': {\n              '/contact': 1\n            }\n          });\n        }\n      })\n    ]\n  }\n];\n"
  },
  {
    "path": "packages/guess-webpack/test/unit/compress.spec.ts",
    "content": "import { compressGraph } from '../../src/compress';\nimport { PrefetchGraph, CompressedGraphMap, CompressedPrefetchGraph } from '../../src/declarations';\n\nconst sample: PrefetchGraph = {\n  a: [\n    {\n      probability: 0.9,\n      route: 'b',\n      chunk: 'b.js'\n    },\n    {\n      probability: 0.1,\n      route: 'c',\n      chunk: 'c.js'\n    }\n  ],\n  b: [\n    {\n      probability: 1,\n      route: 'a',\n      chunk: 'a.js'\n    }\n  ]\n};\n\nconst fixtureMap: CompressedGraphMap = {\n  chunks: ['b.js', 'c.js', 'a.js'],\n  routes: ['a', 'b', 'c']\n};\n\nconst fixtureGraph: CompressedPrefetchGraph = [[[0.9, 1, 0], [0.1, 2, 1]], [[1, 0, 2]]];\n\ndescribe('compressGraph', () => {\n  it('should compress a graph', () => {\n    const { graph, graphMap } = compressGraph(sample, 1);\n    expect(graphMap).toEqual(fixtureMap);\n    expect(graph).toEqual(fixtureGraph);\n  });\n});\n"
  },
  {
    "path": "packages/guess-webpack/test/unit/runtime.spec.ts",
    "content": "import { PrefetchGraph } from '../../src/declarations';\nimport { compressGraph } from '../../src/compress';\nimport { initialize, guess } from '../../src/runtime/guess';\n\nconst sample: PrefetchGraph = {\n  a: [\n    {\n      probability: 0.9,\n      route: 'b',\n      chunk: 'b.js'\n    },\n    {\n      probability: 0.1,\n      route: 'c/:id',\n      chunk: 'c.js'\n    }\n  ],\n  b: [\n    {\n      probability: 1,\n      route: 'a',\n      chunk: 'a.js'\n    }\n  ]\n};\nconst { graph, graphMap } = compressGraph(sample, 1);\nconst config = {\n  '4g': 0.15,\n  '3g': 0.3,\n  '2g': 0.45,\n  'slow-2g': 0.6\n};\n\ndescribe('runtime', () => {\n  it('should guess links', () => {\n    initialize(window, config, graph, graphMap);\n    expect(\n      guess({\n        path: 'a',\n        connection: '4g',\n        thresholds: {\n          '4g': 0.01,\n          '3g': 0.3,\n          '2g': 0.45,\n          'slow-2g': 0.6\n        }\n      })\n    ).toEqual({ b: { probability: 0.9, chunk: 'b.js' }, 'c/:id': { probability: 0.1, chunk: 'c.js' } });\n  });\n\n  it('should work with no matches', () => {\n    initialize(window, config, graph, graphMap);\n    expect(\n      guess({\n        path: 'a',\n        connection: 'slow-2g',\n        thresholds: {\n          '4g': 0.01,\n          '3g': 0.3,\n          '2g': 0.45,\n          'slow-2g': 0.95\n        }\n      })\n    ).toEqual({});\n  });\n\n  it('should work with partial matches', () => {\n    initialize(window, config, graph, graphMap);\n    expect(guess({ path: 'a' })).toEqual({ b: { probability: 0.9, chunk: 'b.js' } });\n  });\n});\n"
  },
  {
    "path": "packages/guess-webpack/test/unit/utils.spec.ts",
    "content": "import {\n  stripExtension,\n  Compilation,\n  JSChunk,\n  getCompilationMapping\n} from '../../src/utils';\nimport { join } from 'path';\nimport { Logger } from '../../../common/logger';\n\ndescribe('stripExtension', () => {\n  it('should strip .js, .jsx, .tsx, .ts extensions', () => {\n    expect(stripExtension('/foo.js')).toBe('/foo');\n    expect(stripExtension('/bar/foo.jsx')).toBe('/bar/foo');\n    expect(stripExtension('/bar/foo.tsx')).toBe('/bar/foo');\n    expect(stripExtension('/bar/foo/.tsx')).toBe('/bar/foo/');\n  });\n\n  it('should strip not strip other extensions', () => {\n    expect(stripExtension('/foo.css')).toBe('/foo.css');\n    expect(stripExtension('/foo.json')).toBe('/foo.json');\n    expect(stripExtension('/foo.sass')).toBe('/foo.sass');\n  });\n});\n\nconst getComp = (chunks: JSChunk[]): Compilation => {\n  return {\n    getStats() {\n      return {\n        toJson() {\n          return {\n            chunks,\n            modules: []\n          };\n        }\n      };\n    }\n  };\n};\n\nconst getAbsolutePaths = (paths: string[]) => {\n  return paths.map(p => join(process.cwd(), p));\n};\n\ndescribe('getCompilationMapping', () => {\n  it('should work', () => {\n    const res = getCompilationMapping(getComp([]), new Set(), new Logger());\n    expect(res.mainName).toBe(null);\n    expect(res.fileChunk).toEqual({});\n  });\n\n  it('should return mainName', () => {\n    const res = getCompilationMapping(\n      getComp([\n        {\n          id: 1,\n          files: ['chunk.js'],\n          initial: true,\n          origins: [],\n          modules: []\n        }\n      ]),\n      new Set(),\n      new Logger()\n    );\n    expect(res.mainName).toBe('chunk.js');\n    expect(res.fileChunk).toEqual({});\n  });\n\n  it('should return mainName with multiple initials', () => {\n    const res = getCompilationMapping(\n      getComp([\n        {\n          id: 1,\n          files: ['a.js'],\n          initial: true,\n          origins: [],\n          modules: []\n        },\n        {\n          id: 1,\n          files: ['b.js'],\n          initial: false,\n          origins: [],\n          modules: []\n        },\n        {\n          id: 2,\n          files: ['c.js'],\n          initial: true,\n          modules: [],\n          origins: []\n        }\n      ]),\n      new Set(),\n      new Logger()\n    );\n    expect(res.mainName).toBe('a.js');\n    expect(res.fileChunk).toEqual({});\n  });\n\n  it('should return file mapping', () => {\n    const res = getCompilationMapping(\n      getComp([\n        {\n          id: 0,\n          files: ['a.js'],\n          initial: true,\n          origins: [],\n          modules: [\n            {\n              id: '',\n              chunks: [],\n              name: '/a.module.js',\n              reasons: []\n            }\n          ]\n        },\n        {\n          id: 1,\n          files: ['b.js'],\n          initial: false,\n          origins: [],\n          modules: [\n            {\n              id: '',\n              chunks: [],\n              name: '/b.module.js',\n              reasons: []\n            }\n          ]\n        },\n        {\n          id: 2,\n          files: ['c.js'],\n          initial: true,\n          origins: [],\n          modules: [\n            {\n              id: '',\n              chunks: [],\n              name: './c.module.js',\n              reasons: []\n            },\n            {\n              id: '',\n              chunks: [],\n              name: './c1.module.js',\n              reasons: []\n            },\n            {\n              id: '',\n              chunks: [],\n              name: './c2.module.js',\n              reasons: []\n            }\n          ]\n        }\n      ]),\n      new Set(getAbsolutePaths(['c.module', 'b.module', 'a.module'])),\n      new Logger()\n    );\n    expect(res.mainName).toBe('a.js');\n    const cwd = process.cwd();\n    expect(res.fileChunk).toEqual({\n      [join(cwd, '/a.module')]: {\n        deps: undefined,\n        file: 'a.js'\n      },\n      [join(cwd, '/b.module')]: {\n        deps: undefined,\n        file: 'b.js'\n      },\n      [join(cwd, '/c.module')]: {\n        deps: undefined,\n        file: 'c.js'\n      }\n    });\n  });\n\n  it('should throw when it cannot file the module entry point name', () => {\n    expect(\n      getCompilationMapping(\n        getComp([\n          {\n            id: 0,\n            files: ['a.js'],\n            initial: true,\n            origins: [],\n            modules: [\n              {\n                id: '',\n                chunks: [],\n                name: '+1 bar',\n                reasons: []\n              }\n            ]\n          }\n        ]),\n        new Set(['c.module', 'b.module', 'a.module']),\n        new Logger()\n      )\n    ).toEqual({ fileChunk: {}, mainName: 'a.js' });\n  });\n\n  it('should return file mapping with missing entry points', () => {\n    const res = getCompilationMapping(\n      getComp([\n        {\n          id: 0,\n          files: ['a.js'],\n          initial: true,\n          origins: [],\n          modules: [\n            {\n              id: '',\n              chunks: [],\n              name: '/a.module.js',\n              reasons: []\n            }\n          ]\n        },\n        {\n          id: 1,\n          files: ['b.js'],\n          initial: false,\n          origins: [],\n          modules: [\n            {\n              id: '',\n              chunks: [],\n              name: '/b.module.js',\n              reasons: []\n            }\n          ]\n        },\n        {\n          id: 2,\n          files: ['c.js'],\n          initial: true,\n          origins: [],\n          modules: [\n            {\n              id: '',\n              chunks: [],\n              name: './c.module.js',\n              reasons: []\n            },\n            {\n              id: '',\n              chunks: [],\n              name: './c1.module.js',\n              reasons: []\n            },\n            {\n              id: '',\n              chunks: [],\n              name: './c2.module.js',\n              reasons: []\n            }\n          ]\n        }\n      ]),\n      new Set(getAbsolutePaths(['not-there.module', 'b.module', 'a.module'])),\n      new Logger()\n    );\n    expect(res.mainName).toBe('a.js');\n    const cwd = process.cwd();\n    expect(res.fileChunk).toEqual({\n      [join(cwd, '/a.module')]: {\n        deps: undefined,\n        file: 'a.js'\n      },\n      [join(cwd, '/b.module')]: {\n        deps: undefined,\n        file: 'b.js'\n      }\n    });\n  });\n\n  it('should pick the right bundle priority', () => {\n    expect(\n      getCompilationMapping(\n        getComp([\n          {\n            id: 0,\n            files: ['foo.js'],\n            initial: true,\n            origins: [],\n            modules: [\n              {\n                id: '',\n                name: 'foo',\n                reasons: [],\n                chunks: []\n              }\n            ]\n          },\n          {\n            id: 1,\n            files: ['main.js'],\n            initial: true,\n            origins: [],\n            modules: [\n              {\n                id: '',\n                name: 'main',\n                reasons: [],\n                chunks: []\n              }\n            ]\n          }\n        ]),\n        new Set(['c.module', 'b.module', 'a.module']),\n        new Logger()\n      )\n    ).toEqual({ fileChunk: {}, mainName: 'main.js' });\n  });\n});\n"
  },
  {
    "path": "packages/guess-webpack/tsconfig-api.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"baseUrl\": \".\",\n    \"module\": \"commonjs\",\n    \"sourceMap\": true,\n    \"declaration\": true,\n    \"strict\": true,\n    \"experimentalDecorators\": true,\n    \"downlevelIteration\": true,\n    \"lib\": [\"es2015\", \"esnext\", \"dom\"]\n  },\n  \"files\": [\"api/index.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-webpack/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"baseUrl\": \"..\",\n    \"module\": \"commonjs\",\n    \"sourceMap\": true,\n    \"declaration\": true,\n    \"strict\": true,\n    \"experimentalDecorators\": true,\n    \"downlevelIteration\": true,\n    \"lib\": [\"es2015\", \"esnext\", \"dom\"],\n    \"outDir\": \"dist\",\n    \"paths\": {\n      \"guess-ga\": [\"guess-ga\"]\n    }\n  },\n  \"files\": [\"index.ts\", \"src/runtime/guess.ts\", \"src/runtime/runtime.ts\"]\n}\n"
  },
  {
    "path": "packages/guess-webpack/webpack.config.js",
    "content": "const CopyWebpackPlugin = require('copy-webpack-plugin');\n\nconst common = {\n  mode: 'production',\n  externals: [/^(@|\\w{3}(?<!\\w:\\\\)).*$/i],\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js']\n  },\n  module: {\n    rules: [\n      // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`\n      { test: /\\.tsx?$/, loader: 'ts-loader' }\n    ]\n  }\n};\n\nmodule.exports = [\n  {\n    mode: 'production',\n    externals: [/^(@|\\w{3}(?<!\\w:\\\\)).*$/i],\n    entry: `${__dirname}/api/index.ts`,\n    output: {\n      filename: 'api/index.js',\n      path: __dirname,\n      libraryTarget: 'commonjs'\n    },\n    target: 'web',\n    module: {\n      rules: [\n        {\n          test: /\\.tsx?$/,\n          loader: 'ts-loader',\n          options: {\n            // context: __dirname,\n            configFile: 'tsconfig-api.json'\n          }\n        }\n      ]\n    }\n  },\n  Object.assign(\n    {\n      entry: {\n        runtime: './src/runtime/runtime.ts'\n      },\n      target: 'node',\n      output: {\n        filename: '[name].js',\n        path: __dirname + '/dist/guess-webpack/',\n        libraryTarget: 'commonjs'\n      }\n    },\n    common\n  ),\n  Object.assign(\n    {\n      entry: {\n        guess: './src/runtime/guess.ts'\n      },\n      target: 'node',\n      output: {\n        filename: '[name].js',\n        path: __dirname + '/dist/guess-webpack/',\n        libraryTarget: 'commonjs'\n      }\n    },\n    common\n  ),\n  Object.assign(\n    {\n      entry: {\n        'guess-aot': './src/aot/guess-aot.ts'\n      },\n      target: 'node',\n      output: {\n        filename: '[name].js',\n        path: __dirname + '/dist/guess-webpack/',\n        libraryTarget: 'commonjs'\n      }\n    },\n    common\n  ),\n  Object.assign(\n    {\n      entry: './index.ts',\n      output: {\n        filename: 'main.js',\n        path: __dirname + '/dist/guess-webpack/',\n        libraryTarget: 'umd'\n      },\n      optimization: {\n        minimize: false\n      },\n      target: 'node',\n      node: {\n        __dirname: false,\n        __filename: false\n      },\n      plugins: [\n        new CopyWebpackPlugin([\n          { from: './src/runtime/runtime.tpl', to: 'runtime.tpl' },\n          { from: './src/aot/aot.tpl', to: 'aot.tpl' }\n        ])\n      ]\n    },\n    common\n  )\n];\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"extends\": [\n    \"config:base\"\n  ]\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"module\": \"commonjs\",\n    \"sourceMap\": true,\n    \"declaration\": true,\n    \"experimentalDecorators\": true,\n    \"strict\": true,\n    \"downlevelIteration\": true,\n    \"lib\": [\"es2015\", \"esnext\", \"dom\"]\n  },\n  \"exclude\": [\"packages/detector/test/fixtures\"]\n}\n"
  },
  {
    "path": "tslint.json",
    "content": "{\n  \"rules\": {\n    \"callable-types\": true,\n    \"class-name\": true,\n    \"comment-format\": [true, \"check-space\"],\n    \"curly\": true,\n    \"eofline\": true,\n    \"forin\": true,\n    \"import-blacklist\": [true, \"rxjs\"],\n    \"import-spacing\": true,\n    \"indent\": [true, \"spaces\"],\n    \"interface-over-type-literal\": true,\n    \"label-position\": true,\n    \"max-line-length\": [true, 140],\n    \"member-access\": false,\n    \"member-ordering\": [true, \"static-before-instance\", \"variables-before-functions\"],\n    \"no-arg\": true,\n    \"no-console\": [true, \"debug\", \"info\", \"time\", \"timeEnd\", \"trace\"],\n    \"no-construct\": true,\n    \"no-debugger\": true,\n    \"no-duplicate-variable\": true,\n    \"no-empty\": false,\n    \"no-empty-interface\": true,\n    \"no-eval\": true,\n    \"no-inferrable-types\": [true, \"ignore-params\"],\n    \"no-jasmine-focus\": true,\n    \"no-shadowed-variable\": true,\n    \"no-string-literal\": false,\n    \"no-string-throw\": true,\n    \"no-switch-case-fall-through\": true,\n    \"no-trailing-whitespace\": true,\n    \"no-unused-expression\": true,\n    \"no-use-before-declare\": true,\n    \"no-var-keyword\": true,\n    \"object-literal-sort-keys\": false,\n    \"one-line\": [true, \"check-open-brace\", \"check-catch\", \"check-else\", \"check-whitespace\"],\n    \"prefer-const\": true,\n    \"quotemark\": [true, \"single\"],\n    \"radix\": true,\n    \"semicolon\": [\"always\"],\n    \"triple-equals\": [true, \"allow-null-check\"],\n    \"typedef-whitespace\": [\n      true,\n      {\n        \"call-signature\": \"nospace\",\n        \"index-signature\": \"nospace\",\n        \"parameter\": \"nospace\",\n        \"property-declaration\": \"nospace\",\n        \"variable-declaration\": \"nospace\"\n      }\n    ],\n    \"typeof-compare\": true,\n    \"unified-signatures\": true,\n    \"variable-name\": false,\n    \"whitespace\": [true, \"check-branch\", \"check-decl\", \"check-operator\", \"check-separator\", \"check-type\"],\n\n    \"directive-selector\": [true, \"attribute\", \"aio\", \"camelCase\"],\n    \"component-selector\": [true, \"element\", \"aio\", \"kebab-case\"],\n    \"use-input-property-decorator\": true,\n    \"use-output-property-decorator\": true,\n    \"use-host-property-decorator\": true,\n    \"no-input-rename\": true,\n    \"no-output-rename\": true,\n    \"use-life-cycle-interface\": true,\n    \"use-pipe-transform-interface\": true,\n    \"component-class-suffix\": true,\n    \"directive-class-suffix\": true,\n    \"no-access-missing-member\": true,\n    \"templates-use-public\": true,\n    \"invoke-injectable\": true\n  }\n}\n"
  }
]