@flarum/cli 2.0.0-beta.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +178 -48
- package/bin/run +2 -1
- package/bin/splitsh-lite-darwin +0 -0
- package/bin/splitsh-lite-linux +0 -0
- package/boilerplate/skeleton/extension/.gitattributes +16 -14
- package/boilerplate/skeleton/extension/.github/workflows/backend.yml +2 -6
- package/boilerplate/skeleton/extension/.github/workflows/frontend.yml +5 -6
- package/boilerplate/skeleton/extension/.github/workflows/phpstan.yml +12 -0
- package/boilerplate/skeleton/extension/LICENSE.md +1 -1
- package/boilerplate/skeleton/extension/README.md +1 -1
- package/boilerplate/skeleton/extension/composer.json +13 -7
- package/boilerplate/skeleton/extension/extend.php +2 -2
- package/boilerplate/skeleton/extension/gitignore +1 -0
- package/boilerplate/skeleton/extension/js/admin.ts +2 -0
- package/boilerplate/skeleton/extension/js/forum.ts +2 -0
- package/boilerplate/skeleton/extension/js/jest.config.cjs +1 -0
- package/boilerplate/skeleton/extension/js/package.json +11 -4
- package/boilerplate/skeleton/extension/js/src/admin/extend.js +8 -0
- package/boilerplate/skeleton/extension/js/src/admin/extend.ts +8 -0
- package/boilerplate/skeleton/extension/js/src/admin/index.js +2 -0
- package/boilerplate/skeleton/extension/js/src/admin/index.ts +7 -0
- package/boilerplate/skeleton/extension/js/src/common/extend.js +5 -0
- package/boilerplate/skeleton/extension/js/src/common/extend.ts +5 -0
- package/boilerplate/skeleton/extension/js/src/common/index.ts +5 -0
- package/boilerplate/skeleton/extension/js/src/forum/extend.js +8 -0
- package/boilerplate/skeleton/extension/js/src/forum/extend.ts +8 -0
- package/boilerplate/skeleton/extension/js/src/forum/index.js +2 -0
- package/boilerplate/skeleton/extension/js/src/forum/index.ts +7 -0
- package/boilerplate/skeleton/extension/js/tests/unit/.gitkeep +0 -0
- package/boilerplate/skeleton/extension/js/tsconfig.json +10 -2
- package/boilerplate/skeleton/extension/js/tsconfig.test.json +10 -0
- package/boilerplate/skeleton/extension/locale/en.yml +1 -1
- package/boilerplate/skeleton/extension/phpstan.neon +12 -0
- package/boilerplate/skeleton/extension/tests/phpunit.integration.xml +6 -7
- package/boilerplate/skeleton/extension/tests/phpunit.unit.xml +5 -10
- package/boilerplate/stubs/backend/advanced-api-resource.php +85 -0
- package/boilerplate/stubs/backend/api-resource.php +73 -0
- package/boilerplate/stubs/backend/command.php +2 -2
- package/boilerplate/stubs/backend/controller.php +19 -0
- package/boilerplate/stubs/backend/event-listener.php +1 -1
- package/boilerplate/stubs/backend/filter.php +25 -0
- package/boilerplate/stubs/backend/handler/command.php +6 -20
- package/boilerplate/stubs/backend/handler/handler.php +6 -14
- package/boilerplate/stubs/backend/integration-test.php +10 -7
- package/boilerplate/stubs/backend/job.php +6 -11
- package/boilerplate/stubs/backend/mail-driver.php +36 -0
- package/boilerplate/stubs/backend/middleware.php +19 -0
- package/boilerplate/stubs/backend/model.php +1 -1
- package/boilerplate/stubs/backend/notification-blueprint.php +42 -0
- package/boilerplate/stubs/backend/notification-driver.php +32 -0
- package/boilerplate/stubs/backend/policy.php +1 -1
- package/boilerplate/stubs/backend/post-type.php +35 -0
- package/boilerplate/stubs/backend/repository.php +2 -10
- package/boilerplate/stubs/backend/search/driver.php +13 -0
- package/boilerplate/stubs/backend/search/searcher.php +41 -0
- package/boilerplate/stubs/backend/service-provider.php +1 -1
- package/boilerplate/stubs/backend/validator.php +1 -1
- package/boilerplate/stubs/frontend/component.js +1 -1
- package/boilerplate/stubs/frontend/forum-page.js +68 -0
- package/boilerplate/stubs/frontend/gambit/boolean.js +12 -0
- package/boilerplate/stubs/frontend/gambit/key-value.js +16 -0
- package/boilerplate/stubs/frontend/modal.js +1 -1
- package/boilerplate/stubs/frontend/model.js +1 -1
- package/boilerplate/stubs/frontend/notification.js +22 -0
- package/boilerplate/stubs/frontend/post-type.js +13 -0
- package/boilerplate/stubs/migration.php +1 -1
- package/boilerplate/stubs/views/email/html/information.blade.php +8 -0
- package/boilerplate/stubs/views/email/html/notification.blade.php +8 -0
- package/boilerplate/stubs/views/email/plain/information.blade.php +7 -0
- package/boilerplate/stubs/views/email/plain/notification.blade.php +6 -0
- package/lib/base-command.d.ts +22 -6
- package/lib/base-command.js +114 -56
- package/lib/boilersmith/io.d.ts +33 -11
- package/lib/boilersmith/io.js +32 -17
- package/lib/boilersmith/paths.d.ts +3 -3
- package/lib/boilersmith/paths.js +7 -7
- package/lib/boilersmith/scaffolding/audit-step-factory.js +12 -12
- package/lib/boilersmith/scaffolding/infra-step-factory.js +2 -2
- package/lib/boilersmith/scaffolding/init-step-factory.js +5 -5
- package/lib/boilersmith/scaffolding/module.d.ts +30 -10
- package/lib/boilersmith/scaffolding/module.js +61 -19
- package/lib/boilersmith/scaffolding/scaffolder.d.ts +4 -1
- package/lib/boilersmith/scaffolding/scaffolder.js +33 -33
- package/lib/boilersmith/scaffolding/template-param.d.ts +2 -2
- package/lib/boilersmith/scaffolding/template-param.js +2 -2
- package/lib/boilersmith/step-manager.d.ts +15 -11
- package/lib/boilersmith/step-manager.js +45 -29
- package/lib/boilersmith/steps/stub-base.js +4 -4
- package/lib/boilersmith/utils/clone-and-fill.js +1 -1
- package/lib/boilersmith/utils/commit-async.d.ts +2 -0
- package/lib/boilersmith/utils/commit-async.js +15 -0
- package/lib/boilersmith/utils/json-leaf-paths.d.ts +2 -2
- package/lib/boilersmith/utils/read-tpl.js +2 -2
- package/lib/commands/audit/infra.d.ts +2 -5
- package/lib/commands/audit/infra.js +31 -9
- package/lib/commands/infra.d.ts +2 -10
- package/lib/commands/infra.js +20 -14
- package/lib/commands/init.d.ts +2 -5
- package/lib/commands/init.js +7 -5
- package/lib/commands/make/backend/{api-serializer.d.ts → api-resource.d.ts} +2 -5
- package/lib/commands/make/backend/api-resource.js +26 -0
- package/lib/commands/make/backend/command.d.ts +1 -4
- package/lib/commands/make/backend/command.js +3 -4
- package/lib/commands/make/backend/{api-controller.d.ts → controller.d.ts} +2 -5
- package/lib/commands/make/backend/controller.js +31 -0
- package/lib/commands/make/backend/event-listener.d.ts +1 -4
- package/lib/commands/make/backend/event-listener.js +2 -3
- package/lib/commands/make/backend/{api-serializer-attributes.d.ts → filter.d.ts} +3 -6
- package/lib/commands/make/backend/filter.js +26 -0
- package/lib/commands/make/backend/handler.d.ts +2 -5
- package/lib/commands/make/backend/handler.js +8 -11
- package/lib/commands/make/backend/integration-test.d.ts +1 -4
- package/lib/commands/make/backend/integration-test.js +4 -6
- package/lib/commands/make/backend/job.d.ts +1 -4
- package/lib/commands/make/backend/job.js +2 -2
- package/lib/commands/make/backend/mail-driver.d.ts +12 -0
- package/lib/commands/make/backend/mail-driver.js +29 -0
- package/lib/commands/make/backend/middleware.d.ts +11 -0
- package/lib/commands/make/backend/middleware.js +26 -0
- package/lib/commands/make/backend/migration.d.ts +1 -4
- package/lib/commands/make/backend/migration.js +10 -4
- package/lib/commands/make/backend/model.d.ts +6 -7
- package/lib/commands/make/backend/model.js +69 -449
- package/lib/commands/make/backend/notification-blueprint.d.ts +12 -0
- package/lib/commands/make/backend/notification-blueprint.js +29 -0
- package/lib/commands/make/backend/notification-driver.d.ts +12 -0
- package/lib/commands/make/backend/notification-driver.js +29 -0
- package/lib/commands/make/backend/policy.d.ts +1 -4
- package/lib/commands/make/backend/policy.js +2 -3
- package/lib/commands/make/backend/post-type.d.ts +12 -0
- package/lib/commands/make/backend/post-type.js +29 -0
- package/lib/commands/make/backend/repository.d.ts +1 -4
- package/lib/commands/make/backend/repository.js +1 -1
- package/lib/commands/make/backend/route.d.ts +1 -4
- package/lib/commands/make/backend/route.js +2 -3
- package/lib/commands/make/backend/search-driver.d.ts +11 -0
- package/lib/commands/make/backend/search-driver.js +51 -0
- package/lib/commands/make/backend/service-provider.d.ts +1 -4
- package/lib/commands/make/backend/service-provider.js +3 -4
- package/lib/commands/make/backend/validator.d.ts +1 -4
- package/lib/commands/make/backend/validator.js +2 -2
- package/lib/commands/make/frontend/component.d.ts +4 -5
- package/lib/commands/make/frontend/component.js +7 -2
- package/lib/commands/make/frontend/forum-page.d.ts +11 -0
- package/lib/commands/make/frontend/forum-page.js +92 -0
- package/lib/commands/make/frontend/gambit.d.ts +11 -0
- package/lib/commands/make/frontend/gambit.js +30 -0
- package/lib/commands/make/frontend/modal.d.ts +1 -4
- package/lib/commands/make/frontend/modal.js +3 -2
- package/lib/commands/make/frontend/model.d.ts +6 -7
- package/lib/commands/make/frontend/model.js +27 -28
- package/lib/commands/make/frontend/notification.d.ts +12 -0
- package/lib/commands/make/frontend/notification.js +62 -0
- package/lib/commands/make/frontend/post-type.d.ts +12 -0
- package/lib/commands/make/frontend/post-type.js +59 -0
- package/lib/commands/make/locale.d.ts +11 -0
- package/lib/commands/make/locale.js +27 -0
- package/lib/commands/make/model.d.ts +12 -0
- package/lib/commands/make/model.js +29 -0
- package/lib/commands/make/notification.d.ts +11 -0
- package/lib/commands/make/notification.js +33 -0
- package/lib/commands/make/post-type.d.ts +11 -0
- package/lib/commands/make/post-type.js +31 -0
- package/lib/commands/monorepo/create.d.ts +12 -0
- package/lib/commands/monorepo/create.js +20 -0
- package/lib/commands/monorepo/split.d.ts +12 -0
- package/lib/commands/monorepo/split.js +19 -0
- package/lib/commands/update/js-imports.d.ts +1 -4
- package/lib/commands/update/js-imports.js +2 -3
- package/lib/commands/upgrade/2.0.d.ts +17 -0
- package/lib/commands/upgrade/2.0.js +113 -0
- package/lib/help.js +2 -2
- package/lib/providers/php-provider.d.ts +7 -1
- package/lib/providers/php-provider.js +18 -5
- package/lib/steps/extenders/{api-serializer.d.ts → api-resource.d.ts} +1 -1
- package/lib/steps/extenders/api-resource.js +38 -0
- package/lib/steps/extenders/base.d.ts +1 -1
- package/lib/steps/extenders/base.js +13 -1
- package/lib/steps/extenders/console-command.js +1 -1
- package/lib/steps/extenders/event.js +1 -1
- package/lib/steps/extenders/mail-driver.d.ts +5 -0
- package/lib/steps/extenders/mail-driver.js +58 -0
- package/lib/steps/extenders/middleware.d.ts +5 -0
- package/lib/steps/extenders/middleware.js +57 -0
- package/lib/steps/extenders/notification-driver.d.ts +5 -0
- package/lib/steps/extenders/notification-driver.js +58 -0
- package/lib/steps/extenders/notification-type.d.ts +5 -0
- package/lib/steps/extenders/notification-type.js +55 -0
- package/lib/steps/extenders/policy.js +1 -1
- package/lib/steps/extenders/post-type.d.ts +5 -0
- package/lib/steps/extenders/post-type.js +42 -0
- package/lib/steps/extenders/route.js +11 -2
- package/lib/steps/extenders/search-driver.d.ts +5 -0
- package/lib/steps/extenders/search-driver.js +38 -0
- package/lib/steps/extenders/search-filter.d.ts +5 -0
- package/lib/steps/extenders/search-filter.js +67 -0
- package/lib/steps/extenders/service-provider.js +1 -1
- package/lib/steps/gen-ext-scaffolder.d.ts +4 -4
- package/lib/steps/gen-ext-scaffolder.js +264 -58
- package/lib/steps/js/base.d.ts +14 -5
- package/lib/steps/js/base.js +101 -27
- package/lib/steps/js/model.d.ts +4 -7
- package/lib/steps/js/model.js +45 -19
- package/lib/steps/js/notification.d.ts +7 -0
- package/lib/steps/js/notification.js +58 -0
- package/lib/steps/js/post-type.d.ts +8 -0
- package/lib/steps/js/post-type.js +60 -0
- package/lib/steps/js/routes.d.ts +7 -0
- package/lib/steps/js/routes.js +63 -0
- package/lib/steps/js/search-driver-locale.d.ts +8 -0
- package/lib/steps/js/search-driver-locale.js +36 -0
- package/lib/steps/js/search-gambit.d.ts +7 -0
- package/lib/steps/js/search-gambit.js +51 -0
- package/lib/steps/locale/base.d.ts +32 -0
- package/lib/steps/locale/base.js +97 -0
- package/lib/steps/misc/composer.js +2 -2
- package/lib/steps/misc/git.d.ts +1 -1
- package/lib/steps/misc/git.js +3 -3
- package/lib/steps/misc/npm.d.ts +11 -0
- package/lib/steps/misc/npm.js +19 -0
- package/lib/steps/misc/yarn.js +2 -2
- package/lib/steps/monorepo/create.d.ts +19 -0
- package/lib/steps/monorepo/create.js +187 -0
- package/lib/steps/monorepo/split.d.ts +14 -0
- package/lib/steps/monorepo/split.js +99 -0
- package/lib/steps/stubs/backend/advanced-api-resource.d.ts +13 -0
- package/lib/steps/stubs/backend/advanced-api-resource.js +81 -0
- package/lib/steps/stubs/backend/{api-serializer.d.ts → api-resource.d.ts} +2 -2
- package/lib/steps/stubs/backend/{api-serializer.js → api-resource.js} +12 -9
- package/lib/steps/stubs/backend/command.d.ts +2 -21
- package/lib/steps/stubs/backend/command.js +15 -1
- package/lib/steps/stubs/backend/{api-controller.d.ts → controller.d.ts} +4 -14
- package/lib/steps/stubs/backend/controller.js +40 -0
- package/lib/steps/stubs/backend/event-listener.d.ts +1 -1
- package/lib/steps/stubs/backend/event-listener.js +3 -1
- package/lib/steps/stubs/backend/filter.d.ts +8 -0
- package/lib/steps/stubs/backend/filter.js +44 -0
- package/lib/steps/stubs/backend/handler-command.d.ts +2 -27
- package/lib/steps/stubs/backend/handler-command.js +3 -1
- package/lib/steps/stubs/backend/handler.d.ts +1 -1
- package/lib/steps/stubs/backend/handler.js +5 -1
- package/lib/steps/stubs/backend/integration-test.d.ts +1 -1
- package/lib/steps/stubs/backend/integration-test.js +1 -4
- package/lib/steps/stubs/backend/job.d.ts +1 -1
- package/lib/steps/stubs/backend/job.js +1 -0
- package/lib/steps/stubs/backend/mail-driver.d.ts +7 -0
- package/lib/steps/stubs/backend/mail-driver.js +30 -0
- package/lib/steps/stubs/backend/middleware.d.ts +22 -0
- package/lib/steps/stubs/backend/middleware.js +31 -0
- package/lib/steps/stubs/backend/migration.js +6 -3
- package/lib/steps/stubs/backend/model.d.ts +2 -24
- package/lib/steps/stubs/backend/model.js +3 -5
- package/lib/steps/stubs/backend/notification-blueprint.d.ts +7 -0
- package/lib/steps/stubs/backend/notification-blueprint.js +44 -0
- package/lib/steps/stubs/backend/notification-driver.d.ts +7 -0
- package/lib/steps/stubs/backend/notification-driver.js +30 -0
- package/lib/steps/stubs/backend/policy.d.ts +1 -1
- package/lib/steps/stubs/backend/policy.js +3 -1
- package/lib/steps/stubs/backend/post-type.d.ts +7 -0
- package/lib/steps/stubs/backend/post-type.js +44 -0
- package/lib/steps/stubs/backend/repository.d.ts +1 -1
- package/lib/steps/stubs/backend/repository.js +3 -1
- package/lib/steps/stubs/backend/search-driver-searcher.d.ts +24 -0
- package/lib/steps/stubs/backend/search-driver-searcher.js +32 -0
- package/lib/steps/stubs/backend/search-driver.d.ts +8 -0
- package/lib/steps/stubs/backend/search-driver.js +49 -0
- package/lib/steps/stubs/backend/service-provider.d.ts +1 -1
- package/lib/steps/stubs/backend/service-provider.js +1 -0
- package/lib/steps/stubs/backend/validator.d.ts +1 -1
- package/lib/steps/stubs/backend/validator.js +1 -0
- package/lib/steps/stubs/flarum-base.js +1 -1
- package/lib/steps/stubs/frontend/component.d.ts +0 -5
- package/lib/steps/stubs/frontend/component.js +1 -0
- package/lib/steps/stubs/frontend/forum-page.d.ts +25 -0
- package/lib/steps/stubs/frontend/forum-page.js +37 -0
- package/lib/steps/stubs/frontend/gambit.d.ts +7 -0
- package/lib/steps/stubs/frontend/gambit.js +50 -0
- package/lib/steps/stubs/frontend/modal.d.ts +0 -5
- package/lib/steps/stubs/frontend/modal.js +1 -0
- package/lib/steps/stubs/frontend/model.d.ts +8 -1
- package/lib/steps/stubs/frontend/model.js +6 -0
- package/lib/steps/stubs/frontend/notification.d.ts +11 -0
- package/lib/steps/stubs/frontend/notification.js +48 -0
- package/lib/steps/stubs/frontend/post-type.d.ts +11 -0
- package/lib/steps/stubs/frontend/post-type.js +48 -0
- package/lib/steps/stubs/js-base.js +12 -5
- package/lib/steps/stubs/php-base.js +13 -9
- package/lib/steps/update/js-imports.js +9 -3
- package/lib/steps/upgrade/twopointoh/backend/email-views.d.ts +18 -0
- package/lib/steps/upgrade/twopointoh/backend/email-views.js +81 -0
- package/lib/steps/upgrade/twopointoh/backend/filesystem.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/filesystem.js +40 -0
- package/lib/steps/upgrade/twopointoh/backend/intervention-image.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/intervention-image.js +44 -0
- package/lib/steps/upgrade/twopointoh/backend/json-api.d.ts +12 -0
- package/lib/steps/upgrade/twopointoh/backend/json-api.js +111 -0
- package/lib/steps/upgrade/twopointoh/backend/mailer.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/mailer.js +37 -0
- package/lib/steps/upgrade/twopointoh/backend/misc.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/misc.js +42 -0
- package/lib/steps/upgrade/twopointoh/backend/phpunit.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/phpunit.js +52 -0
- package/lib/steps/upgrade/twopointoh/backend/search.d.ts +28 -0
- package/lib/steps/upgrade/twopointoh/backend/search.js +200 -0
- package/lib/steps/upgrade/twopointoh/base.d.ts +58 -0
- package/lib/steps/upgrade/twopointoh/base.js +284 -0
- package/lib/steps/upgrade/twopointoh/dependencies.d.ts +10 -0
- package/lib/steps/upgrade/twopointoh/dependencies.js +108 -0
- package/lib/steps/upgrade/twopointoh/frontend/code-splitting/usage-of-lazy-modules.d.ts +26 -0
- package/lib/steps/upgrade/twopointoh/frontend/code-splitting/usage-of-lazy-modules.js +418 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/compat.d.ts +12 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/compat.js +75 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/import-ext.d.ts +13 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/import-ext.js +126 -0
- package/lib/steps/upgrade/twopointoh/frontend/format.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/frontend/format.js +32 -0
- package/lib/steps/upgrade/twopointoh/frontend/misc.d.ts +17 -0
- package/lib/steps/upgrade/twopointoh/frontend/misc.js +433 -0
- package/lib/steps/upgrade/twopointoh/infra.d.ts +10 -0
- package/lib/steps/upgrade/twopointoh/infra.js +51 -0
- package/lib/steps/upgrade/twopointoh/less.d.ts +12 -0
- package/lib/steps/upgrade/twopointoh/less.js +217 -0
- package/lib/utils/add-extenders.d.ts +2 -0
- package/lib/utils/add-extenders.js +115 -0
- package/lib/utils/ast.d.ts +22 -0
- package/lib/utils/ast.js +235 -0
- package/lib/utils/composer.d.ts +2 -1
- package/lib/utils/migration.js +3 -1
- package/lib/utils/model-name.d.ts +1 -0
- package/lib/utils/model-name.js +7 -3
- package/lib/utils/monorepo.d.ts +24 -0
- package/lib/utils/monorepo.js +24 -0
- package/lib/utils/validation.d.ts +6 -1
- package/lib/utils/validation.js +15 -0
- package/oclif.manifest.json +1 -1
- package/package.json +27 -14
- package/php-subsystem/composer.json +11 -9
- package/php-subsystem/composer.lock +66 -71
- package/php-subsystem/index.php +41 -6
- package/php-subsystem/src/CustomPrettyPrinter.php +1 -1
- package/php-subsystem/src/ExtenderUtil.php +7 -13
- package/php-subsystem/src/NodeUtil.php +72 -0
- package/php-subsystem/src/NodeVisitors/AddExtender.php +28 -12
- package/php-subsystem/src/NodeVisitors/AddUses.php +24 -0
- package/php-subsystem/src/NodeVisitors/ChangeSignatures.php +200 -0
- package/php-subsystem/src/NodeVisitors/ReplaceUses.php +175 -0
- package/php-subsystem/src/Upgrade/Replacement.php +51 -0
- package/php-subsystem/src/Upgrade/ReplacementResult.php +17 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/EmailViews.php +94 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/Filesystem.php +88 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/InterventionImage.php +86 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/JsonApi.php +186 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/Misc.php +564 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/PhpUnit.php +241 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/Search.php +589 -0
- package/php-subsystem/vendor/autoload.php +18 -0
- package/php-subsystem/vendor/bin/php-parse +119 -0
- package/php-subsystem/vendor/composer/ClassLoader.php +166 -32
- package/php-subsystem/vendor/composer/InstalledVersions.php +350 -209
- package/php-subsystem/vendor/composer/autoload_classmap.php +1 -1
- package/php-subsystem/vendor/composer/autoload_namespaces.php +1 -1
- package/php-subsystem/vendor/composer/autoload_psr4.php +1 -1
- package/php-subsystem/vendor/composer/autoload_real.php +3 -22
- package/php-subsystem/vendor/composer/installed.json +56 -61
- package/php-subsystem/vendor/composer/installed.php +29 -30
- package/php-subsystem/vendor/composer/platform_check.php +2 -2
- package/php-subsystem/vendor/nikic/php-parser/README.md +21 -13
- package/php-subsystem/vendor/nikic/php-parser/bin/php-parse +12 -11
- package/php-subsystem/vendor/nikic/php-parser/composer.json +41 -39
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php +58 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php +54 -25
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php +11 -4
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php +87 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php +116 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php +22 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +26 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php +31 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php +5 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php +69 -26
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php +47 -18
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php +6 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php +25 -28
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php +31 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php +8 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php +85 -70
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php +119 -71
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Comment.php +35 -67
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php +3 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php +17 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Error.php +24 -33
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php +6 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php +11 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php +36 -22
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php +24 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php +237 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php +63 -69
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php +15 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +74 -92
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php +11 -18
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php +10 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php +45 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php +19 -25
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php +6 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php +22 -29
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php +31 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php +31 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php +6 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php +10 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer.php +70 -491
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php +69 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NameContext.php +23 -24
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php +13 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php +43 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php +5 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php +36 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/ComplexType.php +13 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php +12 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php +37 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +1 -39
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +11 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php +35 -30
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +8 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php +35 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php +5 -6
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +5 -6
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php +12 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +34 -27
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +1 -32
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php +5 -6
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +15 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +13 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +11 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +12 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php +8 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +18 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +17 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php +18 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php +10 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +10 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +9 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +19 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +11 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +12 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php +6 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php +13 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php +32 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php +27 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php +80 -53
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php +47 -23
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php +37 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +1 -68
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +1 -29
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +1 -28
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php +78 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php +82 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php +34 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +1 -71
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php +44 -24
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php +39 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php +29 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +33 -27
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php +15 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +66 -71
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +48 -61
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +1 -32
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +12 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php +17 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +19 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +20 -17
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +31 -27
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php +16 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +18 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +13 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php +35 -36
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +1 -32
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +1 -35
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +8 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +12 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +3 -4
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +10 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +1 -50
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +16 -16
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php +8 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php +55 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php +27 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node.php +24 -29
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php +20 -20
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php +169 -82
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php +28 -19
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php +71 -84
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php +4 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php +82 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +40 -24
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php +8 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php +59 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php +2011 -2058
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php +2717 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser.php +9 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php +466 -248
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php +31 -33
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php +164 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php +419 -338
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php +51 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +587 -431
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Token.php +18 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php +63 -0
- package/boilerplate/stubs/backend/api-controller/create.php +0 -53
- package/boilerplate/stubs/backend/api-controller/delete.php +0 -52
- package/boilerplate/stubs/backend/api-controller/list.php +0 -61
- package/boilerplate/stubs/backend/api-controller/normal.php +0 -29
- package/boilerplate/stubs/backend/api-controller/show.php +0 -48
- package/boilerplate/stubs/backend/api-controller/update.php +0 -54
- package/boilerplate/stubs/backend/api-serializer.php +0 -36
- package/lib/commands/make/backend/api-controller.js +0 -27
- package/lib/commands/make/backend/api-serializer-attributes.js +0 -15
- package/lib/commands/make/backend/api-serializer.js +0 -15
- package/lib/steps/extenders/api-serializer.js +0 -77
- package/lib/steps/stubs/backend/api-controller.js +0 -62
- package/lib/steps/stubs/frontend/migration.js +0 -1
- package/php-subsystem/vendor/nikic/php-parser/.editorconfig +0 -9
- package/php-subsystem/vendor/nikic/php-parser/grammar/README.md +0 -30
- package/php-subsystem/vendor/nikic/php-parser/grammar/parser.template +0 -106
- package/php-subsystem/vendor/nikic/php-parser/grammar/php5.y +0 -1026
- package/php-subsystem/vendor/nikic/php-parser/grammar/php7.y +0 -1152
- package/php-subsystem/vendor/nikic/php-parser/grammar/phpyLang.php +0 -192
- package/php-subsystem/vendor/nikic/php-parser/grammar/rebuildParsers.php +0 -81
- package/php-subsystem/vendor/nikic/php-parser/grammar/tokens.template +0 -17
- package/php-subsystem/vendor/nikic/php-parser/grammar/tokens.y +0 -115
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php +0 -47
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php +0 -76
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php +0 -23
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php +0 -105
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +0 -30
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php +0 -55
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php +0 -2630
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php +0 -145
- /package/{lib/steps/stubs/frontend/migration.d.ts → boilerplate/skeleton/extension/js/tests/integration/.gitkeep} +0 -0
- /package/boilerplate/skeleton/extension/js/{webpack.config.js → webpack.config.cjs} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_1 = require("./base");
|
|
4
|
+
class Infrastructure extends base_1.BaseUpgradeStep {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.type = 'Update the extension infrastructure.';
|
|
8
|
+
}
|
|
9
|
+
replacements(file) {
|
|
10
|
+
const replacements = [];
|
|
11
|
+
if (file.endsWith('.yml')) {
|
|
12
|
+
replacements.push(this.updateWorkflow());
|
|
13
|
+
}
|
|
14
|
+
if (file.endsWith('.neon')) {
|
|
15
|
+
replacements.push(this.updatePhpStan());
|
|
16
|
+
}
|
|
17
|
+
return replacements;
|
|
18
|
+
}
|
|
19
|
+
targets() {
|
|
20
|
+
return ['.github/workflows/*.yml', 'phpstan.neon'];
|
|
21
|
+
}
|
|
22
|
+
gitCommit() {
|
|
23
|
+
return {
|
|
24
|
+
message: 'chore(2.0): update infrastructure',
|
|
25
|
+
description: 'Update the extension infrastructure',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
pauseMessage() {
|
|
29
|
+
return 'Infrastructure updated. Please review the changes then proceed.';
|
|
30
|
+
}
|
|
31
|
+
updateWorkflow() {
|
|
32
|
+
return (_file, code) => ({
|
|
33
|
+
updated: code
|
|
34
|
+
.replace('REUSABLE_backend.yml@1.x', 'REUSABLE_backend.yml@2.x')
|
|
35
|
+
.replace('REUSABLE_frontend.yml@1.x', 'REUSABLE_frontend.yml@2.x')
|
|
36
|
+
.replace('REUSABLE_backend.yml@main', 'REUSABLE_backend.yml@2.x')
|
|
37
|
+
.replace('REUSABLE_frontend.yml@main', 'REUSABLE_frontend.yml@2.x')
|
|
38
|
+
.replace(/php_versions: '\["[^']+]'/, 'php_versions: \'["8.2", "8.3", "8.4"]\''),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
updatePhpStan() {
|
|
42
|
+
return (_file, code) => ({
|
|
43
|
+
updated: code
|
|
44
|
+
// remove lines
|
|
45
|
+
// checkMissingIterableValueType: false
|
|
46
|
+
// checkGenericClassInNonGenericObjectType: false
|
|
47
|
+
.replace(/^(\s+checkMissingIterableValueType: false\n|\s+checkGenericClassInNonGenericObjectType: false\n)/gm, ''),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = Infrastructure;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseUpgradeStep, GitCommit, Replacement } from './base';
|
|
2
|
+
export default class LessChanges extends BaseUpgradeStep {
|
|
3
|
+
type: string;
|
|
4
|
+
static MODE_SPECIFIC_VARS: string[];
|
|
5
|
+
static VARS: string[];
|
|
6
|
+
static MIXINS: string[];
|
|
7
|
+
replacements(file: string): Replacement[];
|
|
8
|
+
targets(): string[];
|
|
9
|
+
gitCommit(): GitCommit;
|
|
10
|
+
pauseMessage(): string;
|
|
11
|
+
static vars(): string[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
class LessChanges extends base_1.BaseUpgradeStep {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.type = 'LESS code changes to more vanilla CSS';
|
|
10
|
+
}
|
|
11
|
+
replacements(file) {
|
|
12
|
+
if (!file.endsWith('.less'))
|
|
13
|
+
return [];
|
|
14
|
+
const replacements = {};
|
|
15
|
+
const declarations = {};
|
|
16
|
+
return [
|
|
17
|
+
// Replace color functions with CSS variable declarations and usage.
|
|
18
|
+
(_file, code) => {
|
|
19
|
+
// match all color functions
|
|
20
|
+
const colorFunctions = code.match(/(fade|lighten|darken|mix|saturate|desaturate|shade|fadein|fadeout|spin|tint|greyscale|contrast)\([^)]+\)/g);
|
|
21
|
+
colorFunctions === null || colorFunctions === void 0 ? void 0 : colorFunctions.forEach((colorFunction) => {
|
|
22
|
+
const content = colorFunction.match(/(fade|lighten|darken|mix|saturate|desaturate|shade|fadein|fadeout|spin|tint|greyscale|contrast)\(([^)]+)\)/);
|
|
23
|
+
let needsReplacement = false;
|
|
24
|
+
for (const variable of LessChanges.MODE_SPECIFIC_VARS) {
|
|
25
|
+
if (content === null || content === void 0 ? void 0 : content[2].includes(`@${variable}`)) {
|
|
26
|
+
needsReplacement = true;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (needsReplacement) {
|
|
31
|
+
const varName = content[2].match(/@([\dA-z-]+)/)[1];
|
|
32
|
+
const modifier = content[1];
|
|
33
|
+
const degree = content[2].replace(/[^\d.]/g, '');
|
|
34
|
+
const newVarName = `--${varName}-${modifier}-${degree}`;
|
|
35
|
+
replacements[colorFunction] = `var(${newVarName})`;
|
|
36
|
+
declarations[newVarName] = {
|
|
37
|
+
dark: colorFunction.replace(`@${varName}`, `@${varName}-dark`),
|
|
38
|
+
light: colorFunction.replace(`@${varName}`, `@${varName}-light`),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return null;
|
|
43
|
+
},
|
|
44
|
+
// Basic replacements.
|
|
45
|
+
(_file, code) => {
|
|
46
|
+
const replaceWithCssVars = (code) => code
|
|
47
|
+
// property: @variable => property: var(--variable)
|
|
48
|
+
.replace(/^(\s+)([^:@]+):\s*(.*)@([\dA-z-]+)([^;]*);(.*)$/gim, (_, indent, property, before, variable, after, comments) => {
|
|
49
|
+
if (LessChanges.vars().includes(variable) &&
|
|
50
|
+
!/(fade|lighten|darken|mix|saturate|desaturate|shade|fadein|fadeout|spin|tint|greyscale|contrast)\(/.test(before)) {
|
|
51
|
+
return `${indent}${property}: ${before}var(--${variable})${after};${comments}`;
|
|
52
|
+
}
|
|
53
|
+
return _;
|
|
54
|
+
});
|
|
55
|
+
for (const [colorFunction, replacement] of Object.entries(replacements)) {
|
|
56
|
+
code = code.replace(colorFunction, replacement);
|
|
57
|
+
}
|
|
58
|
+
for (const mixin of LessChanges.MIXINS) {
|
|
59
|
+
code = code.replace(new RegExp(`\\.${mixin}\\((.*?)\\);`, 'g'), `${mixin}: $1;`);
|
|
60
|
+
}
|
|
61
|
+
code = replaceWithCssVars(replaceWithCssVars(code))
|
|
62
|
+
// light/dark mode
|
|
63
|
+
.replace(/\s+&\s*when\s*\(\s*@config-dark-mode\s*\)\s*{/, '[data-theme^=dark] & {')
|
|
64
|
+
.replace(/\s+&\s*when\s*\(\s*@config-dark-mode\s*=\s*true\s*\)\s*{/, '[data-theme^=dark] & {')
|
|
65
|
+
.replace(/\s+&\s*when\s*\(\s*@config-dark-mode\s*=\s*false\s*\)\s*{/, '[data-theme^=light] & {')
|
|
66
|
+
// colored header
|
|
67
|
+
.replace(/\s+&\s*when\s*\(\s*@config-colored-header\s*\)\s*{/, '[data-colored-header=true] & {')
|
|
68
|
+
.replace(/\s+&\s*when\s*\(\s*@config-colored-header\s*=\s*true\s*\)\s*{/, '[data-colored-header=true] & {')
|
|
69
|
+
.replace(/\s+&\s*when\s*\(\s*@config-colored-header\s*=\s*false\s*\)\s*{/, '[data-colored-header=false] & {')
|
|
70
|
+
// what couldn't be changed
|
|
71
|
+
.replace(/^(.*@config-dark-mode.*)$/gm, '$1 /* @TODO: use [data-theme^=dark] and [data-theme^=light] instead */')
|
|
72
|
+
.replace(/^(.*@config-colored-header.*)$/gm, '$1 /* @TODO: use [data-colored-header=true] and [data-colored-header=false] instead */')
|
|
73
|
+
// calculations
|
|
74
|
+
.replace(/:\s*(var\(.*?\)\s*[*+/-]\s*[^;]+);/g, ': calc(~"$1");')
|
|
75
|
+
.replace(/:\s*(-\s*var\(.*?\)\s*[*+/-]\s*[^;]+);/g, ': calc(~"0px$1");');
|
|
76
|
+
if (Object.entries(declarations).length > 0) {
|
|
77
|
+
let newLightVars = '[data-theme^=light] {';
|
|
78
|
+
let newDarkVars = '[data-theme^=dark] {';
|
|
79
|
+
for (const [varName, { light, dark }] of Object.entries(declarations)) {
|
|
80
|
+
newLightVars += `\n ${varName}: ${light};`;
|
|
81
|
+
newDarkVars += `\n ${varName}: ${dark};`;
|
|
82
|
+
}
|
|
83
|
+
newLightVars += '\n}';
|
|
84
|
+
newDarkVars += '\n}';
|
|
85
|
+
code += `\n\n${newLightVars}\n${newDarkVars}`;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
updated: code,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
targets() {
|
|
94
|
+
return ['less/**/*', 'resources/less/**/*'];
|
|
95
|
+
}
|
|
96
|
+
gitCommit() {
|
|
97
|
+
return {
|
|
98
|
+
message: 'chore(2.0): `LESS` code changes',
|
|
99
|
+
description: 'Many variables have been renamed to light/dark specific names and most are now used as CSS variables instead.',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
pauseMessage() {
|
|
103
|
+
const link = 'https://docs.flarum.org/2.x/extend/update-2_0/#less-preprocessing';
|
|
104
|
+
const readMore = chalk_1.default.dim(`Read more: ${link}`);
|
|
105
|
+
const dataThemeDark = chalk_1.default.yellow.bold('[data-theme^=dark]');
|
|
106
|
+
const dataThemeLight = chalk_1.default.yellow.bold('[data-theme^=light]');
|
|
107
|
+
const dataColoredHeader = chalk_1.default.yellow.bold('[data-colored-header=true]');
|
|
108
|
+
const dataColoredHeaderFalse = chalk_1.default.yellow.bold('[data-colored-header=false]');
|
|
109
|
+
const configDarkMode = chalk_1.default.yellow('@config-dark-mode');
|
|
110
|
+
const configColoredHeader = chalk_1.default.yellow('@config-colored-header');
|
|
111
|
+
return `Many variables have been renamed to light/dark specific names and most are now used as CSS variables instead.
|
|
112
|
+
Light/Dark modes are now handled using vanilla CSS variables.
|
|
113
|
+
|
|
114
|
+
The ${configDarkMode} and ${configColoredHeader} variables no longer exist, use instead the following selectors:
|
|
115
|
+
- ${dataThemeDark} for dark mode
|
|
116
|
+
- ${dataThemeLight} for light mode
|
|
117
|
+
- ${dataColoredHeader} for colored header
|
|
118
|
+
- ${dataColoredHeaderFalse} for non-colored header
|
|
119
|
+
|
|
120
|
+
${readMore}`;
|
|
121
|
+
}
|
|
122
|
+
static vars() {
|
|
123
|
+
return [...LessChanges.MODE_SPECIFIC_VARS, ...LessChanges.VARS];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.default = LessChanges;
|
|
127
|
+
LessChanges.MODE_SPECIFIC_VARS = [
|
|
128
|
+
'body-bg',
|
|
129
|
+
'text-color',
|
|
130
|
+
'heading-color',
|
|
131
|
+
'muted-color',
|
|
132
|
+
'muted-more-color',
|
|
133
|
+
'shadow-color',
|
|
134
|
+
'control-bg',
|
|
135
|
+
'control-color',
|
|
136
|
+
'control-danger-bg',
|
|
137
|
+
'control-danger-color',
|
|
138
|
+
'header-bg',
|
|
139
|
+
'header-color',
|
|
140
|
+
'header-control-bg',
|
|
141
|
+
'header-control-color',
|
|
142
|
+
'header-bg-colored',
|
|
143
|
+
'header-color-colored',
|
|
144
|
+
'header-control-bg-colored',
|
|
145
|
+
'header-control-color-colored',
|
|
146
|
+
'overlay-bg',
|
|
147
|
+
'code-bg',
|
|
148
|
+
'code-color',
|
|
149
|
+
];
|
|
150
|
+
LessChanges.VARS = [
|
|
151
|
+
'primary-color',
|
|
152
|
+
'secondary-color',
|
|
153
|
+
'control-success-bg',
|
|
154
|
+
'control-success-color',
|
|
155
|
+
'control-warning-bg',
|
|
156
|
+
'control-warning-color',
|
|
157
|
+
'error-color',
|
|
158
|
+
'alert-bg',
|
|
159
|
+
'alert-color',
|
|
160
|
+
'alert-error-bg',
|
|
161
|
+
'alert-error-color',
|
|
162
|
+
'alert-success-bg',
|
|
163
|
+
'alert-success-color',
|
|
164
|
+
'validation-error-color',
|
|
165
|
+
'drawer-width',
|
|
166
|
+
'pane-width',
|
|
167
|
+
'header-height',
|
|
168
|
+
'header-height-phone',
|
|
169
|
+
'border-radius',
|
|
170
|
+
'zindex-header',
|
|
171
|
+
'zindex-pane',
|
|
172
|
+
'zindex-composer',
|
|
173
|
+
'zindex-dropdown',
|
|
174
|
+
'zindex-modal-background',
|
|
175
|
+
'zindex-modal',
|
|
176
|
+
'zindex-alerts',
|
|
177
|
+
'zindex-tooltip',
|
|
178
|
+
'tooltip-bg',
|
|
179
|
+
'tooltip-color',
|
|
180
|
+
'online-user-circle-color',
|
|
181
|
+
'link-color',
|
|
182
|
+
'text-on-dark',
|
|
183
|
+
'text-on-light',
|
|
184
|
+
];
|
|
185
|
+
LessChanges.MIXINS = [
|
|
186
|
+
'animation',
|
|
187
|
+
'animation-name',
|
|
188
|
+
'animation-duration',
|
|
189
|
+
'animation-timing-function',
|
|
190
|
+
'animation-delay',
|
|
191
|
+
'animation-iteration-count',
|
|
192
|
+
'animation-direction',
|
|
193
|
+
'animation-fill-mode',
|
|
194
|
+
'backface-visibility',
|
|
195
|
+
'box-shadow',
|
|
196
|
+
'box-sizing',
|
|
197
|
+
'content-columns',
|
|
198
|
+
'hyphens',
|
|
199
|
+
'scale',
|
|
200
|
+
'scaleX',
|
|
201
|
+
'scaleY',
|
|
202
|
+
'skew',
|
|
203
|
+
'translate',
|
|
204
|
+
'translate3d',
|
|
205
|
+
'rotate',
|
|
206
|
+
'rotateX',
|
|
207
|
+
'rotateY',
|
|
208
|
+
'perspective',
|
|
209
|
+
'perspective-origin',
|
|
210
|
+
'transform-origin',
|
|
211
|
+
'transition',
|
|
212
|
+
'transition-property',
|
|
213
|
+
'transition-delay',
|
|
214
|
+
'transition-duration',
|
|
215
|
+
'transition-timing-function',
|
|
216
|
+
'transition-transform',
|
|
217
|
+
];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const php_provider_1 = require("../providers/php-provider");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const t = tslib_1.__importStar(require("@babel/types"));
|
|
7
|
+
const ast_1 = require("./ast");
|
|
8
|
+
function addExtenders(path, extenders, frontend) {
|
|
9
|
+
var _a;
|
|
10
|
+
const code = fs.readFileSync(path, 'utf-8');
|
|
11
|
+
const ast = (0, ast_1.parseCode)(code);
|
|
12
|
+
const importing = applyImportsForExtenders(ast, extenders, frontend);
|
|
13
|
+
// The code would contain something like:
|
|
14
|
+
// const extenders = [
|
|
15
|
+
// new Extend.Routes() //
|
|
16
|
+
// .add('flags', '/flags', FlagsPage),
|
|
17
|
+
// ];
|
|
18
|
+
//
|
|
19
|
+
// export default extenders;
|
|
20
|
+
// We need to add the new extender to the array.
|
|
21
|
+
// We can do this by finding the array and adding the new extender to it.
|
|
22
|
+
const array = findExtendersArray(ast);
|
|
23
|
+
const expressions = [];
|
|
24
|
+
for (const extender of extenders) {
|
|
25
|
+
const classPath = extender.extender.className;
|
|
26
|
+
const className = classPath.split('/').pop();
|
|
27
|
+
// Before creating a newExtender, find an existing one.
|
|
28
|
+
let newExtender = [...array.elements, ...expressions].find(function (element) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if ((element === null || element === void 0 ? void 0 : element.type) !== 'SequenceExpression' && (element === null || element === void 0 ? void 0 : element.type) !== 'CallExpression' && (element === null || element === void 0 ? void 0 : element.type) !== 'NewExpression') {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
let newExpression = null;
|
|
34
|
+
if (element.type === 'NewExpression') {
|
|
35
|
+
newExpression = element;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
let callExpression = null;
|
|
39
|
+
if (element.type === 'SequenceExpression') {
|
|
40
|
+
callExpression = element.expressions[element.expressions.length - 1];
|
|
41
|
+
}
|
|
42
|
+
if (element.type === 'CallExpression') {
|
|
43
|
+
callExpression = element;
|
|
44
|
+
}
|
|
45
|
+
if (!callExpression) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (((_a = callExpression.callee) === null || _a === void 0 ? void 0 : _a.type) === 'NewExpression') {
|
|
49
|
+
newExpression = callExpression.callee;
|
|
50
|
+
}
|
|
51
|
+
else if (((_b = callExpression.callee) === null || _b === void 0 ? void 0 : _b.type) === 'MemberExpression') {
|
|
52
|
+
newExpression = (0, ast_1.findNewExpressionWithinNestedMemberExpression)(callExpression.callee);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!newExpression) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const sameName = newExpression.callee.type === 'MemberExpression'
|
|
59
|
+
? newExpression.callee.property.name === className
|
|
60
|
+
: newExpression.callee.name === className;
|
|
61
|
+
return sameName && (0, ast_1.sameArguments)(ast, newExpression.arguments, extender.extender.args);
|
|
62
|
+
});
|
|
63
|
+
const extenderExists = Boolean(newExtender);
|
|
64
|
+
// Create the new extender expression.
|
|
65
|
+
if (!newExtender) {
|
|
66
|
+
newExtender = t.newExpression(t.identifier(importing.qualifiedModule(classPath)), ((_a = extender.extender.args) === null || _a === void 0 ? void 0 : _a.map((arg) => {
|
|
67
|
+
return (0, ast_1.argumentsExpressions)([arg])[0];
|
|
68
|
+
})) || []);
|
|
69
|
+
}
|
|
70
|
+
let callExpression = null;
|
|
71
|
+
// Wrap the new extender in a statement for method calls if any
|
|
72
|
+
if (extender.methodCalls) {
|
|
73
|
+
for (const methodCall of extender.methodCalls) {
|
|
74
|
+
if ((0, ast_1.findCallExpression)(newExtender, methodCall)) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
callExpression = t.callExpression(t.memberExpression(callExpression !== null && callExpression !== void 0 ? callExpression : newExtender, t.identifier(methodCall.methodName)), methodCall.args ? (0, ast_1.argumentsExpressions)(methodCall.args) : []);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const expression = callExpression ? callExpression : newExtender;
|
|
81
|
+
if (extenderExists) {
|
|
82
|
+
// replace
|
|
83
|
+
array.elements[array.elements.indexOf(newExtender)] = expression;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
expressions.push(expression);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
array.elements.push(...expressions);
|
|
90
|
+
(0, ast_1.generateCode)(ast, true).then((formattedCode) => fs.writeFileSync(path, formattedCode));
|
|
91
|
+
}
|
|
92
|
+
exports.default = addExtenders;
|
|
93
|
+
function applyImportsForExtenders(ast, extenders, frontend) {
|
|
94
|
+
const modules = extenders.map((extender) => extender.extender.className);
|
|
95
|
+
modules.push(...extenders.flatMap((extender) => { var _a; return ((_a = extender.extender.args) === null || _a === void 0 ? void 0 : _a.filter((arg) => arg.type === php_provider_1.ExpressionType.CLASS_CONST).map((arg) => arg.value)) || []; }), ...extenders.flatMap((extender) => {
|
|
96
|
+
var _a;
|
|
97
|
+
return ((_a = extender.methodCalls) === null || _a === void 0 ? void 0 : _a.flatMap((methodCall) => { var _a; return ((_a = methodCall.args) === null || _a === void 0 ? void 0 : _a.filter((arg) => arg.type === php_provider_1.ExpressionType.CLASS_CONST).map((arg) => arg.value)) || []; })) || [];
|
|
98
|
+
}));
|
|
99
|
+
return (0, ast_1.applyImports)(ast, frontend, modules.map((module) => {
|
|
100
|
+
return {
|
|
101
|
+
name: module.split('/').pop(),
|
|
102
|
+
path: module,
|
|
103
|
+
defaultImport: true,
|
|
104
|
+
};
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
function findExtendersArray(ast) {
|
|
108
|
+
let defaultExport = ast.program.body.find((node) => {
|
|
109
|
+
return node.type === 'ExportDefaultDeclaration' && node.declaration.type === 'ArrayExpression';
|
|
110
|
+
});
|
|
111
|
+
if (!defaultExport) {
|
|
112
|
+
ast.program.body.push((defaultExport = t.exportDefaultDeclaration(t.arrayExpression([]))));
|
|
113
|
+
}
|
|
114
|
+
return defaultExport.declaration;
|
|
115
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { MemberExpression, NewExpression } from '@babel/types';
|
|
3
|
+
import { ExpressionSpec, MethodCallSpec } from '../providers/php-provider';
|
|
4
|
+
export declare function parseCode(code: string): t.File;
|
|
5
|
+
export declare function generateCode(ast: t.File, extenders?: boolean): Promise<string>;
|
|
6
|
+
export type ModuleImport = {
|
|
7
|
+
name: string;
|
|
8
|
+
path: string;
|
|
9
|
+
defaultImport: boolean;
|
|
10
|
+
preferGroupImport?: boolean;
|
|
11
|
+
useNamedGroupImport?: string | null;
|
|
12
|
+
};
|
|
13
|
+
export declare function applyImports(ast: t.File, frontend: string, modules: ModuleImport[]): {
|
|
14
|
+
qualifiedModule: (name: string | ModuleImport) => string;
|
|
15
|
+
};
|
|
16
|
+
export declare function populateImports(ast: t.File, module: ModuleImport, defaultImports: Record<string, t.ImportDefaultSpecifier | null>, specificImports: Record<string, t.ImportSpecifier[] | null>, frontend: string, insertAt?: number | null): void;
|
|
17
|
+
export declare function findNewExpressionWithinNestedMemberExpression(memberExpression: MemberExpression): NewExpression | null;
|
|
18
|
+
export declare function findCallExpression(newExtender: t.NewExpression | t.SequenceExpression | t.CallExpression, methodCall: MethodCallSpec): boolean;
|
|
19
|
+
export declare function argumentsExpressions(args: ExpressionSpec[]): Array<t.Expression>;
|
|
20
|
+
export declare function sameArguments(ast: t.File, usedArguments: Array<t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder>, extenderArgs: ExpressionSpec[] | undefined): boolean;
|
|
21
|
+
export declare function formatCode(code: string, extenders?: boolean): Promise<string>;
|
|
22
|
+
export declare function getFunctionName(node: t.Node): string | null;
|
package/lib/utils/ast.js
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFunctionName = exports.formatCode = exports.sameArguments = exports.argumentsExpressions = exports.findCallExpression = exports.findNewExpressionWithinNestedMemberExpression = exports.populateImports = exports.applyImports = exports.generateCode = exports.parseCode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = tslib_1.__importStar(require("@babel/types"));
|
|
6
|
+
const php_provider_1 = require("../providers/php-provider");
|
|
7
|
+
const prettier_1 = tslib_1.__importDefault(require("prettier"));
|
|
8
|
+
const prettierrc_json_1 = tslib_1.__importDefault(require("@flarum/prettier-config/prettierrc.json"));
|
|
9
|
+
// import { parse } from '@babel/parser';
|
|
10
|
+
// import generate from '@babel/generator';
|
|
11
|
+
const recast = tslib_1.__importStar(require("recast"));
|
|
12
|
+
function parseCode(code) {
|
|
13
|
+
try {
|
|
14
|
+
return recast.parse(code, {
|
|
15
|
+
parser: require('recast/parsers/babel-ts'),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.log(code);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.parseCode = parseCode;
|
|
24
|
+
async function generateCode(ast, extenders = false) {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
const generatedCode = recast.print(ast, {
|
|
27
|
+
parser: require('recast/parsers/babel-ts'),
|
|
28
|
+
}).code;
|
|
29
|
+
// Format the code
|
|
30
|
+
return formatCode(generatedCode, extenders);
|
|
31
|
+
}
|
|
32
|
+
exports.generateCode = generateCode;
|
|
33
|
+
function applyImports(ast, frontend, modules) {
|
|
34
|
+
const defaultImports = {};
|
|
35
|
+
const specificImports = {};
|
|
36
|
+
modules.forEach((module) => populateImports(ast, module, defaultImports, specificImports, frontend));
|
|
37
|
+
return {
|
|
38
|
+
qualifiedModule(module) {
|
|
39
|
+
let isFullPath = true;
|
|
40
|
+
if (typeof module === 'string') {
|
|
41
|
+
isFullPath = module.includes('/');
|
|
42
|
+
module = {
|
|
43
|
+
name: module.split('/').pop(),
|
|
44
|
+
path: module,
|
|
45
|
+
defaultImport: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
let specificImportDeclarations = null;
|
|
49
|
+
if (isFullPath) {
|
|
50
|
+
specificImportDeclarations = specificImports[`${module.path}:${module.name}`];
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
Object.keys(specificImports).forEach((key) => {
|
|
54
|
+
if (key.endsWith(`:${module.name}`)) {
|
|
55
|
+
specificImportDeclarations = specificImports[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const specifier = specificImportDeclarations === null || specificImportDeclarations === void 0 ? void 0 : specificImportDeclarations.find((specifier) => { var _a; return ((_a = specifier === null || specifier === void 0 ? void 0 : specifier.imported) === null || _a === void 0 ? void 0 : _a.name) === module.name; });
|
|
60
|
+
if (specifier) {
|
|
61
|
+
return specifier.local.name;
|
|
62
|
+
}
|
|
63
|
+
let defaultImportDeclaration = null;
|
|
64
|
+
if (isFullPath) {
|
|
65
|
+
defaultImportDeclaration = defaultImports[`${module.path}:${module.name}`];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
Object.keys(defaultImports).forEach((key) => {
|
|
69
|
+
if (key.endsWith(`:${module.name}`)) {
|
|
70
|
+
defaultImportDeclaration = defaultImports[key];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (!module.defaultImport || module.preferGroupImport || (defaultImportDeclaration === null || defaultImportDeclaration === void 0 ? void 0 : defaultImportDeclaration.local.name) !== module.name) {
|
|
75
|
+
return `${defaultImportDeclaration.local.name}.${module.name}`;
|
|
76
|
+
}
|
|
77
|
+
return (defaultImportDeclaration === null || defaultImportDeclaration === void 0 ? void 0 : defaultImportDeclaration.local.name) || module.name;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
exports.applyImports = applyImports;
|
|
82
|
+
function relativizePath(path, root) {
|
|
83
|
+
return path.replace(new RegExp(`^${root}`), '.').replace(/^common/, '../common');
|
|
84
|
+
}
|
|
85
|
+
function populateImports(ast, module, defaultImports, specificImports, frontend, insertAt = null) {
|
|
86
|
+
var _a, _b, _c;
|
|
87
|
+
const preferDefaultImport = module.defaultImport || (module.preferGroupImport && module.useNamedGroupImport);
|
|
88
|
+
let defaultImportDeclaration = null;
|
|
89
|
+
const relativePath = relativizePath(module.path, frontend);
|
|
90
|
+
const searchedPaths = [relativePath];
|
|
91
|
+
if (module.preferGroupImport || module.defaultImport) {
|
|
92
|
+
searchedPaths.push(relativePath.split('/').slice(0, -1).join('/'));
|
|
93
|
+
}
|
|
94
|
+
if (preferDefaultImport) {
|
|
95
|
+
defaultImportDeclaration = ((_b = (_a = ast.program.body.find((node) => {
|
|
96
|
+
return (node.type === 'ImportDeclaration' &&
|
|
97
|
+
searchedPaths.includes(node.source.value) &&
|
|
98
|
+
node.specifiers.some((specifier) => specifier.type === 'ImportDefaultSpecifier'));
|
|
99
|
+
})) === null || _a === void 0 ? void 0 : _a.specifiers[0]) !== null && _b !== void 0 ? _b : null);
|
|
100
|
+
}
|
|
101
|
+
let specificImportDeclarations = (_c = ast.program.body.find((node) => {
|
|
102
|
+
return (node.type === 'ImportDeclaration' &&
|
|
103
|
+
searchedPaths.includes(node.source.value) &&
|
|
104
|
+
node.specifiers.some((specifier) => specifier.type === 'ImportSpecifier'));
|
|
105
|
+
})) === null || _c === void 0 ? void 0 : _c.specifiers;
|
|
106
|
+
if (!defaultImportDeclaration && !(specificImportDeclarations === null || specificImportDeclarations === void 0 ? void 0 : specificImportDeclarations.length) && preferDefaultImport) {
|
|
107
|
+
if (!module.preferGroupImport) {
|
|
108
|
+
defaultImportDeclaration = t.importDefaultSpecifier(t.identifier(module.name));
|
|
109
|
+
const declaration = t.importDeclaration([defaultImportDeclaration], t.stringLiteral(relativePath));
|
|
110
|
+
if (!insertAt) {
|
|
111
|
+
ast.program.body.unshift(declaration);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
ast.program.body.splice(insertAt, 0, declaration);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (module.useNamedGroupImport) {
|
|
118
|
+
defaultImportDeclaration = t.importDefaultSpecifier(t.identifier(module.useNamedGroupImport));
|
|
119
|
+
const declaration = t.importDeclaration([defaultImportDeclaration], t.stringLiteral(relativePath.split('/').slice(0, -1).join('/')));
|
|
120
|
+
if (!insertAt) {
|
|
121
|
+
ast.program.body.unshift(declaration);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
ast.program.body.splice(insertAt, 0, declaration);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (!defaultImportDeclaration &&
|
|
129
|
+
((specificImportDeclarations && specificImportDeclarations.length > 0) ||
|
|
130
|
+
(module.preferGroupImport && !module.useNamedGroupImport) ||
|
|
131
|
+
(!module.defaultImport && !module.preferGroupImport))) {
|
|
132
|
+
const imported = new Set((specificImportDeclarations === null || specificImportDeclarations === void 0 ? void 0 : specificImportDeclarations.map((specifier) => specifier.imported.name)) || []);
|
|
133
|
+
const notImported = !imported.has(module.name);
|
|
134
|
+
if (notImported) {
|
|
135
|
+
const path = relativizePath(module.preferGroupImport ? module.path.split('/').slice(0, -1).join('/') : module.path, frontend);
|
|
136
|
+
const newImports = t.importDeclaration([t.importSpecifier(t.identifier(module.name), t.identifier(module.name))], t.stringLiteral(path));
|
|
137
|
+
if (specificImportDeclarations) {
|
|
138
|
+
specificImportDeclarations.push(...newImports.specifiers);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
specificImportDeclarations = newImports.specifiers;
|
|
142
|
+
if (!insertAt) {
|
|
143
|
+
ast.program.body.unshift(newImports);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
ast.program.body.splice(insertAt, 0, newImports);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
defaultImports[`${module.path}:${module.name}`] = defaultImportDeclaration;
|
|
152
|
+
specificImports[`${module.path}:${module.name}`] = specificImportDeclarations;
|
|
153
|
+
}
|
|
154
|
+
exports.populateImports = populateImports;
|
|
155
|
+
function findNewExpressionWithinNestedMemberExpression(memberExpression) {
|
|
156
|
+
if (memberExpression.object.type === 'NewExpression') {
|
|
157
|
+
return memberExpression.object;
|
|
158
|
+
}
|
|
159
|
+
if (memberExpression.object.type === 'CallExpression' && memberExpression.object.callee.type === 'MemberExpression') {
|
|
160
|
+
return findNewExpressionWithinNestedMemberExpression(memberExpression.object.callee);
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
exports.findNewExpressionWithinNestedMemberExpression = findNewExpressionWithinNestedMemberExpression;
|
|
165
|
+
function findCallExpression(newExtender, methodCall) {
|
|
166
|
+
if (newExtender.type === 'NewExpression' || newExtender.type === 'SequenceExpression') {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
let found = newExtender.type === 'CallExpression' &&
|
|
170
|
+
newExtender.callee.type === 'MemberExpression' &&
|
|
171
|
+
newExtender.callee.property.type === 'Identifier' &&
|
|
172
|
+
newExtender.callee.property.name === methodCall.methodName &&
|
|
173
|
+
JSON.stringify(newExtender.arguments.map((arg) => arg.value)) ===
|
|
174
|
+
JSON.stringify((methodCall.args || []).map((arg) => arg.value));
|
|
175
|
+
if (!found && newExtender.callee.type === 'MemberExpression' && newExtender.callee.object.type === 'CallExpression') {
|
|
176
|
+
found = findCallExpression(newExtender.callee.object, methodCall);
|
|
177
|
+
}
|
|
178
|
+
return found;
|
|
179
|
+
}
|
|
180
|
+
exports.findCallExpression = findCallExpression;
|
|
181
|
+
function argumentsExpressions(args) {
|
|
182
|
+
return args.map((arg) => {
|
|
183
|
+
switch (arg.type) {
|
|
184
|
+
case php_provider_1.ExpressionType.SCALAR:
|
|
185
|
+
return t.stringLiteral(arg.value);
|
|
186
|
+
case php_provider_1.ExpressionType.CLASS_CONST:
|
|
187
|
+
return t.identifier(arg.value.split('/').pop());
|
|
188
|
+
case php_provider_1.ExpressionType.CLOSURE:
|
|
189
|
+
return t.arrowFunctionExpression(arg.value.params.map((param) => t.identifier(param.name)), t.blockStatement([]));
|
|
190
|
+
// case ExpressionType.VARIABLE:
|
|
191
|
+
default:
|
|
192
|
+
return t.identifier(arg.value);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
exports.argumentsExpressions = argumentsExpressions;
|
|
197
|
+
function sameArguments(ast, usedArguments, extenderArgs) {
|
|
198
|
+
const argumentValues = usedArguments
|
|
199
|
+
.map((arg) => {
|
|
200
|
+
var _a;
|
|
201
|
+
if (arg.type === 'StringLiteral') {
|
|
202
|
+
return arg.value;
|
|
203
|
+
}
|
|
204
|
+
// return full module path
|
|
205
|
+
if (arg.type === 'Identifier') {
|
|
206
|
+
const path = (_a = ast.program.body.find((node) => {
|
|
207
|
+
return node.type === 'ImportDeclaration' && node.specifiers.some((specifier) => specifier.local.name === arg.name);
|
|
208
|
+
})) === null || _a === void 0 ? void 0 : _a.source.value;
|
|
209
|
+
return path ? `${path}/${arg.name}` : arg.name;
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
})
|
|
213
|
+
.filter((value) => value !== null);
|
|
214
|
+
const configuredArgs = (extenderArgs === null || extenderArgs === void 0 ? void 0 : extenderArgs.map((arg) => arg.value)) || [];
|
|
215
|
+
return JSON.stringify(argumentValues) === JSON.stringify(configuredArgs);
|
|
216
|
+
}
|
|
217
|
+
exports.sameArguments = sameArguments;
|
|
218
|
+
function formatCode(code, extenders = false) {
|
|
219
|
+
const options = Object.assign(Object.assign({}, prettierrc_json_1.default), { parser: 'babel-ts' });
|
|
220
|
+
if (extenders) {
|
|
221
|
+
options.printWidth = 100;
|
|
222
|
+
}
|
|
223
|
+
return prettier_1.default.format(code, options);
|
|
224
|
+
}
|
|
225
|
+
exports.formatCode = formatCode;
|
|
226
|
+
function getFunctionName(node) {
|
|
227
|
+
if (node.type === 'Identifier') {
|
|
228
|
+
return node.name;
|
|
229
|
+
}
|
|
230
|
+
if (node.type === 'MemberExpression') {
|
|
231
|
+
return `${getFunctionName(node.object)}.${getFunctionName(node.property)}`;
|
|
232
|
+
}
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
exports.getFunctionName = getFunctionName;
|