Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

PR: Transform Export Declarations #5

Merged
merged 8 commits into from
Oct 15, 2021
Merged

Conversation

unicornware
Copy link
Member

Description

✨ Features

  • Added TrextOptions#mandatory to toggle mandatory file extensions
  • Implemented Trextel#ExportAllDeclaration and Trextel#ExportNamedDeclaration to transform export declarations
  • Implemented Trextel.getCode to pull source code values from TrextNodePath objects
  • Added TrextNodeType and TrextNode type definitions

♻️ Code Improvements

  • Refactored Trextel.transform to handle ExportAllDeclaration and ExportNamedDeclaration nodes
  • Refactored TrextNodePath to use TrextNode

📖 Documentation

  • Added "Mandatory File Extensions" section to usage guide

🔨 Build

  • Added plugins and utils to package entry point (and consequently bundle output)

Tests

 PASS   trext  src/plugins/__tests__/trextel.plugin.spec.ts
  unit:plugins/Trextel
    .getCode
      ✓ should return @flex-development/trext given CallExpression with 1 argument (3 ms)
      ✓ should return undefined given ExportNamedDeclaration without source
      ✓ should return ./imported.js given ImportDeclaration with source
    get plugin
      ✓ should return plugin object (1 ms)
    get visitor
      ✓ should return #CallExpression and #ImportDeclaration

 PASS   trext  src/plugins/__tests__/trextel.plugin.functional.spec.ts
  functional:plugins/Trextel
    #CallExpression
      ✓ should add extension to relative require statement (2 ms)
      ✓ should change extension in relative require statement (1 ms)
      ✓ should not change extension in absolute require statement (1 ms)
      ✓ should not change extension if require is not string literal
      ✓ should not ignore require statement if require is partial dirix (1 ms)
      ✓ should ignore require statement if require is partial dirix and file extensions are not mandatory (1 ms)
      ✓ should not ignore require statement if require is full dirix (1 ms)
    #ExportAllDeclaration
      ✓ should add extension to relative export all declaration (1 ms)
      ✓ should change extension in relative export all declaration (1 ms)
      ✓ should not change extension in absolute import
      ✓ should not ignore export all declaration if export is partial dirix (1 ms)
      ✓ should ignore export all declaration if export is partial dirix and file extensions are not mandatory
      ✓ should not ignore export all declaration if export is full dirix (5 ms)
    #ExportNamedDeclaration
      ✓ should add extension to relative named export declaration (1 ms)
      ✓ should change extension in relative named export declaration (1 ms)
      ✓ should not change extension in absolute named export
      ✓ should not ignore named export declaration if export is partial dirix (1 ms)
      ✓ should ignore named export declaration if export is partial dirix and file extensions are not mandatory
      ✓ should not ignore named export declaration if export is full dirix (1 ms)
    #ImportDeclaration
      ✓ should add extension to relative import declaration
      ✓ should change extension in relative import declaration (1 ms)
      ✓ should not change extension in absolute import
      ✓ should not ignore import declaration if import is partial dirix (1 ms)
      ✓ should ignore import declaration if import is partial dirix and file extensions are not mandatory (1 ms)
      ✓ should not ignore import declaration if import is full dirix

Test Suites: 2 passed, 2 total
Tests:       30 passed, 30 total
Snapshots:   0 total
Time:        2.802 s
Ran all test suites matching /trextel/i.

Additional context

Linked issues

None

Submission checklist

  • pr title prefixed with PR: (e.g: PR: User authentication)
  • pr title describes functionality (not vague title like Update index.md)
  • pr targets branch next
  • project was run locally to verify that there are no errors
  • documentation added or updated

@unicornware unicornware added scope:typescript TypeScript support (enums, interfaces, types) type:feat New feature or request scope:plugins Plugins labels Oct 15, 2021
@unicornware unicornware self-assigned this Oct 15, 2021
Copy link

@flexdevelopment flexdevelopment left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍🏾

@unicornware unicornware merged commit f937db0 into next Oct 15, 2021
@unicornware unicornware deleted the feat/export-declarations branch October 15, 2021 15:25
@unicornware unicornware added the status:released Merged into next, main, and released label Oct 15, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or features. Be sure to reference this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope:plugins Plugins scope:typescript TypeScript support (enums, interfaces, types) status:released Merged into next, main, and released type:feat New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants