v0.1.0
This release is a big revamp of the existing parser and also adds a lot of new features. Here are the highlights:
NPM Package Support
We now fully support Stimulus controllers imported from NPM packages installed on disk. We can trace the import
declaration to the resolved source file within the NPM package. If the import is importing a class declaration, we can fully resolve the import to the class declaration in the NPM package.
Sadly the parser doesn't yet resolve controllers imported from import-mapped NPM packages.
Stimulus Parser Playground
The pull requests features a fully interactive web-based playground to interact and inspect the parse results. The playground allows users to encode the input into a sharable URL that can come in heady for bug and issue reports.
New Internal Structure and classes to represent objects
We already had:
Project
Parser
ControllerDefinition
MethodDefinition
ValueDefinition
ClassDefinition
TargetDefinition
Newly added:
SourceFile
- A representation of a (parsed) JavaScript/TypeScript source file.ImportDeclaration
- A representation of an import declaration within aSourceFile
. If a single import statement imports two constants it will be represented with twoImportDeclaration
objects. We decide betweendefault
,named
andnamespace
imports.ExportDeclaration
- A representation of an export declaration within aSourceFile
. If a single export statement exports two constants it will be represented with twoExportDeclaration
objects. We decide betweendefault
,named
andnamespace
exports.ClassDeclaration
- A representation of any class declaration within aSourceFile
. If class declaration defines a Stimulus controller it will have thecontrollerDefinition
populated.NodeModule
- The node module represents a detected NPM package. It holds aSourceFile
for each file it contains.ApplicationFile
- The file where the Stimulus application is defined/started in and exported from.ControllersIndexFile
- Responsible for detecting the registered controllers on the application.RegisteredController
- AControllerDefinition
/identifier
pair register which controllers where registered on the application with which identifier.
Analysis of registered controllers on the Stimulus
application
The Project
now exposes controllerDefinitions
and registeredControllers
, where controllerDefinitions
contain any of the controller definitions the parser found in the project and registeredControllers
are the controllers the were actually detected to be registered on the Stimulus
Application with an identifier.
The controllerDefinitions
have a guessIdentifier
property that uses a best effort strategy to come up with the most likely identifier somewhere would register this controllers as, this also includes controllers found in the installed NPM packages.
The registeredControllers
have an identifier
property, for which we are certain the this controller was registered with this identifier, either by manually calling application.register(...)
or through one of the autoload plugins we support. Currently we have support for the following mechanisms:
register
stimulus-loading-lazy
stimulus-loading-eager
esbuild-rails
stimulus-vite-helpers
stimulus-webpack-helpers
But we would love to implement support for other autoload mechanisms.
Changelog
Added
- Add support for private getters by @marcoroth in #32
- Add support for parsing TypeScript files by @marcoroth, @Zeko369 and @CharlieIGG in #49
- Add support for parsing parent controllers by @marcoroth in #50
- Add support for parsing Stimulus Decorators by @Zeko369 in #12
- Add support for NPM Packages by @marcoroth in #66
- Add support for import/export tracing by @marcoroth in #66
- Add support for analyzing registered controllers on the Stimulus application by @marcoroth in #66
- Add AST Builder and Stimulus Builder utils by @marcoroth in #56
- Add Laravel Sample Apps by @tonysm in #60
- Add Playground by @marcoroth in #66
Changed
- Better detect controller identifiers based on filename by @marcoroth in #53
Dependencies
Show all
- Bump typescript from 5.2.2 to 5.3.2 by @dependabot in #23
- Bump acorn-walk from 8.3.0 to 8.3.1 by @dependabot in #25
- Bump typescript from 5.3.2 to 5.3.3 by @dependabot in #26
- Bump vitest from 0.34.6 to 1.0.4 by @dependabot in #27
- Bump ts-node from 10.9.1 to 10.9.2 by @dependabot in #28
- Bump vitest from 1.0.4 to 1.1.0 by @dependabot in #30
- Bump @types/node from 20.10.5 to 20.10.6 by @dependabot in #33
- Bump acorn from 8.11.2 to 8.11.3 by @dependabot in #34
- Bump vitest from 1.1.0 to 1.1.1 by @dependabot in #35
- Bump vitest from 1.1.1 to 1.1.3 by @dependabot in #37
- Bump @types/node from 20.10.6 to 20.10.7 by @dependabot in #36
- Bump vitest from 1.1.3 to 1.2.0 by @dependabot in #40
- Bump acorn-walk from 8.3.1 to 8.3.2 by @dependabot in #39
- Bump @types/node from 20.10.7 to 20.11.0 by @dependabot in #38
- Bump vite from 5.0.8 to 5.0.12 by @dependabot in #41
- Bump vitest from 1.2.0 to 1.2.1 by @dependabot in #42
- Bump @types/node from 20.11.0 to 20.11.5 by @dependabot in #43
- Bump vitest from 1.2.1 to 1.2.2 by @dependabot in #44
- Bump @types/node from 20.11.5 to 20.11.10 by @dependabot in #45
- Bump @types/node from 20.11.10 to 20.11.16 by @dependabot in #46
- Bump @types/node from 20.11.16 to 20.11.17 by @dependabot in #55
- Bump vitest from 1.2.2 to 1.3.0 by @dependabot in #59
- Bump @types/node from 20.11.17 to 20.11.19 by @dependabot in #58
- Bump @typescript-eslint/typescript-estree from 6.21.0 to 7.0.1 by @dependabot in #57
New Contributors
- @Zeko369 made their first contribution in #12
- @CharlieIGG made their first contribution in #49
- @tonysm made their first contribution in #60
Commits
Full Changelog: v0.0.14...v0.1.0