![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
guess-parser
Advanced tools
This module is used for route extraction by the GuessPlugin
. The module exports several functions:
npm i guess-parser --save-dev
detect(path: string)
- Detects the project type and returns metadata. For the currently supported projects see the ProjectMetadata
interface.parseRoutes(path: string)
- Extracts the routes of the application in path
. Internally uses the detect
function.parseAngularRoutes(tsconfig: string)
- Extracts the routes of an Angular application. As arguments the function accepts path to the tsconfig.json
file of the project.parseReactJSXRoutes(path: string)
- Extracts the routes from React JSX project. See the supported syntax below.parseReactTSXRoutes(tsconfig: string)
- Extracts the routes from React TypeScript projects which uses JSX by tsconfig.json
file. See the supported syntax below.export interface ProjectMetadata {
type: ProjectType;
version: string;
details?: ProjectLayout;
}
export enum ProjectType {
AngularCLI = 'angular-cli',
CreateReactApp = 'create-react-app',
Gatsby = 'gatsby',
CreateReactAppTypeScript = 'create-react-app-typescript'
}
export interface ProjectLayout {
typescript?: string;
tsconfigPath?: string;
sourceDir?: string;
}
Because of the produced summaries by the Angular compiler the Angular parser supports most Angular CLI applications as well as most starters.
Because of the dynamic nature of React and lack of standard route definition syntax, only applications using the following convention can be successfully parsed:
<Router history={history}>
<div className="App">
<Link to="/intro">Intro</Link>
<Link to="/main">Main</Link>
<div>
<Switch>
<Redirect exact={true} from="/" to="/intro" />
<Route path="/intro" component={AsyncComponent(() => import('./intro/Intro'))} />
<Route path="/main" component={Main} />
</Switch>
</div>
</div>
</Router>
Currently, there are several important conventions:
react-router
-like syntax<Route/>
element must have value of type string literal.CallExpression
(e.g. AsyncComponent
) with a single argumentArrowFunction
CallExpression
)CallExpression
should be passed a StringLiteral
which points to the lazy-loaded moduleContributions aiming to extend the supported syntax are very welcome!
MIT
FAQs
Finds the route declarations in your application.
The npm package guess-parser receives a total of 60,158 weekly downloads. As such, guess-parser popularity was classified as popular.
We found that guess-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.