Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto-import for the package.json imports field #55015

Merged
merged 34 commits into from
Dec 21, 2023

Commits on Jul 14, 2023

  1. Configuration menu
    Copy the full SHA
    7c0fef4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    60ec33b View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2023

  1. Configuration menu
    Copy the full SHA
    faef5fd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1d49909 View commit details
    Browse the repository at this point in the history
  3. Use JSON.parse

    diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts
    index 4dcf24ea4b..d6022afe4b 100644
    --- a/src/compiler/moduleSpecifiers.ts
    +++ b/src/compiler/moduleSpecifiers.ts
    @@ -90,7 +90,6 @@ import {
         pathIsBareSpecifier,
         pathIsRelative,
         PropertyAccessExpression,
    -    readJson,
         removeExtension,
         removeFileExtension,
         removeSuffix,
    @@ -894,11 +893,11 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName: string, sourceDi
         }
         const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
         const cachedPackageJson = host.getPackageJsonInfoCache?.()?.getPackageJsonInfo(packageJsonPath);
    -    if (typeof cachedPackageJson !== "object" && cachedPackageJson !== undefined) {
    +    if (typeof cachedPackageJson !== "object" && cachedPackageJson !== undefined || !host.fileExists(packageJsonPath)) {
             return undefined;
         }
    -    const packageJsonContent = cachedPackageJson?.contents.packageJsonContent || readJson(packageJsonPath, host as { readFile(fileName: string): string | undefined });
    -    const imports = (packageJsonContent as any).imports;
    +    const packageJsonContent = cachedPackageJson?.contents.packageJsonContent || JSON.parse(host.readFile(packageJsonPath)!);
    +    const imports = packageJsonContent?.imports;
         if (!imports) {
             return undefined;
         }
    emmatown committed Aug 16, 2023
    Configuration menu
    Copy the full SHA
    4e676a3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    747e769 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2023

  1. Configuration menu
    Copy the full SHA
    01ceb65 View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2023

  1. Add test with conditions

    emmatown committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    864b9a3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d0407a9 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2023

  1. Configuration menu
    Copy the full SHA
    e092943 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8f781c5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a2aa5ae View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Configuration menu
    Copy the full SHA
    eaa8e2e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    051239b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b3c5ca4 View commit details
    Browse the repository at this point in the history
  4. add extra test case

    Andarist committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    ea67766 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7abf4a2 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6a72a51 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9903d72 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2023

  1. Configuration menu
    Copy the full SHA
    9e2df94 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c4df857 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    566e543 View commit details
    Browse the repository at this point in the history
  4. reprioritize checks

    Andarist committed Oct 31, 2023
    Configuration menu
    Copy the full SHA
    1f9f214 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2023

  1. Configuration menu
    Copy the full SHA
    7a5c164 View commit details
    Browse the repository at this point in the history
  2. Fix lints

    andrewbranch committed Nov 15, 2023
    Configuration menu
    Copy the full SHA
    45194b2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8f2d0c3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8bef690 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cd84162 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    8d68392 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2023

  1. Configuration menu
    Copy the full SHA
    a9634ed View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7f52af2 View commit details
    Browse the repository at this point in the history
  3. fixed endsWith

    Andarist committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    4aab191 View commit details
    Browse the repository at this point in the history

Commits on Dec 21, 2023

  1. Configuration menu
    Copy the full SHA
    c435528 View commit details
    Browse the repository at this point in the history
  2. Fix bad merge artifacts

    andrewbranch committed Dec 21, 2023
    Configuration menu
    Copy the full SHA
    4f29d3a View commit details
    Browse the repository at this point in the history