Skip to content

Parser, Tree class roadmap #18

@MajorLift

Description

@MajorLift

1. Parser

A. Expand Import Statement support

a) Static Imports

  • For static import statements with namespace or default specifiers, only add members that are used in the document.
import foo from "mod.js"
import * as foo from "mod.js"
  • Module imports for side effects only
import '/modules/my-module.js';
import 'http:example.com\pears.js';

b) Require Statements

  • Support namespaces and member expressions
const foo = require("./module"); ... ; <foo.component />;
  • Support invocations and method/member calls
const foo = require("./module")();
const foo = require("./module").method(arg);

c) Dynamic imports

  • Support AwaitExpression
const foo = await import("./module")
  • Support Promise.resolve()
const foo = Promise.resolve(import("./module"))
  • Support .then() chains
import("./module").then(mod => mod.loadPage())
  • Support non-literal specifiers in module name
import(`/modules/module-${index}.js`)

B. Implement Export Statement parser

C. Support Barrel files

  • 1) Recognize barrel files
  • 2) Parse export statements in barrel file
  • 3) Parse export statements for components in each barrel file entry.

D. Support more path types

E. Increase Babel type guard coverage

const foo = React.lazy(() => import('./module'));

2. Tree

  • Consolidate Tree and Node data class/interfaces for parser, serialized workspace cache, and webview.
  • Encapsulation for class members

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions