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

feat: enable allowImportingTsExtensions by default #3029

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

productdevbook
Copy link
Contributor

@productdevbook productdevbook commented Jan 24, 2025 β€’

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Type stripping works with most versions of TypeScript but we recommend version 5.7 or newer with the following tsconfig.json settings: nodejs docs

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Sorry, something went wrong.

@@ -217,6 +217,8 @@ declare module "nitro/types" {
jsx: "preserve",
jsxFactory: "h",
jsxFragmentFactory: "Fragment",
allowImportingTsExtensions: true,
rewriteRelativeImportExtensions: true,
Copy link
Member

Choose a reason for hiding this comment

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

It is not required for us as nitro does not use tsc compiler.

allow importing ts extensions is nice (we could also backport it to v2 branch as non breaking change)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which structure do we broadcast from without tsc ? Which place in the code should I examine. I need to learn this structure

@productdevbook productdevbook changed the base branch from main to v2 January 24, 2025 11:41
@productdevbook productdevbook changed the base branch from v2 to main January 24, 2025 11:41
@productdevbook
Copy link
Contributor Author

my computer pnpm install this problem. How to fixed ?

Details

.../node_modules/better-sqlite3 install$ prebuil…
β”‚ prebuild-install warn install No prebuilt bina…
β”‚ gyp info it worked if it ends with ok
β”‚ gyp info using [email protected]
β”‚ gyp info using [email protected] | darwin | arm64
β”‚ gyp info find Python using Python version 3.13…
β”‚ gyp info spawn /opt/homebrew/opt/[email protected]/b…
β”‚ gyp info spawn args [
β”‚ gyp info spawn args '/Users/productdevbook/Lib…
β”‚ gyp info spawn args 'binding.gyp',
β”‚ gyp info spawn args '-f',
β”‚ gyp info spawn args 'make',
β”‚ gyp info spawn args '-I',
β”‚ gyp info spawn args '/Users/productdevbook/Doc…
β”‚ gyp info spawn args '-I',
β”‚ gyp info spawn args '/Users/productdevbook/Lib…
β”‚ gyp info spawn args '-I',
β”‚ gyp info spawn args '/Users/productdevbook/Lib…
β”‚ gyp info spawn args '-Dlibrary=shared_library',
β”‚ gyp info spawn args '-Dvisibility=default',
β”‚ gyp info spawn args '-Dnode_root_dir=/Users/pr…
β”‚ gyp info spawn args '-Dnode_gyp_dir=/Users/pro…
β”‚ gyp info spawn args '-Dnode_lib_file=/Users/pr…
β”‚ gyp info spawn args '-Dmodule_root_dir=/Users/…
β”‚ gyp info spawn args '-Dnode_engine=v8',
β”‚ gyp info spawn args '--depth=.',
β”‚ gyp info spawn args '--no-parallel',
β”‚ gyp info spawn args '--generator-output',
β”‚ gyp info spawn args 'build',
β”‚ gyp info spawn args '-Goutput_dir=.'
β”‚ gyp info spawn args ]
β”‚ gyp info spawn make
β”‚ gyp info spawn args [ 'BUILDTYPE=Release', '-C…
β”‚ TOUCH ba23eeee118cd63e16015df367567cb043fed8…
β”‚ ACTION deps_sqlite3_gyp_locate_sqlite3_targe…
β”‚ TOUCH Release/obj.target/deps/locate_sqlite3…
β”‚ CC(target) Release/obj.target/sqlite3/gen/sq…
β”‚ LIBTOOL-STATIC Release/sqlite3.a
β”‚ CXX(target) Release/obj.target/better_sqlite…
β”‚ ./src/util/macros.lzz:150:35: error: no matchi…
β”‚ 150 | recv->InstanceTemplate()->SetA…
β”‚ | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~…
β”‚ /Users/productdevbook/Library/Caches/node-gyp/…
β”‚ 1049 | void SetAccessor(
β”‚ | ^
β”‚ 1050 | Local name, AccessorGett…
β”‚ 1051 | AccessorSetterCallback setter = …
β”‚ 1052 | Local data = Local…
β”‚ | …
β”‚ /Users/productdevbook/Library/Caches/node-gyp/…
β”‚ 1055 | void SetAccessor(
β”‚ | ^
β”‚ 1056 | Local name, AccessorNameGe…
β”‚ | ~~~~~~~~~~~~~~…
β”‚ ./src/objects/database.lzz:180:21: warning: va…
β”‚ 180 | int status = sqlite3_d…
β”‚ | ^
β”‚ 1 warning and 1 error generated.
β”‚ make: *** [Release/obj.target/better_sqlite3/s…
β”‚ rm ba23eeee118cd63e16015df367567cb043fed872.in…
β”‚ gyp ERR! build error
β”‚ gyp ERR! stack Error: make failed with exit …
β”‚ gyp ERR! stack at ChildProcess. (/U…
β”‚ gyp ERR! System Darwin 24.2.0
β”‚ gyp ERR! command "/Users/productdevbook/.nvm/v…
β”‚ gyp ERR! cwd /Users/productdevbook/Documents/G…
β”‚ gyp ERR! node -v v22.12.0
β”‚ gyp ERR! node-gyp -v v10.2.0
β”‚ gyp ERR! not ok
└─ Failed in 29.4s at /Users/productdevbook/Documents/GitHub/dev/dev-nitro/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3

dev-nitro on ξ‚  v2 is πŸ“¦ v2.10.4 via  v22.12.0 took 45s
❯

@pi0 pi0 changed the title feat: add support for TypeScript extension imports in build types feat: enable allowImportingTsExtensions by default Jan 28, 2025
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

thanks!

@pi0 pi0 merged commit ce23e94 into nitrojs:main Jan 28, 2025
4 checks passed
@pi0
Copy link
Member

pi0 commented Jan 28, 2025

my computer pnpm install this problem. How to fixed ?

You need to use Node.js v20, sadly an issue with better-sqlite3 dev dependency..

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

Successfully merging this pull request may close these issues.

None yet

2 participants