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

npm package name validation #1335

Open
granicz opened this issue May 12, 2023 · 1 comment
Open

npm package name validation #1335

granicz opened this issue May 12, 2023 · 1 comment

Comments

@granicz
Copy link
Member

granicz commented May 12, 2023

When using npm package-based imports, such as:

let QRCode = JS.Import("foo", "date-fns")

then raise an error, if the given npm package is not defined in the project file, say, using the femto convention:

<NpmDependencies>
    <NpmPackage Name="date-fns" Version="gt 1.30.0 lt 2.0.0" ResolutionStrategy="Max" />
</NpmDependencies>
@Jand42
Copy link
Member

Jand42 commented May 13, 2023

@granicz First I am adding the possibility npm package-based imports.

I am modifying JS.Import to follow rules used by JS imports too:

  • if you want to import a locally defined module (resource in current assembly), you can do that as JS.Import("foo", "./localEmbedded.js").
  • Similartly, importing from another WS assembly should look like a relative path JS.Import("foo", "../AnotherLib/embedded.js")
  • Finally, as you write JS.Import("foo", "date-fns") will import from npm package "date-fns". Generally, if the import path does not start with ./ or ../, it is preserved exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants