├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── DEVELOPING.md ├── LICENSE ├── README.md ├── experiments └── guess-static-sites │ ├── .gitignore │ ├── README.md │ ├── config.js │ ├── generatePredictions.js │ ├── package-lock.json │ ├── package.json │ ├── predictiveFetching.js │ ├── server.js │ ├── src │ ├── models │ │ ├── pageView.js │ │ └── prediction.js │ ├── parser.js │ └── queryParams.js │ └── test │ ├── clientTests.js │ ├── fixtures │ ├── gaResponse.json │ ├── server.js │ └── test.html │ ├── gaClientTests.js │ └── serverTests.js ├── infra ├── e2e.ts ├── install.ts ├── pretest.ts └── test.ts ├── jest-puppeteer.config.js ├── jest.config.js ├── lerna.json ├── package-lock.json ├── package.json ├── packages ├── common │ ├── interfaces.ts │ └── logger.ts ├── guess-ga │ ├── .npmignore │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── client.ts │ │ ├── ga.ts │ │ └── normalize.ts │ ├── test │ │ └── normalize.spec.ts │ ├── tsconfig.json │ └── webpack.config.js ├── guess-parser │ ├── .npmignore │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── angular │ │ │ ├── index.ts │ │ │ ├── modules.ts │ │ │ ├── route-parser.ts │ │ │ └── routes.ts │ │ ├── detector │ │ │ ├── detect.ts │ │ │ └── index.ts │ │ ├── language-service.ts │ │ ├── parser.ts │ │ ├── preact │ │ │ └── index.ts │ │ ├── react │ │ │ ├── base.ts │ │ │ ├── index.ts │ │ │ ├── react-jsx.ts │ │ │ └── react-tsx.ts │ │ └── utils.ts │ ├── test │ │ ├── angular.spec.ts │ │ ├── detect.spec.ts │ │ ├── fixtures │ │ │ ├── angular │ │ │ │ ├── .angular-cli.json │ │ │ │ ├── library │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── library.module.ts │ │ │ │ │ ├── nested │ │ │ │ │ │ └── library.module.ts │ │ │ │ │ └── tsconfig.json │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ ├── src │ │ │ │ │ ├── app │ │ │ │ │ │ ├── about │ │ │ │ │ │ │ ├── about-routing.module.ts │ │ │ │ │ │ │ └── about.module.ts │ │ │ │ │ │ ├── app-routing.module.ts │ │ │ │ │ │ ├── app.component.css │ │ │ │ │ │ ├── app.component.html │ │ │ │ │ │ ├── app.component.spec.ts │ │ │ │ │ │ ├── app.component.ts │ │ │ │ │ │ ├── app.module.ts │ │ │ │ │ │ ├── bar-simple.component.ts │ │ │ │ │ │ ├── bar │ │ │ │ │ │ │ ├── bar.module.ts │ │ │ │ │ │ │ └── baz │ │ │ │ │ │ │ │ ├── baz.module.ts │ │ │ │ │ │ │ │ └── cycle-parent.ts │ │ │ │ │ │ ├── foo │ │ │ │ │ │ │ ├── baz │ │ │ │ │ │ │ │ ├── baz-routing.module.ts │ │ │ │ │ │ │ │ ├── baz.component.ts │ │ │ │ │ │ │ │ └── baz.module.ts │ │ │ │ │ │ │ ├── foo-routing.module.ts │ │ │ │ │ │ │ ├── foo.component.ts │ │ │ │ │ │ │ └── foo.module.ts │ │ │ │ │ │ ├── lazy │ │ │ │ │ │ │ ├── lazy-routing.module.ts │ │ │ │ │ │ │ ├── lazy.component.ts │ │ │ │ │ │ │ └── lazy.module.ts │ │ │ │ │ │ ├── qux │ │ │ │ │ │ │ └── qux.module.ts │ │ │ │ │ │ └── wrapper │ │ │ │ │ │ │ └── wrapper.module.ts │ │ │ │ │ ├── environments │ │ │ │ │ │ ├── environment.prod.ts │ │ │ │ │ │ └── environment.ts │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── index.html │ │ │ │ │ ├── main.ts │ │ │ │ │ ├── polyfills.ts │ │ │ │ │ ├── styles.css │ │ │ │ │ ├── test.ts │ │ │ │ │ ├── tsconfig.app.json │ │ │ │ │ ├── tsconfig.spec.json │ │ │ │ │ └── typings.d.ts │ │ │ │ └── tsconfig.json │ │ │ ├── gatsby │ │ │ │ ├── .gitignore │ │ │ │ ├── .prettierrc │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── gatsby-browser.js │ │ │ │ ├── gatsby-config.js │ │ │ │ ├── gatsby-node.js │ │ │ │ ├── gatsby-ssr.js │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ └── src │ │ │ │ │ ├── components │ │ │ │ │ └── header.js │ │ │ │ │ ├── layouts │ │ │ │ │ ├── index.css │ │ │ │ │ └── index.js │ │ │ │ │ └── pages │ │ │ │ │ ├── 404.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── page-2.js │ │ │ ├── ng8 │ │ │ │ ├── .editorconfig │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── angular.json │ │ │ │ ├── browserslist │ │ │ │ ├── e2e │ │ │ │ │ ├── protractor.conf.js │ │ │ │ │ ├── src │ │ │ │ │ │ ├── app.e2e-spec.ts │ │ │ │ │ │ └── app.po.ts │ │ │ │ │ └── tsconfig.json │ │ │ │ ├── karma.conf.js │ │ │ │ ├── package.json │ │ │ │ ├── src │ │ │ │ │ ├── app │ │ │ │ │ │ ├── app-routing.module.ts │ │ │ │ │ │ ├── app.component.css │ │ │ │ │ │ ├── app.component.html │ │ │ │ │ │ ├── app.component.spec.ts │ │ │ │ │ │ ├── app.component.ts │ │ │ │ │ │ └── app.module.ts │ │ │ │ │ ├── assets │ │ │ │ │ │ └── .gitkeep │ │ │ │ │ ├── environments │ │ │ │ │ │ ├── environment.prod.ts │ │ │ │ │ │ └── environment.ts │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── index.html │ │ │ │ │ ├── main.ts │ │ │ │ │ ├── polyfills.ts │ │ │ │ │ ├── styles.css │ │ │ │ │ └── test.ts │ │ │ │ ├── tsconfig.app.json │ │ │ │ ├── tsconfig.json │ │ │ │ ├── tsconfig.spec.json │ │ │ │ └── tslint.json │ │ │ ├── nx │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── angular.json │ │ │ │ ├── apps │ │ │ │ │ ├── customers-ui-e2e │ │ │ │ │ │ └── src │ │ │ │ │ │ │ └── integration │ │ │ │ │ │ │ └── customers.component.spec.ts │ │ │ │ │ ├── feat-home-e2e │ │ │ │ │ │ ├── cypress.json │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ ├── fixtures │ │ │ │ │ │ │ │ └── example.json │ │ │ │ │ │ │ ├── integration │ │ │ │ │ │ │ │ └── home.component.spec.ts │ │ │ │ │ │ │ ├── plugins │ │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ │ └── support │ │ │ │ │ │ │ │ ├── commands.ts │ │ │ │ │ │ │ │ └── index.ts │ │ │ │ │ │ ├── tsconfig.e2e.json │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ └── tslint.json │ │ │ │ │ ├── ng-cli-app-e2e │ │ │ │ │ │ ├── cypress.json │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ ├── fixtures │ │ │ │ │ │ │ │ └── example.json │ │ │ │ │ │ │ ├── integration │ │ │ │ │ │ │ │ ├── app.spec.ts │ │ │ │ │ │ │ │ ├── customers.spec.ts │ │ │ │ │ │ │ │ └── home.spec.ts │ │ │ │ │ │ │ ├── plugins │ │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ │ └── support │ │ │ │ │ │ │ │ ├── app.po.ts │ │ │ │ │ │ │ │ ├── commands.ts │ │ │ │ │ │ │ │ └── index.ts │ │ │ │ │ │ ├── tsconfig.e2e.json │ │ │ │ │ │ └── tsconfig.json │ │ │ │ │ ├── ng-cli-app │ │ │ │ │ │ ├── browserslist │ │ │ │ │ │ ├── karma.conf.js │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ ├── app │ │ │ │ │ │ │ │ ├── app.component.html │ │ │ │ │ │ │ │ ├── app.component.scss │ │ │ │ │ │ │ │ ├── app.component.spec.ts │ │ │ │ │ │ │ │ ├── app.component.ts │ │ │ │ │ │ │ │ └── app.module.ts │ │ │ │ │ │ │ ├── assets │ │ │ │ │ │ │ │ ├── .gitkeep │ │ │ │ │ │ │ │ └── customers.json │ │ │ │ │ │ │ ├── environments │ │ │ │ │ │ │ │ ├── environment.prod.ts │ │ │ │ │ │ │ │ └── environment.ts │ │ │ │ │ │ │ ├── favicon.ico │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ ├── main.ts │ │ │ │ │ │ │ ├── polyfills.ts │ │ │ │ │ │ │ ├── styles.scss │ │ │ │ │ │ │ └── test.ts │ │ │ │ │ │ ├── tsconfig.app.json │ │ │ │ │ │ └── tsconfig.spec.json │ │ │ │ │ └── shared-components-e2e │ │ │ │ │ │ ├── cypress.json │ │ │ │ │ │ ├── src │ │ │ │ │ │ ├── fixtures │ │ │ │ │ │ │ └── example.json │ │ │ │ │ │ ├── integration │ │ │ │ │ │ │ ├── info-box │ │ │ │ │ │ │ │ └── info-box.component.spec.ts │ │ │ │ │ │ │ └── navigation │ │ │ │ │ │ │ │ └── navigation.component.spec.ts │ │ │ │ │ │ ├── plugins │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ └── support │ │ │ │ │ │ │ ├── commands.ts │ │ │ │ │ │ │ └── index.ts │ │ │ │ │ │ ├── tsconfig.e2e.json │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ └── tslint.json │ │ │ │ ├── docs │ │ │ │ │ ├── _config.yml │ │ │ │ │ ├── index.md │ │ │ │ │ └── scalable_angular_architecture_with_nx.pdf │ │ │ │ ├── index.js │ │ │ │ ├── jest.config.js │ │ │ │ ├── karma.conf.js │ │ │ │ ├── libs │ │ │ │ │ ├── .gitkeep │ │ │ │ │ ├── auth │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── jest.config.js │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ ├── lib │ │ │ │ │ │ │ │ ├── auth-routing.module.ts │ │ │ │ │ │ │ │ ├── auth.guard.spec.ts │ │ │ │ │ │ │ │ ├── auth.guard.ts │ │ │ │ │ │ │ │ ├── auth.module.spec.ts │ │ │ │ │ │ │ │ ├── auth.module.ts │ │ │ │ │ │ │ │ ├── auth.service.spec.ts │ │ │ │ │ │ │ │ ├── auth.service.ts │ │ │ │ │ │ │ │ └── login │ │ │ │ │ │ │ │ │ ├── login.component.html │ │ │ │ │ │ │ │ │ ├── login.component.scss │ │ │ │ │ │ │ │ │ ├── login.component.spec.ts │ │ │ │ │ │ │ │ │ └── login.component.ts │ │ │ │ │ │ │ └── test-setup.ts │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ ├── tsconfig.lib.json │ │ │ │ │ │ ├── tsconfig.spec.json │ │ │ │ │ │ └── tslint.json │ │ │ │ │ ├── customers │ │ │ │ │ │ ├── data │ │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ │ ├── jest.config.js │ │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ │ ├── lib │ │ │ │ │ │ │ │ │ ├── customer.model.ts │ │ │ │ │ │ │ │ │ ├── customer.service.spec.ts │ │ │ │ │ │ │ │ │ └── customer.service.ts │ │ │ │ │ │ │ │ └── test-setup.ts │ │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ │ ├── tsconfig.lib.json │ │ │ │ │ │ │ ├── tsconfig.spec.json │ │ │ │ │ │ │ └── tslint.json │ │ │ │ │ │ └── ui │ │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ │ ├── jest.config.js │ │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ ├── lib │ │ │ │ │ │ │ │ ├── customer-list │ │ │ │ │ │ │ │ │ ├── customer-list-datasource.ts │ │ │ │ │ │ │ │ │ ├── customer-list.component.html │ │ │ │ │ │ │ │ │ ├── customer-list.component.scss │ │ │ │ │ │ │ │ │ ├── customer-list.component.spec.ts │ │ │ │ │ │ │ │ │ └── customer-list.component.ts │ │ │ │ │ │ │ │ ├── customers-routing.module.ts │ │ │ │ │ │ │ │ ├── customers-ui.module.spec.ts │ │ │ │ │ │ │ │ ├── customers-ui.module.ts │ │ │ │ │ │ │ │ ├── customers.component.html │ │ │ │ │ │ │ │ ├── customers.component.scss │ │ │ │ │ │ │ │ ├── customers.component.spec.ts │ │ │ │ │ │ │ │ └── customers.component.ts │ │ │ │ │ │ │ └── test-setup.ts │ │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ │ ├── tsconfig.lib.json │ │ │ │ │ │ │ ├── tsconfig.spec.json │ │ │ │ │ │ │ └── tslint.json │ │ │ │ │ ├── home │ │ │ │ │ │ └── ui │ │ │ │ │ │ │ ├── .storybook │ │ │ │ │ │ │ ├── addons.js │ │ │ │ │ │ │ ├── config.js │ │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ │ └── webpack.config.js │ │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ │ ├── jest.config.js │ │ │ │ │ │ │ ├── src │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ ├── lib │ │ │ │ │ │ │ │ ├── home-ui.module.spec.ts │ │ │ │ │ │ │ │ ├── home-ui.module.ts │ │ │ │ │ │ │ │ ├── home.component.html │ │ │ │ │ │ │ │ ├── home.component.scss │ │ │ │ │ │ │ │ ├── home.component.spec.ts │ │ │ │ │ │ │ │ ├── home.component.stories.ts │ │ │ │ │ │ │ │ └── home.component.ts │ │ │ │ │ │ │ └── test-setup.ts │ │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ │ ├── tsconfig.lib.json │ │ │ │ │ │ │ ├── tsconfig.spec.json │ │ │ │ │ │ │ └── tslint.json │ │ │ │ │ └── shared │ │ │ │ │ │ └── components │ │ │ │ │ │ ├── .storybook │ │ │ │ │ │ ├── addons.js │ │ │ │ │ │ ├── config.js │ │ │ │ │ │ ├── preview-head.html │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ └── webpack.config.js │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── jest.config.js │ │ │ │ │ │ ├── src │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── lib │ │ │ │ │ │ │ ├── info-box │ │ │ │ │ │ │ │ ├── info-box.component.html │ │ │ │ │ │ │ │ ├── info-box.component.scss │ │ │ │ │ │ │ │ ├── info-box.component.spec.ts │ │ │ │ │ │ │ │ ├── info-box.component.stories.ts │ │ │ │ │ │ │ │ └── info-box.component.ts │ │ │ │ │ │ │ ├── navigation │ │ │ │ │ │ │ │ ├── navigation.component.html │ │ │ │ │ │ │ │ ├── navigation.component.scss │ │ │ │ │ │ │ │ ├── navigation.component.spec.ts │ │ │ │ │ │ │ │ ├── navigation.component.stories.ts │ │ │ │ │ │ │ │ └── navigation.component.ts │ │ │ │ │ │ │ ├── shared-components.module.spec.ts │ │ │ │ │ │ │ └── shared-components.module.ts │ │ │ │ │ │ └── test-setup.ts │ │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ │ ├── tsconfig.lib.json │ │ │ │ │ │ ├── tsconfig.spec.json │ │ │ │ │ │ └── tslint.json │ │ │ │ ├── nx.json │ │ │ │ ├── package.json │ │ │ │ ├── scully.config.js │ │ │ │ ├── tools │ │ │ │ │ ├── schematics │ │ │ │ │ │ └── .gitkeep │ │ │ │ │ └── tsconfig.tools.json │ │ │ │ ├── tsconfig.json │ │ │ │ ├── tslint.json │ │ │ │ └── yarn.lock │ │ │ ├── preact-app │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── package.json │ │ │ │ └── src │ │ │ │ │ ├── .babelrc │ │ │ │ │ ├── assets │ │ │ │ │ └── favicon.ico │ │ │ │ │ ├── components │ │ │ │ │ ├── app.js │ │ │ │ │ ├── header │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── style.css │ │ │ │ │ └── info.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── manifest.json │ │ │ │ │ ├── routes │ │ │ │ │ ├── about │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── home │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── style.css │ │ │ │ │ └── profile │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── style.css │ │ │ │ │ ├── style │ │ │ │ │ └── index.css │ │ │ │ │ └── tests │ │ │ │ │ ├── __mocks__ │ │ │ │ │ └── browserMocks.js │ │ │ │ │ └── header.test.js │ │ │ ├── react-app-ts │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── images.d.ts │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ ├── src │ │ │ │ │ ├── App.css │ │ │ │ │ ├── App.tsx │ │ │ │ │ ├── LazyRoute.tsx │ │ │ │ │ ├── index.css │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── intro │ │ │ │ │ │ └── Intro.tsx │ │ │ │ │ ├── logo.svg │ │ │ │ │ ├── main │ │ │ │ │ │ ├── Main.tsx │ │ │ │ │ │ ├── kid │ │ │ │ │ │ │ └── Kid.tsx │ │ │ │ │ │ └── parent │ │ │ │ │ │ │ └── Parent.tsx │ │ │ │ │ └── registerServiceWorker.ts │ │ │ │ ├── tsconfig.json │ │ │ │ ├── tsconfig.test.json │ │ │ │ ├── tslint.json │ │ │ │ └── yarn.lock │ │ │ ├── react-app │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ ├── public │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── index.html │ │ │ │ │ └── manifest.json │ │ │ │ ├── src │ │ │ │ │ ├── App.css │ │ │ │ │ ├── App.jsx │ │ │ │ │ ├── LazyRoute.jsx │ │ │ │ │ ├── index.css │ │ │ │ │ ├── index.js │ │ │ │ │ ├── intro │ │ │ │ │ │ └── Intro.jsx │ │ │ │ │ ├── logo.svg │ │ │ │ │ └── main │ │ │ │ │ │ ├── Main.jsx │ │ │ │ │ │ ├── kid │ │ │ │ │ │ └── Kid.jsx │ │ │ │ │ │ └── parent │ │ │ │ │ │ └── Parent.jsx │ │ │ │ └── yarn.lock │ │ │ └── unknown │ │ │ │ └── package.json │ │ ├── parser.spec.ts │ │ ├── preact-jsx.spec.ts │ │ ├── react-jsx.spec.ts │ │ └── react-tsx.spec.ts │ ├── tsconfig.json │ └── webpack.config.js └── guess-webpack │ ├── .gitignore │ ├── .npmignore │ ├── README.md │ ├── api │ └── index.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── aot │ │ ├── aot.tpl │ │ └── guess-aot.ts │ ├── asset-observer.ts │ ├── compress.ts │ ├── declarations.ts │ ├── ga-provider.ts │ ├── guess-webpack.ts │ ├── prefetch-aot-plugin.ts │ ├── prefetch-plugin.ts │ ├── runtime │ │ ├── guess.ts │ │ ├── runtime.tpl │ │ └── runtime.ts │ └── utils.ts │ ├── test │ ├── e2e │ │ ├── delegate.spec.ts │ │ ├── next.spec.ts │ │ └── prefetch.spec.ts │ ├── fixtures │ │ ├── angular │ │ │ ├── .editorconfig │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── angular.json │ │ │ ├── e2e │ │ │ │ ├── protractor.conf.js │ │ │ │ ├── src │ │ │ │ │ ├── app.e2e-spec.ts │ │ │ │ │ └── app.po.ts │ │ │ │ └── tsconfig.e2e.json │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── routes.json │ │ │ ├── src │ │ │ │ ├── app │ │ │ │ │ ├── app-routing.module.ts │ │ │ │ │ ├── app.component.css │ │ │ │ │ ├── app.component.html │ │ │ │ │ ├── app.component.spec.ts │ │ │ │ │ ├── app.component.ts │ │ │ │ │ ├── app.module.ts │ │ │ │ │ ├── bar │ │ │ │ │ │ ├── bar.component.ts │ │ │ │ │ │ └── bar.module.ts │ │ │ │ │ ├── foo │ │ │ │ │ │ ├── baz │ │ │ │ │ │ │ ├── baz-routing.module.ts │ │ │ │ │ │ │ ├── baz.component.ts │ │ │ │ │ │ │ └── baz.module.ts │ │ │ │ │ │ ├── foo-routing.module.ts │ │ │ │ │ │ ├── foo.component.ts │ │ │ │ │ │ └── foo.module.ts │ │ │ │ │ └── qux │ │ │ │ │ │ ├── qux-routing.module.ts │ │ │ │ │ │ ├── qux.component.ts │ │ │ │ │ │ └── qux.module.ts │ │ │ │ ├── assets │ │ │ │ │ └── .gitkeep │ │ │ │ ├── browserslist │ │ │ │ ├── environments │ │ │ │ │ ├── environment.prod.ts │ │ │ │ │ └── environment.ts │ │ │ │ ├── favicon.ico │ │ │ │ ├── index.html │ │ │ │ ├── karma.conf.js │ │ │ │ ├── main.ts │ │ │ │ ├── polyfills.ts │ │ │ │ ├── styles.css │ │ │ │ ├── test.ts │ │ │ │ ├── tsconfig.app.json │ │ │ │ ├── tsconfig.spec.json │ │ │ │ └── tslint.json │ │ │ ├── tsconfig.json │ │ │ ├── tslint.json │ │ │ ├── webpack.extra.js │ │ │ └── yarn.lock │ │ ├── delegate │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ └── webpack.config.js │ │ ├── next │ │ │ ├── components │ │ │ │ └── layout.js │ │ │ ├── next.config.js │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── pages │ │ │ │ ├── about.js │ │ │ │ ├── contact.js │ │ │ │ └── index.js │ │ │ └── static │ │ │ │ └── favicon.ico │ │ └── prefetch │ │ │ ├── about.js │ │ │ ├── contact.js │ │ │ ├── home.js │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ └── webpack.config.js │ └── unit │ │ ├── compress.spec.ts │ │ ├── runtime.spec.ts │ │ └── utils.spec.ts │ ├── tsconfig-api.json │ ├── tsconfig.json │ └── webpack.config.js ├── renovate.json ├── tsconfig.json └── tslint.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | .vscode 4 | build 5 | node_modules 6 | npm-debug.log 7 | temp 8 | tmp-* 9 | .esm-cache/ 10 | dist 11 | lerna-debug.log 12 | *.d.ts 13 | 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: stable 3 | os: linux 4 | sudo: required 5 | 6 | install: 7 | - npm run bootstrap 8 | script: 9 | - npm run build 10 | - npm run test:ci 11 | - npm run e2e 12 | 13 | git: 14 | depth: 5 15 | 16 | cache: 17 | directories: 18 | - node_modules 19 | -------------------------------------------------------------------------------- /DEVELOPING.md: -------------------------------------------------------------------------------- 1 | # Developer's Guide 2 | 3 | This document explains how to build, test, and publish the packages from the monorepo. 4 | 5 | ## Installation 6 | 7 | In order to install all the dependencies run: 8 | 9 | ```bash 10 | npm run bootstrap 11 | ``` 12 | 13 | This 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. 14 | 15 | ## Build 16 | 17 | In order to build the packages run: 18 | 19 | ```bash 20 | npm run build 21 | ``` 22 | 23 | The command will build all the packages, topologically sorted. 24 | 25 | ## Publish 26 | 27 | To publish the packages, run: 28 | 29 | ```bash 30 | npm run publish 31 | ``` 32 | 33 | The `publish` script will delegate the execution to `lerna publish` which will take care of updating the dependencies' versions and publishing them to npm. 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Minko Gechev and the Guess 4 | contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /experiments/guess-static-sites/.gitignore: -------------------------------------------------------------------------------- 1 | *.env 2 | *.pem 3 | *.p12 4 | node_modules/ 5 | *.swp 6 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/config.js: -------------------------------------------------------------------------------- 1 | const env = process.env.NODE_ENV 2 | 3 | require('dotenv').config() 4 | 5 | const dev = { 6 | auth: { 7 | keyFileName: 'key.pem', 8 | viewID: process.env.VIEW_ID, 9 | serviceAccountEmail: process.env.SERVICE_ACCOUNT_EMAIL 10 | }, 11 | db: { 12 | mongoURL: 'mongodb://localhost:27017/guessjs_dev' 13 | }, 14 | server: { 15 | port: 3000, 16 | url: 'http://localhost:3000' 17 | } 18 | } 19 | 20 | const test = { 21 | auth: { 22 | keyFileName: 'key.pem', 23 | viewID: process.env.VIEW_ID, 24 | serviceAccountEmail: process.env.SERVICE_ACCOUNT_EMAIL 25 | }, 26 | db: { 27 | mongoURL: 'mongodb://localhost:27017/guessjs_test' 28 | }, 29 | server: { 30 | port: 3000, 31 | url: 'http://localhost:3000' 32 | } 33 | } 34 | 35 | const prod = { 36 | auth: { 37 | keyFileName: 'key.pem', 38 | viewID: process.env.VIEW_ID, 39 | serviceAccountEmail: process.env.SERVICE_ACCOUNT_EMAIL 40 | }, 41 | db: { 42 | mongoURL: 'mongodb://localhost:27017/guessjs_prod' 43 | }, 44 | server: { 45 | port: 3000, 46 | url: 'http://localhost:3000' 47 | } 48 | } 49 | 50 | const config = { 51 | dev, 52 | test, 53 | prod 54 | } 55 | 56 | module.exports = config[env] || config['dev'] 57 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/generatePredictions.js: -------------------------------------------------------------------------------- 1 | /* 2 | This scripts retrieves recent reporting data from Google Analytics 3 | and uses this to determine the "Most Likely Next Page" for each page on your site. 4 | This data is saved in Mongo. 5 | */ 6 | const {google} = require('googleapis') 7 | const fs = require('fs') 8 | const queryParams = require('./src/queryParams') 9 | const parser = require('./src/parser') 10 | const config = require('./config') 11 | const path = require('path') 12 | 13 | const authClient = new google.auth.JWT({ 14 | email: config.auth.serviceAccountEmail, 15 | key: fs.readFileSync(path.join(__dirname, config.auth.keyFileName), 'utf8'), 16 | scopes: ['https://www.googleapis.com/auth/analytics.readonly'] 17 | }) 18 | 19 | const getData = async (authClient) => { 20 | await authClient.authorize() 21 | const analytics = google.analyticsreporting({ 22 | version: 'v4', 23 | auth: authClient 24 | }) 25 | const response = await analytics.reports.batchGet(queryParams) 26 | await parser.saveReports(response.data.reports) 27 | process.exit() 28 | } 29 | 30 | getData(authClient) 31 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "guess-static-sites", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "generate-predictions-tests": "NODE_ENV=test mocha ./test/gaClientTests.js", 8 | "client-tests": "NODE_ENV=test mocha ./test/clientTests.js", 9 | "server-tests": "NODE_ENV=test mocha ./test/serverTests.js", 10 | "build": "babel src/client.js --out-file dist/client.js --presets minify" 11 | }, 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "body-parser": "^1.18.2", 16 | "dotenv": "^8.0.0", 17 | "express": "^4.16.3", 18 | "fs": "0.0.2", 19 | "googleapis": "^67.0.0", 20 | "mongoose": "^5.0.14" 21 | }, 22 | "devDependencies": { 23 | "babel-cli": "6.26.0", 24 | "babel-minify": "0.5.1", 25 | "babel-preset-es2015": "6.24.1", 26 | "babel-preset-minify": "0.5.1", 27 | "chai": "4.3.0", 28 | "cors": "2.8.5", 29 | "http-server": "0.12.1", 30 | "mocha": "8.3.1", 31 | "path": "0.12.7", 32 | "puppeteer": "7.1.0", 33 | "standard": "16.0.3", 34 | "supertest": "6.1.3" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/src/models/pageView.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose') 2 | 3 | const pageViewSchema = mongoose.Schema({ 4 | pagePath: String, 5 | clientInfo: Object, 6 | userFlow: Array, 7 | prefetchPath: String, 8 | actualNextPagePath: String 9 | }) 10 | const PageView = mongoose.model('PageView', pageViewSchema) 11 | 12 | module.exports = PageView 13 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/src/models/prediction.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose') 2 | 3 | const predictionSchema = mongoose.Schema({ 4 | pagePath: String, 5 | nextPagePath: String, 6 | nextPageCertainty: Number 7 | }) 8 | const Prediction = mongoose.model('Prediction', predictionSchema) 9 | 10 | module.exports = Prediction 11 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/src/queryParams.js: -------------------------------------------------------------------------------- 1 | const config = require('../config') 2 | 3 | const queryParams = { 4 | resource: { 5 | reportRequests: [ 6 | { 7 | viewId: config.auth.viewID, 8 | dateRanges: [{startDate: '30daysAgo', endDate: 'yesterday'}], 9 | metrics: [ 10 | {expression: 'ga:pageviews'}, 11 | {expression: 'ga:exits'} 12 | ], 13 | dimensions: [ 14 | {name: 'ga:previousPagePath'}, 15 | {name: 'ga:pagePath'} 16 | ], 17 | orderBys: [ 18 | {fieldName: 'ga:previousPagePath', sortOrder: 'ASCENDING'}, 19 | {fieldName: 'ga:pageviews', sortOrder: 'DESCENDING'} 20 | ], 21 | pageSize: 10000 22 | } 23 | ] 24 | } 25 | } 26 | 27 | module.exports = queryParams 28 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/test/fixtures/server.js: -------------------------------------------------------------------------------- 1 | // Simple static server for serving a page for testing front-end script 2 | const express = require('express') 3 | const cors = require('cors') 4 | const path = require('path') 5 | const fs = require('fs') 6 | 7 | const app = express() 8 | const PORT = 8080 9 | 10 | app.use(cors()) 11 | 12 | app.get('/test.html', function (req, res) { 13 | res.sendFile(path.join(__dirname + '/test.html')) 14 | }) 15 | 16 | app.get('/predictiveFetching.js', async (req, res) => { 17 | fs.readFile(path.join(__dirname + '/../../predictiveFetching.js'), 'utf8', (err, data) => { 18 | const response = data.replace(/http:\/\/YOUR_SERVER_ENDPOINT\//g, 'http://localhost:3000/') 19 | res.send(response) 20 | }) 21 | }) 22 | 23 | app.listen(PORT, function () { 24 | console.log('Test web server listening on port ' + PORT) 25 | }) 26 | -------------------------------------------------------------------------------- /experiments/guess-static-sites/test/fixtures/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Next Page Predictor 6 | 7 | 8 | Page for testing predictive fetching. 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /infra/install.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { execSync } from 'child_process'; 3 | 4 | const PackagesDir = join(process.cwd(), 'packages'); 5 | console.log( 6 | execSync( 7 | `cd ${join(PackagesDir, 'guess-parser', 'test', 'fixtures', 'angular')} && npm i` 8 | ).toString() 9 | ); 10 | -------------------------------------------------------------------------------- /infra/pretest.ts: -------------------------------------------------------------------------------- 1 | import { readdirSync } from 'fs'; 2 | import { join } from 'path'; 3 | import { execSync } from 'child_process'; 4 | 5 | const cwd = process.cwd(); 6 | const base = join(cwd, 'packages', 'guess-webpack', 'test', 'fixtures'); 7 | 8 | readdirSync(base).forEach(dir => { 9 | if (dir === '.' || dir === '..') { 10 | return; 11 | } 12 | execSync(`cd ${join(base, dir)} && rm -rf dist && npm i && npm run build`); 13 | }); 14 | -------------------------------------------------------------------------------- /infra/test.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { spawn } from 'child_process'; 3 | import chalk from 'chalk'; 4 | 5 | const StaticServer = require('static-server'); 6 | const port = 5122; 7 | 8 | const setupMockServers = () => 9 | new Promise(resolve => { 10 | const server = new StaticServer({ 11 | rootPath: join(process.cwd(), 'packages', 'guess-webpack', 'test', 'fixtures'), 12 | port 13 | }); 14 | 15 | server.start(() => { 16 | console.log(chalk.yellow('Test server started on port', server.port)); 17 | resolve(server); 18 | }); 19 | }); 20 | 21 | async function main() { 22 | await setupMockServers(); 23 | const options = process.argv.filter(a => a === '--watch'); 24 | const jest = spawn(`${process.cwd()}/node_modules/.bin/jest`, options, { stdio: 'inherit' }); 25 | return new Promise(resolve => { 26 | jest.on('exit', code => resolve(code)); 27 | jest.on('close', code => resolve(code)); 28 | }); 29 | } 30 | 31 | main().then(code => process.exit(code)); 32 | -------------------------------------------------------------------------------- /jest-puppeteer.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | launch: { 3 | args: ['--no-sandbox', '--disable-setuid-sandbox'], 4 | headless: true 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transform: { 3 | '^.+\\.tsx?$': 'ts-jest' 4 | }, 5 | testRegex: '(/test/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', 6 | testPathIgnorePatterns: [ 7 | '/packages/guess-parser/test/fixtures', 8 | '/infra/test.ts', 9 | '/experiments/guess-static-sites/test', 10 | '/packages/guess-webpack/test/fixtures' 11 | ], 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 13 | preset: '/node_modules/jest-puppeteer', 14 | globals: { 15 | window: {} 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.11.0", 3 | "packages": [ 4 | "packages/*" 5 | ], 6 | "version": "0.4.22" 7 | } 8 | -------------------------------------------------------------------------------- /packages/common/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface Neighbors { 2 | [key: string]: number; 3 | } 4 | 5 | export interface Graph { 6 | [key: string]: Neighbors; 7 | } 8 | 9 | export interface Module { 10 | modulePath: string; 11 | parentModulePath: string; 12 | } 13 | 14 | export interface RoutingModule { 15 | path: string; 16 | modulePath: string; 17 | parentModulePath: string | null; 18 | lazy: boolean; 19 | redirectTo?: string; 20 | } 21 | 22 | export interface Connection { 23 | from: string; 24 | weight: number; 25 | to: string; 26 | } 27 | 28 | export interface Period { 29 | startDate: Date; 30 | endDate: Date; 31 | } 32 | 33 | export enum ProjectType { 34 | AngularCLI = 'angular-cli', 35 | CreateReactApp = 'create-react-app', 36 | PreactCLI = 'preact-cli', 37 | Gatsby = 'gatsby', 38 | CreateReactAppTypeScript = 'create-react-app-typescript' 39 | } 40 | 41 | export interface ProjectLayout { 42 | typescript?: string; 43 | tsconfigPath?: string; 44 | sourceDir?: string; 45 | } 46 | 47 | export interface ProjectMetadata { 48 | type: ProjectType; 49 | version: string; 50 | details?: ProjectLayout; 51 | } 52 | -------------------------------------------------------------------------------- /packages/guess-ga/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src 3 | test 4 | index.ts 5 | tsconfig.json 6 | webpack.config.js 7 | -------------------------------------------------------------------------------- /packages/guess-ga/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/ga'; 2 | -------------------------------------------------------------------------------- /packages/guess-ga/src/ga.ts: -------------------------------------------------------------------------------- 1 | import { getClient } from './client'; 2 | import { normalize } from './normalize'; 3 | import { Graph, Period } from '../../common/interfaces'; 4 | 5 | const PageSize = 10000; 6 | const id = (r: string) => r; 7 | const DefaultExpression = 'ga:pageviews'; 8 | 9 | export interface FetchConfig { 10 | auth: any; 11 | viewId: string; 12 | period: Period; 13 | formatter?: (route: string) => string; 14 | routes?: string[]; 15 | expression?: string; 16 | } 17 | 18 | export async function fetch(config: FetchConfig) { 19 | const client = getClient(config.auth, PageSize, config.viewId, config.period, config.expression || DefaultExpression); 20 | const graph: Graph = {}; 21 | for await (const val of client()) { 22 | if (val.error) { 23 | throw val.error; 24 | } 25 | const result = val.report; 26 | normalize(result.data, config.formatter || id, config.routes || []).forEach((n: any) => { 27 | const r = graph[n.from] || {}; 28 | r[n.to] = n.weight + (r[n.to] || 0); 29 | graph[n.from] = r; 30 | }); 31 | } 32 | return graph; 33 | } 34 | -------------------------------------------------------------------------------- /packages/guess-ga/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "experimentalDecorators": true, 8 | "strict": true, 9 | "outDir": "dist", 10 | "downlevelIteration": true, 11 | "lib": ["es2015", "esnext", "dom"] 12 | }, 13 | "files": ["index.ts"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/guess-ga/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mode: 'production', 3 | entry: './index.ts', 4 | target: 'node', 5 | output: { 6 | filename: './guess-ga/index.js', 7 | libraryTarget: 'umd' 8 | }, 9 | externals: [/^(@|\w{3}(? { 5 | const files: ts.MapLike<{ version: number }> = {}; 6 | 7 | // initialize the list of files 8 | rootFileNames.forEach(fileName => { 9 | files[fileName] = { version: 0 }; 10 | }); 11 | const servicesHost: ts.LanguageServiceHost = { 12 | getScriptFileNames: () => rootFileNames, 13 | getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(), 14 | getScriptSnapshot: fileName => { 15 | if (!existsSync(fileName)) { 16 | return undefined; 17 | } 18 | 19 | return ts.ScriptSnapshot.fromString(readFileSync(fileName).toString()); 20 | }, 21 | getCurrentDirectory: () => process.cwd(), 22 | getCompilationSettings: () => options, 23 | getDefaultLibFileName: o => ts.getDefaultLibFilePath(o) 24 | }; 25 | 26 | return ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); 27 | }; 28 | -------------------------------------------------------------------------------- /packages/guess-parser/src/react/index.ts: -------------------------------------------------------------------------------- 1 | export { parseReactRoutes } from './base'; 2 | export { parseRoutes as parseReactTSXRoutes } from './react-tsx'; 3 | export { parseRoutes as parseReactJSXRoutes } from './react-jsx'; 4 | -------------------------------------------------------------------------------- /packages/guess-parser/src/react/react-jsx.ts: -------------------------------------------------------------------------------- 1 | import { parseReactRoutes } from '.'; 2 | import { JsxEmit } from 'typescript'; 3 | import { RoutingModule } from '../../../common/interfaces'; 4 | import { readFiles } from '../utils'; 5 | 6 | export const parseRoutes = (base: string): RoutingModule[] => { 7 | return parseReactRoutes(readFiles(base), { 8 | jsx: JsxEmit.React, 9 | allowJs: true 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/guess-parser/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { statSync, readdirSync } from 'fs'; 2 | import { join } from 'path'; 3 | 4 | export const readFiles = (dir: string): string[] => { 5 | if (dir === 'node_modules') { 6 | return []; 7 | } 8 | const result = readdirSync(dir).map(node => join(dir, node)); 9 | const files = result.filter( 10 | node => statSync(node).isFile() && (node.endsWith('.jsx') || node.endsWith('.js')) 11 | ); 12 | const dirs = result.filter(node => statSync(node).isDirectory()); 13 | return [].concat.apply(files, (dirs.map(readFiles) as unknown) as ConcatArray[]); 14 | }; 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/library/index.ts: -------------------------------------------------------------------------------- 1 | export * from './nested/library.module'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/library/library.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | @Component({ 5 | 6 | }) 7 | class LibraryComponent {} 8 | 9 | @NgModule({ 10 | declarations: [LibraryComponent], 11 | imports: [RouterModule.forChild([ 12 | { 13 | path: '', 14 | component: LibraryComponent, 15 | pathMatch: 'full' 16 | } 17 | ])], 18 | bootstrap: [LibraryComponent] 19 | }) 20 | export class LibraryModule {} 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/library/nested/library.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | @Component({ 5 | 6 | }) 7 | class LibraryComponent {} 8 | 9 | @NgModule({ 10 | declarations: [LibraryComponent], 11 | imports: [RouterModule.forChild([ 12 | { 13 | path: '', 14 | component: LibraryComponent, 15 | pathMatch: 'full' 16 | } 17 | ])], 18 | bootstrap: [LibraryComponent] 19 | }) 20 | export class LibraryModule {} 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/library/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/library", 5 | "module": "es2015", 6 | "types": [] 7 | }, 8 | "include": ["**/*.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/about/about-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forChild(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AboutRoutingModule {} 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/about/about.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | import { AboutRoutingModule } from './about-routing.module'; 5 | 6 | @NgModule({ 7 | declarations: [], 8 | imports: [ 9 | CommonModule, 10 | AboutRoutingModule 11 | ] 12 | }) 13 | export class AboutModule { } 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/angular/src/app/app.component.css -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | Foo 2 | Bar 3 | Baz 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | describe('AppComponent', () => { 4 | beforeEach(async(() => { 5 | TestBed.configureTestingModule({ 6 | declarations: [ 7 | AppComponent 8 | ], 9 | }).compileComponents(); 10 | })); 11 | it('should create the app', async(() => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.debugElement.componentInstance; 14 | expect(app).toBeTruthy(); 15 | })); 16 | it(`should have as title 'app'`, async(() => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app.title).toEqual('app'); 20 | })); 21 | it('should render title in a h1 tag', async(() => { 22 | const fixture = TestBed.createComponent(AppComponent); 23 | fixture.detectChanges(); 24 | const compiled = fixture.debugElement.nativeElement; 25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'app'; 10 | } 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { AppRoutingModule } from './app-routing.module'; 6 | 7 | @NgModule({ 8 | declarations: [AppComponent], 9 | imports: [BrowserModule, AppRoutingModule], 10 | providers: [], 11 | bootstrap: [AppComponent] 12 | }) 13 | export class AppModule {} 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/bar-simple.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-component', 5 | template: 'Bar Simple' 6 | }) 7 | export class BarSimpleComponent {} 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/bar/bar.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | @NgModule({ 5 | imports: [ 6 | RouterModule.forChild([ 7 | { 8 | path: 'baz', 9 | loadChildren: () => import('./baz/baz.module').then(m => m.BazModule) 10 | } 11 | ]) 12 | ] 13 | }) 14 | export class BarModule {} 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/bar/baz/baz.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import './cycle-parent'; 4 | 5 | @Component({ 6 | selector: 'app-baz', 7 | template: 'Baz' 8 | }) 9 | export class BazComponent {} 10 | 11 | const routes: Routes = [ 12 | { 13 | path: '', 14 | pathMatch: 'full', 15 | component: BazComponent 16 | } 17 | ]; 18 | 19 | @NgModule({ 20 | declarations: [BazComponent], 21 | imports: [RouterModule.forChild(routes)], 22 | exports: [RouterModule] 23 | }) 24 | export class BazModule {} 25 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/bar/baz/cycle-parent.ts: -------------------------------------------------------------------------------- 1 | import './baz.module'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/foo/baz/baz-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { BazComponent } from './baz.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: BazComponent 9 | }, 10 | { 11 | path: 'index', 12 | component: BazComponent 13 | } 14 | ]; 15 | 16 | @NgModule({ 17 | imports: [RouterModule.forChild(routes)], 18 | exports: [RouterModule] 19 | }) 20 | export class BazRoutingModule {} 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/foo/baz/baz.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-baz', 5 | template: 'baz-component' 6 | }) 7 | export class BazComponent {} 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/foo/baz/baz.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BazComponent } from './baz.component'; 3 | import { BazRoutingModule } from './baz-routing.module'; 4 | 5 | @NgModule({ 6 | declarations: [BazComponent], 7 | imports: [BazRoutingModule], 8 | bootstrap: [BazComponent] 9 | }) 10 | export class FooModule {} 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/foo/foo-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { FooComponent } from './foo.component'; 4 | 5 | const baz = 'baz'; 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | pathMatch: 'full', 10 | component: FooComponent 11 | }, 12 | { 13 | path: 'index', 14 | component: FooComponent 15 | }, 16 | { 17 | path: 'baz', 18 | loadChildren: baz + '/baz.module#BazModule' 19 | }, 20 | { 21 | path: '', 22 | children: [ 23 | { 24 | path: 'child1', 25 | component: FooComponent 26 | } 27 | ] 28 | }, 29 | { 30 | path: 'foo-parent', 31 | children: [ 32 | { 33 | path: 'child2', 34 | component: FooComponent 35 | } 36 | ] 37 | } 38 | ]; 39 | 40 | @NgModule({ 41 | imports: [RouterModule.forChild(routes)], 42 | exports: [RouterModule] 43 | }) 44 | export class FooRoutingModule {} 45 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/foo/foo.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-foo', 5 | template: 'foo-component' 6 | }) 7 | export class FooComponent {} 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/foo/foo.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { FooComponent } from './foo.component'; 3 | import { FooRoutingModule } from './foo-routing.module'; 4 | 5 | @NgModule({ 6 | declarations: [FooComponent], 7 | imports: [FooRoutingModule], 8 | bootstrap: [FooComponent] 9 | }) 10 | export class FooModule {} 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/lazy/lazy-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { LazyComponent } from './lazy.component'; 5 | 6 | const routes: Routes = [{ path: '', component: LazyComponent }]; 7 | 8 | @NgModule({ 9 | imports: [RouterModule.forChild(routes)], 10 | exports: [RouterModule] 11 | }) 12 | export class LazyRoutingModule {} 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/lazy/lazy.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | template: '', 5 | }) 6 | export class LazyComponent { } 7 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/lazy/lazy.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | import { LazyRoutingModule } from './lazy-routing.module'; 5 | import { LazyComponent } from './lazy.component'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | LazyComponent 10 | ], 11 | imports: [ 12 | CommonModule, 13 | LazyRoutingModule 14 | ] 15 | }) 16 | export class LazyModule { } 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/qux/qux.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | @Component({ 5 | 6 | }) 7 | class QuxComponent {} 8 | 9 | 10 | @NgModule({ 11 | declarations: [QuxComponent], 12 | imports: [RouterModule.forChild([ 13 | { 14 | path: '', 15 | component: QuxComponent, 16 | pathMatch: 'full' 17 | } 18 | ])], 19 | bootstrap: [QuxComponent] 20 | }) 21 | export class QuxModule {} 22 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/app/wrapper/wrapper.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { LibraryModule } from '~library'; 3 | 4 | @NgModule({ 5 | imports: [LibraryModule] 6 | }) 7 | export class WrapperModule {} 8 | 9 | import { Component } from '@angular/core'; 10 | import { RouterModule } from '@angular/router'; 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/angular/src/favicon.ico -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "es2015", 6 | "types": [] 7 | }, 8 | "exclude": [ 9 | "test.ts", 10 | "**/*.spec.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "module": "commonjs", 6 | "types": [ 7 | "jasmine", 8 | "node" 9 | ] 10 | }, 11 | "files": [ 12 | "test.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ], 18 | "baseUrl": ".", 19 | "paths": { 20 | "~library": ["library/index.ts"], 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/.gitignore: -------------------------------------------------------------------------------- 1 | # Project dependencies 2 | .cache 3 | node_modules 4 | yarn-error.log 5 | 6 | # Build directory 7 | /public 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "trailingComma": "es5" 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 gatsbyjs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/README.md: -------------------------------------------------------------------------------- 1 | # gatsby-starter-default 2 | The default Gatsby starter. 3 | 4 | For an overview of the project structure please refer to the [Gatsby documentation - Building with Components](https://www.gatsbyjs.org/docs/building-with-components/). 5 | 6 | ## Install 7 | 8 | Make sure that you have the Gatsby CLI program installed: 9 | ```sh 10 | npm install --global gatsby-cli 11 | ``` 12 | 13 | And run from your CLI: 14 | ```sh 15 | gatsby new gatsby-example-site 16 | ``` 17 | 18 | Then you can run it by: 19 | ```sh 20 | cd gatsby-example-site 21 | npm run develop 22 | ``` 23 | 24 | ## Deploy 25 | 26 | [![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) 27 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/gatsby-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Browser APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/browser-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/gatsby-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | siteMetadata: { 3 | title: 'Gatsby Default Starter', 4 | }, 5 | plugins: ['gatsby-plugin-react-helmet'], 6 | } 7 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/gatsby-node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Node APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/node-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/gatsby-ssr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/ssr-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-starter-default", 3 | "description": "Gatsby default starter", 4 | "version": "1.0.0", 5 | "author": "Kyle Mathews ", 6 | "dependencies": { 7 | "gatsby": "^1.9.247", 8 | "gatsby-link": "^1.6.40", 9 | "gatsby-plugin-react-helmet": "^2.0.10", 10 | "react-helmet": "^5.2.0" 11 | }, 12 | "keywords": [ 13 | "gatsby" 14 | ], 15 | "license": "MIT", 16 | "scripts": { 17 | "build": "gatsby build", 18 | "develop": "gatsby develop", 19 | "format": "prettier --write 'src/**/*.js'", 20 | "test": "echo \"Error: no test specified\" && exit 1" 21 | }, 22 | "devDependencies": { 23 | "prettier": "^1.12.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/src/components/header.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from 'gatsby-link' 3 | 4 | const Header = ({ siteTitle }) => ( 5 |
11 |
18 |

19 | 26 | {siteTitle} 27 | 28 |

29 |
30 |
31 | ) 32 | 33 | export default Header 34 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/src/layouts/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import Helmet from 'react-helmet' 4 | 5 | import Header from '../components/header' 6 | import './index.css' 7 | 8 | const Layout = ({ children, data }) => ( 9 |
10 | 17 |
18 |
26 | {children()} 27 |
28 |
29 | ) 30 | 31 | Layout.propTypes = { 32 | children: PropTypes.func, 33 | } 34 | 35 | export default Layout 36 | 37 | export const query = graphql` 38 | query SiteTitleQuery { 39 | site { 40 | siteMetadata { 41 | title 42 | } 43 | } 44 | } 45 | ` 46 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/src/pages/404.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const NotFoundPage = () => ( 4 |
5 |

NOT FOUND

6 |

You just hit a route that doesn't exist... the sadness.

7 |
8 | ) 9 | 10 | export default NotFoundPage 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/src/pages/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from 'gatsby-link' 3 | 4 | const IndexPage = () => ( 5 |
6 |

Hi people

7 |

Welcome to your new Gatsby site.

8 |

Now go build something great.

9 | Go to page 2 10 |
11 | ) 12 | 13 | export default IndexPage 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/gatsby/src/pages/page-2.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from 'gatsby-link' 3 | 4 | const SecondPage = () => ( 5 |
6 |

Hi from the second page

7 |

Welcome to page 2

8 | Go back to the homepage 9 |
10 | ) 11 | 12 | export default SecondPage 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events.json 15 | speed-measure-plugin.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/README.md: -------------------------------------------------------------------------------- 1 | # Ng8 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.0.1. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To 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). 28 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | 'browserName': 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to ng8!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/ng8'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forRoot(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AppRoutingModule { } 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/ng8/src/app/app.component.css -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'ng8'; 10 | } 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | AppRoutingModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/ng8/src/assets/.gitkeep -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/ng8/src/favicon.ico -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ng8 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "include": [ 8 | "src/**/*.ts" 9 | ], 10 | "exclude": [ 11 | "src/test.ts", 12 | "src/**/*.spec.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "esnext", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/ng8/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Christian Janz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/README.md: -------------------------------------------------------------------------------- 1 | # Angular monorepo example using Nx 2 | 3 | This app shows the process of refactoring an Angular app to a monorepo with the help of [Nx](https://nx.dev/angular) 4 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/customers-ui-e2e/src/integration/customers.component.spec.ts: -------------------------------------------------------------------------------- 1 | describe('feat-customers', () => { 2 | beforeEach(() => cy.visit('/iframe.html?id=customerscomponent--primary')); 3 | 4 | it('should display correctly', () => { 5 | cy.wait(30000); 6 | cy.findByText('Customer Data'); 7 | cy.findByRole('grid') 8 | .get('tbody tr:first-child') 9 | .should('contain', '1') 10 | .should('contain', 'Waulker'); 11 | }); 12 | it('should sort by first name', () => { 13 | cy.findByText('first_name').click(); 14 | cy.findByRole('grid') 15 | .get('tbody tr:first-child') 16 | .should('contain', '22') 17 | .should('contain', 'Scattergood'); 18 | 19 | cy.findByText('first_name').click(); 20 | cy.findByRole('grid') 21 | .get('tbody tr:first-child') 22 | .should('contain', '25') 23 | .should('contain', 'Getley'); 24 | 25 | cy.findByText('first_name').click(); 26 | cy.findByRole('grid') 27 | .get('tbody tr:first-child') 28 | .should('contain', '1') 29 | .should('contain', 'Waulker'); 30 | }); 31 | 32 | it('should render the component', () => { 33 | cy.get('app-customers').should('exist'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileServerFolder": ".", 3 | "fixturesFolder": "./src/fixtures", 4 | "integrationFolder": "./src/integration", 5 | "modifyObstructiveCode": false, 6 | "pluginsFile": "./src/plugins/index", 7 | "supportFile": "./src/support/index.ts", 8 | "video": true, 9 | "videosFolder": "../../dist/cypress/apps/feat-home-e2e/videos", 10 | "screenshotsFolder": "../../dist/cypress/apps/feat-home-e2e/screenshots", 11 | "chromeWebSecurity": false, 12 | "baseUrl": "http://localhost:4400" 13 | } 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io" 4 | } 5 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/integration/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | describe('feat-home', () => { 2 | beforeEach(() => cy.visit('/iframe.html?id=homecomponent--primary')); 3 | 4 | it('should display correctly', () => { 5 | cy.wait(30000); 6 | cy.findByText('Welcome to the Demo App'); 7 | cy.findByText('🥳 Customer of the day'); 8 | cy.contains('mat-icon', 'person'); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/plugins/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example plugins/index.js can be used to load plugins 3 | // 4 | // You can change the location of this file or turn off loading 5 | // the plugins file with the 'pluginsFile' configuration option. 6 | // 7 | // You can read more here: 8 | // https://on.cypress.io/plugins-guide 9 | // *********************************************************** 10 | 11 | // This function is called when a project is opened or re-opened (e.g. due to 12 | // the project's config changing) 13 | 14 | const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); 15 | 16 | module.exports = (on, config) => { 17 | // `on` is used to hook into various events Cypress emits 18 | // `config` is the resolved Cypress config 19 | 20 | // Preprocess Typescript 21 | on('file:preprocessor', preprocessTypescript(config)); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/src/support/index.ts: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../../dist/out-tsc" 6 | }, 7 | "include": ["src/**/*.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["cypress", "node"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/feat-home-e2e/tslint.json: -------------------------------------------------------------------------------- 1 | {"extends":"../../tslint.json","rules":[]} -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileServerFolder": "./", 3 | "fixturesFolder": "./src/fixtures", 4 | "integrationFolder": "./src/integration", 5 | "pluginsFile": "./src/plugins/index.js", 6 | "supportFile": "./src/support/index.ts", 7 | "video": true, 8 | "videosFolder": "../../dist/out-tsc/apps/ng-cli-app-e2e/videos", 9 | "screenshotsFolder": "../../dist/out-tsc/apps/ng-cli-app-e2e/screenshots", 10 | "chromeWebSecurity": false 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io" 4 | } 5 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/integration/app.spec.ts: -------------------------------------------------------------------------------- 1 | describe('app', () => { 2 | beforeEach(() => cy.visit('/')); 3 | 4 | it('should list all nav items', () => { 5 | cy.findByText('Home').click(); 6 | cy.findByText('Customers').click(); 7 | cy.url().should('contain', '/auth/login'); 8 | }); 9 | 10 | it('should fail login', () => { 11 | cy.login('something', 'badpass'); 12 | cy.findByText('Error: Wrong user or password'); 13 | }); 14 | 15 | it('should login', () => { 16 | cy.login('test', 'goodpass'); 17 | cy.url().should('contain', '/home'); 18 | }); 19 | 20 | it('should navigate to routes', () => { 21 | cy.login('test', 'goodpass'); 22 | cy.findByText('Home').click(); 23 | cy.url().should('contain', '/home'); 24 | cy.findByText('Customers').click(); 25 | cy.url().should('contain', '/customers'); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/integration/customers.spec.ts: -------------------------------------------------------------------------------- 1 | describe('customers', () => { 2 | beforeEach(() => { 3 | cy.login('test', 'goodpass'); 4 | cy.findByText('Customers').click(); 5 | }); 6 | 7 | it('should display correctly', () => { 8 | cy.wait(30000); 9 | cy.findByText('Customer Data'); 10 | cy.findByRole('grid') 11 | .get('tbody tr:first-child') 12 | .should('contain', '1') 13 | .should('contain', 'Waulker'); 14 | }); 15 | it('should sort by first name', () => { 16 | cy.findByText('first_name').click(); 17 | cy.findByRole('grid') 18 | .get('tbody tr:first-child') 19 | .should('contain', '22') 20 | .should('contain', 'Scattergood'); 21 | 22 | cy.findByText('first_name').click(); 23 | cy.findByRole('grid') 24 | .get('tbody tr:first-child') 25 | .should('contain', '25') 26 | .should('contain', 'Getley'); 27 | 28 | cy.findByText('first_name').click(); 29 | cy.findByRole('grid') 30 | .get('tbody tr:first-child') 31 | .should('contain', '1') 32 | .should('contain', 'Waulker'); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/integration/home.spec.ts: -------------------------------------------------------------------------------- 1 | describe('home', () => { 2 | beforeEach(() => cy.login('test', 'goodpass')); 3 | 4 | it('should display correctly', () => { 5 | cy.wait(30000); 6 | cy.findByText('Welcome to the Demo App'); 7 | cy.findByText('🥳 Customer of the day'); 8 | cy.contains('mat-icon', 'person'); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/plugins/index.js: -------------------------------------------------------------------------------- 1 | const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); // *********************************************************** 2 | // This example plugins/index.js can be used to load plugins 3 | // 4 | // You can change the location of this file or turn off loading 5 | // the plugins file with the 'pluginsFile' configuration option. 6 | // 7 | // You can read more here: 8 | // https://on.cypress.io/plugins-guide 9 | // *********************************************************** 10 | // This function is called when a project is opened or re-opened (e.g. due to 11 | // the project's config changing) 12 | module.exports = function(on, config) { 13 | on('file:preprocessor', preprocessTypescript(config)); 14 | // `on` is used to hook into various events Cypress emits 15 | // `config` is the resolved Cypress config 16 | }; 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/support/app.po.ts: -------------------------------------------------------------------------------- 1 | export const getGreeting = () => cy.get('h1'); 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/src/support/index.ts: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../../dist/out-tsc" 6 | }, 7 | "include": ["src/**/*.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["cypress", "@types/testing-library__cypress", "node"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/ng-cli-app'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: true, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | {{ user.fullName }} 5 | 6 | 7 |
8 | 9 |
10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.scss -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 5 | import { SharedComponentsModule } from '@ng-cli-app/shared/components'; 6 | 7 | describe('AppComponent', () => { 8 | beforeEach(async(() => { 9 | TestBed.configureTestingModule({ 10 | imports: [ 11 | RouterTestingModule, 12 | NoopAnimationsModule, 13 | SharedComponentsModule 14 | ], 15 | declarations: [AppComponent] 16 | }).compileComponents(); 17 | })); 18 | 19 | it('should create the app', () => { 20 | const fixture = TestBed.createComponent(AppComponent); 21 | const app = fixture.debugElement.componentInstance; 22 | expect(app).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { IdleMonitorService } from '@scullyio/ng-lib'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { AuthService, User } from '@ng-cli-app/auth'; 5 | 6 | @Component({ 7 | selector: 'app-root', 8 | templateUrl: './app.component.html', 9 | styleUrls: ['./app.component.scss'] 10 | }) 11 | export class AppComponent implements OnInit { 12 | public user$: Observable; 13 | 14 | constructor( 15 | private idle: IdleMonitorService, 16 | private authService: AuthService 17 | ) {} 18 | 19 | ngOnInit(): void { 20 | this.user$ = this.authService.currentUser$; 21 | } 22 | 23 | public logout() { 24 | this.authService.logout(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/assets/.gitkeep -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/favicon.ico -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Demo App 6 | 7 | 8 | 9 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import 'hammerjs'; 2 | import { enableProdMode } from '@angular/core'; 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | 5 | import { AppModule } from './app/app.module'; 6 | import { environment } from './environments/environment'; 7 | 8 | if (environment.production) { 9 | enableProdMode(); 10 | } 11 | 12 | platformBrowserDynamic() 13 | .bootstrapModule(AppModule) 14 | .catch(err => console.error(err)); 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, 4 | body { 5 | height: 100%; 6 | } 7 | body { 8 | margin: 0; 9 | font-family: Roboto, 'Helvetica Neue', sans-serif; 10 | } 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "types": [] 6 | }, 7 | "files": ["src/main.ts", "src/polyfills.ts"], 8 | "include": ["src/**/*.ts"], 9 | "exclude": ["src/test.ts", "src/**/*.spec.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/ng-cli-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "types": ["jasmine", "node"] 6 | }, 7 | "files": ["src/test.ts", "src/polyfills.ts"], 8 | "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileServerFolder": ".", 3 | "fixturesFolder": "./src/fixtures", 4 | "integrationFolder": "./src/integration", 5 | "modifyObstructiveCode": false, 6 | "pluginsFile": "./src/plugins/index", 7 | "supportFile": "./src/support/index.ts", 8 | "video": true, 9 | "videosFolder": "../../dist/cypress/apps/shared-components-e2e/videos", 10 | "screenshotsFolder": "../../dist/cypress/apps/shared-components-e2e/screenshots", 11 | "chromeWebSecurity": false, 12 | "baseUrl": "http://localhost:4400" 13 | } 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io" 4 | } 5 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/integration/info-box/info-box.component.spec.ts: -------------------------------------------------------------------------------- 1 | describe('shared-components', () => { 2 | it('should render the component', () => { 3 | cy.visit( 4 | '/iframe.html?id=infoboxcomponent--primary&knob-icon=person&knob-message=O-H-I-O' 5 | ); 6 | cy.get('app-info-box').should('exist'); 7 | cy.contains('Go Bucks'); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/integration/navigation/navigation.component.spec.ts: -------------------------------------------------------------------------------- 1 | describe('shared-components', () => { 2 | beforeEach(() => cy.visit('/iframe.html?id=navigationcomponent--primary')); 3 | 4 | it('should render the component', () => { 5 | cy.get('app-navigation').should('exist'); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/plugins/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example plugins/index.js can be used to load plugins 3 | // 4 | // You can change the location of this file or turn off loading 5 | // the plugins file with the 'pluginsFile' configuration option. 6 | // 7 | // You can read more here: 8 | // https://on.cypress.io/plugins-guide 9 | // *********************************************************** 10 | 11 | // This function is called when a project is opened or re-opened (e.g. due to 12 | // the project's config changing) 13 | 14 | const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); 15 | 16 | module.exports = (on, config) => { 17 | // `on` is used to hook into various events Cypress emits 18 | // `config` is the resolved Cypress config 19 | 20 | // Preprocess Typescript 21 | on('file:preprocessor', preprocessTypescript(config)); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/support/commands.ts: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // eslint-disable-next-line @typescript-eslint/no-namespace 11 | declare namespace Cypress { 12 | interface Chainable { 13 | login(email: string, password: string): void; 14 | } 15 | } 16 | // 17 | // -- This is a parent command -- 18 | Cypress.Commands.add('login', (email, password) => { 19 | console.log('Custom command example: Login', email, password); 20 | }); 21 | // 22 | // -- This is a child command -- 23 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 24 | // 25 | // 26 | // -- This is a dual command -- 27 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 28 | // 29 | // 30 | // -- This will overwrite an existing command -- 31 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 32 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/src/support/index.ts: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../../dist/out-tsc" 6 | }, 7 | "include": ["src/**/*.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["cypress", "node"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/apps/shared-components-e2e/tslint.json: -------------------------------------------------------------------------------- 1 | {"extends":"../../tslint.json","rules":[]} -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal 2 | title: Angular monorepo example using Nx 3 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | # Angular monorepo example using Nx 6 | 7 | This app shows the process of refactoring an Angular app to a monorepo with the help of [Nx](https://nx.dev/angular) 8 | 9 | # Slides 10 | 11 | The slides for the corresponding sessions of these samples can be found here: [Slides](./scalable_angular_architecture_with_nx.pdf). 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/docs/scalable_angular_architecture_with_nx.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/docs/scalable_angular_architecture_with_nx.pdf -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/index.js: -------------------------------------------------------------------------------- 1 | const { parseAngularRoutes } = require('guess-parser'); 2 | 3 | console.log(parseAngularRoutes('apps/ng-cli-app/tsconfig.app.json')); 4 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'], 3 | transform: { 4 | '^.+\\.(ts|js|html)$': 'ts-jest' 5 | }, 6 | resolver: '@nrwl/jest/plugins/resolver', 7 | moduleFileExtensions: ['ts', 'js', 'html'], 8 | coverageReporters: ['html'], 9 | passWithNoTests: true 10 | }; 11 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | const { join } = require('path'); 5 | const { constants } = require('karma'); 6 | 7 | module.exports = () => { 8 | return { 9 | basePath: '', 10 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 11 | plugins: [ 12 | require('karma-jasmine'), 13 | require('karma-chrome-launcher'), 14 | require('karma-jasmine-html-reporter'), 15 | require('karma-coverage-istanbul-reporter'), 16 | require('@angular-devkit/build-angular/plugins/karma') 17 | ], 18 | client: { 19 | clearContext: false // leave Jasmine Spec Runner output visible in browser 20 | }, 21 | coverageIstanbulReporter: { 22 | dir: join(__dirname, '../../coverage'), 23 | reports: ['html', 'lcovonly'], 24 | fixWebpackSourcePaths: true 25 | }, 26 | reporters: ['progress', 'kjhtml'], 27 | port: 9876, 28 | colors: true, 29 | logLevel: constants.LOG_INFO, 30 | autoWatch: true, 31 | browsers: ['Chrome'], 32 | singleRun: true 33 | }; 34 | }; 35 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/libs/.gitkeep -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/README.md: -------------------------------------------------------------------------------- 1 | # auth 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test auth` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'auth', 3 | preset: '../../jest.config.js', 4 | coverageDirectory: '../../coverage/libs/auth', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/AngularSnapshotSerializer.js', 7 | 'jest-preset-angular/HTMLCommentSerializer.js' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/auth.module'; 2 | export * from './lib/auth-routing.module'; 3 | export * from './lib/auth.guard'; 4 | export * from './lib/auth.service'; 5 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { LoginComponent } from './login/login.component'; 4 | 5 | export const AUTH_ROUTES: Routes = [ 6 | { path: 'login', component: LoginComponent } 7 | ]; 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async, inject } from '@angular/core/testing'; 2 | 3 | import { AuthGuard } from './auth.guard'; 4 | import { RouterTestingModule } from '@angular/router/testing'; 5 | 6 | describe('AuthGuard', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | imports: [RouterTestingModule], 10 | providers: [AuthGuard] 11 | }); 12 | }); 13 | 14 | it('should ...', inject([AuthGuard], (guard: AuthGuard) => { 15 | expect(guard).toBeTruthy(); 16 | })); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | CanActivate, 4 | ActivatedRouteSnapshot, 5 | RouterStateSnapshot, 6 | UrlTree, 7 | Router 8 | } from '@angular/router'; 9 | import { Observable } from 'rxjs'; 10 | import { AuthService } from './auth.service'; 11 | import { take, map } from 'rxjs/operators'; 12 | 13 | @Injectable({ 14 | providedIn: 'root' 15 | }) 16 | export class AuthGuard implements CanActivate { 17 | constructor(private authService: AuthService, private router: Router) {} 18 | 19 | canActivate( 20 | next: ActivatedRouteSnapshot, 21 | state: RouterStateSnapshot 22 | ): Observable { 23 | return this.authService.isAuthenticated$.pipe( 24 | take(1), 25 | map(authenticated => 26 | authenticated ? true : this.router.parseUrl('/auth/login') 27 | ) 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, TestBed } from '@angular/core/testing'; 2 | import { AuthModule } from './auth.module'; 3 | 4 | describe('AuthModule', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [AuthModule] 8 | }).compileComponents(); 9 | })); 10 | 11 | it('should create', () => { 12 | expect(AuthModule).toBeDefined(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { MatInputModule } from '@angular/material/input'; 4 | import { LoginComponent } from './login/login.component'; 5 | import { MatButtonModule } from '@angular/material/button'; 6 | import { MatCardModule } from '@angular/material/card'; 7 | import { ReactiveFormsModule } from '@angular/forms'; 8 | import { MatIconModule } from '@angular/material/icon'; 9 | 10 | import { SharedComponentsModule } from '@ng-cli-app/shared/components'; 11 | 12 | @NgModule({ 13 | declarations: [LoginComponent], 14 | imports: [ 15 | CommonModule, 16 | SharedComponentsModule, 17 | MatInputModule, 18 | MatButtonModule, 19 | ReactiveFormsModule, 20 | MatCardModule, 21 | MatIconModule 22 | ] 23 | }) 24 | export class AuthModule {} 25 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthService } from './auth.service'; 4 | import { RouterTestingModule } from '@angular/router/testing'; 5 | 6 | describe('AuthService', () => { 7 | beforeEach(() => 8 | TestBed.configureTestingModule({ 9 | imports: [RouterTestingModule] 10 | }) 11 | ); 12 | 13 | it('should be created', () => { 14 | const service: AuthService = TestBed.get(AuthService); 15 | expect(service).toBeTruthy(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BehaviorSubject, Observable, of, throwError } from 'rxjs'; 3 | import { map } from 'rxjs/operators'; 4 | import { Router } from '@angular/router'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class AuthService { 10 | private userSubject: BehaviorSubject = new BehaviorSubject(null); 11 | 12 | public currentUser$ = this.userSubject.asObservable(); 13 | 14 | public isAuthenticated$ = this.currentUser$.pipe(map(user => !!user)); 15 | 16 | constructor(private router: Router) {} 17 | 18 | public login(username: string, password: string): Observable { 19 | if ('test' === username) { 20 | const user = { username, fullName: 'Test User' }; 21 | 22 | this.userSubject.next(user); 23 | this.router.navigateByUrl('/'); 24 | 25 | return of(user); 26 | } 27 | 28 | return throwError(new Error('Wrong user or password')); 29 | } 30 | 31 | public logout() { 32 | this.userSubject.next(null); 33 | this.router.navigateByUrl('/auth/login'); 34 | } 35 | } 36 | 37 | export interface User { 38 | username: string; 39 | fullName: string; 40 | } 41 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/login/login.component.html: -------------------------------------------------------------------------------- 1 |

Login

2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/login/login.component.scss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | flex-direction: column; 4 | } 5 | 6 | form { 7 | display: flex; 8 | flex-direction: column; 9 | max-width: 250px; 10 | } 11 | 12 | app-info-box { 13 | margin-bottom: 2rem; 14 | } 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/lib/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormBuilder, Validators } from '@angular/forms'; 3 | import { AuthService } from '../auth.service'; 4 | import { catchError, tap, take } from 'rxjs/operators'; 5 | 6 | @Component({ 7 | selector: 'app-login', 8 | templateUrl: './login.component.html', 9 | styleUrls: ['./login.component.scss'] 10 | }) 11 | export class LoginComponent implements OnInit { 12 | public form: FormGroup; 13 | 14 | public error: string; 15 | 16 | constructor(fb: FormBuilder, private authService: AuthService) { 17 | this.form = fb.group({ 18 | username: ['', Validators.required], 19 | password: ['', Validators.required] 20 | }); 21 | } 22 | 23 | ngOnInit() {} 24 | 25 | public onSubmit() { 26 | if (this.form.valid) { 27 | this.authService 28 | .login(this.form.value.username, this.form.value.password) 29 | .pipe( 30 | take(1), 31 | catchError(error => (this.error = error.toString())) 32 | ) 33 | .subscribe(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": ["dom", "es2018"] 10 | }, 11 | "angularCompilerOptions": { 12 | "annotateForClosureCompiler": true, 13 | "skipTemplateCodegen": true, 14 | "strictMetadataEmit": true, 15 | "fullTemplateTypeCheck": true, 16 | "strictInjectionParameters": true, 17 | "enableResourceInlining": true 18 | }, 19 | "exclude": ["src/test-setup.ts", "**/*.spec.ts"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "emitDecoratorMetadata": true 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": ["**/*.spec.ts", "**/*.d.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/auth/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "app", "camelCase"], 5 | "component-selector": [true, "element", "app", "kebab-case"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/README.md: -------------------------------------------------------------------------------- 1 | # customers-data 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test customers-data` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'customers-data', 3 | preset: '../../../jest.config.js', 4 | coverageDirectory: '../../../coverage/libs/customers/data', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/AngularSnapshotSerializer.js', 7 | 'jest-preset-angular/HTMLCommentSerializer.js' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/customer.service'; 2 | export * from './lib/customer.model'; 3 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/src/lib/customer.model.ts: -------------------------------------------------------------------------------- 1 | export interface Customer { 2 | id: number; 3 | first_name: string; 4 | last_name: string; 5 | email: string; 6 | street: string; 7 | city: string; 8 | country: string; 9 | } 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/src/lib/customer.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerService } from './customer.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | 6 | describe('CustomerService', () => { 7 | beforeEach(() => 8 | TestBed.configureTestingModule({ 9 | imports: [HttpClientTestingModule] 10 | }) 11 | ); 12 | 13 | it('should be created', () => { 14 | const service: CustomerService = TestBed.get(CustomerService); 15 | expect(service).toBeTruthy(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/src/lib/customer.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { Customer } from './customer.model'; 5 | import { shareReplay, map } from 'rxjs/operators'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class CustomerService { 11 | constructor(private httpClient: HttpClient) {} 12 | 13 | public getCustomers(): Observable { 14 | return this.httpClient 15 | .get('/assets/customers.json') 16 | .pipe(shareReplay(1)); 17 | } 18 | 19 | public getCustomerOfTheDay(): Observable { 20 | return this.getCustomers().pipe( 21 | map(customers => customers[Math.floor(Math.random() * customers.length)]) 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": ["dom", "es2018"] 10 | }, 11 | "angularCompilerOptions": { 12 | "annotateForClosureCompiler": true, 13 | "skipTemplateCodegen": true, 14 | "strictMetadataEmit": true, 15 | "fullTemplateTypeCheck": true, 16 | "strictInjectionParameters": true, 17 | "enableResourceInlining": true 18 | }, 19 | "exclude": ["src/test-setup.ts", "**/*.spec.ts"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "emitDecoratorMetadata": true 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": ["**/*.spec.ts", "**/*.d.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/data/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "app", "camelCase"], 5 | "component-selector": [true, "element", "app", "kebab-case"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/README.md: -------------------------------------------------------------------------------- 1 | # feat-customers 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test feat-customers` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'feat-customers', 3 | preset: '../../../jest.config.js', 4 | coverageDirectory: '../../../coverage/libs/customers/ui', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/AngularSnapshotSerializer.js', 7 | 'jest-preset-angular/HTMLCommentSerializer.js' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/customers-ui.module'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customer-list/customer-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
{{ col }}{{ row[col] }}
11 | 12 | 18 | 19 |
20 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customer-list/customer-list.component.scss: -------------------------------------------------------------------------------- 1 | .full-width-table { 2 | width: 100%; 3 | } 4 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { CustomersComponent } from './customers.component'; 5 | import { CustomerListComponent } from './customer-list/customer-list.component'; 6 | 7 | export const routes: Routes = [ 8 | { 9 | path: '', 10 | component: CustomersComponent, 11 | children: [ 12 | { path: '', pathMatch: 'full', redirectTo: 'list' }, 13 | { path: 'list', component: CustomerListComponent } 14 | ] 15 | } 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [RouterModule.forChild(routes)], 20 | exports: [RouterModule] 21 | }) 22 | export class CustomersRoutingModule {} 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers-ui.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, TestBed } from '@angular/core/testing'; 2 | import { CustomersUiModule } from './feat-customers.module'; 3 | 4 | describe('CustomersUiModule', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [CustomersUiModule] 8 | }).compileComponents(); 9 | })); 10 | 11 | it('should create', () => { 12 | expect(CustomersUiModule).toBeDefined(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers-ui.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | import { CustomersRoutingModule } from './customers-routing.module'; 5 | import { CustomersComponent } from './customers.component'; 6 | import { CustomerListComponent } from './customer-list/customer-list.component'; 7 | import { MatTableModule } from '@angular/material/table'; 8 | import { MatPaginatorModule } from '@angular/material/paginator'; 9 | import { MatSortModule } from '@angular/material/sort'; 10 | 11 | @NgModule({ 12 | declarations: [CustomersComponent, CustomerListComponent], 13 | imports: [ 14 | CommonModule, 15 | CustomersRoutingModule, 16 | MatTableModule, 17 | MatPaginatorModule, 18 | MatSortModule 19 | ], 20 | exports: [CustomerListComponent] 21 | }) 22 | export class CustomersUiModule {} 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.html: -------------------------------------------------------------------------------- 1 |

Customer Data

2 | 3 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.scss -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomersComponent } from './customers.component'; 4 | import { RouterTestingModule } from '@angular/router/testing'; 5 | 6 | describe('CustomersComponent', () => { 7 | let component: CustomersComponent; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | imports: [RouterTestingModule], 13 | declarations: [CustomersComponent] 14 | }).compileComponents(); 15 | })); 16 | 17 | beforeEach(() => { 18 | fixture = TestBed.createComponent(CustomersComponent); 19 | component = fixture.componentInstance; 20 | fixture.detectChanges(); 21 | }); 22 | 23 | it('should create', () => { 24 | expect(component).toBeTruthy(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/lib/customers.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-customers', 5 | templateUrl: './customers.component.html', 6 | styleUrls: ['./customers.component.scss'] 7 | }) 8 | export class CustomersComponent implements OnInit { 9 | constructor() {} 10 | 11 | ngOnInit() {} 12 | } 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": ["dom", "es2018"] 10 | }, 11 | "angularCompilerOptions": { 12 | "annotateForClosureCompiler": true, 13 | "skipTemplateCodegen": true, 14 | "strictMetadataEmit": true, 15 | "fullTemplateTypeCheck": true, 16 | "strictInjectionParameters": true, 17 | "enableResourceInlining": true 18 | }, 19 | "exclude": ["src/test-setup.ts", "**/*.spec.ts"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "emitDecoratorMetadata": true 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": ["**/*.spec.ts", "**/*.d.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/customers/ui/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "app", "camelCase"], 5 | "component-selector": [true, "element", "app", "kebab-case"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/addons.js: -------------------------------------------------------------------------------- 1 | import '../../../../.storybook/addons'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { configure, addDecorator } from '@storybook/angular'; 2 | import { withKnobs } from '@storybook/addon-knobs'; 3 | 4 | addDecorator(withKnobs); 5 | configure(require.context('../src/lib', true, /\.stories\.tsx?$/), module); 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "emitDecoratorMetadata": true 5 | }, 6 | "exclude": ["../src/test.ts", "../**/*.spec.ts"], 7 | "include": ["../src/**/*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/.storybook/webpack.config.js: -------------------------------------------------------------------------------- 1 | const rootWebpackConfig = require('../../../../.storybook/webpack.config'); 2 | // Export a function. Accept the base config as the only param. 3 | module.exports = async ({ config, mode }) => { 4 | config = await rootWebpackConfig({ config, mode }); 5 | 6 | return config; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/README.md: -------------------------------------------------------------------------------- 1 | # feat-home 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test feat-home` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'feat-home', 3 | preset: '../../../jest.config.js', 4 | coverageDirectory: '../../../coverage/libs/home/ui', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/AngularSnapshotSerializer.js', 7 | 'jest-preset-angular/HTMLCommentSerializer.js' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/home-ui.module'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home-ui.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, TestBed } from '@angular/core/testing'; 2 | import { HomeUiModule } from './feat-home.module'; 3 | 4 | describe('HomeUiModule', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [HomeUiModule] 8 | }).compileComponents(); 9 | })); 10 | 11 | it('should create', () => { 12 | expect(HomeUiModule).toBeDefined(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home-ui.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | import { HomeComponent } from './home.component'; 5 | import { SharedComponentsModule } from '@ng-cli-app/shared/components'; 6 | import { Routes, RouterModule } from '@angular/router'; 7 | 8 | export const routes: Routes = [{ path: '', component: HomeComponent }]; 9 | 10 | @NgModule({ 11 | declarations: [HomeComponent], 12 | imports: [CommonModule, SharedComponentsModule, RouterModule.forChild(routes)] 13 | }) 14 | export class HomeUiModule {} 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.html: -------------------------------------------------------------------------------- 1 |

Welcome to the Demo App

2 |
3 |

🥳 Customer of the day

4 | 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.scss -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | import { EMPTY } from 'rxjs'; 5 | import { SharedComponentsModule } from '@ng-cli-app/shared/components'; 6 | import { CustomerService } from '@ng-cli-app/customers/data'; 7 | 8 | describe('HomeComponent', () => { 9 | let component: HomeComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | const customerServiceMock = { 14 | getCustomerOfTheDay: () => EMPTY 15 | }; 16 | 17 | TestBed.configureTestingModule({ 18 | imports: [SharedComponentsModule], 19 | declarations: [HomeComponent], 20 | providers: [{ provide: CustomerService, useValue: customerServiceMock }] 21 | }).compileComponents(); 22 | })); 23 | 24 | beforeEach(() => { 25 | fixture = TestBed.createComponent(HomeComponent); 26 | component = fixture.componentInstance; 27 | fixture.detectChanges(); 28 | }); 29 | 30 | it('should create', () => { 31 | expect(component).toBeTruthy(); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/lib/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Observable } from 'rxjs'; 3 | import { map, filter } from 'rxjs/operators'; 4 | import { CustomerService, Customer } from '@ng-cli-app/customers/data'; 5 | 6 | @Component({ 7 | selector: 'app-home', 8 | templateUrl: './home.component.html', 9 | styleUrls: ['./home.component.scss'] 10 | }) 11 | export class HomeComponent implements OnInit { 12 | public customerOfTheDay$: Observable; 13 | 14 | constructor(private customerService: CustomerService) {} 15 | 16 | ngOnInit() { 17 | this.customerOfTheDay$ = this.customerService.getCustomerOfTheDay().pipe( 18 | filter(customer => !!customer), 19 | map( 20 | (customer: Customer) => customer.first_name + ' ' + customer.last_name 21 | ) 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": [ 10 | "dom", 11 | "es2018" 12 | ] 13 | }, 14 | "angularCompilerOptions": { 15 | "annotateForClosureCompiler": true, 16 | "skipTemplateCodegen": true, 17 | "strictMetadataEmit": true, 18 | "fullTemplateTypeCheck": true, 19 | "strictInjectionParameters": true, 20 | "enableResourceInlining": true 21 | }, 22 | "exclude": [ 23 | "src/test-setup.ts", 24 | "**/*.spec.ts", 25 | "**/*.stories.ts" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "emitDecoratorMetadata": true 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": ["**/*.spec.ts", "**/*.d.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/home/ui/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "app", "camelCase"], 5 | "component-selector": [true, "element", "app", "kebab-case"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/addons.js: -------------------------------------------------------------------------------- 1 | import '../../../../.storybook/addons'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { configure, addDecorator } from '@storybook/angular'; 2 | import { withKnobs } from '@storybook/addon-knobs'; 3 | 4 | addDecorator(withKnobs); 5 | configure(require.context('../src/lib', true, /\.stories\.tsx?$/), module); 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/preview-head.html: -------------------------------------------------------------------------------- 1 | 5 | 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "emitDecoratorMetadata": true 5 | }, 6 | "exclude": ["../src/test.ts", "../**/*.spec.ts"], 7 | "include": ["../src/**/*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/.storybook/webpack.config.js: -------------------------------------------------------------------------------- 1 | const rootWebpackConfig = require('../../../../.storybook/webpack.config'); 2 | // Export a function. Accept the base config as the only param. 3 | module.exports = async ({ config, mode }) => { 4 | config = await rootWebpackConfig({ config, mode }); 5 | 6 | return config; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/README.md: -------------------------------------------------------------------------------- 1 | # shared-components 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test shared-components` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'shared-components', 3 | preset: '../../../jest.config.js', 4 | coverageDirectory: '../../../coverage/libs/shared/components', 5 | snapshotSerializers: [ 6 | 'jest-preset-angular/AngularSnapshotSerializer.js', 7 | 'jest-preset-angular/HTMLCommentSerializer.js' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/shared-components.module'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | {{ icon }}{{ message }} 5 |
6 |
7 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.scss: -------------------------------------------------------------------------------- 1 | .box { 2 | display: flex; 3 | flex-direction: row; 4 | align-items: center; 5 | 6 | span { 7 | margin-left: 1rem; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { InfoBoxComponent } from './info-box.component'; 4 | import { MatCardModule } from '@angular/material/card'; 5 | import { MatIconModule } from '@angular/material/icon'; 6 | 7 | describe('InfoBoxComponent', () => { 8 | let component: InfoBoxComponent; 9 | let fixture: ComponentFixture; 10 | 11 | beforeEach(async(() => { 12 | TestBed.configureTestingModule({ 13 | imports: [MatCardModule, MatIconModule], 14 | declarations: [InfoBoxComponent] 15 | }).compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(InfoBoxComponent); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.stories.ts: -------------------------------------------------------------------------------- 1 | import { text, number, boolean } from '@storybook/addon-knobs'; 2 | import { SharedComponentsModule } from '../shared-components.module'; 3 | import { InfoBoxComponent } from './info-box.component'; 4 | import { MatCardModule } from '@angular/material/card'; 5 | import { MatIconModule } from '@angular/material/icon'; 6 | 7 | export default { 8 | title: 'InfoBoxComponent' 9 | }; 10 | 11 | export const primary = () => ({ 12 | moduleMetadata: { 13 | imports: [MatCardModule, MatIconModule] 14 | }, 15 | component: InfoBoxComponent, 16 | props: { 17 | icon: text('icon', ''), 18 | message: text('message', '') 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/info-box/info-box.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-info-box', 5 | templateUrl: './info-box.component.html', 6 | styleUrls: ['./info-box.component.scss'] 7 | }) 8 | export class InfoBoxComponent implements OnInit { 9 | @Input() icon: string; 10 | 11 | @Input() message: string; 12 | 13 | constructor() {} 14 | 15 | ngOnInit() {} 16 | } 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.scss: -------------------------------------------------------------------------------- 1 | .sidenav-container { 2 | height: 100%; 3 | } 4 | 5 | .sidenav { 6 | width: 200px; 7 | } 8 | 9 | .sidenav .mat-toolbar { 10 | background: inherit; 11 | } 12 | 13 | .mat-toolbar.mat-primary { 14 | position: sticky; 15 | top: 0; 16 | z-index: 1; 17 | } 18 | 19 | .active { 20 | background: rgba(0, 0, 0, 0.04); 21 | } 22 | 23 | main { 24 | padding: 1rem; 25 | } 26 | 27 | .spacer { 28 | flex: 1 0 auto; 29 | } 30 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.stories.ts: -------------------------------------------------------------------------------- 1 | 2 | import { SharedComponentsModule } from '../shared-components.module'; 3 | import { NavigationComponent } from './navigation.component'; 4 | 5 | export default { 6 | title: 'NavigationComponent' 7 | } 8 | 9 | export const primary = () => ({ 10 | moduleMetadata: { 11 | imports: [] 12 | }, 13 | component: NavigationComponent, 14 | props: { 15 | } 16 | }) 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/navigation/navigation.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; 3 | import { Observable } from 'rxjs'; 4 | import { map, shareReplay } from 'rxjs/operators'; 5 | 6 | @Component({ 7 | selector: 'app-navigation', 8 | templateUrl: './navigation.component.html', 9 | styleUrls: ['./navigation.component.scss'] 10 | }) 11 | export class NavigationComponent { 12 | isHandset$: Observable = this.breakpointObserver 13 | .observe(Breakpoints.Handset) 14 | .pipe( 15 | map(result => result.matches), 16 | shareReplay() 17 | ); 18 | 19 | constructor(private breakpointObserver: BreakpointObserver) {} 20 | } 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/shared-components.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, TestBed } from '@angular/core/testing'; 2 | import { SharedComponentsModule } from './shared-components.module'; 3 | 4 | describe('SharedComponentsModule', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [SharedComponentsModule] 8 | }).compileComponents(); 9 | })); 10 | 11 | it('should create', () => { 12 | expect(SharedComponentsModule).toBeDefined(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/lib/shared-components.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { LayoutModule } from '@angular/cdk/layout'; 4 | import { MatToolbarModule } from '@angular/material/toolbar'; 5 | import { MatButtonModule } from '@angular/material/button'; 6 | import { MatSidenavModule } from '@angular/material/sidenav'; 7 | import { MatIconModule } from '@angular/material/icon'; 8 | import { MatListModule } from '@angular/material/list'; 9 | import { MatCardModule } from '@angular/material/card'; 10 | import { RouterModule } from '@angular/router'; 11 | import { NavigationComponent } from './navigation/navigation.component'; 12 | import { InfoBoxComponent } from './info-box/info-box.component'; 13 | 14 | @NgModule({ 15 | declarations: [NavigationComponent, InfoBoxComponent], 16 | imports: [ 17 | CommonModule, 18 | RouterModule, 19 | LayoutModule, 20 | MatCardModule, 21 | MatToolbarModule, 22 | MatButtonModule, 23 | MatSidenavModule, 24 | MatIconModule, 25 | MatListModule 26 | ], 27 | exports: [NavigationComponent, InfoBoxComponent] 28 | }) 29 | export class SharedComponentsModule {} 30 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["node", "jest"] 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": [ 10 | "dom", 11 | "es2018" 12 | ] 13 | }, 14 | "angularCompilerOptions": { 15 | "annotateForClosureCompiler": true, 16 | "skipTemplateCodegen": true, 17 | "strictMetadataEmit": true, 18 | "fullTemplateTypeCheck": true, 19 | "strictInjectionParameters": true, 20 | "enableResourceInlining": true 21 | }, 22 | "exclude": [ 23 | "src/test-setup.ts", 24 | "**/*.spec.ts", 25 | "**/*.stories.ts" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "emitDecoratorMetadata": true 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": ["**/*.spec.ts", "**/*.d.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/libs/shared/components/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "app", "camelCase"], 5 | "component-selector": [true, "element", "app", "kebab-case"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/nx.json: -------------------------------------------------------------------------------- 1 | { 2 | "npmScope": "ng-cli-app", 3 | "implicitDependencies": { 4 | "angular.json": "*", 5 | "package.json": "*", 6 | "tsconfig.json": "*", 7 | "tslint.json": "*", 8 | "nx.json": "*" 9 | }, 10 | "projects": { 11 | "ng-cli-app": { 12 | "tags": [ 13 | "scope:app", 14 | "type:app" 15 | ] 16 | }, 17 | "ng-cli-app-e2e": { 18 | "tags": [ 19 | "scope:app", 20 | "type:e2e" 21 | ] 22 | }, 23 | "shared-components": { 24 | "tags": [ 25 | "scope:shared", 26 | "type:ui" 27 | ] 28 | }, 29 | "auth": { 30 | "tags": [ 31 | "scope:auth", 32 | "type:ui" 33 | ] 34 | }, 35 | "feat-customers": { 36 | "tags": [ 37 | "scope:customers", 38 | "type:ui" 39 | ] 40 | }, 41 | "customers-data": { 42 | "tags": [ 43 | "scope:customers", 44 | "type:data" 45 | ] 46 | }, 47 | "feat-home": { 48 | "tags": [ 49 | "scope:home", 50 | "type:ui" 51 | ] 52 | }, 53 | "shared-components-e2e": { 54 | "tags": [] 55 | }, 56 | "feat-home-e2e": { 57 | "tags": [] 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/scully.config.js: -------------------------------------------------------------------------------- 1 | exports.config = { 2 | projectRoot: './apps/ng-cli-app/src', 3 | routes: {} 4 | }; 5 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/tools/schematics/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/nx/tools/schematics/.gitkeep -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/tools/tsconfig.tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../dist/out-tsc/tools", 5 | "rootDir": ".", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": ["node"] 9 | }, 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/nx/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": ["node_modules/@types"], 15 | "lib": ["es2018", "dom"], 16 | "paths": { 17 | "@ng-cli-app/shared/components": ["libs/shared/components/src/index.ts"], 18 | "@ng-cli-app/auth": ["libs/auth/src/index.ts"], 19 | "@ng-cli-app/customers/ui": ["libs/customers/ui/src/index.ts"], 20 | "@ng-cli-app/customers/data": ["libs/customers/data/src/index.ts"], 21 | "@ng-cli-app/home/ui": ["libs/home/ui/src/index.ts"] 22 | }, 23 | "rootDir": "." 24 | }, 25 | "angularCompilerOptions": { 26 | "fullTemplateTypeCheck": true, 27 | "strictInjectionParameters": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /build 3 | /*.log 4 | *.lock 5 | 6 | package-lock.json -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/README.md: -------------------------------------------------------------------------------- 1 | # preact-app 2 | 3 | ## CLI Commands 4 | 5 | ``` bash 6 | # install dependencies 7 | npm install 8 | 9 | # serve with hot reload at localhost:8080 10 | npm run dev 11 | 12 | # build for production with minification 13 | npm run build 14 | 15 | # test the production build locally 16 | npm run serve 17 | 18 | # run tests with jest and preact-render-spy 19 | npm run test 20 | ``` 21 | 22 | For detailed explanation on how things work, checkout the [CLI Readme](https://github.com/developit/preact-cli/blob/master/README.md). 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["preact-cli/babel", { "modules": "commonjs" }] 4 | ] 5 | } -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/preact-app/src/assets/favicon.ico -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/components/header/index.js: -------------------------------------------------------------------------------- 1 | import { h, Component } from 'preact'; 2 | import { Link } from 'preact-router/match'; 3 | import style from './style'; 4 | 5 | export default class Header extends Component { 6 | render() { 7 | return ( 8 |
9 |

Preact App

10 | 27 |
28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/components/header/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | position: fixed; 3 | left: 0; 4 | top: 0; 5 | width: 100%; 6 | height: 56px; 7 | padding: 0; 8 | background: #673AB7; 9 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); 10 | z-index: 50; 11 | } 12 | 13 | .header h1 { 14 | float: left; 15 | margin: 0; 16 | padding: 0 15px; 17 | font-size: 24px; 18 | line-height: 56px; 19 | font-weight: 400; 20 | color: #FFF; 21 | } 22 | 23 | .header nav { 24 | float: right; 25 | font-size: 100%; 26 | } 27 | 28 | .header nav a { 29 | display: inline-block; 30 | height: 56px; 31 | line-height: 56px; 32 | padding: 0 15px; 33 | min-width: 50px; 34 | text-align: center; 35 | background: rgba(255,255,255,0); 36 | text-decoration: none; 37 | color: #FFF; 38 | will-change: background-color; 39 | } 40 | 41 | .header nav a:hover, 42 | .header nav a:active { 43 | background: rgba(0,0,0,0.2); 44 | } 45 | 46 | .header nav a.active { 47 | background: rgba(0,0,0,0.4); 48 | } 49 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/components/info.js: -------------------------------------------------------------------------------- 1 | import { h, Component } from 'preact'; 2 | 3 | export default class Info extends Component { 4 | render() { 5 | return ( 6 |
7 |

Info

8 |

This is the Info component.

9 |
10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/index.js: -------------------------------------------------------------------------------- 1 | import './style'; 2 | import App from './components/app'; 3 | 4 | export default App; 5 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "preact-app", 3 | "short_name": "preact-app", 4 | "start_url": "/", 5 | "display": "standalone", 6 | "orientation": "portrait", 7 | "background_color": "#fff", 8 | "theme_color": "#673ab8", 9 | "icons": [ 10 | { 11 | "src": "/assets/icons/android-chrome-192x192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "/assets/icons/android-chrome-512x512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/routes/about/index.js: -------------------------------------------------------------------------------- 1 | import { h, Component } from 'preact'; 2 | 3 | export default class About extends Component { 4 | render() { 5 | return ( 6 |
7 |

About

8 |

This is the About component.

9 |
10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/routes/home/index.js: -------------------------------------------------------------------------------- 1 | import { h, Component } from 'preact'; 2 | import style from './style'; 3 | 4 | export default class Home extends Component { 5 | render() { 6 | return ( 7 |
8 |

Home

9 |

This is the Home component.

10 |
11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/routes/home/style.css: -------------------------------------------------------------------------------- 1 | .home { 2 | padding: 56px 20px; 3 | min-height: 100%; 4 | width: 100%; 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/routes/profile/style.css: -------------------------------------------------------------------------------- 1 | .profile { 2 | padding: 56px 20px; 3 | min-height: 100%; 4 | width: 100%; 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/style/index.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | width: 100%; 4 | padding: 0; 5 | margin: 0; 6 | background: #FAFAFA; 7 | font-family: 'Helvetica Neue', arial, sans-serif; 8 | font-weight: 400; 9 | color: #444; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | 18 | #app { 19 | height: 100%; 20 | } 21 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/tests/__mocks__/browserMocks.js: -------------------------------------------------------------------------------- 1 | // Mock Browser API's which are not supported by JSDOM, e.g. ServiceWorker, LocalStorage 2 | /** 3 | * An example how to mock localStorage is given below 👇 4 | */ 5 | 6 | /* 7 | // Mocks localStorage 8 | const localStorageMock = (function() { 9 | let store = {}; 10 | 11 | return { 12 | getItem: (key) => store[key] || null, 13 | setItem: (key, value) => store[key] = value.toString(), 14 | clear: () => store = {} 15 | }; 16 | 17 | })(); 18 | 19 | Object.defineProperty(window, 'localStorage', { 20 | value: localStorageMock 21 | }); */ 22 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/preact-app/src/tests/header.test.js: -------------------------------------------------------------------------------- 1 | import { h, Component } from 'preact'; 2 | import Header from '../components/header'; 3 | import { Link } from 'preact-router/match'; 4 | // See: https://github.com/mzgoddard/preact-render-spy 5 | import { shallow, deep } from 'preact-render-spy'; 6 | 7 | describe('Initial Test of the Header', () => { 8 | 9 | test('Header renders 3 nav items', () => { 10 | const context = shallow(
); 11 | expect(context.find('h1').text()).toBe('Preact App'); 12 | expect(context.find().length).toBe(3); 13 | }); 14 | }); -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/images.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.svg' 2 | declare module '*.png' 3 | declare module '*.jpg' 4 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-app-ts", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.3.2", 7 | "react-dom": "^16.3.2", 8 | "react-loadable": "^5.3.1", 9 | "react-router": "^4.2.0", 10 | "react-router-dom": "^4.2.2", 11 | "react-scripts-ts": "2.15.1" 12 | }, 13 | "scripts": { 14 | "start": "react-scripts-ts start", 15 | "build": "react-scripts-ts build", 16 | "test": "react-scripts-ts test --env=jsdom", 17 | "eject": "react-scripts-ts eject" 18 | }, 19 | "devDependencies": { 20 | "@types/jest": "^22.2.3", 21 | "@types/node": "^9.6.6", 22 | "@types/react": "^16.3.12", 23 | "@types/react-dom": "^16.0.5", 24 | "@types/react-loadable": "^5.3.4", 25 | "@types/react-router": "^4.0.24", 26 | "@types/react-router-dom": "^4.2.6", 27 | "typescript": "^2.8.3" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 80px; 8 | } 9 | 10 | .App-header { 11 | background-color: #222; 12 | height: 150px; 13 | padding: 20px; 14 | color: white; 15 | } 16 | 17 | .App-title { 18 | font-size: 1.5em; 19 | } 20 | 21 | .App-intro { 22 | font-size: large; 23 | } 24 | 25 | @keyframes App-logo-spin { 26 | from { transform: rotate(0deg); } 27 | to { transform: rotate(360deg); } 28 | } 29 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/App.tsx: -------------------------------------------------------------------------------- 1 | import createBrowserHistory from 'history/createBrowserHistory'; 2 | import * as React from 'react'; 3 | import { Redirect, Route, Router, Switch } from 'react-router'; 4 | import { Link } from 'react-router-dom'; 5 | import './App.css'; 6 | import { AsyncComponent } from './LazyRoute'; 7 | 8 | const history = createBrowserHistory(); 9 | 10 | class App extends React.Component { 11 | public render() { 12 | return ( 13 | 14 |
15 | Intro 16 | Main 17 |
18 | 19 | 20 | import('./intro/Intro'))} /> 21 | import('./main/Main'))} /> 22 | 23 |
24 |
25 |
26 | ); 27 | } 28 | } 29 | 30 | export default App; 31 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/LazyRoute.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as Loadable from 'react-loadable'; 3 | 4 | const loading = ({ isLoading, error }: { isLoading: boolean; error: Error }) => { 5 | if (isLoading) { 6 | return
Loading...
; 7 | } else if (error) { 8 | return
Sorry, there was a problem loading the page.
; 9 | } else { 10 | return null; 11 | } 12 | }; 13 | 14 | export const AsyncComponent = (loader: any) => Loadable({ loader, loading }); 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import './index.css'; 5 | import registerServiceWorker from './registerServiceWorker'; 6 | 7 | ReactDOM.render( 8 | , 9 | document.getElementById('root') as HTMLElement 10 | ); 11 | registerServiceWorker(); 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/intro/Intro.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Switch } from 'react-router'; 3 | 4 | export default class Intro extends React.Component { 5 | public render() { 6 | return ( 7 | <> 8 |

Intro

9 | 10 | {/* import('./login/Login'))} /> 11 | import('./parent/Parent'))} /> */} 12 | 13 | 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/main/Main.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Route, Switch } from 'react-router'; 3 | import { Link } from 'react-router-dom'; 4 | import { AsyncComponent } from '../LazyRoute'; 5 | import Kid from './kid/Kid'; 6 | 7 | export default class Main extends React.Component { 8 | public render() { 9 | return ( 10 | <> 11 | <> 12 | Kid 13 | Parent 14 | 15 |

Main

16 | 17 | 18 | import('./parent/Parent'))} /> 19 | 20 | 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/main/kid/Kid.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export default class Kid extends React.Component { 4 | public render() { 5 | return ( 6 | <> 7 |

Kid

8 | 9 | ); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/src/main/parent/Parent.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export default class Parent extends React.Component { 4 | public render() { 5 | return ( 6 | <> 7 |

Parent

8 | 9 | ); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "build/dist", 4 | "module": "esnext", 5 | "target": "es5", 6 | "baseUrl": ".", 7 | "lib": ["es6", "dom"], 8 | "sourceMap": true, 9 | "allowJs": true, 10 | "jsx": "react", 11 | "moduleResolution": "node", 12 | "rootDir": "src", 13 | "forceConsistentCasingInFileNames": true, 14 | "noImplicitReturns": true, 15 | "noImplicitThis": true, 16 | "noImplicitAny": true, 17 | "strictNullChecks": true, 18 | "suppressImplicitAnyIndexErrors": true, 19 | "noUnusedLocals": true 20 | }, 21 | "exclude": ["node_modules", "build", "scripts", "acceptance-tests", "webpack", "jest", "src/setupTests.ts"] 22 | } 23 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app-ts/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"], 3 | "linterOptions": { 4 | "exclude": [ 5 | "config/**/*.js", 6 | "node_modules/**/*.ts" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.3.2", 7 | "react-dom": "^16.3.2", 8 | "react-loadable": "^5.3.1", 9 | "react-router": "^4.2.0", 10 | "react-router-dom": "^4.2.2", 11 | "react-scripts": "1.1.4" 12 | }, 13 | "scripts": { 14 | "start": "react-scripts start", 15 | "build": "react-scripts build", 16 | "test": "react-scripts test --env=jsdom", 17 | "eject": "react-scripts eject" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-parser/test/fixtures/react-app/public/favicon.ico -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 80px; 8 | } 9 | 10 | .App-header { 11 | background-color: #222; 12 | height: 150px; 13 | padding: 20px; 14 | color: white; 15 | } 16 | 17 | .App-title { 18 | font-size: 1.5em; 19 | } 20 | 21 | .App-intro { 22 | font-size: large; 23 | } 24 | 25 | @keyframes App-logo-spin { 26 | from { transform: rotate(0deg); } 27 | to { transform: rotate(360deg); } 28 | } 29 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/App.jsx: -------------------------------------------------------------------------------- 1 | import createBrowserHistory from 'history/createBrowserHistory'; 2 | import * as React from 'react'; 3 | import { Redirect, Route, Router, Switch } from 'react-router'; 4 | import { Link } from 'react-router-dom'; 5 | import './App.css'; 6 | import { AsyncComponent } from './LazyRoute'; 7 | 8 | const history = createBrowserHistory(); 9 | 10 | class App extends React.Component { 11 | render() { 12 | return ( 13 | 14 |
15 | Intro 16 | Main 17 |
18 | 19 | 20 | import('./intro/Intro'))} /> 21 | import('./main/Main'))} /> 22 | 23 |
24 |
25 |
26 | ); 27 | } 28 | } 29 | 30 | export default App; 31 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/LazyRoute.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as Loadable from 'react-loadable'; 3 | 4 | const loading = ({ isLoading, error }) => { 5 | if (isLoading) { 6 | return
Loading...
; 7 | } else if (error) { 8 | return
Sorry, there was a problem loading the page.
; 9 | } else { 10 | return null; 11 | } 12 | }; 13 | 14 | export const AsyncComponent = loader => Loadable({ loader, loading }); 15 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/index.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import './index.css'; 5 | 6 | ReactDOM.render(, document.getElementById('root')); 7 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/intro/Intro.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Switch } from 'react-router'; 3 | 4 | export default class Intro extends React.Component { 5 | render() { 6 | return ( 7 | 8 |

Intro

9 | 10 | {/* import('./login/Login'))} /> 11 | import('./parent/Parent'))} /> */} 12 | 13 |
14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/main/Main.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Route, Switch } from 'react-router'; 3 | import { Link } from 'react-router-dom'; 4 | import { AsyncComponent } from '../LazyRoute'; 5 | import Kid from './kid/Kid'; 6 | 7 | export default class Main extends React.Component { 8 | render() { 9 | return ( 10 | 11 | 12 | Kid 13 | Parent 14 | 15 |

Main

16 | 17 | 18 | import('./parent/Parent'))} /> 19 | 20 |
21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/main/kid/Kid.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export default class Kid extends React.Component { 4 | render() { 5 | return ( 6 | 7 |

Kid

8 |
9 | ); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/react-app/src/main/parent/Parent.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export default class Parent extends React.Component { 4 | render() { 5 | return ( 6 | 7 |

Parent

8 |
9 | ); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/fixtures/unknown/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unknown", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-parser/test/preact-jsx.spec.ts: -------------------------------------------------------------------------------- 1 | import { parsePreactJSXRoutes } from '../src/preact'; 2 | 3 | const fixtureRoutes = new Set(['/', '/info', '/home', '/profile/', '/profile/:user', '/about']); 4 | 5 | describe('Preact JavaScript parser', () => { 6 | it('should parse an app', () => { 7 | expect(() => parsePreactJSXRoutes('packages/guess-parser/test/fixtures/preact-app/src')).not.toThrow(); 8 | }); 9 | 10 | it('should discover all routes', () => { 11 | const routes = parsePreactJSXRoutes('packages/guess-parser/test/fixtures/preact-app/src'); 12 | expect(routes).toBeInstanceOf(Array); 13 | expect(routes.map(r => r.path).reduce((c, route) => c && fixtureRoutes.has(route), true)).toEqual(true); 14 | expect(routes.length).toEqual(fixtureRoutes.size); 15 | expect((routes.filter(r => !r.lazy).shift() as any).path).toEqual('/info'); 16 | }); 17 | 18 | it('should discover all lazy loaded routes', () => { 19 | const routes = parsePreactJSXRoutes('packages/guess-parser/test/fixtures/preact-app/src'); 20 | expect(routes).toBeInstanceOf(Array); 21 | expect(routes.filter(r => r.lazy).length).toEqual(5); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/guess-parser/test/react-jsx.spec.ts: -------------------------------------------------------------------------------- 1 | import { parseReactJSXRoutes } from '../src/react'; 2 | 3 | const fixtureRoutes = new Set(['/', '/intro', '/main', '/main/kid', '/main/parent']); 4 | 5 | describe('React TypeScript parser', () => { 6 | it('should parse an app', () => { 7 | expect(() => parseReactJSXRoutes('packages/guess-parser/test/fixtures/react-app/src')).not.toThrow(); 8 | }); 9 | 10 | it('should produce routes', () => { 11 | const routes = parseReactJSXRoutes('packages/guess-parser/test/fixtures/react-app/src'); 12 | expect(routes).toBeInstanceOf(Array); 13 | expect(routes.map(r => r.path).reduce((c, route) => c && fixtureRoutes.has(route), true)).toEqual(true); 14 | expect(routes.length).toEqual(fixtureRoutes.size); 15 | expect(routes.filter(r => !r.lazy).shift()!.path).toEqual('/main/kid'); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/guess-parser/test/react-tsx.spec.ts: -------------------------------------------------------------------------------- 1 | import { parseReactTSXRoutes } from '../src/react'; 2 | 3 | const fixtureRoutes = new Set(['/', '/intro', '/main', '/main/kid', '/main/parent']); 4 | 5 | describe('React TypeScript parser', () => { 6 | it('should parse an app', () => { 7 | expect(() => parseReactTSXRoutes('packages/guess-parser/test/fixtures/react-app-ts/tsconfig.json')).not.toThrow(); 8 | }); 9 | 10 | it('should produce routes', () => { 11 | const routes = parseReactTSXRoutes('packages/guess-parser/test/fixtures/react-app-ts/tsconfig.json'); 12 | expect(routes).toBeInstanceOf(Array); 13 | expect(routes.map(r => r.path).reduce((c, route) => c && fixtureRoutes.has(route), true)).toEqual(true); 14 | expect(routes.length).toEqual(fixtureRoutes.size); 15 | expect(routes.filter(r => !r.lazy).shift()!.path).toEqual('/main/kid'); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/guess-parser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "experimentalDecorators": true, 8 | "strict": true, 9 | "outDir": "dist", 10 | "downlevelIteration": true, 11 | "lib": ["es2015", "esnext", "dom"] 12 | }, 13 | "files": ["index.ts"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/guess-parser/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mode: 'production', 3 | entry: './index.ts', 4 | target: 'node', 5 | output: { 6 | filename: './guess-parser/index.js', 7 | libraryTarget: 'umd' 8 | }, 9 | optimization: { 10 | minimize: false 11 | }, 12 | externals: [/^(@|\w{3}(? 2 | ((typeof window === 'undefined' ? global : window) as any).__GUESS__.guess(params); 3 | -------------------------------------------------------------------------------- /packages/guess-webpack/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/guess-webpack'; 2 | -------------------------------------------------------------------------------- /packages/guess-webpack/src/aot/aot.tpl: -------------------------------------------------------------------------------- 1 | import { initialize } from './guess-aot'; 2 | 3 | (function(g, thresholds, base) { 4 | initialize(g, thresholds, base); 5 | })(typeof window === 'undefined' ? global : window, <%= THRESHOLDS %>, '<%= BASE_PATH %>'); 6 | -------------------------------------------------------------------------------- /packages/guess-webpack/src/asset-observer.ts: -------------------------------------------------------------------------------- 1 | export interface Asset { 2 | name: string; 3 | callback: () => void; 4 | } 5 | 6 | export type AssetCallback = (asset: Asset) => void; 7 | 8 | export class AssetObserver { 9 | buffer: Asset[] = []; 10 | private _callbacks: AssetCallback[] = []; 11 | 12 | onAsset(cb: AssetCallback) { 13 | this._callbacks.push(cb); 14 | } 15 | 16 | addAsset(asset: Asset) { 17 | this._callbacks.forEach(cb => cb(asset)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/guess-webpack/src/runtime/runtime.tpl: -------------------------------------------------------------------------------- 1 | import { initialize } from './runtime'; 2 | 3 | (function(g, history, graph, m, basePath, thresholds) { 4 | initialize(g, history, graph, m, basePath, thresholds); 5 | })(typeof window === 'undefined' ? global : window, (typeof window === 'undefined' ? {} : window).history || {}, <%= GRAPH %>, <%= GRAPH_MAP %>, '<%= BASE_PATH %>', <%= THRESHOLDS %>); 6 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/e2e/delegate.spec.ts: -------------------------------------------------------------------------------- 1 | describe('GuessPlugin delegate', () => { 2 | const puppeteer = require('puppeteer'); 3 | 4 | let browser: any; 5 | let page: any; 6 | 7 | beforeAll(async () => { 8 | browser = await puppeteer.launch(); 9 | page = await browser.newPage(); 10 | }); 11 | 12 | it('should export global __GUESS__', async () => { 13 | await page.goto('http://localhost:5122/delegate/dist/index.html', { 14 | waitUntil: 'networkidle0' 15 | }); 16 | 17 | const guessGlobal = await page.evaluate(() => { 18 | return !!(window as any).__GUESS__; 19 | }); 20 | 21 | expect(guessGlobal).toBeTruthy(); 22 | }); 23 | 24 | it('should export make predictions', async () => { 25 | await page.goto('http://localhost:5122/delegate/dist/index.html', { 26 | waitUntil: 'networkidle0' 27 | }); 28 | 29 | const result = await page.evaluate(() => { 30 | return (window as any).__GUESS__.guess({ path: 'foo' }).bar.probability; 31 | }); 32 | 33 | expect(result).toBe(1); 34 | }); 35 | 36 | afterAll(async () => { 37 | await browser.close(); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/e2e/next.spec.ts: -------------------------------------------------------------------------------- 1 | describe('GuessPlugin integration with Next.js', () => { 2 | const puppeteer = require('puppeteer'); 3 | 4 | let browser: any; 5 | let page: any; 6 | 7 | beforeAll(async () => { 8 | browser = await puppeteer.launch(); 9 | page = await browser.newPage(); 10 | }); 11 | 12 | describe('auto prefetching', () => { 13 | it('should prefetch on initial page load', async () => { 14 | await page.goto('http://localhost:5122/next/dist/', { waitUntil: 'networkidle0' }); 15 | await page.waitForSelector('a:nth-of-type(3)'); 16 | expect((await page.$$('script')).length).toBe(6); 17 | const contactsLink = await page.$('a:nth-of-type(3)'); 18 | await contactsLink.click(); 19 | await new Promise(resolve => setTimeout(resolve, 1000)); 20 | expect((await page.$$('script')).length).toBe(7); 21 | }); 22 | }); 23 | 24 | afterAll(async () => { 25 | await browser.close(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events.json 15 | speed-measure-plugin.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/README.md: -------------------------------------------------------------------------------- 1 | # Angular 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.9. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To 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). 28 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to angular!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/routes.json: -------------------------------------------------------------------------------- 1 | { 2 | "/": { 3 | "/foo": 1 4 | }, 5 | "/foo": { 6 | "/foo/baz": 0.6, 7 | "/qux": 0.4 8 | }, 9 | "/qux": { 10 | "/foo": 0.989, 11 | "/foo/baz": 0.011 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { BarComponent } from './bar/bar.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: 'fo' + 'o', 8 | loadChildren: './foo/foo.module#FooModule' 9 | }, 10 | { 11 | path: 'qux', 12 | loadChildren: './qux/qux.module#QuxModule' 13 | }, 14 | { 15 | path: 'bar', 16 | component: BarComponent 17 | }, 18 | { 19 | path: '', 20 | pathMatch: 'full', 21 | redirectTo: 'bar' 22 | } 23 | ]; 24 | 25 | @NgModule({ 26 | imports: [RouterModule.forRoot(routes)], 27 | exports: [RouterModule] 28 | }) 29 | export class AppRoutingModule {} 30 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-webpack/test/fixtures/angular/src/app/app.component.css -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | Foo 2 | Bar 3 | 4 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | describe('AppComponent', () => { 4 | beforeEach(async(() => { 5 | TestBed.configureTestingModule({ 6 | declarations: [ 7 | AppComponent 8 | ], 9 | }).compileComponents(); 10 | })); 11 | it('should create the app', async(() => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.debugElement.componentInstance; 14 | expect(app).toBeTruthy(); 15 | })); 16 | it(`should have as title 'app'`, async(() => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app.title).toEqual('app'); 20 | })); 21 | it('should render title in a h1 tag', async(() => { 22 | const fixture = TestBed.createComponent(AppComponent); 23 | fixture.detectChanges(); 24 | const compiled = fixture.debugElement.nativeElement; 25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'app'; 10 | } 11 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { BarModule } from './bar/bar.module'; 7 | 8 | @NgModule({ 9 | declarations: [AppComponent], 10 | imports: [BrowserModule, BarModule, AppRoutingModule], 11 | providers: [], 12 | bootstrap: [AppComponent] 13 | }) 14 | export class AppModule {} 15 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/bar/bar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-component', 5 | template: 'bar-component' 6 | }) 7 | export class BarComponent {} 8 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/bar/bar.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BarComponent } from './bar.component'; 3 | 4 | @NgModule({ 5 | declarations: [BarComponent], 6 | providers: [] 7 | }) 8 | export class BarModule {} 9 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/foo/baz/baz-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { BazComponent } from './baz.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: BazComponent 9 | }, 10 | { 11 | path: 'index', 12 | component: BazComponent 13 | } 14 | ]; 15 | 16 | @NgModule({ 17 | imports: [RouterModule.forChild(routes)], 18 | exports: [RouterModule] 19 | }) 20 | export class BazRoutingModule {} 21 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/foo/baz/baz.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-baz', 5 | template: 'baz-component' 6 | }) 7 | export class BazComponent {} 8 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/foo/baz/baz.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BazComponent } from './baz.component'; 3 | import { BazRoutingModule } from './baz-routing.module'; 4 | 5 | @NgModule({ 6 | declarations: [BazComponent], 7 | imports: [BazRoutingModule], 8 | bootstrap: [BazComponent] 9 | }) 10 | export class BazModule {} 11 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/foo/foo-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { FooComponent } from './foo.component'; 4 | 5 | const baz = './baz'; 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | component: FooComponent 10 | }, 11 | { 12 | path: 'index', 13 | component: FooComponent 14 | }, 15 | { 16 | path: 'baz', 17 | loadChildren: baz + '/baz.module#BazModule' 18 | } 19 | ]; 20 | 21 | @NgModule({ 22 | imports: [RouterModule.forChild(routes)], 23 | exports: [RouterModule] 24 | }) 25 | export class FooRoutingModule {} 26 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/foo/foo.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-foo', 5 | template: 'foo-component' 6 | }) 7 | export class FooComponent {} 8 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/foo/foo.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, Component } from '@angular/core'; 2 | import { FooComponent } from './foo.component'; 3 | import { FooRoutingModule } from './foo-routing.module'; 4 | 5 | @NgModule({ 6 | declarations: [FooComponent], 7 | imports: [FooRoutingModule], 8 | bootstrap: [FooComponent] 9 | }) 10 | export class FooModule {} 11 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/qux/qux-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { QuxComponent } from './qux.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: QuxComponent 9 | }, 10 | { 11 | path: 'index', 12 | component: QuxComponent 13 | } 14 | ]; 15 | 16 | @NgModule({ 17 | imports: [RouterModule.forChild(routes)], 18 | exports: [RouterModule] 19 | }) 20 | export class QuxRoutingModule {} 21 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/qux/qux.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-qux', 5 | template: 'qux-component' 6 | }) 7 | export class QuxComponent {} 8 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/app/qux/qux.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { QuxComponent } from './qux.component'; 3 | import { QuxRoutingModule } from './qux-routing.module'; 4 | 5 | @NgModule({ 6 | declarations: [QuxComponent], 7 | imports: [QuxRoutingModule], 8 | bootstrap: [QuxComponent] 9 | }) 10 | export class QuxModule {} 11 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-webpack/test/fixtures/angular/src/assets/.gitkeep -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-webpack/test/fixtures/angular/src/favicon.ico -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage/angular'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/angular/webpack.extra.js: -------------------------------------------------------------------------------- 1 | const { GuessPlugin } = require('../../../'); 2 | const { parseRoutes } = require('../../../../guess-parser/'); 3 | 4 | module.exports = { 5 | plugins: [ 6 | new GuessPlugin({ 7 | debug: true, 8 | reportProvider() { 9 | return Promise.resolve(JSON.parse(require('fs').readFileSync('./routes.json').toString())); 10 | }, 11 | runtime: { 12 | base: 'http://localhost:1337' 13 | }, 14 | routeProvider() { 15 | return parseRoutes('.'); 16 | } 17 | }) 18 | ] 19 | }; 20 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/delegate/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/delegate/index.js: -------------------------------------------------------------------------------- 1 | console.log('42'); 2 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/delegate/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "lockfileVersion": 1 3 | } 4 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/delegate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "build": "../../../../../node_modules/.bin/webpack" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/delegate/webpack.config.js: -------------------------------------------------------------------------------- 1 | const CopyWebpackPlugin = require('copy-webpack-plugin'); 2 | const { GuessPlugin } = require('../../../dist/guess-webpack/main'); 3 | 4 | module.exports = { 5 | mode: 'development', 6 | entry: './index.js', 7 | target: 'web', 8 | output: { 9 | filename: './index.js', 10 | libraryTarget: 'umd' 11 | }, 12 | resolve: { 13 | extensions: ['.js'] 14 | }, 15 | plugins: [ 16 | new CopyWebpackPlugin([{ from: 'index.html', to: 'index.html' }]), 17 | new GuessPlugin({ 18 | runtime: { 19 | delegate: true, 20 | }, 21 | routeProvider: false, 22 | reportProvider() { 23 | return Promise.resolve({ 24 | foo: { 25 | bar: 4 26 | } 27 | }); 28 | } 29 | }) 30 | ] 31 | }; 32 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/next/next.config.js: -------------------------------------------------------------------------------- 1 | const { GuessPlugin } = require('../../../dist/guess-webpack/main'); 2 | 3 | module.exports = { 4 | assetPrefix: '/next/dist', 5 | webpack: function(config, { isServer }) { 6 | if (isServer) return config; 7 | config.plugins.push( 8 | new GuessPlugin({ 9 | reportProvider() { 10 | return Promise.resolve({ 11 | '/': { 12 | '/contact': 80, 13 | '/about': 20 14 | }, 15 | '/contact': { 16 | '/': 20, 17 | '/about': 80 18 | }, 19 | '/about': { 20 | '/': 80, 21 | '/contact': 20 22 | } 23 | }); 24 | }, 25 | runtime: { 26 | delegate: true, 27 | prefetchConfig: { 28 | '4g': 0.7, 29 | '3g': 0.7, 30 | '2g': 0.7, 31 | 'slow-2g': 0.7 32 | } 33 | }, 34 | routeProvider: false 35 | }) 36 | ); 37 | return config; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/next/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "guess-next", 3 | "version": "0.0.0", 4 | "description": "Experiment for integration of Guess.js with Next.js", 5 | "scripts": { 6 | "dev": "next", 7 | "build": "next build && next export -o dist", 8 | "start": "next start" 9 | }, 10 | "license": "MIT", 11 | "dependencies": { 12 | "next": "^9.0.0", 13 | "react": "^16.9.0", 14 | "react-dom": "^16.9.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/next/pages/about.js: -------------------------------------------------------------------------------- 1 | import Layout from '../components/layout'; 2 | 3 | export default () => About us; 4 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/next/pages/contact.js: -------------------------------------------------------------------------------- 1 | import Layout from '../components/layout' 2 | 3 | export default () => ( 4 | 5 | This is the contact page. 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/next/pages/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Layout from '../components/layout'; 3 | 4 | export default class Index extends React.Component { 5 | render() { 6 | return ( 7 | 8 |

Next.js + Guess.js 🔮

9 |

Welcome, Next.js

10 |
11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/next/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guess-js/guess/0def89f41d43011abe0e449bd5f676f32e17b891/packages/guess-webpack/test/fixtures/next/static/favicon.ico -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/prefetch/about.js: -------------------------------------------------------------------------------- 1 | console.log('about'); 2 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/prefetch/contact.js: -------------------------------------------------------------------------------- 1 | console.log('contact'); 2 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/prefetch/home.js: -------------------------------------------------------------------------------- 1 | console.log('home'); 2 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/prefetch/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | /home 11 | /about 12 | /contact 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/prefetch/index.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | [].slice.call(document.querySelectorAll('a')).forEach(n => { 3 | n.addEventListener('click', e => { 4 | const link = n.innerText; 5 | history.pushState({}, link, link); 6 | if (link === '/home') { 7 | import('./home.js'); 8 | } 9 | if (link === '/about') { 10 | import('./about.js'); 11 | } 12 | if (link === '/contact') { 13 | import('./contact.js'); 14 | } 15 | e.preventDefault(); 16 | }); 17 | }); 18 | })(); 19 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/prefetch/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "lockfileVersion": 1 3 | } 4 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/fixtures/prefetch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "build": "../../../../../node_modules/.bin/webpack" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/guess-webpack/test/unit/compress.spec.ts: -------------------------------------------------------------------------------- 1 | import { compressGraph } from '../../src/compress'; 2 | import { PrefetchGraph, CompressedGraphMap, CompressedPrefetchGraph } from '../../src/declarations'; 3 | 4 | const sample: PrefetchGraph = { 5 | a: [ 6 | { 7 | probability: 0.9, 8 | route: 'b', 9 | chunk: 'b.js' 10 | }, 11 | { 12 | probability: 0.1, 13 | route: 'c', 14 | chunk: 'c.js' 15 | } 16 | ], 17 | b: [ 18 | { 19 | probability: 1, 20 | route: 'a', 21 | chunk: 'a.js' 22 | } 23 | ] 24 | }; 25 | 26 | const fixtureMap: CompressedGraphMap = { 27 | chunks: ['b.js', 'c.js', 'a.js'], 28 | routes: ['a', 'b', 'c'] 29 | }; 30 | 31 | const fixtureGraph: CompressedPrefetchGraph = [[[0.9, 1, 0], [0.1, 2, 1]], [[1, 0, 2]]]; 32 | 33 | describe('compressGraph', () => { 34 | it('should compress a graph', () => { 35 | const { graph, graphMap } = compressGraph(sample, 1); 36 | expect(graphMap).toEqual(fixtureMap); 37 | expect(graph).toEqual(fixtureGraph); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/guess-webpack/tsconfig-api.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "baseUrl": ".", 5 | "module": "commonjs", 6 | "sourceMap": true, 7 | "declaration": true, 8 | "strict": true, 9 | "experimentalDecorators": true, 10 | "downlevelIteration": true, 11 | "lib": ["es2015", "esnext", "dom"] 12 | }, 13 | "files": ["api/index.ts"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/guess-webpack/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "baseUrl": "..", 5 | "module": "commonjs", 6 | "sourceMap": true, 7 | "declaration": true, 8 | "strict": true, 9 | "experimentalDecorators": true, 10 | "downlevelIteration": true, 11 | "lib": ["es2015", "esnext", "dom"], 12 | "outDir": "dist", 13 | "paths": { 14 | "guess-ga": ["guess-ga"] 15 | } 16 | }, 17 | "files": ["index.ts", "src/runtime/guess.ts", "src/runtime/runtime.ts"] 18 | } 19 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "declaration": true, 7 | "experimentalDecorators": true, 8 | "strict": true, 9 | "downlevelIteration": true, 10 | "lib": ["es2015", "esnext", "dom"] 11 | }, 12 | "exclude": ["packages/detector/test/fixtures"] 13 | } 14 | --------------------------------------------------------------------------------