forked from albanm/node-libxslt
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix build failures with spaces in installation paths #2
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
Open
mariuso
wants to merge
19
commits into
master
Choose a base branch
from
feature/node-20-22-24-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Update package.json with correct repository URLs and metadata - Create .npmignore to exclude development files while keeping libxslt submodule - Revert submodule initialization attempt in apply-patches.js - Ready for npm publication as libxslt-next
- Quote node_xmljs path in common.gypi to handle spaces in directory names - Remove problematic rpath setting that can cause issues with spaces - Update README.md to use libxslt-next package name consistently - Bump version to 1.0.1 for path fix
- Create index.d.ts with full type definitions for libxslt-next API - Add custom libxmljs2 type definitions since @types/libxmljs2 doesn't exist - Include TypeScript test file to validate type definitions - Update package.json with types field, TypeScript keywords, and dev dependencies - Add npm test:types script for TypeScript validation - Update README.md with TypeScript usage examples and documentation - Configure .npmignore to include TypeScript definitions in published package - Add proper files field to package.json for explicit control over published files Features: - Built-in TypeScript definitions (no separate @types package needed) - Full type safety for all synchronous and asynchronous API methods - Comprehensive method overloads for different input/output types - Compatible with TypeScript 3.0+ and modern IDEs - Auto-completion and IntelliSense support
- Restructure common.gypi to use target_defaults for better path handling - Remove complex path concatenation that breaks with spaces in directory names - Simplify libxslt.gyp by removing duplicate xmljs references - Remove unnecessary xmljs build dependency (already built by npm) - Use gyp's built-in features for consistent path resolution This fixes installation failures when the project path contains spaces, such as "XSLT Work" or "My Project". Fixes build error: "clang: error: no such file or directory"
- Quote patchPath in apply-patches.js to handle directory paths with spaces - Fixes npm install failures when package is installed in paths containing spaces
- Use JSON.stringify to properly quote resolved libxmljs2 path in common.gypi - Fixes compilation failures when package is installed in paths containing spaces
- Create test script to verify installation and compilation in directories with spaces - Add test:spaces npm script for automated testing - Test creates temporary directory with spaces and verifies package functionality
- Use sed to escape spaces in libxmljs2 path instead of JSON.stringify - Should properly handle paths with spaces in gyp build system
- Use JSON.stringify then slice(1, -1) to remove quotes but keep proper escaping - This should handle spaces in paths without breaking the path resolution
- Remove JSON.stringify approach that was causing issues - Let gyp handle path quoting natively - This should fix the spaces in path issue properly
Replace gyp variable expansion with direct node command execution to properly handle paths containing spaces. This resolves installation failures when the package is installed in directories with spaces.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Technical Details
The root cause was that gyp's
<(variable)expansion mechanism generated unquoted paths in Makefiles, causing build failures when paths contained spaces. The solution replaces this with<\!(node -p ...)syntax which:path.join()ensures correct path constructionChanges Made
<(node_xmljs)variable expansion with direct<\!(node -p ...)commandsTest Results
✅ All existing tests pass
✅ New spaces-in-path test passes
✅ Package successfully installs and loads in directories with spaces
Testing
npm run test:spaces npm test