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

Compiler fails when package name contains dot #4651

Open
leevilehtonen opened this issue Oct 2, 2024 · 0 comments
Open

Compiler fails when package name contains dot #4651

leevilehtonen opened this issue Oct 2, 2024 · 0 comments
Labels
bug This issue is a bug. p2

Comments

@leevilehtonen
Copy link

Describe the bug

JSII compiler fails when package.json name contains dot, e.g. @foo/example.jsii-dot-error.

This could be a bug or a known limitation (could not find it in the documentation).

Expected Behavior

JSII Compiler is able to compile even when package name contains dot.

Current Behavior

[2024-10-02T09:25:51.066] [DEBUG] jsii/compiler - Creating or updating /***/tsconfig.json
[2024-10-02T09:25:51.429] [TRACE] jsii/assembler - Processing source file: src/index.ts
[2024-10-02T09:25:51.430] [TRACE] jsii/assembler - Processing interface: .Props
[2024-10-02T09:25:51.431] [TRACE] jsii/assembler - Processing property: @foo/example.jsii-dot-error.Props#name
[2024-10-02T09:25:51.434] [INFO] jsii/assembler - Registering JSII interface: @foo/example.jsii-dot-error.Props
[2024-10-02T09:25:51.435] [TRACE] jsii/assembler - Processing class: .ExampleClass
[2024-10-02T09:25:51.435] [TRACE] jsii/assembler - Processing parameter: props
[2024-10-02T09:25:51.437] [INFO] jsii/assembler - Registering JSII class: @foo/example.jsii-dot-error.ExampleClass
[2024-10-02T09:25:51.437] [ERROR] jsii/compiler - Type model errors prevented the JSII assembly from being created
suggestion JSII2: A "homepage" field should be specified in "package.json"
error JSII9000: Encountered use of module that is not declared in "dependencies" or "peerDependencies": "@foo/example"

Reproduction Steps

  1. Create a JSII project with package name including a dot:
{
  "name": "@foo/example.jsii-dot-error"
}
  1. Add any exported implementation (interface, class etc.)
  2. Run npx jsii --verbose --verbose --verbose
  3. error JSII9000: Encountered use of module that is not declared in "dependencies" or "peerDependencies": "@foo/example"

Possible Solution

Looks like some parts of the code do string.split('.') on fqn values, maybe it would be possible to make it more sophisticated and consider the package name more throughly in that case?

OR: Document it as known limitation and maybe additionally raise a more descriptive diagnostic error when reading the package.json.

Additional Information/Context

If there's any workarounds, it would be nice to know.

SDK version used

5.5.4 (build 1378d94), typescript 5.5.4

Environment details (OS name and version, etc.)

Apple M1 Max, macOS 14.6.1

@leevilehtonen leevilehtonen added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 2, 2024
@mrgrain mrgrain added p2 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2
Projects
None yet
Development

No branches or pull requests

2 participants