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

fix(dynamicInstantiate): works with pnpm #45

Merged
merged 1 commit into from
May 12, 2020
Merged

fix(dynamicInstantiate): works with pnpm #45

merged 1 commit into from
May 12, 2020

Conversation

yoursunny
Copy link
Contributor

@yoursunny yoursunny commented Apr 25, 2020

This commit fixes the path splitting algorithm in dynamicInstantiate, so that it can work with a node_modules tree installed by pnpm.

Previously, the code splits the URL of to-be-loaded module with node_modules/, and take the first part as base directory and the second part part as package name.
However, a node_modules tree installed by pnpm contains multiple node_modules/ components to reach a package, such as node_modules/.pnpm/registry.npmjs.org/stdout-stream/1.4.1/node_modules/stdout-stream, while node_modules/stdout-stream is a symbolic link to that directory.
The old splitting code would think .pnpm/registry.npmjs.org/stdout-stream/1.4.1 is the package name, which is incorrect.


To reproduce the bug with pnpm, save the following files, then install dependencies with pnpm install.
package.json

{
  "private": true,
  "type": "module",
  "scripts": {
    "build": "tsc --noEmit",
    "dev": "node --loader @k-foss/ts-esnode --experimental-specifier-resolution=node main.ts"
  },
  "dependencies": {
    "stdout-stream": "^1.4.1"
  },
  "devDependencies": {
    "@k-foss/ts-esnode": "*",
    "@types/stdout-stream": "^1.4.0",
    "typescript": "^3.8.3"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "module": "ESNext",
    "target": "ESNext",
    "moduleResolution": "Node"
  }
}

main.ts

import stdout from "stdout-stream";
stdout.write("OK\n");

@EntraptaJ EntraptaJ merged commit 5c0fadf into K-FOSS:next May 12, 2020
github-actions bot pushed a commit that referenced this pull request May 12, 2020
## [1.3.6](v1.3.5...v1.3.6) (2020-05-12)

### Bug Fixes

* **dynamicInstantiate:** works with pnpm ([#45](#45)) ([5c0fadf](5c0fadf))
@KJDev-Bot
Copy link
Contributor

🎉 This PR is included in version 1.3.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

EntraptaJ added a commit that referenced this pull request May 12, 2020
* chore(branches): Setup Next branch

* fix(Resovler): Refactor resolver and module loader to prevent loading of URLs and already discovered javascript files (#28)

* refactor: Remove Node 13.7/13.8 from supported versions

* chore(release): 1.3.2 [skip ci]

## [1.3.2](v1.3.1...v1.3.2) (2020-03-30)

### Bug Fixes

* **Resovler:** Refactor resolver and module loader to prevent loading of URLs and already discovered javascript files ([#28](#28)) ([4825f19](4825f19))

* fix: Readd JS_EXTS to findFIles to allow for post build JS support

* chore(release): 1.3.3 [skip ci]

## [1.3.3](v1.3.2...v1.3.3) (2020-03-30)

### Bug Fixes

* Readd JS_EXTS to findFIles to allow for post build JS support ([82b27c0](82b27c0))

* chore(deps-dev): bump @types/node from 13.9.5 to 13.9.8 (#29)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.9.5 to 13.9.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* chore(deps-dev): bump @types/node from 13.9.8 to 13.11.0 (#30)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.9.8 to 13.11.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* tests(Similar Folder): Add a test for similar folder names when searching for a file (should fail currently)

* fix(findFiles): Fix the discovery of files when a directory of partial name match occurs

* chore(release): 1.3.4 [skip ci]

## [1.3.4](v1.3.3...v1.3.4) (2020-04-05)

### Bug Fixes

* **findFiles:** Fix the discovery of files when a directory of partial name match occurs ([2f108e2](2f108e2))

* fix(resolve): Don't run findFiles if we can already see an extension.

* chore(release): 1.3.5 [skip ci]

## [1.3.5](v1.3.4...v1.3.5) (2020-04-05)

### Bug Fixes

* **resolve:** Don't run findFiles if we can already see an extension. ([b0e2b85](b0e2b85))

* chore(deps-dev): bump @types/node from 13.11.0 to 13.11.1 (#35)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.11.0 to 13.11.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* chore(deps-dev): bump prettier from 2.0.2 to 2.0.4 (#33)

Bumps [prettier](https://github.com/prettier/prettier) from 2.0.2 to 2.0.4.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](prettier/prettier@2.0.2...2.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* chore(deps-dev): bump typescript from 3.8.3 to 3.9.2 (#50)

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.8.3 to 3.9.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* chore(deps-dev): bump conventional-changelog-conventionalcommits (#49)

Bumps [conventional-changelog-conventionalcommits](https://github.com/conventional-changelog/conventional-changelog) from 4.2.3 to 4.3.0.
- [Release notes](https://github.com/conventional-changelog/conventional-changelog/releases)
- [Commits](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.2.3...conventional-changelog-conventionalcommits@4.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* fix(dynamicInstantiate): works with pnpm (#45)

* chore(release): 1.3.6 [skip ci]

## [1.3.6](v1.3.5...v1.3.6) (2020-05-12)

### Bug Fixes

* **dynamicInstantiate:** works with pnpm ([#45](#45)) ([5c0fadf](5c0fadf))

* chore(deps-dev): bump prettier from 2.0.4 to 2.0.5 (#41)

Bumps [prettier](https://github.com/prettier/prettier) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/2.0.5/CHANGELOG.md)
- [Commits](prettier/prettier@2.0.4...2.0.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* chore(deps-dev): bump semantic-release from 17.0.4 to 17.0.7 (#42)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.0.4 to 17.0.7.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v17.0.4...v17.0.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* fix(dot import): Fix `import XYZ from '.'` (#52)

closes issue #34

* chore(release): 1.3.7 [skip ci]

## [1.3.7](v1.3.6...v1.3.7) (2020-05-12)

### Bug Fixes

* **dot import:** Fix `import XYZ from '.'` ([#52](#52)) ([19df585](19df585)), closes [#34](#34)

Co-authored-by: KJDev-Bots <bots@kristianjones.dev>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Junxiao Shi <sunnylandh@gmail.com>
EntraptaJ pushed a commit that referenced this pull request May 12, 2020
## [1.3.6](v1.3.5...v1.3.6) (2020-05-12)

### Bug Fixes

* **dynamicInstantiate:** works with pnpm ([#45](#45)) ([5c0fadf](5c0fadf))
EntraptaJ added a commit that referenced this pull request May 12, 2020
EntraptaJ added a commit that referenced this pull request May 12, 2020
github-actions bot pushed a commit that referenced this pull request May 12, 2020
# [1.4.0](v1.3.7...v1.4.0) (2020-05-12)

### Features

* Force release ([58f3d3b](58f3d3b))

### Reverts

* Revert "chore(branches): Setup Next branch" ([b3a2345](b3a2345))
* Revert "fix(Resovler): Refactor resolver and module loader to prevent loading of URLs and already discovered javascript files (#28)" ([2aa2df8](2aa2df8)), closes [#28](#28)
* Revert "refactor: Remove Node 13.7/13.8 from supported versions" ([c0916b6](c0916b6))
* Revert "chore(release): 1.3.2 [skip ci]" ([e112a8d](e112a8d))
* Revert "fix: Readd JS_EXTS to findFIles to allow for post build JS support" ([ed01c06](ed01c06))
* Revert "chore(release): 1.3.3 [skip ci]" ([2e29ee2](2e29ee2))
* Revert "chore(deps-dev): bump @types/node from 13.9.5 to 13.9.8 (#29)" ([06561dc](06561dc)), closes [#29](#29)
* Revert "chore(deps-dev): bump @types/node from 13.9.8 to 13.11.0 (#30)" ([8050e6e](8050e6e)), closes [#30](#30)
* Revert "tests(Similar Folder): Add a test for similar folder names when searching for a file (should fail currently)" ([aa94c10](aa94c10))
* Revert "fix(findFiles): Fix the discovery of files when a directory of partial name match occurs" ([f51c084](f51c084))
* Revert "chore(release): 1.3.4 [skip ci]" ([fa25197](fa25197))
* Revert "fix(resolve): Don't run findFiles if we can already see an extension." ([3050146](3050146))
* Revert "chore(release): 1.3.5 [skip ci]" ([044da67](044da67))
* Revert "chore(deps-dev): bump @types/node from 13.11.0 to 13.11.1 (#35)" ([1b9eae8](1b9eae8)), closes [#35](#35)
* Revert "chore(deps-dev): bump prettier from 2.0.2 to 2.0.4 (#33)" ([9d37c8f](9d37c8f)), closes [#33](#33)
* Revert "chore(deps-dev): bump typescript from 3.8.3 to 3.9.2 (#50)" ([f962acf](f962acf)), closes [#50](#50)
* Revert "chore(deps-dev): bump conventional-changelog-conventionalcommits (#49)" ([e6a4d8f](e6a4d8f)), closes [#49](#49)
* Revert "fix(dynamicInstantiate): works with pnpm (#45)" ([4a92673](4a92673)), closes [#45](#45)
* Revert "chore(release): 1.3.6 [skip ci]" ([a461c3b](a461c3b))
* Revert "chore(deps-dev): bump prettier from 2.0.4 to 2.0.5 (#41)" ([c5613ca](c5613ca)), closes [#41](#41)
* Revert "chore(deps-dev): bump semantic-release from 17.0.4 to 17.0.7 (#42)" ([1d6a63d](1d6a63d)), closes [#42](#42)
* Revert "fix(dot import): Fix `import XYZ from '.'` (#52)" ([33612d1](33612d1)), closes [#52](#52)
* Revert "release 1.3.6 (#31)" ([db72a3f](db72a3f)), closes [#31](#31)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants