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

PR: Ignore Directory Indexes #2

Merged
merged 3 commits into from
Oct 13, 2021
Merged

Conversation

unicornware
Copy link
Member

@unicornware unicornware commented Oct 13, 2021

Description

  • Updated Trextel to ignore directory index specifiers (i.e: './types', where ./types/index.* is being imported)
  • Added Trextel.transform to consolidate transformation logic
  • Added TrextNodePath type definition

Tests

 PASS   trext  src/plugins/__tests__/trextel.plugin.functional.spec.ts (15.064 s)
  functional:plugins/Trextel
    #CallExpression
      ✓ should add extension to relative require statement (4 ms)
      ✓ should change extension in relative require statement
      ✓ should not change extension in absolute require statement
      ✓ should not change extension if require is not string literal (1 ms)
      ✓ should ignore require statement if require is directory entry point
    #ImportDeclaration
      ✓ should add extension to relative import declaration (1 ms)
      ✓ should change extension in relative import declaration (1 ms)
      ✓ should not change extension in absolute import (1 ms)
      ✓ should ignore import declaration if import is directory entry point (1 ms)

 PASS   trext  src/plugins/__tests__/trextel.plugin.spec.ts
  unit:plugins/Trextel
    get plugin
      ✓ should return plugin object (3 ms)
    get visitor
      ✓ should return #CallExpression and #ImportDeclaration

 PASS   trext  src/plugins/__tests__/trext.plugin.functional.spec.ts (28.62 s)
  functional:plugins/Trext
    .trext
      ✓ should get files to transform (5 ms)
      ✓ should transform files
    .trextFile
      ✓ should transform file (24 ms)
      ✓ should throw Error if missing transformation result (1 ms)
      ✓ should call options.to if it is a function (1 ms)
      ✓ should create source map and add comment (1 ms)
      ✓ should create file with new extension (1 ms)

Test Suites: 3 passed, 3 total
Tests:       18 passed, 18 total
Snapshots:   0 total
Time:        49.916 s

Additional context

Prior to this update, extensions were being added to directory index specifiers thus resulting in errors like this one:

 FAIL   sdk  src/lib/__tests__/request.functional.util.spec.ts
  ● Test suite failed to run

    Cannot find module '../enums.cjs' from 'node_modules/@flex-development/exceptions/cjs/exceptions/base.exception.cjs'

    Require stack:
      node_modules/@flex-development/exceptions/cjs/exceptions/base.exception.cjs
      packages/sdk/src/config/axios.config.ts
      packages/sdk/src/lib/request.ts
      packages/sdk/src/lib/__tests__/request.functional.util.spec.ts

      at Resolver.resolveModule (packages/sdk/node_modules/jest-resolve/build/resolver.js:322:11)
      at Object.<anonymous> (node_modules/@flex-development/exceptions/src/exceptions/base.exception.ts:4:1)

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 changed the title PR: Ignore directory indexes PR: Ignore Directory Indexes Oct 13, 2021
@unicornware unicornware marked this pull request as ready for review October 13, 2021 04:07
@unicornware unicornware self-assigned this Oct 13, 2021
@unicornware unicornware added scope:plugins Plugins type:fix Something isn't working labels Oct 13, 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 3313025 into next Oct 13, 2021
@unicornware unicornware deleted the hotfix/ignore-directory-indexes branch October 13, 2021 04:12
@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 status:released Merged into next, main, and released type:fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants