-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
714 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.symfony.bundle.yaml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/assets/src export-ignore | ||
/assets/test export-ignore | ||
/tests export-ignore |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
vendor | ||
composer.lock | ||
.php_cs.cache | ||
.phpunit.result.cache |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
branches: ["2.x"] | ||
maintained_branches: ["2.x"] | ||
doc_dir: "doc" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# CHANGELOG | ||
|
||
## [Unreleased] | ||
|
||
- Create the component. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2023-present Fabien Potencier | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is furnished | ||
to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Symfony UX Router | ||
|
||
**EXPERIMENTAL** This component is currently experimental and is | ||
likely to change, or even change drastically. | ||
|
||
Symfony UX Router integrates [Symfony Router](https://symfony.com/doc/current/routing.html) for JavaScript. | ||
|
||
**This repository is a READ-ONLY sub-tree split**. See | ||
https://github.com/symfony/ux to create issues or submit pull requests. | ||
|
||
## Resources | ||
|
||
- [Documentation](https://symfony.com/bundles/ux-router/current/index.html) | ||
- [Report issues](https://github.com/symfony/ux/issues) and | ||
[send Pull Requests](https://github.com/symfony/ux/pulls) | ||
in the [main Symfony UX repository](https://github.com/symfony/ux) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@symfony/ux-router", | ||
"description": "Symfony Router for JavaScript", | ||
"license": "MIT", | ||
"version": "1.0.0", | ||
"main": "dist/router_controller.js", | ||
"types": "dist/router_controller.d.ts", | ||
"symfony": { | ||
"importmap": { | ||
"intl-messageformat": "^10.2.5", | ||
"@symfony/ux-router": "path:%PACKAGE%/dist/router_controller.js", | ||
"@app/routes": "path:var/routes/index.js", | ||
"@app/routes/configuration": "path:var/routes/configuration.js" | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// TODO |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
export * from './router'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "symfony/ux-router", | ||
"type": "symfony-bundle", | ||
"description": "Exposes Symfony Routes directly to JavaScript.", | ||
"keywords": [ | ||
"symfony-ux" | ||
], | ||
"homepage": "https://symfony.com", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Hugo Alliaume", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Symfony Community", | ||
"homepage": "https://symfony.com/contributors" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Symfony\\UX\\Router\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Symfony\\UX\\Router\\Tests\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=8.1", | ||
"symfony/console": "^5.4|^6.0|^7.0", | ||
"symfony/filesystem": "^5.4|^6.0|^7.0", | ||
"symfony/string": "^5.4|^6.0|^7.0" | ||
}, | ||
"require-dev": { | ||
"symfony/framework-bundle": "^5.4|^6.0|^7.0", | ||
"symfony/phpunit-bridge": "^5.2|^6.0|^7.0", | ||
"symfony/var-dumper": "^5.4|^6.0|^7.0" | ||
}, | ||
"extra": { | ||
"thanks": { | ||
"name": "symfony/ux", | ||
"url": "https://github.com/symfony/ux" | ||
} | ||
}, | ||
"minimum-stability": "dev" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\UX\Router\CacheWarmer\RoutesCacheWarmer; | ||
use Symfony\UX\Router\RoutesDumper; | ||
|
||
/* | ||
* @author Hugo Alliaume <[email protected]> | ||
*/ | ||
return static function (ContainerConfigurator $container): void { | ||
$container->services() | ||
->set('ux.router.cache_warmer.routes_cache_warmer', RoutesCacheWarmer::class) | ||
->args([ | ||
service('router'), | ||
service('ux.router.routes_dumper'), | ||
]) | ||
->tag('kernel.cache_warmer') | ||
|
||
->set('ux.router.routes_dumper', RoutesDumper::class) | ||
->args([ | ||
null, // Dump directory | ||
service('filesystem'), | ||
]) | ||
; | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Symfony UX Router | ||
================= | ||
|
||
**EXPERIMENTAL** This component is currently experimental and is likely | ||
to change, or even change drastically. | ||
|
||
// ... | ||
|
||
Installation | ||
------------ | ||
|
||
Usage | ||
----- | ||
|
||
Configuring the default locale | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
// ... | ||
|
||
Importing and using routes | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
// ... | ||
|
||
.. _using-with-asset-mapper: | ||
|
||
Using with AssetMapper | ||
---------------------- | ||
|
||
// ... | ||
|
||
Backward Compatibility promise | ||
------------------------------ | ||
|
||
This bundle aims at following the same Backward Compatibility promise as | ||
the Symfony framework: | ||
https://symfony.com/doc/current/contributing/code/bc.html | ||
|
||
// ... |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html --> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
bootstrap="vendor/autoload.php" | ||
failOnRisky="true" | ||
failOnWarning="true"> | ||
<php> | ||
<ini name="error_reporting" value="-1" /> | ||
<ini name="intl.default_locale" value="en" /> | ||
<ini name="intl.error_level" value="0" /> | ||
<ini name="memory_limit" value="-1" /> | ||
<env name="SHELL_VERBOSITY" value="-1" /> | ||
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&max[direct]=0"/> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>./src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\UX\Router\CacheWarmer; | ||
|
||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; | ||
use Symfony\UX\Router\RoutesDumper; | ||
|
||
/** | ||
* @author Hugo Alliaume <[email protected]> | ||
* | ||
* @experimental | ||
*/ | ||
class RoutesCacheWarmer implements CacheWarmerInterface | ||
{ | ||
public function __construct( | ||
private RoutesDumper $routesDumper, | ||
) { | ||
} | ||
|
||
public function isOptional(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function warmUp(string $cacheDir, string $buildDir = null): array | ||
{ | ||
$this->routesDumper->dump( | ||
// TODO: pass routes collection | ||
); | ||
|
||
// No need to preload anything | ||
return []; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\UX\Router\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/** | ||
* @author Hugo Alliaume <[email protected]> | ||
* | ||
* @experimental | ||
*/ | ||
class Configuration implements ConfigurationInterface | ||
{ | ||
public function getConfigTreeBuilder(): TreeBuilder | ||
{ | ||
$treeBuilder = new TreeBuilder('ux_router'); | ||
$rootNode = $treeBuilder->getRootNode(); | ||
$rootNode | ||
->children() | ||
->scalarNode('dump_directory')->defaultValue('%kernel.project_dir%/var/routes')->end() | ||
->end() | ||
; | ||
|
||
return $treeBuilder; | ||
} | ||
} |
Oops, something went wrong.