-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Migrate to typescript and ESM #1769
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
eatsjobs
wants to merge
25
commits into
goldfire:master
Choose a base branch
from
eatsjobs:migrate-to-es
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.
Open
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
Since plugins are enabled by default when registered and automatically removed when unregistered, the enable/disable/isEnabled methods add unnecessary complexity. Plugins now have a simpler lifecycle: registered means active, unregistered means inactive. Changes: - Remove enable/disable/isEnabled methods from PluginManager - Remove enabled flag from RegisteredPlugin interface - Simplify _executeHooks to always execute for registered plugins - Update README documentation to remove enable/disable examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Added comprehensive details about the breaking changes, new features, and improvements in the CHANGELOG for the first alpha release of Howler.js v3.0, including the migration guide from v2.x. - Updated README to reflect the new TypeScript support, plugin registration, and usage examples, including HTML import maps for cleaner module imports. - Enhanced documentation with TypeScript type annotations and examples for better developer experience.
…consistency - Removed the `init` method from HowlerGlobal and directly initialized properties in the constructor for clarity. - Replaced `self` references with `this` for consistency across methods. - Simplified the plugin registration process by removing the `onRegister` hook from the PluginHooks interface, streamlining the plugin lifecycle. - Enhanced documentation comments for better understanding of plugin initialization behavior. This refactor aims to enhance code maintainability and readability while ensuring existing functionality remains intact.
- Expanded TypeScript types in `types.ts` to include custom interfaces for HTML5 audio elements and audio nodes, improving type safety and clarity. - Updated `HowlerGlobal` and `Sound` classes in `howler.core.ts` to utilize new types, ensuring better type checking and reducing potential runtime errors. - Refined audio handling logic to incorporate type guards for audio nodes, enhancing the robustness of audio playback and manipulation. - Improved error handling in `audio-loader.ts` by creating a more descriptive error event for XMLHttpRequest failures. - Adjusted spatial plugin connections to ensure compatibility with the new type definitions. These changes aim to enhance the overall developer experience and maintainability of the codebase while ensuring existing functionality remains intact.
- Introduced a new `biome.json` configuration file to manage project settings, including VCS, file includes, formatter, and linter options. - Updated `package.json` to include `@biomejs/biome` as a development dependency, ensuring compatibility with the new configuration. - Modified `package-lock.json` to reflect the addition of the new dependency and its associated metadata. - Ensured consistent formatting across various files by standardizing indentation and style. These changes aim to enhance project configuration management and maintain consistency in code formatting.
- Added `sideEffects: false` to `package.json` for better tree-shaking. - Introduced a new `size` script in `package.json` to check the bundle sizes using `check-size.js`. - Created `check-size.js` to calculate and log the sizes of core and plugin files, including gzip sizes. - Added `howl.ts`, `howler-global.ts`, `howler.core.ts`, `sound.ts`, and related type definitions to improve audio handling and maintainability. These changes aim to improve project configuration management and provide developers with tools to monitor bundle sizes effectively.
- Replaced XMLHttpRequest with Fetch API in `audio-loader.ts` for improved performance and modern browser support. - Updated the `headers` property in the `Howl` class to use `HeadersInit` type for better type safety. - Enhanced documentation in `types.ts` to clarify the use of fetch options for loading audio files. These changes aim to modernize the audio loading process and improve type definitions for better maintainability.
… for Howler.js v3.0.0-alpha.1 - Eliminated old license comments from multiple source files to streamline code. - Updated version information in `index.ts` to reflect the new alpha release. - Ensured consistency in code formatting and improved readability across various files. These changes aim to modernize the codebase in preparation for the upcoming release.
- Modified `package.json` to change the repository URL format and added new development dependencies: `@arethetypeswrong/core` and `publint`. - Updated `package-lock.json` to reflect changes in dependencies and their versions. - Adjusted `tsdown.config.ts` to specify entry points for bundling, disable unbundling for plugins, and enhance minification settings. - Revised `check-size.js` to reflect changes in file structure due to bundling configuration. These updates aim to improve project configuration, enhance dependency management, and streamline the build process.
- Changed section headers from '###' to '##' for improved readability and uniformity in the pull request template. - Ensured the template aligns with standard markdown practices for better presentation. These updates aim to enhance the clarity and usability of the pull request template.
- Introduced a new `cache.ts` file to implement a global cache for decoded audio buffers, allowing multiple Howl instances to share audio data. - Updated imports in `howl.ts`, `howler.core.ts`, and `audio-loader.ts` to utilize the new cache implementation, enhancing audio data management and performance. These changes aim to improve audio handling efficiency and reduce memory usage across Howl instances.
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.
3.0.0 Migration to typescript and esm, modern build workflow
Howler.js v3.0, major rewrite that migrates the library to TypeScript and introduces a modern plugin architecture.
Uses tsdown, publint @arethetypeswrong/cli tool
Breaking Changes
New Features
ADDEDComplete TypeScript rewrite with full type definitionsADDEDModern plugin system with hook-based architecture (HowlerPlugin,PluginManager)ADDEDSpatial audio plugin refactored to use the new plugin systemADDEDLightweight UA parser for consistent browser/device detectionADDEDTypeScript types exported:SpatialHowler,SpatialHowl,SpatialHowlOptionsADDEDPlugin lifecycle hooks:onHowlerInit,onHowlCreate,onSoundCreate,onHowlLoad,onHowlDestroy,onUnregisterADDEDHowler.addPlugin()andHowler.removePlugin()methods for plugin managementADDEDHowler.hasPlugin()method to check if a plugin is registeredADDEDImport map examples in documentation for cleaner CDN usageADDEDComprehensive TypeScript examples throughout documentationImprovements
CHANGEDAll user agent detection now uses centralizedlight-ua-parserfunctionsCHANGEDSpatial plugin properly cleans up state when unregisteredCHANGEDPlugin hooks execute correctly for both HTML5 and WebAudio backendsCHANGEDImproved error handling in plugin systemCHANGEDBetter separation of concerns with modular architectureCHANGEDAll code examples migrated to TypeScript with proper types