Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: support windows absolute extends#3062

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@sheerlox
Copy link
Member

@sheerloxsheerlox commentedNov 16, 2023
edited
Loading

Description

Restore support for Windows absolute path in theextends configuration option by usingimport-from-esm to load the referenced module.

Context

Following the changes in#3037,a user encountered anERR_UNSUPPORTED_ESM_URL_SCHEME error becauseusingresolve-fromdoes not return an URL, andimport then considersC:/ to be an URL scheme (likefile://) and returns the encountered error.

How has this been tested

Since there are no Windows-specific tests on this repository and the test pipeline doesn't run on Windows, we can rely onimport-from-esm solid test suite to guarantee this works:

Related issues

@sheerloxsheerloxforce-pushed thefix/support-windows-absolute-extends branch from7444fcf tod8c7d60CompareNovember 16, 2023 15:58
Copy link
Member

@travitravi left a comment

Choose a reason for hiding this comment

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

just one thought wondering if we could clean things up furhter. i havent dug in to better understand if that is a reasonable follow up or not, but i'm going to move this forward and we can do that as a separate PR if it does make sense.

thanks for sticking with this@sheerlox!

import{castArray,isNil,isPlainObject,isString,pickBy}from"lodash-es";
import{readPackageUp}from"read-pkg-up";
import{cosmiconfig}from"cosmiconfig";
importresolveFromfrom"resolve-from";
Copy link
Member

Choose a reason for hiding this comment

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

is resolve-from still used elsewhere in the project? would it be possible to remove it as a dependency?

Copy link
MemberAuthor

@sheerloxsheerloxNov 17, 2023
edited
Loading

Choose a reason for hiding this comment

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

Yes it is still being used in theloadPlugin function, and we can't replace it withimport-from-esm it because doesn't support ESM named exports (it only returns the whole moduleif thedefault export does not exist).
At least this part of the code is not subject to the Windows absolute path issue since theimport statement explicitly specifies thefile:// protocol.

exportasyncfunctionloadPlugin({ cwd},name,pluginsPath){
constbasePath=pluginsPath[name]
?dirname(resolveFrom.silent(__dirname,pluginsPath[name])||resolveFrom(cwd,pluginsPath[name]))
:__dirname;
if(isFunction(name)){
returnname;
}
constfile=resolveFrom.silent(basePath,name)||resolveFrom(cwd,name);
const{default:cjsExport, ...esmNamedExports}=awaitimport(`file://${file}`);
if(cjsExport){
returncjsExport;
}
returnesmNamedExports;
}

travi reacted with thumbs up emoji
@travitravi merged commit0d06f62 intosemantic-release:masterNov 17, 2023
@github-actions
Copy link

🎉 This PR is included in version 22.0.8 🎉

The release is available on:

Yoursemantic-release bot 📦🚀

sheerlox reacted with hooray emoji

@sheerloxsheerlox deleted the fix/support-windows-absolute-extends branchNovember 17, 2023 06:24
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@travitravitravi approved these changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@sheerlox@travi

[8]ページ先頭

©2009-2025 Movatter.jp